first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1,216 @@
<?php
/**
* @version $Id: comments.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 ;
jimport('joomla.application.component.controller');
class K2ControllerComments extends K2Controller
{
public function display($cachable = false, $urlparams = array())
{
$user = JFactory::getUser();
if ($user->guest)
{
$uri = JFactory::getURI();
if (K2_JVERSION != '15')
{
$url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString());
}
else
{
$url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString());
}
$application = JFactory::getApplication();
$application->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
JRequest::setVar('tmpl', 'component');
$params = JComponentHelper::getParams('com_k2');
$document = JFactory::getDocument();
if (version_compare(JVERSION, '1.6.0', 'ge'))
{
JHtml::_('behavior.framework');
}
else
{
JHTML::_('behavior.mootools');
}
// Language
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
// CSS
$document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.css?v=2.6.7');
// JS
K2HelperHTML::loadjQuery(true);
$document->addScript(JURI::root(true).'/media/k2/assets/js/k2.js?v=2.6.7&amp;sitepath='.JURI::root(true).'/');
$this->addViewPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views');
$this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
$view = $this->getView('comments', 'html');
$view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'comments'.DS.'tmpl');
$view->addHelperPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'helpers');
$view->display();
}
function publish()
{
JRequest::checkToken() or jexit('Invalid Token');
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
$user = JFactory::getUser();
if ($user->guest)
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
$model = K2Model::getInstance('Comments', 'K2Model');
$model->publish();
}
function unpublish()
{
JRequest::checkToken() or jexit('Invalid Token');
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
$user = JFactory::getUser();
if ($user->guest)
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
$model = K2Model::getInstance('Comments', 'K2Model');
$model->unpublish();
}
function remove()
{
JRequest::checkToken() or jexit('Invalid Token');
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
$user = JFactory::getUser();
if ($user->guest)
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
$model = K2Model::getInstance('Comments', 'K2Model');
$model->remove();
}
function deleteUnpublished()
{
JRequest::checkToken() or jexit('Invalid Token');
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
$user = JFactory::getUser();
if ($user->guest)
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
$model = K2Model::getInstance('Comments', 'K2Model');
$model->deleteUnpublished();
}
function saveComment()
{
JRequest::checkToken() or jexit('Invalid Token');
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
$user = JFactory::getUser();
if ($user->guest)
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
$model = K2Model::getInstance('Comments', 'K2Model');
$model->save();
$mainframe->close();
}
function report()
{
JRequest::setVar('tmpl', 'component');
$view = $this->getView('comments', 'html');
$view->setLayout('report');
$view->report();
}
function sendReport()
{
JRequest::checkToken() or jexit('Invalid Token');
$params = K2HelperUtilities::getParams('com_k2');
$user = JFactory::getUser();
if (!$params->get('comments') || !$params->get('commentsReporting') || ($params->get('commentsReporting') == '2' && $user->guest))
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
K2Model::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
$model = K2Model::getInstance('Comments', 'K2Model');
$model->setState('id', JRequest::getInt('id'));
$model->setState('name', JRequest::getString('name'));
$model->setState('reportReason', JRequest::getString('reportReason'));
if (!$model->report())
{
echo $model->getError();
}
else
{
echo JText::_('K2_REPORT_SUBMITTED');
}
$mainframe = JFactory::getApplication();
$mainframe->close();
}
function reportSpammer()
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$format = JRequest::getVar('format');
$errors = array();
if (K2_JVERSION != '15')
{
if (!$user->authorise('core.admin', 'com_k2'))
{
$format == 'raw' ? die(JText::_('K2_ALERTNOTAUTH')) : JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
}
else
{
if ($user->gid < 25)
{
$format == 'raw' ? die(JText::_('K2_ALERTNOTAUTH')) : JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
}
K2Model::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'models');
$model = K2Model::getInstance('User', 'K2Model');
$model->setState('id', JRequest::getInt('id'));
$model->reportSpammer();
if ($format == 'raw')
{
$response = '';
$messages = $mainframe->getMessageQueue();
foreach ($messages as $message)
{
$response .= $message['message']."\n";
}
die($response);
}
$this->setRedirect('index.php?option=com_k2&view=comments&tmpl=component');
}
}

View 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);
}
}
}

View File

@ -0,0 +1,404 @@
<?php
/**
* @version $Id: item.php 1985 2013-06-25 16:58:55Z 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())
{
$model = $this->getModel('itemlist');
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView('item', $viewType);
$view->setModel($model);
JRequest::setVar('view', 'item');
$user = JFactory::getUser();
if ($user->guest)
{
$cache = true;
}
else
{
$cache = true;
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$row = JTable::getInstance('K2Item', 'Table');
$row->load(JRequest::getInt('id'));
if (K2HelperPermissions::canEditItem($row->created_by, $row->catid))
{
$cache = false;
}
$params = K2HelperUtilities::getParams('com_k2');
if ($row->created_by == $user->id && $params->get('inlineCommentsModeration'))
{
$cache = false;
}
if ($row->access > 0)
{
$cache = false;
}
$category = JTable::getInstance('K2Category', 'Table');
$category->load($row->catid);
if ($category->access > 0)
{
$cache = false;
}
if ($params->get('comments') && $document->getType() == 'html')
{
$itemListModel = K2Model::getInstance('Itemlist', 'K2Model');
$profile = $itemListModel->getUserProfile($user->id);
$script = "
\$K2(document).ready(function() {
\$K2('#userName').val('".$view->escape($user->name)."').attr('disabled', 'disabled');
\$K2('#commentEmail').val('".$user->email."').attr('disabled', 'disabled');";
if (is_object($profile) && $profile->url)
{
$script .= " \$K2('#commentURL').val('".htmlspecialchars($profile->url, ENT_QUOTES, 'UTF-8')."').attr('disabled', 'disabled');";
}
$script .= " });";
$document->addScriptDeclaration($script);
}
}
if (K2_JVERSION != '15')
{
$urlparams['id'] = 'INT';
$urlparams['print'] = 'INT';
$urlparams['lang'] = 'CMD';
$urlparams['Itemid'] = 'INT';
}
parent::display($cache, $urlparams);
}
function edit()
{
JRequest::setVar('tmpl', 'component');
$mainframe = JFactory::getApplication();
$params = K2HelperUtilities::getParams('com_k2');
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
$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');
$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');
// JS
K2HelperHTML::loadjQuery(true);
$document->addScript(JURI::root(true).'/media/k2/assets/js/k2.js?v=2.6.7&amp;sitepath='.JURI::root(true).'/');
$this->addViewPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views');
$this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
$view = $this->getView('item', 'html');
$view->setLayout('itemform');
if ($params->get('category'))
{
JRequest::setVar('catid', $params->get('category'));
}
// Look for template files in component folders
$view->addTemplatePath(JPATH_COMPONENT.DS.'templates');
$view->addTemplatePath(JPATH_COMPONENT.DS.'templates'.DS.'default');
// Look for overrides in template folder (K2 template structure)
$view->addTemplatePath(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates');
$view->addTemplatePath(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.'default');
// Look for overrides in template folder (Joomla! template structure)
$view->addTemplatePath(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'default');
$view->addTemplatePath(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2');
// Look for specific K2 theme files
if ($params->get('theme'))
{
$view->addTemplatePath(JPATH_COMPONENT.DS.'templates'.DS.$params->get('theme'));
$view->addTemplatePath(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.$params->get('theme'));
$view->addTemplatePath(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.$params->get('theme'));
}
$view->display();
}
function add()
{
$this->edit();
}
function cancel()
{
$this->setRedirect(JURI::root(true));
return false;
}
function save()
{
$mainframe = JFactory::getApplication();
JRequest::checkToken() or jexit('Invalid Token');
JRequest::setVar('tmpl', 'component');
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'item.php');
$model = new K2ModelItem;
$model->save(true);
$mainframe->close();
}
function deleteAttachment()
{
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'item.php');
$model = new K2ModelItem;
$model->deleteAttachment();
}
function tag()
{
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'tag.php');
$model = new K2ModelTag;
$model->addTag();
}
function tags()
{
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'tag.php');
$model = new K2ModelTag;
$model->tags();
}
function download()
{
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'item.php');
$model = new K2ModelItem;
$model->download();
}
function extraFields()
{
$mainframe = JFactory::getApplication();
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
$itemID = JRequest::getInt('id', NULL);
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$catid = JRequest::getInt('cid');
$category = JTable::getInstance('K2Category', 'Table');
$category->load($catid);
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'extrafield.php');
$extraFieldModel = new K2ModelExtraField;
$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 checkin()
{
$model = $this->getModel('item');
$model->checkin();
}
function vote()
{
$model = $this->getModel('item');
$model->vote();
}
function getVotesNum()
{
$model = $this->getModel('item');
$model->getVotesNum();
}
function getVotesPercentage()
{
$model = $this->getModel('item');
$model->getVotesPercentage();
}
function comment()
{
$model = $this->getModel('item');
$model->comment();
}
function resetHits()
{
JRequest::checkToken() or jexit('Invalid Token');
JRequest::setVar('tmpl', 'component');
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'item.php');
$model = new K2ModelItem;
$model->resetHits();
}
function resetRating()
{
JRequest::checkToken() or jexit('Invalid Token');
JRequest::setVar('tmpl', 'component');
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'item.php');
$model = new K2ModelItem;
$model->resetRating();
}
function media()
{
K2HelperHTML::loadjQuery(true, true);
JRequest::setVar('tmpl', 'component');
$params = K2HelperUtilities::getParams('com_k2');
$document = JFactory::getDocument();
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
$user = JFactory::getUser();
if ($user->guest)
{
$uri = JFactory::getURI();
if (K2_JVERSION != '15')
{
$url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString());
}
else
{
$url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString());
}
$mainframe = JFactory::getApplication();
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
// CSS
$document->addStyleSheet(JURI::root(true).'/media/k2/assets/css/k2.css?v=2.6.7');
// JS
K2HelperHTML::loadjQuery(true);
$document->addScript(JURI::root(true).'/media/k2/assets/js/k2.js?v=2.6.7&amp;sitepath='.JURI::root(true).'/');
$this->addViewPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views');
$view = $this->getView('media', 'html');
$view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'media'.DS.'tmpl');
$view->setLayout('default');
$view->display();
}
function connector()
{
JRequest::setVar('tmpl', 'component');
$user = JFactory::getUser();
if ($user->guest)
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'controllers'.DS.'media.php');
$controller = new K2ControllerMedia();
$controller->connector();
}
function users()
{
$itemID = JRequest::getInt('itemID');
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$item = JTable::getInstance('K2Item', 'Table');
$item->load($itemID);
if (!K2HelperPermissions::canAddItem() && !K2HelperPermissions::canEditItem($item->created_by, $item->catid))
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
$K2Permissions = K2Permissions::getInstance();
if (!$K2Permissions->permissions->get('editAll'))
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
JRequest::setVar('tmpl', 'component');
$mainframe = JFactory::getApplication();
$params = JComponentHelper::getParams('com_k2');
$language = JFactory::getLanguage();
$language->load('com_k2', JPATH_ADMINISTRATOR);
$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');
// JS
K2HelperHTML::loadjQuery(true);
$document->addScript(JURI::root(true).'/media/k2/assets/js/k2.js?v=2.6.7&amp;sitepath='.JURI::root(true).'/');
$this->addViewPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views');
$this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models');
$view = $this->getView('users', 'html');
$view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'users'.DS.'tmpl');
$view->setLayout('element');
$view->display();
}
}

View File

@ -0,0 +1,88 @@
<?php
/**
* @version $Id: itemlist.php 1960 2013-04-11 11:46:46Z 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 K2ControllerItemlist extends K2Controller
{
public function display($cachable = false, $urlparams = array())
{
$model = $this->getModel('item');
$format = JRequest::getWord('format', 'html');
$document = JFactory::getDocument();
$viewType = $document->getType();
$view = $this->getView('itemlist', $viewType);
$view->setModel($model);
$user = JFactory::getUser();
if ($user->guest)
{
$cache = true;
}
else
{
$cache = false;
}
if (K2_JVERSION != '15')
{
$urlparams['limit'] = 'UINT';
$urlparams['limitstart'] = 'UINT';
$urlparams['id'] = 'INT';
$urlparams['tag'] = 'STRING';
$urlparams['searchword'] = 'STRING';
$urlparams['day'] = 'INT';
$urlparams['year'] = 'INT';
$urlparams['month'] = 'INT';
$urlparams['print'] = 'INT';
$urlparams['lang'] = 'CMD';
$urlparams['Itemid'] = 'INT';
}
parent::display($cache, $urlparams);
}
function calendar()
{
require_once (JPATH_SITE.DS.'modules'.DS.'mod_k2_tools'.DS.'includes'.DS.'calendarClass.php');
require_once (JPATH_SITE.DS.'modules'.DS.'mod_k2_tools'.DS.'helper.php');
$mainframe = JFactory::getApplication();
$month = JRequest::getInt('month');
$year = JRequest::getInt('year');
$months = array(JText::_('K2_JANUARY'), JText::_('K2_FEBRUARY'), JText::_('K2_MARCH'), JText::_('K2_APRIL'), JText::_('K2_MAY'), JText::_('K2_JUNE'), JText::_('K2_JULY'), JText::_('K2_AUGUST'), JText::_('K2_SEPTEMBER'), JText::_('K2_OCTOBER'), JText::_('K2_NOVEMBER'), JText::_('K2_DECEMBER'), );
$days = array(JText::_('K2_SUN'), JText::_('K2_MON'), JText::_('K2_TUE'), JText::_('K2_WED'), JText::_('K2_THU'), JText::_('K2_FRI'), JText::_('K2_SAT'), );
$cal = new MyCalendar;
$cal->setMonthNames($months);
$cal->setDayNames($days);
$cal->category = JRequest::getInt('catid');
$cal->setStartDay(1);
if (($month) && ($year))
{
echo $cal->getMonthView($month, $year);
}
else
{
echo $cal->getCurrentMonthView();
}
$mainframe->close();
}
function module()
{
$document = JFactory::getDocument();
$view = $this->getView('itemlist', 'raw');
$model = $this->getModel('itemlist');
$view->setModel($model);
$model = $this->getModel('item');
$view->setModel($model);
$view->module();
}
}

View File

@ -0,0 +1,35 @@
<?php
/**
* @version $Id: latest.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 K2ControllerLatest extends K2Controller
{
public function display($cachable = false, $urlparams = array())
{
$view = $this->getView('latest', 'html');
$model = $this->getModel('itemlist');
$view->setModel($model);
$itemModel = $this->getModel('item');
$view->setModel($itemModel);
$user = JFactory::getUser();
if ($user->guest)
{
$cache = true;
}
else
{
$cache = false;
}
parent::display($cache);
}
}

1019
components/com_k2/css/k2.css Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
/**
* @version $Id: k2.print.css 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
*/
/* Print-specific CSS for K2 */
a.itemPrintThisPage,
div.itemHeader h2.itemTitle span sup,
div.itemToolbar,
div.itemRatingBlock,
div.itemLinks,
div.itemSocialLinksBlock,
div.itemAttachmentsBlock,
div.itemRelated,
div.itemAuthorLatest,
div.itemVideoBlock,
div.itemImageGallery,
div.itemNavigation {display:none;}

View File

