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 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,232 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.pagenavigation
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Pagenavigation plugin class.
*
* @package Joomla.Plugin
* @subpackage Content.pagenavigation
* @since 1.5
*/
class PlgContentPagenavigation extends JPlugin
{
/**
* If in the article view and the parameter is enabled shows the page navigation
*
* @param string $context The context of the content being passed to the plugin
* @param object &$row The article object
* @param mixed &$params The article params
* @param integer $page The 'page' number
*
* @return mixed void or true
*
* @since 1.6
*/
public function onContentBeforeDisplay($context, &$row, &$params, $page = 0)
{
$app = JFactory::getApplication();
$view = $app->input->get('view');
$print = $app->input->getBool('print');
if ($print)
{
return false;
}
if (($context == 'com_content.article') && ($view == 'article') && $params->get('show_item_navigation'))
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
$lang = JFactory::getLanguage();
$nullDate = $db->getNullDate();
$date = JFactory::getDate();
$now = $date->toSql();
$uid = $row->id;
$option = 'com_content';
$canPublish = $user->authorise('core.edit.state', $option . '.article.' . $row->id);
/**
* The following is needed as different menu items types utilise a different param to control ordering.
* For Blogs the `orderby_sec` param is the order controlling param.
* For Table and List views it is the `orderby` param.
**/
$params_list = $params->toArray();
if (array_key_exists('orderby_sec', $params_list))
{
$order_method = $params->get('orderby_sec', '');
}
else
{
$order_method = $params->get('orderby', '');
}
// Additional check for invalid sort ordering.
if ($order_method == 'front')
{
$order_method = '';
}
// Determine sort order.
switch ($order_method)
{
case 'date' :
$orderby = 'a.created';
break;
case 'rdate' :
$orderby = 'a.created DESC';
break;
case 'alpha' :
$orderby = 'a.title';
break;
case 'ralpha' :
$orderby = 'a.title DESC';
break;
case 'hits' :
$orderby = 'a.hits';
break;
case 'rhits' :
$orderby = 'a.hits DESC';
break;
case 'order' :
$orderby = 'a.ordering';
break;
case 'author' :
$orderby = 'a.created_by_alias, u.name';
break;
case 'rauthor' :
$orderby = 'a.created_by_alias DESC, u.name DESC';
break;
case 'front' :
$orderby = 'f.ordering';
break;
default :
$orderby = 'a.ordering';
break;
}
$xwhere = ' AND (a.state = 1 OR a.state = -1)' .
' AND (publish_up = ' . $db->quote($nullDate) . ' OR publish_up <= ' . $db->quote($now) . ')' .
' AND (publish_down = ' . $db->quote($nullDate) . ' OR publish_down >= ' . $db->quote($now) . ')';
// Array of articles in same category correctly ordered.
$query = $db->getQuery(true);
// Sqlsrv changes
$case_when = ' CASE WHEN ';
$case_when .= $query->charLength('a.alias', '!=', '0');
$case_when .= ' THEN ';
$a_id = $query->castAsChar('a.id');
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
$case_when .= ' ELSE ';
$case_when .= $a_id . ' END as slug';
$case_when1 = ' CASE WHEN ';
$case_when1 .= $query->charLength('cc.alias', '!=', '0');
$case_when1 .= ' THEN ';
$c_id = $query->castAsChar('cc.id');
$case_when1 .= $query->concatenate(array($c_id, 'cc.alias'), ':');
$case_when1 .= ' ELSE ';
$case_when1 .= $c_id . ' END as catslug';
$query->select('a.id,' . $case_when . ',' . $case_when1)
->from('#__content AS a')
->join('LEFT', '#__categories AS cc ON cc.id = a.catid')
->where(
'a.catid = ' . (int) $row->catid . ' AND a.state = ' . (int) $row->state
. ($canPublish ? '' : ' AND a.access = ' . (int) $row->access) . $xwhere
);
$query->order($orderby);
if ($app->isSite() && $app->getLanguageFilter())
{
$query->where('a.language in (' . $db->quote($lang->getTag()) . ',' . $db->quote('*') . ')');
}
$db->setQuery($query);
$list = $db->loadObjectList('id');
// This check needed if incorrect Itemid is given resulting in an incorrect result.
if (!is_array($list))
{
$list = array();
}
reset($list);
// Location of current content item in array list.
$location = array_search($uid, array_keys($list));
$rows = array_values($list);
$row->prev = null;
$row->next = null;
if ($location - 1 >= 0)
{
// The previous content item cannot be in the array position -1.
$row->prev = $rows[$location - 1];
}
if (($location + 1) < count($rows))
{
// The next content item cannot be in an array position greater than the number of array postions.
$row->next = $rows[$location + 1];
}
// $pnSpace is/can be used in the include file
$pnSpace = "";
if (JText::_('JGLOBAL_LT') || JText::_('JGLOBAL_GT'))
{
$pnSpace = " ";
}
if ($row->prev)
{
$row->prev = JRoute::_(ContentHelperRoute::getArticleRoute($row->prev->slug, $row->prev->catslug));
}
else
{
$row->prev = '';
}
if ($row->next)
{
$row->next = JRoute::_(ContentHelperRoute::getArticleRoute($row->next->slug, $row->next->catslug));
}
else
{
$row->next = '';
}
// Output.
if ($row->prev || $row->next)
{
// Get the path for the layout file
$path = JPluginHelper::getLayoutPath('content', 'pagenavigation');
// Render the pagenav
ob_start();
include $path;
$row->pagination = ob_get_clean();
$row->paginationposition = $this->params->get('position', 1);
// This will default to the 1.5 and 1.6-1.7 behavior.
$row->paginationrelative = $this->params->get('relative', 0);
}
}
return;
}
}

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="content">
<name>plg_content_pagenavigation</name>
<author>Joomla! Project</author>
<creationDate>January 2006</creationDate>
<copyright>Copyright (C) 2005 - 2013 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>PLG_PAGENAVIGATION_XML_DESCRIPTION</description>
<files>
<filename plugin="pagenavigation">pagenavigation.php</filename>
<filename>index.html</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_content_pagenavigation.ini</language>
<language tag="en-GB">en-GB.plg_content_pagenavigation.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field name="position" type="list"
default="1"
description="PLG_PAGENAVIGATION_FIELD_POSITION_DESC"
label="PLG_PAGENAVIGATION_FIELD_POSITION_LABEL"
>
<option value="1">PLG_PAGENAVIGATION_FIELD_VALUE_BELOW</option>
<option value="0">PLG_PAGENAVIGATION_FIELD_VALUE_ABOVE</option>
</field>
<field name="relative" type="list"
default="1"
description="PLG_PAGENAVIGATION_FIELD_RELATIVE_DESC"
label="PLG_PAGENAVIGATION_FIELD_RELATIVE_LABEL"
>
<option value="1">PLG_PAGENAVIGATION_FIELD_VALUE_ARTICLE</option>
<option value="0">PLG_PAGENAVIGATION_FIELD_VALUE_TEXT</option>
</field>
</fieldset>
</fields>
</config>
</extension>

View File

@ -0,0 +1,23 @@
<?php
/**
* @package Joomla.Plugin
* @subpackage Content.pagenavigation
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<ul class="pager pagenav">
<?php if ($row->prev) : ?>
<li class="previous">
<a href="<?php echo $row->prev; ?>" rel="prev"><?php echo JText::_('JGLOBAL_LT') . $pnSpace . JText::_('JPREV'); ?></a>
</li>
<?php endif; ?>
<?php if ($row->next) : ?>
<li class="next">
<a href="<?php echo $row->next; ?>" rel="next"><?php echo JText::_('JNEXT') . $pnSpace . JText::_('JGLOBAL_GT'); ?></a>
</li>
<?php endif; ?>
</ul>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>