upstream patch by ian

This commit is contained in:
Garvin Hicking 2016-09-23 10:48:48 +02:00
parent f701a87ab9
commit bbcc4184da
13 changed files with 95 additions and 83 deletions

View file

@ -1 +1,12 @@
1.6: Fix pagination being off by one page, thanks to montebianco
1.7.2:
------
* Set plugin consistencies
* Add missing db type for mysqli cases
* Use load language API - extends required Serendipity version to v.1.6
1.6:
----
* Fix pagination being off by one page, thanks to montebianco

View file

@ -1,4 +1,4 @@
<?php #
<?php
/**
* @version
@ -8,3 +8,4 @@
@define('PLUGIN_EVENT_FILTER_ENTRIES_NAME', 'Филтриране на статии');
@define('PLUGIN_EVENT_FILTER_ENTRIES_DESC', 'Позволява посетителите да филтрират статиите по различни критерии');

View file

@ -9,3 +9,4 @@
@define('PLUGIN_EVENT_FILTER_ENTRIES_NAME', 'Filtrování příspěvků');
@define('PLUGIN_EVENT_FILTER_ENTRIES_DESC', 'Umožňuje návštěvníkům blogu filtrovat/řadit příspěvky podle různých pravidel');

View file

@ -9,3 +9,4 @@
@define('PLUGIN_EVENT_FILTER_ENTRIES_NAME', 'Filtrování příspěvků');
@define('PLUGIN_EVENT_FILTER_ENTRIES_DESC', 'Umožňuje návštěvníkům blogu filtrovat/řadit příspěvky podle různých pravidel');

View file

@ -1,4 +1,5 @@
<?php #
<?php
@define('PLUGIN_EVENT_FILTER_ENTRIES_NAME', 'Filtern von Einträgen im Frontend');
@define('PLUGIN_EVENT_FILTER_ENTRIES_DESC', 'Ermöglich Besuchern die Einträge im Blog nach Kriterien zu durchsuchen/sortieren');

View file

@ -1,4 +1,4 @@
<?php #
<?php
/**
* @version
@ -8,3 +8,4 @@
@define('PLUGIN_EVENT_FILTER_ENTRIES_NAME', 'Ôèëòðèðàíå íà ñòàòèè');
@define('PLUGIN_EVENT_FILTER_ENTRIES_DESC', 'Ïîçâîëÿâà ïîñåòèòåëèòå äà ôèëòðèðàò ñòàòèèòå ïî ðàçëè÷íè êðèòåðèè');

View file

@ -9,3 +9,4 @@
@define('PLUGIN_EVENT_FILTER_ENTRIES_NAME', 'Filtrování pøíspìvkù');
@define('PLUGIN_EVENT_FILTER_ENTRIES_DESC', 'Umožòuje návštìvníkùm blogu filtrovat/øadit pøíspìvky podle rùzných pravidel');

View file

@ -9,3 +9,4 @@
@define('PLUGIN_EVENT_FILTER_ENTRIES_NAME', 'Filtrování pøíspìvkù');
@define('PLUGIN_EVENT_FILTER_ENTRIES_DESC', 'Umo¾òuje náv¹tìvníkùm blogu filtrovat/øadit pøíspìvky podle rùzných pravidel');

View file

@ -1,4 +1,5 @@
<?php #
<?php
@define('PLUGIN_EVENT_FILTER_ENTRIES_NAME', 'Filtern von Einträgen im Frontend');
@define('PLUGIN_EVENT_FILTER_ENTRIES_DESC', 'Ermöglich Besuchern die Einträge im Blog nach Kriterien zu durchsuchen/sortieren');

View file

@ -1,4 +1,4 @@
<?php #
<?php
/**
* @version
@ -9,4 +9,3 @@
@define('PLUGIN_EVENT_FILTER_ENTRIES_NAME', 'Frontend entry filtering');
@define('PLUGIN_EVENT_FILTER_ENTRIES_DESC', 'Allows visitors to filter/order your entries by several options');
?>

View file

@ -1,17 +1,10 @@
<?php #
<?php
if (IN_serendipity !== true) {
die ("Don't hack!");
}
// Probe for a language include with constants. Still include defines later on, if some constants were missing
$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
if (file_exists($probelang)) {
include $probelang;
}
include dirname(__FILE__) . '/lang_en.inc.php';
@serendipity_plugin_api::load_language(dirname(__FILE__));
class serendipity_event_filter_entries extends serendipity_event
{
@ -25,10 +18,10 @@ class serendipity_event_filter_entries extends serendipity_event
$propbag->add('name', PLUGIN_EVENT_FILTER_ENTRIES_NAME);
$propbag->add('description', PLUGIN_EVENT_FILTER_ENTRIES_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('version', '1.7.1');
$propbag->add('author', 'Garvin Hicking, Ian');
$propbag->add('version', '1.7.2');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'serendipity' => '1.6',
'smarty' => '2.6.7',
'php' => '4.1.0'
));
@ -41,11 +34,13 @@ class serendipity_event_filter_entries extends serendipity_event
$propbag->add('groups', array('FRONTEND_VIEWS'));
}
function generate_content(&$title) {
function generate_content(&$title)
{
$title = $this->title;
}
function event_hook($event, &$bag, &$eventData, $addData = null) {
function event_hook($event, &$bag, &$eventData, $addData = null)
{
global $serendipity;
$hooks = &$bag->get('event_hooks');
@ -108,7 +103,7 @@ class serendipity_event_filter_entries extends serendipity_event
<?php
$categories = serendipity_fetchCategories();
$categories = serendipity_walkRecursive($categories, 'categoryid', 'parentid', VIEWMODE_THREADED);
foreach ( $categories as $cat ) {
foreach ( $categories AS $cat ) {
echo '<option value="'. $cat['categoryid'] .'"'. ($_SESSION['filter']['category'] == $cat['categoryid'] ? ' selected="selected"' : '') .'>'. str_repeat('&nbsp;', $cat['depth']) . $cat['category_name'] .'</option>' . "\n";
}
?> </select>
@ -124,7 +119,7 @@ class serendipity_event_filter_entries extends serendipity_event
<td>
<select name="sort[order]">
<?php
foreach($sort_order as $so_key => $so_val) {
foreach($sort_order AS $so_key => $so_val) {
echo '<option value="' . $so_key . '" ' . (isset($_SESSION['sort']['order']) && $_SESSION['sort']['order'] == $so_key ? 'selected="selected"': '') . '>' . $so_val . '</option>' . "\n";
}
?> </select>
@ -155,7 +150,6 @@ class serendipity_event_filter_entries extends serendipity_event
</form>
</div>
<?php
return true;
break;
case 'external_plugin':
@ -206,7 +200,7 @@ class serendipity_event_filter_entries extends serendipity_event
}
/* Attempt to locate hidden variables within the URI */
foreach ($serendipity['uriArguments'] as $k => $v){
foreach ($serendipity['uriArguments'] AS $k => $v){
if ($v[0] == 'P') { /* Page */
$page = substr($v, 1);
if (is_numeric($page)) {
@ -249,7 +243,7 @@ class serendipity_event_filter_entries extends serendipity_event
}
if (!empty($_SESSION['filter']['body'])) {
if ($serendipity['dbType'] == 'mysql') {
if ($serendipity['dbType'] == 'mysql' || $serendipity['dbType'] == 'mysqli') {
$filter[] = "MATCH (title,body,extended) AGAINST ('" . serendipity_db_escape_string($_SESSION['filter']['body']) . "')";
$full = true;
}
@ -282,18 +276,18 @@ class serendipity_event_filter_entries extends serendipity_event
$serendipity['smarty']->display(serendipity_getTemplateFile($serendipity['smarty_file'], 'serendipityPath'));
break;
}
return true;
break;
default:
return false;
break;
}
return true;
} else {
return false;
}
}
}
/* vim: set sts=4 ts=4 expandtab : */
?>