@ -0,0 +1,87 @@
<?php
/**
* @version $Id: permissions.j16.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.html.parameter');
class K2HelperPermissions
{
public static function checkPermissions()
{
// Set some variables
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$task = JRequest::getCmd('task');
$id = JRequest::getInt('cid');
//Generic manage check
if (!$user->authorise('core.manage', $option))
{
JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
$mainframe->redirect('index.php');
}
// Determine action for rest checks
$action = false;
if ($mainframe->isAdmin() && $view != '' && $view != 'info')
{
switch($task)
{
case '' :
case 'save' :
case 'apply' :
if (!$id)
{
$action = 'core.create';
}
else
{
$action = 'core.edit';
}
break;
case 'trash' :
case 'remove' :
$action = 'core.delete';
break;
case 'publish' :
case 'unpublish' :
$action = 'core.edit.state';
}
// Edit or Edit own action
if ($action == 'core.edit' && $view == 'item' && $id)
{
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$item = JTable::getInstance('K2Item', 'Table');
$item->load($id);
if ($item->created_by == $user->id)
{
$action = 'core.edit.own';
}
}
// Check the determined action
if ($action)
{
if (!$user->authorise($action, $option))
{
JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
$mainframe->redirect('index.php?option=com_k2');
}
}
}
}
}

View File

@ -0,0 +1,344 @@
<?php
/**
* @version $Id: permissions.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.html.parameter');
class K2HelperPermissions
{
public static function setPermissions()
{
$params = K2HelperUtilities::getParams('com_k2');
$user = JFactory::getUser();
if ($user->guest)
{
return;
}
$K2User = K2HelperPermissions::getK2User($user->id);
if (!is_object($K2User))
{
return;
}
$K2UserGroup = K2HelperPermissions::getK2UserGroup($K2User->group);
if (is_null($K2UserGroup))
{
return;
}
$K2Permissions = K2Permissions::getInstance();
$permissions = K2_JVERSION == '15' ? new JParameter($K2UserGroup->permissions) : new JRegistry($K2UserGroup->permissions);
$K2Permissions->permissions = $permissions;
if ($permissions->get('categories') == 'none')
{
return;
}
else if ($permissions->get('categories') == 'all')
{
if ($permissions->get('add') && $permissions->get('frontEdit') && $params->get('frontendEditing'))
{
$K2Permissions->actions[] = 'add.category.all';
$K2Permissions->actions[] = 'tag';
$K2Permissions->actions[] = 'extraFields';
}
if ($permissions->get('editOwn') && $permissions->get('frontEdit') && $params->get('frontendEditing'))
{
$K2Permissions->actions[] = 'editOwn.item.'.$user->id;
$K2Permissions->actions[] = 'tag';
$K2Permissions->actions[] = 'extraFields';
}
if ($permissions->get('editAll') && $permissions->get('frontEdit') && $params->get('frontendEditing'))
{
$K2Permissions->actions[] = 'editAll.category.all';
$K2Permissions->actions[] = 'tag';
$K2Permissions->actions[] = 'extraFields';
}
if ($permissions->get('publish') && $permissions->get('frontEdit') && $params->get('frontendEditing'))
{
$K2Permissions->actions[] = 'publish.category.all';
}
if ($permissions->get('comment'))
{
$K2Permissions->actions[] = 'comment.category.all';
}
if ($permissions->get('editPublished'))
{
$K2Permissions->actions[] = 'editPublished.category.all';
}
}
else
{
$selectedCategories = $permissions->get('categories', NULL);
if (is_string($selectedCategories))
{
$searchIDs[] = $selectedCategories;
}
else
{
$searchIDs = $selectedCategories;
}
if ($permissions->get('inheritance'))
{
$model = K2Model::getInstance('Itemlist', 'K2Model');
$categories = $model->getCategoryTree($searchIDs);
}
else
{
$categories = $searchIDs;
}
if (is_array($categories) && count($categories))
{
foreach ($categories as $category)
{
if ($permissions->get('add') && $permissions->get('frontEdit') && $params->get('frontendEditing'))
{
$K2Permissions->actions[] = 'add.category.'.$category;
$K2Permissions->actions[] = 'tag';
$K2Permissions->actions[] = 'extraFields';
}
if ($permissions->get('editOwn') && $permissions->get('frontEdit') && $params->get('frontendEditing'))
{
$K2Permissions->actions[] = 'editOwn.item.'.$user->id.'.'.$category;
$K2Permissions->actions[] = 'tag';
$K2Permissions->actions[] = 'extraFields';
}
if ($permissions->get('editAll') && $permissions->get('frontEdit') && $params->get('frontendEditing'))
{
$K2Permissions->actions[] = 'editAll.category.'.$category;
$K2Permissions->actions[] = 'tag';
$K2Permissions->actions[] = 'extraFields';
}
if ($permissions->get('publish') && $permissions->get('frontEdit') && $params->get('frontendEditing'))
{
$K2Permissions->actions[] = 'publish.category.'.$category;
}
if ($permissions->get('comment'))
{
$K2Permissions->actions[] = 'comment.category.'.$category;
}
if ($permissions->get('editPublished'))
{
$K2Permissions->actions[] = 'editPublished.category.'.$category;
}
}
}
}
return;
}
public static function checkPermissions()
{
$view = JRequest::getCmd('view');
if ($view != 'item')
{
return;
}
$task = JRequest::getCmd('task');
$user = JFactory::getUser();
if ($user->guest && ($task == 'add' || $task == 'edit'))
{
$mainframe = JFactory::getApplication();
$uri = JURI::getInstance();
$return = base64_encode($uri->toString());
if (K2_JVERSION == '15')
{
$mainframe->redirect('index.php?option=com_user&view=login&return='.$return.'&tmpl=component', JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice');
}
else
{
$mainframe->redirect('index.php?option=com_users&view=login&return='.$return.'&tmpl=component', JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'), 'notice');
}
}
switch ($task)
{
case 'add' :
if (!K2HelperPermissions::canAddItem())
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
break;
case 'edit' :
case 'deleteAttachment' :
case 'checkin' :
$cid = JRequest::getInt('cid');
if (!$cid)
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$item = JTable::getInstance('K2Item', 'Table');
$item->load($cid);
if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid))
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
break;
case 'save' :
$cid = JRequest::getInt('id');
if ($cid)
{
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$item = JTable::getInstance('K2Item', 'Table');
$item->load($cid);
if (!K2HelperPermissions::canEditItem($item->created_by, $item->catid))
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
else
{
if (!K2HelperPermissions::canAddItem())
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
break;
case 'tag' :
if (!K2HelperPermissions::canAddTag())
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
break;
case 'extraFields' :
if (!K2HelperPermissions::canRenderExtraFields())
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
break;
}
}
public static function getK2User($userID)
{
$db = JFactory::getDBO();
$query = "SELECT * FROM #__k2_users WHERE userID = ".(int)$userID;
$db->setQuery($query);
$row = $db->loadObject();
return $row;
}
public static function getK2UserGroup($id)
{
$db = JFactory::getDBO();
$query = "SELECT * FROM #__k2_user_groups WHERE id = ".(int)$id;
$db->setQuery($query);
$row = $db->loadObject();
return $row;
}
public static function canAddItem($category = false)
{
$user = JFactory::getUser();
$K2Permissions = K2Permissions::getInstance();
if (in_array('add.category.all', $K2Permissions->actions))
{
return true;
}
if ($category)
{
return in_array('add.category.'.$category, $K2Permissions->actions);
}
$db = JFactory::getDBO();
$query = "SELECT id FROM #__k2_categories WHERE published=1 AND trash=0";
if (K2_JVERSION != '15')
{
$query .= " AND access IN(".implode(',', $user->getAuthorisedViewLevels()).")";
}
else
{
$aid = (int)$user->get('aid');
$query .= " AND access<={$aid}";
}
$db->setQuery($query);
$categories = K2_JVERSION == '30' ? $db->loadColumn() : $db->loadResultArray();
foreach ($categories as $category)
{
if (in_array('add.category.'.$category, $K2Permissions->actions))
{
return true;
}
}
return false;
}
public static function canAddToAll()
{
$K2Permissions = K2Permissions::getInstance();
return in_array('add.category.all', $K2Permissions->actions);
}
public static function canEditItem($itemOwner, $itemCategory)
{
$K2Permissions = K2Permissions::getInstance();
if (in_array('editAll.category.all', $K2Permissions->actions) || in_array('editOwn.item.'.$itemOwner, $K2Permissions->actions) || in_array('editOwn.item.'.$itemOwner.'.'.$itemCategory, $K2Permissions->actions) || in_array('editAll.category.'.$itemCategory, $K2Permissions->actions))
{
return true;
}
else
{
return false;
}
}
public static function canPublishItem($itemCategory)
{
$K2Permissions = K2Permissions::getInstance();
if (in_array('publish.category.all', $K2Permissions->actions) || in_array('publish.category.'.$itemCategory, $K2Permissions->actions))
{
return true;
}
else
{
return false;
}
}
public static function canAddTag()
{
$K2Permissions = K2Permissions::getInstance();
return in_array('tag', $K2Permissions->actions);
}
public static function canRenderExtraFields()
{
$K2Permissions = K2Permissions::getInstance();
return in_array('extraFields', $K2Permissions->actions);
}
public static function canAddComment($itemCategory)
{
$K2Permissions = K2Permissions::getInstance();
return in_array('comment.category.all', $K2Permissions->actions) || in_array('comment.category.'.$itemCategory, $K2Permissions->actions);
}
public static function canEditPublished($itemCategory)
{
$K2Permissions = K2Permissions::getInstance();
return in_array('editPublished.category.all', $K2Permissions->actions) || in_array('editPublished.category.'.$itemCategory, $K2Permissions->actions);
}
}
class K2Permissions
{
var $actions = array();
var $permissions = null;
public static function getInstance()
{
static $instance;
if (!is_object($instance))
{
$instance = new K2Permissions();
}
return $instance;
}
}

View File

@ -0,0 +1,285 @@
<?php
/**
* @version $Id: route.php 1948 2013-03-11 16:47:00Z 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.helper');
class K2HelperRoute
{
private static $anyK2Link = null;
private static $multipleCategoriesMapping = array();
public static function getItemRoute($id, $catid = 0)
{
$needles = array(
'item' => (int)$id,
'category' => (int)$catid,
);
$link = 'index.php?option=com_k2&view=item&id='.$id;
if ($item = K2HelperRoute::_findItem($needles))
{
$link .= '&Itemid='.$item->id;
}
return $link;
}
public static function getCategoryRoute($catid)
{
$needles = array('category' => (int)$catid);
$link = 'index.php?option=com_k2&view=itemlist&task=category&id='.$catid;
if ($item = K2HelperRoute::_findItem($needles))
{
$link .= '&Itemid='.$item->id;
}
return $link;
}
public static function getUserRoute($userID)
{
if (K2_CB)
{
global $_CB_framework;
return $_CB_framework->userProfileUrl((int)$userID);
}
$needles = array('user' => (int)$userID);
$user = JFactory::getUser($userID);
if (K2_JVERSION != '15' && JFactory::getConfig()->get('unicodeslugs') == 1)
{
$alias = JApplication::stringURLSafe($user->name);
}
else if (JPluginHelper::isEnabled('system', 'unicodeslug') || JPluginHelper::isEnabled('system', 'jw_unicodeSlugsExtended'))
{
$alias = JFilterOutput::stringURLSafe($user->name);
}
else
{
mb_internal_encoding("UTF-8");
mb_regex_encoding("UTF-8");
$alias = trim(mb_strtolower($user->name));
$alias = str_replace('-', ' ', $alias);
$alias = mb_ereg_replace('[[:space:]]+', ' ', $alias);
$alias = trim(str_replace(' ', '', $alias));
$alias = str_replace('.', '', $alias);
$stripthese = ',|~|!|@|%|^|(|)|<|>|:|;|{|}|[|]|&|`|„|‹|’|‘|“|â€<C3A2>|•|›|«|´|»|°|«|»|…';
$strips = explode('|', $stripthese);
foreach ($strips as $strip)
{
$alias = str_replace($strip, '', $alias);
}
$params = K2HelperUtilities::getParams('com_k2');
$SEFReplacements = array();
$items = explode(',', $params->get('SEFReplacements', NULL));
foreach ($items as $item)
{
if (!empty($item))
{
@list($src, $dst) = explode('|', trim($item));
$SEFReplacements[trim($src)] = trim($dst);
}
}
foreach ($SEFReplacements as $key => $value)
{
$alias = str_replace($key, $value, $alias);
}
$alias = trim($alias, '-.');
if (trim(str_replace('-', '', $alias)) == '')
{
$datenow = JFactory::getDate();
$alias = K2_JVERSION == '15' ? $datenow->toFormat("%Y-%m-%d-%H-%M-%S") : $datenow->format("Y-m-d-H-i-s");
}
}
$link = 'index.php?option=com_k2&view=itemlist&task=user&id='.$userID.':'.$alias;
if ($item = K2HelperRoute::_findItem($needles))
{
$link .= '&Itemid='.$item->id;
}
return $link;
}
public static function getTagRoute($tag)
{
$needles = array('tag' => $tag);
$link = 'index.php?option=com_k2&view=itemlist&task=tag&tag='.urlencode($tag);
if ($item = K2HelperRoute::_findItem($needles))
{
$link .= '&Itemid='.$item->id;
}
return $link;
}
public static function getDateRoute($year, $month, $day = null, $catid = null)
{
$needles = array('year' => $year);
$link = 'index.php?option=com_k2&view=itemlist&task=date&year='.$year.'&month='.$month;
if ($day)
{
$link .= '&day='.$day;
}
if ($catid)
{
$link .= '&catid='.$catid;
}
if ($item = K2HelperRoute::_findItem($needles))
{
$link .= '&Itemid='.$item->id;
}
return $link;
}
public static function getSearchRoute()
{
$needles = array('search' => 'search');
$link = 'index.php?option=com_k2&view=itemlist&task=search';
if ($item = K2HelperRoute::_findItem($needles))
{
$link .= '&Itemid='.$item->id;
}
return $link;
}
public static function _findItem($needles)
{
$component = JComponentHelper::getComponent('com_k2');
$application = JFactory::getApplication();
$menus = $application->getMenu('site', array());
if (K2_JVERSION != '15')
{
$items = $menus->getItems('component_id', $component->id);
}
else
{
$items = $menus->getItems('componentid', $component->id);
}
$match = null;
foreach ($needles as $needle => $id)
{
if (count($items))
{
foreach ($items as $item)
{
// Detect multiple K2 categories link and set the generic K2 link ( if any )
if (@$item->query['view'] == 'itemlist' && @$item->query['task'] == '')
{
if (!isset(self::$multipleCategoriesMapping[$item->id]))
{
if (K2_JVERSION == '15')
{
$menuparams = explode("\n", $item->params);
foreach ($menuparams as $param)
{
if (strpos($param, 'categories=') === 0)
{
$array = explode('categories=', $param);
$item->K2Categories = explode('|', $array[1]);
}
}
if (!isset($item->K2Categories))
{
$item->K2Categories = array();
}
}
else
{
$menuparams = json_decode($item->params);
$item->K2Categories = isset($menuparams->categories) ? $menuparams->categories : array();
}
self::$multipleCategoriesMapping[$item->id] = $item->K2Categories;
if (count($item->K2Categories) === 0)
{
self::$anyK2Link = $item;
}
}
}
if ($needle == 'user' || $needle == 'category')
{
if ((@$item->query['task'] == $needle) && (@$item->query['id'] == $id))
{
$match = $item;
break;
}
}
else if ($needle == 'tag')
{
if ((@$item->query['task'] == $needle) && (@$item->query['tag'] == $id))
{
$match = $item;
break;
}
}
else
{
if ((@$item->query['view'] == $needle) && (@$item->query['id'] == $id))
{
$match = $item;
break;
}
}
if (!is_null($match))
{
break;
}
}
// Second pass [START]
// Only for multiple categories links. Triggered only if we do not have find any match (link to direct category)
if (is_null($match) && $needle == 'category')
{
foreach ($items as $item)
{
if (@$item->query['view'] == 'itemlist' && @$item->query['task'] == '')
{
if (isset(self::$multipleCategoriesMapping[$item->id]) && is_array(self::$multipleCategoriesMapping[$item->id]))
{
foreach (self::$multipleCategoriesMapping[$item->id] as $catid)
{
if ((int)$catid == $id)
{
$match = $item;
break;
}
}
}
if (!is_null($match))
{
break;
}
}
}
}
// Second pass [END]
}
if (!is_null($match))
{
break;
}
}
if (is_null($match) && !is_null(self::$anyK2Link))
{
$match = self::$anyK2Link;
}
return $match;
}
}

View File

@ -0,0 +1,364 @@
<?php
/**
* @version $Id: utilities.php 1977 2013-05-15 11:39:46Z 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 K2HelperUtilities
{
// Get user avatar
public static function getAvatar($userID, $email = NULL, $width = 50)
{
jimport('joomla.filesystem.folder');
jimport('joomla.application.component.model');
$mainframe = JFactory::getApplication();
$params = K2HelperUtilities::getParams('com_k2');
if (K2_CB && $userID != 'alias')
{
$cbUser = CBuser::getInstance((int)$userID);
if (is_object($cbUser))
{
$avatar = $cbUser->getField('avatar', null, 'csv', 'none', 'profile');
return $avatar;
}
}
// Check for placeholder overrides
if (JFile::exists(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'images'.DS.'placeholder'.DS.'user.png'))
{
$avatarPath = 'templates/'.$mainframe->getTemplate().'/images/placeholder/user.png';
}
else
{
$avatarPath = 'components/com_k2/images/placeholder/user.png';
}
// Continue with default K2 avatar determination
if ($userID == 'alias')
{
$avatar = JURI::root(true).'/'.$avatarPath;
}
else if ($userID == 0)
{
if ($params->get('gravatar') && !is_null($email))
{
$avatar = '//www.gravatar.com/avatar/'.md5($email).'?s='.$width.'&amp;default='.urlencode(JURI::root().$avatarPath);
}
else
{
$avatar = JURI::root(true).'/'.$avatarPath;
}
}
else if (is_numeric($userID) && $userID > 0)
{
K2Model::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'models');
$model = K2Model::getInstance('Item', 'K2Model');
$profile = $model->getUserProfile($userID);
$avatar = (is_null($profile)) ? '' : $profile->image;
if (empty($avatar))
{
if ($params->get('gravatar') && !is_null($email))
{
$avatar = '//www.gravatar.com/avatar/'.md5($email).'?s='.$width.'&amp;default='.urlencode(JURI::root().$avatarPath);
}
else
{
$avatar = JURI::root(true).'/'.$avatarPath;
}
}
else
{
$avatar = JURI::root(true).'/media/k2/users/'.$avatar;
}
}
if (!$params->get('userImageDefault') && $avatar == JURI::root(true).'/'.$avatarPath)
{
$avatar = '';
}
return $avatar;
}
public static function getCategoryImage($image, $params)
{
jimport('joomla.filesystem.file');
$mainframe = JFactory::getApplication();
$categoryImage = NULL;
if (!empty($image))
{
$categoryImage = JURI::root(true).'/media/k2/categories/'.$image;
}
else
{
if ($params->get('catImageDefault'))
{
if (JFile::exists(JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'images'.DS.'placeholder'.DS.'category.png'))
{
$categoryImage = JURI::root(true).'/templates/'.$mainframe->getTemplate().'/images/placeholder/category.png';
}
else
{
$categoryImage = JURI::root(true).'/components/com_k2/images/placeholder/category.png';
}
}
}
return $categoryImage;
}
// Word limit
public static function wordLimit($str, $limit = 100, $end_char = '&#8230;')
{
if (JString::trim($str) == '')
return $str;
// always strip tags for text
$str = strip_tags($str);
$find = array("/\r|\n/u", "/\t/u", "/\s\s+/u");
$replace = array(" ", " ", " ");
$str = preg_replace($find, $replace, $str);
preg_match('/\s*(?:\S*\s*){'.(int)$limit.'}/u', $str, $matches);
if (JString::strlen($matches[0]) == JString::strlen($str))
$end_char = '';
return JString::rtrim($matches[0]).$end_char;
}
// Character limit
public static function characterLimit($str, $limit = 150, $end_char = '...')
{
if (JString::trim($str) == '')
return $str;
// always strip tags for text
$str = strip_tags(JString::trim($str));
$find = array("/\r|\n/u", "/\t/u", "/\s\s+/u");
$replace = array(" ", " ", " ");
$str = preg_replace($find, $replace, $str);
if (JString::strlen($str) > $limit)
{
$str = JString::substr($str, 0, $limit);
return JString::rtrim($str).$end_char;
}
else
{
return $str;
}
}
// Cleanup HTML entities
public static function cleanHtml($text)
{
return htmlentities($text, ENT_QUOTES, 'UTF-8');
}
// Gender
public static function writtenBy($gender)
{
if (is_null($gender))
return JText::_('K2_WRITTEN_BY');
if ($gender == 'm')
return JText::_('K2_WRITTEN_BY_MALE');
if ($gender == 'f')
return JText::_('K2_WRITTEN_BY_FEMALE');
}
public static function setDefaultImage(&$item, $view, $params = NULL)
{
if ($view == 'item')
{
$image = 'image'.$item->params->get('itemImgSize');
$item->image = $item->$image;
switch ($item->params->get('itemImgSize'))
{
case 'XSmall' :
$item->imageWidth = $item->params->get('itemImageXS');
break;
case 'Small' :
$item->imageWidth = $item->params->get('itemImageS');
break;
case 'Medium' :
$item->imageWidth = $item->params->get('itemImageM');
break;
case 'Large' :
$item->imageWidth = $item->params->get('itemImageL');
break;
case 'XLarge' :
$item->imageWidth = $item->params->get('itemImageXL');
break;
}
}
if ($view == 'itemlist')
{
$image = 'image'.$params->get($item->itemGroup.'ImgSize');
$item->image = isset($item->$image) ? $item->$image : '';
switch ($params->get($item->itemGroup.'ImgSize'))
{
case 'XSmall' :
$item->imageWidth = $item->params->get('itemImageXS');
break;
case 'Small' :
$item->imageWidth = $item->params->get('itemImageS');
break;
case 'Medium' :
$item->imageWidth = $item->params->get('itemImageM');
break;
case 'Large' :
$item->imageWidth = $item->params->get('itemImageL');
break;
case 'XLarge' :
$item->imageWidth = $item->params->get('itemImageXL');
break;
}
}
if ($view == 'latest')
{
$image = 'image'.$params->get('latestItemImageSize');
$item->image = $item->$image;
switch ($params->get('latestItemImageSize'))
{
case 'XSmall' :
$item->imageWidth = $item->params->get('itemImageXS');
break;
case 'Small' :
$item->imageWidth = $item->params->get('itemImageS');
break;
case 'Medium' :
$item->imageWidth = $item->params->get('itemImageM');
break;
case 'Large' :
$item->imageWidth = $item->params->get('itemImageL');
break;
case 'XLarge' :
$item->imageWidth = $item->params->get('itemImageXL');
break;
}
}
if ($view == 'relatedByTag' && $params->get('itemRelatedImageSize'))
{
$image = 'image'.$params->get('itemRelatedImageSize');
$item->image = $item->$image;
switch ($params->get('itemRelatedImageSize'))
{
case 'XSmall' :
$item->imageWidth = $item->params->get('itemImageXS');
break;
case 'Small' :
$item->imageWidth = $item->params->get('itemImageS');
break;
case 'Medium' :
$item->imageWidth = $item->params->get('itemImageM');
break;
case 'Large' :
$item->imageWidth = $item->params->get('itemImageL');
break;
case 'XLarge' :
$item->imageWidth = $item->params->get('itemImageXL');
break;
}
}
}
public static function getParams($option)
{
if (K2_JVERSION != '15')
{
$application = JFactory::getApplication();
if ($application->isSite())
{
$params = $application->getParams($option);
}
else
{
$params = JComponentHelper::getParams($option);
}
}
else
{
$params = JComponentHelper::getParams($option);
}
return $params;
}
public static function cleanTags($string, $allowed_tags)
{
$allowed_htmltags = array();
foreach ($allowed_tags as $tag)
{
$allowed_htmltags[] .= "<".$tag.">";
}
$allowed_htmltags = implode("", $allowed_htmltags);
$string = strip_tags($string, $allowed_htmltags);
return $string;
}
// Clean HTML Tag Attributes
// e.g. cleanupAttributes($string,"img,hr,h1,h2,h3,h4","style,width,height,hspace,vspace,border,class,id");
public static function cleanAttributes($string, $tag_array, $attr_array)
{
$attr = implode("|", $attr_array);
foreach ($tag_array as $tag)
{
preg_match_all("#<($tag) .+?>#", $string, $matches, PREG_PATTERN_ORDER);
foreach ($matches[0] as $match)
{
preg_match_all('/('.$attr.')=([\\"\\\']).+?([\\"\\\'])/', $match, $matchesAttr, PREG_PATTERN_ORDER);
foreach ($matchesAttr[0] as $attrToClean)
{
$string = str_replace($attrToClean, '', $string);
$string = preg_replace('| +|', ' ', $string);
$string = str_replace(' >', '>', $string);
}
}
}
return $string;
}
} // End Class

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

258
components/com_k2/js/k2.js Normal file
View File

@ -0,0 +1,258 @@
/**
* @version $Id: k2.js 1987 2013-06-27 11:51: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
*/
var $K2 = jQuery.noConflict();
$K2(document).ready(function(){
// Generic function to get URL params passed in .js script include
function getUrlParams(targetScript, varName) {
var scripts = document.getElementsByTagName('script');
var scriptCount = scripts.length;
for (var a = 0; a < scriptCount; a++) {
var scriptSrc = scripts[a].src;
if (scriptSrc.indexOf(targetScript) >= 0) {
varName = varName.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var re = new RegExp("[\\?&]" + varName + "=([^&#]*)");
var parsedVariables = re.exec(scriptSrc);
if (parsedVariables !== null) {
return parsedVariables[1];
}
}
}
}
// Set the site root path
var K2SitePath = getUrlParams('k2.js', 'sitepath');
// Comments
$K2('#comment-form').submit(function(event){
event.preventDefault();
$K2('#formLog').empty().addClass('formLogLoading');
$K2.ajax({
url: $K2('#comment-form').attr('action'),
type: 'post',
dataType: 'json',
data: $K2('#comment-form').serialize(),
success: function(response){
$K2('#formLog').removeClass('formLogLoading').html(response.message);
if(typeof(Recaptcha) != "undefined"){
Recaptcha.reload();
}
if (response.refresh) {
window.location.reload();
}
}
});
});
$K2('.commentRemoveLink').click(function(event){
event.preventDefault();
var element = $K2(this);
$K2(element).parent().addClass('commentToolbarLoading');
$K2.ajax({
url: $K2(element).attr('href'),
type: 'post',
data: $K2('#comment-form input:last').serialize(),
success: function(response){
$K2(element).parent().removeClass('commentToolbarLoading');
if(response=='true'){
$K2(element).parent().parent().remove();
}
}
});
});
$K2('.commentApproveLink').click(function(event){
event.preventDefault();
var element = $K2(this);
$K2(element).parent().addClass('commentToolbarLoading');
$K2.ajax({
url: $K2(element).attr('href'),
type: 'post',
data: $K2('#comment-form input:last').serialize(),
success: function(response){
$K2(element).parent().removeClass('commentToolbarLoading');
if(response=='true'){
$K2(element).parent().parent().removeClass('unpublishedComment');
}
}
});
});
$K2('.k2ReportUserButton').click(function(event){
event.preventDefault();
if (confirm(K2Language[0])) {
var element = $K2(this);
$K2(element).parent().addClass('commentToolbarLoading');
$K2.ajax({
url: $K2(element).attr('href'),
type: 'GET',
success: function(response){
$K2(element).parent().removeClass('commentToolbarLoading');
alert(response);
}
});
}
});
$K2('#k2ReportCommentForm').submit(function(event){
event.preventDefault();
$K2('#formLog').empty().addClass('formLogLoading');
$K2.ajax({
url: $K2('#k2ReportCommentForm').attr('action'),
type: 'post',
data: $K2('#k2ReportCommentForm').serialize(),
success: function(response){
$K2('#formLog').removeClass('formLogLoading').html(response);
if(typeof(Recaptcha) != "undefined"){
Recaptcha.reload();
}
}
});
});
// Text Resizer
$K2('#fontDecrease').click(function(event){
event.preventDefault();
$K2('.itemFullText').removeClass('largerFontSize');
$K2('.itemFullText').addClass('smallerFontSize');
});
$K2('#fontIncrease').click(function(event){
event.preventDefault();
$K2('.itemFullText').removeClass('smallerFontSize');
$K2('.itemFullText').addClass('largerFontSize');
});
// Smooth Scroll
$K2('.k2Anchor').click(function(event){
event.preventDefault();
var target = this.hash;
$K2('html, body').stop().animate({
scrollTop: $K2(target).offset().top
}, 500);
});
// Rating
$K2('.itemRatingForm a').click(function(event){
event.preventDefault();
var itemID = $K2(this).attr('rel');
var log = $K2('#itemRatingLog' + itemID).empty().addClass('formLogLoading');
var rating = $K2(this).html();
$K2.ajax({
url: K2SitePath+"index.php?option=com_k2&view=item&task=vote&format=raw&user_rating=" + rating + "&itemID=" + itemID,
type: 'get',
success: function(response){
log.removeClass('formLogLoading');
log.html(response);
$K2.ajax({
url: K2SitePath+"index.php?option=com_k2&view=item&task=getVotesPercentage&format=raw&itemID=" + itemID,
type: 'get',
success: function(percentage){
$K2('#itemCurrentRating' + itemID).css('width', percentage + "%");
setTimeout(function(){
$K2.ajax({
url: K2SitePath+"index.php?option=com_k2&view=item&task=getVotesNum&format=raw&itemID=" + itemID,
type: 'get',
success: function(response){
log.html(response);
}
});
}, 2000);
}
});
}
});
});
// Classic popup
$K2('.classicPopup').click(function(event){
event.preventDefault();
if($K2(this).attr('rel')){
var json = $K2(this).attr('rel');
json = json.replace(/'/g, '"');
var options = $K2.parseJSON(json);
} else {
var options = {x:900,y:600}; /* use some default values if not defined */
}
window.open($K2(this).attr('href'),'K2PopUpWindow','width='+options.x+',height='+options.y+',menubar=yes,resizable=yes');
});
// Live search
$K2('div.k2LiveSearchBlock form input[name=searchword]').keyup(function(event){
var parentElement = $K2(this).parent().parent();
if($K2(this).val().length>3 && event.key!='enter'){
$K2(this).addClass('k2SearchLoading');
parentElement.find('.k2LiveSearchResults').css('display','none').empty();
parentElement.find('input[name=t]').val($K2.now());
parentElement.find('input[name=format]').val('raw');
var url = 'index.php?option=com_k2&view=itemlist&task=search&' + parentElement.find('form').serialize();
parentElement.find('input[name=format]').val('html');
$K2.ajax({
url: url,
type: 'get',
success: function(response){
parentElement.find('.k2LiveSearchResults').html(response);
parentElement.find('input[name=searchword]').removeClass('k2SearchLoading');
parentElement.find('.k2LiveSearchResults').css('display', 'block');
}
});
} else {
parentElement.find('.k2LiveSearchResults').css('display','none').empty();
}
});
// Calendar
if (typeof($K2().live) == "undefined") {
$K2('.k2CalendarBlock').on('click', '.calendarNavLink', function(event){
event.preventDefault();
var parentElement = $K2(this).parent().parent().parent().parent();
var url = $K2(this).attr('href');
parentElement.empty().addClass('k2CalendarLoader');
$K2.ajax({
url: url,
type: 'post',
success: function(response){
parentElement.html(response);
parentElement.removeClass('k2CalendarLoader');
}
});
});
}
else {
$K2('a.calendarNavLink').live('click', function(event){
event.preventDefault();
var parentElement = $K2(this).parent().parent().parent().parent();
var url = $K2(this).attr('href');
parentElement.empty().addClass('k2CalendarLoader');
$K2.ajax({
url: url,
type: 'post',
success: function(response){
parentElement.html(response);
parentElement.removeClass('k2CalendarLoader');
}
});
});
}
// Generic Element Scroller (use .k2Scroller in the container and .k2ScrollerElement for each contained element)
$K2('.k2Scroller').css('width',($K2('.k2Scroller').find('.k2ScrollerElement:first').outerWidth(true))*$K2('.k2Scroller').children('.k2ScrollerElement').length);
});
// Equal block heights for the "default" view
$K2(window).load(function () {
var blocks = $K2('.subCategory, .k2EqualHeights');
var maxHeight = 0;
blocks.each(function(){
maxHeight = Math.max(maxHeight, parseInt($K2(this).css('height')));
});
blocks.css('height', maxHeight);
});

73
components/com_k2/k2.php Normal file
View File

@ -0,0 +1,73 @@
<?php
/**
* @version $Id: k2.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;
if (K2_JVERSION != '15')
{
$user = JFactory::getUser();
if ($user->authorise('core.admin', 'com_k2'))
{
$user->gid = 1000;
}
else
{
$user->gid = 1;
}
}
JLoader::register('K2Controller', JPATH_COMPONENT.DS.'controllers'.DS.'controller.php');
JLoader::register('K2Model', JPATH_COMPONENT_ADMINISTRATOR.DS.'models'.DS.'model.php');
JLoader::register('K2View', JPATH_COMPONENT_ADMINISTRATOR.DS.'views'.DS.'view.php');
JLoader::register('K2HelperRoute', JPATH_COMPONENT.DS.'helpers'.DS.'route.php');
JLoader::register('K2HelperPermissions', JPATH_COMPONENT.DS.'helpers'.DS.'permissions.php');
JLoader::register('K2HelperUtilities', JPATH_COMPONENT.DS.'helpers'.DS.'utilities.php');
K2HelperPermissions::setPermissions();
K2HelperPermissions::checkPermissions();
$controller = JRequest::getWord('view', 'itemlist');
$task = JRequest::getWord('task');
if ($controller == 'media')
{
$controller = 'item';
if ($task != 'connector')
{
$task = 'media';
}
}
if ($controller == 'users')
{
$controller = 'item';
$task = 'users';
}
jimport('joomla.filesystem.file');
jimport('joomla.html.parameter');
if (JFile::exists(JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php'))
{
require_once (JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php');
$classname = 'K2Controller'.$controller;
$controller = new $classname();
$controller->execute($task);
$controller->redirect();
}
else
{
JError::raiseError(404, JText::_('K2_NOT_FOUND'));
}
if (JRequest::getCmd('format') != 'json')
{
echo "\n<!-- JoomlaWorks \"K2\" (v2.6.7) | Learn more about K2 at http://getk2.org -->\n\n";
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,668 @@
<?php
/**
* @version $Id: router.php 1935 2013-03-04 16:09: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 ;
$params = JComponentHelper::getParams('com_k2');
// Quick implementation of "Improved K2 router.php" https://gist.github.com/phproberto/4687829
// @TODO Merge the two routers
if ($params->get('k2Sef'))
{
/**
* Build the SEF route from the query
*
* @param array &$query The array of query string values for which to build a route
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @since 1.5
*/
function k2BuildRoute(&$query)
{
// Initialize
$segments = array();
// Get params
$params = JComponentHelper::getParams('com_k2');
// Get the menu
$menu = JFactory::getApplication()->getMenu();
// Detect the active menu item
if (empty($query['Itemid']))
{
$menuItem = $menu->getActive();
}
else
{
$menuItem = $menu->getItem($query['Itemid']);
}
// Load data from the current menu item
$mView = ( empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
$mTask = ( empty($menuItem->query['task'])) ? null : $menuItem->query['task'];
$mId = ( empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
$mTag = ( empty($menuItem->query['tag'])) ? null : $menuItem->query['tag'];
if (isset($query['layout']))
{
unset($query['layout']);
}
if ($mView == @$query['view'] && $mTask == @$query['task'] && $mId == @intval($query['id']) && @intval($query['id']) > 0)
{
unset($query['view']);
unset($query['task']);
unset($query['id']);
}
if ($mView == @$query['view'] && $mTask == @$query['task'] && $mTag == @$query['tag'] && isset($query['tag']))
{
unset($query['view']);
unset($query['task']);
unset($query['tag']);
}
if (isset($query['view']))
{
$segments[] = $query['view'];
unset($query['view']);
}
if (isset($query['task']))
{
$segments[] = $query['task'];
unset($query['task']);
}
if (isset($query['id']))
{
$segments[] = $query['id'];
unset($query['id']);
}
if (isset($query['cid']))
{
$segments[] = $query['cid'];
unset($query['cid']);
}
if (isset($query['tag']))
{
$segments[] = $query['tag'];
unset($query['tag']);
}
if (isset($query['year']))
{
$segments[] = $query['year'];
unset($query['year']);
}
if (isset($query['month']))
{
$segments[] = $query['month'];
unset($query['month']);
}
if (isset($query['day']))
{
$segments[] = $query['day'];
unset($query['day']);
}
if (isset($query['task']))
{
$segments[] = $query['task'];
unset($query['task']);
}
// Item view
if (isset($segments[0]) && $segments[0] == 'item')
{
// Enabled category prefix for items
if ($params->get('k2SefLabelItem'))
{
// Tasks available for an item
$itemTasks = array(
'edit',
'download'
);
// If it's a task pick the next key
if (in_array($segments[1], $itemTasks))
{
$ItemId = $segments[2];
}
else
{
$ItemId = $segments[1];
}
// Replace the item with the category slug
if ($params->get('k2SefLabelItem') == '1')
{
$segments[0] = getCategorySlug((int)$ItemId);
}
else
{
$segments[0] = $params->get('k2SefLabelItemCustomPrefix');
}
}
// Remove "item" from the URL
else
{
unset($segments[0]);
}
// Handle item id and alias
if ($params->get('k2SefInsertItemId'))
{
if ($params->get('k2SefUseItemTitleAlias'))
{
if ($params->get('k2SefItemIdTitleAliasSep') == 'slash')
{
$segments[1] = JString::str_ireplace(':', '/', $segments[1]);
}
}
else
{
$temp = @explode(':', $segments[1]);
$segments[1] = (int)$temp[0];
}
}
else
{
if (isset($segments[1]) && $segments[1] != 'download')
{
// Try to split the slud
$temp = @explode(':', $segments[1]);
// If the slug contained an item id do not use it
if (count($temp) > 1)
{
$segments[1] = $temp[1];
}
}
}
}
// Itemlist view. Check for prefix segments
elseif (isset($segments[0]) && $segments[0] == 'itemlist')
{
switch ($segments[1])
{
case 'category' :
$segments[0] = $params->get('k2SefLabelCat', 'content');
unset($segments[1]);
// Handle category id and alias
if ($params->get('k2SefInsertCatId'))
{
if ($params->get('k2SefUseCatTitleAlias'))
{
if ($params->get('k2SefCatIdTitleAliasSep') == 'slash')
{
$segments[2] = JString::str_ireplace(':', '/', $segments[2]);
}
}
else
{
$temp = @explode(':', $segments[2]);
$segments[2] = (int)$temp[0];
}
}
else
{
// Try to split the slud
$temp = @explode(':', $segments[2]);
// If the slug contained an item id do not use it
if (count($temp) > 1)
{
@$segments[1] = $temp[2];
}
}
break;
case 'tag' :
$segments[0] = $params->get('k2SefLabelTag', 'tag');
unset($segments[1]);
break;
case 'user' :
$segments[0] = $params->get('k2SefLabelUser', 'author');
unset($segments[1]);
break;
case 'date' :
$segments[0] = $params->get('k2SefLabelDate', 'date');
unset($segments[1]);
break;
case 'search' :
$segments[0] = $params->get('k2SefLabelSearch', 'search');
unset($segments[1]);
break;
default :
$segments[0] = 'itemlist';
break;
}
}
// Return reordered segments array
return array_values($segments);
}
/**
* Get back the url from the segments
*
* @param array $segments Segments in the SEF URL
*
* @return array Generated vars for the query
*/
function k2ParseRoute($segments)
{
// Initialize
$vars = array();
$params = JComponentHelper::getParams('com_k2');
$reservedViews = array(
'item',
'itemlist',
'media',
'users',
'comments',
'latest'
);
if (!in_array($segments[0], $reservedViews))
{
// Category view
if ($segments[0] == $params->get('k2SefLabelCat', 'content'))
{
$segments[0] = 'itemlist';
array_splice($segments, 1, 0, 'category');
}
// Tag view
elseif ($segments[0] == $params->get('k2SefLabelTag', 'tag'))
{
$segments[0] = 'itemlist';
array_splice($segments, 1, 0, 'tag');
}
// User view
elseif ($segments[0] == $params->get('k2SefLabelUser', 'author'))
{
$segments[0] = 'itemlist';
array_splice($segments, 1, 0, 'user');
}
// Date view
elseif ($segments[0] == $params->get('k2SefLabelDate', 'date'))
{
$segments[0] = 'itemlist';
array_splice($segments, 1, 0, 'date');
}
// Search view
elseif ($segments[0] == $params->get('k2SefLabelSearch', 'search'))
{
$segments[0] = 'itemlist';
array_splice($segments, 1, 0, 'search');
}
// Item view
else
{
// Replace the category prefix with item
if ($params->get('k2SefLabelItem'))
{
$segments[0] = 'item';
}
// Reinsert the removed item segment
else
{
array_splice($segments, 0, 0, 'item');
}
// Reinsert item id to the item alias
if (!$params->get('k2SefInsertItemId') && @$segments[1] != 'download' && @$segments[1] != 'edit')
{
$segments[1] = str_replace(':', '-', $segments[1]);
$ItemId = getItemId($segments[1]);
$segments[1] = $ItemId.':'.$segments[1];
}
}
}
$vars['view'] = $segments[0];
if (!isset($segments[1]))
{
$segments[1] = '';
}
$vars['task'] = $segments[1];
if ($segments[0] == 'itemlist')
{
switch ($segments[1])
{
case 'category' :
if (isset($segments[2]))
{
$vars['id'] = $segments[2];
}
break;
case 'tag' :
if (isset($segments[2]))
{
$vars['tag'] = $segments[2];
}
break;
case 'user' :
if (isset($segments[2]))
{
$vars['id'] = $segments[2];
}
break;
case 'date' :
if (isset($segments[2]))
{
$vars['year'] = $segments[2];
}
if (isset($segments[3]))
{
$vars['month'] = $segments[3];
}
if (isset($segments[4]))
{
$vars['day'] = $segments[4];
}
break;
}
}
elseif ($segments[0] == 'item')
{
switch ($segments[1])
{
case 'edit' :
if (isset($segments[2]))
{
$vars['cid'] = $segments[2];
}
break;
case 'download' :
if (isset($segments[2]))
{
$vars['id'] = $segments[2];
}
break;
default :
$vars['id'] = $segments[1];
break;
}
}
if ($segments[0] == 'comments' && isset($segments[1]) && $segments[1] == 'reportSpammer')
{
$vars['id'] = $segments[2];
}
return $vars;
}
/**
* Get a category alias
*
* @param integer $ItemId The category id
*
* @return string The category alias
*/
function getCategorySlug($ItemId = null)
{
$slug = null;
$db = JFactory::getDBO();
$query = "SELECT items.id, categories.id AS catid, CASE WHEN CHAR_LENGTH(categories.alias) THEN CONCAT_WS('-', categories.id, categories.alias) ELSE categories.id END AS catslug
FROM #__k2_items AS items
INNER JOIN #__k2_categories AS categories ON items.catid = categories.id
WHERE items.id = ".(int)$ItemId;
$db->setQuery($query);
try
{
if ($result = $db->loadObject())
{
$slug = $result->catslug;
}
}
catch (Exception $e)
{
$this->setError($e->getMessage());
return false;
}
return $slug;
}
/**
* Get id K2.
*
* @param string $alias The k2 item alias
*
* @return integer
*/
function getItemId($alias)
{
$id = null;
$db = JFactory::getDBO();
$query = "SELECT id FROM #__k2_items WHERE alias = ".$db->quote($alias);
$db->setQuery($query);
try
{
$id = $db->loadResult();
}
catch (Exception $e)
{
$this->setError($e->getMessage());
return false;
}
return $id;
}
}
else
{
function K2BuildRoute(&$query)
{
$segments = array();
$application = JFactory::getApplication();
$menu = $application->getMenu();
if (empty($query['Itemid']))
{
$menuItem = $menu->getActive();
}
else
{
$menuItem = $menu->getItem($query['Itemid']);
}
$mView = ( empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
$mTask = ( empty($menuItem->query['task'])) ? null : $menuItem->query['task'];
$mId = ( empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
$mTag = ( empty($menuItem->query['tag'])) ? null : $menuItem->query['tag'];
if (isset($query['layout']))
{
unset($query['layout']);
}
if ($mView == @$query['view'] && $mTask == @$query['task'] && $mId == @intval($query['id']) && @intval($query['id']) > 0)
{
unset($query['view']);
unset($query['task']);
unset($query['id']);
}
if ($mView == @$query['view'] && $mTask == @$query['task'] && $mTag == @$query['tag'] && isset($query['tag']))
{
unset($query['view']);
unset($query['task']);
unset($query['tag']);
}
if (isset($query['view']))
{
$view = $query['view'];
$segments[] = $view;
unset($query['view']);
}
if (@ isset($query['task']))
{
$task = $query['task'];
$segments[] = $task;
unset($query['task']);
}
if (isset($query['id']))
{
$id = $query['id'];
$segments[] = $id;
unset($query['id']);
}
if (isset($query['cid']))
{
$cid = $query['cid'];
$segments[] = $cid;
unset($query['cid']);
}
if (isset($query['tag']))
{
$tag = $query['tag'];
$segments[] = $tag;
unset($query['tag']);
}
if (isset($query['year']))
{
$year = $query['year'];
$segments[] = $year;
unset($query['year']);
}
if (isset($query['month']))
{
$month = $query['month'];
$segments[] = $month;
unset($query['month']);
}
if (isset($query['day']))
{
$day = $query['day'];
$segments[] = $day;
unset($query['day']);
}
if (isset($query['task']))
{
$task = $query['task'];
$segments[] = $task;
unset($query['task']);
}
return $segments;
}
function K2ParseRoute($segments)
{
$vars = array();
$vars['view'] = $segments[0];
if (!isset($segments[1]))
$segments[1] = '';
$vars['task'] = $segments[1];
if ($segments[0] == 'itemlist')
{
switch($segments[1])
{
case 'category' :
if (isset($segments[2]))
$vars['id'] = $segments[2];
break;
case 'tag' :
if (isset($segments[2]))
$vars['tag'] = $segments[2];
break;
case 'user' :
if (isset($segments[2]))
$vars['id'] = $segments[2];
break;
case 'date' :
if (isset($segments[2]))
$vars['year'] = $segments[2];
if (isset($segments[3]))
$vars['month'] = $segments[3];
if (isset($segments[4]))
{
$vars['day'] = $segments[4];
}
break;
}
}
else if ($segments[0] == 'item')
{
switch($segments[1])
{
case 'edit' :
if (isset($segments[2]))
$vars['cid'] = $segments[2];
break;
case 'download' :
if (isset($segments[2]))
$vars['id'] = $segments[2];
break;
default :
$vars['id'] = $segments[1];
break;
}
}
if ($segments[0] == 'comments' && isset($segments[1]) && $segments[1] == 'reportSpammer')
{
$vars['id'] = $segments[2];
}
return $vars;
}
}

View File

@ -0,0 +1,327 @@
<?php
/**
* @version $Id: com_k2.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 (!function_exists('getCategoryPath'))
{
function getCategoryPath($catid, $begin = false)
{
static $array = array();
if (intval($catid) == 0)
{
return false;
}
if ($begin)
{
$array = array();
}
$user = JFactory::getUser();
$aid = (int)$user->get('aid');
$catid = (int)$catid;
$db = JFactory::getDBO();
$query = "SELECT * FROM #__k2_categories WHERE id={$catid} AND published=1";
if (version_compare(JVERSION, '1.6.0', 'ge'))
{
$query .= " AND access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
}
else
{
$query .= " AND access<={$aid} ";
}
$db->setQuery($query);
$rows = $db->loadObjectList();
if ($db->getErrorNum())
{
echo $db->stderr();
return false;
}
foreach ($rows as $row)
{
array_push($array, $row->alias);
getCategoryPath($row->parent, false);
}
return array_reverse($array);
}
}
// ------------------ Standard plugin initialize function - don't change ---------------------------
global $sh_LANG;
$sefConfig = shRouter::shGetConfig();
$shLangName = '';
$shLangIso = '';
$title = array();
$shItemidString = '';
$dosef = shInitializePlugin($lang, $shLangName, $shLangIso, $option);
if ($dosef == false)
return;
$shHomePageFlag = false;
$shHomePageFlag = !$shHomePageFlag ? shIsHomepage($string) : $shHomePageFlag;
// Remove common URL from GET vars list, so that they don't show up as query string in the URL
shRemoveFromGETVarsList('option');
shRemoveFromGETVarsList('lang');
if (!empty($Itemid))
shRemoveFromGETVarsList('Itemid');
if (!empty($limit))
shRemoveFromGETVarsList('limit');
if (isset($limitstart))
shRemoveFromGETVarsList('limitstart');
// limitstart can be zero
// Start by inserting the menu element title (just an idea, this is not required at all)
$task = isset($task) ? @$task : null;
$view = isset($view) ? @$view : null;
$Itemid = isset($Itemid) ? @$Itemid : null;
// Set dummy task for module feeds
if ($view == 'itemlist' && isset($moduleID))
{
$task = 'module';
}
// K2 parameters
$params = JComponentHelper::getParams('com_k2');
$authorPrefix = $params->get('sh404SefLabelUser', 'blog');
$itemlistPrefix = $params->get('sh404SefLabelCat', '');
$itemPrefix = $params->get('sh404SefLabelItem', 2);
$sh404SefTitleAlias = $params->get('sh404SefTitleAlias', 'alias');
$sh404SefModK2ContentFeedAlias = $params->get('sh404SefModK2ContentFeedAlias', 'feed');
$sh404SefInsertItemId = $params->get('sh404SefInsertItemId');
$sh404SefInsertUniqueItemId = $params->get('sh404SefInsertUniqueItemId');
$database = JFactory::getDBO();
$menu = JSite::getMenu();
$menuparams = NULL;
$menuparams = $menu->getParams($Itemid);
if (isset($task) && ($task == 'calendar' || $task == 'edit' || $task == 'add' || $task == 'save' || $task == 'deleteAttachment' || $task == 'extraFields' || $task == 'checkin' || $task == 'vote' || $task == 'getVotesNum' || $task == 'getVotesPercentage' || $task == 'comment' || $task == 'download'))
$dosef = false;
if ($view == 'item' && $task == 'tag')
$dosef = false;
if ($view == 'comments')
$dosef = false;
switch ($view)
{
case 'item' :
if (isset($id) && $id > 0 && $task != 'download')
{
$id = (int)$id;
if ($sh404SefInsertUniqueItemId)
{
$query = 'SELECT id, catid, created FROM #__k2_items WHERE id = '.$database->Quote($id);
$database->setQuery($query);
if (shTranslateUrl($option, $shLangName))
{
$contentElement = $database->loadObject();
}
else
{
$contentElement = $database->loadObject(false);
}
$shTemp = explode(' ', $contentElement->created);
$title[] = str_replace('-', '', $shTemp[0]).$contentElement->id;
}
if (!shTranslateUrl($option, $shLangName))
{
$query = 'SELECT '.$sh404SefTitleAlias.', catid FROM #__k2_items WHERE id = '.$id;
}
else
{
$query = 'SELECT id, '.$sh404SefTitleAlias.', catid FROM #__k2_items WHERE id = '.$id;
}
$database->setQuery($query);
if (shTranslateUrl($option, $shLangName))
$row = $database->loadObject();
else
$row = $database->loadObject(false);
switch($itemPrefix)
{
case 0 :
break;
case 1 :
$fullPath = getCategoryPath($row->catid, true);
$title[] = array_pop($fullPath);
break;
default :
case 2 :
$fullPath = getCategoryPath($row->catid, true);
foreach ($fullPath as $path)
{
$title[] = $path;
}
break;
}
if ($sh404SefInsertItemId)
{
$title[] = $row->id.'-'.$row->$sh404SefTitleAlias;
}
else
{
$title[] = $row->$sh404SefTitleAlias;
}
shMustCreatePageId('set', true);
}
break;
case 'itemlist' :
switch ($task)
{
case 'category' :
if (!empty($itemlistPrefix))
{
$title[] = $itemlistPrefix;
}
$fullPath = getCategoryPath($id, true);
foreach ($fullPath as $path)
{
$title[] = $path;
}
shMustCreatePageId('set', true);
break;
case 'user' :
$user = JFactory::getUser($id);
if (!empty($authorPrefix))
{
$title[] = $authorPrefix;
}
$title[] = $user->name;
break;
case 'tag' :
$title[] = 'tag';
$tag = str_replace('%20', '-', $tag);
$tag = str_replace('+', '-', $tag);
$title[] = $tag;
shMustCreatePageId('set', true);
break;
case 'search' :
$title[] = 'search';
if (!empty($searchword))
$title[] = $searchword;
break;
case 'date' :
$title[] = 'date';
if (!empty($year))
$title[] = $year;
if (!empty($month))
$title[] = $month;
if (!empty($day))
$title[] = $day;
break;
case 'module' :
$query = 'SELECT title FROM #__modules WHERE id = '.(int)$moduleID;
$database->setQuery($query);
$moduleTitle = $database->loadResult();
$moduleTitle = str_replace(' ', '-', $moduleTitle);
if ($sh404SefModK2ContentFeedAlias)
{
$title[] = $sh404SefModK2ContentFeedAlias;
}
$title[] = $moduleTitle;
break;
default :
if (isset($Itemid))
{
$title[] = $menu->getItem($Itemid)->alias;
shMustCreatePageId('set', true);
}
break;
}
break;
case 'latest' :
if (isset($Itemid))
{
$title[] = $menu->getItem($Itemid)->alias;
shMustCreatePageId('set', true);
}
break;
}
if (!empty($format) && $format == 'feed')
{
$title[] = $format;
if (!empty($type) && $format != $type)
{
$title[] = $type;
}
}
if (isset($layout))
shRemoveFromGETVarsList('layout');
if (isset($task))
shRemoveFromGETVarsList('task');
if (isset($tag))
shRemoveFromGETVarsList('tag');
if (isset($searchword))
shRemoveFromGETVarsList('searchword');
if (isset($view))
shRemoveFromGETVarsList('view');
if (isset($Itemid))
shRemoveFromGETVarsList('Itemid');
if (isset($year))
shRemoveFromGETVarsList('year');
if (isset($month))
shRemoveFromGETVarsList('month');
if (isset($day))
shRemoveFromGETVarsList('day');
if (isset($id))
shRemoveFromGETVarsList('id');
/*
* Only remove format variable if form is html. In all other situations, leave it there as some system plugins
* may cause pdf and rss to break if they call JFactory::getDocument() in the onAfterInitialize event handler
* because at this time SEF url are not decoded yet.
*
*/
if (isset($format) && (!sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR || (sh404SEF_PROTECT_AGAINST_DOCUMENT_TYPE_ERROR && $format == 'html')))
{
shRemoveFromGETVarsList('format');
}
if (isset($moduleID))
{
shRemoveFromGETVarsList('moduleID');
}
// ------------------ Standard plugin finalize function - don't change ---------------------------
if ($dosef)
{
$string = shFinalizePlugin($string, $title, $shAppendString, $shItemidString, (isset($limit) ? @$limit : null), (isset($limitstart) ? @$limitstart : null), (isset($shLangName) ? @$shLangName : null));
}
// ------------------ Standard plugin finalize function - don't change ---------------------------

View File

@ -0,0 +1,264 @@
<?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;
?>
<!-- Start K2 Category Layout -->
<div id="k2Container" class="itemListView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>">
<?php if($this->params->get('show_page_title')): ?>
<!-- Page title -->
<div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>">
<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>
<?php if($this->params->get('catFeedIcon')): ?>
<!-- RSS feed icon -->
<div class="k2FeedIcon">
<a href="<?php echo $this->feed; ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
</a>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(isset($this->category) || ( $this->params->get('subCategories') && isset($this->subCategories) && count($this->subCategories) )): ?>
<!-- Blocks for current category and subcategories -->
<div class="itemListCategoriesBlock">
<?php if(isset($this->category) && ( $this->params->get('catImage') || $this->params->get('catTitle') || $this->params->get('catDescription') || $this->category->event->K2CategoryDisplay )): ?>
<!-- Category block -->
<div class="itemListCategory">
<?php if(isset($this->addLink)): ?>
<!-- Item add link -->
<span class="catItemAddLink">
<a class="modal" rel="{handler:'iframe',size:{x:990,y:650}}" href="<?php echo $this->addLink; ?>">
<?php echo JText::_('K2_ADD_A_NEW_ITEM_IN_THIS_CATEGORY'); ?>
</a>
</span>
<?php endif; ?>
<?php if($this->params->get('catImage') && $this->category->image): ?>
<!-- Category image -->
<img alt="<?php echo K2HelperUtilities::cleanHtml($this->category->name); ?>" src="<?php echo $this->category->image; ?>" style="width:<?php echo $this->params->get('catImageWidth'); ?>px; height:auto;" />
<?php endif; ?>
<?php if($this->params->get('catTitle')): ?>
<!-- Category title -->
<h2><?php echo $this->category->name; ?><?php if($this->params->get('catTitleItemCounter')) echo ' ('.$this->pagination->total.')'; ?></h2>
<?php endif; ?>
<?php if($this->params->get('catDescription')): ?>
<!-- Category description -->
<p><?php echo $this->category->description; ?></p>
<?php endif; ?>
<!-- K2 Plugins: K2CategoryDisplay -->
<?php echo $this->category->event->K2CategoryDisplay; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->params->get('subCategories') && isset($this->subCategories) && count($this->subCategories)): ?>
<!-- Subcategories -->
<div class="itemListSubCategories">
<h3><?php echo JText::_('K2_CHILDREN_CATEGORIES'); ?></h3>
<?php foreach($this->subCategories as $key=>$subCategory): ?>
<?php
// Define a CSS class for the last container on each row
if( (($key+1)%($this->params->get('subCatColumns'))==0))
$lastContainer= ' subCategoryContainerLast';
else
$lastContainer='';
?>
<div class="subCategoryContainer<?php echo $lastContainer; ?>"<?php echo (count($this->subCategories)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('subCatColumns'), 1).'%;"'; ?>>
<div class="subCategory">
<?php if($this->params->get('subCatImage') && $subCategory->image): ?>
<!-- Subcategory image -->
<a class="subCategoryImage" href="<?php echo $subCategory->link; ?>">
<img alt="<?php echo K2HelperUtilities::cleanHtml($subCategory->name); ?>" src="<?php echo $subCategory->image; ?>" />
</a>
<?php endif; ?>
<?php if($this->params->get('subCatTitle')): ?>
<!-- Subcategory title -->
<h2>
<a href="<?php echo $subCategory->link; ?>">
<?php echo $subCategory->name; ?><?php if($this->params->get('subCatTitleItemCounter')) echo ' ('.$subCategory->numOfItems.')'; ?>
</a>
</h2>
<?php endif; ?>
<?php if($this->params->get('subCatDescription')): ?>
<!-- Subcategory description -->
<p><?php echo $subCategory->description; ?></p>
<?php endif; ?>
<!-- Subcategory more... -->
<a class="subCategoryMore" href="<?php echo $subCategory->link; ?>">
<?php echo JText::_('K2_VIEW_ITEMS'); ?>
</a>
<div class="clr"></div>
</div>
</div>
<?php if(($key+1)%($this->params->get('subCatColumns'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if((isset($this->leading) || isset($this->primary) || isset($this->secondary) || isset($this->links)) && (count($this->leading) || count($this->primary) || count($this->secondary) || count($this->links))): ?>
<!-- Item list -->
<div class="itemList">
<?php if(isset($this->leading) && count($this->leading)): ?>
<!-- Leading items -->
<div id="itemListLeading">
<?php foreach($this->leading as $key=>$item): ?>
<?php
// Define a CSS class for the last container on each row
if( (($key+1)%($this->params->get('num_leading_columns'))==0) || count($this->leading)<$this->params->get('num_leading_columns') )
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->leading)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_leading_columns'), 1).'%;"'; ?>>
<?php
// Load category_item.php by default
$this->item=$item;
echo $this->loadTemplate('item');
?>
</div>
<?php if(($key+1)%($this->params->get('num_leading_columns'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(isset($this->primary) && count($this->primary)): ?>
<!-- Primary items -->
<div id="itemListPrimary">
<?php foreach($this->primary as $key=>$item): ?>
<?php
// Define a CSS class for the last container on each row
if( (($key+1)%($this->params->get('num_primary_columns'))==0) || count($this->primary)<$this->params->get('num_primary_columns') )
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->primary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_primary_columns'), 1).'%;"'; ?>>
<?php
// Load category_item.php by default
$this->item=$item;
echo $this->loadTemplate('item');
?>
</div>
<?php if(($key+1)%($this->params->get('num_primary_columns'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(isset($this->secondary) && count($this->secondary)): ?>
<!-- Secondary items -->
<div id="itemListSecondary">
<?php foreach($this->secondary as $key=>$item): ?>
<?php
// Define a CSS class for the last container on each row
if( (($key+1)%($this->params->get('num_secondary_columns'))==0) || count($this->secondary)<$this->params->get('num_secondary_columns') )
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->secondary)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_secondary_columns'), 1).'%;"'; ?>>
<?php
// Load category_item.php by default
$this->item=$item;
echo $this->loadTemplate('item');
?>
</div>
<?php if(($key+1)%($this->params->get('num_secondary_columns'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(isset($this->links) && count($this->links)): ?>
<!-- Link items -->
<div id="itemListLinks">
<h4><?php echo JText::_('K2_MORE'); ?></h4>
<?php foreach($this->links as $key=>$item): ?>
<?php
// Define a CSS class for the last container on each row
if( (($key+1)%($this->params->get('num_links_columns'))==0) || count($this->links)<$this->params->get('num_links_columns') )
$lastContainer= ' itemContainerLast';
else
$lastContainer='';
?>
<div class="itemContainer<?php echo $lastContainer; ?>"<?php echo (count($this->links)==1) ? '' : ' style="width:'.number_format(100/$this->params->get('num_links_columns'), 1).'%;"'; ?>>
<?php
// Load category_item_links.php by default
$this->item=$item;
echo $this->loadTemplate('item_links');
?>
</div>
<?php if(($key+1)%($this->params->get('num_links_columns'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
</div>
<!-- Pagination -->
<?php if(count($this->pagination->getPagesLinks())): ?>
<div class="k2Pagination">
<?php if($this->params->get('catPagination')) echo $this->pagination->getPagesLinks(); ?>
<div class="clr"></div>
<?php if($this->params->get('catPaginationResults')) echo $this->pagination->getPagesCounter(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<!-- End K2 Category Layout -->

View File

@ -0,0 +1,300 @@
<?php
/**
* @version $Id: category_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;
// Define default image size (do not change)
K2HelperUtilities::setDefaultImage($this->item, 'itemlist', $this->params);
?>
<!-- Start K2 Item Layout -->
<div class="catItemView group<?php echo ucfirst($this->item->itemGroup); ?><?php echo ($this->item->featured) ? ' catItemIsFeatured' : ''; ?><?php if($this->item->params->get('pageclass_sfx')) echo ' '.$this->item->params->get('pageclass_sfx'); ?>">
<!-- Plugins: BeforeDisplay -->
<?php echo $this->item->event->BeforeDisplay; ?>
<!-- K2 Plugins: K2BeforeDisplay -->
<?php echo $this->item->event->K2BeforeDisplay; ?>
<div class="catItemHeader">
<?php if($this->item->params->get('catItemDateCreated')): ?>
<!-- Date created -->
<span class="catItemDateCreated">
<?php echo JHTML::_('date', $this->item->created , JText::_('K2_DATE_FORMAT_LC2')); ?>
</span>
<?php endif; ?>
<?php if($this->item->params->get('catItemTitle')): ?>
<!-- Item title -->
<h3 class="catItemTitle">
<?php if(isset($this->item->editLink)): ?>
<!-- Item edit link -->
<span class="catItemEditLink">
<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $this->item->editLink; ?>">
<?php echo JText::_('K2_EDIT_ITEM'); ?>
</a>
</span>
<?php endif; ?>
<?php if ($this->item->params->get('catItemTitleLinked')): ?>
<a href="<?php echo $this->item->link; ?>">
<?php echo $this->item->title; ?>
</a>
<?php else: ?>
<?php echo $this->item->title; ?>
<?php endif; ?>
<?php if($this->item->params->get('catItemFeaturedNotice') && $this->item->featured): ?>
<!-- Featured flag -->
<span>
<sup>
<?php echo JText::_('K2_FEATURED'); ?>
</sup>
</span>
<?php endif; ?>
</h3>
<?php endif; ?>
<?php if($this->item->params->get('catItemAuthor')): ?>
<!-- Item Author -->
<span class="catItemAuthor">
<?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?>
<?php if(isset($this->item->author->link) && $this->item->author->link): ?>
<a rel="author" href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a>
<?php else: ?>
<?php echo $this->item->author->name; ?>
<?php endif; ?>
</span>
<?php endif; ?>
</div>
<!-- Plugins: AfterDisplayTitle -->
<?php echo $this->item->event->AfterDisplayTitle; ?>
<!-- K2 Plugins: K2AfterDisplayTitle -->
<?php echo $this->item->event->K2AfterDisplayTitle; ?>
<?php if($this->item->params->get('catItemRating')): ?>
<!-- Item Rating -->
<div class="catItemRatingBlock">
<span><?php echo JText::_('K2_RATE_THIS_ITEM'); ?></span>
<div class="itemRatingForm">
<ul class="itemRatingList">
<li class="itemCurrentRating" id="itemCurrentRating<?php echo $this->item->id; ?>" style="width:<?php echo $this->item->votingPercentage; ?>%;"></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_1_STAR_OUT_OF_5'); ?>" class="one-star">1</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_2_STARS_OUT_OF_5'); ?>" class="two-stars">2</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_3_STARS_OUT_OF_5'); ?>" class="three-stars">3</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_4_STARS_OUT_OF_5'); ?>" class="four-stars">4</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_5_STARS_OUT_OF_5'); ?>" class="five-stars">5</a></li>
</ul>
<div id="itemRatingLog<?php echo $this->item->id; ?>" class="itemRatingLog"><?php echo $this->item->numOfvotes; ?></div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<?php endif; ?>
<div class="catItemBody">
<!-- Plugins: BeforeDisplayContent -->
<?php echo $this->item->event->BeforeDisplayContent; ?>
<!-- K2 Plugins: K2BeforeDisplayContent -->
<?php echo $this->item->event->K2BeforeDisplayContent; ?>
<?php if($this->item->params->get('catItemImage') && !empty($this->item->image)): ?>
<!-- Item Image -->
<div class="catItemImageBlock">
<span class="catItemImage">
<a href="<?php echo $this->item->link; ?>" title="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>">
<img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
</a>
</span>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('catItemIntroText')): ?>
<!-- Item introtext -->
<div class="catItemIntroText">
<?php echo $this->item->introtext; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if($this->item->params->get('catItemExtraFields') && count($this->item->extra_fields)): ?>
<!-- Item extra fields -->
<div class="catItemExtraFields">
<h4><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h4>
<ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="catItemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<span class="catItemExtraFieldsLabel"><?php echo $extraField->name; ?></span>
<span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<!-- Plugins: AfterDisplayContent -->
<?php echo $this->item->event->AfterDisplayContent; ?>
<!-- K2 Plugins: K2AfterDisplayContent -->
<?php echo $this->item->event->K2AfterDisplayContent; ?>
<div class="clr"></div>
</div>
<?php if(
$this->item->params->get('catItemHits') ||
$this->item->params->get('catItemCategory') ||
$this->item->params->get('catItemTags') ||
$this->item->params->get('catItemAttachments')
): ?>
<div class="catItemLinks">
<?php if($this->item->params->get('catItemHits')): ?>
<!-- Item Hits -->
<div class="catItemHitsBlock">
<span class="catItemHits">
<?php echo JText::_('K2_READ'); ?> <b><?php echo $this->item->hits; ?></b> <?php echo JText::_('K2_TIMES'); ?>
</span>
</div>
<?php endif; ?>
<?php if($this->item->params->get('catItemCategory')): ?>
<!-- Item category name -->
<div class="catItemCategory">
<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
<a href="<?php echo $this->item->category->link; ?>"><?php echo $this->item->category->name; ?></a>
</div>
<?php endif; ?>
<?php if($this->item->params->get('catItemTags') && count($this->item->tags)): ?>
<!-- Item tags -->
<div class="catItemTagsBlock">
<span><?php echo JText::_('K2_TAGGED_UNDER'); ?></span>
<ul class="catItemTags">
<?php foreach ($this->item->tags as $tag): ?>
<li><a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a></li>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('catItemAttachments') && count($this->item->attachments)): ?>
<!-- Item attachments -->
<div class="catItemAttachmentsBlock">
<span><?php echo JText::_('K2_DOWNLOAD_ATTACHMENTS'); ?></span>
<ul class="catItemAttachments">
<?php foreach ($this->item->attachments as $attachment): ?>
<li>
<a title="<?php echo K2HelperUtilities::cleanHtml($attachment->titleAttribute); ?>" href="<?php echo $attachment->link; ?>">
<?php echo $attachment->title ; ?>
</a>
<?php if($this->item->params->get('catItemAttachmentsCounter')): ?>
<span>(<?php echo $attachment->hits; ?> <?php echo ($attachment->hits==1) ? JText::_('K2_DOWNLOAD') : JText::_('K2_DOWNLOADS'); ?>)</span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if($this->item->params->get('catItemVideo') && !empty($this->item->video)): ?>
<!-- Item video -->
<div class="catItemVideoBlock">
<h3><?php echo JText::_('K2_RELATED_VIDEO'); ?></h3>
<?php if($this->item->videoType=='embedded'): ?>
<div class="catItemVideoEmbedded">
<?php echo $this->item->video; ?>
</div>
<?php else: ?>
<span class="catItemVideo"><?php echo $this->item->video; ?></span>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if($this->item->params->get('catItemImageGallery') && !empty($this->item->gallery)): ?>
<!-- Item image gallery -->
<div class="catItemImageGallery">
<h4><?php echo JText::_('K2_IMAGE_GALLERY'); ?></h4>
<?php echo $this->item->gallery; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if($this->item->params->get('catItemCommentsAnchor') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1')) ): ?>
<!-- Anchor link to comments below -->
<div class="catItemCommentsLink">
<?php if(!empty($this->item->event->K2CommentsCounter)): ?>
<!-- K2 Plugins: K2CommentsCounter -->
<?php echo $this->item->event->K2CommentsCounter; ?>
<?php else: ?>
<?php if($this->item->numOfComments > 0): ?>
<a href="<?php echo $this->item->link; ?>#itemCommentsAnchor">
<?php echo $this->item->numOfComments; ?> <?php echo ($this->item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?>
</a>
<?php else: ?>
<a href="<?php echo $this->item->link; ?>#itemCommentsAnchor">
<?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($this->item->params->get('catItemReadMore')): ?>
<!-- Item "read more..." link -->
<div class="catItemReadMore">
<a class="k2ReadMore" href="<?php echo $this->item->link; ?>">
<?php echo JText::_('K2_READ_MORE'); ?>
</a>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if($this->item->params->get('catItemDateModified')): ?>
<!-- Item date modified -->
<?php if($this->item->modified != $this->nullDate && $this->item->modified != $this->item->created ): ?>
<span class="catItemDateModified">
<?php echo JText::_('K2_LAST_MODIFIED_ON'); ?> <?php echo JHTML::_('date', $this->item->modified, JText::_('K2_DATE_FORMAT_LC2')); ?>
</span>
<?php endif; ?>
<?php endif; ?>
<!-- Plugins: AfterDisplay -->
<?php echo $this->item->event->AfterDisplay; ?>
<!-- K2 Plugins: K2AfterDisplay -->
<?php echo $this->item->event->K2AfterDisplay; ?>
<div class="clr"></div>
</div>
<!-- End K2 Item Layout -->

View File

@ -0,0 +1,46 @@
<?php
/**
* @version $Id: category_item_links.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;
// Define default image size (do not change)
K2HelperUtilities::setDefaultImage($this->item, 'itemlist', $this->params);
?>
<!-- Start K2 Item Layout (links) -->
<div class="catItemView group<?php echo ucfirst($this->item->itemGroup); ?><?php if($this->item->params->get('pageclass_sfx')) echo ' '.$this->item->params->get('pageclass_sfx'); ?>">
<?php if($this->item->params->get('catItemTitle')): ?>
<!-- Item title -->
<h3 class="catItemTitle">
<?php if ($this->item->params->get('catItemTitleLinked')): ?>
<a href="<?php echo $this->item->link; ?>">
<?php echo $this->item->title; ?>
</a>
<?php else: ?>
<?php echo $this->item->title; ?>
<?php endif; ?>
</h3>
<?php if($this->item->params->get('catItemImage') && !empty($this->item->image)): ?>
<!-- Item Image -->
<div class="catItemImageBlock">
<span class="catItemImage">
<a href="<?php echo $this->item->link; ?>" title="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>">
<img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
</a>
</span>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<!-- End K2 Item Layout (links) -->

View File

@ -0,0 +1,685 @@
<?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;
?>
<?php if(JRequest::getInt('print')==1): ?>
<!-- Print button at the top of the print page only -->
<a class="itemPrintThisPage" rel="nofollow" href="#" onclick="window.print();return false;">
<span><?php echo JText::_('K2_PRINT_THIS_PAGE'); ?></span>
</a>
<?php endif; ?>
<!-- Start K2 Item Layout -->
<span id="startOfPageId<?php echo JRequest::getInt('id'); ?>"></span>
<div id="k2Container" class="itemView<?php echo ($this->item->featured) ? ' itemIsFeatured' : ''; ?><?php if($this->item->params->get('pageclass_sfx')) echo ' '.$this->item->params->get('pageclass_sfx'); ?>">
<!-- Plugins: BeforeDisplay -->
<?php echo $this->item->event->BeforeDisplay; ?>
<!-- K2 Plugins: K2BeforeDisplay -->
<?php echo $this->item->event->K2BeforeDisplay; ?>
<div class="itemHeader">
<?php if($this->item->params->get('itemDateCreated')): ?>
<!-- Date created -->
<span class="itemDateCreated">
<?php echo JHTML::_('date', $this->item->created , JText::_('K2_DATE_FORMAT_LC2')); ?>
</span>
<?php endif; ?>
<?php if($this->item->params->get('itemTitle')): ?>
<!-- Item title -->
<h2 class="itemTitle">
<?php if(isset($this->item->editLink)): ?>
<!-- Item edit link -->
<span class="itemEditLink">
<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $this->item->editLink; ?>">
<?php echo JText::_('K2_EDIT_ITEM'); ?>
</a>
</span>
<?php endif; ?>
<?php echo $this->item->title; ?>
<?php if($this->item->params->get('itemFeaturedNotice') && $this->item->featured): ?>
<!-- Featured flag -->
<span>
<sup>
<?php echo JText::_('K2_FEATURED'); ?>
</sup>
</span>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php if($this->item->params->get('itemAuthor')): ?>
<!-- Item Author -->
<span class="itemAuthor">
<?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?>&nbsp;
<?php if(empty($this->item->created_by_alias)): ?>
<a rel="author" href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a>
<?php else: ?>
<?php echo $this->item->author->name; ?>
<?php endif; ?>
</span>
<?php endif; ?>
</div>
<!-- Plugins: AfterDisplayTitle -->
<?php echo $this->item->event->AfterDisplayTitle; ?>
<!-- K2 Plugins: K2AfterDisplayTitle -->
<?php echo $this->item->event->K2AfterDisplayTitle; ?>
<?php if(
$this->item->params->get('itemFontResizer') ||
$this->item->params->get('itemPrintButton') ||
$this->item->params->get('itemEmailButton') ||
$this->item->params->get('itemSocialButton') ||
$this->item->params->get('itemVideoAnchor') ||
$this->item->params->get('itemImageGalleryAnchor') ||
$this->item->params->get('itemCommentsAnchor')
): ?>
<div class="itemToolbar">
<ul>
<?php if($this->item->params->get('itemFontResizer')): ?>
<!-- Font Resizer -->
<li>
<span class="itemTextResizerTitle"><?php echo JText::_('K2_FONT_SIZE'); ?></span>
<a href="#" id="fontDecrease">
<span><?php echo JText::_('K2_DECREASE_FONT_SIZE'); ?></span>
<img src="<?php echo JURI::root(true); ?>/components/com_k2/images/system/blank.gif" alt="<?php echo JText::_('K2_DECREASE_FONT_SIZE'); ?>" />
</a>
<a href="#" id="fontIncrease">
<span><?php echo JText::_('K2_INCREASE_FONT_SIZE'); ?></span>
<img src="<?php echo JURI::root(true); ?>/components/com_k2/images/system/blank.gif" alt="<?php echo JText::_('K2_INCREASE_FONT_SIZE'); ?>" />
</a>
</li>
<?php endif; ?>
<?php if($this->item->params->get('itemPrintButton') && !JRequest::getInt('print')): ?>
<!-- Print Button -->
<li>
<a class="itemPrintLink" rel="nofollow" href="<?php echo $this->item->printLink; ?>" onclick="window.open(this.href,'printWindow','width=900,height=600,location=no,menubar=no,resizable=yes,scrollbars=yes'); return false;">
<span><?php echo JText::_('K2_PRINT'); ?></span>
</a>
</li>
<?php endif; ?>
<?php if($this->item->params->get('itemEmailButton') && !JRequest::getInt('print')): ?>
<!-- Email Button -->
<li>
<a class="itemEmailLink" rel="nofollow" href="<?php echo $this->item->emailLink; ?>" onclick="window.open(this.href,'emailWindow','width=400,height=350,location=no,menubar=no,resizable=no,scrollbars=no'); return false;">
<span><?php echo JText::_('K2_EMAIL'); ?></span>
</a>
</li>
<?php endif; ?>
<?php if($this->item->params->get('itemSocialButton') && !is_null($this->item->params->get('socialButtonCode', NULL))): ?>
<!-- Item Social Button -->
<li>
<?php echo $this->item->params->get('socialButtonCode'); ?>
</li>
<?php endif; ?>
<?php if($this->item->params->get('itemVideoAnchor') && !empty($this->item->video)): ?>
<!-- Anchor link to item video below - if it exists -->
<li>
<a class="itemVideoLink k2Anchor" href="<?php echo $this->item->link; ?>#itemVideoAnchor"><?php echo JText::_('K2_MEDIA'); ?></a>
</li>
<?php endif; ?>
<?php if($this->item->params->get('itemImageGalleryAnchor') && !empty($this->item->gallery)): ?>
<!-- Anchor link to item image gallery below - if it exists -->
<li>
<a class="itemImageGalleryLink k2Anchor" href="<?php echo $this->item->link; ?>#itemImageGalleryAnchor"><?php echo JText::_('K2_IMAGE_GALLERY'); ?></a>
</li>
<?php endif; ?>
<?php if($this->item->params->get('itemCommentsAnchor') && $this->item->params->get('itemComments') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1')) ): ?>
<!-- Anchor link to comments below - if enabled -->
<li>
<?php if(!empty($this->item->event->K2CommentsCounter)): ?>
<!-- K2 Plugins: K2CommentsCounter -->
<?php echo $this->item->event->K2CommentsCounter; ?>
<?php else: ?>
<?php if($this->item->numOfComments > 0): ?>
<a class="itemCommentsLink k2Anchor" href="<?php echo $this->item->link; ?>#itemCommentsAnchor">
<span><?php echo $this->item->numOfComments; ?></span> <?php echo ($this->item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?>
</a>
<?php else: ?>
<a class="itemCommentsLink k2Anchor" href="<?php echo $this->item->link; ?>#itemCommentsAnchor">
<?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?>
</a>
<?php endif; ?>
<?php endif; ?>
</li>
<?php endif; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemRating')): ?>
<!-- Item Rating -->
<div class="itemRatingBlock">
<span><?php echo JText::_('K2_RATE_THIS_ITEM'); ?></span>
<div class="itemRatingForm">
<ul class="itemRatingList">
<li class="itemCurrentRating" id="itemCurrentRating<?php echo $this->item->id; ?>" style="width:<?php echo $this->item->votingPercentage; ?>%;"></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_1_STAR_OUT_OF_5'); ?>" class="one-star">1</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_2_STARS_OUT_OF_5'); ?>" class="two-stars">2</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_3_STARS_OUT_OF_5'); ?>" class="three-stars">3</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_4_STARS_OUT_OF_5'); ?>" class="four-stars">4</a></li>
<li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_5_STARS_OUT_OF_5'); ?>" class="five-stars">5</a></li>
</ul>
<div id="itemRatingLog<?php echo $this->item->id; ?>" class="itemRatingLog"><?php echo $this->item->numOfvotes; ?></div>
<div class="clr"></div>
</div>
<div class="clr"></div>
</div>
<?php endif; ?>
<div class="itemBody">
<!-- Plugins: BeforeDisplayContent -->
<?php echo $this->item->event->BeforeDisplayContent; ?>
<!-- K2 Plugins: K2BeforeDisplayContent -->
<?php echo $this->item->event->K2BeforeDisplayContent; ?>
<?php if($this->item->params->get('itemImage') && !empty($this->item->image)): ?>
<!-- Item Image -->
<div class="itemImageBlock">
<span class="itemImage">
<a class="modal" rel="{handler: 'image'}" href="<?php echo $this->item->imageXLarge; ?>" title="<?php echo JText::_('K2_CLICK_TO_PREVIEW_IMAGE'); ?>">
<img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" />
</a>
</span>
<?php if($this->item->params->get('itemImageMainCaption') && !empty($this->item->image_caption)): ?>
<!-- Image caption -->
<span class="itemImageCaption"><?php echo $this->item->image_caption; ?></span>
<?php endif; ?>
<?php if($this->item->params->get('itemImageMainCredits') && !empty($this->item->image_credits)): ?>
<!-- Image credits -->
<span class="itemImageCredits"><?php echo $this->item->image_credits; ?></span>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(!empty($this->item->fulltext)): ?>
<?php if($this->item->params->get('itemIntroText')): ?>
<!-- Item introtext -->
<div class="itemIntroText">
<?php echo $this->item->introtext; ?>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemFullText')): ?>
<!-- Item fulltext -->
<div class="itemFullText">
<?php echo $this->item->fulltext; ?>
</div>
<?php endif; ?>
<?php else: ?>
<!-- Item text -->
<div class="itemFullText">
<?php echo $this->item->introtext; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if($this->item->params->get('itemExtraFields') && count($this->item->extra_fields)): ?>
<!-- Item extra fields -->
<div class="itemExtraFields">
<h3><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h3>
<ul>
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="itemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<span class="itemExtraFieldsLabel"><?php echo $extraField->name; ?>:</span>
<span class="itemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemHits') || ($this->item->params->get('itemDateModified') && intval($this->item->modified)!=0)): ?>
<div class="itemContentFooter">
<?php if($this->item->params->get('itemHits')): ?>
<!-- Item Hits -->
<span class="itemHits">
<?php echo JText::_('K2_READ'); ?> <b><?php echo $this->item->hits; ?></b> <?php echo JText::_('K2_TIMES'); ?>
</span>
<?php endif; ?>
<?php if($this->item->params->get('itemDateModified') && intval($this->item->modified)!=0): ?>
<!-- Item date modified -->
<span class="itemDateModified">
<?php echo JText::_('K2_LAST_MODIFIED_ON'); ?> <?php echo JHTML::_('date', $this->item->modified, JText::_('K2_DATE_FORMAT_LC2')); ?>
</span>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<!-- Plugins: AfterDisplayContent -->
<?php echo $this->item->event->AfterDisplayContent; ?>
<!-- K2 Plugins: K2AfterDisplayContent -->
<?php echo $this->item->event->K2AfterDisplayContent; ?>
<div class="clr"></div>
</div>
<?php if($this->item->params->get('itemTwitterButton',1) || $this->item->params->get('itemFacebookButton',1) || $this->item->params->get('itemGooglePlusOneButton',1)): ?>
<!-- Social sharing -->
<div class="itemSocialSharing">
<?php if($this->item->params->get('itemTwitterButton',1)): ?>
<!-- Twitter Button -->
<div class="itemTwitterButton">
<a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal"<?php if($this->item->params->get('twitterUsername')): ?> data-via="<?php echo $this->item->params->get('twitterUsername'); ?>"<?php endif; ?>>
<?php echo JText::_('K2_TWEET'); ?>
</a>
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemFacebookButton',1)): ?>
<!-- Facebook Button -->
<div class="itemFacebookButton">
<div id="fb-root"></div>
<script type="text/javascript">
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-like" data-send="false" data-width="200" data-show-faces="true"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemGooglePlusOneButton',1)): ?>
<!-- Google +1 Button -->
<div class="itemGooglePlusOneButton">
<g:plusone annotation="inline" width="120"></g:plusone>
<script type="text/javascript">
(function() {
window.___gcfg = {lang: 'en'}; // Define button default language here
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemCategory') || $this->item->params->get('itemTags') || $this->item->params->get('itemAttachments')): ?>
<div class="itemLinks">
<?php if($this->item->params->get('itemCategory')): ?>
<!-- Item category -->
<div class="itemCategory">
<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
<a href="<?php echo $this->item->category->link; ?>"><?php echo $this->item->category->name; ?></a>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemTags') && count($this->item->tags)): ?>
<!-- Item tags -->
<div class="itemTagsBlock">
<span><?php echo JText::_('K2_TAGGED_UNDER'); ?></span>
<ul class="itemTags">
<?php foreach ($this->item->tags as $tag): ?>
<li><a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a></li>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemAttachments') && count($this->item->attachments)): ?>
<!-- Item attachments -->
<div class="itemAttachmentsBlock">
<span><?php echo JText::_('K2_DOWNLOAD_ATTACHMENTS'); ?></span>
<ul class="itemAttachments">
<?php foreach ($this->item->attachments as $attachment): ?>
<li>
<a title="<?php echo K2HelperUtilities::cleanHtml($attachment->titleAttribute); ?>" href="<?php echo $attachment->link; ?>"><?php echo $attachment->title; ?></a>
<?php if($this->item->params->get('itemAttachmentsCounter')): ?>
<span>(<?php echo $attachment->hits; ?> <?php echo ($attachment->hits==1) ? JText::_('K2_DOWNLOAD') : JText::_('K2_DOWNLOADS'); ?>)</span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemAuthorBlock') && empty($this->item->created_by_alias)): ?>
<!-- Author Block -->
<div class="itemAuthorBlock">
<?php if($this->item->params->get('itemAuthorImage') && !empty($this->item->author->avatar)): ?>
<img class="itemAuthorAvatar" src="<?php echo $this->item->author->avatar; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($this->item->author->name); ?>" />
<?php endif; ?>
<div class="itemAuthorDetails">
<h3 class="itemAuthorName">
<a rel="author" href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a>
</h3>
<?php if($this->item->params->get('itemAuthorDescription') && !empty($this->item->author->profile->description)): ?>
<p><?php echo $this->item->author->profile->description; ?></p>
<?php endif; ?>
<?php if($this->item->params->get('itemAuthorURL') && !empty($this->item->author->profile->url)): ?>
<span class="itemAuthorUrl"><?php echo JText::_('K2_WEBSITE'); ?> <a rel="me" href="<?php echo $this->item->author->profile->url; ?>" target="_blank"><?php echo str_replace('http://','',$this->item->author->profile->url); ?></a></span>
<?php endif; ?>
<?php if($this->item->params->get('itemAuthorEmail')): ?>
<span class="itemAuthorEmail"><?php echo JText::_('K2_EMAIL'); ?> <?php echo JHTML::_('Email.cloak', $this->item->author->email); ?></span>
<?php endif; ?>
<div class="clr"></div>
<!-- K2 Plugins: K2UserDisplay -->
<?php echo $this->item->event->K2UserDisplay; ?>
</div>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemAuthorLatest') && empty($this->item->created_by_alias) && isset($this->authorLatestItems)): ?>
<!-- Latest items from author -->
<div class="itemAuthorLatest">
<h3><?php echo JText::_('K2_LATEST_FROM'); ?> <?php echo $this->item->author->name; ?></h3>
<ul>
<?php foreach($this->authorLatestItems as $key=>$item): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?>">
<a href="<?php echo $item->link ?>"><?php echo $item->title; ?></a>
</li>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php
/*
Note regarding 'Related Items'!
If you add:
- the CSS rule 'overflow-x:scroll;' in the element div.itemRelated {…} in the k2.css
- the class 'k2Scroller' to the ul element below
- the classes 'k2ScrollerElement' and 'k2EqualHeights' to the li element inside the foreach loop below
- the style attribute 'style="width:<?php echo $item->imageWidth; ?>px;"' to the li element inside the foreach loop below
...then your Related Items will be transformed into a vertical-scrolling block, inside which, all items have the same height (equal column heights). This can be very useful if you want to show your related articles or products with title/author/category/image etc., which would take a significant amount of space in the classic list-style display.
*/
?>
<?php if($this->item->params->get('itemRelated') && isset($this->relatedItems)): ?>
<!-- Related items by tag -->
<div class="itemRelated">
<h3><?php echo JText::_("K2_RELATED_ITEMS_BY_TAG"); ?></h3>
<ul>
<?php foreach($this->relatedItems as $key=>$item): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?>">
<?php if($this->item->params->get('itemRelatedTitle', 1)): ?>
<a class="itemRelTitle" href="<?php echo $item->link ?>"><?php echo $item->title; ?></a>
<?php endif; ?>
<?php if($this->item->params->get('itemRelatedCategory')): ?>
<div class="itemRelCat"><?php echo JText::_("K2_IN"); ?> <a href="<?php echo $item->category->link ?>"><?php echo $item->category->name; ?></a></div>
<?php endif; ?>
<?php if($this->item->params->get('itemRelatedAuthor')): ?>
<div class="itemRelAuthor"><?php echo JText::_("K2_BY"); ?> <a rel="author" href="<?php echo $item->author->link; ?>"><?php echo $item->author->name; ?></a></div>
<?php endif; ?>
<?php if($this->item->params->get('itemRelatedImageSize')): ?>
<img style="width:<?php echo $item->imageWidth; ?>px;height:auto;" class="itemRelImg" src="<?php echo $item->image; ?>" alt="<?php K2HelperUtilities::cleanHtml($item->title); ?>" />
<?php endif; ?>
<?php if($this->item->params->get('itemRelatedIntrotext')): ?>
<div class="itemRelIntrotext"><?php echo $item->introtext; ?></div>
<?php endif; ?>
<?php if($this->item->params->get('itemRelatedFulltext')): ?>
<div class="itemRelFulltext"><?php echo $item->fulltext; ?></div>
<?php endif; ?>
<?php if($this->item->params->get('itemRelatedMedia')): ?>
<?php if($item->videoType=='embedded'): ?>
<div class="itemRelMediaEmbedded"><?php echo $item->video; ?></div>
<?php else: ?>
<div class="itemRelMedia"><?php echo $item->video; ?></div>
<?php endif; ?>
<?php endif; ?>
<?php if($this->item->params->get('itemRelatedImageGallery')): ?>
<div class="itemRelImageGallery"><?php echo $item->gallery; ?></div>
<?php endif; ?>
</li>
<?php endforeach; ?>
<li class="clr"></li>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if($this->item->params->get('itemVideo') && !empty($this->item->video)): ?>
<!-- Item video -->
<a name="itemVideoAnchor" id="itemVideoAnchor"></a>
<div class="itemVideoBlock">
<h3><?php echo JText::_('K2_MEDIA'); ?></h3>
<?php if($this->item->videoType=='embedded'): ?>
<div class="itemVideoEmbedded">
<?php echo $this->item->video; ?>
</div>
<?php else: ?>
<span class="itemVideo"><?php echo $this->item->video; ?></span>
<?php endif; ?>
<?php if($this->item->params->get('itemVideoCaption') && !empty($this->item->video_caption)): ?>
<span class="itemVideoCaption"><?php echo $this->item->video_caption; ?></span>
<?php endif; ?>
<?php if($this->item->params->get('itemVideoCredits') && !empty($this->item->video_credits)): ?>
<span class="itemVideoCredits"><?php echo $this->item->video_credits; ?></span>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemImageGallery') && !empty($this->item->gallery)): ?>
<!-- Item image gallery -->
<a name="itemImageGalleryAnchor" id="itemImageGalleryAnchor"></a>
<div class="itemImageGallery">
<h3><?php echo JText::_('K2_IMAGE_GALLERY'); ?></h3>
<?php echo $this->item->gallery; ?>
</div>
<?php endif; ?>
<?php if($this->item->params->get('itemNavigation') && !JRequest::getCmd('print') && (isset($this->item->nextLink) || isset($this->item->previousLink))): ?>
<!-- Item navigation -->
<div class="itemNavigation">
<span class="itemNavigationTitle"><?php echo JText::_('K2_MORE_IN_THIS_CATEGORY'); ?></span>
<?php if(isset($this->item->previousLink)): ?>
<a class="itemPrevious" href="<?php echo $this->item->previousLink; ?>">
&laquo; <?php echo $this->item->previousTitle; ?>
</a>
<?php endif; ?>
<?php if(isset($this->item->nextLink)): ?>
<a class="itemNext" href="<?php echo $this->item->nextLink; ?>">
<?php echo $this->item->nextTitle; ?> &raquo;
</a>
<?php endif; ?>
</div>
<?php endif; ?>
<!-- Plugins: AfterDisplay -->
<?php echo $this->item->event->AfterDisplay; ?>
<!-- K2 Plugins: K2AfterDisplay -->
<?php echo $this->item->event->K2AfterDisplay; ?>
<?php if($this->item->params->get('itemComments') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1'))): ?>
<!-- K2 Plugins: K2CommentsBlock -->
<?php echo $this->item->event->K2CommentsBlock; ?>
<?php endif; ?>
<?php if($this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2')) && empty($this->item->event->K2CommentsBlock)): ?>
<!-- Item comments -->
<a name="itemCommentsAnchor" id="itemCommentsAnchor"></a>
<div class="itemComments">
<?php if($this->item->params->get('commentsFormPosition')=='above' && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?>
<!-- Item comments form -->
<div class="itemCommentsForm">
<?php echo $this->loadTemplate('comments_form'); ?>
</div>
<?php endif; ?>
<?php if($this->item->numOfComments>0 && $this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2'))): ?>
<!-- Item user comments -->
<h3 class="itemCommentsCounter">
<span><?php echo $this->item->numOfComments; ?></span> <?php echo ($this->item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?>
</h3>
<ul class="itemCommentsList">
<?php foreach ($this->item->comments as $key=>$comment): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; echo (!$this->item->created_by_alias && $comment->userID==$this->item->created_by) ? " authorResponse" : ""; echo($comment->published) ? '':' unpublishedComment'; ?>">
<span class="commentLink">
<a href="<?php echo $this->item->link; ?>#comment<?php echo $comment->id; ?>" name="comment<?php echo $comment->id; ?>" id="comment<?php echo $comment->id; ?>">
<?php echo JText::_('K2_COMMENT_LINK'); ?>
</a>
</span>
<?php if($comment->userImage): ?>
<img src="<?php echo $comment->userImage; ?>" alt="<?php echo JFilterOutput::cleanText($comment->userName); ?>" width="<?php echo $this->item->params->get('commenterImgWidth'); ?>" />
<?php endif; ?>
<span class="commentDate">
<?php echo JHTML::_('date', $comment->commentDate, JText::_('K2_DATE_FORMAT_LC2')); ?>
</span>
<span class="commentAuthorName">
<?php echo JText::_('K2_POSTED_BY'); ?>
<?php if(!empty($comment->userLink)): ?>
<a href="<?php echo JFilterOutput::cleanText($comment->userLink); ?>" title="<?php echo JFilterOutput::cleanText($comment->userName); ?>" target="_blank" rel="nofollow">
<?php echo $comment->userName; ?>
</a>
<?php else: ?>
<?php echo $comment->userName; ?>
<?php endif; ?>
</span>
<p><?php echo $comment->commentText; ?></p>
<?php if($this->inlineCommentsModeration || ($comment->published && ($this->params->get('commentsReporting')=='1' || ($this->params->get('commentsReporting')=='2' && !$this->user->guest)))): ?>
<span class="commentToolbar">
<?php if($this->inlineCommentsModeration): ?>
<?php if(!$comment->published): ?>
<a class="commentApproveLink" href="<?php echo JRoute::_('index.php?option=com_k2&view=comments&task=publish&commentID='.$comment->id.'&format=raw')?>"><?php echo JText::_('K2_APPROVE')?></a>
<?php endif; ?>
<a class="commentRemoveLink" href="<?php echo JRoute::_('index.php?option=com_k2&view=comments&task=remove&commentID='.$comment->id.'&format=raw')?>"><?php echo JText::_('K2_REMOVE')?></a>
<?php endif; ?>
<?php if($comment->published && ($this->params->get('commentsReporting')=='1' || ($this->params->get('commentsReporting')=='2' && !$this->user->guest))): ?>
<a class="modal" rel="{handler:'iframe',size:{x:560,y:480}}" href="<?php echo JRoute::_('index.php?option=com_k2&view=comments&task=report&commentID='.$comment->id)?>"><?php echo JText::_('K2_REPORT')?></a>
<?php endif; ?>
<?php if($comment->reportUserLink): ?>
<a class="k2ReportUserButton" href="<?php echo $comment->reportUserLink; ?>"><?php echo JText::_('K2_FLAG_AS_SPAMMER'); ?></a>
<?php endif; ?>
</span>
<?php endif; ?>
<div class="clr"></div>
</li>
<?php endforeach; ?>
</ul>
<div class="itemCommentsPagination">
<?php echo $this->pagination->getPagesLinks(); ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('commentsFormPosition')=='below' && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?>
<!-- Item comments form -->
<div class="itemCommentsForm">
<?php echo $this->loadTemplate('comments_form'); ?>
</div>
<?php endif; ?>
<?php $user = JFactory::getUser(); if ($this->item->params->get('comments') == '2' && $user->guest): ?>
<div><?php echo JText::_('K2_LOGIN_TO_POST_COMMENTS'); ?></div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if(!JRequest::getCmd('print')): ?>
<div class="itemBackToTop">
<a class="k2Anchor" href="<?php echo $this->item->link; ?>#startOfPageId<?php echo JRequest::getInt('id'); ?>">
<?php echo JText::_('K2_BACK_TO_TOP'); ?>
</a>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<!-- End K2 Item Layout -->

View File

@ -0,0 +1,54 @@
<?php
/**
* @version $Id: item_comments_form.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;
?>
<h3><?php echo JText::_('K2_LEAVE_A_COMMENT') ?></h3>
<?php if($this->params->get('commentsFormNotes')): ?>
<p class="itemCommentsFormNotes">
<?php if($this->params->get('commentsFormNotesText')): ?>
<?php echo nl2br($this->params->get('commentsFormNotesText')); ?>
<?php else: ?>
<?php echo JText::_('K2_COMMENT_FORM_NOTES') ?>
<?php endif; ?>
</p>
<?php endif; ?>
<form action="<?php echo JURI::root(true); ?>/index.php" method="post" id="comment-form" class="form-validate">
<label class="formComment" for="commentText"><?php echo JText::_('K2_MESSAGE'); ?> *</label>
<textarea rows="20" cols="10" class="inputbox" onblur="if(this.value=='') this.value='<?php echo JText::_('K2_ENTER_YOUR_MESSAGE_HERE'); ?>';" onfocus="if(this.value=='<?php echo JText::_('K2_ENTER_YOUR_MESSAGE_HERE'); ?>') this.value='';" name="commentText" id="commentText"><?php echo JText::_('K2_ENTER_YOUR_MESSAGE_HERE'); ?></textarea>
<label class="formName" for="userName"><?php echo JText::_('K2_NAME'); ?> *</label>
<input class="inputbox" type="text" name="userName" id="userName" value="<?php echo JText::_('K2_ENTER_YOUR_NAME'); ?>" onblur="if(this.value=='') this.value='<?php echo JText::_('K2_ENTER_YOUR_NAME'); ?>';" onfocus="if(this.value=='<?php echo JText::_('K2_ENTER_YOUR_NAME'); ?>') this.value='';" />
<label class="formEmail" for="commentEmail"><?php echo JText::_('K2_EMAIL'); ?> *</label>
<input class="inputbox" type="text" name="commentEmail" id="commentEmail" value="<?php echo JText::_('K2_ENTER_YOUR_EMAIL_ADDRESS'); ?>" onblur="if(this.value=='') this.value='<?php echo JText::_('K2_ENTER_YOUR_EMAIL_ADDRESS'); ?>';" onfocus="if(this.value=='<?php echo JText::_('K2_ENTER_YOUR_EMAIL_ADDRESS'); ?>') this.value='';" />
<label class="formUrl" for="commentURL"><?php echo JText::_('K2_WEBSITE_URL'); ?></label>
<input class="inputbox" type="text" name="commentURL" id="commentURL" value="<?php echo JText::_('K2_ENTER_YOUR_SITE_URL'); ?>" onblur="if(this.value=='') this.value='<?php echo JText::_('K2_ENTER_YOUR_SITE_URL'); ?>';" onfocus="if(this.value=='<?php echo JText::_('K2_ENTER_YOUR_SITE_URL'); ?>') this.value='';" />
<?php if($this->params->get('recaptcha') && ($this->user->guest || $this->params->get('recaptchaForRegistered', 1))): ?>
<label class="formRecaptcha"><?php echo JText::_('K2_ENTER_THE_TWO_WORDS_YOU_SEE_BELOW'); ?></label>
<div id="recaptcha"></div>
<?php endif; ?>
<input type="submit" class="button" id="submitCommentButton" value="<?php echo JText::_('K2_SUBMIT_COMMENT'); ?>" />
<span id="formLog"></span>
<input type="hidden" name="option" value="com_k2" />
<input type="hidden" name="view" value="item" />
<input type="hidden" name="task" value="comment" />
<input type="hidden" name="itemID" value="<?php echo JRequest::getInt('id'); ?>" />
<?php echo JHTML::_('form.token'); ?>
</form>

View File

@ -0,0 +1,951 @@
<?php
/**
* @version $Id: itemform.php 1982 2013-05-30 12:55:18Z 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('#title').val()) == '') {
alert( '".JText::_('K2_ITEM_MUST_HAVE_A_TITLE', true)."' );
}
else if (\$K2.trim(\$K2('#catid').val()) == '0') {
alert( '".JText::_('K2_PLEASE_SELECT_A_CATEGORY', true)."' );
}
else {
syncExtraFieldsEditor();
var validation = validateExtraFields();
if(validation === true) {
\$K2('#selectedTags option').attr('selected', 'selected');
submitform( pressbutton );
}
}
}
");
?>
<form action="<?php echo JURI::root(true); ?>/index.php" enctype="multipart/form-data" 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-save" class="button">
<a class="toolbar" href="#" onclick="Joomla.submitbutton('save'); return false;"> <span title="<?php echo JText::_('K2_SAVE'); ?>" class="icon-32-save icon-save"></span> <?php echo JText::_('K2_SAVE'); ?> </a>
</td>
<td id="toolbar-cancel" class="button">
<a class="toolbar" href="#"> <span title="<?php echo JText::_('K2_CANCEL'); ?>" class="icon-32-cancel icon-cancel"></span> <?php echo JText::_('K2_CLOSE'); ?> </a>
</td>
</tr>
</table>
<div id="k2FrontendEditToolbar">
<h2 class="header icon-48-k2">
<?php echo (JRequest::getInt('cid')) ? JText::_('K2_EDIT_ITEM') : JText::_('K2_ADD_ITEM'); ?>
</h2>
</div>
<div class="clr"></div>
<hr class="sep" />
<?php if(!$this->permissions->get('publish')): ?>
<div id="k2FrontendPermissionsNotice">
<p><?php echo JText::_('K2_FRONTEND_PERMISSIONS_NOTICE'); ?></p>
</div>
<?php endif; ?>
<?php endif; ?>
<div id="k2ToggleSidebarContainer"> <a href="#" id="k2ToggleSidebar"><?php echo JText::_('K2_TOGGLE_SIDEBAR'); ?></a> </div>
<table cellspacing="0" cellpadding="0" border="0" class="adminFormK2Container table">
<tbody>
<tr>
<td>
<table class="adminFormK2">
<tr>
<td class="adminK2LeftCol">
<label for="title"><?php echo JText::_('K2_TITLE'); ?></label>
</td>
<td class="adminK2RightCol">
<input class="text_area k2TitleBox" type="text" name="title" id="title" maxlength="250" value="<?php echo $this->row->title; ?>" />
</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" id="alias" maxlength="250" value="<?php echo $this->row->alias; ?>" />
</td>
</tr>
<tr>
<td class="adminK2LeftCol">
<label><?php echo JText::_('K2_CATEGORY'); ?></label>
</td>
<td class="adminK2RightCol">
<?php echo $this->lists['categories']; ?>
</td>
</tr>
<tr>
<td class="adminK2LeftCol">
<label><?php echo JText::_('K2_TAGS'); ?></label>
</td>
<td class="adminK2RightCol">
<?php if($this->params->get('taggingSystem')): ?>
<!-- Free tagging -->
<ul class="tags">
<?php if(isset($this->row->tags) && count($this->row->tags)): ?>
<?php foreach($this->row->tags as $tag): ?>
<li class="tagAdded">
<?php echo $tag->name; ?>
<span title="<?php echo JText::_('K2_CLICK_TO_REMOVE_TAG'); ?>" class="tagRemove">x</span>
<input type="hidden" name="tags[]" value="<?php echo $tag->name; ?>" />
</li>
<?php endforeach; ?>
<?php endif; ?>
<li class="tagAdd">
<input type="text" id="search-field" />
</li>
<li class="clr"></li>
</ul>
<span class="k2Note"> <?php echo JText::_('K2_WRITE_A_TAG_AND_PRESS_RETURN_OR_COMMA_TO_ADD_IT'); ?> </span>
<?php else: ?>
<!-- Selection based tagging -->
<?php if( !$this->params->get('lockTags') || $this->user->gid>23): ?>
<div style="float:left;">
<input type="text" name="tag" id="tag" />
<input type="button" id="newTagButton" value="<?php echo JText::_('K2_ADD'); ?>" />
</div>
<div id="tagsLog"></div>
<div class="clr"></div>
<span class="k2Note"> <?php echo JText::_('K2_WRITE_A_TAG_AND_PRESS_ADD_TO_INSERT_IT_TO_THE_AVAILABLE_TAGS_LISTNEW_TAGS_ARE_APPENDED_AT_THE_BOTTOM_OF_THE_AVAILABLE_TAGS_LIST_LEFT'); ?> </span>
<?php endif; ?>
<table cellspacing="0" cellpadding="0" border="0" id="tagLists">
<tr>
<td id="tagListsLeft">
<span><?php echo JText::_('K2_AVAILABLE_TAGS'); ?></span> <?php echo $this->lists['tags']; ?>
</td>
<td id="tagListsButtons">
<input type="button" id="addTagButton" value="<?php echo JText::_('K2_ADD'); ?> &raquo;" />
<br />
<br />
<input type="button" id="removeTagButton" value="&laquo; <?php echo JText::_('K2_REMOVE'); ?>" />
</td>
<td id="tagListsRight">
<span><?php echo JText::_('K2_SELECTED_TAGS'); ?></span> <?php echo $this->lists['selectedTags']; ?>
</td>
</tr>
</table>
<?php endif; ?>
</td>
</tr>
<?php if($this->mainframe->isAdmin() || ($this->mainframe->isSite() && $this->permissions->get('publish'))): ?>
<tr>
<td class="adminK2LeftCol">
<label for="featured"><?php echo JText::_('K2_IS_IT_FEATURED'); ?></label>
</td>
<td class="adminK2RightCol">
<?php echo $this->lists['featured']; ?>
</td>
</tr>
<tr>
<td class="adminK2LeftCol">
<label><?php echo JText::_('K2_PUBLISHED'); ?></label>
</td>
<td class="adminK2RightCol">
<?php echo $this->lists['published']; ?>
</td>
</tr>
<?php endif; ?>
</table>
<ul id="k2ExtraFieldsValidationResults"></ul>
<!-- Tabs start here -->
<div class="simpleTabs" id="k2Tabs">
<ul class="simpleTabsNavigation">
<li id="tabContent"><a href="#k2Tab1"><?php echo JText::_('K2_CONTENT'); ?></a></li>
<?php if ($this->params->get('showImageTab')): ?>
<li id="tabImage"><a href="#k2Tab2"><?php echo JText::_('K2_IMAGE'); ?></a></li>
<?php endif; ?>
<?php if ($this->params->get('showImageGalleryTab')): ?>
<li id="tabImageGallery"><a href="#k2Tab3"><?php echo JText::_('K2_IMAGE_GALLERY'); ?></a></li>
<?php endif; ?>
<?php if ($this->params->get('showVideoTab')): ?>
<li id="tabVideo"><a href="#k2Tab4"><?php echo JText::_('K2_MEDIA'); ?></a></li>
<?php endif; ?>
<?php if ($this->params->get('showExtraFieldsTab')): ?>
<li id="tabExtraFields"><a href="#k2Tab5"><?php echo JText::_('K2_EXTRA_FIELDS'); ?></a></li>
<?php endif; ?>
<?php if ($this->params->get('showAttachmentsTab')): ?>
<li id="tabAttachments"><a href="#k2Tab6"><?php echo JText::_('K2_ATTACHMENTS'); ?></a></li>
<?php endif; ?>
<?php if(count(array_filter($this->K2PluginsItemOther)) && $this->params->get('showK2Plugins')): ?>
<li id="tabPlugins"><a href="#k2Tab7"><?php echo JText::_('K2_PLUGINS'); ?></a></li>
<?php endif; ?>
</ul>
<!-- Tab content -->
<div class="simpleTabsContent" id="k2Tab1">
<?php if($this->params->get('mergeEditors')): ?>
<div class="k2ItemFormEditor"> <?php echo $this->text; ?>
<div class="dummyHeight"></div>
<div class="clr"></div>
</div>
<?php else: ?>
<div class="k2ItemFormEditor"> <span class="k2ItemFormEditorTitle"> <?php echo JText::_('K2_INTROTEXT_TEASER_CONTENTEXCERPT'); ?> </span> <?php echo $this->introtext; ?>
<div class="dummyHeight"></div>
<div class="clr"></div>
</div>
<div class="k2ItemFormEditor"> <span class="k2ItemFormEditorTitle"> <?php echo JText::_('K2_FULLTEXT_MAIN_CONTENT'); ?> </span> <?php echo $this->fulltext; ?>
<div class="dummyHeight"></div>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if (count($this->K2PluginsItemContent)): ?>
<div class="itemPlugins">
<?php foreach($this->K2PluginsItemContent as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<fieldset>
<legend><?php echo $K2Plugin->name; ?></legend>
<?php echo $K2Plugin->fields; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php if ($this->params->get('showImageTab')): ?>
<!-- Tab image -->
<div class="simpleTabsContent" id="k2Tab2">
<table class="admintable">
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_ITEM_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 />
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_ITEM_IMAGE_CAPTION'); ?>
</td>
<td>
<input type="text" name="image_caption" size="30" class="text_area" value="<?php echo $this->row->image_caption; ?>" />
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_ITEM_IMAGE_CREDITS'); ?>
</td>
<td>
<input type="text" name="image_credits" size="30" class="text_area" value="<?php echo $this->row->image_credits; ?>" />
</td>
</tr>
<?php if (!empty($this->row->image)): ?>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_ITEM_IMAGE_PREVIEW'); ?>
</td>
<td>
<a class="modal" rel="{handler: 'image'}" href="<?php echo $this->row->image; ?>" title="<?php echo JText::_('K2_CLICK_ON_IMAGE_TO_PREVIEW_IN_ORIGINAL_SIZE'); ?>">
<img alt="<?php echo $this->row->title; ?>" src="<?php echo $this->row->thumb; ?>" class="k2AdminImage" />
</a>
<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>
</td>
</tr>
<?php endif; ?>
</table>
<?php if (count($this->K2PluginsItemImage)): ?>
<div class="itemPlugins">
<?php foreach($this->K2PluginsItemImage as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<fieldset>
<legend><?php echo $K2Plugin->name; ?></legend>
<?php echo $K2Plugin->fields; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($this->params->get('showImageGalleryTab')): ?>
<!-- Tab image gallery -->
<div class="simpleTabsContent" id="k2Tab3">
<?php if ($this->lists['checkSIG']): ?>
<table class="admintable table" id="item_gallery_content">
<tr>
<td align="right" valign="top" class="key">
<?php echo JText::_('K2_COM_BE_ITEM_ITEM_IMAGE_GALLERY'); ?>
</td>
<td valign="top">
<?php if($this->sigPro): ?>
<a class="modal" rel="{handler: 'iframe', size: {x: 940, y: 560}}" href="index.php?option=com_sigpro&view=galleries&task=create&newFolder=<?php echo $this->sigProFolder; ?>&type=k2&tmpl=component&template=system"><?php echo JText::_('K2_COM_BE_ITEM_SIGPRO_UPLOAD'); ?></a> <i>(<?php echo JText::_('K2_COM_BE_ITEM_SIGPRO_UPLOAD_NOTE'); ?>)</i>
<input name="sigProFolder" type="hidden" value="<?php echo $this->sigProFolder; ?>" />
<br />
<br />
<?php echo JText::_('K2_OR'); ?>
<?php endif; ?>
<?php echo JText::_('K2_UPLOAD_A_ZIP_FILE_WITH_IMAGES'); ?> <input type="file" name="gallery" class="fileUpload" /> <span class="hasTip k2GalleryNotice" title="<?php echo JText::_('K2_UPLOAD_A_ZIP_FILE_HELP_HEADER'); ?>::<?php echo JText::_('K2_UPLOAD_A_ZIP_FILE_HELP_TEXT'); ?>"><?php echo JText::_('K2_UPLOAD_A_ZIP_FILE_HELP'); ?></span> <i>(<?php echo JText::_('K2_MAX_UPLOAD_SIZE'); ?>: <?php echo ini_get('upload_max_filesize'); ?>)</i>
<br />
<br />
<?php echo JText::_('K2_OR_ENTER_A_FLICKR_SET_URL'); ?><?php echo JText::_('K2_OR_ENTER_A_FLICKR_SET_URL'); ?>
<input type="text" name="flickrGallery" size="50" value="<?php echo ($this->row->galleryType == 'flickr') ? $this->row->galleryValue : ''; ?>" /> <span class="hasTip k2GalleryNotice" title="<?php echo JText::_('K2_VALID_FLICK_API_KEY_HELP_HEADER'); ?>::<?php echo JText::_('K2_VALID_FLICK_API_KEY_HELP_TEXT'); ?>"><?php echo JText::_('K2_UPLOAD_A_ZIP_FILE_HELP'); ?></span>
<?php if (!empty($this->row->gallery)): ?>
<!-- Preview -->
<div id="itemGallery">
<?php echo $this->row->gallery; ?>
<br />
<input type="checkbox" name="del_gallery" id="del_gallery" />
<label for="del_gallery"><?php echo JText::_('K2_CHECK_THIS_BOX_TO_DELETE_CURRENT_IMAGE_GALLERY_OR_JUST_UPLOAD_A_NEW_IMAGE_GALLERY_TO_REPLACE_THE_EXISTING_ONE'); ?></label>
</div>
<?php endif; ?>
</td>
</tr>
</table>
<?php else: ?>
<?php if (K2_JVERSION == '15'): ?>
<dl id="system-message">
<dt class="notice"><?php echo JText::_('K2_NOTICE'); ?></dt>
<dd class="notice message fade">
<ul>
<li><?php echo JText::_('K2_NOTICE_PLEASE_INSTALL_JOOMLAWORKS_SIMPLE_IMAGE_GALLERY_PRO_PLUGIN_IF_YOU_WANT_TO_USE_THE_IMAGE_GALLERY_FEATURES_OF_K2'); ?></li>
</ul>
</dd>
</dl>
<?php elseif(K2_JVERSION == '25'): ?>
<div id="system-message-container">
<dl id="system-message">
<dt class="notice"><?php echo JText::_('K2_NOTICE'); ?></dt>
<dd class="notice message">
<ul>
<li><?php echo JText::_('K2_NOTICE_PLEASE_INSTALL_JOOMLAWORKS_SIMPLE_IMAGE_GALLERY_PRO_PLUGIN_IF_YOU_WANT_TO_USE_THE_IMAGE_GALLERY_FEATURES_OF_K2'); ?></li>
</ul>
</dd>
</dl>
</div>
<?php else: ?>
<div class="alert">
<h4 class="alert-heading"><?php echo JText::_('K2_NOTICE'); ?></h4>
<div><p><?php echo JText::_('K2_NOTICE_PLEASE_INSTALL_JOOMLAWORKS_SIMPLE_IMAGE_GALLERY_PRO_PLUGIN_IF_YOU_WANT_TO_USE_THE_IMAGE_GALLERY_FEATURES_OF_K2'); ?></p></div>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if (count($this->K2PluginsItemGallery)): ?>
<div class="itemPlugins">
<?php foreach($this->K2PluginsItemGallery as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<fieldset>
<legend><?php echo $K2Plugin->name; ?></legend>
<?php echo $K2Plugin->fields; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($this->params->get('showVideoTab')): ?>
<!-- Tab video -->
<div class="simpleTabsContent" id="k2Tab4">
<?php if ($this->lists['checkAllVideos']): ?>
<table class="admintable" id="item_video_content">
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_MEDIA_SOURCE'); ?>
</td>
<td>
<div id="k2VideoTabs" class="simpleTabs">
<ul class="simpleTabsNavigation">
<li><a href="#k2VideoTab1"><?php echo JText::_('K2_UPLOAD'); ?></a></li>
<li><a href="#k2VideoTab2"><?php echo JText::_('K2_BROWSE_SERVERUSE_REMOTE_MEDIA'); ?></a></li>
<li><a href="#k2VideoTab3"><?php echo JText::_('K2_MEDIA_USE_ONLINE_VIDEO_SERVICE'); ?></a></li>
<li><a href="#k2VideoTab4"><?php echo JText::_('K2_EMBED'); ?></a></li>
</ul>
<div id="k2VideoTab1" class="simpleTabsContent">
<div class="panel" id="Upload_video">
<input type="file" name="video" class="fileUpload" />
<i>(<?php echo JText::_('K2_MAX_UPLOAD_SIZE'); ?>: <?php echo ini_get('upload_max_filesize'); ?>)</i> </div>
</div>
<div id="k2VideoTab2" class="simpleTabsContent">
<div class="panel" id="Remote_video"> <a id="k2MediaBrowseServer" href="index.php?option=com_k2&view=media&type=video&tmpl=component&fieldID=remoteVideo"><?php echo JText::_('K2_BROWSE_VIDEOS_ON_SERVER')?></a> <?php echo JText::_('K2_OR'); ?> <?php echo JText::_('K2_PASTE_REMOTE_VIDEO_URL'); ?>
<br />
<br />
<input type="text" size="50" name="remoteVideo" id="remoteVideo" value="<?php echo $this->lists['remoteVideo'] ?>" />
</div>
</div>
<div id="k2VideoTab3" class="simpleTabsContent">
<div class="panel" id="Video_from_provider"> <?php echo JText::_('K2_SELECT_VIDEO_PROVIDER'); ?> <?php echo $this->lists['providers']; ?> <br/><br/> <?php echo JText::_('K2_AND_ENTER_VIDEO_ID'); ?>
<input type="text" size="50" name="videoID" value="<?php echo $this->lists['providerVideo'] ?>" />
<br />
<br />
<a class="modal" rel="{handler: 'iframe', size: {x: 990, y: 600}}" href="http://www.joomlaworks.net/allvideos-documentation"><?php echo JText::_('K2_READ_THE_ALLVIDEOS_DOCUMENTATION_FOR_MORE'); ?></a> </div>
</div>
<div id="k2VideoTab4" class="simpleTabsContent">
<div class="panel" id="embedVideo">
<?php echo JText::_('K2_PASTE_HTML_EMBED_CODE_BELOW'); ?>
<br />
<textarea name="embedVideo" rows="5" cols="50" class="textarea"><?php echo $this->lists['embedVideo']; ?></textarea>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_MEDIA_CAPTION'); ?>
</td>
<td>
<input type="text" name="video_caption" size="50" class="text_area" value="<?php echo $this->row->video_caption; ?>" />
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_MEDIA_CREDITS'); ?>
</td>
<td>
<input type="text" name="video_credits" size="50" class="text_area" value="<?php echo $this->row->video_credits; ?>" />
</td>
</tr>
<?php if($this->row->video): ?>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_MEDIA_PREVIEW'); ?>
</td>
<td>
<?php echo $this->row->video; ?>
<br />
<input type="checkbox" name="del_video" id="del_video" />
<label for="del_video"><?php echo JText::_('K2_CHECK_THIS_BOX_TO_DELETE_CURRENT_VIDEO_OR_USE_THE_FORM_ABOVE_TO_REPLACE_THE_EXISTING_ONE'); ?></label>
</td>
</tr>
<?php endif; ?>
</table>
<?php else: ?>
<?php if (K2_JVERSION == '15'): ?>
<dl id="system-message">
<dt class="notice"><?php echo JText::_('K2_NOTICE'); ?></dt>
<dd class="notice message fade">
<ul>
<li><?php echo JText::_('K2_NOTICE_PLEASE_INSTALL_JOOMLAWORKS_ALLVIDEOS_PLUGIN_IF_YOU_WANT_TO_USE_THE_FULL_VIDEO_FEATURES_OF_K2'); ?></li>
</ul>
</dd>
</dl>
<?php elseif(K2_JVERSION == '25'): ?>
<div id="system-message-container">
<dl id="system-message">
<dt class="notice"><?php echo JText::_('K2_NOTICE'); ?></dt>
<dd class="notice message">
<ul>
<li><?php echo JText::_('K2_NOTICE_PLEASE_INSTALL_JOOMLAWORKS_ALLVIDEOS_PLUGIN_IF_YOU_WANT_TO_USE_THE_FULL_VIDEO_FEATURES_OF_K2'); ?></li>
</ul>
</dd>
</dl>
</div>
<?php else: ?>
<div class="alert">
<h4 class="alert-heading"><?php echo JText::_('K2_NOTICE'); ?></h4>
<div><p><?php echo JText::_('K2_NOTICE_PLEASE_INSTALL_JOOMLAWORKS_ALLVIDEOS_PLUGIN_IF_YOU_WANT_TO_USE_THE_FULL_VIDEO_FEATURES_OF_K2'); ?></p></div>
</div>
<?php endif; ?>
<table class="admintable" id="item_video_content">
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_MEDIA_SOURCE'); ?>
</td>
<td>
<div id="k2VideoTabs" class="simpleTabs">
<ul class="simpleTabsNavigation">
<li><a href="#k2VideoTab4"><?php echo JText::_('K2_EMBED'); ?></a></li>
</ul>
<div class="simpleTabsContent" id="k2VideoTab4">
<div class="panel" id="embedVideo">
<?php echo JText::_('K2_PASTE_HTML_EMBED_CODE_BELOW'); ?>
<br />
<textarea name="embedVideo" rows="5" cols="50" class="textarea"><?php echo $this->lists['embedVideo']; ?></textarea>
</div>
</div>
</div>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_MEDIA_CAPTION'); ?>
</td>
<td>
<input type="text" name="video_caption" size="50" class="text_area" value="<?php echo $this->row->video_caption; ?>" />
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_MEDIA_CREDITS'); ?>
</td>
<td>
<input type="text" name="video_credits" size="50" class="text_area" value="<?php echo $this->row->video_credits; ?>" />
</td>
</tr>
<?php if($this->row->video): ?>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_MEDIA_PREVIEW'); ?>
</td>
<td>
<?php echo $this->row->video; ?>
<br />
<input type="checkbox" name="del_video" id="del_video" />
<label for="del_video"><?php echo JText::_('K2_USE_THE_FORM_ABOVE_TO_REPLACE_THE_EXISTING_VIDEO_OR_CHECK_THIS_BOX_TO_DELETE_CURRENT_VIDEO'); ?></label>
</td>
</tr>
<?php endif; ?>
</table>
<?php endif; ?>
<?php if (count($this->K2PluginsItemVideo)): ?>
<div class="itemPlugins">
<?php foreach($this->K2PluginsItemVideo as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<fieldset>
<legend><?php echo $K2Plugin->name; ?></legend>
<?php echo $K2Plugin->fields; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($this->params->get('showExtraFieldsTab')): ?>
<!-- Tab extra fields -->
<div class="simpleTabsContent" id="k2Tab5">
<div id="extraFieldsContainer">
<?php if (count($this->extraFields)): ?>
<table class="admintable" id="extraFields">
<?php foreach($this->extraFields as $extraField): ?>
<?php if($extraField->type == 'header'): ?>
<tr>
<td colspan="2" ><h4 class="k2ExtraFieldHeader"><?php echo $extraField->name; ?></h4></td>
</tr>
<?php else: ?>
<tr>
<td align="right" class="key">
<label for="K2ExtraField_<?php echo $extraField->id; ?>"><?php echo $extraField->name; ?></label>
</td>
<td>
<?php echo $extraField->element; ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</table>
<?php else: ?>
<?php if (K2_JVERSION == '15'): ?>
<dl id="system-message">
<dt class="notice"><?php echo JText::_('K2_NOTICE'); ?></dt>
<dd class="notice message fade">
<ul>
<li><?php echo JText::_('K2_PLEASE_SELECT_A_CATEGORY_FIRST_TO_RETRIEVE_ITS_RELATED_EXTRA_FIELDS'); ?></li>
</ul>
</dd>
</dl>
<?php elseif (K2_JVERSION == '25'): ?>
<div id="system-message-container">
<dl id="system-message">
<dt class="notice"><?php echo JText::_('K2_NOTICE'); ?></dt>
<dd class="notice message">
<ul>
<li><?php echo JText::_('K2_PLEASE_SELECT_A_CATEGORY_FIRST_TO_RETRIEVE_ITS_RELATED_EXTRA_FIELDS'); ?></li>
</ul>
</dd>
</dl>
</div>
<?php else: ?>
<div class="alert">
<h4 class="alert-heading"><?php echo JText::_('K2_NOTICE'); ?></h4>
<div>
<p><?php echo JText::_('K2_PLEASE_SELECT_A_CATEGORY_FIRST_TO_RETRIEVE_ITS_RELATED_EXTRA_FIELDS'); ?></p>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<?php if (count($this->K2PluginsItemExtraFields)): ?>
<div class="itemPlugins">
<?php foreach($this->K2PluginsItemExtraFields as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<fieldset>
<legend><?php echo $K2Plugin->name; ?></legend>
<?php echo $K2Plugin->fields; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($this->params->get('showAttachmentsTab')): ?>
<!-- Tab attachements -->
<div class="simpleTabsContent" id="k2Tab6">
<div class="itemAttachments">
<?php if (count($this->row->attachments)): ?>
<table class="adminlist">
<tr>
<th>
<?php echo JText::_('K2_FILENAME'); ?>
</th>
<th>
<?php echo JText::_('K2_TITLE'); ?>
</th>
<th>
<?php echo JText::_('K2_TITLE_ATTRIBUTE'); ?>
</th>
<th>
<?php echo JText::_('K2_DOWNLOADS'); ?>
</th>
<th>
<?php echo JText::_('K2_OPERATIONS'); ?>
</th>
</tr>
<?php foreach($this->row->attachments as $attachment): ?>
<tr>
<td class="attachment_entry">
<?php echo $attachment->filename; ?>
</td>
<td>
<?php echo $attachment->title; ?>
</td>
<td>
<?php echo $attachment->titleAttribute; ?>
</td>
<td>
<?php echo $attachment->hits; ?>
</td>
<td>
<a href="<?php echo $attachment->link; ?>"><?php echo JText::_('K2_DOWNLOAD'); ?></a> <a class="deleteAttachmentButton" href="<?php echo JURI::base(true); ?>/index.php?option=com_k2&amp;view=item&amp;task=deleteAttachment&amp;id=<?php echo $attachment->id?>&amp;cid=<?php echo $this->row->id; ?>"><?php echo JText::_('K2_DELETE'); ?></a>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>
<div id="addAttachment">
<input type="button" id="addAttachmentButton" value="<?php echo JText::_('K2_ADD_ATTACHMENT_FIELD'); ?>" />
<i>(<?php echo JText::_('K2_MAX_UPLOAD_SIZE'); ?>: <?php echo ini_get('upload_max_filesize'); ?>)</i> </div>
<div id="itemAttachments"></div>
<?php if (count($this->K2PluginsItemAttachments)): ?>
<div class="itemPlugins">
<?php foreach($this->K2PluginsItemAttachments as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<fieldset>
<legend><?php echo $K2Plugin->name; ?></legend>
<?php echo $K2Plugin->fields; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if(count(array_filter($this->K2PluginsItemOther)) && $this->params->get('showK2Plugins')): ?>
<!-- Tab other plugins -->
<div class="simpleTabsContent" id="k2Tab7">
<div class="itemPlugins">
<?php foreach($this->K2PluginsItemOther as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<fieldset>
<legend><?php echo $K2Plugin->name; ?></legend>
<?php echo $K2Plugin->fields; ?>
</fieldset>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
<!-- Tabs end here -->
<input type="hidden" name="isSite" value="<?php echo (int)$this->mainframe->isSite(); ?>" />
<?php if($this->mainframe->isSite()): ?>
<input type="hidden" name="lang" value="<?php echo JRequest::getCmd('lang'); ?>" />
<?php endif; ?>
<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="item" />
<input type="hidden" name="task" value="<?php echo JRequest::getVar('task'); ?>" />
<input type="hidden" name="Itemid" value="<?php echo JRequest::getInt('Itemid'); ?>" />
<?php echo JHTML::_('form.token'); ?>
</td>
<td id="adminFormK2Sidebar"<?php if($this->mainframe->isSite() && !$this->params->get('sideBarDisplayFrontend')): ?> style="display:none;"<?php endif; ?> class="xmlParamsFields">
<?php if($this->row->id): ?>
<table class="sidebarDetails">
<tr>
<td>
<strong><?php echo JText::_('K2_ITEM_ID'); ?></strong>
</td>
<td>
<?php echo $this->row->id; ?>
</td>
</tr>
<tr>
<td>
<strong><?php echo JText::_('K2_PUBLISHED'); ?></strong>
</td>
<td>
<?php echo ($this->row->published > 0) ? JText::_('K2_YES') : JText::_('K2_NO'); ?>
</td>
</tr>
<tr>
<td>
<strong><?php echo JText::_('K2_FEATURED'); ?></strong>
</td>
<td>
<?php echo ($this->row->featured > 0) ? JText::_('K2_YES'): JText::_('K2_NO'); ?>
</td>
</tr>
<tr>
<td>
<strong><?php echo JText::_('K2_CREATED_DATE'); ?></strong>
</td>
<td>
<?php echo $this->lists['created']; ?>
</td>
</tr>
<tr>
<td>
<strong><?php echo JText::_('K2_CREATED_BY'); ?></strong>
</td>
<td>
<?php echo $this->row->author; ?>
</td>
</tr>
<tr>
<td>
<strong><?php echo JText::_('K2_MODIFIED_DATE'); ?></strong>
</td>
<td>
<?php echo $this->lists['modified']; ?>
</td>
</tr>
<tr>
<td>
<strong><?php echo JText::_('K2_MODIFIED_BY'); ?></strong>
</td>
<td>
<?php echo $this->row->moderator; ?>
</td>
</tr>
<tr>
<td>
<strong><?php echo JText::_('K2_HITS'); ?></strong>
</td>
<td>
<?php echo $this->row->hits; ?>
<?php if($this->row->hits): ?>
<input id="resetHitsButton" type="button" value="<?php echo JText::_('K2_RESET'); ?>" class="button" name="resetHits" />
<?php endif; ?>
</td>
</tr>
<?php endif; ?>
<?php if($this->row->id): ?>
<tr>
<td>
<strong><?php echo JText::_('K2_RATING'); ?></strong>
</td>
<td>
<?php echo $this->row->ratingCount; ?> <?php echo JText::_('K2_VOTES'); ?>
<?php if($this->row->ratingCount): ?>
<br />
(<?php echo JText::_('K2_AVERAGE_RATING'); ?>: <?php echo number_format(($this->row->ratingSum/$this->row->ratingCount),2); ?>/5.00)
<?php endif; ?>
<input id="resetRatingButton" type="button" value="<?php echo JText::_('K2_RESET'); ?>" class="button" name="resetRating" />
</td>
</tr>
</table>
<?php endif; ?>
<div id="k2Accordion">
<h3><a href="#"><?php echo JText::_('K2_AUTHOR_PUBLISHING_STATUS'); ?></a></h3>
<div>
<table class="admintable">
<?php if(isset($this->lists['language'])): ?>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_LANGUAGE'); ?>
</td>
<td>
<?php echo $this->lists['language']; ?>
</td>
</tr>
<?php endif; ?>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_AUTHOR'); ?>
</td>
<td id="k2AuthorOptions">
<span id="k2Author"><?php echo $this->row->author; ?></span>
<?php if($this->mainframe->isAdmin() || ($this->mainframe->isSite() && $this->permissions->get('editAll'))): ?>
<a class="modal" rel="{handler:'iframe', size: {x: 800, y: 460}}" href="index.php?option=com_k2&amp;view=users&amp;task=element&amp;tmpl=component"><?php echo JText::_('K2_CHANGE'); ?></a>
<input type="hidden" name="created_by" value="<?php echo $this->row->created_by; ?>" />
<?php endif; ?>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_AUTHOR_ALIAS'); ?>
</td>
<td>
<input class="text_area" type="text" name="created_by_alias" maxlength="250" value="<?php echo $this->row->created_by_alias; ?>" />
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_ACCESS_LEVEL'); ?>
</td>
<td>
<?php echo $this->lists['access']; ?>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_CREATION_DATE'); ?>
</td>
<td class="k2ItemFormDateField">
<?php echo $this->lists['createdCalendar']; ?>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_START_PUBLISHING'); ?>
</td>
<td class="k2ItemFormDateField">
<?php echo $this->lists['publish_up']; ?>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_FINISH_PUBLISHING'); ?>
</td>
<td class="k2ItemFormDateField">
<?php echo $this->lists['publish_down']; ?>
</td>
</tr>
</table>
</div>
<h3><a href="#"><?php echo JText::_('K2_METADATA_INFORMATION'); ?></a></h3>
<div>
<table class="admintable">
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_DESCRIPTION'); ?>
</td>
<td>
<textarea name="metadesc" rows="5" cols="20"><?php echo $this->row->metadesc; ?></textarea>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_KEYWORDS'); ?>
</td>
<td>
<textarea name="metakey" rows="5" cols="20"><?php echo $this->row->metakey; ?></textarea>
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_ROBOTS'); ?>
</td>
<td>
<input type="text" name="meta[robots]" value="<?php echo $this->lists['metadata']->get('robots'); ?>" />
</td>
</tr>
<tr>
<td align="right" class="key">
<?php echo JText::_('K2_AUTHOR'); ?>
</td>
<td>
<input type="text" name="meta[author]" value="<?php echo $this->lists['metadata']->get('author'); ?>" />
</td>
</tr>
</table>
</div>
<?php if($this->mainframe->isAdmin()): ?>
<h3><a href="#"><?php echo JText::_('K2_ITEM_VIEW_OPTIONS_IN_CATEGORY_LISTINGS'); ?></a></h3>
<div>
<?php if(version_compare( JVERSION, '1.6.0', 'ge' )): ?>
<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">&nbsp;</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(version_compare( JVERSION, '1.6.0', 'ge' )): ?>
<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">&nbsp;</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>
<?php endif; ?>
<?php if($this->aceAclFlag): ?>
<h3><a href="#"><?php echo JText::_('AceACL') . ' ' . JText::_('COM_ACEACL_COMMON_PERMISSIONS'); ?></a></h3>
<div><?php AceaclApi::getWidget('com_k2.item.'.$this->row->id, true); ?></div>
<?php endif; ?>
</div>
</td>
</tr>
</tbody>
</table>
<div class="clr"></div>
<?php if($this->mainframe->isSite()): ?>
</div>
</div>
<?php endif; ?>
</form>

View File

@ -0,0 +1,160 @@
<?php
/**
* @version $Id: latest.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;
?>
<!-- Start K2 Latest Layout -->
<div id="k2Container" class="latestView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>">
<?php if($this->params->get('show_page_title')): ?>
<!-- Page title -->
<div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>">
<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>
<?php foreach($this->blocks as $key=>$block): ?>
<div class="latestItemsContainer" style="width:<?php echo number_format(100/$this->params->get('latestItemsCols'), 1); ?>%;">
<?php if($this->source=='categories'): $category=$block; ?>
<?php if($this->params->get('categoryFeed') || $this->params->get('categoryImage') || $this->params->get('categoryTitle') || $this->params->get('categoryDescription')): ?>
<!-- Start K2 Category block -->
<div class="latestItemsCategory">
<?php if($this->params->get('categoryFeed')): ?>
<!-- RSS feed icon -->
<div class="k2FeedIcon">
<a href="<?php echo $category->feed; ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
</a>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if ($this->params->get('categoryImage') && !empty($category->image)): ?>
<div class="latestItemsCategoryImage">
<img src="<?php echo $category->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($category->name); ?>" style="width:<?php echo $this->params->get('catImageWidth'); ?>px;height:auto;" />
</div>
<?php endif; ?>
<?php if ($this->params->get('categoryTitle')): ?>
<h2><a href="<?php echo $category->link; ?>"><?php echo $category->name; ?></a></h2>
<?php endif; ?>
<?php if ($this->params->get('categoryDescription') && isset($category->description)): ?>
<p><?php echo $category->description; ?></p>
<?php endif; ?>
<div class="clr"></div>
<!-- K2 Plugins: K2CategoryDisplay -->
<?php echo $category->event->K2CategoryDisplay; ?>
<div class="clr"></div>
</div>
<!-- End K2 Category block -->
<?php endif; ?>
<?php else: $user=$block; ?>
<?php if ($this->params->get('userFeed') || $this->params->get('userImage') || $this->params->get('userName') || $this->params->get('userDescription') || $this->params->get('userURL') || $this->params->get('userEmail')): ?>
<!-- Start K2 User block -->
<div class="latestItemsUser">
<?php if($this->params->get('userFeed')): ?>
<!-- RSS feed icon -->
<div class="k2FeedIcon">
<a href="<?php echo $user->feed; ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
</a>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if ($this->params->get('userImage') && !empty($user->avatar)): ?>
<img src="<?php echo $user->avatar; ?>" alt="<?php echo $user->name; ?>" style="width:<?php echo $this->params->get('userImageWidth'); ?>px;height:auto;" />
<?php endif; ?>
<?php if ($this->params->get('userName')): ?>
<h2><a rel="author" href="<?php echo $user->link; ?>"><?php echo $user->name; ?></a></h2>
<?php endif; ?>
<?php if ($this->params->get('userDescription') && isset($user->profile->description)): ?>
<p class="latestItemsUserDescription"><?php echo $user->profile->description; ?></p>
<?php endif; ?>
<?php if ($this->params->get('userURL') || $this->params->get('userEmail')): ?>
<p class="latestItemsUserAdditionalInfo">
<?php if ($this->params->get('userURL') && isset($user->profile->url)): ?>
<span class="latestItemsUserURL">
<?php echo JText::_('K2_WEBSITE_URL'); ?>: <a rel="me" href="<?php echo $user->profile->url; ?>" target="_blank"><?php echo $user->profile->url; ?></a>
</span>
<?php endif; ?>
<?php if ($this->params->get('userEmail')): ?>
<span class="latestItemsUserEmail">
<?php echo JText::_('K2_EMAIL'); ?>: <?php echo JHTML::_('Email.cloak', $user->email); ?>
</span>
<?php endif; ?>
</p>
<?php endif; ?>
<div class="clr"></div>
<?php echo $user->event->K2UserDisplay; ?>
<div class="clr"></div>
</div>
<!-- End K2 User block -->
<?php endif; ?>
<?php endif; ?>
<!-- Start Items list -->
<div class="latestItemList">
<?php if($this->params->get('latestItemsDisplayEffect')=="first"): ?>
<?php foreach ($block->items as $itemCounter=>$item): K2HelperUtilities::setDefaultImage($item, 'latest', $this->params); ?>
<?php if($itemCounter==0): ?>
<?php $this->item=$item; echo $this->loadTemplate('item'); ?>
<?php else: ?>
<h2 class="latestItemTitleList">
<?php if ($item->params->get('latestItemTitleLinked')): ?>
<a href="<?php echo $item->link; ?>">
<?php echo $item->title; ?>
</a>
<?php else: ?>
<?php echo $item->title; ?>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php endforeach; ?>
<?php else: ?>
<?php foreach ($block->items as $item): K2HelperUtilities::setDefaultImage($item, 'latest', $this->params); ?>
<?php $this->item=$item; echo $this->loadTemplate('item'); ?>
<?php endforeach; ?>
<?php endif; ?>
</div>
<!-- End Item list -->
</div>
<?php if(($key+1)%($this->params->get('latestItemsCols'))==0): ?>
<div class="clr"></div>
<?php endif; ?>
<?php endforeach; ?>
<div class="clr"></div>
</div>
<!-- End K2 Latest Layout -->

View File

@ -0,0 +1,167 @@
<?php
/**
* @version $Id: latest_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;
?>
<!-- Start K2 Item Layout -->
<div class="latestItemView">
<!-- Plugins: BeforeDisplay -->
<?php echo $this->item->event->BeforeDisplay; ?>
<!-- K2 Plugins: K2BeforeDisplay -->
<?php echo $this->item->event->K2BeforeDisplay; ?>
<div class="latestItemHeader">
<?php if($this->item->params->get('latestItemTitle')): ?>
<!-- Item title -->
<h2 class="latestItemTitle">
<?php if ($this->item->params->get('latestItemTitleLinked')): ?>
<a href="<?php echo $this->item->link; ?>">
<?php echo $this->item->title; ?>
</a>
<?php else: ?>
<?php echo $this->item->title; ?>
<?php endif; ?>
</h2>
<?php endif; ?>
</div>
<?php if($this->item->params->get('latestItemDateCreated')): ?>
<!-- Date created -->
<span class="latestItemDateCreated">
<?php echo JHTML::_('date', $this->item->created , JText::_('K2_DATE_FORMAT_LC2')); ?>
</span>
<?php endif; ?>
<!-- Plugins: AfterDisplayTitle -->
<?php echo $this->item->event->AfterDisplayTitle; ?>
<!-- K2 Plugins: K2AfterDisplayTitle -->
<?php echo $this->item->event->K2AfterDisplayTitle; ?>
<div class="latestItemBody">
<!-- Plugins: BeforeDisplayContent -->
<?php echo $this->item->event->BeforeDisplayContent; ?>
<!-- K2 Plugins: K2BeforeDisplayContent -->
<?php echo $this->item->event->K2BeforeDisplayContent; ?>
<?php if($this->item->params->get('latestItemImage') && !empty($this->item->image)): ?>
<!-- Item Image -->
<div class="latestItemImageBlock">
<span class="latestItemImage">
<a href="<?php echo $this->item->link; ?>" title="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>">
<img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px;height:auto;" />
</a>
</span>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->item->params->get('latestItemIntroText')): ?>
<!-- Item introtext -->
<div class="latestItemIntroText">
<?php echo $this->item->introtext; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
<!-- Plugins: AfterDisplayContent -->
<?php echo $this->item->event->AfterDisplayContent; ?>
<!-- K2 Plugins: K2AfterDisplayContent -->
<?php echo $this->item->event->K2AfterDisplayContent; ?>
<div class="clr"></div>
</div>
<?php if($this->item->params->get('latestItemCategory') || $this->item->params->get('latestItemTags')): ?>
<div class="latestItemLinks">
<?php if($this->item->params->get('latestItemCategory')): ?>
<!-- Item category name -->
<div class="latestItemCategory">
<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
<a href="<?php echo $this->item->category->link; ?>"><?php echo $this->item->category->name; ?></a>
</div>
<?php endif; ?>
<?php if($this->item->params->get('latestItemTags') && count($this->item->tags)): ?>
<!-- Item tags -->
<div class="latestItemTagsBlock">
<span><?php echo JText::_('K2_TAGGED_UNDER'); ?></span>
<ul class="latestItemTags">
<?php foreach ($this->item->tags as $tag): ?>
<li><a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a></li>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if($this->params->get('latestItemVideo') && !empty($this->item->video)): ?>
<!-- Item video -->
<div class="latestItemVideoBlock">
<h3><?php echo JText::_('K2_RELATED_VIDEO'); ?></h3>
<span class="latestItemVideo<?php if($this->item->videoType=='embedded'): ?> embedded<?php endif; ?>"><?php echo $this->item->video; ?></span>
</div>
<?php endif; ?>
<?php if($this->item->params->get('latestItemCommentsAnchor') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1')) ): ?>
<!-- Anchor link to comments below -->
<div class="latestItemCommentsLink">
<?php if(!empty($this->item->event->K2CommentsCounter)): ?>
<!-- K2 Plugins: K2CommentsCounter -->
<?php echo $this->item->event->K2CommentsCounter; ?>
<?php else: ?>
<?php if($this->item->numOfComments > 0): ?>
<a href="<?php echo $this->item->link; ?>#itemCommentsAnchor">
<?php echo $this->item->numOfComments; ?> <?php echo ($this->item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?>
</a>
<?php else: ?>
<a href="<?php echo $this->item->link; ?>#itemCommentsAnchor">
<?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($this->item->params->get('latestItemReadMore')): ?>
<!-- Item "read more..." link -->
<div class="latestItemReadMore">
<a class="k2ReadMore" href="<?php echo $this->item->link; ?>">
<?php echo JText::_('K2_READ_MORE'); ?>
</a>
</div>
<?php endif; ?>
<div class="clr"></div>
<!-- Plugins: AfterDisplay -->
<?php echo $this->item->event->AfterDisplay; ?>
<!-- K2 Plugins: K2AfterDisplay -->
<?php echo $this->item->event->K2AfterDisplay; ?>
<div class="clr"></div>
</div>
<!-- End K2 Item Layout -->

View File

@ -0,0 +1,147 @@
<?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;
?>
<!-- Start K2 Tag Layout -->
<div id="k2Container" class="tagView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>">
<?php if($this->params->get('show_page_title')): ?>
<!-- Page title -->
<div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>">
<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>
<?php if($this->params->get('tagFeedIcon',1)): ?>
<!-- RSS feed icon -->
<div class="k2FeedIcon">
<a href="<?php echo $this->feed; ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
</a>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(count($this->items)): ?>
<div class="tagItemList">
<?php foreach($this->items as $item): ?>
<!-- Start K2 Item Layout -->
<div class="tagItemView">
<div class="tagItemHeader">
<?php if($item->params->get('tagItemDateCreated',1)): ?>
<!-- Date created -->
<span class="tagItemDateCreated">
<?php echo JHTML::_('date', $item->created , JText::_('K2_DATE_FORMAT_LC2')); ?>
</span>
<?php endif; ?>
<?php if($item->params->get('tagItemTitle',1)): ?>
<!-- Item title -->
<h2 class="tagItemTitle">
<?php if ($item->params->get('tagItemTitleLinked',1)): ?>
<a href="<?php echo $item->link; ?>">
<?php echo $item->title; ?>
</a>
<?php else: ?>
<?php echo $item->title; ?>
<?php endif; ?>
</h2>
<?php endif; ?>
</div>
<div class="tagItemBody">
<?php if($item->params->get('tagItemImage',1) && !empty($item->imageGeneric)): ?>
<!-- Item Image -->
<div class="tagItemImageBlock">
<span class="tagItemImage">
<a href="<?php echo $item->link; ?>" title="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>">
<img src="<?php echo $item->imageGeneric; ?>" alt="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>" style="width:<?php echo $item->params->get('itemImageGeneric'); ?>px; height:auto;" />
</a>
</span>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($item->params->get('tagItemIntroText',1)): ?>
<!-- Item introtext -->
<div class="tagItemIntroText">
<?php echo $item->introtext; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<div class="clr"></div>
<?php if($item->params->get('tagItemExtraFields',0) && count($item->extra_fields)): ?>
<!-- Item extra fields -->
<div class="tagItemExtraFields">
<h4><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h4>
<ul>
<?php foreach ($item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="tagItemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<span class="tagItemExtraFieldsLabel"><?php echo $extraField->name; ?></span>
<span class="tagItemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($item->params->get('tagItemCategory')): ?>
<!-- Item category name -->
<div class="tagItemCategory">
<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
<a href="<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a>
</div>
<?php endif; ?>
<?php if ($item->params->get('tagItemReadMore')): ?>
<!-- Item "read more..." link -->
<div class="tagItemReadMore">
<a class="k2ReadMore" href="<?php echo $item->link; ?>">
<?php echo JText::_('K2_READ_MORE'); ?>
</a>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<!-- End K2 Item Layout -->
<?php endforeach; ?>
</div>
<!-- Pagination -->
<?php if($this->pagination->getPagesLinks()): ?>
<div class="k2Pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
<div class="clr"></div>
<?php echo $this->pagination->getPagesCounter(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<!-- End K2 Tag Layout -->

View File

@ -0,0 +1,272 @@
<?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;
// Get user stuff (do not change)
$user = JFactory::getUser();
?>
<!-- Start K2 User Layout -->
<div id="k2Container" class="userView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>">
<?php if($this->params->get('show_page_title') && $this->params->get('page_title')!=$this->user->name): ?>
<!-- Page title -->
<div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>">
<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>
<?php if($this->params->get('userFeedIcon',1)): ?>
<!-- RSS feed icon -->
<div class="k2FeedIcon">
<a href="<?php echo $this->feed; ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
</a>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if ($this->params->get('userImage') || $this->params->get('userName') || $this->params->get('userDescription') || $this->params->get('userURL') || $this->params->get('userEmail')): ?>
<div class="userBlock">
<?php if(isset($this->addLink) && JRequest::getInt('id')==$user->id): ?>
<!-- Item add link -->
<span class="userItemAddLink">
<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $this->addLink; ?>">
<?php echo JText::_('K2_POST_A_NEW_ITEM'); ?>
</a>
</span>
<?php endif; ?>
<?php if ($this->params->get('userImage') && !empty($this->user->avatar)): ?>
<img src="<?php echo $this->user->avatar; ?>" alt="<?php echo $this->user->name; ?>" style="width:<?php echo $this->params->get('userImageWidth'); ?>px; height:auto;" />
<?php endif; ?>
<?php if ($this->params->get('userName')): ?>
<h2><?php echo $this->user->name; ?></h2>
<?php endif; ?>
<?php if ($this->params->get('userDescription') && trim($this->user->profile->description)): ?>
<div class="userDescription"><?php echo $this->user->profile->description; ?></div>
<?php endif; ?>
<?php if (($this->params->get('userURL') && isset($this->user->profile->url) && $this->user->profile->url) || $this->params->get('userEmail')): ?>
<div class="userAdditionalInfo">
<?php if ($this->params->get('userURL') && isset($this->user->profile->url) && $this->user->profile->url): ?>
<span class="userURL">
<?php echo JText::_('K2_WEBSITE_URL'); ?>: <a href="<?php echo $this->user->profile->url; ?>" target="_blank" rel="me"><?php echo $this->user->profile->url; ?></a>
</span>
<?php endif; ?>
<?php if ($this->params->get('userEmail')): ?>
<span class="userEmail">
<?php echo JText::_('K2_EMAIL'); ?>: <?php echo JHTML::_('Email.cloak', $this->user->email); ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php echo $this->user->event->K2UserDisplay; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(count($this->items)): ?>
<!-- Item list -->
<div class="userItemList">
<?php foreach ($this->items as $item): ?>
<!-- Start K2 Item Layout -->
<div class="userItemView<?php if(!$item->published || ($item->publish_up != $this->nullDate && $item->publish_up > $this->now) || ($item->publish_down != $this->nullDate && $item->publish_down < $this->now)) echo ' userItemViewUnpublished'; ?><?php echo ($item->featured) ? ' userItemIsFeatured' : ''; ?>">
<!-- Plugins: BeforeDisplay -->
<?php echo $item->event->BeforeDisplay; ?>
<!-- K2 Plugins: K2BeforeDisplay -->
<?php echo $item->event->K2BeforeDisplay; ?>
<div class="userItemHeader">
<?php if($this->params->get('userItemDateCreated')): ?>
<!-- Date created -->
<span class="userItemDateCreated">
<?php echo JHTML::_('date', $item->created , JText::_('K2_DATE_FORMAT_LC2')); ?>
</span>
<?php endif; ?>
<?php if($this->params->get('userItemTitle')): ?>
<!-- Item title -->
<h3 class="userItemTitle">
<?php if(isset($item->editLink)): ?>
<!-- Item edit link -->
<span class="userItemEditLink">
<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $item->editLink; ?>">
<?php echo JText::_('K2_EDIT_ITEM'); ?>
</a>
</span>
<?php endif; ?>
<?php if ($this->params->get('userItemTitleLinked') && $item->published): ?>
<a href="<?php echo $item->link; ?>">
<?php echo $item->title; ?>
</a>
<?php else: ?>
<?php echo $item->title; ?>
<?php endif; ?>
<?php if(!$item->published || ($item->publish_up != $this->nullDate && $item->publish_up > $this->now) || ($item->publish_down != $this->nullDate && $item->publish_down < $this->now)): ?>
<span>
<sup>
<?php echo JText::_('K2_UNPUBLISHED'); ?>
</sup>
</span>
<?php endif; ?>
</h3>
<?php endif; ?>
</div>
<!-- Plugins: AfterDisplayTitle -->
<?php echo $item->event->AfterDisplayTitle; ?>
<!-- K2 Plugins: K2AfterDisplayTitle -->
<?php echo $item->event->K2AfterDisplayTitle; ?>
<div class="userItemBody">
<!-- Plugins: BeforeDisplayContent -->
<?php echo $item->event->BeforeDisplayContent; ?>
<!-- K2 Plugins: K2BeforeDisplayContent -->
<?php echo $item->event->K2BeforeDisplayContent; ?>
<?php if($this->params->get('userItemImage') && !empty($item->imageGeneric)): ?>
<!-- Item Image -->
<div class="userItemImageBlock">
<span class="userItemImage">
<a href="<?php echo $item->link; ?>" title="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>">
<img src="<?php echo $item->imageGeneric; ?>" alt="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>" style="width:<?php echo $this->params->get('itemImageGeneric'); ?>px; height:auto;" />
</a>
</span>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->params->get('userItemIntroText')): ?>
<!-- Item introtext -->
<div class="userItemIntroText">
<?php echo $item->introtext; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
<!-- Plugins: AfterDisplayContent -->
<?php echo $item->event->AfterDisplayContent; ?>
<!-- K2 Plugins: K2AfterDisplayContent -->
<?php echo $item->event->K2AfterDisplayContent; ?>
<div class="clr"></div>
</div>
<?php if($this->params->get('userItemCategory') || $this->params->get('userItemTags')): ?>
<div class="userItemLinks">
<?php if($this->params->get('userItemCategory')): ?>
<!-- Item category name -->
<div class="userItemCategory">
<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
<a href="<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a>
</div>
<?php endif; ?>
<?php if($this->params->get('userItemTags') && isset($item->tags)): ?>
<!-- Item tags -->
<div class="userItemTagsBlock">
<span><?php echo JText::_('K2_TAGGED_UNDER'); ?></span>
<ul class="userItemTags">
<?php foreach ($item->tags as $tag): ?>
<li><a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a></li>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<div class="clr"></div>
<?php if($this->params->get('userItemCommentsAnchor') && ( ($this->params->get('comments') == '2' && !$this->user->guest) || ($this->params->get('comments') == '1')) ): ?>
<!-- Anchor link to comments below -->
<div class="userItemCommentsLink">
<?php if(!empty($item->event->K2CommentsCounter)): ?>
<!-- K2 Plugins: K2CommentsCounter -->
<?php echo $item->event->K2CommentsCounter; ?>
<?php else: ?>
<?php if($item->numOfComments > 0): ?>
<a href="<?php echo $item->link; ?>#itemCommentsAnchor">
<?php echo $item->numOfComments; ?> <?php echo ($item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?>
</a>
<?php else: ?>
<a href="<?php echo $item->link; ?>#itemCommentsAnchor">
<?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?>
</a>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($this->params->get('userItemReadMore')): ?>
<!-- Item "read more..." link -->
<div class="userItemReadMore">
<a class="k2ReadMore" href="<?php echo $item->link; ?>">
<?php echo JText::_('K2_READ_MORE'); ?>
</a>
</div>
<?php endif; ?>
<div class="clr"></div>
<!-- Plugins: AfterDisplay -->
<?php echo $item->event->AfterDisplay; ?>
<!-- K2 Plugins: K2AfterDisplay -->
<?php echo $item->event->K2AfterDisplay; ?>
<div class="clr"></div>
</div>
<!-- End K2 Item Layout -->
<?php endforeach; ?>
</div>
<!-- Pagination -->
<?php if(count($this->pagination->getPagesLinks())): ?>
<div class="k2Pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
<div class="clr"></div>
<?php echo $this->pagination->getPagesCounter(); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<!-- End K2 User Layout -->

View File

@ -0,0 +1,162 @@
<?php
/**
* @version $Id: generic.php 1913 2013-02-08 22:35:11Z 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;
?>
<!-- Start K2 Generic (search/date) Layout -->
<div id="k2Container" class="genericView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>">
<?php if($this->params->get('show_page_title') || JRequest::getCmd('task')=='search' || JRequest::getCmd('task')=='date'): ?>
<!-- Page title -->
<div class="componentheading<?php echo $this->params->get('pageclass_sfx')?>">
<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>
<?php if(JRequest::getCmd('task')=='search' && $this->params->get('googleSearch')): ?>
<!-- Google Search container -->
<div id="<?php echo $this->params->get('googleSearchContainer'); ?>"></div>
<?php endif; ?>
<?php if(count($this->items) && $this->params->get('genericFeedIcon',1)): ?>
<!-- RSS feed icon -->
<div class="k2FeedIcon">
<a href="<?php echo $this->feed; ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
</a>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if(count($this->items)): ?>
<div class="genericItemList">
<?php foreach($this->items as $item): ?>
<!-- Start K2 Item Layout -->
<div class="genericItemView">
<div class="genericItemHeader">
<?php if($this->params->get('genericItemDateCreated')): ?>
<!-- Date created -->
<span class="genericItemDateCreated">
<?php echo JHTML::_('date', $item->created , JText::_('K2_DATE_FORMAT_LC2')); ?>
</span>
<?php endif; ?>
<?php if($this->params->get('genericItemTitle')): ?>
<!-- Item title -->
<h2 class="genericItemTitle">
<?php if ($this->params->get('genericItemTitleLinked')): ?>
<a href="<?php echo $item->link; ?>">
<?php echo $item->title; ?>
</a>
<?php else: ?>
<?php echo $item->title; ?>
<?php endif; ?>
</h2>
<?php endif; ?>
</div>
<div class="genericItemBody">
<?php if($this->params->get('genericItemImage') && !empty($item->imageGeneric)): ?>
<!-- Item Image -->
<div class="genericItemImageBlock">
<span class="genericItemImage">
<a href="<?php echo $item->link; ?>" title="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>">
<img src="<?php echo $item->imageGeneric; ?>" alt="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>" style="width:<?php echo $this->params->get('itemImageGeneric'); ?>px; height:auto;" />
</a>
</span>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->params->get('genericItemIntroText')): ?>
<!-- Item introtext -->
<div class="genericItemIntroText">
<?php echo $item->introtext; ?>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<div class="clr"></div>
<?php if($this->params->get('genericItemExtraFields') && count($item->extra_fields)): ?>
<!-- Item extra fields -->
<div class="genericItemExtraFields">
<h4><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h4>
<ul>
<?php foreach ($item->extra_fields as $key=>$extraField): ?>
<?php if($extraField->value != ''): ?>
<li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>">
<?php if($extraField->type == 'header'): ?>
<h4 class="genericItemExtraFieldsHeader"><?php echo $extraField->name; ?></h4>
<?php else: ?>
<span class="genericItemExtraFieldsLabel"><?php echo $extraField->name; ?></span>
<span class="genericItemExtraFieldsValue"><?php echo $extraField->value; ?></span>
<?php endif; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php if($this->params->get('genericItemCategory')): ?>
<!-- Item category name -->
<div class="genericItemCategory">
<span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span>
<a href="<?php echo $item->category->link; ?>"><?php echo $item->category->name; ?></a>
</div>
<?php endif; ?>
<?php if ($this->params->get('genericItemReadMore')): ?>
<!-- Item "read more..." link -->
<div class="genericItemReadMore">
<a class="k2ReadMore" href="<?php echo $item->link; ?>">
<?php echo JText::_('K2_READ_MORE'); ?>
</a>
</div>
<?php endif; ?>
<div class="clr"></div>
</div>
<!-- End K2 Item Layout -->
<?php endforeach; ?>
</div>
<!-- Pagination -->
<?php if($this->pagination->getPagesLinks()): ?>
<div class="k2Pagination">
<?php echo $this->pagination->getPagesLinks(); ?>
<div class="clr"></div>
<?php echo $this->pagination->getPagesCounter(); ?>
</div>
<?php endif; ?>
<?php else: ?>
<?php if(!$this->params->get('googleSearch')): ?>
<!-- No results found -->
<div id="genericItemListNothingFound">
<p><?php echo JText::_('K2_NO_RESULTS_FOUND'); ?></p>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<!-- End K2 Generic (search/date) Layout -->

View File

@ -0,0 +1,21 @@
<?php
/**
* @version $Id: generic_search.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;
?>
<?php if(count($this->items)): ?>
<ul class="liveSearchResults">
<?php foreach($this->items as $item): ?>
<li><a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>

View File

@ -0,0 +1,198 @@
<?php
/**
* @version $Id: profile.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;
?>
<!-- K2 user profile form -->
<form action="<?php echo JURI::root(true); ?>/index.php" enctype="multipart/form-data" method="post" name="userform" autocomplete="off" class="form-validate">
<?php if($this->params->def('show_page_title',1)): ?>
<div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>
<div id="k2Container" class="k2AccountPage">
<table class="admintable" cellpadding="0" cellspacing="0">
<tr>
<th colspan="2" class="k2ProfileHeading">
<?php echo JText::_('K2_ACCOUNT_DETAILS'); ?>
</th>
</tr>
<tr>
<td class="key">
<label for="username"><?php echo JText::_('K2_USER_NAME'); ?></label>
</td>
<td>
<span><b><?php echo $this->user->get('username'); ?></b></span>
</td>
</tr>
<tr>
<td class="key">
<label id="namemsg" for="name"><?php echo JText::_('K2_NAME'); ?></label>
</td>
<td>
<input type="text" name="<?php echo $this->nameFieldName; ?>" id="name" size="40" value="<?php echo $this->escape($this->user->get( 'name' )); ?>" class="inputbox required" maxlength="50" />
</td>
</tr>
<tr>
<td class="key">
<label id="emailmsg" for="email"><?php echo JText::_('K2_EMAIL'); ?></label>
</td>
<td>
<input type="text" id="email" name="<?php echo $this->emailFieldName; ?>" size="40" value="<?php echo $this->escape($this->user->get( 'email' )); ?>" class="inputbox required validate-email" maxlength="100" />
</td>
</tr>
<?php if(version_compare(JVERSION, '2.5', 'ge')): ?>
<tr>
<td class="key">
<label id="email2msg" for="email2"><?php echo JText::_('K2_CONFIRM_EMAIL'); ?></label>
</td>
<td>
<input type="text" id="email2" name="jform[email2]" size="40" value="<?php echo $this->escape($this->user->get( 'email' )); ?>" class="inputbox required validate-email" maxlength="100" />
*
</td>
</tr>
<?php endif; ?>
<tr>
<td class="key">
<label id="pwmsg" for="password"><?php echo JText::_('K2_PASSWORD'); ?></label>
</td>
<td>
<input class="inputbox validate-password" type="password" id="password" name="<?php echo $this->passwordFieldName; ?>" size="40" value="" />
</td>
</tr>
<tr>
<td class="key">
<label id="pw2msg" for="password2"><?php echo JText::_('K2_VERIFY_PASSWORD'); ?></label>
</td>
<td>
<input class="inputbox validate-passverify" type="password" id="password2" name="<?php echo $this->passwordVerifyFieldName; ?>" size="40" value="" />
</td>
</tr>
<tr>
<th colspan="2" class="k2ProfileHeading">
<?php echo JText::_('K2_PERSONAL_DETAILS'); ?>
</th>
</tr>
<!-- K2 attached fields -->
<tr>
<td class="key">
<label id="gendermsg" for="gender"><?php echo JText::_('K2_GENDER'); ?></label>
</td>
<td>
<?php echo $this->lists['gender']; ?>
</td>
</tr>
<tr>
<td class="key">
<label id="descriptionmsg" for="description"><?php echo JText::_('K2_DESCRIPTION'); ?></label>
</td>
<td>
<?php echo $this->editor; ?>
</td>
</tr>
<tr>
<td class="key">
<label id="imagemsg" for="image"><?php echo JText::_( 'K2_USER_IMAGE_AVATAR' ); ?></label>
</td>
<td>
<input type="file" id="image" name="image"/>
<?php if ($this->K2User->image): ?>
<img class="k2AccountPageImage" src="<?php echo JURI::root(true).'/media/k2/users/'.$this->K2User->image; ?>" alt="<?php echo $this->user->name; ?>" />
<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>
<tr>
<td class="key">
<label id="urlmsg" for="url"><?php echo JText::_('K2_URL'); ?></label>
</td>
<td>
<input type="text" size="50" value="<?php echo $this->K2User->url; ?>" name="url" id="url"/>
</td>
</tr>
<?php if(count(array_filter($this->K2Plugins))): ?>
<!-- K2 Plugin attached fields -->
<tr>
<th colspan="2" class="k2ProfileHeading">
<?php echo JText::_('K2_ADDITIONAL_DETAILS'); ?>
</th>
</tr>
<?php foreach($this->K2Plugins as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<tr>
<td colspan="2">
<?php echo $K2Plugin->fields; ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<?php if(isset($this->params) && version_compare(JVERSION, '1.6', 'lt')): ?>
<tr>
<th colspan="2" class="k2ProfileHeading">
<?php echo JText::_('K2_ADMINISTRATIVE_DETAILS'); ?>
</th>
</tr>
<tr>
<td colspan="2" id="userAdminParams">
<?php echo $this->params->render('params'); ?>
</td>
</tr>
<?php endif; ?>
<!-- Joomla! 1.6+ JForm implementation -->
<?php if(isset($this->form)): ?>
<?php foreach ($this->form->getFieldsets() as $fieldset): // Iterate through the form fieldsets and display each one.?>
<?php if($fieldset->name != 'core'): ?>
<?php $fields = $this->form->getFieldset($fieldset->name);?>
<?php if (count($fields)):?>
<?php if (isset($fieldset->label)):// If the fieldset has a label set, display it as the legend.?>
<tr>
<th colspan="2" class="k2ProfileHeading">
<?php echo JText::_($fieldset->label);?>
</th>
</tr>
<?php endif;?>
<?php foreach($fields as $field):// Iterate through the fields in the set and display them.?>
<?php if ($field->hidden):// If the field is hidden, just display the input.?>
<tr><td colspan="2"><?php echo $field->input;?></td></tr>
<?php else:?>
<tr>
<td class="key">
<?php echo $field->label; ?>
<?php if (!$field->required && $field->type != 'Spacer'): ?>
<span class="optional"><?php echo JText::_('COM_USERS_OPTIONAL');?></span>
<?php endif; ?>
</td>
<td><?php echo $field->input;?></td>
</tr>
<?php endif;?>
<?php endforeach;?>
<?php endif;?>
<?php endif; ?>
<?php endforeach;?>
<?php endif; ?>
</table>
<div class="k2AccountPageUpdate">
<button class="button validate" type="submit" onclick="submitbutton( this.form );return false;">
<?php echo JText::_('K2_SAVE'); ?>
</button>
</div>
</div>
<input type="hidden" name="<?php echo $this->usernameFieldName; ?>" value="<?php echo $this->user->get('username'); ?>" />
<input type="hidden" name="<?php echo $this->idFieldName; ?>" value="<?php echo $this->user->get('id'); ?>" />
<input type="hidden" name="gid" value="<?php echo $this->user->get('gid'); ?>" />
<input type="hidden" name="option" value="<?php echo $this->optionValue; ?>" />
<input type="hidden" name="task" value="<?php echo $this->taskValue; ?>" />
<input type="hidden" name="K2UserForm" value="1" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>

View File

@ -0,0 +1,201 @@
<?php
/**
* @version $Id: register.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;
?>
<!-- K2 user register form -->
<?php if(isset($this->message)) $this->display('message'); ?>
<form action="<?php echo JURI::root(true); ?>/index.php" enctype="multipart/form-data" method="post" id="josForm" name="josForm" class="form-validate">
<?php if($this->params->def('show_page_title',1)): ?>
<div class="componentheading<?php echo $this->escape($this->params->get('pageclass_sfx')); ?>">
<?php echo $this->escape($this->params->get('page_title')); ?>
</div>
<?php endif; ?>
<div id="k2Container" class="k2AccountPage">
<table class="admintable" cellpadding="0" cellspacing="0">
<tr>
<th colspan="2" class="k2ProfileHeading">
<?php echo JText::_('K2_ACCOUNT_DETAILS'); ?>
</th>
</tr>
<tr>
<td class="key">
<label id="namemsg" for="name"><?php echo JText::_('K2_NAME'); ?></label>
</td>
<td>
<input type="text" name="<?php echo $this->nameFieldName; ?>" id="name" size="40" value="<?php echo $this->escape($this->user->get( 'name' )); ?>" class="inputbox required" maxlength="50" />
*
</td>
</tr>
<tr>
<td class="key">
<label id="usernamemsg" for="username"><?php echo JText::_('K2_USER_NAME'); ?></label>
</td>
<td>
<input type="text" id="username" name="<?php echo $this->usernameFieldName; ?>" size="40" value="<?php echo $this->escape($this->user->get( 'username' )); ?>" class="inputbox required validate-username" maxlength="25" />
*
</td>
</tr>
<tr>
<td class="key">
<label id="emailmsg" for="email"><?php echo JText::_('K2_EMAIL'); ?></label>
</td>
<td>
<input type="text" id="email" name="<?php echo $this->emailFieldName; ?>" size="40" value="<?php echo $this->escape($this->user->get( 'email' )); ?>" class="inputbox required validate-email" maxlength="100" />
*
</td>
</tr>
<?php if(version_compare(JVERSION, '1.6', 'ge')): ?>
<tr>
<td class="key">
<label id="email2msg" for="email2"><?php echo JText::_('K2_CONFIRM_EMAIL'); ?></label>
</td>
<td>
<input type="text" id="email2" name="jform[email2]" size="40" value="" class="inputbox required validate-email" maxlength="100" />
*
</td>
</tr>
<?php endif; ?>
<tr>
<td class="key">
<label id="pwmsg" for="password"><?php echo JText::_('K2_PASSWORD'); ?></label>
</td>
<td>
<input class="inputbox required validate-password" type="password" id="password" name="<?php echo $this->passwordFieldName; ?>" size="40" value="" />
*
</td>
</tr>
<tr>
<td class="key">
<label id="pw2msg" for="password2"><?php echo JText::_('K2_VERIFY_PASSWORD'); ?></label>
</td>
<td>
<input class="inputbox required validate-passverify" type="password" id="password2" name="<?php echo $this->passwordVerifyFieldName; ?>" size="40" value="" />
*
</td>
</tr>
<tr>
<th colspan="2" class="k2ProfileHeading">
<?php echo JText::_('K2_PERSONAL_DETAILS'); ?>
</th>
</tr>
<!-- K2 attached fields -->
<tr>
<td class="key">
<label id="gendermsg" for="gender"><?php echo JText::_('K2_GENDER'); ?></label>
</td>
<td>
<?php echo $this->lists['gender']; ?>
</td>
</tr>
<tr>
<td class="key">
<label id="descriptionmsg" for="description"><?php echo JText::_('K2_DESCRIPTION'); ?></label>
</td>
<td>
<?php echo $this->editor; ?>
</td>
</tr>
<tr>
<td class="key">
<label id="imagemsg" for="image"><?php echo JText::_( 'K2_USER_IMAGE_AVATAR' ); ?></label>
</td>
<td>
<input type="file" id="image" name="image"/>
<?php if ($this->K2User->image): ?>
<img class="k2AdminImage" src="<?php echo JURI::root().'media/k2/users/'.$this->K2User->image; ?>" alt="<?php echo $this->user->name; ?>" />
<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>
<tr>
<td class="key">
<label id="urlmsg" for="url"><?php echo JText::_('K2_URL'); ?></label>
</td>
<td>
<input type="text" size="50" value="<?php echo $this->K2User->url; ?>" name="url" id="url"/>
</td>
</tr>
<?php if(count(array_filter($this->K2Plugins))): ?>
<!-- K2 Plugin attached fields -->
<tr>
<th colspan="2" class="k2ProfileHeading">
<?php echo JText::_('K2_ADDITIONAL_DETAILS'); ?>
</th>
</tr>
<?php foreach ($this->K2Plugins as $K2Plugin): ?>
<?php if(!is_null($K2Plugin)): ?>
<tr>
<td colspan="2">
<?php echo $K2Plugin->fields; ?>
</td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
<!-- Joomla! 1.6+ JForm implementation -->
<?php if(isset($this->form)): ?>
<?php foreach ($this->form->getFieldsets() as $fieldset): // Iterate through the form fieldsets and display each one.?>
<?php if($fieldset->name != 'default'): ?>
<?php $fields = $this->form->getFieldset($fieldset->name);?>
<?php if (count($fields)):?>
<?php if (isset($fieldset->label)):// If the fieldset has a label set, display it as the legend.?>
<tr>
<th colspan="2" class="k2ProfileHeading">
<?php echo JText::_($fieldset->label);?>
</th>
</tr>
<?php endif;?>
<?php foreach($fields as $field):// Iterate through the fields in the set and display them.?>
<?php if ($field->hidden):// If the field is hidden, just display the input.?>
<tr><td colspan="2"><?php echo $field->input;?></td></tr>
<?php else:?>
<tr>
<td class="key">
<?php echo $field->label; ?>
<?php if (!$field->required && $field->type != 'Spacer'): ?>
<span class="optional"><?php echo JText::_('COM_USERS_OPTIONAL');?></span>
<?php endif; ?>
</td>
<td><?php echo $field->input;?></td>
</tr>
<?php endif;?>
<?php endforeach;?>
<?php endif;?>
<?php endif; ?>
<?php endforeach;?>
<?php endif; ?>
</table>
<?php if($this->K2Params->get('recaptchaOnRegistration') && $this->K2Params->get('recaptcha_public_key')): ?>
<label class="formRecaptcha"><?php echo JText::_('K2_ENTER_THE_TWO_WORDS_YOU_SEE_BELOW'); ?></label>
<div id="recaptcha"></div>
<?php endif; ?>
<div class="k2AccountPageNotice"><?php echo JText::_('K2_REGISTER_REQUIRED'); ?></div>
<div class="k2AccountPageUpdate">
<button class="button validate" type="submit">
<?php echo JText::_('K2_REGISTER'); ?>
</button>
</div>
</div>
<input type="hidden" name="option" value="<?php echo $this->optionValue; ?>" />
<input type="hidden" name="task" value="<?php echo $this->taskValue; ?>" />
<input type="hidden" name="id" value="0" />
<input type="hidden" name="gid" value="0" />
<input type="hidden" name="K2UserForm" value="1" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="Comments" hidden="true"/>
</metadata>

View File

@ -0,0 +1,46 @@
<?php
/**
* @version $Id: report.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;
?>
<div class="k2ReportCommentFormContainer">
<h2 class="componentheading">
<?php echo JText::_('K2_REPORT_COMMENT'); ?>
</h2>
<blockquote class="commentPreview">
<span class="quoteIconLeft">&ldquo;</span>
<span class="theComment"><?php echo nl2br($this->row->commentText); ?></span>
<span class="quoteIconRight">&rdquo;</span>
</blockquote>
<form action="<?php echo JURI::root(true); ?>/index.php" name="k2ReportCommentForm" id="k2ReportCommentForm" method="post">
<label for="name"><?php echo JText::_('K2_YOUR_NAME'); ?></label>
<input type="text" id="name" name="name" value="" />
<label for="reportReason"><?php echo JText::_('K2_REPORT_REASON'); ?></label>
<textarea name="reportReason" id="reportReason" cols="60" rows="10"></textarea>
<?php if($this->params->get('recaptcha') && $this->user->guest): ?>
<label class="formRecaptcha"><?php echo JText::_('K2_ENTER_THE_TWO_WORDS_YOU_SEE_BELOW'); ?></label>
<div id="recaptcha"></div>
<?php endif; ?>
<button class="button"><?php echo JText::_('K2_SEND_REPORT'); ?></button>
<span id="formLog"></span>
<input type="hidden" name="option" value="com_k2" />
<input type="hidden" name="view" value="comments" />
<input type="hidden" name="task" value="sendReport" />
<input type="hidden" name="id" value="<?php echo $this->row->id; ?>" />
<input type="hidden" name="format" value="raw" />
<?php echo JHTML::_('form.token'); ?>
</form>
</div>

View File

@ -0,0 +1,66 @@
<?php
/**
* @version $Id: view.html.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.view');
class K2ViewComments extends K2View
{
function report($tpl = null)
{
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$row = &JTable::getInstance('K2Comment', 'Table');
$row->load(JRequest::getInt('commentID'));
if (!$row->published)
{
JError::raiseError(404, JText::_('K2_NOT_FOUND'));
}
$this->assignRef('row', $row);
$user = JFactory::getUser();
$this->assignRef('user', $user);
$params = &K2HelperUtilities::getParams('com_k2');
if (!$params->get('comments') || !$params->get('commentsReporting') || ($params->get('commentsReporting') == '2' && $user->guest))
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
// Pass the old parameter to the view in order to avoid layout changes
if ($params->get('antispam') == 'recaptcha' || $params->get('antispam') == 'both')
{
$params->set('recaptcha', true);
}
else
{
$params->set('recaptcha', false);
}
$this->assignRef('params', $params);
if ($params->get('recaptcha') && $user->guest)
{
$document = JFactory::getDocument();
$document->addScript('https://www.google.com/recaptcha/api/js/recaptcha_ajax.js');
$js = '
function showRecaptcha(){
Recaptcha.create("'.$params->get('recaptcha_public_key').'", "recaptcha", {
theme: "'.$params->get('recaptcha_theme', 'clean').'"
});
}
$K2(window).load(function() {
showRecaptcha();
});
';
$document->addScriptDeclaration($js);
}
parent::display($tpl);
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="K2_ITEM">
<message>K2_CREATE_A_MENU_ITEM_LINKING_DIRECTLY_TO_AN_ITEM_IN_K2</message>
</view>
</metadata>

View File

@ -0,0 +1,13 @@
<?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;
?>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="K2_ITEM">
<message>K2_CREATE_A_MENU_ITEM_LINKING_DIRECTLY_TO_AN_ITEM_IN_K2</message>
</layout>
<state>
<name>K2_ITEM</name>
<description>K2_CREATE_A_MENU_ITEM_LINKING_DIRECTLY_TO_AN_ITEM_IN_K2</description>
<url addpath="/administrator/components/com_k2/elements">
<param name="id" type="item" default="" label="K2_SELECT_ITEM" description="K2_SELECT_AN_ITEM_TO_LINK_TO_DIRECTLY"/>
</url>
<params>
</params>
<fields name="request">
<fieldset name="request" addfieldpath="/administrator/components/com_k2/elements">
<field name="id" type="item" default="" label="K2_SELECT_ITEM" description="K2_SELECT_AN_ITEM_TO_LINK_TO_DIRECTLY" required="true"/>
</fieldset>
</fields>
</state>
</metadata>

View File

@ -0,0 +1,13 @@
<?php
/**
* @version $Id: item_comments_form.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;
?>

View File

@ -0,0 +1,13 @@
<?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;
?>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="K2_ITEM_EDIT_FORM">
<message>K2_CREATE_A_MENU_ITEM_LINKING_TO_ITEM_EDIT_FORM</message>
</layout>
<state>
<name>K2_ITEM_EDIT_FORM</name>
<description>K2_CREATE_A_MENU_ITEM_LINKING_TO_ITEM_EDIT_FORM</description>
<params addpath="/administrator/components/com_k2/elements">
<param name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE" />
<param name="category" type="categories" default="" label="K2_PRESELECTED_CATEGORY" />
<param name="itemform" type="itemform" />
</params>
<url addpath="/administrator/components/com_k2/elements">
<param name="task" type="hidden" default="add"/>
</url>
<params>
</params>
<fields name="params">
<fieldset name="basic" addfieldpath="/administrator/components/com_k2/elements">
<field name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
<field name="category" type="categories" default="" label="K2_PRESELECTED_CATEGORY" />
<field name="itemform" type="itemform" />
</fieldset>
</fields>
<fields name="request">
<fieldset name="request" addfieldpath="/administrator/components/com_k2/elements">
<field name="task" type="hidden" default="add" />
</fieldset>
</fields>
</state>
</metadata>

View File

@ -0,0 +1,514 @@
<?php
/**
* @version $Id: view.html.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.view');
class K2ViewItem extends K2View
{
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$document = JFactory::getDocument();
$params = K2HelperUtilities::getParams('com_k2');
$limitstart = JRequest::getInt('limitstart', 0);
$view = JRequest::getWord('view');
$task = JRequest::getWord('task');
$db = JFactory::getDBO();
$jnow = JFactory::getDate();
$now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql();
$nullDate = $db->getNullDate();
$this->setLayout('item');
// Add link
if (K2HelperPermissions::canAddItem())
$addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component');
$this->assignRef('addLink', $addLink);
// Get item
$model = $this->getModel();
$item = $model->getData();
// Does the item exists?
if (!is_object($item) || !$item->id)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
// Prepare item
$item = $model->prepareItem($item, $view, $task);
// Plugins
$item = $model->execPlugins($item, $view, $task);
// User K2 plugins
$item->event->K2UserDisplay = '';
if (isset($item->author) && is_object($item->author->profile) && isset($item->author->profile->id))
{
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2UserDisplay', array(&$item->author->profile, &$params, $limitstart));
$item->event->K2UserDisplay = trim(implode("\n", $results));
$item->author->profile->url = htmlspecialchars($item->author->profile->url, ENT_QUOTES, 'UTF-8');
}
// Access check
if ($this->getLayout() == 'form')
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
if (K2_JVERSION != '15')
{
if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($item->category->access, $user->getAuthorisedViewLevels()))
{
if ($user->guest)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
else
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
}
else
{
if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0))
{
if ($user->guest)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
else
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
}
// Published check
if (!$item->published || $item->trash)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ($item->publish_up != $nullDate && $item->publish_up > $now)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ($item->publish_down != $nullDate && $item->publish_down < $now)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if (!$item->category->published || $item->category->trash)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
// Increase hits counter
$model->hit($item->id);
// Set default image
K2HelperUtilities::setDefaultImage($item, $view);
// Pass the old parameter to the view in order to avoid layout changes
if($params->get('antispam') == 'recaptcha' || $params->get('antispam') == 'both')
{
$params->set('recaptcha', true);
$item->params->set('recaptcha', true);
}
else {
$params->set('recaptcha', false);
$item->params->set('recaptcha', false);
}
// Comments
$item->event->K2CommentsCounter = '';
$item->event->K2CommentsBlock = '';
if ($item->params->get('itemComments'))
{
// Trigger comments events
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart));
$item->event->K2CommentsCounter = trim(implode("\n", $results));
$results = $dispatcher->trigger('onK2CommentsBlock', array(&$item, &$params, $limitstart));
$item->event->K2CommentsBlock = trim(implode("\n", $results));
// Load K2 native comments system only if there are no plugins overriding it
if (empty($item->event->K2CommentsCounter) && empty($item->event->K2CommentsBlock))
{
// Load reCAPTCHA script
if (!JRequest::getInt('print') && ($item->params->get('comments') == '1' || ($item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($item->catid))))
{
if ($params->get('recaptcha') && ($user->guest || $params->get('recaptchaForRegistered', 1)))
{
$document->addScript('https://www.google.com/recaptcha/api/js/recaptcha_ajax.js');
$js = '
function showRecaptcha(){
Recaptcha.create("'.$item->params->get('recaptcha_public_key').'", "recaptcha", {
theme: "'.$item->params->get('recaptcha_theme', 'clean').'"
});
}
$K2(window).load(function() {
showRecaptcha();
});
';
$document->addScriptDeclaration($js);
}
}
// Check for inline comment moderation
if (!$user->guest && $user->id == $item->created_by && $params->get('inlineCommentsModeration'))
{
$inlineCommentsModeration = true;
$commentsPublished = false;
}
else
{
$inlineCommentsModeration = false;
$commentsPublished = true;
}
$this->assignRef('inlineCommentsModeration', $inlineCommentsModeration);
// Flag spammer link
$reportSpammerFlag = false;
if (K2_JVERSION != '15')
{
if ($user->authorise('core.admin', 'com_k2'))
{
$reportSpammerFlag = true;
$document = JFactory::getDocument();
$document->addScriptDeclaration('var K2Language = ["'.JText::_('K2_REPORT_USER_WARNING', true).'"];');
}
}
else
{
if ($user->gid > 24)
{
$reportSpammerFlag = true;
}
}
$limit = $params->get('commentsLimit');
$comments = $model->getItemComments($item->id, $limitstart, $limit, $commentsPublished);
for ($i = 0; $i < sizeof($comments); $i++)
{
$comments[$i]->commentText = nl2br($comments[$i]->commentText);
// Convert URLs to links properly
$comments[$i]->commentText = preg_replace("/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/i", "$1http://$2", $comments[$i]->commentText);
$comments[$i]->commentText = preg_replace("/([\w]+:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/i", "<a target=\"_blank\" rel=\"nofollow\" href=\"$1\">$1</A>", $comments[$i]->commentText);
$comments[$i]->commentText = preg_replace("/([\w-?&;#~=\.\/]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?))/i", "<a href=\"mailto:$1\">$1</A>", $comments[$i]->commentText);
$comments[$i]->userImage = K2HelperUtilities::getAvatar($comments[$i]->userID, $comments[$i]->commentEmail, $params->get('commenterImgWidth'));
if ($comments[$i]->userID > 0)
{
$comments[$i]->userLink = K2HelperRoute::getUserRoute($comments[$i]->userID);
}
else
{
$comments[$i]->userLink = $comments[$i]->commentURL;
}
if ($reportSpammerFlag && $comments[$i]->userID > 0)
{
$comments[$i]->reportUserLink = JRoute::_('index.php?option=com_k2&view=comments&task=reportSpammer&id='.$comments[$i]->userID.'&format=raw');
}
else
{
$comments[$i]->reportUserLink = false;
}
}
$item->comments = $comments;
jimport('joomla.html.pagination');
$total = $item->numOfComments;
$pagination = new JPagination($total, $limitstart, $limit);
}
}
// Author's latest items
if ($item->params->get('itemAuthorLatest') && $item->created_by_alias == '')
{
$model = $this->getModel('itemlist');
$authorLatestItems = $model->getAuthorLatest($item->id, $item->params->get('itemAuthorLatestLimit'), $item->created_by);
if (count($authorLatestItems))
{
for ($i = 0; $i < sizeof($authorLatestItems); $i++)
{
$authorLatestItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($authorLatestItems[$i]->id.':'.urlencode($authorLatestItems[$i]->alias), $authorLatestItems[$i]->catid.':'.urlencode($authorLatestItems[$i]->categoryalias))));
}
$this->assignRef('authorLatestItems', $authorLatestItems);
}
}
// Related items
if ($item->params->get('itemRelated') && isset($item->tags) && count($item->tags))
{
$model = $this->getModel('itemlist');
$relatedItems = $model->getRelatedItems($item->id, $item->tags, $item->params);
if (count($relatedItems))
{
for ($i = 0; $i < sizeof($relatedItems); $i++)
{
$relatedItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($relatedItems[$i]->id.':'.urlencode($relatedItems[$i]->alias), $relatedItems[$i]->catid.':'.urlencode($relatedItems[$i]->categoryalias))));
}
$this->assignRef('relatedItems', $relatedItems);
}
}
// Navigation (previous and next item)
if ($item->params->get('itemNavigation'))
{
$model = $this->getModel('item');
$nextItem = $model->getNextItem($item->id, $item->catid, $item->ordering);
if (!is_null($nextItem))
{
$item->nextLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($nextItem->id.':'.urlencode($nextItem->alias), $nextItem->catid.':'.urlencode($item->category->alias))));
$item->nextTitle = $nextItem->title;
}
$previousItem = $model->getPreviousItem($item->id, $item->catid, $item->ordering);
if (!is_null($previousItem))
{
$item->previousLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($previousItem->id.':'.urlencode($previousItem->alias), $previousItem->catid.':'.urlencode($item->category->alias))));
$item->previousTitle = $previousItem->title;
}
}
// Absolute URL
$uri = JURI::getInstance();
$item->absoluteURL = $uri->toString();
// Email link
if (K2_JVERSION != '15')
{
require_once (JPATH_SITE.'/components/com_mailto/helpers/mailto.php');
$template = $mainframe->getTemplate();
$item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&template='.$template.'&link='.MailToHelper::addLink($item->absoluteURL));
}
else
{
require_once (JPATH_SITE.DS.'components'.DS.'com_mailto'.DS.'helpers'.DS.'mailto.php');
$item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&link='.MailToHelper::addLink($item->absoluteURL));
}
// Twitter link (legacy code)
if ($params->get('twitterUsername'))
{
$item->twitterURL = 'http://twitter.com/intent/tweet?text='.urlencode($item->title).'&amp;url='.urlencode($item->absoluteURL).'&amp;via='.$params->get('twitterUsername');
}
else
{
$item->twitterURL = 'http://twitter.com/intent/tweet?text='.urlencode($item->title).'&amp;url='.urlencode($item->absoluteURL);
}
// Social link
$item->socialLink = urlencode($item->absoluteURL);
// Set page title
$menus = $mainframe->getMenu();
$menu = $menus->getActive();
if (is_object($menu) && isset($menu->query['view']) && $menu->query['view'] == 'item' && isset($menu->query['id']) && $menu->query['id'] == $item->id)
{
if (is_string($menu->params))
{
$menu_params = K2_JVERSION == '15' ? new JParameter($menu->params) : new JRegistry($menu->params);
}
else
{
$menu_params = $menu->params;
}
if (!$menu_params->get('page_title'))
{
$params->set('page_title', $item->cleanTitle);
}
}
else
{
$params->set('page_title', $item->cleanTitle);
}
if (K2_JVERSION != '15')
{
if ($mainframe->getCfg('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $mainframe->getCfg('sitename'), $params->get('page_title'));
$params->set('page_title', $title);
}
elseif ($mainframe->getCfg('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $params->get('page_title'), $mainframe->getCfg('sitename'));
$params->set('page_title', $title);
}
}
$document->setTitle($params->get('page_title'));
// Set pathway
$menus = $mainframe->getMenu();
$menu = $menus->getActive();
$pathway = $mainframe->getPathWay();
if ($menu)
{
if (isset($menu->query['view']) && ($menu->query['view'] != 'item' || $menu->query['id'] != $item->id))
{
if (!isset($menu->query['task']) || $menu->query['task'] != 'category' || $menu->query['id'] != $item->catid)
$pathway->addItem($item->category->name, $item->category->link);
$pathway->addItem($item->cleanTitle, '');
}
}
// Set metadata
if ($item->metadesc)
{
$document->setDescription((K2_JVERSION == '15') ? htmlspecialchars($item->metadesc, ENT_QUOTES, 'UTF-8') : $item->metadesc);
}
else
{
$metaDescItem = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $item->introtext.' '.$item->fulltext);
$metaDescItem = strip_tags($metaDescItem);
$metaDescItem = K2HelperUtilities::characterLimit($metaDescItem, $params->get('metaDescLimit', 150));
$document->setDescription(K2_JVERSION == '15' ? $metaDescItem : html_entity_decode($metaDescItem));
}
if ($item->metakey)
{
$document->setMetadata('keywords', $item->metakey);
}
else
{
if (isset($item->tags) && count($item->tags))
{
$tmp = array();
foreach ($item->tags as $tag)
{
$tmp[] = $tag->name;
}
$document->setMetadata('keywords', implode(',', $tmp));
}
}
// Menu metadata for Joomla! 2.5+ (overrides the current metadata if set)
if (K2_JVERSION != '15')
{
if ($params->get('menu-meta_description'))
{
$document->setDescription($params->get('menu-meta_description'));
}
if ($params->get('menu-meta_keywords'))
{
$document->setMetadata('keywords', $params->get('menu-meta_keywords'));
}
if ($params->get('robots'))
{
$document->setMetadata('robots', $params->get('robots'));
}
// Menu page display options
if ($params->get('page_heading'))
{
$params->set('page_title', $params->get('page_heading'));
}
$params->set('show_page_title', $params->get('show_page_heading'));
}
if ($mainframe->getCfg('MetaTitle') == '1')
{
$document->setMetadata('title', $item->cleanTitle);
}
if ($mainframe->getCfg('MetaAuthor') == '1' && isset($item->author->name))
{
$document->setMetadata('author', $item->author->name);
}
$mdata = class_exists('JParameter') ? new JParameter($item->metadata) : new JRegistry($item->metadata);
$mdata = $mdata->toArray();
foreach ($mdata as $k => $v)
{
if ($k == 'robots' || $k == 'author')
{
if ($v)
$document->setMetadata($k, $v);
}
}
// Set Facebook meta data
$document = JFactory::getDocument();
$uri = JURI::getInstance();
$document->setMetaData('og:url', $uri->toString());
$document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle());
$document->setMetaData('og:type', 'article');
$facebookImage = 'image'.$params->get('facebookImage', 'Small');
if ($item->$facebookImage)
{
$parts = parse_url($item->$facebookImage);
if (JFile::exists(JPATH_SITE.$parts['path']))
{
$image = substr(JURI::root(), 0, -1).str_replace(JURI::root(true), '', $item->$facebookImage);
$document->setMetaData('og:image', $image);
$document->setMetaData('image', $image);
}
}
$document->setMetaData('og:description', strip_tags($document->getDescription()));
// Look for template files in component folders
$this->_addPath('template', JPATH_COMPONENT.DS.'templates');
$this->_addPath('template', JPATH_COMPONENT.DS.'templates'.DS.'default');
// Look for overrides in template folder (K2 template structure)
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates');
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.'default');
// Look for overrides in template folder (Joomla! template structure)
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'default');
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2');
// Look for specific K2 theme files
if ($item->params->get('theme'))
{
$this->_addPath('template', JPATH_COMPONENT.DS.'templates'.DS.$item->params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.$item->params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.$item->params->get('theme'));
}
// Assign data
$this->assignRef('item', $item);
$this->assignRef('user', $user);
$this->assignRef('params', $item->params);
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
}

View File

@ -0,0 +1,135 @@
<?php
/**
* @version $Id: view.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;
jimport('joomla.application.component.view');
class K2ViewItem extends K2View
{
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$document = JFactory::getDocument();
if (K2_JVERSION == '15')
{
$document->setMimeEncoding('application/json');
$document->setType('json');
}
$params = K2HelperUtilities::getParams('com_k2');
$view = JRequest::getWord('view');
$task = JRequest::getWord('task');
$db = JFactory::getDBO();
$jnow = JFactory::getDate();
$now = K2_JVERSION == '15'?$jnow->toMySQL():$jnow->toSql();
$nullDate = $db->getNullDate();
// Get item
$model = $this->getModel();
$item = $model->getData();
// Does the item exists?
if (!is_object($item) || !$item->id)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
// Override some params because we want to show all elements in JSON
$itemParams = class_exists('JParameter') ? new JParameter($item->params) : new JRegistry($item->params);
$itemParams->set('itemIntroText', true);
$itemParams->set('itemFullText', true);
$itemParams->set('itemTags', true);
$itemParams->set('itemExtraFields', true);
$itemParams->set('itemAttachments', true);
$itemParams->set('itemRating', true);
$itemParams->set('itemAuthor', true);
$itemParams->set('itemImageGallery', true);
$itemParams->set('itemVideo', true);
$item->params = $itemParams->toString();
// Prepare item
$item = $model->prepareItem($item, $view, $task);
// Plugins
$item = $model->execPlugins($item, $view, $task);
// Access check
if (K2_JVERSION != '15')
{
if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($item->category->access, $user->getAuthorisedViewLevels()))
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
}
else
{
if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0))
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
}
// Published check
if (!$item->published || $item->trash)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ($item->publish_up != $nullDate && $item->publish_up > $now)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ($item->publish_down != $nullDate && $item->publish_down < $now)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if (!$item->category->published || $item->category->trash)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
// Set default image
K2HelperUtilities::setDefaultImage($item, $view);
// Build the output object
$row = $model->prepareJSONItem($item);
// Output
$response = new stdClass();
// Site
$response->site = new stdClass();
$uri = JURI::getInstance();
$response->site->url = $uri->toString(array('scheme', 'host', 'port'));
$config = JFactory::getConfig();
$response->site->name = K2_JVERSION == '30' ? $config->get('sitename') : $config->getValue('config.sitename');
$response->item = $row;
$json = json_encode($response);
$callback = JRequest::getCmd('callback');
if ($callback)
{
$document->setMimeEncoding('application/javascript');
echo $callback.'('.$json.')';
}
else
{
echo $json;
}
}
}

View File

@ -0,0 +1,289 @@
<?php
/**
* @version $Id: view.raw.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.view');
class K2ViewItem extends K2View
{
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$document = JFactory::getDocument();
$params = K2HelperUtilities::getParams('com_k2');
$limitstart = JRequest::getInt('limitstart', 0);
$view = JRequest::getWord('view');
$task = JRequest::getWord('task');
$db = JFactory::getDBO();
$jnow = JFactory::getDate();
$now = K2_JVERSION == '15'?$jnow->toMySQL():$jnow->toSql();
$nullDate = $db->getNullDate();
$this->setLayout('item');
// Add link
if (K2HelperPermissions::canAddItem())
$addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component');
$this->assignRef('addLink', $addLink);
// Get item
$model = $this->getModel();
$item = $model->getData();
$item->event = new stdClass;
// Does the item exists?
if (!is_object($item) || !$item->id)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
// Prepare item
$item = $model->prepareItem($item, $view, $task);
// Plugins
$item = $model->execPlugins($item, $view, $task);
// User K2 plugins
$item->event->K2UserDisplay = '';
if (isset($item->author) && is_object($item->author->profile) && isset($item->author->profile->id))
{
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2UserDisplay', array(&$item->author->profile, &$params, $limitstart));
$item->event->K2UserDisplay = trim(implode("\n", $results));
$item->author->profile->url = htmlspecialchars($item->author->profile->url, ENT_QUOTES, 'UTF-8');
}
// Access check
if ($this->getLayout() == 'form')
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
if (K2_JVERSION != '15')
{
if (!in_array($item->access, $user->getAuthorisedViewLevels()) || !in_array($item->category->access, $user->getAuthorisedViewLevels()))
{
if ($user->guest)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
else
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
}
else
{
if ($item->access > $user->get('aid', 0) || $item->category->access > $user->get('aid', 0))
{
if ($user->guest)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
else
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
}
// Published check
if (!$item->published || $item->trash)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ($item->publish_up != $nullDate && $item->publish_up > $now)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if ($item->publish_down != $nullDate && $item->publish_down < $now)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
if (!$item->category->published || $item->category->trash)
{
JError::raiseError(404, JText::_('K2_ITEM_NOT_FOUND'));
}
// Increase hits counter
$model->hit($item->id);
// Set default image
K2HelperUtilities::setDefaultImage($item, $view);
// Comments
$item->event->K2CommentsCounter = '';
$item->event->K2CommentsBlock = '';
if ($item->params->get('itemComments'))
{
// Trigger comments events
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CommentsCounter', array(&$item, &$params, $limitstart));
$item->event->K2CommentsCounter = trim(implode("\n", $results));
$results = $dispatcher->trigger('onK2CommentsBlock', array(&$item, &$params, $limitstart));
$item->event->K2CommentsBlock = trim(implode("\n", $results));
// Load K2 native comments system only if there are no plugins overriding it
if (empty($item->event->K2CommentsCounter) && empty($item->event->K2CommentsBlock))
{
$limit = $params->get('commentsLimit');
$comments = $model->getItemComments($item->id, $limitstart, $limit);
$pattern = "@\b(https?://)?(([0-9a-zA-Z_!~*'().&=+$%-]+:)?[0-9a-zA-Z_!~*'().&=+$%-]+\@)?(([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\@&=+$,%#-]+)*/?)@";
for ($i = 0; $i < sizeof($comments); $i++)
{
$comments[$i]->commentText = nl2br($comments[$i]->commentText);
$comments[$i]->commentText = preg_replace($pattern, '<a target="_blank" rel="nofollow" href="\0">\0</a>', $comments[$i]->commentText);
$comments[$i]->userImage = K2HelperUtilities::getAvatar($comments[$i]->userID, $comments[$i]->commentEmail, $params->get('commenterImgWidth'));
if ($comments[$i]->userID > 0)
$comments[$i]->userLink = K2HelperRoute::getUserRoute($comments[$i]->userID);
else
$comments[$i]->userLink = $comments[$i]->commentURL;
}
$item->comments = $comments;
jimport('joomla.html.pagination');
$total = $item->numOfComments;
$pagination = new JPagination($total, $limitstart, $limit);
}
}
// Author's latest items
if ($item->params->get('itemAuthorLatest') && $item->created_by_alias == '')
{
$model = $this->getModel('itemlist');
$authorLatestItems = $model->getAuthorLatest($item->id, $item->params->get('itemAuthorLatestLimit'), $item->created_by);
if (count($authorLatestItems))
{
for ($i = 0; $i < sizeof($authorLatestItems); $i++)
{
$authorLatestItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($authorLatestItems[$i]->id.':'.urlencode($authorLatestItems[$i]->alias), $authorLatestItems[$i]->catid.':'.urlencode($authorLatestItems[$i]->categoryalias))));
}
$this->assignRef('authorLatestItems', $authorLatestItems);
}
}
// Related items
if ($item->params->get('itemRelated') && isset($item->tags) && count($item->tags))
{
$model = $this->getModel('itemlist');
$relatedItems = $model->getRelatedItems($item->id, $item->tags, $item->params);
if (count($relatedItems))
{
for ($i = 0; $i < sizeof($relatedItems); $i++)
{
$relatedItems[$i]->link = urldecode(JRoute::_(K2HelperRoute::getItemRoute($relatedItems[$i]->id.':'.urlencode($relatedItems[$i]->alias), $relatedItems[$i]->catid.':'.urlencode($relatedItems[$i]->categoryalias))));
}
$this->assignRef('relatedItems', $relatedItems);
}
}
// Navigation (previous and next item)
if ($item->params->get('itemNavigation'))
{
$model = $this->getModel('item');
$nextItem = $model->getNextItem($item->id, $item->catid, $item->ordering);
if (!is_null($nextItem))
{
$item->nextLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($nextItem->id.':'.urlencode($nextItem->alias), $nextItem->catid.':'.urlencode($item->category->alias))));
$item->nextTitle = $nextItem->title;
}
$previousItem = $model->getPreviousItem($item->id, $item->catid, $item->ordering);
if (!is_null($previousItem))
{
$item->previousLink = urldecode(JRoute::_(K2HelperRoute::getItemRoute($previousItem->id.':'.urlencode($previousItem->alias), $previousItem->catid.':'.urlencode($item->category->alias))));
$item->previousTitle = $previousItem->title;
}
}
// Absolute URL
$uri = JURI::getInstance();
$item->absoluteURL = $uri->toString();
// Email link
if (K2_JVERSION != '15')
{
require_once (JPATH_SITE.'/components/com_mailto/helpers/mailto.php');
$template = $mainframe->getTemplate();
$item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&template='.$template.'&link='.MailToHelper::addLink($item->absoluteURL));
}
else
{
require_once (JPATH_SITE.DS.'components'.DS.'com_mailto'.DS.'helpers'.DS.'mailto.php');
$item->emailLink = JRoute::_('index.php?option=com_mailto&tmpl=component&link='.MailToHelper::addLink($item->absoluteURL));
}
// Twitter link (legacy code)
if ($params->get('twitterUsername'))
{
$item->twitterURL = 'http://twitter.com/intent/tweet?text='.urlencode($item->title).'&amp;url='.urlencode($item->absoluteURL).'&amp;via='.$params->get('twitterUsername');
}
else
{
$item->twitterURL = 'http://twitter.com/intent/tweet?text='.urlencode($item->title).'&amp;url='.urlencode($item->absoluteURL);
}
// Social link
$item->socialLink = urlencode($item->absoluteURL);
// Look for template files in component folders
$this->_addPath('template', JPATH_COMPONENT.DS.'templates');
$this->_addPath('template', JPATH_COMPONENT.DS.'templates'.DS.'default');
// Look for overrides in template folder (K2 template structure)
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates');
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.'default');
// Look for overrides in template folder (Joomla! template structure)
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'default');
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2');
// Look for specific K2 theme files
if ($item->params->get('theme'))
{
$this->_addPath('template', JPATH_COMPONENT.DS.'templates'.DS.$item->params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.$item->params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.$item->params->get('theme'));
}
// Assign data
$this->assignRef('item', $item);
$this->assignRef('user', $user);
$this->assignRef('params', $item->params);
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="K2_ITEM_LISTINGS">
<message>K2_CREATE_A_MENU_ITEM_LINKING_TO_A_GRID_PAGE_WITH_THE_LATEST_ITEMS_FROM_SPECIFIC_USERS_OR_CATEGORIES_IN_K2</message>
</view>
</metadata>

View File

@ -0,0 +1,13 @@
<?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;
?>

View File

@ -0,0 +1,242 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="K2_CATEGORIES">
<message>
<![CDATA[K2_DISPLAYS_A_LIST_OF_ITEMS_FROM_ONE_OR_MORE_CATEGORIES]]>
</message>
</layout>
<state>
<name>K2_CATEGORIES</name>
<description>K2_DISPLAYS_A_LIST_OF_ITEMS_FROM_ONE_OR_MORE_CATEGORIES</description>
<params addpath="/administrator/components/com_k2/elements">
<param name="" type="header" default="K2_SELECT_ONE_OR_MORE_CATEGORIES" label="" description=""/>
<param name="categories" type="category" default="" label="K2_SELECT_CATEGORIES" description="K2_IF_YOU_SELECT_MULTIPLE_CATEGORIES_YOU_CAN_ADJUST_ADDITIONAL_PARAMETERS_BELOW_IF_YOU_SELECT_ONLY_ONE_CATEGORY_THEN_K2_WILL_FETCH_THE_OPTIONS_AS_DEFINED_IN_THAT_SPECIFIC_CATEGORYS_OPTIONS_IN_K2_CATEGORIES"/>
<param name="catCatalogMode" type="list" default="0" label="K2_FETCH_ITEMS_FROM_CHILDREN_CATEGORIES" description="K2_IF_YOU_SELECT_NO_THEN_ONLY_THE_ITEMS_DIRECTLY_BELONGING_TO_THIS_CATEGORY_WILL_BE_RETRIEVED_IF_YOU_SELECT_YES_THEN_ITEMS_FROM_ALL_SUBCATEGORIES_WILL_BE_RETRIEVED_SETTING_THIS_OPTION_TO_YES_IS_IDEAL_FOR_NEWSPORTALMAGAZINEBLOG_LAYOUTS">
<option value="1">K2_NO</option>
<option value="0">K2_YES</option>
</param>
<param name="" type="header" default="K2_LAYOUT_OPTIONS_FOR_SINGLE_CATEGORY_SELECTION" label="" description=""/>
<param name="singleCatOrdering" type="list" default="" label="K2_ITEM_ORDERING" description="">
<option value="">K2_INHERIT_FROM_CATEGORY</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="" type="header" default="K2_LAYOUT_OPTIONS_FOR_MULTIPLE_CATEGORY_SELECTION" label="" description=""/>
<param name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
<param name="@spacer" type="spacer" default="" 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_THE_DIMENSIONS_FOR_EACH_IMAGE_SIZE_ARE_DEFINED_INSIDE_K2S_GLOBAL_PARAMETERS">
<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_THE_DIMENSIONS_FOR_EACH_IMAGE_SIZE_ARE_DEFINED_INSIDE_K2S_GLOBAL_PARAMETERS">
<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_THE_DIMENSIONS_FOR_EACH_IMAGE_SIZE_ARE_DEFINED_INSIDE_K2S_GLOBAL_PARAMETERS">
<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_THE_DIMENSIONS_FOR_EACH_IMAGE_SIZE_ARE_DEFINED_INSIDE_K2S_GLOBAL_PARAMETERS">
<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="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>
<param name="@spacer" type="spacer" default="" label="" description=""/>
<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>
</params>
<url>
<param name="task" type="hidden" default=""/>
<param name="id" type="hidden" default=""/>
</url>
<fields name="request">
<fieldset name="request">
<field name="task" type="hidden" default=""/>
<field name="id" type="hidden" default=""/>
</fieldset>
</fields>
<fields name="params">
<fieldset name="basic" addfieldpath="/administrator/components/com_k2/elements">
<field name="" type="header" default="K2_SELECT_ONE_OR_MORE_CATEGORIES" label="" description=""/>
<field name="categories" type="k2category" default="" label="K2_SELECT_CATEGORIES" description="K2_IF_YOU_SELECT_MULTIPLE_CATEGORIES_YOU_CAN_ADJUST_ADDITIONAL_PARAMETERS_BELOW_IF_YOU_SELECT_ONLY_ONE_CATEGORY_THEN_K2_WILL_FETCH_THE_OPTIONS_AS_DEFINED_IN_THAT_SPECIFIC_CATEGORYS_OPTIONS_IN_K2_CATEGORIES"/>
<field name="catCatalogMode" type="list" default="0" label="K2_FETCH_ITEMS_FROM_CHILDREN_CATEGORIES" description="K2_IF_YOU_SELECT_NO_THEN_ONLY_THE_ITEMS_DIRECTLY_BELONGING_TO_THIS_CATEGORY_WILL_BE_RETRIEVED_IF_YOU_SELECT_YES_THEN_ITEMS_FROM_ALL_SUBCATEGORIES_WILL_BE_RETRIEVED_SETTING_THIS_OPTION_TO_YES_IS_IDEAL_FOR_NEWSPORTALMAGAZINEBLOG_LAYOUTS">
<option value="1">K2_NO</option>
<option value="0">K2_YES</option>
</field>
<field name="" type="header" default="K2_LAYOUT_OPTIONS_FOR_SINGLE_CATEGORY_SELECTION" label="" description=""/>
<field name="singleCatOrdering" type="list" default="" label="K2_ITEM_ORDERING" description="">
<option value="">K2_INHERIT_FROM_CATEGORY</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="" type="header" default="K2_LAYOUT_OPTIONS_FOR_MULTIPLE_CATEGORY_SELECTION" label="" description=""/>
<field name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
<field name="@spacer" type="spacer" default="" 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_THE_DIMENSIONS_FOR_EACH_IMAGE_SIZE_ARE_DEFINED_INSIDE_K2S_GLOBAL_PARAMETERS">
<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_THE_DIMENSIONS_FOR_EACH_IMAGE_SIZE_ARE_DEFINED_INSIDE_K2S_GLOBAL_PARAMETERS">
<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_THE_DIMENSIONS_FOR_EACH_IMAGE_SIZE_ARE_DEFINED_INSIDE_K2S_GLOBAL_PARAMETERS">
<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_THE_DIMENSIONS_FOR_EACH_IMAGE_SIZE_ARE_DEFINED_INSIDE_K2S_GLOBAL_PARAMETERS">
<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="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>
<field name="@spacer" type="spacer" default="" label="" description=""/>
<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>
</fieldset>
</fields>
</state>
</metadata>

View File

@ -0,0 +1,13 @@
<?php
/**
* @version $Id: category_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;
?>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="Generic" hidden="true">
<message>
<![CDATA[This XML file is intentionally left blank to override the pre-v2.5 generic.xml file, which K2 used to create the 'tag' menu item. The 'tag' menu item now has its own tag.xml menu definition file.]]>
</message>
</layout>
<state></state>
</metadata>

View File

@ -0,0 +1,13 @@
<?php
/**
* @version $Id: generic_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;
?>

View File

@ -0,0 +1,13 @@
<?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;
?>

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="K2_TAG">
<message>
<![CDATA[K2_CREATE_A_MENU_ITEM_LINKING_TO_A_TAG_IN_K2]]>
</message>
</layout>
<state>
<name>K2_TAG</name>
<description>K2_CREATE_A_MENU_ITEM_LINKING_TO_A_TAG_IN_K2</description>
<params addpath="/administrator/components/com_k2/elements">
<param name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
<param name="categoriesFilter" type="category" default="" label="K2_FILTER_CATEGORIES" description=""/>
<param name="tagOrdering" type="list" default="" label="K2_ITEM_ORDERING" description="">
<option value="">K2_INHERIT_FROM_PARAMS</option>
<option value="id">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="rand">K2_RANDOM_ORDERING</option>
</param>
<param name="tagFeedLink" 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="tagFeedIcon" type="radio" default="1" label="K2_RSS_FEED_ICON" description="">
<option value="0">K2_DISABLE</option>
<option value="1">K2_ENABLE</option>
</param>
</params>
<url addpath="/administrator/components/com_k2/elements">
<param name="tag" type="k2tag" default="" label="K2_SELECT_TAG" description=""/>
<param name="task" type="hidden" default="tag"/>
</url>
<fields name="request">
<fieldset name="request" addfieldpath="/administrator/components/com_k2/elements">
<field name="tag" type="k2tag" default="" label="K2_SELECT_TAG" description=""/>
<field name="task" type="hidden" default="tag"/>
</fieldset>
</fields>
<fields name="params">
<fieldset name="basic" addfieldpath="/administrator/components/com_k2/elements">
<field name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
<field name="categoriesFilter" type="k2category" default="" label="K2_FILTER_CATEGORIES" description=""/>
<field name="tagOrdering" type="list" default="" label="K2_ITEM_ORDERING" description="">
<option value="">K2_INHERIT_FROM_PARAMS</option>
<option value="id">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="rand">K2_RANDOM_ORDERING</option>
</field>
<field name="tagFeedLink" 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="tagFeedIcon" type="radio" default="1" label="K2_RSS_FEED_ICON" description="">
<option value="0">K2_DISABLE</option>
<option value="1">K2_ENABLE</option>
</field>
</fieldset>
</fields>
</state>
</metadata>

View File

@ -0,0 +1,13 @@
<?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;
?>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="K2_USER_PAGE_BLOG">
<message>
<![CDATA[K2_CREATE_A_MENU_ITEM_LINKING_TO_A_USER_PAGE_BLOG]]>
</message>
</layout>
<state>
<name>K2_USER_PAGE_BLOG</name>
<description>K2_CREATE_A_MENU_ITEM_LINKING_TO_A_USER_PAGE_BLOG</description>
<params addPath="/administrator/components/com_k2/elements">
<param name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
<param name="userCategoriesFilter" type="categories" multiple="multiple" default="" label="K2_FILTER_CATEGORIES" description=""/>
<param name="userOrdering" 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="rand">K2_RANDOM_ORDERING</option>
</param>
<param name="userFeedLink" 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="userFeedIcon" type="radio" default="1" label="K2_RSS_FEED_ICON" description="">
<option value="0">K2_DISABLE</option>
<option value="1">K2_ENABLE</option>
</param>
</params>
<url addpath="/administrator/components/com_k2/elements">
<param name="id" type="user" default="" label="K2_SELECT_USER" description=""/>
<param name="task" type="hidden" default="user"/>
</url>
<fields name="request" addfieldpath="/administrator/components/com_k2/elements">
<fieldset name="request">
<field name="id" type="k2user" default="" label="K2_SELECT_USER" description=""/>
<field name="task" type="hidden" default="user"/>
</fieldset>
</fields>
<fields name="params" addfieldpath="/administrator/components/com_k2/elements">
<fieldset name="basic">
<field name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
<field name="userCategoriesFilter" type="categories" multiple="multiple" default="" label="K2_FILTER_CATEGORIES" description=""/>
<field name="userOrdering" 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="rand">K2_RANDOM_ORDERING</option>
</field>
<field name="userFeedLink" 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="userFeedIcon" type="radio" default="1" label="K2_RSS_FEED_ICON" description="">
<option value="0">K2_DISABLE</option>
<option value="1">K2_ENABLE</option>
</field>
</fieldset>
</fields>
</state>
</metadata>

View File

@ -0,0 +1,13 @@
<?php
/**
* @version $Id: user_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;
?>

View File

@ -0,0 +1,290 @@
<?php
/**
* @version $Id: view.feed.php 1930 2013-02-13 14:11:07Z 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;
jimport('joomla.application.component.view');
class K2ViewItemlist extends K2View
{
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$params = K2HelperUtilities::getParams('com_k2');
$document = JFactory::getDocument();
$model = $this->getModel('itemlist');
$limitstart = JRequest::getInt('limitstart');
$moduleID = JRequest::getInt('moduleID');
if ($moduleID)
{
$result = $model->getModuleItems($moduleID);
$items = $result->items;
$title = $result->title;
}
else
{
//Get data depending on task
$task = JRequest::getCmd('task');
switch ($task)
{
case 'category' :
//Get category
$id = JRequest::getInt('id');
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$category = JTable::getInstance('K2Category', 'Table');
$category->load($id);
// State check
if (!$category->published || $category->trash)
{
JError::raiseError(404, JText::_('K2_CATEGORY_NOT_FOUND'));
}
//Access check
$user = JFactory::getUser();
if (K2_JVERSION != '15')
{
if (!in_array($category->access, $user->getAuthorisedViewLevels()))
{
if ($user->guest)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
else
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
$languageFilter = $mainframe->getLanguageFilter();
$languageTag = JFactory::getLanguage()->getTag();
if ($languageFilter && $category->language != $languageTag && $category->language != '*')
{
return;
}
}
else
{
if ($category->access > $user->get('aid', 0))
{
if ($user->guest)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
else
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
}
//Merge params
$cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params);
if ($cparams->get('inheritFrom'))
{
$masterCategory = JTable::getInstance('K2Category', 'Table');
$masterCategory->load($cparams->get('inheritFrom'));
$cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params);
}
$params->merge($cparams);
//Category link
$category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias))));
//Set featured flag
JRequest::setVar('featured', $params->get('catFeaturedItems'));
//Set title
$title = $category->name;
// Set ordering
if ($params->get('singleCatOrdering'))
{
$ordering = $params->get('singleCatOrdering');
}
else
{
$ordering = $params->get('catOrdering');
}
break;
case 'user' :
//Get user
$id = JRequest::getInt('id');
$userObject = JFactory::getUser($id);
//Check user status
if ($userObject->block)
{
JError::raiseError(404, JText::_('K2_USER_NOT_FOUND'));
}
//Set title
$title = $userObject->name;
// Set ordering
$ordering = $params->get('userOrdering');
break;
case 'tag' :
//set title
$title = JText::_('K2_DISPLAYING_ITEMS_BY_TAG').' '.JRequest::getVar('tag');
// Set ordering
$ordering = $params->get('tagOrdering');
break;
case 'search' :
//Set title
$title = JText::_('K2_SEARCH_RESULTS_FOR').' '.JRequest::getVar('searchword');
break;
case 'date' :
// Set title
if (JRequest::getInt('day'))
{
$date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month').'-'.JRequest::getInt('day'));
$dateFormat = (K2_JVERSION == '15') ? '%A, %d %B %Y' : 'l, d F Y';
$title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat);
}
else
{
$date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month'));
$dateFormat = (K2_JVERSION == '15') ? '%B %Y' : 'F Y';
$title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat);
}
// Set ordering
$ordering = 'rdate';
break;
default :
//Set featured flag
JRequest::setVar('featured', $params->get('catFeaturedItems'));
//Set title
$title = $params->get('page_title');
// Set ordering
$ordering = $params->get('catOrdering');
break;
}
// Various Feed Validations
$title = JFilterOutput::ampReplace($title);
// Get items
if (!isset($ordering))
{
$items = $model->getData();
}
else
{
$items = $model->getData($ordering);
}
}
// Prepare feed items
$model = &$this->getModel('item');
foreach ($items as $item)
{
$item = $model->prepareFeedItem($item);
$item->title = $this->escape($item->title);
$item->title = html_entity_decode($item->title);
$feedItem = new JFeedItem();
$feedItem->title = $item->title;
$feedItem->link = $item->link;
$feedItem->description = $item->description;
$feedItem->date = $item->created;
$feedItem->category = $item->category->name;
$feedItem->author = $item->author->name;
if ($params->get('feedBogusEmail'))
{
$feedItem->authorEmail = $params->get('feedBogusEmail');
}
else
{
if ($mainframe->getCfg('feed_email') == 'author')
{
$feedItem->authorEmail = $item->author->email;
}
else
{
$feedItem->authorEmail = $mainframe->getCfg('mailfrom');
}
}
// Add item
$document->addItem($feedItem);
}
// Set title
$document = JFactory::getDocument();
$menus = JSite::getMenu();
$menu = $menus->getActive();
if (is_object($menu))
{
$menu_params = class_exists('JParameter') ? new JParameter($menu->params) : new JRegistry($menu->params);
if (!$menu_params->get('page_title'))
$params->set('page_title', $title);
}
else
{
$params->set('page_title', $title);
}
if (K2_JVERSION != '15')
{
if ($mainframe->getCfg('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $mainframe->getCfg('sitename'), $params->get('page_title'));
$params->set('page_title', $title);
}
elseif ($mainframe->getCfg('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $params->get('page_title'), $mainframe->getCfg('sitename'));
$params->set('page_title', $title);
}
}
$document->setTitle($params->get('page_title'));
// Prevent spammers from using the tag view
if ($task == 'tag' && !count($items))
{
$tag = JRequest::getString('tag');
$db = JFactory::getDBO();
$db->setQuery('SELECT id FROM #__k2_tags WHERE name = '.$db->quote($tag));
$tagID = $db->loadResult();
if (!$tagID)
{
JError::raiseError(404, JText::_('K2_NOT_FOUND'));
return false;
}
}
}
}

View File

@ -0,0 +1,744 @@
<?php
/**
* @version $Id: view.html.php 1990 2013-07-04 14:31: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 ;
jimport('joomla.application.component.view');
class K2ViewItemlist extends K2View
{
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$params = K2HelperUtilities::getParams('com_k2');
$model = $this->getModel('itemlist');
$limitstart = JRequest::getInt('limitstart');
$view = JRequest::getWord('view');
$task = JRequest::getWord('task');
$db = JFactory::getDBO();
// Add link
if (K2HelperPermissions::canAddItem())
$addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component');
$this->assignRef('addLink', $addLink);
// Get data depending on task
switch ($task)
{
case 'category' :
// Get category
$id = JRequest::getInt('id');
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$category = JTable::getInstance('K2Category', 'Table');
$category->load($id);
$category->event = new stdClass;
// State check
if (!$category->published || $category->trash)
{
JError::raiseError(404, JText::_('K2_CATEGORY_NOT_FOUND'));
}
// Access check
$user = JFactory::getUser();
if (K2_JVERSION != '15')
{
if (!in_array($category->access, $user->getAuthorisedViewLevels()))
{
if ($user->guest)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_users&view=login&return='.base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
else
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
$languageFilter = $mainframe->getLanguageFilter();
$languageTag = JFactory::getLanguage()->getTag();
if ($languageFilter && $category->language != $languageTag && $category->language != '*')
{
return;
}
}
else
{
if ($category->access > $user->get('aid', 0))
{
if ($user->guest)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
else
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
}
// Hide the add new item link if user cannot post in the specific category
if (!K2HelperPermissions::canAddItem($id))
{
unset($this->addLink);
}
// Merge params
$cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params);
// Get the meta information before merging params since we do not want them to be inherited
$category->metaDescription = $cparams->get('catMetaDesc');
$category->metaKeywords = $cparams->get('catMetaKey');
$category->metaRobots = $cparams->get('catMetaRobots');
$category->metaAuthor = $cparams->get('catMetaAuthor');
if ($cparams->get('inheritFrom'))
{
$masterCategory = JTable::getInstance('K2Category', 'Table');
$masterCategory->load($cparams->get('inheritFrom'));
$cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params);
}
$params->merge($cparams);
// Category link
$category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias))));
// Category image
$category->image = K2HelperUtilities::getCategoryImage($category->image, $params);
// Category plugins
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$category->text = $category->description;
if (K2_JVERSION != '15')
{
$dispatcher->trigger('onContentPrepare', array(
'com_k2.category',
&$category,
&$params,
$limitstart
));
}
else
{
$dispatcher->trigger('onPrepareContent', array(
&$category,
&$params,
$limitstart
));
}
$category->description = $category->text;
// Category K2 plugins
$category->event->K2CategoryDisplay = '';
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CategoryDisplay', array(
&$category,
&$params,
$limitstart
));
$category->event->K2CategoryDisplay = trim(implode("\n", $results));
$category->text = $category->description;
$dispatcher->trigger('onK2PrepareContent', array(
&$category,
&$params,
$limitstart
));
$category->description = $category->text;
$this->assignRef('category', $category);
$this->assignRef('user', $user);
// Category children
$ordering = $params->get('subCatOrdering');
$children = $model->getCategoryFirstChildren($id, $ordering);
if (count($children))
{
foreach ($children as $child)
{
if ($params->get('subCatTitleItemCounter'))
{
$child->numOfItems = $model->countCategoryItems($child->id);
}
$child->image = K2HelperUtilities::getCategoryImage($child->image, $params);
$child->name = htmlspecialchars($child->name, ENT_QUOTES);
$child->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($child->id.':'.urlencode($child->alias))));
$subCategories[] = $child;
}
$this->assignRef('subCategories', $subCategories);
}
// Set limit
$limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links');
// Set featured flag
JRequest::setVar('featured', $params->get('catFeaturedItems'));
// Set layout
$this->setLayout('category');
// Set title
$title = $category->name;
$category->name = htmlspecialchars($category->name, ENT_QUOTES);
// Set ordering
if ($params->get('singleCatOrdering'))
{
$ordering = $params->get('singleCatOrdering');
}
else
{
$ordering = $params->get('catOrdering');
}
$addHeadFeedLink = $params->get('catFeedLink');
break;
case 'user' :
// Get user
$id = JRequest::getInt('id');
$userObject = JFactory::getUser($id);
$userObject->event = new stdClass;
// Check user status
if ($userObject->block)
{
JError::raiseError(404, JText::_('K2_USER_NOT_FOUND'));
}
// Get K2 user profile
$userObject->profile = $model->getUserProfile();
// User image
$userObject->avatar = K2HelperUtilities::getAvatar($userObject->id, $userObject->email, $params->get('userImageWidth'));
// User K2 plugins
$userObject->event->K2UserDisplay = '';
if (is_object($userObject->profile) && $userObject->profile->id > 0)
{
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2UserDisplay', array(
&$userObject->profile,
&$params,
$limitstart
));
$userObject->event->K2UserDisplay = trim(implode("\n", $results));
$userObject->profile->url = htmlspecialchars($userObject->profile->url, ENT_QUOTES, 'UTF-8');
}
$this->assignRef('user', $userObject);
$date = JFactory::getDate();
$now = K2_JVERSION == '15' ? $date->toMySQL() : $date->toSql();
$this->assignRef('now', $now);
// Set layout
$this->setLayout('user');
// Set limit
$limit = $params->get('userItemCount');
// Set title
$title = $userObject->name;
$userObject->name = htmlspecialchars($userObject->name, ENT_QUOTES);
// Set ordering
$ordering = $params->get('userOrdering');
$addHeadFeedLink = $params->get('userFeedLink', 1);
break;
case 'tag' :
// Set layout
$this->setLayout('tag');
// Set limit
$limit = $params->get('tagItemCount');
// Set title
$title = JText::_('K2_DISPLAYING_ITEMS_BY_TAG').' '.JRequest::getVar('tag');
// Set ordering
$ordering = $params->get('tagOrdering');
$addHeadFeedLink = $params->get('tagFeedLink', 1);
break;
case 'search' :
// Set layout
$this->setLayout('generic');
// Set limit
$limit = $params->get('genericItemCount');
// Set title
$title = JText::_('K2_SEARCH_RESULTS_FOR').' '.JRequest::getVar('searchword');
$addHeadFeedLink = $params->get('genericFeedLink', 1);
break;
case 'date' :
// Set layout
$this->setLayout('generic');
// Set limit
$limit = $params->get('genericItemCount');
// Fix wrong timezone
if (function_exists('date_default_timezone_get'))
{
$originalTimezone = date_default_timezone_get();
}
if (function_exists('date_default_timezone_set'))
{
date_default_timezone_set('UTC');
}
// Set title
if (JRequest::getInt('day'))
{
$date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month').'-'.JRequest::getInt('day'));
$dateFormat = (K2_JVERSION == '15') ? '%A, %d %B %Y' : 'l, d F Y';
$title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat);
}
else
{
$date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month'));
$dateFormat = (K2_JVERSION == '15') ? '%B %Y' : 'F Y';
$title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat);
}
// Restore the original timezone
if (function_exists('date_default_timezone_set') && isset($originalTimezone))
{
date_default_timezone_set($originalTimezone);
}
// Set ordering
$ordering = 'rdate';
$addHeadFeedLink = $params->get('genericFeedLink', 1);
break;
default :
// Set layout
$this->setLayout('category');
$user = JFactory::getUser();
$this->assignRef('user', $user);
// Set limit
$limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links');
// Set featured flag
JRequest::setVar('featured', $params->get('catFeaturedItems'));
// Set title
$title = $params->get('page_title');
// Set ordering
$ordering = $params->get('catOrdering');
$addHeadFeedLink = $params->get('catFeedLink', 1);
break;
}
// Set limit for model
if (!$limit)
$limit = 10;
JRequest::setVar('limit', $limit);
// Get items
if (!isset($ordering))
{
$items = $model->getData();
}
else
{
$items = $model->getData($ordering);
}
// Pagination
jimport('joomla.html.pagination');
$total = count($items) ? $model->getTotal() : 0;
$pagination = new JPagination($total, $limitstart, $limit);
//Prepare items
$user = JFactory::getUser();
$cache = JFactory::getCache('com_k2_extended');
$model = $this->getModel('item');
for ($i = 0; $i < sizeof($items); $i++)
{
// Ensure that all items have a group. If an item with no group is found then assign to it the leading group
$items[$i]->itemGroup = 'leading';
//Item group
if ($task == "category" || $task == "")
{
if ($i < ($params->get('num_links') + $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items')))
$items[$i]->itemGroup = 'links';
if ($i < ($params->get('num_secondary_items') + $params->get('num_leading_items') + $params->get('num_primary_items')))
$items[$i]->itemGroup = 'secondary';
if ($i < ($params->get('num_primary_items') + $params->get('num_leading_items')))
$items[$i]->itemGroup = 'primary';
if ($i < $params->get('num_leading_items'))
$items[$i]->itemGroup = 'leading';
}
// Check if the model should use the cache for preparing the item even if the user is logged in
if ($user->guest || $task == 'tag' || $task == 'search' || $task == 'date')
{
$cacheFlag = true;
}
else
{
$cacheFlag = true;
if (K2HelperPermissions::canEditItem($items[$i]->created_by, $items[$i]->catid))
{
$cacheFlag = false;
}
}
// Prepare item
if ($cacheFlag)
{
$hits = $items[$i]->hits;
$items[$i]->hits = 0;
JTable::getInstance('K2Category', 'Table');
$items[$i] = $cache->call(array(
$model,
'prepareItem'
), $items[$i], $view, $task);
$items[$i]->hits = $hits;
}
else
{
$items[$i] = $model->prepareItem($items[$i], $view, $task);
}
// Plugins
$items[$i] = $model->execPlugins($items[$i], $view, $task);
// Trigger comments counter event
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CommentsCounter', array(
&$items[$i],
&$params,
$limitstart
));
$items[$i]->event->K2CommentsCounter = trim(implode("\n", $results));
}
// Set title
$document = JFactory::getDocument();
$application = JFactory::getApplication();
$menus = $application->getMenu();
$menu = $menus->getActive();
if (is_object($menu))
{
if (is_string($menu->params))
{
$menu_params = K2_JVERSION == '15' ? new JParameter($menu->params) : new JRegistry($menu->params);
}
else
{
$menu_params = $menu->params;
}
if (!$menu_params->get('page_title'))
{
$params->set('page_title', $title);
}
}
else
{
$params->set('page_title', $title);
}
// We're adding a new variable here which won't get the appended/prepended site title,
// when enabled via Joomla!'s SEO/SEF settings
$params->set('page_title_clean', $title);
if (K2_JVERSION != '15')
{
if ($mainframe->getCfg('sitename_pagetitles', 0) == 1)
{
$tmpTitle = JText::sprintf('JPAGETITLE', $mainframe->getCfg('sitename'), $params->get('page_title'));
$params->set('page_title', $tmpTitle);
}
elseif ($mainframe->getCfg('sitename_pagetitles', 0) == 2)
{
$tmpTitle = JText::sprintf('JPAGETITLE', $params->get('page_title'), $mainframe->getCfg('sitename'));
$params->set('page_title', $tmpTitle);
}
}
$document->setTitle($params->get('page_title'));
// Search - Update the Google Search results container (K2 v2.6.7+)
if ($task == 'search')
{
$googleSearchContainerID = trim($params->get('googleSearchContainer', 'k2GoogleSearchContainer'));
if ($googleSearchContainerID == 'k2Container')
{
$googleSearchContainerID = 'k2GoogleSearchContainer';
}
$params->set('googleSearchContainer', $googleSearchContainerID);
}
// Set metadata for category
if ($task == 'category')
{
if ($category->metaDescription)
{
$document->setDescription($category->metaDescription);
}
else
{
$metaDescItem = preg_replace("#{(.*?)}(.*?){/(.*?)}#s", '', $this->category->description);
$metaDescItem = strip_tags($metaDescItem);
$metaDescItem = K2HelperUtilities::characterLimit($metaDescItem, $params->get('metaDescLimit', 150));
if (K2_JVERSION != '15')
{
$metaDescItem = html_entity_decode($metaDescItem);
}
$document->setDescription($metaDescItem);
}
if ($category->metaKeywords)
{
$document->setMetadata('keywords', $category->metaKeywords);
}
if ($category->metaRobots)
{
$document->setMetadata('robots', $category->metaRobots);
}
if ($category->metaAuthor)
{
$document->setMetadata('author', $category->metaAuthor);
}
}
if (K2_JVERSION != '15')
{
// Menu metadata options
if ($params->get('menu-meta_description'))
{
$document->setDescription($params->get('menu-meta_description'));
}
if ($params->get('menu-meta_keywords'))
{
$document->setMetadata('keywords', $params->get('menu-meta_keywords'));
}
if ($params->get('robots'))
{
$document->setMetadata('robots', $params->get('robots'));
}
// Menu page display options
if ($params->get('page_heading'))
{
$params->set('page_title', $params->get('page_heading'));
}
$params->set('show_page_title', $params->get('show_page_heading'));
}
// Pathway
$pathway = $mainframe->getPathWay();
if (!isset($menu->query['task']))
$menu->query['task'] = '';
if ($menu)
{
switch ($task)
{
case 'category' :
if ($menu->query['task'] != 'category' || $menu->query['id'] != JRequest::getInt('id'))
$pathway->addItem($title, '');
break;
case 'user' :
if ($menu->query['task'] != 'user' || $menu->query['id'] != JRequest::getInt('id'))
$pathway->addItem($title, '');
break;
case 'tag' :
if ($menu->query['task'] != 'tag' || $menu->query['tag'] != JRequest::getVar('tag'))
$pathway->addItem($title, '');
break;
case 'search' :
case 'date' :
$pathway->addItem($title, '');
break;
}
}
// Feed link
$config = JFactory::getConfig();
$menu = $application->getMenu();
$default = $menu->getDefault();
$active = $menu->getActive();
if ($task == 'tag')
{
$link = K2HelperRoute::getTagRoute(JRequest::getVar('tag'));
}
else
{
$link = '';
}
$sef = K2_JVERSION == '30' ? $config->get('sef') : $config->getValue('config.sef');
if (!is_null($active) && $active->id == $default->id && $sef)
{
$link .= '&Itemid='.$active->id.'&format=feed&limitstart=';
}
else
{
$link .= '&format=feed&limitstart=';
}
$feed = JRoute::_($link);
$this->assignRef('feed', $feed);
// Add head feed link
if ($addHeadFeedLink)
{
$attribs = array(
'type' => 'application/rss+xml',
'title' => 'RSS 2.0'
);
$document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs);
$attribs = array(
'type' => 'application/atom+xml',
'title' => 'Atom 1.0'
);
$document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs);
}
// Assign data
if ($task == "category" || $task == "")
{
// Leading items
$offset = 0;
$length = $params->get('num_leading_items');
$leading = array_slice($items, $offset, $length);
// Primary
$offset = (int)$params->get('num_leading_items');
$length = (int)$params->get('num_primary_items');
$primary = array_slice($items, $offset, $length);
// Secondary
$offset = (int)($params->get('num_leading_items') + $params->get('num_primary_items'));
$length = (int)$params->get('num_secondary_items');
$secondary = array_slice($items, $offset, $length);
// Links
$offset = (int)($params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items'));
$length = (int)$params->get('num_links');
$links = array_slice($items, $offset, $length);
// Assign data
$this->assignRef('leading', $leading);
$this->assignRef('primary', $primary);
$this->assignRef('secondary', $secondary);
$this->assignRef('links', $links);
}
else
{
$this->assignRef('items', $items);
}
// Set default values to avoid division by zero
if ($params->get('num_leading_columns') == 0)
$params->set('num_leading_columns', 1);
if ($params->get('num_primary_columns') == 0)
$params->set('num_primary_columns', 1);
if ($params->get('num_secondary_columns') == 0)
$params->set('num_secondary_columns', 1);
if ($params->get('num_links_columns') == 0)
$params->set('num_links_columns', 1);
$this->assignRef('params', $params);
$this->assignRef('pagination', $pagination);
// Set Facebook meta data
$document = JFactory::getDocument();
$uri = JURI::getInstance();
$document->setMetaData('og:url', $uri->toString());
$document->setMetaData('og:title', (K2_JVERSION == '15') ? htmlspecialchars($document->getTitle(), ENT_QUOTES, 'UTF-8') : $document->getTitle());
$document->setMetaData('og:type', 'website');
if ($task == 'category' && $this->category->image && strpos($this->category->image, 'placeholder/category.png') === false)
{
$image = substr(JURI::root(), 0, -1).str_replace(JURI::root(true), '', $this->category->image);
$document->setMetaData('og:image', $image);
$document->setMetaData('image', $image);
}
$document->setMetaData('og:description', strip_tags($document->getDescription()));
// Look for template files in component folders
$this->_addPath('template', JPATH_COMPONENT.DS.'templates');
$this->_addPath('template', JPATH_COMPONENT.DS.'templates'.DS.'default');
// Look for overrides in template folder (K2 template structure)
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates');
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.'default');
// Look for overrides in template folder (Joomla! template structure)
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'default');
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2');
// Look for specific K2 theme files
if ($params->get('theme'))
{
$this->_addPath('template', JPATH_COMPONENT.DS.'templates'.DS.$params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.$params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.$params->get('theme'));
}
$nullDate = $db->getNullDate();
$this->assignRef('nullDate', $nullDate);
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$dispatcher->trigger('onK2BeforeViewDisplay');
// Prevent spammers from using the tag view
if ($task == 'tag' && !count($this->items))
{
$tag = JRequest::getString('tag');
$db = JFactory::getDBO();
$db->setQuery('SELECT id FROM #__k2_tags WHERE name = '.$db->quote($tag));
$tagID = $db->loadResult();
if (!$tagID)
{
JError::raiseError(404, JText::_('K2_NOT_FOUND'));
return false;
}
}
parent::display($tpl);
}
}

View File

@ -0,0 +1,473 @@
<?php
/**
* @version $Id: view.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 ;
jimport('joomla.application.component.view');
class K2ViewItemlist extends K2View
{
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$params = K2HelperUtilities::getParams('com_k2');
$document = JFactory::getDocument();
if (K2_JVERSION == '15')
{
$document->setMimeEncoding('application/json');
$document->setType('json');
}
$model = $this->getModel('itemlist');
//Set limit for model
$limit = JRequest::getInt('limit');
if ($limit > 100 || $limit == 0)
{
$limit = 100;
JRequest::setVar('limit', $limit);
}
$page = JRequest::getInt('page');
if ($page <= 0)
{
$limitstart = 0;
}
else
{
$page--;
$limitstart = $page * $limit;
}
JRequest::setVar('limitstart', $limitstart);
$view = JRequest::getWord('view');
$task = JRequest::getWord('task');
$response = new JObject();
unset($response->_errors);
// Site
$response->site = new stdClass();
$uri = JURI::getInstance();
$response->site->url = $uri->toString(array('scheme', 'host', 'port'));
$config = JFactory::getConfig();
$response->site->name = K2_JVERSION == '30' ? $config->get('sitename') : $config->getValue('config.sitename');
$moduleID = JRequest::getInt('moduleID');
if ($moduleID)
{
$result = $model->getModuleItems($moduleID);
$items = $result->items;
$title = $result->title;
$prefix = 'cat';
}
else
{
//Get data depending on task
switch ($task)
{
case 'category' :
//Get category
$id = JRequest::getInt('id');
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$category = JTable::getInstance('K2Category', 'Table');
$category->load($id);
// State Check
if (!$category->published || $category->trash)
{
JError::raiseError(404, JText::_('K2_CATEGORY_NOT_FOUND'));
}
//Access check
$user = JFactory::getUser();
if (K2_JVERSION != '15')
{
if (!in_array($category->access, $user->getAuthorisedViewLevels()))
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
$languageFilter = $mainframe->getLanguageFilter();
$languageTag = JFactory::getLanguage()->getTag();
if ($languageFilter && $category->language != $languageTag && $category->language != '*')
{
return;
}
}
else
{
if ($category->access > $user->get('aid', 0))
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
}
}
//Merge params
$cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params);
if ($cparams->get('inheritFrom'))
{
$masterCategory = JTable::getInstance('K2Category', 'Table');
$masterCategory->load($cparams->get('inheritFrom'));
$cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params);
}
$params->merge($cparams);
//Category link
$category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias))));
//Category image
$category->image = K2HelperUtilities::getCategoryImage($category->image, $params);
//Category plugins
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$category->text = $category->description;
if (K2_JVERSION != '15')
{
$dispatcher->trigger('onContentPrepare', array('com_k2.category', &$category, &$params, $limitstart));
}
else
{
$dispatcher->trigger('onPrepareContent', array(&$category, &$params, $limitstart));
}
$category->description = $category->text;
//Category K2 plugins
$category->event->K2CategoryDisplay = '';
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CategoryDisplay', array(&$category, &$params, $limitstart));
$category->event->K2CategoryDisplay = trim(implode("\n", $results));
$category->text = $category->description;
$dispatcher->trigger('onK2PrepareContent', array(&$category, &$params, $limitstart));
$category->description = $category->text;
//Category children
$ordering = $params->get('subCatOrdering');
$children = $model->getCategoryFirstChildren($id, $ordering);
$subCategories = array();
if (count($children))
{
foreach ($children as $child)
{
if ($params->get('subCatTitleItemCounter'))
{
$child->numOfItems = $model->countCategoryItems($child->id);
}
$child->image = K2HelperUtilities::getCategoryImage($child->image, $params);
$child->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($child->id.':'.urlencode($child->alias))));
unset($child->params);
unset($child->access);
unset($child->published);
unset($child->trash);
unset($child->language);
$subCategories[] = $child;
}
}
//Set featured flag
JRequest::setVar('featured', $params->get('catFeaturedItems'));
//Set title
$title = $category->name;
// Set ordering
if ($params->get('singleCatOrdering'))
{
$ordering = $params->get('singleCatOrdering');
}
else
{
$ordering = $params->get('catOrdering');
}
// Set parameters prefix
$prefix = 'cat';
// Prepare the JSON category object;
$row = new JObject();
unset($row->_errors);
$row->id = $category->id;
$row->name = $category->name;
$row->alias = $category->alias;
$row->link = $category->link;
$row->parent = $category->parent;
$row->extraFieldsGroup = $category->extraFieldsGroup;
$row->image = $category->image;
$row->ordering = $category->ordering;
//$row->plugins = $category->plugins;
$row->events = $category->event;
$row->chidlren = $subCategories;
$response->category = $row;
break;
case 'user' :
//Get user
$id = JRequest::getInt('id');
$userObject = JFactory::getUser($id);
//Check user status
if ($userObject->block)
{
JError::raiseError(404, JText::_('K2_USER_NOT_FOUND'));
}
//Get K2 user profile
$userObject->profile = $model->getUserProfile();
//User image
$userObject->avatar = K2HelperUtilities::getAvatar($userObject->id, $userObject->email, $params->get('userImageWidth'));
//User K2 plugins
$userObject->event->K2UserDisplay = '';
if (is_object($userObject->profile) && $userObject->profile->id > 0)
{
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2UserDisplay', array(&$userObject->profile, &$params, $limitstart));
$userObject->event->K2UserDisplay = trim(implode("\n", $results));
$userObject->profile->url = htmlspecialchars($userObject->profile->url, ENT_QUOTES, 'UTF-8');
}
//Set title
$title = $userObject->name;
// Set ordering
$ordering = $params->get('userOrdering');
// Set parameters prefix
$prefix = 'user';
// Prepare the JSON user object;
$row = new JObject();
unset($row->_errors);
//$row->id = $userObject->id;
$row->name = $userObject->name;
//$row->username = $userObject->username;
if (isset($userObject->profile->plugins))
{
unset($userObject->profile->plugins);
}
$row->profile = $userObject->profile;
$row->avatar = $userObject->avatar;
$row->events = $userObject->event;
$response->user = $row;
break;
case 'tag' :
//Set limit
$limit = $params->get('tagItemCount');
//set title
$title = JText::_('K2_DISPLAYING_ITEMS_BY_TAG').' '.JRequest::getVar('tag');
// Set ordering
$ordering = $params->get('tagOrdering');
// Set parameters prefix
$prefix = 'tag';
$response->tag = JRequest::getVar('tag');
break;
case 'search' :
//Set title
$title = JText::_('K2_SEARCH_RESULTS_FOR').' '.JRequest::getVar('searchword');
// Set parameters prefix
$prefix = 'generic';
$response->search = JRequest::getVar('searchword');
break;
case 'date' :
// Set title
if (JRequest::getInt('day'))
{
$date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month').'-'.JRequest::getInt('day'));
$dateFormat = (K2_JVERSION == '15') ? '%A, %d %B %Y' : 'l, d F Y';
$title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat);
}
else
{
$date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month'));
$dateFormat = (K2_JVERSION == '15') ? '%B %Y' : 'F Y';
$title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat);
}
// Set ordering
$ordering = 'rdate';
// Set parameters prefix
$prefix = 'generic';
$response->date = JHTML::_('date', $date, $dateFormat);
break;
default :
$user = JFactory::getUser();
//Set limit
$limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links');
//Set featured flag
JRequest::setVar('featured', $params->get('catFeaturedItems'));
//Set title
$title = $params->get('page_title');
// Set ordering
$ordering = $params->get('catOrdering');
// Set parameters prefix
$prefix = 'cat';
break;
}
if (!isset($ordering))
{
$items = $model->getData();
}
else
{
$items = $model->getData($ordering);
}
}
//Prepare items
$user = JFactory::getUser();
$cache = JFactory::getCache('com_k2_extended');
$model = $this->getModel('item');
$rows = array();
for ($i = 0; $i < sizeof($items); $i++)
{
//Item group
if ($task == "category" || $task == "")
{
$items[$i]->itemGroup = 'links';
if ($i < ($params->get('num_links') + $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items')))
$items[$i]->itemGroup = 'links';
if ($i < ($params->get('num_secondary_items') + $params->get('num_leading_items') + $params->get('num_primary_items')))
$items[$i]->itemGroup = 'secondary';
if ($i < ($params->get('num_primary_items') + $params->get('num_leading_items')))
$items[$i]->itemGroup = 'primary';
if ($i < $params->get('num_leading_items'))
$items[$i]->itemGroup = 'leading';
}
else
{
$items[$i]->itemGroup = '';
}
$itemParams = class_exists('JParameter') ? new JParameter($items[$i]->params) : new JRegistry($items[$i]->params);
$itemParams->set($prefix.'ItemIntroText', true);
$itemParams->set($prefix.'ItemFullText', true);
$itemParams->set($prefix.'ItemTags', true);
$itemParams->set($prefix.'ItemExtraFields', true);
$itemParams->set($prefix.'ItemAttachments', true);
$itemParams->set($prefix.'ItemRating', true);
$itemParams->set($prefix.'ItemAuthor', true);
$itemParams->set($prefix.'ItemImageGallery', true);
$itemParams->set($prefix.'ItemVideo', true);
$itemParams->set($prefix.'ItemImage', true);
$items[$i]->params = $itemParams->toString();
//Check if model should use cache for preparing item even if user is logged in
if ($user->guest || $task == 'tag' || $task == 'search' || $task == 'date')
{
$cacheFlag = true;
}
else
{
$cacheFlag = true;
if (K2HelperPermissions::canEditItem($items[$i]->created_by, $items[$i]->catid))
{
$cacheFlag = false;
}
}
//Prepare item
if ($cacheFlag)
{
$hits = $items[$i]->hits;
$items[$i]->hits = 0;
JTable::getInstance('K2Category', 'Table');
$items[$i] = $cache->call(array($model, 'prepareItem'), $items[$i], $view, $task);
$items[$i]->hits = $hits;
}
else
{
$items[$i] = $model->prepareItem($items[$i], $view, $task);
}
//Plugins
$items[$i] = $model->execPlugins($items[$i], $view, $task);
//Trigger comments counter event
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CommentsCounter', array(&$items[$i], &$params, $limitstart));
$items[$i]->event->K2CommentsCounter = trim(implode("\n", $results));
// Set default image
if ($task == 'user' || $task == 'tag' || $task == 'search' || $task == 'date')
{
$items[$i]->image = (isset($items[$i]->imageGeneric)) ? $items[$i]->imageGeneric : '';
}
else
{
if (!$moduleID)
{
K2HelperUtilities::setDefaultImage($items[$i], $view, $params);
}
}
$rows[] = $model->prepareJSONItem($items[$i]);
}
$response->items = $rows;
// Prevent spammers from using the tag view
if ($task == 'tag' && !count($response->items))
{
$tag = JRequest::getString('tag');
$db = JFactory::getDBO();
$db->setQuery('SELECT id FROM #__k2_tags WHERE name = '.$db->quote($tag));
$tagID = $db->loadResult();
if (!$tagID)
{
JError::raiseError(404, JText::_('K2_NOT_FOUND'));
return false;
}
}
// Output
$json = json_encode($response);
$callback = JRequest::getCmd('callback');
if ($callback)
{
$document->setMimeEncoding('application/javascript');
echo $callback.'('.$json.')';
}
else
{
echo $json;
}
}
}

View File

@ -0,0 +1,506 @@
<?php
/**
* @version $Id: view.raw.php 1827 2013-01-25 12:01:41Z 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 K2ViewItemlist extends K2View
{
function display($tpl = null)
{
$mainframe = JFactory::getApplication();
$params = K2HelperUtilities::getParams('com_k2');
$model = $this->getModel('itemlist');
$limitstart = JRequest::getInt('limitstart');
$view = JRequest::getWord('view');
$task = JRequest::getWord('task');
//Add link
if (K2HelperPermissions::canAddItem())
$addLink = JRoute::_('index.php?option=com_k2&view=item&task=add&tmpl=component');
$this->assignRef('addLink', $addLink);
//Get data depending on task
switch ($task)
{
case 'category' :
//Get category
$id = JRequest::getInt('id');
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
$category = JTable::getInstance('K2Category', 'Table');
$category->load($id);
// State Check
if (!$category->published || $category->trash)
{
JError::raiseError(404, JText::_('K2_CATEGORY_NOT_FOUND'));
}
//Access check
$user = JFactory::getUser();
if (K2_JVERSION != '15')
{
if (!in_array($category->access, $user->getAuthorisedViewLevels()))
{
if ($user->guest)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
else
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
$languageFilter = $mainframe->getLanguageFilter();
$languageTag = JFactory::getLanguage()->getTag();
if ($languageFilter && $category->language != $languageTag && $category->language != '*')
{
return;
}
}
else
{
if ($category->access > $user->get('aid', 0))
{
if ($user->guest)
{
$uri = JFactory::getURI();
$url = 'index.php?option=com_user&view=login&return='.base64_encode($uri->toString());
$mainframe->redirect(JRoute::_($url, false), JText::_('K2_YOU_NEED_TO_LOGIN_FIRST'));
}
else
{
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));
return;
}
}
}
// Hide the add new item link if user cannot post in the specific category
if (!K2HelperPermissions::canAddItem($id))
{
unset($this->addLink);
}
//Merge params
$cparams = class_exists('JParameter') ? new JParameter($category->params) : new JRegistry($category->params);
if ($cparams->get('inheritFrom'))
{
$masterCategory = JTable::getInstance('K2Category', 'Table');
$masterCategory->load($cparams->get('inheritFrom'));
$cparams = class_exists('JParameter') ? new JParameter($masterCategory->params) : new JRegistry($masterCategory->params);
}
$params->merge($cparams);
//Category link
$category->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($category->id.':'.urlencode($category->alias))));
//Category image
$category->image = K2HelperUtilities::getCategoryImage($category->image, $params);
//Category plugins
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$category->text = $category->description;
if (K2_JVERSION != '15')
{
$dispatcher->trigger('onContentPrepare', array('com_k2.category', &$category, &$params, $limitstart));
}
else
{
$dispatcher->trigger('onPrepareContent', array(&$category, &$params, $limitstart));
}
$category->description = $category->text;
//Category K2 plugins
$category->event->K2CategoryDisplay = '';
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CategoryDisplay', array(&$category, &$params, $limitstart));
$category->event->K2CategoryDisplay = trim(implode("\n", $results));
$category->text = $category->description;
$dispatcher->trigger('onK2PrepareContent', array(&$category, &$params, $limitstart));
$category->description = $category->text;
$this->assignRef('category', $category);
$this->assignRef('user', $user);
//Category children
$ordering = $params->get('subCatOrdering');
$children = $model->getCategoryFirstChildren($id, $ordering);
if (count($children))
{
foreach ($children as $child)
{
if ($params->get('subCatTitleItemCounter'))
{
$child->numOfItems = $model->countCategoryItems($child->id);
}
$child->image = K2HelperUtilities::getCategoryImage($child->image, $params);
$child->link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($child->id.':'.urlencode($child->alias))));
$subCategories[] = $child;
}
$this->assignRef('subCategories', $subCategories);
}
//Set limit
$limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links');
//Set featured flag
JRequest::setVar('featured', $params->get('catFeaturedItems'));
//Set layout
$this->setLayout('category');
//Set title
$title = $category->name;
// Set ordering
if ($params->get('singleCatOrdering'))
{
$ordering = $params->get('singleCatOrdering');
}
else
{
$ordering = $params->get('catOrdering');
}
break;
case 'user' :
//Get user
$id = JRequest::getInt('id');
$userObject = JFactory::getUser($id);
//Check user status
if ($userObject->block)
{
JError::raiseError(404, JText::_('K2_USER_NOT_FOUND'));
}
//Get K2 user profile
$userObject->profile = $model->getUserProfile();
//User image
$userObject->avatar = K2HelperUtilities::getAvatar($userObject->id, $userObject->email, $params->get('userImageWidth'));
//User K2 plugins
$userObject->event->K2UserDisplay = '';
if (is_object($userObject->profile) && $userObject->profile->id > 0)
{
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2UserDisplay', array(&$userObject->profile, &$params, $limitstart));
$userObject->event->K2UserDisplay = trim(implode("\n", $results));
$userObject->profile->url = htmlspecialchars($userObject->profile->url, ENT_QUOTES, 'UTF-8');
}
$this->assignRef('user', $userObject);
//Set layout
$this->setLayout('user');
//Set limit
$limit = $params->get('userItemCount');
//Set title
$title = $userObject->name;
// Set ordering
$ordering = $params->get('userOrdering');
break;
case 'tag' :
//Set layout
$this->setLayout('tag');
//Set limit
$limit = $params->get('tagItemCount');
//set title
$title = JText::_('K2_DISPLAYING_ITEMS_BY_TAG').' '.JRequest::getVar('tag');
// Set ordering
$ordering = $params->get('tagOrdering');
break;
case 'search' :
//Set layout
$this->setLayout('generic');
$tpl = JRequest::getCmd('tpl', null);
//Set limit
$limit = $params->get('genericItemCount');
//Set title
$title = JText::_('K2_SEARCH_RESULTS_FOR').' '.JRequest::getVar('searchword');
break;
case 'date' :
//Set layout
$this->setLayout('generic');
//Set limit
$limit = $params->get('genericItemCount');
// Set title
if (JRequest::getInt('day'))
{
$date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month').'-'.JRequest::getInt('day'));
$dateFormat = (K2_JVERSION == '15') ? '%A, %d %B %Y' : 'l, d F Y';
$title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat);
}
else
{
$date = strtotime(JRequest::getInt('year').'-'.JRequest::getInt('month'));
$dateFormat = (K2_JVERSION == '15') ? '%B %Y' : 'F Y';
$title = JText::_('K2_ITEMS_FILTERED_BY_DATE').' '.JHTML::_('date', $date, $dateFormat);
}
// Set ordering
$ordering = 'rdate';
break;
default :
//Set layout
$this->setLayout('category');
$user = JFactory::getUser();
$this->assignRef('user', $user);
//Set limit
$limit = $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items') + $params->get('num_links');
//Set featured flag
JRequest::setVar('featured', $params->get('catFeaturedItems'));
//Set title
$title = $params->get('page_title');
// Set ordering
$ordering = $params->get('catOrdering');
break;
}
//Set limit for model
JRequest::setVar('limit', $limit);
if (!isset($ordering))
{
$items = $model->getData();
}
else
{
$items = $model->getData($ordering);
}
//Pagination
jimport('joomla.html.pagination');
$total = count($items) ? $model->getTotal() : 0;
$pagination = new JPagination($total, $limitstart, $limit);
//Prepare items
$user = JFactory::getUser();
$cache = JFactory::getCache('com_k2_extended');
$model = $this->getModel('item');
for ($i = 0; $i < sizeof($items); $i++)
{
//Item group
if ($task == "category" || $task == "")
{
if ($i < ($params->get('num_links') + $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items')))
$items[$i]->itemGroup = 'links';
if ($i < ($params->get('num_secondary_items') + $params->get('num_leading_items') + $params->get('num_primary_items')))
$items[$i]->itemGroup = 'secondary';
if ($i < ($params->get('num_primary_items') + $params->get('num_leading_items')))
$items[$i]->itemGroup = 'primary';
if ($i < $params->get('num_leading_items'))
$items[$i]->itemGroup = 'leading';
}
//Check if model should use cache for preparing item even if user is logged in
if ($user->guest || $task == 'tag' || $task == 'search' || $task == 'date')
{
$cacheFlag = true;
}
else
{
$cacheFlag = true;
if (K2HelperPermissions::canEditItem($items[$i]->created_by, $items[$i]->catid))
{
$cacheFlag = false;
}
}
//Prepare item
if ($cacheFlag)
{
$hits = $items[$i]->hits;
$items[$i]->hits = 0;
JTable::getInstance('K2Category', 'Table');
$items[$i] = $cache->call(array($model, 'prepareItem'), $items[$i], $view, $task);
$items[$i]->hits = $hits;
}
else
{
$items[$i] = $model->prepareItem($items[$i], $view, $task);
}
//Plugins
$items[$i] = $model->execPlugins($items[$i], $view, $task);
//Trigger comments counter event
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$results = $dispatcher->trigger('onK2CommentsCounter', array(&$items[$i], &$params, $limitstart));
$items[$i]->event->K2CommentsCounter = trim(implode("\n", $results));
}
//Pathway
$pathway = $mainframe->getPathWay();
$pathway->addItem($title);
//Feed link
$config = JFactory::getConfig();
$menu = $mainframe->getMenu();
$default = $menu->getDefault();
$active = $menu->getActive();
if ($task == 'tag')
{
$link = K2HelperRoute::getTagRoute(JRequest::getVar('tag'));
}
else
{
$link = '';
}
$sef = K2_JVERSION == '30' ? $config->get('sef') : $config->getValue('config.sef');
if (!is_null($active) && $active->id == $default->id && $sef)
{
$link .= '&Itemid='.$active->id.'&format=feed&limitstart=';
}
else
{
$link .= '&format=feed&limitstart=';
}
$feed = JRoute::_($link);
$this->assignRef('feed', $feed);
//Assign data
if ($task == "category" || $task == "")
{
$leading = @array_slice($items, 0, $params->get('num_leading_items'));
$primary = @array_slice($items, $params->get('num_leading_items'), $params->get('num_primary_items'));
$secondary = @array_slice($items, $params->get('num_leading_items') + $params->get('num_primary_items'), $params->get('num_secondary_items'));
$links = @array_slice($items, $params->get('num_leading_items') + $params->get('num_primary_items') + $params->get('num_secondary_items'), $params->get('num_links'));
$this->assignRef('leading', $leading);
$this->assignRef('primary', $primary);
$this->assignRef('secondary', $secondary);
$this->assignRef('links', $links);
}
else
{
$this->assignRef('items', $items);
}
//Set default values to avoid division by zero
if ($params->get('num_leading_columns') == 0)
$params->set('num_leading_columns', 1);
if ($params->get('num_primary_columns') == 0)
$params->set('num_primary_columns', 1);
if ($params->get('num_secondary_columns') == 0)
$params->set('num_secondary_columns', 1);
if ($params->get('num_links_columns') == 0)
$params->set('num_links_columns', 1);
$this->assignRef('params', $params);
$this->assignRef('pagination', $pagination);
//Look for template files in component folders
$this->_addPath('template', JPATH_COMPONENT.DS.'templates');
$this->_addPath('template', JPATH_COMPONENT.DS.'templates'.DS.'default');
//Look for overrides in template folder (K2 template structure)
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates');
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.'default');
//Look for overrides in template folder (Joomla! template structure)
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'default');
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2');
//Look for specific K2 theme files
if ($params->get('theme'))
{
$this->_addPath('template', JPATH_COMPONENT.DS.'templates'.DS.$params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.$params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.$params->get('theme'));
}
$db = JFactory::getDBO();
$nullDate = $db->getNullDate();
$this->assignRef('nullDate', $nullDate);
// Prevent spammers from using the tag view
if ($task == 'tag' && !count($this->items))
{
$tag = JRequest::getString('tag');
$db = JFactory::getDBO();
$db->setQuery('SELECT id FROM #__k2_tags WHERE name = '.$db->quote($tag));
$tagID = $db->loadResult();
if (!$tagID)
{
JError::raiseError(404, JText::_('K2_NOT_FOUND'));
return false;
}
}
parent::display($tpl);
}
function module()
{
jimport('joomla.application.module.helper');
$mainframe = JFactory::getApplication();
$moduleID = JRequest::getInt('moduleID');
$model = K2Model::getInstance('Itemlist', 'K2Model');
if ($moduleID)
{
$result = $model->getModuleItems($moduleID);
$items = $result->items;
$componentParams = JComponentHelper::getParams('com_k2');
if (is_string($result->params))
{
$params = class_exists('JParameter') ? new JParameter($result->params) : new JRegistry($result->params);
}
else
{
$params = $result->params;
}
if ($params->get('getTemplate'))
require (JModuleHelper::getLayoutPath('mod_k2_content', $params->get('getTemplate').DS.'default'));
else
require (JModuleHelper::getLayoutPath($result->module, 'default'));
}
$mainframe->close();
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<view title="K2_LATEST_ITEMS_FROM_ONE_OR_MORE_USERS_OR_CATEGORIES">
<message>K2_CREATE_A_MENU_ITEM_LINKING_TO_A_GRID_PAGE_WITH_THE_LATEST_ITEMS_FROM_SPECIFIC_CATEGORIES_OR_USERS_IN_K2</message>
</view>
</metadata>

View File

@ -0,0 +1,13 @@
<?php
/**
* @version $Id: latest.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;
?>

View File

@ -0,0 +1,260 @@
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="K2_LATEST_ITEMS_FROM_ONE_OR_MORE_USERS_OR_CATEGORIES">
<message>
<![CDATA[K2_CREATE_A_MENU_ITEM_LINKING_TO_A_GRID_PAGE_WITH_THE_LATEST_ITEMS_FROM_SPECIFIC_CATEGORIES_OR_USERS_IN_K2]]>
</message>
</layout>
<state>
<name>K2_LATEST_ITEMS_FROM_ONE_OR_MORE_USERS_OR_CATEGORIES</name>
<description>K2_CREATE_A_MENU_ITEM_LINKING_TO_A_GRID_PAGE_WITH_THE_LATEST_ITEMS_FROM_SPECIFIC_CATEGORIES_OR_USERS_IN_K2</description>
<params addPath="/administrator/components/com_k2/elements">
<param name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
<param name="" type="header" default="K2_CONTENT_SOURCE" label="" description=""/>
<param name="source" type="list" default="0" label="K2_CHOOSE_CONTENT_SOURCE" description="K2_PLEASE_SELECT_WHETHER_TO_RETRIEVE_CONTENT_FROM_K2_USERS_OR_CATEGORIES">
<option value="0">K2_USERS</option>
<option value="1">K2_CATEGORIES</option>
</param>
<param name="latestItemsCols" type="text" default="2" size="4" label="K2_NUMBER_OF_COLUMNS"/>
<param name="latestItemsLimit" type="text" default="3" size="4" label="K2_MAXIMUM_NUMBER_OF_ITEMS_PER_USER_OR_CATEGORY"/>
<param name="latestItemsDisplayEffect" type="list" default="all" label="K2_ITEM_VIEW_OPTIONS_SET_BELOW_EFFECT" description="">
<option value="first">K2_EFFECT_THE_FIRST_ITEM_ONLY_SUBSEQUENT_ITEMS_DISPLAY_TITLE_ONLY</option>
<option value="all">K2_ALL_FETCHED_ITEMS</option>
</param>
<param name="" type="header" default="K2_USER_SETTINGS" label="" description=""/>
<param name="userIDs" type="userslatest" default="" label="K2_SELECTED_USERS_SORT_WITH_DRAG_DROP" description="K2_DRAG_USERS_ONE_BY_ONE_TO_REORDER_THE_LIST_CLICK_THE_REMOVE_ICON_TO_REMOVE_A_USER_FROM_THE_LIST"/>
<param name="userName" type="radio" default="1" label="K2_NAME" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="userImage" type="radio" default="1" label="K2_IMAGE_AVATAR" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="userDescription" type="radio" default="1" label="K2_DESCRIPTION" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="userURL" type="radio" default="1" label="K2_URL" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="userEmail" type="radio" default="0" label="K2_EMAIL" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="userFeed" 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_CATEGORY_SETTINGS" label="" description=""/>
<param name="categoryIDs" type="categorieslatest" default="" label="K2_SELECTED_CATEGORIES_SORT_WITH_DRAG_DROP" description="K2_DRAG_CATEGORIES_ONE_BY_ONE_TO_REORDER_THE_LIST_CLICK_THE_REMOVE_ICON_TO_REMOVE_A_CATEGORY_FROM_THE_LIST"/>
<param name="categoryTitle" type="radio" default="1" label="K2_TITLE" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="categoryDescription" type="radio" default="1" label="K2_DESCRIPTION" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="categoryImage" type="radio" default="1" label="K2_IMAGE" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="categoryFeed" 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_ITEM_VIEW_OPTIONS_COMMON_FOR_USER_OR_CATEGORY_SOURCE" label="" description=""/>
<param name="latestItemTitle" type="radio" default="1" label="K2_TITLE" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="latestItemTitleLinked" 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="latestItemDateCreated" 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="latestItemImage" type="radio" default="1" label="K2_IMAGE" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="latestItemImageSize" type="list" default="Medium" 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="latestItemVideo" type="radio" default="1" label="K2_VIDEO" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="latestItemVideoWidth" type="text" default="" size="4" label="K2_VIDEO_WIDTH" description=""/>
<param name="latestItemVideoHeight" type="text" default="" size="4" label="K2_VIDEO_HEIGHT" description=""/>
<param name="latestItemAudioWidth" type="text" default="" size="4" label="K2_AUDIO_WIDTH" description=""/>
<param name="latestItemAudioHeight" type="text" default="" size="4" label="K2_AUDIO_HEIGHT" description=""/>
<param name="latestItemVideoAutoPlay" type="radio" default="0" label="K2_MEDIA_AUTOPLAY" description="">
<option value="0">K2_NO</option>
<option value="1">K2_YES</option>
</param>
<param name="latestItemIntroText" type="radio" default="1" label="K2_INTROTEXT" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="latestItemCategory" type="radio" default="1" label="K2_CATEGORY" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="latestItemTags" type="radio" default="1" label="K2_TAGS" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</param>
<param name="latestItemReadMore" 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="latestItemCommentsAnchor" type="radio" default="0" 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="feedLink" 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="latestItemK2Plugins" type="radio" default="0" label="K2_ENABLE_K2_PLUGINS" description="">
<option value="0">K2_NO</option>
<option value="1">K2_YES</option>
</param>
</params>
<fields name="params">
<fieldset name="basic" addfieldpath="/administrator/components/com_k2/elements">
<field name="theme" type="template" default="default" label="K2_SELECT_A_TEMPLATE"/>
<field name="" type="header" default="K2_CONTENT_SOURCE" label="" description=""/>
<field name="source" type="list" default="0" label="K2_CHOOSE_CONTENT_SOURCE" description="K2_PLEASE_SELECT_WHETHER_TO_RETRIEVE_CONTENT_FROM_K2_USERS_OR_CATEGORIES">
<option value="0">K2_USERS</option>
<option value="1">K2_CATEGORIES</option>
</field>
<field name="latestItemsCols" type="text" default="2" size="4" label="K2_NUMBER_OF_COLUMNS"/>
<field name="latestItemsLimit" type="text" default="3" size="4" label="K2_MAXIMUM_NUMBER_OF_ITEMS_PER_USER_OR_CATEGORY"/>
<field name="latestItemsDisplayEffect" type="list" default="all" label="K2_ITEM_VIEW_OPTIONS_SET_BELOW_EFFECT" description="">
<option value="first">K2_EFFECT_THE_FIRST_ITEM_ONLY_SUBSEQUENT_ITEMS_DISPLAY_TITLE_ONLY</option>
<option value="all">K2_ALL_FETCHED_ITEMS</option>
</field>
<field name="" type="header" default="K2_USER_SETTINGS" label="" description=""/>
<field name="userIDs" type="userslatest" default="" label="K2_SELECTED_USERS_SORT_WITH_DRAG_DROP" description="K2_DRAG_USERS_ONE_BY_ONE_TO_REORDER_THE_LIST_CLICK_THE_REMOVE_ICON_TO_REMOVE_A_USER_FROM_THE_LIST"/>
<field name="userName" type="radio" default="1" label="K2_NAME" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="userImage" type="radio" default="1" label="K2_IMAGE_AVATAR" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="userDescription" type="radio" default="1" label="K2_DESCRIPTION" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="userURL" type="radio" default="1" label="K2_URL" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="userEmail" type="radio" default="0" label="K2_EMAIL" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="userFeed" 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_CATEGORY_SETTINGS" label="" description=""/>
<field name="categoryIDs" type="categorieslatest" default="" label="K2_SELECTED_CATEGORIES_SORT_WITH_DRAG_DROP" description="K2_DRAG_CATEGORIES_ONE_BY_ONE_TO_REORDER_THE_LIST_CLICK_THE_REMOVE_ICON_TO_REMOVE_A_CATEGORY_FROM_THE_LIST"/>
<field name="categoryTitle" type="radio" default="1" label="K2_TITLE" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="categoryDescription" type="radio" default="1" label="K2_DESCRIPTION" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="categoryImage" type="radio" default="1" label="K2_IMAGE" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="categoryFeed" 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_ITEM_VIEW_OPTIONS_COMMON_FOR_USER_OR_CATEGORY_SOURCE" label="" description=""/>
<field name="latestItemTitle" type="radio" default="1" label="K2_TITLE" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="latestItemTitleLinked" 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="latestItemDateCreated" 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="latestItemImage" type="radio" default="1" label="K2_IMAGE" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="latestItemImageSize" type="list" default="Medium" 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="latestItemVideo" type="radio" default="1" label="K2_VIDEO" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="latestItemVideoWidth" type="text" default="" size="4" label="K2_VIDEO_WIDTH" description=""/>
<field name="latestItemVideoHeight" type="text" default="" size="4" label="K2_VIDEO_HEIGHT" description=""/>
<field name="latestItemAudioWidth" type="text" default="" size="4" label="K2_AUDIO_WIDTH" description=""/>
<field name="latestItemAudioHeight" type="text" default="" size="4" label="K2_AUDIO_HEIGHT" description=""/>
<field name="latestItemVideoAutoPlay" type="radio" default="0" label="K2_MEDIA_AUTOPLAY" description="">
<option value="0">K2_NO</option>
<option value="1">K2_YES</option>
</field>
<field name="latestItemIntroText" type="radio" default="1" label="K2_INTROTEXT" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="latestItemCategory" type="radio" default="1" label="K2_CATEGORY" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="latestItemTags" type="radio" default="1" label="K2_TAGS" description="">
<option value="0">K2_HIDE</option>
<option value="1">K2_SHOW</option>
</field>
<field name="latestItemReadMore" 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="latestItemCommentsAnchor" type="radio" default="0" 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="feedLink" 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="latestItemK2Plugins" type="radio" default="0" label="K2_ENABLE_K2_PLUGINS" description="">
<option value="0">K2_NO</option>
<option value="1">K2_YES</option>
</field>
</fieldset>
</fields>
</state>
</metadata>

Some files were not shown because too many files have changed in this diff Show More