Description and authors of all default plugins reworked. (Original plugin authors are mentioned in CONTRIBUTORS.md from now on.)

This commit is contained in:
azett 2020-10-24 20:42:59 +02:00
parent 6830a2b0e8
commit c2accdedcc
23 changed files with 1011 additions and 1030 deletions

View File

@ -1,22 +1,20 @@
<?php
/*
Plugin Name: Accessible Antispam
Plugin URI: http://flatpress.nowherland.it/
Description: Antispam asking to answer a simple math question.
Author: NoWhereMan (E.Vacchi)
Version: 3.0
Author URI: http://www.nowhereland.it
*/
* Plugin Name: Accessible Antispam
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Antispam asking to answer a simple math question. Part of the standard distribution.
* Version: 3.0
*/
define('AASPAM_DEBUG', false);
define('AASPAM_LOG', CACHE_DIR . 'aaspamlog.txt');
add_action('comment_validate', 'plugin_aaspam_validate', 5, 2);
add_action('comment_form', 'plugin_aaspam_comment_form');
function plugin_aaspam_validate($bool, $arr) {
// if boolean $bool==false
// the test is forced to fail
if (!$bool)
@ -25,118 +23,116 @@ function plugin_aaspam_validate($bool, $arr) {
// if user is loggedin we ignore the plugin
if (user_loggedin())
return true;
// get the value and reset last saved, so that
// an attacker can't use the old one for multiple posting
$v = sess_remove('aaspam');
// we get the array stored in session:
// if it evaluated to false value (e.g. is null) test fails
if (!$v) {
return false;
}
// we test the result wether match user input
if (!($ret = $_POST['aaspam']==$v)) {
// we test the result wether match user input
if (!($ret = $_POST ['aaspam'] == $v)) {
global $smarty;
$lang = lang_load('plugin:accessibleantispam');
$smarty->append('error', $lang['plugin']['accessibleantispam']['error']);
$smarty->append('error', $lang ['plugin'] ['accessibleantispam'] ['error']);
}
if ( AASPAM_DEBUG && $f=@fopen(AASPAM_LOG, 'a') ) {
$arr['aaspam-q'] = $_POST['aaspam'];
$arr['aaspam-a'] = $v;
$arr['SUCCESS'] = $ret;
$s = date('r'). "|" . session_id().'|'.utils_kimplode($arr)."\r\n";
@fwrite($f, $s);
@fclose($f);
}
if (AASPAM_DEBUG && $f = @fopen(AASPAM_LOG, 'a')) {
$arr ['aaspam-q'] = $_POST ['aaspam'];
$arr ['aaspam-a'] = $v;
$arr ['SUCCESS'] = $ret;
$s = date('r') . "|" . session_id() . '|' . utils_kimplode($arr) . "\r\n";
@fwrite($f, $s);
@fclose($f);
}
return $ret;
}
function plugin_aaspam_comment_form() {
// we get a random arithmetic operation
// between sum, subtraction and multiplication;
// we intentionally left out division because
// it can lead to situations like division by zero
// or floating point numbers
$myop = array_rand($ops = array(
'+',
'-',
'*'
));
$op = $ops [$myop];
$myop = array_rand($ops=array('+','-','*'));
$op=$ops[$myop];
// we get two random integers between 1 and 10
$v1 = mt_rand(1, 10);
// we rand $v2 until it differs from $v1
// (otherwise result for subtractions is zero)
while (($v2 = mt_rand(1, 10))==$v1);
// we rand $v2 until it differs from $v1
// (otherwise result for subtractions is zero)
while (($v2 = mt_rand(1, 10)) == $v1)
;
// if operation is subtraction
// the higher number must always come first
// or you'll get a negative integer
if ($v2>$v1 && $op=='-') {
if ($v2 > $v1 && $op == '-') {
$tmp = $v1;
$v1 = $v2;
$v2 = $tmp;
}
// execute the operation
switch($op) {
case '+' :
$v = $v1+$v2;
switch ($op) {
case '+':
$v = $v1 + $v2;
break;
case '-' :
$v = $v1-$v2;
case '-':
$v = $v1 - $v2;
break;
case '*' :
$v = $v1*$v2;
case '*':
$v = $v1 * $v2;
break;
}
}
sess_add('aaspam', $v);
// load plugin strings
// they're located under plugin.PLUGINNAME/lang/LANGID/
$lang = lang_load('plugin:accessibleantispam');
$langstrings =& $lang['plugin']['accessibleantispam'];
$langstrings = & $lang ['plugin'] ['accessibleantispam'];
// get the correct question depending on the operation
switch($op) {
case '+' :
$question = $langstrings['sum'];
switch ($op) {
case '+':
$question = $langstrings ['sum'];
break;
case '-' :
$question = $langstrings['sub'];
case '-':
$question = $langstrings ['sub'];
break;
case '*' :
$question = $langstrings['prod'];
case '*':
$question = $langstrings ['prod'];
break;
}
}
// format the question with numbers at the proper positions
$question = sprintf($question, $v1, $v2);
if ( AASPAM_DEBUG && $f=@fopen(AASPAM_LOG, 'a') ) {
$arr['aaspam-q'] = $v;
@fwrite($f, date('r'). '|'.session_id() .'|'. utils_kimplode($arr)."\r\n");
if (AASPAM_DEBUG && $f = @fopen(AASPAM_LOG, 'a')) {
$arr ['aaspam-q'] = $v;
@fwrite($f, date('r') . '|' . session_id() . '|' . utils_kimplode($arr) . "\r\n");
@fclose($f);
}
// echoes the question and the form part
echo <<<STR
<p><label class="textlabel" for="aaspam">{$lang['plugin']['accessibleantispam']['prefix']} <strong>$question (*)</strong></label><br />
<input type="text" name="aaspam" id="aaspam" /></p>
STR;
<p><label class="textlabel" for="aaspam">{$lang['plugin']['accessibleantispam']['prefix']} <strong>$question (*)</strong></label><br />
<input type="text" name="aaspam" id="aaspam" /></p>
STR;
}
?>

View File

@ -2,11 +2,11 @@
/*
* Plugin Name: AdminArea
* Plugin URI: http://www.nowhereland.it/
* Description: AdminArea plugin. Part of the standard distribution ;)
* Author: NoWhereMan
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: AdminArea plugin. Part of the standard distribution.
* Version: 1.0
* Author URI: http://www.nowhereland.it/
*/
function plugin_adminarea_widget() {

View File

@ -1,14 +1,12 @@
<?php
/*
Plugin Name: Akismet
Version: 0.1
Plugin URI: http://flatpress.sf.net
Description: Integration with Akismet powerful Antispam system!
Author: NoWhereMan
Author URI: http://flatpress.sf.net
*/
* Plugin Name: Akismet
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Integration with Akismet powerful Antispam system. Part of the standard distribution.
* Version: 1.0
*/
define('AKISMET_TIMEOUT', 10);
require plugin_getdir('akismet') . '/inc/Akismet.class.php';
@ -16,70 +14,71 @@ require plugin_getdir('akismet') . '/inc/Akismet.class.php';
function plugin_akismet_setup() {
global $fp_config;
if (!plugin_getoptions('akismet','apikey')) {
if (!plugin_getoptions('akismet', 'apikey')) {
return -1;
}
return 1;
return 1;
}
if (plugin_getoptions('akismet','apikey')) {
add_filter('comment_validate','plugin_akismet_validate', 10, 2);
if (plugin_getoptions('akismet', 'apikey')) {
add_filter('comment_validate', 'plugin_akismet_validate', 10, 2);
}
function plugin_akismet_validate($bool, $contents) {
if (!$bool) return false;
global $fp_config;
$akismet = new Akismet($fp_config['general']['www'], plugin_getoptions('akismet','apikey'));
$akismet->setAuthor($contents['name']);
$akismet->setAuthorEmail(isset($contents['email'])? $contents['email'] : '');
$akismet->setAuthorURL(isset($contents['url'])? $contents['url'] : '');
$akismet->setContent($contents['content']);
if ($v= $akismet->isSpam()){
global $smarty;
$smarty->assign('error', array('ERROR: Comment is invalid'));
if (!$bool)
return false;
}
global $fp_config;
$akismet = new Akismet($fp_config ['general'] ['www'], plugin_getoptions('akismet', 'apikey'));
$akismet->setAuthor($contents ['name']);
$akismet->setAuthorEmail(isset($contents ['email']) ? $contents ['email'] : '');
$akismet->setAuthorURL(isset($contents ['url']) ? $contents ['url'] : '');
$akismet->setContent($contents ['content']);
if ($v = $akismet->isSpam()) {
global $smarty;
$smarty->assign('error', array(
'ERROR: Comment is invalid'
));
return false;
}
return true;
}
if (class_exists('AdminPanelAction')){
if (class_exists('AdminPanelAction')) {
class admin_plugin_akismet extends AdminPanelAction {
class admin_plugin_akismet extends AdminPanelAction {
var $langres = 'plugin:akismet';
function setup() {
$this->smarty->assign('admin_resource', "plugin:akismet/admin.plugin.akismet");
}
function main() {
$akismetconf = plugin_getoptions('akismet');
$this->smarty->assign('akismetconf', $akismetconf);
}
function onsubmit() {
global $fp_config;
if ($_POST['wp-apikey']){
plugin_addoption('akismet', 'apikey', $_POST['wp-apikey']);
if ($_POST ['wp-apikey']) {
plugin_addoption('akismet', 'apikey', $_POST ['wp-apikey']);
plugin_saveoptions('akismet');
$this->smarty->assign('success', 1);
} else {
$this->smarty->assign('success', -1);
$this->smarty->assign('success', -1);
}
return 2;
}
}
admin_addpanelaction('plugin', 'akismet', true);
}

View File

@ -1,86 +1,84 @@
<?php
/*
Plugin Name: Archives
Version: 1.0
Plugin URI: http://flatpress.sf.net
Description: Adds an Archive widget element
Author: NoWhereMan
Author URI: http://flatpress.sf.net
*/
* Plugin Name: Archives
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Adds an Archive widget element. Part of the standard distribution.
* Version: 1.0
*/
class plugin_archives_monthlist extends fs_filelister {
var $_directory = CONTENT_DIR;
var $_list = array();
var $_htmllist = array();
var $_months = array();
var $_year = '';
function _checkFile($directory, $file) {
$f = "$directory/$file";
if (ctype_digit($file)) {
if ($this->_directory === $directory) {
// add year to the list (do not closes li, because
// we may have nested elements)
$this->_year = $file;
$lnk = get_year_link($file);
$this->_htmllist[$this->_year] = "<li class=\"archive-year archive-y20$file\"> <a href=\"$lnk\">20$file</a>";
return 1;
} elseif (is_dir($f)) {
$this->_months[] = $file;
return 0;
}
var $_directory = CONTENT_DIR;
var $_list = array();
var $_htmllist = array();
var $_months = array();
var $_year = '';
function _checkFile($directory, $file) {
$f = "$directory/$file";
if (ctype_digit($file)) {
if ($this->_directory === $directory) {
// add year to the list (do not closes li, because
// we may have nested elements)
$this->_year = $file;
$lnk = get_year_link($file);
$this->_htmllist [$this->_year] = "<li class=\"archive-year archive-y20$file\"> <a href=\"$lnk\">20$file</a>";
return 1;
} elseif (is_dir($f)) {
$this->_months [] = $file;
return 0;
}
}
function _exitingDir($directory = null, $file=null) {
$y = $this->_year;
if ($mos =& $this->_months) {
sort($mos);
$list = '';
$linearlist = array();
foreach($mos as $mth) {
$lnk = get_month_link($y, $mth);
$the_month = theme_date_format( mktime(0, 0, 0, $mth, 1, 0 ), '%B');
$list = "<li class=\"archive-month archive-m$mth\"><a href=\"$lnk\">".
$the_month
.' </a></li>' . $list;
$linearlist["$the_month 20{$this->_year}"] = $lnk;
}
$list = '<ul>' . $list . '</ul>';
}
function _exitingDir($directory = null, $file = null) {
$y = $this->_year;
if ($mos = & $this->_months) {
sort($mos);
$list = '';
$linearlist = array();
foreach ($mos as $mth) {
$lnk = get_month_link($y, $mth);
$the_month = theme_date_format(mktime(0, 0, 0, $mth, 1, 0), '%B');
$list = "<li class=\"archive-month archive-m$mth\"><a href=\"$lnk\">" . $the_month . ' </a></li>' . $list;
$linearlist ["$the_month 20{$this->_year}"] = $lnk;
}
$mos = array();
// we close year's li
$this->_list[$y] = $linearlist;
$this->_htmllist[$y] .= $list . '</li>';
$list = '<ul>' . $list . '</ul>';
}
function getList() {
krsort($this->_list);
return $this->_list;
}
function getHtmlList() {
krsort($this->_htmllist);
return implode($this->_htmllist);
}
$mos = array();
// we close year's li
$this->_list [$y] = $linearlist;
$this->_htmllist [$y] .= $list . '</li>';
}
function getList() {
krsort($this->_list);
return $this->_list;
}
function getHtmlList() {
krsort($this->_htmllist);
return implode($this->_htmllist);
}
}
function plugin_archives_head() {
global $PLUGIN_ARCHIVES_MONTHLIST;
$PLUGIN_ARCHIVES_MONTHLIST = new plugin_archives_monthlist;
$PLUGIN_ARCHIVES_MONTHLIST = new plugin_archives_monthlist();
echo "\n<!-- archives -->\n";
foreach($PLUGIN_ARCHIVES_MONTHLIST->getList() as $y => $months) {
foreach ($PLUGIN_ARCHIVES_MONTHLIST->getList() as $y => $months) {
foreach ($months as $ttl => $link)
echo "<link rel=\"archives\" title=\"{$ttl}\" href=\"{$link}\" />\n";
}
@ -90,19 +88,14 @@ function plugin_archives_head() {
add_filter('wp_head', 'plugin_archives_head');
function plugin_archives_widget() {
lang_load('plugin:archives');
global $lang, $PLUGIN_ARCHIVES_MONTHLIST;
return array(
'subject' => $lang['plugin']['archives']['subject'],
'content' => ($list = $PLUGIN_ARCHIVES_MONTHLIST->getHtmlList()) ?
'<ul>' . $list . '</ul>'
:
"<p>{$lang['plugin']['archives']['no_posts']}</p>"
);
'subject' => $lang ['plugin'] ['archives'] ['subject'],
'content' => ($list = $PLUGIN_ARCHIVES_MONTHLIST->getHtmlList()) ? '<ul>' . $list . '</ul>' : "<p>{$lang['plugin']['archives']['no_posts']}</p>"
);
}
register_widget('archives', 'Archives', 'plugin_archives_widget');

View File

@ -1,11 +1,11 @@
<?php
/*
* Plugin Name: BBCode
* Version: 1.5
* Plugin URI: http://flatpress.sf.net
* Description: Allows using <a href="http://www.phpbb.com/phpBB/faq.php?mode=bbcode">BBCode</a> markup; provides automatic integration with lightbox.
* Author: Hydra, NoWhereMan
* Author URI: http://flatpress.sf.net
* Version: 1.6
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Allows using <a href="http://www.phpbb.com/phpBB/faq.php?mode=bbcode">BBCode</a> markup; provides automatic integration with lightbox. Part of the standard distribution.
*/
require (plugin_getdir('bbcode') . '/inc/stringparser_bbcode.class.php');
require (plugin_getdir('bbcode') . '/panels/admin.plugin.panel.bbcode.php');

View File

@ -2,12 +2,12 @@
/*
* Plugin Name: BlockParser
* Plugin URI: http://www.nowhereland.it/
* Type: Block
* Description: BlockParser plugin. Part of the standard distribution ;) This allow you to use simple non-plugin custom blocks :)
* Author: NoWhereMan real_nowhereman at user dot sf dot net
* Version: 1.0
* Author URI: http://www.nowhereland.it/
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Allows you to use simple non-plugin custom blocks. Part of the standard distribution.
*/
// define('BLOCKS_DIR', CONTENT_DIR . 'blocks/');

View File

@ -3,11 +3,11 @@
/*
* Plugin Name: Calendar
* Version: 1.1
* Plugin URI: http://flatpress.sf.net
* Type: Block
* Description: Adds a Calendar block level element
* Author: NoWhereMan
* Author URI: http://flatpress.sf.net
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Adds a calendar widget. Part of the standard distribution.
*/
// PHP Calendar (version 2.3), written by Keith Devens
@ -19,17 +19,17 @@ function generate_calendar($year, $month, $days = array(), $day_name_length = 3,
// remember that mktime will automatically correct if invalid dates are entered
// for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
// this provides a built in "rounding" feature to generate_calendar()
$day_names = array(); // generate all the day names according to the current locale
for($n = 0, $t = (3 + $first_day) * 86400; $n < 7; $n++, $t += 86400) // January 4, 1970 was a Sunday
$day_names [$n] = ucfirst(date_strformat('%A', $t)); // %A means full textual day name
list ($month, $year, $month_name, $weekday) = explode(',', date_strformat('%m,%Y,%B,%w', $first_of_month));
$weekday = ($weekday + 7 - $first_day) % 7; // adjust for $first_day
$title = htmlentities(ucfirst($month_name)) . '&nbsp;' . $year; // note that some locales don't capitalize month and day names
// Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
// PHP7 compatibility: Since $pn is never passed, we do not need to create "previous" and "next" elements.
$p = '';
$n = '';
@ -37,16 +37,16 @@ function generate_calendar($year, $month, $days = array(), $day_name_length = 3,
// @list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
// if($p) $p = '<span class="calendar-prev">'.($pl ? '<a href="'.($pl).'">'.$p.'</a>' : $p).'</span>&nbsp;';
// if($n) $n = '&nbsp;<span class="calendar-next">'.($nl ? '<a href="'.($nl).'">'.$n.'</a>' : $n).'</span>';
$calendar = '<table class="calendar">' . "\n" . '<caption class="calendar-month">' . $p . ($month_href ? '<a href="' . ($month_href) . '">' . $title . '</a>' : $title) . $n . "</caption>\n<tr>";
if ($day_name_length) { // if the day names should be shown ($day_name_length > 0)
// if day_name_length is >3, the full name of the day will be printed
foreach ($day_names as $d)
$calendar .= '<th abbr="' . htmlentities($d) . '">' . htmlentities($day_name_length < 4 ? substr($d, 0, $day_name_length) : $d) . '</th>';
$calendar .= "</tr>\n<tr>";
}
if ($weekday > 0)
$calendar .= '<td colspan="' . $weekday . '">&nbsp;</td>'; // initial 'empty' days
for($day = 1, $days_in_month = gmdate('t', $first_of_month); $day <= $days_in_month; $day++, $weekday++) {
@ -64,49 +64,49 @@ function generate_calendar($year, $month, $days = array(), $day_name_length = 3,
}
if ($weekday != 7)
$calendar .= '<td colspan="' . (7 - $weekday) . '">&nbsp;</td>'; // remaining "empty" days
return $calendar . "</tr>\n</table>\n";
}
function plugin_calendar_widget() {
global $fp_params;
$y = isset($fp_params ['y']) ? $fp_params ['y'] : date('y');
$m = isset($fp_params ['m']) ? $fp_params ['m'] : date('m');
global $fpdb;
$q = new FPDB_Query(array(
'fullparse' => false,
'y' => $y,
'm' => $m,
'count' => -1
), null);
$days = array();
while ($q->hasmore($queryId)) {
list ($id, $entry) = $q->getEntry($queryId);
$date = date_from_id($id);
$d = (int) $date ['d'];
$days [$d] = array(
get_day_link($y, $m, str_pad($d, 2, '0', STR_PAD_LEFT)),
'linked-day'
);
$count++;
}
// load plugin strings
// they're located under plugin.PLUGINNAME/lang/LANGID/
$lang = lang_load('plugin:calendar');
$widget = array();
$widget ['subject'] = $lang ['plugin'] ['calendar'] ['subject'];
$widget ['content'] = '<ul id="widget_calendar"><li>' . generate_calendar($y, $m, $days) . '</li></ul>';
return $widget;
}

View File

@ -1,34 +1,32 @@
<?php
/*
Plugin Name: Categories
Plugin URI: http://www.nowhereland.it/
Type: Block
Description: Lists your categories in a widget.
Author: NoWhereMan
Version: 1.0
Author URI: http://www.nowhereland.it/
*/
* Plugin Name: Categories
* Type: Block
* Version: 1.0
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Lists your categories in a widget. Part of the standard distribution.
*/
function plugin_categories_widget() {
global $smarty;
// set this to true if you want show the number
// of categories for each category; please notice:
// not cheap on the server, it should be cached
// somewhere else
// default: disabled
$smarty->assign('categories_showcount', false);
// load plugin strings
// they're located under plugin.PLUGINNAME/lang/LANGID/
$lang = lang_load('plugin:categories');
$entry['subject'] = $lang['plugin']['categories']['subject'];
$entry['content'] = $smarty->fetch('plugin:categories/widget');
$entry ['subject'] = $lang ['plugin'] ['categories'] ['subject'];
$entry ['content'] = $smarty->fetch('plugin:categories/widget');
return $entry;
}

View File

@ -4,9 +4,9 @@
* Plugin Name: Comment Center
* Version: 1.1.2
* Plugin URI: https://www.flatpress.org
* Description: Manage your blog's comments: Set policies, publish or reject comments.
* Author: FlatPress (credits to Piero VDFN)
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Manage your blog's comments: Set policies, publish or reject comments. Part of the standard distribution.
*/
/**

View File

@ -1,21 +1,20 @@
<?php
/*
Plugin Name: FavIcon
Plugin URI: http://www.flatpress.org/
Description: Adds a favicon to FlatPress
Author: NoWhereMan
Version: 1.0
Author URI: http://www.nowhereland.it/
*/
* Plugin Name: FavIcon
* Version: 1.0
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Adds a favicon to FlatPress. Part of the standard distribution.
*/
function plugin_favicon_head() {
// your file *must* be named favicon.ico
// your file *must* be named favicon.ico
// and be a ICO file (not a renamed png, jpg, gif, etc...)
// or it won't work in IE
echo '<link rel="shortcut icon" href="' .
plugin_geturl('favicon') .'imgs/favicon.ico" />';
echo '<link rel="shortcut icon" href="' . plugin_geturl('favicon') . 'imgs/favicon.ico" />';
}
add_action('wp_head', 'plugin_favicon_head');
?>

View File

@ -1,11 +1,11 @@
<?php
/*
* Plugin Name: FootNotes
* Version: 0.1
* Plugin URI: http://flatpress.nowhereland.it
* Description: footnotes in your entry
* Author: NoWhereMan
* Author URI: http://flatpress.nowhereland.it
* Version: 1.0
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Enables footnotes in your entries. Part of the standard distribution.
*/
define('FOOTNOTES_START', '[footnotes]');

View File

@ -1,28 +1,24 @@
<?php
/*
Plugin Name: jQuery
Version: 2.0.1
Plugin URI: http://www.vdfn.altervista.org/
Description: Provides <a href="http://jquery.com/" title="jQuery">jQuery</a> locally.
Author: Piero VDFN
Author URI: http://www.vdfn.altervista.org/
JQuery and JQueryUI version bump by Arvid Zimmermann
*/
## Original author: NoWhereMan (http://www.nowhereland.it)
* Plugin Name: jQuery
* Version: 2.0.1
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Provides <a href="http://jquery.com/" title="jQuery">jQuery</a> locally. Part of the standard distribution.
*/
// # Original author: NoWhereMan (http://www.nowhereland.it)
add_action('wp_head', 'plugin_jquery_head', 0);
function plugin_jquery_head() {
$pdir=plugin_geturl('jquery');
$pdir = plugin_geturl('jquery');
echo <<<JSUTILS
<!-- start of jsUtils -->
<script type="text/javascript" src="{$pdir}res/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="{$pdir}res/jqueryui/1.10.3/jquery-ui.min.js"></script>
<!-- end of jsUtils -->
JSUTILS;
<!-- start of jsUtils -->
<script type="text/javascript" src="{$pdir}res/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="{$pdir}res/jqueryui/1.10.3/jquery-ui.min.js"></script>
<!-- end of jsUtils -->
JSUTILS;
}
?>

View File

@ -1,32 +1,30 @@
<?php
/*
Plugin Name: LastComments
Plugin URI: http://www.nowhereland.it/
Type: Block
Description: LastComments plugin. Part of the standard distribution ;)
Author: NoWhereMan
Version: 1.0
Author URI: http://www.nowhereland.it/
*/
define('LASTCOMMENTS_CACHE_FILE', CACHE_DIR . 'lastcomments.tmp');
* Plugin Name: LastComments
* Type: Block
* Version: 1.0
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Adds a widget that shows the latest comments. Part of the standard distribution.
*/
define('LASTCOMMENTS_CACHE_FILE', CACHE_DIR . 'lastcomments.tmp');
define('LASTCOMMENTS_MAX', 8);
add_action('comment_post', 'plugin_lastcomments_cache', 0, 2);
function plugin_lastcomments_widget() {
if (false===($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) {
if (false === ($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) {
// no comments in cache
$list = array();
$list = array();
} else {
// if file exists and its correctly read, we get the stored list
// (it is stored in encoded form)
$list = unserialize($f);
}
$content = '<ul class="last-comments">';
// cimangi Aggiunta traduzione stringhe
// load plugin strings
@ -36,48 +34,47 @@ function plugin_lastcomments_widget() {
if ($count = count($list)) {
while ($arr = array_pop($list)) {
theme_comments_filters($arr, $id);
$q = new FPDB_Query(array('id' => $arr['entry']), null);
$q = new FPDB_Query(array(
'id' => $arr ['entry']
), null);
// first element of the array is dropped, as it is the ID, which
// we already know
@list(, $entry) = $q->getEntry($query);
if (!$entry){
@list (, $entry) = $q->getEntry($query);
if (!$entry) {
$count--;
$update = true;
$update = true;
continue;
}
$content .=
"<li>
$content .= "<li>
<blockquote class=\"comment-quote\" cite=\"comments.php?entry={$arr['entry']}#{$arr['id']}\">
{$arr['content']}
<p><a href=\"".get_comments_link($arr['entry']).
"#{$arr['id']}\">{$arr['name']} - {$entry['subject']}</a></p>
<p><a href=\"" . get_comments_link($arr ['entry']) . "#{$arr['id']}\">{$arr['name']} - {$entry['subject']}</a></p>
</blockquote></li>\n";
}
$subject = $lang['plugin']['lastcomments']['last'] . ' ' . $count . ' '. $lang['plugin']['lastcomments']['comments'];
$subject = $lang ['plugin'] ['lastcomments'] ['last'] . ' ' . $count . ' ' . $lang ['plugin'] ['lastcomments'] ['comments'];
}
if (!$count) {
if ($update)
fs_delete(LASTCOMMENTS_CACHE_FILE);
$content .= '<li>' . $lang['plugin']['lastcomments']['no_comments'] .'</li>';
$subject = $lang['plugin']['lastcomments']['no_new_comments'];
}
$content .= '<li>' . $lang ['plugin'] ['lastcomments'] ['no_comments'] . '</li>';
$subject = $lang ['plugin'] ['lastcomments'] ['no_new_comments'];
}
$content .= '</ul>';
$entry['subject'] = $subject;
$entry['content'] = $content;
$entry ['subject'] = $subject;
$entry ['content'] = $content;
return $entry;
}
/**
* function plugin_lastcomments_cache
*
*
* comment cache is a reverse queue; we put
* element on the top, and we delete elements
* from bottom; this is because the output
@ -85,104 +82,102 @@ function plugin_lastcomments_widget() {
* All this headache stuff just to say that
* in the end the widget will show up elements ordered
* from newer to older :P
*
* @param $entryid string entry id i.e. entryNNNNNN-NNNNNN
* @param $comment array where $comment[0] is $commentid i.e. commentNNNNNN-NNNNNN
* and $comment[1] is the actual content array
*
* @param $entryid string
* entry id i.e. entryNNNNNN-NNNNNN
* @param $comment array
* where $comment[0] is $commentid i.e. commentNNNNNN-NNNNNN
* and $comment[1] is the actual content array
*/
function plugin_lastcomments_cache($entryid, $comment) {
// max num of chars per comment
$CHOP_AT = 30;
list($id, $content) = $comment;
list ($id, $content) = $comment;
comment_clean($content);
if (false===($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) {
if (false === ($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) {
// no comments in cache
$list = array();
$list = array();
} else {
// if file exists and its correctly read, we get the stored list
// (it is stored in encoded form)
$list = unserialize($f);
if (count($list)+1 > LASTCOMMENTS_MAX) {
if (count($list) + 1 > LASTCOMMENTS_MAX) {
// comments are more than allowed maximum:
// we delete the last in queue.
// we delete the last in queue.
array_shift($list);
}
}
if (strlen($content['content']) > $CHOP_AT) {
$string = substr($content['content'], 0, $CHOP_AT) . '...';
} else {$string = $content['content'];}
array_push($list, array('name'=>$content['name'],
'content'=>$string,
'id'=> $id,
'entry'=> $entryid)
);
if (strlen($content ['content']) > $CHOP_AT) {
$string = substr($content ['content'], 0, $CHOP_AT) . '...';
} else {
$string = $content ['content'];
}
array_push($list, array(
'name' => $content ['name'],
'content' => $string,
'id' => $id,
'entry' => $entryid
));
return io_write_file(LASTCOMMENTS_CACHE_FILE, serialize($list));
}
register_widget('lastcomments', 'LastComments', 'plugin_lastcomments_widget');
function plugin_lastcomments_rss () {
function plugin_lastcomments_rss() {
global $smarty;
if (false===($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) {
if (false === ($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) {
// no comments in cache
$list = array();
$list = array();
} else {
// if file exists and its correctly read, we get the stored list
// (it is stored in encoded form)
$list = unserialize($f);
}
$newlist = array();
foreach($list as $c) {
$newlist[] = comment_parse($list['entryid'], $list['id']);
foreach ($list as $c) {
$newlist [] = comment_parse($list ['entryid'], $list ['id']);
}
$smarty->assign('lastcomments_list', $newlist);
}
/*
function plugin_lastcomments_def_rss_link() {
return BLOG_BASEURL . "?feed=lastcomments-rss2";
}
function plugin_lastcomments_rss_link() {
return apply_filters('plugin_lastcomments_rss_link', '');
}
add_action('wp_head', 'plugin_lastcomments_rsshead');
function plugin_lastcomments_rsshead() {
echo "\n<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Get RSS 2.0 Feed\" href=\"".
plugin_lastcomments_rss_link()
."\" />\n";
}
add_action('init', 'plugin_lastcomments_rssinit');
function plugin_lastcomments_rssinit() {
global $smarty;
if (isset($_GET['feed']) && $_GET['feed']=='lastcomments-rss2') {
$smarty->display('plugin:lastcomments/plugin.lastcomments-feed');
exit();
}
}
*/
*
* function plugin_lastcomments_def_rss_link() {
* return BLOG_BASEURL . "?feed=lastcomments-rss2";
* }
*
* function plugin_lastcomments_rss_link() {
* return apply_filters('plugin_lastcomments_rss_link', '');
* }
*
* add_action('wp_head', 'plugin_lastcomments_rsshead');
* function plugin_lastcomments_rsshead() {
* echo "\n<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Get RSS 2.0 Feed\" href=\"".
* plugin_lastcomments_rss_link()
* ."\" />\n";
* }
*
* add_action('init', 'plugin_lastcomments_rssinit');
* function plugin_lastcomments_rssinit() {
* global $smarty;
*
* if (isset($_GET['feed']) && $_GET['feed']=='lastcomments-rss2') {
* $smarty->display('plugin:lastcomments/plugin.lastcomments-feed');
* exit();
* }
* }
*
*/
?>

View File

@ -1,65 +1,68 @@
<?php
/*
Plugin Name: Last Comments Admin
Version: 0.1
Plugin URI: http://kirgroup.com/blog/
Description: Manage last comments cache. Require LastComment plugin.
Author: Fabrixxm
Author URI: http://kirgroup.com/blog/
*/
* Plugin Name: LastComments Admin
* Version: 1.0
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Manage the cache of the LastComments plugin. Requires LastComment plugin enabled. Part of the standard distribution.
*/
if (class_exists('AdminPanelAction')) {
class admin_plugin_lastcommentsadmin extends AdminPanelAction {
if (class_exists('AdminPanelAction')){
class admin_plugin_lastcommentsadmin extends AdminPanelAction {
var $langres = 'plugin:lastcommentsadmin';
function setup() {
$this->smarty->assign('admin_resource', "plugin:lastcommentsadmin/admin.plugin.lastcommentsadmin");
}
function main() {
if (!function_exists('plugin_lastcomments_cache')){
if (!function_exists('plugin_lastcomments_cache')) {
$this->smarty->assign('success', -2);
}
}
function onsubmit($data = NULL) {
global $fp_config;
if (isset($_POST['lastcommentadmin_clear'])){
if (isset($_POST ['lastcommentadmin_clear'])) {
fs_delete(LASTCOMMENTS_CACHE_FILE);
$this->smarty->assign('success', 1);
}
if (isset($_POST['lastcommentadmin_rebuild'])){
if (isset($_POST ['lastcommentadmin_rebuild'])) {
fs_delete(LASTCOMMENTS_CACHE_FILE);
$coms = Array();
$q = new FPDB_Query(array('fullparse'=>false,'start'=>0,'count'=>-1), null);
$q = new FPDB_Query(array(
'fullparse' => false,
'start' => 0,
'count' => -1
), null);
while ($q->hasmore()) {
list($id,$e) = $q->getEntry();
list ($id, $e) = $q->getEntry();
$obj = new comment_indexer($id);
foreach($obj->getList() as $value){
$coms[$value]=$id;
foreach ($obj->getList() as $value) {
$coms [$value] = $id;
}
ksort($coms);
$coms = array_slice($coms, -LASTCOMMENTS_MAX );
$coms = array_slice($coms, -LASTCOMMENTS_MAX);
}
foreach($coms as $cid=>$eid){
foreach ($coms as $cid => $eid) {
$c = comment_parse($eid, $cid);
plugin_lastcomments_cache($eid, array($cid, $c));
plugin_lastcomments_cache($eid, array(
$cid,
$c
));
}
$this->smarty->assign('success', 2);
}
return 2;
}
}
admin_addpanelaction('plugin', 'lastcommentsadmin', true);
}

View File

@ -1,65 +1,68 @@
<?php
/*
Plugin Name: LastEntries
Plugin URI: http://www.nowhereland.it/
Type: Block
Description: LastEntries plugin. Part of the standard distribution ;)
Author: NoWhereMan
Version: 1.0
Author URI: http://www.nowhereland.it/
*/
/*
* Plugin Name: LastEntries
* Version: 1.0
* Type: Block
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Adds a widget that lists the latest entries. Part of the standard distribution.
*/
function plugin_lastentries_widget() {
global $fpdb;
// load plugin strings
// they're located under plugin.PLUGINNAME/lang/LANGID/
$lang = lang_load('plugin:lastentries');
$num = 10;
####################
// ###################
/*
$queryId = $fpdb->query("fullparse:false,start:0,count:$num");
$fpdb->doquery($queryId);
$fpdb->getQuery
*/
$q = new FPDB_Query(array('fullparse'=>false,'start'=>0,'count'=>$num), null);
* $queryId = $fpdb->query("fullparse:false,start:0,count:$num");
* $fpdb->doquery($queryId);
*
* $fpdb->getQuery
*/
$q = new FPDB_Query(array(
'fullparse' => false,
'start' => 0,
'count' => $num
), null);
$string = '<ul>';
$count = 0;
while ($q->hasmore()) {
list($id, $entry) = $q->getEntry();
list ($id, $entry) = $q->getEntry();
$link = get_permalink($id);
$string .='<li>';
$string .= '<li>';
$admin = BLOG_BASEURL . "admin.php?p=entry&amp;entry=";
if (user_loggedin()) // if loggedin prints a "edit" link
$string .= "<a href=\"{$admin}{$id}\">[".$lang['plugin']['lastentries']['edit']."]</a>";
$string .= "<a href=\"{$admin}{$id}\">[" . $lang ['plugin'] ['lastentries'] ['edit'] . "]</a>";
$string .= "<a href=\"{$link}\">{$entry['subject']}</a></li>\n";
$count++;
}
if ($string == '<ul>'){
$string .= '<li><a href="admin.php?p=entry&amp;action=write">'.$lang['plugin']['lastentries']['add_entry'].'</a></li>';
$subject = $lang['plugin']['lastentries']['no_entries'];
} else $subject = $lang['plugin']['lastentries']['subject_before_count'] . $count . $lang['plugin']['lastentries']['subject_after_count'];
if ($string == '<ul>') {
$string .= '<li><a href="admin.php?p=entry&amp;action=write">' . $lang ['plugin'] ['lastentries'] ['add_entry'] . '</a></li>';
$subject = $lang ['plugin'] ['lastentries'] ['no_entries'];
} else
$subject = $lang ['plugin'] ['lastentries'] ['subject_before_count'] . $count . $lang ['plugin'] ['lastentries'] ['subject_after_count'];
$string .= '</ul>';
$widget = array();
$widget['subject'] = $subject;
$widget['content'] = $string;
$widget ['subject'] = $subject;
$widget ['content'] = $string;
return $widget;
}

View File

@ -1,47 +1,45 @@
<?php
/*
Plugin Name: LightBox2
Version: 2.0
Plugin URI: http://www.vdfn.altervista.org/
Description: Lightbox overlays using <a href="http://www.digitalia.be/software/slimbox2">SlimBox 2</a> requires <a href="http://jquery.com" title="jQuery">jQuery</a> (modified jsutils plugin)
Author: Piero VDFN
Author URI: http://www.vdfn.altervista.org/
*/
## Original author: NoWhereMan (http://www.nowhereland.it)
/*
* Plugin Name: LightBox2
* Version: 2.0
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Lightbox overlays using <a href="http://www.digitalia.be/software/slimbox2">SlimBox 2</a> requires <a href="http://jquery.com" title="jQuery">jQuery</a> (modified jsutils plugin). Part of the standard distribution.
*/
// # Original author: NoWhereMan (http://www.nowhereland.it)
// if PLUGINS_DIR is not fp-plugins please edit res/lightbox.js
function plugin_lightbox2_setup() {
return function_exists('plugin_jquery_head')? 1:-1;
return function_exists('plugin_jquery_head') ? 1 : -1;
}
function plugin_lightbox2_head() {
$pdir=plugin_geturl('lightbox2');
$pdir = plugin_geturl('lightbox2');
echo <<<LBOXHEAD
<!-- start of lightbox -->
<link rel="stylesheet" type="text/css" href="{$pdir}res/slimbox2.css" />
<!-- end of lightbox -->
LBOXHEAD;
<!-- start of lightbox -->
<link rel="stylesheet" type="text/css" href="{$pdir}res/slimbox2.css" />
<!-- end of lightbox -->
LBOXHEAD;
}
add_action('wp_head', 'plugin_lightbox2_head');
function plugin_lightbox2_footer() {
$pdir=plugin_geturl('lightbox2');
$pdir = plugin_geturl('lightbox2');
echo <<<LBOXHEAD
<!-- start of lightbox -->
<script type="text/javascript" src="{$pdir}res/slimbox2.js"></script>
<!-- end of lightbox -->
LBOXHEAD;
<!-- start of lightbox -->
<script type="text/javascript" src="{$pdir}res/slimbox2.js"></script>
<!-- end of lightbox -->
LBOXHEAD;
}
add_action('wp_footer', 'plugin_lightbox2_footer');
function plugin_lightbox2_hook($popup, $abspath) {
global $lightbox_rel;
// the other $popup is just dropped
return $lightbox_rel? "rel=\"lightbox[$lightbox_rel]\"" : ' rel="lightbox"';
return $lightbox_rel ? "rel=\"lightbox[$lightbox_rel]\"" : ' rel="lightbox"';
}
add_action('bbcode_img_popup', 'plugin_lightbox2_hook', 5, 2);

View File

@ -1,60 +1,55 @@
<?php
/*
Plugin Name: Media Manager
Version: 0.4
Plugin URI: http://kirgroup.com/blog/
Description: Manage uloaded files ad photo galleries
Author: Fabrix.xm
Author URI: http://kirgroup.com/fabrixxm/
*/
* Plugin Name: Media Manager
* Version: 1.0
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Manage uploaded files and photo galleries. Part of the standard distribution.
*/
// config
define('ITEMSPERPAGE', 10);
//
function mediamanager_updateUseCountArr(&$files,$fupd){
function mediamanager_updateUseCountArr(&$files, $fupd) {
$params = array();
$params['start']=0;
$params['count']=-1;
$params['fullparse'] = true;
$params ['start'] = 0;
$params ['count'] = -1;
$params ['fullparse'] = true;
$q = new FPDB_Query($params, null);
while ($q->hasMore()) {
list($id, $e) = $q->getEntry();
if (isset($e['content'])){
foreach($fupd as $id){
if (is_null($files[$id]['usecount'])) $files[$id]['usecount']=0;
if ($files[$id]['type']=='gallery'){
$searchterm="[gallery=images/".$files[$id]['name'];
list ($id, $e) = $q->getEntry();
if (isset($e ['content'])) {
foreach ($fupd as $id) {
if (is_null($files [$id] ['usecount']))
$files [$id] ['usecount'] = 0;
if ($files [$id] ['type'] == 'gallery') {
$searchterm = "[gallery=images/" . $files [$id] ['name'];
} else {
$searchterm=$files[$id]['type']."/".$files[$id]['name'];
$searchterm = $files [$id] ['type'] . "/" . $files [$id] ['name'];
}
if (strpos($e['content'], $searchterm) !== false) $files[$id]['usecount']++;
if (strpos($e ['content'], $searchterm) !== false)
$files [$id] ['usecount']++;
}
}
}
$usecount=array();
foreach($files as $info){
$usecount[$info['name']]=$info['usecount'];
$usecount = array();
foreach ($files as $info) {
$usecount [$info ['name']] = $info ['usecount'];
}
plugin_addoption('mediamanager', 'usecount', $usecount);
plugin_saveoptions('mediamanager');
}
if (class_exists('AdminPanelAction')) {
if (class_exists('AdminPanelAction')){
include(plugin_getdir('mediamanager') .'/panels/panel.mediamanager.file.php');
include (plugin_getdir('mediamanager') . '/panels/panel.mediamanager.file.php');
}
/* invalidate count on entry save and delete */
function mediamanager_invalidatecount($arg){
function mediamanager_invalidatecount($arg) {
plugin_addoption('mediamanager', 'usecount', array());
plugin_saveoptions('mediamanager');
return $arg;
@ -62,5 +57,4 @@ function mediamanager_invalidatecount($arg){
add_filter('delete_post', 'mediamanager_invalidatecount', 1);
add_filter('content_save_pre', 'mediamanager_invalidatecount', 1);
?>

View File

@ -1,25 +1,24 @@
<?php
/*
Plugin Name: PostViews
Plugin URI: http://www.nowhereland.it/
Description: PostViews plugin.
Author: NoWhereMan
Version: 1.0
Author URI: http://www.nowhereland.it/
*/
* Plugin Name: PostViews
* Version: 1.0
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Counts and displays entry views. Part of the standard distribution.
*/
add_action('entry_block', 'plugin_postviews_do');
function plugin_postviews_calc($id, $calc) {
$dir = entry_dir($id);
if (!$dir) return;
$f = $dir . '/view_counter' .EXT;
if (!$dir)
return;
$f = $dir . '/view_counter' . EXT;
$v = io_load_file($f);
if ($v===false){
if ($v === false) {
$v = 0;
} elseif ($v < 0) {
// file was locked. Do not increase views.
@ -28,28 +27,24 @@ function plugin_postviews_calc($id, $calc) {
$v = 0;
$calc = false;
}
if ($calc && !user_loggedin()) {
$v++;
io_write_file($f, $v);
}
return $v;
}
function plugin_postviews_do($id) {
global $fpdb, $smarty;
$q = $fpdb->getQuery();
$calc = $q->single;
$v = plugin_postviews_calc($id, $calc);
$smarty->assign('views', $v);
$v = plugin_postviews_calc($id, $calc);
$smarty->assign('views', $v);
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,23 @@
<?php
/*
Plugin Name: QuickSpamFilter
Plugin URI: http://flatpress.nowherland.it/
Description: Quick ban words (edit the plugin to add more to the list)
Author: NoWhereMan
Version: 3.5.1
Author URI: http://www.nowhereland.it
*/
* Plugin Name: QuickSpamFilter
* Version: 3.5.1
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Block comments by "bad" words. Part of the standard distribution.
*/
/**
* This plugin denies comments when they're containing "bad words",
* e.g. "href" (which indexes links)., etc.
* e.g.
* "href" (which indexes links)., etc.
*
* @global $smarty
* @param boolean $bool
* @param string $contents The comment
* @param string $contents
* The comment
* @return unknown
*/
function plugin_qspam_validate($bool, $contents) {
@ -24,88 +27,89 @@ function plugin_qspam_validate($bool, $contents) {
$qscfg = plugin_getoptions('qspam');
// We're looking for these words:
$BAN_WORDS = '';
if (isset($qscfg['wordlist'])) {
$BAN_WORDS = $qscfg['wordlist'];
if (isset($qscfg ['wordlist'])) {
$BAN_WORDS = $qscfg ['wordlist'];
} else {
// rudimentary ban of links
$BAN_WORDS = array('href', '[url');
$BAN_WORDS = array(
'href',
'[url'
);
}
$qscfg['number'] = isset($qscfg['number'])
? $qscfg['number']
: 1;
$txt = strtolower(trim($contents['content']));
$qscfg ['number'] = isset($qscfg ['number']) ? $qscfg ['number'] : 1;
$txt = strtolower(trim($contents ['content']));
$count = 0;
while ($w = array_pop($BAN_WORDS)) {
$count += substr_count($txt, strtolower($w));
}
if ($count >= $qscfg['number']) {
if ($count >= $qscfg ['number']) {
global $smarty;
$lang = lang_load('plugin:qspam');
$smarty->assign('error', array($lang['plugin']['qspam']['error']));
$smarty->assign('error', array(
$lang ['plugin'] ['qspam'] ['error']
));
return false;
}
return true;
}
add_action('comment_validate', 'plugin_qspam_validate', 5, 2);
if (class_exists('AdminPanelAction')){
if (class_exists('AdminPanelAction')) {
/**
* Provides an admin panel entry for QuickSpam setup.
*/
class admin_plugin_qspam extends AdminPanelAction {
var $langres = 'plugin:qspam';
/**
* Initializes this panel.
*/
function setup() {
$this->smarty->assign('admin_resource', "plugin:qspam/admin.plugin.qspam");
}
/**
* Setups the default panel.
*/
function main() {
$qscfg = plugin_getoptions('qspam');
$qscfg['wordlist'] = isset($qscfg['wordlist']) && is_array($qscfg['wordlist'])
? implode("\n", $qscfg['wordlist'])
: '';
$qscfg['number'] = isset($qscfg['number'])
? $qscfg['number']
: 1;
$qscfg ['wordlist'] = isset($qscfg ['wordlist']) && is_array($qscfg ['wordlist']) ? implode("\n", $qscfg ['wordlist']) : '';
$qscfg ['number'] = isset($qscfg ['number']) ? $qscfg ['number'] : 1;
$this->smarty->assign('qscfg', $qscfg);
}
/**
* Will be executed when the QSF configuration is send.
*
* @return int
*/
function onsubmit($data = null) {
if ($_POST['qs-wordlist']){
$wordlist = isset($_POST['qs-wordlist'])
? stripslashes($_POST['qs-wordlist'])
: '';
if ($_POST ['qs-wordlist']) {
$wordlist = isset($_POST ['qs-wordlist']) ? stripslashes($_POST ['qs-wordlist']) : '';
$wordlist = str_replace("\r", "\n", $wordlist);
// DMKE: Works neither recursive correct nor in a loop... *grrr*
#$wordlist = str_replace("\n\n", "\n", $wordlist);
// $wordlist = str_replace("\n\n", "\n", $wordlist);
$wordlist = explode("\n", $wordlist);
$wordlist = array_filter($wordlist, array($this, '_array_filter'));
$number = isset($_POST['qs-number']) && is_numeric($_POST['qs-number'])
? (int)$_POST['qs-number']
: 1;
$wordlist = array_filter($wordlist, array(
$this,
'_array_filter'
));
$number = isset($_POST ['qs-number']) && is_numeric($_POST ['qs-number']) ? (int) $_POST ['qs-number'] : 1;
plugin_addoption('qspam', 'wordlist', $wordlist);
plugin_addoption('qspam', 'number', $number);
plugin_saveoptions('qspam');
$this->smarty->assign('success', 1);
} else {
$this->smarty->assign('success', -1);
$this->smarty->assign('success', -1);
}
return 2;
}
/**
* Array filter callback function. Culls empty array values.
* Array filter callback function.
* Culls empty array values.
* Life is hell ._.
*
* @param string $str
@ -114,6 +118,7 @@ if (class_exists('AdminPanelAction')){
function _array_filter($str) {
return strlen(trim($str)) > 0;
}
}
admin_addpanelaction('plugin', 'qspam', true);
}

View File

@ -2,11 +2,11 @@
/*
* Plugin Name: ReadMore
* Plugin URI: http://www.nowhereland.it/
* Description: ReadMore plugin. Chops a lengthy entry and appends a "read more" link :)
* Author: NoWhereMan
* Version: 0.703
* Author URI: http://www.nowhereland.it/
* Version: 1.0
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Chops lengthy entries in the overview and appends a "read more" link. Part of the standard distribution.
*/
// $MODE specifies when you want to chop your entry

View File

@ -2,10 +2,10 @@
/*
* Plugin Name: SearchBox
* Version: 1.0
* Plugin URI: http://flatpress.sf.net
* Description: SearchBox which interfaces with standard search function
* Author: NoWhereMan
* Author URI: http://flatpress.sf.net
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Adds a search box widget. Part of the standard distribution.
*/
define('SEARCHBOX_BIG', false);

View File

@ -1,28 +1,24 @@
<?php
/*
Plugin Name: Thumbnails
Plugin URI: http://www.nowhereland.it/
Description: Thumbnail plugin. Part of the standard distribution ;) If this is loaded scale parameter of images will create a scaled version of your img
Author: NoWhereMan real_nowhereman at user dot sf dot net
Version: 1.0
Author URI: http://www.nowhereland.it/
*/
* Plugin Name: Thumbnails
* Version: 1.0
* Plugin URI: https://www.flatpress.org
* Author: FlatPress
* Author URI: https://www.flatpress.org
* Description: Creates thumbnails for scaled images. Part of the standard distribution.
*/
define('THUMB_DIR', '.thumbs');
if (!function_exists('imagegd2'))
{ define('PLUGIN_THUMB_ENABLED', false); }
else { define('PLUGIN_THUMB_ENABLED', true); }
function plugin_thumb_setup() {
return PLUGIN_THUMB_ENABLED? 1 : -1;
if (!function_exists('imagegd2')) {
define('PLUGIN_THUMB_ENABLED', false);
} else {
define('PLUGIN_THUMB_ENABLED', true);
}
function plugin_thumb_setup() {
return PLUGIN_THUMB_ENABLED ? 1 : -1;
}
/**
*
@ -30,21 +26,21 @@ function plugin_thumb_setup() {
*
* creates a thumbnail and caches the thumbnail in IMAGES_DIR/.thumb
*
* @param string $fpath string with filepath
* @param array $infos infos from getimagesize($fpath) function
* @param string $fpath
* string with filepath
* @param array $infos
* infos from getimagesize($fpath) function
* @param int $new_width
* @param int $new_height
*
* @return array array(string $thumbpath, int $thumbwidth, int $thumbheight)
*
*
*/
function plugin_thumb_create($fpath, $infos, $new_width, $new_height) {
if (!defined('PLUGIN_THUMB_ENABLED')) {
return array();
}
if (!file_exists($fpath)) {
return array();
}
@ -53,38 +49,42 @@ function plugin_thumb_create($fpath, $infos, $new_width, $new_height) {
trigger_error("Size can't be 0 but got width=$new_width height=$new_height\n", E_USER_WARNING);
return;
}
$thumbname = basename($fpath);
$thumbdir = dirname($fpath) . '/' . THUMB_DIR ;
$thumbpath = $thumbdir .'/'. $thumbname;
$thumbname = basename($fpath);
$thumbdir = dirname($fpath) . '/' . THUMB_DIR;
$thumbpath = $thumbdir . '/' . $thumbname;
if (file_exists($thumbpath)) {
$oldthumbinfo = getimagesize($thumbpath);
if ($new_width==$oldthumbinfo[0]) {
if ($new_width == $oldthumbinfo [0]) {
// already scaled
return array($thumbpath, $new_width, $new_height);
return array(
$thumbpath,
$new_width,
$new_height
);
}
}
@fs_mkdir($thumbdir);
// we support only jpeg's, png's and gif's
switch($infos[2]) {
case 1: $image = imagecreatefromgif($fpath); break;
case 2: $image = imagecreatefromjpeg ($fpath); break;
case 3: $image = imagecreatefrompng($fpath);
switch ($infos [2]) {
case 1:
$image = imagecreatefromgif($fpath);
break;
case 2:
$image = imagecreatefromjpeg($fpath);
break;
case 3:
$image = imagecreatefrompng($fpath);
}
//$image = imagecreatefromgd2 ($fpath);
// $image = imagecreatefromgd2 ($fpath);
// create empty scaled and copy(resized) the picture
$scaled = imagecreatetruecolor($new_width, $new_height);
/*
* If gif or png preserve the alpha channel
@ -92,35 +92,37 @@ function plugin_thumb_create($fpath, $infos, $new_width, $new_height) {
* Added by Piero VDFN
* Kudos to http://www.php.net/manual/en/function.imagecopyresampled.php#104028
*/
if($infos[2]==1 || $infos[2]==3) {
if ($infos [2] == 1 || $infos [2] == 3) {
imagecolortransparent($scaled, imagecolorallocatealpha($scaled, 0, 0, 0, 127));
imagealphablending($scaled, false);
imagesavealpha($scaled, true);
$output=$infos[2]==3 ? 'png' : 'gif';
$output = $infos [2] == 3 ? 'png' : 'gif';
} else {
$output='jpg';
$output = 'jpg';
}
imagecopyresampled($scaled, $image, 0, 0, 0, 0, $new_width, $new_height, $infos[0], $infos[1]);
imagecopyresampled($scaled, $image, 0, 0, 0, 0, $new_width, $new_height, $infos [0], $infos [1]);
if($output=='png') {
if ($output == 'png') {
imagepng($scaled, $thumbpath);
} elseif($output=='gif') {
} elseif ($output == 'gif') {
imagegif($scaled, $thumbpath);
} else {
imagejpeg($scaled, $thumbpath);
}
@chmod($thumbpath, FILE_PERMISSIONS);
return array($thumbpath, $new_width, $new_height);
return array(
$thumbpath,
$new_width,
$new_height
);
}
function plugin_thumb_bbcodehook($actualpath, $props, $newsize){
list($width, $height) = $newsize;
function plugin_thumb_bbcodehook($actualpath, $props, $newsize) {
list ($width, $height) = $newsize;
if ($thumb = plugin_thumb_create($actualpath, $props, $width, $height))
$thumb = BBCODE_USE_WRAPPER?
("getfile.php?f=" . basename($actualpath) .'&amp;thumb=true') : $thumb[0];
$thumb = BBCODE_USE_WRAPPER ? ("getfile.php?f=" . basename($actualpath) . '&amp;thumb=true') : $thumb [0];
return $thumb;
}