Description and authors of all default plugins reworked. (Original plugin authors are mentioned in CONTRIBUTORS.md from now on.)
This commit is contained in:
		
							parent
							
								
									6830a2b0e8
								
							
						
					
					
						commit
						c2accdedcc
					
				@ -1,20 +1,18 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: Accessible Antispam
 | 
					 * Plugin Name: Accessible Antispam
 | 
				
			||||||
Plugin URI: http://flatpress.nowherland.it/
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Description: Antispam asking to answer a simple math question.
 | 
					 * Author: FlatPress
 | 
				
			||||||
Author: NoWhereMan  (E.Vacchi)
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Version: 3.0
 | 
					 * Description: Antispam asking to answer a simple math question. Part of the standard distribution.
 | 
				
			||||||
Author URI: http://www.nowhereland.it
 | 
					 * Version: 3.0
 | 
				
			||||||
*/
 | 
					 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
define('AASPAM_DEBUG', false);
 | 
					define('AASPAM_DEBUG', false);
 | 
				
			||||||
define('AASPAM_LOG', CACHE_DIR . 'aaspamlog.txt');
 | 
					define('AASPAM_LOG', CACHE_DIR . 'aaspamlog.txt');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_action('comment_validate', 'plugin_aaspam_validate', 5, 2);
 | 
					add_action('comment_validate', 'plugin_aaspam_validate', 5, 2);
 | 
				
			||||||
add_action('comment_form', 'plugin_aaspam_comment_form');
 | 
					add_action('comment_form', 'plugin_aaspam_comment_form');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
function plugin_aaspam_validate($bool, $arr) {
 | 
					function plugin_aaspam_validate($bool, $arr) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// if boolean $bool==false
 | 
						// if boolean $bool==false
 | 
				
			||||||
@ -36,23 +34,22 @@ function plugin_aaspam_validate($bool, $arr) {
 | 
				
			|||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// we test the result wether match user input
 | 
						// we test the result wether match user input
 | 
				
			||||||
	if (!($ret = $_POST['aaspam']==$v)) {
 | 
						if (!($ret = $_POST ['aaspam'] == $v)) {
 | 
				
			||||||
		global $smarty;
 | 
							global $smarty;
 | 
				
			||||||
		$lang = lang_load('plugin:accessibleantispam');
 | 
							$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') ) {
 | 
						if (AASPAM_DEBUG && $f = @fopen(AASPAM_LOG, 'a')) {
 | 
				
			||||||
			$arr['aaspam-q'] = $_POST['aaspam'];
 | 
							$arr ['aaspam-q'] = $_POST ['aaspam'];
 | 
				
			||||||
			$arr['aaspam-a'] = $v;
 | 
							$arr ['aaspam-a'] = $v;
 | 
				
			||||||
			$arr['SUCCESS'] = $ret;
 | 
							$arr ['SUCCESS'] = $ret;
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			$s = date('r'). "|" . session_id().'|'.utils_kimplode($arr)."\r\n";
 | 
					 | 
				
			||||||
			@fwrite($f, $s);
 | 
					 | 
				
			||||||
			@fclose($f);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							$s = date('r') . "|" . session_id() . '|' . utils_kimplode($arr) . "\r\n";
 | 
				
			||||||
 | 
							@fwrite($f, $s);
 | 
				
			||||||
 | 
							@fclose($f);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return $ret;
 | 
						return $ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -65,40 +62,41 @@ function plugin_aaspam_comment_form() {
 | 
				
			|||||||
	// we intentionally left out division because
 | 
						// we intentionally left out division because
 | 
				
			||||||
	// it can lead to situations like division by zero
 | 
						// it can lead to situations like division by zero
 | 
				
			||||||
	// or floating point numbers
 | 
						// or floating point numbers
 | 
				
			||||||
 | 
						$myop = array_rand($ops = array(
 | 
				
			||||||
	$myop = array_rand($ops=array('+','-','*'));
 | 
							'+',
 | 
				
			||||||
	$op=$ops[$myop];
 | 
							'-',
 | 
				
			||||||
 | 
							'*'
 | 
				
			||||||
 | 
						));
 | 
				
			||||||
 | 
						$op = $ops [$myop];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// we get two random integers between 1 and 10
 | 
						// we get two random integers between 1 and 10
 | 
				
			||||||
	$v1 = mt_rand(1, 10);
 | 
						$v1 = mt_rand(1, 10);
 | 
				
			||||||
		// we rand $v2 until it differs from $v1 
 | 
						// we rand $v2 until it differs from $v1
 | 
				
			||||||
		// (otherwise result for subtractions is zero) 
 | 
						// (otherwise result for subtractions is zero)
 | 
				
			||||||
	while (($v2 = mt_rand(1, 10))==$v1); 
 | 
						while (($v2 = mt_rand(1, 10)) == $v1)
 | 
				
			||||||
 | 
							;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// if operation is subtraction
 | 
						// if operation is subtraction
 | 
				
			||||||
	// the higher number must always come first
 | 
						// the higher number must always come first
 | 
				
			||||||
	// or you'll get a negative integer
 | 
						// or you'll get a negative integer
 | 
				
			||||||
	if ($v2>$v1 && $op=='-') {
 | 
						if ($v2 > $v1 && $op == '-') {
 | 
				
			||||||
		$tmp = $v1;
 | 
							$tmp = $v1;
 | 
				
			||||||
		$v1 = $v2;
 | 
							$v1 = $v2;
 | 
				
			||||||
		$v2 = $tmp;
 | 
							$v2 = $tmp;
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// execute the operation
 | 
						// execute the operation
 | 
				
			||||||
	switch($op) {
 | 
						switch ($op) {
 | 
				
			||||||
		case '+' :
 | 
							case '+':
 | 
				
			||||||
			$v = $v1+$v2;
 | 
								$v = $v1 + $v2;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case '-' :
 | 
							case '-':
 | 
				
			||||||
			$v = $v1-$v2;
 | 
								$v = $v1 - $v2;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case '*' :
 | 
							case '*':
 | 
				
			||||||
			$v = $v1*$v2;
 | 
								$v = $v1 * $v2;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
						}
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	sess_add('aaspam', $v);
 | 
						sess_add('aaspam', $v);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -106,37 +104,35 @@ function plugin_aaspam_comment_form() {
 | 
				
			|||||||
	// they're located under plugin.PLUGINNAME/lang/LANGID/
 | 
						// they're located under plugin.PLUGINNAME/lang/LANGID/
 | 
				
			||||||
	$lang = lang_load('plugin:accessibleantispam');
 | 
						$lang = lang_load('plugin:accessibleantispam');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$langstrings =& $lang['plugin']['accessibleantispam'];
 | 
						$langstrings = & $lang ['plugin'] ['accessibleantispam'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// get the correct question depending on the operation
 | 
						// get the correct question depending on the operation
 | 
				
			||||||
	switch($op) {
 | 
						switch ($op) {
 | 
				
			||||||
		case '+' :
 | 
							case '+':
 | 
				
			||||||
			$question = $langstrings['sum'];
 | 
								$question = $langstrings ['sum'];
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case '-' :
 | 
							case '-':
 | 
				
			||||||
			$question = $langstrings['sub'];
 | 
								$question = $langstrings ['sub'];
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case '*' :
 | 
							case '*':
 | 
				
			||||||
			$question = $langstrings['prod'];
 | 
								$question = $langstrings ['prod'];
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// format the question with numbers at the proper positions
 | 
						// format the question with numbers at the proper positions
 | 
				
			||||||
	$question = sprintf($question, $v1, $v2);
 | 
						$question = sprintf($question, $v1, $v2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ( AASPAM_DEBUG && $f=@fopen(AASPAM_LOG, 'a') ) {
 | 
						if (AASPAM_DEBUG && $f = @fopen(AASPAM_LOG, 'a')) {
 | 
				
			||||||
		$arr['aaspam-q'] = $v;
 | 
							$arr ['aaspam-q'] = $v;
 | 
				
			||||||
		@fwrite($f, date('r'). '|'.session_id() .'|'. utils_kimplode($arr)."\r\n");
 | 
							@fwrite($f, date('r') . '|' . session_id() . '|' . utils_kimplode($arr) . "\r\n");
 | 
				
			||||||
		@fclose($f);
 | 
							@fclose($f);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// echoes the question and the form part
 | 
						// echoes the question and the form part
 | 
				
			||||||
	echo <<<STR
 | 
						echo <<<STR
 | 
				
			||||||
	<p><label class="textlabel" for="aaspam">{$lang['plugin']['accessibleantispam']['prefix']} <strong>$question (*)</strong></label><br />
 | 
							<p><label class="textlabel" for="aaspam">{$lang['plugin']['accessibleantispam']['prefix']} <strong>$question (*)</strong></label><br />
 | 
				
			||||||
		<input type="text" name="aaspam" id="aaspam" /></p>
 | 
								<input type="text" name="aaspam" id="aaspam" /></p>
 | 
				
			||||||
STR;
 | 
						STR;
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
				
			|||||||
@ -2,11 +2,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Plugin Name: AdminArea
 | 
					 * Plugin Name: AdminArea
 | 
				
			||||||
 * Plugin URI: http://www.nowhereland.it/
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
 * Description: AdminArea plugin. Part of the standard distribution ;)
 | 
					 * Author: FlatPress
 | 
				
			||||||
 * Author: NoWhereMan
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
 | 
					 * Description: AdminArea plugin. Part of the standard distribution.
 | 
				
			||||||
 * Version: 1.0
 | 
					 * Version: 1.0
 | 
				
			||||||
 * Author URI: http://www.nowhereland.it/
 | 
					 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function plugin_adminarea_widget() {
 | 
					function plugin_adminarea_widget() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,14 +1,12 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: Akismet
 | 
					 * Plugin Name: Akismet
 | 
				
			||||||
Version: 0.1
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Plugin URI: http://flatpress.sf.net
 | 
					 * Author: FlatPress
 | 
				
			||||||
Description: Integration with Akismet powerful Antispam system!
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author: NoWhereMan
 | 
					 * Description: Integration with Akismet powerful Antispam system. Part of the standard distribution.
 | 
				
			||||||
Author URI: http://flatpress.sf.net
 | 
					 * Version: 1.0
 | 
				
			||||||
*/
 | 
					 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
define('AKISMET_TIMEOUT', 10);
 | 
					define('AKISMET_TIMEOUT', 10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require plugin_getdir('akismet') . '/inc/Akismet.class.php';
 | 
					require plugin_getdir('akismet') . '/inc/Akismet.class.php';
 | 
				
			||||||
@ -16,38 +14,40 @@ require plugin_getdir('akismet') . '/inc/Akismet.class.php';
 | 
				
			|||||||
function plugin_akismet_setup() {
 | 
					function plugin_akismet_setup() {
 | 
				
			||||||
	global $fp_config;
 | 
						global $fp_config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!plugin_getoptions('akismet','apikey')) {
 | 
						if (!plugin_getoptions('akismet', 'apikey')) {
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (plugin_getoptions('akismet','apikey')) {
 | 
					if (plugin_getoptions('akismet', 'apikey')) {
 | 
				
			||||||
	add_filter('comment_validate','plugin_akismet_validate', 10, 2);
 | 
						add_filter('comment_validate', 'plugin_akismet_validate', 10, 2);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function plugin_akismet_validate($bool, $contents) {
 | 
					function plugin_akismet_validate($bool, $contents) {
 | 
				
			||||||
	
 | 
						if (!$bool)
 | 
				
			||||||
	if (!$bool) return false;
 | 
							return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	global $fp_config;
 | 
						global $fp_config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$akismet = new Akismet($fp_config['general']['www'], plugin_getoptions('akismet','apikey'));
 | 
						$akismet = new Akismet($fp_config ['general'] ['www'], plugin_getoptions('akismet', 'apikey'));
 | 
				
			||||||
	$akismet->setAuthor($contents['name']);
 | 
						$akismet->setAuthor($contents ['name']);
 | 
				
			||||||
	$akismet->setAuthorEmail(isset($contents['email'])? $contents['email'] : '');
 | 
						$akismet->setAuthorEmail(isset($contents ['email']) ? $contents ['email'] : '');
 | 
				
			||||||
	$akismet->setAuthorURL(isset($contents['url'])? $contents['url'] : '');
 | 
						$akismet->setAuthorURL(isset($contents ['url']) ? $contents ['url'] : '');
 | 
				
			||||||
	$akismet->setContent($contents['content']);
 | 
						$akismet->setContent($contents ['content']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ($v= $akismet->isSpam()){
 | 
						if ($v = $akismet->isSpam()) {
 | 
				
			||||||
		global $smarty;
 | 
							global $smarty;
 | 
				
			||||||
		$smarty->assign('error', array('ERROR: Comment is invalid'));
 | 
							$smarty->assign('error', array(
 | 
				
			||||||
 | 
								'ERROR: Comment is invalid'
 | 
				
			||||||
 | 
							));
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (class_exists('AdminPanelAction')){
 | 
					if (class_exists('AdminPanelAction')) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class admin_plugin_akismet extends AdminPanelAction {
 | 
						class admin_plugin_akismet extends AdminPanelAction {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -65,14 +65,14 @@ if (class_exists('AdminPanelAction')){
 | 
				
			|||||||
		function onsubmit() {
 | 
							function onsubmit() {
 | 
				
			||||||
			global $fp_config;
 | 
								global $fp_config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if ($_POST['wp-apikey']){
 | 
								if ($_POST ['wp-apikey']) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				plugin_addoption('akismet', 'apikey', $_POST['wp-apikey']);
 | 
									plugin_addoption('akismet', 'apikey', $_POST ['wp-apikey']);
 | 
				
			||||||
				plugin_saveoptions('akismet');
 | 
									plugin_saveoptions('akismet');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				$this->smarty->assign('success', 1);
 | 
									$this->smarty->assign('success', 1);
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
			 	$this->smarty->assign('success', -1);
 | 
									$this->smarty->assign('success', -1);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return 2;
 | 
								return 2;
 | 
				
			||||||
@ -81,5 +81,4 @@ if (class_exists('AdminPanelAction')){
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	admin_addpanelaction('plugin', 'akismet', true);
 | 
						admin_addpanelaction('plugin', 'akismet', true);
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,86 +1,84 @@
 | 
				
			|||||||
<?php
 | 
					<?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 {
 | 
					class plugin_archives_monthlist extends fs_filelister {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		var $_directory = CONTENT_DIR;
 | 
						var $_directory = CONTENT_DIR;
 | 
				
			||||||
		var $_list = array();
 | 
					 | 
				
			||||||
		var $_htmllist = array();
 | 
					 | 
				
			||||||
		var $_months = array();
 | 
					 | 
				
			||||||
		var $_year = '';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		function _checkFile($directory, $file) {
 | 
						var $_list = array();
 | 
				
			||||||
			$f = "$directory/$file";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (ctype_digit($file)) {
 | 
						var $_htmllist = array();
 | 
				
			||||||
				if ($this->_directory === $directory) {
 | 
					
 | 
				
			||||||
					// add year to the list (do not closes li, because
 | 
						var $_months = array();
 | 
				
			||||||
					// we may have nested elements)
 | 
					
 | 
				
			||||||
					$this->_year = $file;
 | 
						var $_year = '';
 | 
				
			||||||
					$lnk = get_year_link($file);
 | 
					
 | 
				
			||||||
					$this->_htmllist[$this->_year] = "<li class=\"archive-year archive-y20$file\"> <a href=\"$lnk\">20$file</a>";
 | 
						function _checkFile($directory, $file) {
 | 
				
			||||||
					return 1;
 | 
							$f = "$directory/$file";
 | 
				
			||||||
				} elseif (is_dir($f)) {
 | 
					
 | 
				
			||||||
					$this->_months[] = $file; 
 | 
							if (ctype_digit($file)) {
 | 
				
			||||||
					return 0;
 | 
								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) {
 | 
						function _exitingDir($directory = null, $file = null) {
 | 
				
			||||||
 | 
							$y = $this->_year;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			$y = $this->_year;
 | 
							if ($mos = & $this->_months) {
 | 
				
			||||||
			
 | 
								sort($mos);
 | 
				
			||||||
			if ($mos =& $this->_months) {
 | 
								$list = '';
 | 
				
			||||||
				sort($mos);
 | 
								$linearlist = array();
 | 
				
			||||||
				$list = '';
 | 
								foreach ($mos as $mth) {
 | 
				
			||||||
				$linearlist = array();
 | 
									$lnk = get_month_link($y, $mth);
 | 
				
			||||||
				foreach($mos as $mth) {
 | 
									$the_month = theme_date_format(mktime(0, 0, 0, $mth, 1, 0), '%B');
 | 
				
			||||||
					$lnk = get_month_link($y, $mth);
 | 
									$list = "<li class=\"archive-month archive-m$mth\"><a href=\"$lnk\">" . $the_month . ' </a></li>' . $list;
 | 
				
			||||||
					$the_month = theme_date_format(  mktime(0, 0, 0, $mth, 1, 0 ), '%B');
 | 
									$linearlist ["$the_month 20{$this->_year}"] = $lnk;
 | 
				
			||||||
					$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>';
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
								$list = '<ul>' . $list . '</ul>';
 | 
				
			||||||
			$mos = array();
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			// we close year's li
 | 
					 | 
				
			||||||
			$this->_list[$y] = $linearlist;
 | 
					 | 
				
			||||||
			$this->_htmllist[$y] .= $list . '</li>'; 
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		function getList() {
 | 
							$mos = array();
 | 
				
			||||||
			krsort($this->_list);
 | 
					 | 
				
			||||||
			return $this->_list;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		function getHtmlList() {
 | 
							// we close year's li
 | 
				
			||||||
			krsort($this->_htmllist);
 | 
							$this->_list [$y] = $linearlist;
 | 
				
			||||||
			return implode($this->_htmllist);
 | 
							$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() {
 | 
					function plugin_archives_head() {
 | 
				
			||||||
 | 
					 | 
				
			||||||
	global $PLUGIN_ARCHIVES_MONTHLIST;
 | 
						global $PLUGIN_ARCHIVES_MONTHLIST;
 | 
				
			||||||
	$PLUGIN_ARCHIVES_MONTHLIST = new plugin_archives_monthlist;
 | 
						$PLUGIN_ARCHIVES_MONTHLIST = new plugin_archives_monthlist();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo "\n<!-- archives -->\n";
 | 
						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)
 | 
							foreach ($months as $ttl => $link)
 | 
				
			||||||
			echo "<link rel=\"archives\" title=\"{$ttl}\" href=\"{$link}\" />\n";
 | 
								echo "<link rel=\"archives\" title=\"{$ttl}\" href=\"{$link}\" />\n";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -90,19 +88,14 @@ function plugin_archives_head() {
 | 
				
			|||||||
add_filter('wp_head', 'plugin_archives_head');
 | 
					add_filter('wp_head', 'plugin_archives_head');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function plugin_archives_widget() {
 | 
					function plugin_archives_widget() {
 | 
				
			||||||
 | 
					 | 
				
			||||||
	lang_load('plugin:archives');
 | 
						lang_load('plugin:archives');
 | 
				
			||||||
	global $lang, $PLUGIN_ARCHIVES_MONTHLIST;
 | 
						global $lang, $PLUGIN_ARCHIVES_MONTHLIST;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	return array(
 | 
						return array(
 | 
				
			||||||
		'subject' => $lang['plugin']['archives']['subject'],
 | 
							'subject' => $lang ['plugin'] ['archives'] ['subject'],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		'content' => ($list = $PLUGIN_ARCHIVES_MONTHLIST->getHtmlList()) ? 
 | 
							'content' => ($list = $PLUGIN_ARCHIVES_MONTHLIST->getHtmlList()) ? '<ul>' . $list . '</ul>' : "<p>{$lang['plugin']['archives']['no_posts']}</p>"
 | 
				
			||||||
						'<ul>' . $list . '</ul>' 
 | 
						);
 | 
				
			||||||
						: 
 | 
					 | 
				
			||||||
						"<p>{$lang['plugin']['archives']['no_posts']}</p>" 
 | 
					 | 
				
			||||||
					);		
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
register_widget('archives', 'Archives', 'plugin_archives_widget');
 | 
					register_widget('archives', 'Archives', 'plugin_archives_widget');
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,11 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Plugin Name: BBCode
 | 
					 * Plugin Name: BBCode
 | 
				
			||||||
 * Version: 1.5
 | 
					 * Version: 1.6
 | 
				
			||||||
 * Plugin URI: http://flatpress.sf.net
 | 
					 * Plugin 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.
 | 
					 * Author: FlatPress
 | 
				
			||||||
 * Author: Hydra, NoWhereMan
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
 * Author 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. Part of the standard distribution.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
require (plugin_getdir('bbcode') . '/inc/stringparser_bbcode.class.php');
 | 
					require (plugin_getdir('bbcode') . '/inc/stringparser_bbcode.class.php');
 | 
				
			||||||
require (plugin_getdir('bbcode') . '/panels/admin.plugin.panel.bbcode.php');
 | 
					require (plugin_getdir('bbcode') . '/panels/admin.plugin.panel.bbcode.php');
 | 
				
			||||||
 | 
				
			|||||||
@ -2,12 +2,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Plugin Name: BlockParser
 | 
					 * Plugin Name: BlockParser
 | 
				
			||||||
 * Plugin URI: http://www.nowhereland.it/
 | 
					 | 
				
			||||||
 * Type: Block
 | 
					 * 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
 | 
					 * 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/');
 | 
					// define('BLOCKS_DIR', CONTENT_DIR . 'blocks/');
 | 
				
			||||||
 | 
				
			|||||||
@ -3,11 +3,11 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Plugin Name: Calendar
 | 
					 * Plugin Name: Calendar
 | 
				
			||||||
 * Version: 1.1
 | 
					 * Version: 1.1
 | 
				
			||||||
 * Plugin URI: http://flatpress.sf.net
 | 
					 | 
				
			||||||
 * Type: Block
 | 
					 * Type: Block
 | 
				
			||||||
 * Description: Adds a Calendar block level element
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
 * Author: NoWhereMan
 | 
					 * Author: FlatPress
 | 
				
			||||||
 * Author URI: http://flatpress.sf.net
 | 
					 * 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
 | 
					// PHP Calendar (version 2.3), written by Keith Devens
 | 
				
			||||||
 | 
				
			|||||||
@ -1,17 +1,15 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: Categories
 | 
					 * Plugin Name: Categories
 | 
				
			||||||
Plugin URI: http://www.nowhereland.it/
 | 
					 * Type: Block
 | 
				
			||||||
Type: Block
 | 
					 * Version: 1.0
 | 
				
			||||||
Description: Lists your categories in a widget.
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Author: NoWhereMan
 | 
					 * Author: FlatPress
 | 
				
			||||||
Version: 1.0
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author URI: http://www.nowhereland.it/
 | 
					 * Description: Lists your categories in a widget. Part of the standard distribution.
 | 
				
			||||||
*/ 
 | 
					 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
function plugin_categories_widget() {
 | 
					function plugin_categories_widget() {
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	global $smarty;
 | 
						global $smarty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// set this to true if you want show the number
 | 
						// set this to true if you want show the number
 | 
				
			||||||
@ -27,8 +25,8 @@ function plugin_categories_widget() {
 | 
				
			|||||||
	// they're located under plugin.PLUGINNAME/lang/LANGID/
 | 
						// they're located under plugin.PLUGINNAME/lang/LANGID/
 | 
				
			||||||
	$lang = lang_load('plugin:categories');
 | 
						$lang = lang_load('plugin:categories');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$entry['subject'] = $lang['plugin']['categories']['subject'];
 | 
						$entry ['subject'] = $lang ['plugin'] ['categories'] ['subject'];
 | 
				
			||||||
	$entry['content'] = $smarty->fetch('plugin:categories/widget');
 | 
						$entry ['content'] = $smarty->fetch('plugin:categories/widget');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return $entry;
 | 
						return $entry;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -4,9 +4,9 @@
 | 
				
			|||||||
 * Plugin Name: Comment Center
 | 
					 * Plugin Name: Comment Center
 | 
				
			||||||
 * Version: 1.1.2
 | 
					 * Version: 1.1.2
 | 
				
			||||||
 * Plugin URI: https://www.flatpress.org
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
 * Description: Manage your blog's comments: Set policies, publish or reject comments.
 | 
					 * Author: FlatPress
 | 
				
			||||||
 * Author: FlatPress (credits to Piero VDFN)
 | 
					 | 
				
			||||||
 * Author URI: https://www.flatpress.org
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
 | 
					 * Description: Manage your blog's comments: Set policies, publish or reject comments. Part of the standard distribution.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -1,19 +1,18 @@
 | 
				
			|||||||
<?php
 | 
					<?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() {
 | 
					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...)
 | 
						// and be a ICO file (not a renamed png, jpg, gif, etc...)
 | 
				
			||||||
	// or it won't work in IE
 | 
						// or it won't work in IE
 | 
				
			||||||
	echo '<link rel="shortcut icon" href="' .  
 | 
						echo '<link rel="shortcut icon" href="' . plugin_geturl('favicon') . 'imgs/favicon.ico" />';
 | 
				
			||||||
		plugin_geturl('favicon') .'imgs/favicon.ico" />';
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_action('wp_head', 'plugin_favicon_head');
 | 
					add_action('wp_head', 'plugin_favicon_head');
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,11 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Plugin Name: FootNotes
 | 
					 * Plugin Name: FootNotes
 | 
				
			||||||
 * Version: 0.1
 | 
					 * Version: 1.0
 | 
				
			||||||
 * Plugin URI: http://flatpress.nowhereland.it
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
 * Description: footnotes in your entry
 | 
					 * Author: FlatPress
 | 
				
			||||||
 * Author: NoWhereMan
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
 * Author URI: http://flatpress.nowhereland.it
 | 
					 * Description: Enables footnotes in your entries. Part of the standard distribution.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
define('FOOTNOTES_START', '[footnotes]');
 | 
					define('FOOTNOTES_START', '[footnotes]');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,28 +1,24 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: jQuery
 | 
					 * Plugin Name: jQuery
 | 
				
			||||||
Version: 2.0.1
 | 
					 * Version: 2.0.1
 | 
				
			||||||
Plugin URI: http://www.vdfn.altervista.org/
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Description: Provides <a href="http://jquery.com/" title="jQuery">jQuery</a> locally.
 | 
					 * Author: FlatPress
 | 
				
			||||||
Author: Piero VDFN
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author URI: http://www.vdfn.altervista.org/
 | 
					 * Description: Provides <a href="http://jquery.com/" title="jQuery">jQuery</a> locally. Part of the standard distribution.
 | 
				
			||||||
JQuery and JQueryUI version bump by Arvid Zimmermann
 | 
					 */
 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Original author: NoWhereMan (http://www.nowhereland.it)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// # Original author: NoWhereMan (http://www.nowhereland.it)
 | 
				
			||||||
add_action('wp_head', 'plugin_jquery_head', 0);
 | 
					add_action('wp_head', 'plugin_jquery_head', 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
function plugin_jquery_head() {
 | 
					function plugin_jquery_head() {
 | 
				
			||||||
 | 
						$pdir = plugin_geturl('jquery');
 | 
				
			||||||
	$pdir=plugin_geturl('jquery');
 | 
					 | 
				
			||||||
	echo <<<JSUTILS
 | 
						echo <<<JSUTILS
 | 
				
			||||||
	<!-- start of 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/jquery/1.10.2/jquery.min.js"></script>
 | 
				
			||||||
	<script type="text/javascript" src="{$pdir}res/jqueryui/1.10.3/jquery-ui.min.js"></script>
 | 
							<script type="text/javascript" src="{$pdir}res/jqueryui/1.10.3/jquery-ui.min.js"></script>
 | 
				
			||||||
	<!-- end of jsUtils -->
 | 
							<!-- end of jsUtils -->
 | 
				
			||||||
JSUTILS;
 | 
						JSUTILS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,22 +1,20 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: LastComments
 | 
					 * Plugin Name: LastComments
 | 
				
			||||||
Plugin URI: http://www.nowhereland.it/
 | 
					 * Type: Block
 | 
				
			||||||
Type: Block
 | 
					 * Version: 1.0
 | 
				
			||||||
Description: LastComments plugin. Part of the standard distribution ;)
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Author: NoWhereMan
 | 
					 * Author: FlatPress
 | 
				
			||||||
Version: 1.0
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author URI: http://www.nowhereland.it/
 | 
					 * Description: Adds a widget that shows the latest comments. Part of the standard distribution.
 | 
				
			||||||
*/ 
 | 
					 */
 | 
				
			||||||
 | 
					define('LASTCOMMENTS_CACHE_FILE', CACHE_DIR . 'lastcomments.tmp');
 | 
				
			||||||
define('LASTCOMMENTS_CACHE_FILE', CACHE_DIR  . 'lastcomments.tmp');
 | 
					 | 
				
			||||||
define('LASTCOMMENTS_MAX', 8);
 | 
					define('LASTCOMMENTS_MAX', 8);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_action('comment_post', 'plugin_lastcomments_cache', 0, 2);
 | 
					add_action('comment_post', 'plugin_lastcomments_cache', 0, 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function plugin_lastcomments_widget() {
 | 
					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
 | 
							// no comments in cache
 | 
				
			||||||
		$list = array();
 | 
							$list = array();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
@ -37,40 +35,39 @@ function plugin_lastcomments_widget() {
 | 
				
			|||||||
		while ($arr = array_pop($list)) {
 | 
							while ($arr = array_pop($list)) {
 | 
				
			||||||
			theme_comments_filters($arr, $id);
 | 
								theme_comments_filters($arr, $id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			
 | 
								$q = new FPDB_Query(array(
 | 
				
			||||||
			$q = new FPDB_Query(array('id' => $arr['entry']), null);
 | 
									'id' => $arr ['entry']
 | 
				
			||||||
 | 
								), null);
 | 
				
			||||||
			// first element of the array is dropped, as it is the ID, which
 | 
								// first element of the array is dropped, as it is the ID, which
 | 
				
			||||||
			// we already know
 | 
								// we already know
 | 
				
			||||||
			@list(, $entry) = $q->getEntry($query);
 | 
								@list (, $entry) = $q->getEntry($query);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (!$entry){
 | 
								if (!$entry) {
 | 
				
			||||||
				$count--;
 | 
									$count--;
 | 
				
			||||||
					$update = true;
 | 
									$update = true;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			$content .=	
 | 
								$content .= "<li>
 | 
				
			||||||
			"<li>
 | 
					 | 
				
			||||||
			<blockquote class=\"comment-quote\" cite=\"comments.php?entry={$arr['entry']}#{$arr['id']}\">
 | 
								<blockquote class=\"comment-quote\" cite=\"comments.php?entry={$arr['entry']}#{$arr['id']}\">
 | 
				
			||||||
			{$arr['content']}
 | 
								{$arr['content']}
 | 
				
			||||||
			<p><a href=\"".get_comments_link($arr['entry']).
 | 
								<p><a href=\"" . get_comments_link($arr ['entry']) . "#{$arr['id']}\">{$arr['name']} - {$entry['subject']}</a></p>
 | 
				
			||||||
			"#{$arr['id']}\">{$arr['name']} - {$entry['subject']}</a></p>
 | 
					 | 
				
			||||||
			</blockquote></li>\n";
 | 
								</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 (!$count) {
 | 
				
			||||||
		if ($update)
 | 
							if ($update)
 | 
				
			||||||
			fs_delete(LASTCOMMENTS_CACHE_FILE);
 | 
								fs_delete(LASTCOMMENTS_CACHE_FILE);
 | 
				
			||||||
		$content .= '<li>' . $lang['plugin']['lastcomments']['no_comments'] .'</li>';
 | 
							$content .= '<li>' . $lang ['plugin'] ['lastcomments'] ['no_comments'] . '</li>';
 | 
				
			||||||
		$subject = $lang['plugin']['lastcomments']['no_new_comments'];
 | 
							$subject = $lang ['plugin'] ['lastcomments'] ['no_new_comments'];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$content .= '</ul>';
 | 
						$content .= '</ul>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$entry['subject'] = $subject;
 | 
						$entry ['subject'] = $subject;
 | 
				
			||||||
	$entry['content'] = $content;
 | 
						$entry ['content'] = $content;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return $entry;
 | 
						return $entry;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -86,24 +83,22 @@ function plugin_lastcomments_widget() {
 | 
				
			|||||||
 * in the end the widget will show up elements ordered
 | 
					 * in the end the widget will show up elements ordered
 | 
				
			||||||
 * from newer to older :P
 | 
					 * from newer to older :P
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param $entryid string entry id i.e. entryNNNNNN-NNNNNN
 | 
					 * @param $entryid string
 | 
				
			||||||
 * @param $comment array where $comment[0] is $commentid i.e. commentNNNNNN-NNNNNN
 | 
					 *        	entry id i.e. entryNNNNNN-NNNNNN
 | 
				
			||||||
 *			 and $comment[1] is the actual content array 
 | 
					 * @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) {
 | 
					function plugin_lastcomments_cache($entryid, $comment) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// max num of chars per comment
 | 
						// max num of chars per comment
 | 
				
			||||||
	$CHOP_AT = 30;
 | 
						$CHOP_AT = 30;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						list ($id, $content) = $comment;
 | 
				
			||||||
	list($id, $content) = $comment;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	comment_clean($content);
 | 
						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
 | 
							// no comments in cache
 | 
				
			||||||
		$list = array();
 | 
							$list = array();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
@ -111,35 +106,35 @@ function plugin_lastcomments_cache($entryid, $comment) {
 | 
				
			|||||||
		// (it is stored in encoded form)
 | 
							// (it is stored in encoded form)
 | 
				
			||||||
		$list = unserialize($f);
 | 
							$list = unserialize($f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (count($list)+1 > LASTCOMMENTS_MAX) {
 | 
							if (count($list) + 1 > LASTCOMMENTS_MAX) {
 | 
				
			||||||
			// comments are more than allowed maximum:
 | 
								// comments are more than allowed maximum:
 | 
				
			||||||
			// we delete the last in queue.
 | 
								// we delete the last in queue.
 | 
				
			||||||
			array_shift($list);
 | 
								array_shift($list);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (strlen($content['content']) > $CHOP_AT) {		
 | 
						if (strlen($content ['content']) > $CHOP_AT) {
 | 
				
			||||||
		$string = substr($content['content'], 0, $CHOP_AT) . '...';
 | 
							$string = substr($content ['content'], 0, $CHOP_AT) . '...';
 | 
				
			||||||
	} else {$string = $content['content'];}
 | 
						} else {
 | 
				
			||||||
 | 
							$string = $content ['content'];
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	array_push($list, array('name'=>$content['name'],
 | 
						array_push($list, array(
 | 
				
			||||||
					'content'=>$string, 
 | 
							'name' => $content ['name'],
 | 
				
			||||||
					'id'=> $id,
 | 
							'content' => $string,
 | 
				
			||||||
					'entry'=> $entryid)	
 | 
							'id' => $id,
 | 
				
			||||||
					);
 | 
							'entry' => $entryid
 | 
				
			||||||
 | 
						));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return io_write_file(LASTCOMMENTS_CACHE_FILE, serialize($list));
 | 
						return io_write_file(LASTCOMMENTS_CACHE_FILE, serialize($list));
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
register_widget('lastcomments', 'LastComments', 'plugin_lastcomments_widget');
 | 
					register_widget('lastcomments', 'LastComments', 'plugin_lastcomments_widget');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function plugin_lastcomments_rss () {
 | 
					function plugin_lastcomments_rss() {
 | 
				
			||||||
	global $smarty;
 | 
						global $smarty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
						if (false === ($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) {
 | 
				
			||||||
	if (false===($f = io_load_file(LASTCOMMENTS_CACHE_FILE))) {
 | 
					 | 
				
			||||||
		// no comments in cache
 | 
							// no comments in cache
 | 
				
			||||||
		$list = array();
 | 
							$list = array();
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
@ -149,40 +144,40 @@ function plugin_lastcomments_rss () {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$newlist = array();
 | 
						$newlist = array();
 | 
				
			||||||
	foreach($list as $c) {
 | 
						foreach ($list as $c) {
 | 
				
			||||||
		$newlist[] = comment_parse($list['entryid'], $list['id']);
 | 
							$newlist [] = comment_parse($list ['entryid'], $list ['id']);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$smarty->assign('lastcomments_list', $newlist);
 | 
						$smarty->assign('lastcomments_list', $newlist);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
function plugin_lastcomments_def_rss_link() {
 | 
					 * function plugin_lastcomments_def_rss_link() {
 | 
				
			||||||
	return BLOG_BASEURL . "?feed=lastcomments-rss2";
 | 
					 * return BLOG_BASEURL . "?feed=lastcomments-rss2";
 | 
				
			||||||
}
 | 
					 * }
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
function plugin_lastcomments_rss_link() {
 | 
					 * function plugin_lastcomments_rss_link() {
 | 
				
			||||||
	return apply_filters('plugin_lastcomments_rss_link', '');
 | 
					 * return apply_filters('plugin_lastcomments_rss_link', '');
 | 
				
			||||||
}
 | 
					 * }
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
add_action('wp_head', 'plugin_lastcomments_rsshead');
 | 
					 * add_action('wp_head', 'plugin_lastcomments_rsshead');
 | 
				
			||||||
function plugin_lastcomments_rsshead() {
 | 
					 * function plugin_lastcomments_rsshead() {
 | 
				
			||||||
	echo "\n<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Get RSS 2.0 Feed\" href=\"".
 | 
					 * echo "\n<link rel=\"alternate\" type=\"application/rss+xml\" title=\"Get RSS 2.0 Feed\" href=\"".
 | 
				
			||||||
			plugin_lastcomments_rss_link() 
 | 
					 * plugin_lastcomments_rss_link()
 | 
				
			||||||
		."\" />\n";
 | 
					 * ."\" />\n";
 | 
				
			||||||
}
 | 
					 * }
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
add_action('init', 'plugin_lastcomments_rssinit');
 | 
					 * add_action('init', 'plugin_lastcomments_rssinit');
 | 
				
			||||||
function plugin_lastcomments_rssinit() {
 | 
					 * function plugin_lastcomments_rssinit() {
 | 
				
			||||||
	global $smarty;
 | 
					 * global $smarty;
 | 
				
			||||||
	
 | 
					 *
 | 
				
			||||||
	if (isset($_GET['feed']) && $_GET['feed']=='lastcomments-rss2') {
 | 
					 * if (isset($_GET['feed']) && $_GET['feed']=='lastcomments-rss2') {
 | 
				
			||||||
		$smarty->display('plugin:lastcomments/plugin.lastcomments-feed');
 | 
					 * $smarty->display('plugin:lastcomments/plugin.lastcomments-feed');
 | 
				
			||||||
		exit();
 | 
					 * exit();
 | 
				
			||||||
	}
 | 
					 * }
 | 
				
			||||||
}
 | 
					 * }
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
*/
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,16 +1,13 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: Last Comments Admin
 | 
					 * Plugin Name: LastComments Admin
 | 
				
			||||||
Version: 0.1
 | 
					 * Version: 1.0
 | 
				
			||||||
Plugin URI: http://kirgroup.com/blog/
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Description: Manage last comments cache. Require LastComment plugin.
 | 
					 * Author: FlatPress
 | 
				
			||||||
Author: Fabrixxm
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author URI: http://kirgroup.com/blog/
 | 
					 * Description: Manage the cache of the LastComments plugin. Requires LastComment plugin enabled. Part of the standard distribution.
 | 
				
			||||||
*/
 | 
					 */
 | 
				
			||||||
 | 
					if (class_exists('AdminPanelAction')) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if (class_exists('AdminPanelAction')){
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class admin_plugin_lastcommentsadmin extends AdminPanelAction {
 | 
						class admin_plugin_lastcommentsadmin extends AdminPanelAction {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -21,7 +18,7 @@ if (class_exists('AdminPanelAction')){
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		function main() {
 | 
							function main() {
 | 
				
			||||||
			if  (!function_exists('plugin_lastcomments_cache')){
 | 
								if (!function_exists('plugin_lastcomments_cache')) {
 | 
				
			||||||
				$this->smarty->assign('success', -2);
 | 
									$this->smarty->assign('success', -2);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -29,28 +26,35 @@ if (class_exists('AdminPanelAction')){
 | 
				
			|||||||
		function onsubmit($data = NULL) {
 | 
							function onsubmit($data = NULL) {
 | 
				
			||||||
			global $fp_config;
 | 
								global $fp_config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (isset($_POST['lastcommentadmin_clear'])){
 | 
								if (isset($_POST ['lastcommentadmin_clear'])) {
 | 
				
			||||||
				fs_delete(LASTCOMMENTS_CACHE_FILE);
 | 
									fs_delete(LASTCOMMENTS_CACHE_FILE);
 | 
				
			||||||
				$this->smarty->assign('success', 1);
 | 
									$this->smarty->assign('success', 1);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (isset($_POST['lastcommentadmin_rebuild'])){
 | 
								if (isset($_POST ['lastcommentadmin_rebuild'])) {
 | 
				
			||||||
				fs_delete(LASTCOMMENTS_CACHE_FILE);
 | 
									fs_delete(LASTCOMMENTS_CACHE_FILE);
 | 
				
			||||||
				$coms = Array();
 | 
									$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()) {
 | 
									while ($q->hasmore()) {
 | 
				
			||||||
					list($id,$e) = $q->getEntry();
 | 
										list ($id, $e) = $q->getEntry();
 | 
				
			||||||
					$obj = new comment_indexer($id);
 | 
										$obj = new comment_indexer($id);
 | 
				
			||||||
					foreach($obj->getList() as $value){
 | 
										foreach ($obj->getList() as $value) {
 | 
				
			||||||
						$coms[$value]=$id;
 | 
											$coms [$value] = $id;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					ksort($coms);
 | 
										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);
 | 
										$c = comment_parse($eid, $cid);
 | 
				
			||||||
					plugin_lastcomments_cache($eid, array($cid, $c));
 | 
										plugin_lastcomments_cache($eid, array(
 | 
				
			||||||
 | 
											$cid,
 | 
				
			||||||
 | 
											$c
 | 
				
			||||||
 | 
										));
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				$this->smarty->assign('success', 2);
 | 
									$this->smarty->assign('success', 2);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@ -61,5 +65,4 @@ if (class_exists('AdminPanelAction')){
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	admin_addpanelaction('plugin', 'lastcommentsadmin', true);
 | 
						admin_addpanelaction('plugin', 'lastcommentsadmin', true);
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1,16 +1,15 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: LastEntries
 | 
					 * Plugin Name: LastEntries
 | 
				
			||||||
Plugin URI: http://www.nowhereland.it/
 | 
					 * Version: 1.0
 | 
				
			||||||
Type: Block
 | 
					 * Type: Block
 | 
				
			||||||
Description: LastEntries plugin. Part of the standard distribution ;)
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Author: NoWhereMan
 | 
					 * Author: FlatPress
 | 
				
			||||||
Version: 1.0
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author URI: http://www.nowhereland.it/
 | 
					 * Description: Adds a widget that lists the latest entries. Part of the standard distribution.
 | 
				
			||||||
*/ 
 | 
					 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
function plugin_lastentries_widget() {
 | 
					function plugin_lastentries_widget() {
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	global $fpdb;
 | 
						global $fpdb;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// load plugin strings
 | 
						// load plugin strings
 | 
				
			||||||
@ -18,47 +17,51 @@ function plugin_lastentries_widget() {
 | 
				
			|||||||
	$lang = lang_load('plugin:lastentries');
 | 
						$lang = lang_load('plugin:lastentries');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$num = 10;
 | 
						$num = 10;
 | 
				
			||||||
	####################
 | 
						// ###################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	$queryId = $fpdb->query("fullparse:false,start:0,count:$num");
 | 
						 * $queryId = $fpdb->query("fullparse:false,start:0,count:$num");
 | 
				
			||||||
	$fpdb->doquery($queryId);
 | 
						 * $fpdb->doquery($queryId);
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * $fpdb->getQuery
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$fpdb->getQuery
 | 
						$q = new FPDB_Query(array(
 | 
				
			||||||
	*/
 | 
							'fullparse' => false,
 | 
				
			||||||
	
 | 
							'start' => 0,
 | 
				
			||||||
	$q = new FPDB_Query(array('fullparse'=>false,'start'=>0,'count'=>$num), null);
 | 
							'count' => $num
 | 
				
			||||||
 | 
						), null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$string = '<ul>';
 | 
						$string = '<ul>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	$count = 0;
 | 
						$count = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while ($q->hasmore()) {
 | 
						while ($q->hasmore()) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		list($id, $entry) = $q->getEntry();
 | 
							list ($id, $entry) = $q->getEntry();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$link = get_permalink($id);
 | 
							$link = get_permalink($id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$string .='<li>';
 | 
							$string .= '<li>';
 | 
				
			||||||
		$admin = BLOG_BASEURL . "admin.php?p=entry&entry=";
 | 
							$admin = BLOG_BASEURL . "admin.php?p=entry&entry=";
 | 
				
			||||||
		if (user_loggedin()) // if loggedin prints a "edit" link
 | 
							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";
 | 
							$string .= "<a href=\"{$link}\">{$entry['subject']}</a></li>\n";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$count++;
 | 
							$count++;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ($string == '<ul>'){
 | 
						if ($string == '<ul>') {
 | 
				
			||||||
		$string .= '<li><a href="admin.php?p=entry&action=write">'.$lang['plugin']['lastentries']['add_entry'].'</a></li>';
 | 
							$string .= '<li><a href="admin.php?p=entry&action=write">' . $lang ['plugin'] ['lastentries'] ['add_entry'] . '</a></li>';
 | 
				
			||||||
		$subject = $lang['plugin']['lastentries']['no_entries'];
 | 
							$subject = $lang ['plugin'] ['lastentries'] ['no_entries'];
 | 
				
			||||||
	} else $subject = $lang['plugin']['lastentries']['subject_before_count'] . $count .  $lang['plugin']['lastentries']['subject_after_count'];	
 | 
						} else
 | 
				
			||||||
 | 
							$subject = $lang ['plugin'] ['lastentries'] ['subject_before_count'] . $count . $lang ['plugin'] ['lastentries'] ['subject_after_count'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$string .= '</ul>';
 | 
						$string .= '</ul>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$widget = array();
 | 
						$widget = array();
 | 
				
			||||||
	$widget['subject'] = $subject;
 | 
						$widget ['subject'] = $subject;
 | 
				
			||||||
	$widget['content'] = $string;
 | 
						$widget ['content'] = $string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return $widget;
 | 
						return $widget;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,47 +1,45 @@
 | 
				
			|||||||
<?php
 | 
					<?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
 | 
					// if PLUGINS_DIR is not fp-plugins please edit res/lightbox.js
 | 
				
			||||||
 | 
					 | 
				
			||||||
function plugin_lightbox2_setup() {
 | 
					function plugin_lightbox2_setup() {
 | 
				
			||||||
	return function_exists('plugin_jquery_head')? 1:-1;
 | 
						return function_exists('plugin_jquery_head') ? 1 : -1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function plugin_lightbox2_head() {
 | 
					function plugin_lightbox2_head() {
 | 
				
			||||||
 | 
						$pdir = plugin_geturl('lightbox2');
 | 
				
			||||||
	$pdir=plugin_geturl('lightbox2');
 | 
					 | 
				
			||||||
	echo <<<LBOXHEAD
 | 
						echo <<<LBOXHEAD
 | 
				
			||||||
	<!-- start of lightbox -->
 | 
							<!-- start of lightbox -->
 | 
				
			||||||
	<link rel="stylesheet" type="text/css" href="{$pdir}res/slimbox2.css" />
 | 
							<link rel="stylesheet" type="text/css" href="{$pdir}res/slimbox2.css" />
 | 
				
			||||||
	<!-- end of lightbox -->
 | 
							<!-- end of lightbox -->
 | 
				
			||||||
LBOXHEAD;
 | 
						LBOXHEAD;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
add_action('wp_head', 'plugin_lightbox2_head');
 | 
					add_action('wp_head', 'plugin_lightbox2_head');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function plugin_lightbox2_footer() {
 | 
					function plugin_lightbox2_footer() {
 | 
				
			||||||
 | 
						$pdir = plugin_geturl('lightbox2');
 | 
				
			||||||
	$pdir=plugin_geturl('lightbox2');
 | 
					 | 
				
			||||||
	echo <<<LBOXHEAD
 | 
						echo <<<LBOXHEAD
 | 
				
			||||||
	<!-- start of lightbox -->
 | 
							<!-- start of lightbox -->
 | 
				
			||||||
	<script type="text/javascript" src="{$pdir}res/slimbox2.js"></script>
 | 
							<script type="text/javascript" src="{$pdir}res/slimbox2.js"></script>
 | 
				
			||||||
	<!-- end of lightbox -->
 | 
							<!-- end of lightbox -->
 | 
				
			||||||
LBOXHEAD;
 | 
						LBOXHEAD;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
add_action('wp_footer', 'plugin_lightbox2_footer');
 | 
					add_action('wp_footer', 'plugin_lightbox2_footer');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function plugin_lightbox2_hook($popup, $abspath) {
 | 
					function plugin_lightbox2_hook($popup, $abspath) {
 | 
				
			||||||
	global $lightbox_rel;
 | 
						global $lightbox_rel;
 | 
				
			||||||
	// the other $popup is just dropped
 | 
						// 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);
 | 
					add_action('bbcode_img_popup', 'plugin_lightbox2_hook', 5, 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,60 +1,55 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: Media Manager
 | 
					 * Plugin Name: Media Manager
 | 
				
			||||||
Version: 0.4
 | 
					 * Version: 1.0
 | 
				
			||||||
Plugin URI: http://kirgroup.com/blog/
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Description: Manage uloaded files ad photo galleries
 | 
					 * Author: FlatPress
 | 
				
			||||||
Author: Fabrix.xm
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author URI: http://kirgroup.com/fabrixxm/
 | 
					 * Description: Manage uploaded files and photo galleries. Part of the standard distribution.
 | 
				
			||||||
*/
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// config
 | 
					// config
 | 
				
			||||||
define('ITEMSPERPAGE', 10);
 | 
					define('ITEMSPERPAGE', 10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
function mediamanager_updateUseCountArr(&$files,$fupd){
 | 
					function mediamanager_updateUseCountArr(&$files, $fupd) {
 | 
				
			||||||
	$params = array();
 | 
						$params = array();
 | 
				
			||||||
	$params['start']=0;
 | 
						$params ['start'] = 0;
 | 
				
			||||||
	$params['count']=-1;
 | 
						$params ['count'] = -1;
 | 
				
			||||||
	$params['fullparse'] = true;
 | 
						$params ['fullparse'] = true;
 | 
				
			||||||
	$q = new FPDB_Query($params, null);
 | 
						$q = new FPDB_Query($params, null);
 | 
				
			||||||
	while ($q->hasMore()) {
 | 
						while ($q->hasMore()) {
 | 
				
			||||||
		list($id, $e) = $q->getEntry();
 | 
							list ($id, $e) = $q->getEntry();
 | 
				
			||||||
		if (isset($e['content'])){
 | 
							if (isset($e ['content'])) {
 | 
				
			||||||
			foreach($fupd as $id){
 | 
								foreach ($fupd as $id) {
 | 
				
			||||||
				if (is_null($files[$id]['usecount'])) $files[$id]['usecount']=0;
 | 
									if (is_null($files [$id] ['usecount']))
 | 
				
			||||||
				if ($files[$id]['type']=='gallery'){
 | 
										$files [$id] ['usecount'] = 0;
 | 
				
			||||||
					$searchterm="[gallery=images/".$files[$id]['name'];
 | 
									if ($files [$id] ['type'] == 'gallery') {
 | 
				
			||||||
 | 
										$searchterm = "[gallery=images/" . $files [$id] ['name'];
 | 
				
			||||||
				} else {
 | 
									} 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();
 | 
						$usecount = array();
 | 
				
			||||||
	foreach($files as $info){
 | 
						foreach ($files as $info) {
 | 
				
			||||||
		$usecount[$info['name']]=$info['usecount'];
 | 
							$usecount [$info ['name']] = $info ['usecount'];
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	plugin_addoption('mediamanager', 'usecount', $usecount);
 | 
						plugin_addoption('mediamanager', 'usecount', $usecount);
 | 
				
			||||||
	plugin_saveoptions('mediamanager');
 | 
						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 */
 | 
					/* invalidate count on entry save and delete */
 | 
				
			||||||
function mediamanager_invalidatecount($arg){
 | 
					function mediamanager_invalidatecount($arg) {
 | 
				
			||||||
	plugin_addoption('mediamanager', 'usecount', array());
 | 
						plugin_addoption('mediamanager', 'usecount', array());
 | 
				
			||||||
	plugin_saveoptions('mediamanager');
 | 
						plugin_saveoptions('mediamanager');
 | 
				
			||||||
	return $arg;
 | 
						return $arg;
 | 
				
			||||||
@ -62,5 +57,4 @@ function mediamanager_invalidatecount($arg){
 | 
				
			|||||||
add_filter('delete_post', 'mediamanager_invalidatecount', 1);
 | 
					add_filter('delete_post', 'mediamanager_invalidatecount', 1);
 | 
				
			||||||
add_filter('content_save_pre', 'mediamanager_invalidatecount', 1);
 | 
					add_filter('content_save_pre', 'mediamanager_invalidatecount', 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,25 +1,24 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: PostViews
 | 
					 * Plugin Name: PostViews
 | 
				
			||||||
Plugin URI: http://www.nowhereland.it/
 | 
					 * Version: 1.0
 | 
				
			||||||
Description: PostViews plugin.
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Author: NoWhereMan
 | 
					 * Author: FlatPress
 | 
				
			||||||
Version: 1.0
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author URI: http://www.nowhereland.it/
 | 
					 * Description: Counts and displays entry views. Part of the standard distribution.
 | 
				
			||||||
*/ 
 | 
					 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
add_action('entry_block', 'plugin_postviews_do');
 | 
					add_action('entry_block', 'plugin_postviews_do');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function plugin_postviews_calc($id, $calc) {
 | 
					function plugin_postviews_calc($id, $calc) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
	$dir = entry_dir($id);
 | 
						$dir = entry_dir($id);
 | 
				
			||||||
	if (!$dir) return;
 | 
						if (!$dir)
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$f = $dir . '/view_counter' .EXT;
 | 
						$f = $dir . '/view_counter' . EXT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$v = io_load_file($f);
 | 
						$v = io_load_file($f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ($v===false){
 | 
						if ($v === false) {
 | 
				
			||||||
		$v = 0;
 | 
							$v = 0;
 | 
				
			||||||
	} elseif ($v < 0) {
 | 
						} elseif ($v < 0) {
 | 
				
			||||||
		// file was locked. Do not increase views.
 | 
							// file was locked. Do not increase views.
 | 
				
			||||||
@ -38,7 +37,6 @@ function plugin_postviews_calc($id, $calc) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function plugin_postviews_do($id) {
 | 
					function plugin_postviews_do($id) {
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	global $fpdb, $smarty;
 | 
						global $fpdb, $smarty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$q = $fpdb->getQuery();
 | 
						$q = $fpdb->getQuery();
 | 
				
			||||||
@ -47,9 +45,6 @@ function plugin_postviews_do($id) {
 | 
				
			|||||||
	$v = plugin_postviews_calc($id, $calc);
 | 
						$v = plugin_postviews_calc($id, $calc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$smarty->assign('views', $v);
 | 
						$smarty->assign('views', $v);
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,12 +1,12 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: PrettyURLs
 | 
					 * Plugin Name: PrettyURLs
 | 
				
			||||||
Plugin URI: http://flatpress.nowherland.it/
 | 
					 * Version: 3.0
 | 
				
			||||||
Description: Url prettifier (powered by htaccess)
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Author: NoWhereMan  (E.Vacchi)
 | 
					 * Author: FlatPress
 | 
				
			||||||
Version: 3.0
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author URI: http://www.nowhereland.it
 | 
					 * Description: Enables SEO friendly, pretty URLs (via htaccess). Part of the standard distribution.
 | 
				
			||||||
*/
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Place where the index is stored
 | 
					 * Place where the index is stored
 | 
				
			||||||
@ -20,16 +20,14 @@ define('PRETTYURLS_CATS', CACHE_DIR . '%%prettyurls-cats.tmp');
 | 
				
			|||||||
 * File existance check
 | 
					 * File existance check
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# memo
 | 
					// memo
 | 
				
			||||||
# register_plugin_setup('plugin_id', 'setup_func');
 | 
					// register_plugin_setup('plugin_id', 'setup_func');
 | 
				
			||||||
 | 
					 | 
				
			||||||
function plugin_prettyurls_setup() {
 | 
					function plugin_prettyurls_setup() {
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	if (file_exists(ABS_PATH . '.htaccess'))
 | 
						if (file_exists(ABS_PATH . '.htaccess'))
 | 
				
			||||||
		return 1;
 | 
							return 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!is_writable(ABS_PATH)) {
 | 
						if (!is_writable(ABS_PATH)) {
 | 
				
			||||||
	 	return -2;
 | 
							return -2;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
@ -38,22 +36,24 @@ function plugin_prettyurls_setup() {
 | 
				
			|||||||
class Plugin_PrettyURLs {
 | 
					class Plugin_PrettyURLs {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var $index = array();
 | 
						var $index = array();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var $status = 0;
 | 
						var $status = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var $date_handled = false;
 | 
						var $date_handled = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var $categories = null;
 | 
						var $categories = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var $fp_params;
 | 
						var $fp_params;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
						function categories($force = true) {
 | 
				
			||||||
	function categories($force=true) {
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ($this->categories)
 | 
							if ($this->categories)
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ($force || !file_exists(PRETTYURLS_CATS)) {
 | 
							if ($force || !file_exists(PRETTYURLS_CATS)) {
 | 
				
			||||||
			$d = entry_categories_get('defs');
 | 
								$d = entry_categories_get('defs');
 | 
				
			||||||
			$list = array();
 | 
								$list = array();
 | 
				
			||||||
			foreach ($d as $k=>$v) {
 | 
								foreach ($d as $k => $v) {
 | 
				
			||||||
				$list[$k] = sanitize_title($v);
 | 
									$list [$k] = sanitize_title($v);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			io_write_file(PRETTYURLS_CATS, serialize($list));
 | 
								io_write_file(PRETTYURLS_CATS, serialize($list));
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
@ -63,25 +63,22 @@ class Plugin_PrettyURLs {
 | 
				
			|||||||
		$this->categories = $list;
 | 
							$this->categories = $list;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	function md5($id, $title) {
 | 
						function md5($id, $title) {
 | 
				
			||||||
		$date = date_from_id($id);
 | 
							$date = date_from_id($id);
 | 
				
			||||||
		return md5($date['y'].$date['m'].$date['d'].$title);
 | 
							return md5($date ['y'] . $date ['m'] . $date ['d'] . $title);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	function permalink($str, $id) {
 | 
						function permalink($str, $id) {
 | 
				
			||||||
		global $fpdb, $post;
 | 
							global $fpdb, $post;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (PRETTYURLS_TITLES)
 | 
							if (PRETTYURLS_TITLES)
 | 
				
			||||||
			$title = sanitize_title($post['subject']);
 | 
								$title = sanitize_title($post ['subject']);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			$title = $id;
 | 
								$title = $id;
 | 
				
			||||||
		$date = date_from_id($id);
 | 
							$date = date_from_id($id);
 | 
				
			||||||
					// yeah, hackish, I know...
 | 
							// yeah, hackish, I know...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return $this->baseurl  . "20{$date['y']}/{$date['m']}/{$date['d']}/$title/";
 | 
							return $this->baseurl . "20{$date['y']}/{$date['m']}/{$date['d']}/$title/";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function commentlink($str, $id) {
 | 
						function commentlink($str, $id) {
 | 
				
			||||||
@ -90,8 +87,7 @@ class Plugin_PrettyURLs {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function feedlink($str, $type) {
 | 
						function feedlink($str, $type) {
 | 
				
			||||||
		return $this->baseurl  . "feed/{$type}/";
 | 
							return $this->baseurl . "feed/{$type}/";
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function commentsfeedlink($str, $type, $id) {
 | 
						function commentsfeedlink($str, $type, $id) {
 | 
				
			||||||
@ -99,25 +95,23 @@ class Plugin_PrettyURLs {
 | 
				
			|||||||
		return $link . "feed/{$type}/";
 | 
							return $link . "feed/{$type}/";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	function staticlink($str, $id) {
 | 
						function staticlink($str, $id) {
 | 
				
			||||||
		return $this->baseurl  .  "$id/";
 | 
							return $this->baseurl . "$id/";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	function categorylink($str, $catid) {
 | 
						function categorylink($str, $catid) {
 | 
				
			||||||
		if (PRETTYURLS_TITLES) {
 | 
							if (PRETTYURLS_TITLES) {
 | 
				
			||||||
			if (@$this->categories[$catid])
 | 
								if (@$this->categories [$catid])
 | 
				
			||||||
				return $this->baseurl  . "category/{$this->categories[$catid]}/";
 | 
									return $this->baseurl . "category/{$this->categories[$catid]}/";
 | 
				
			||||||
			else return $str;
 | 
								else
 | 
				
			||||||
 | 
									return $str;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			return $this->baseurl  . "category/{$catid}/";
 | 
								return $this->baseurl . "category/{$catid}/";
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	function yearlink($str, $y) {
 | 
						function yearlink($str, $y) {
 | 
				
			||||||
		return $this->baseurl  . "20$y/";
 | 
							return $this->baseurl . "20$y/";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function monthlink($str, $y, $m) {
 | 
						function monthlink($str, $y, $m) {
 | 
				
			||||||
@ -128,138 +122,125 @@ class Plugin_PrettyURLs {
 | 
				
			|||||||
		return $this->monthlink($str, $y, $m) . "$d/";
 | 
							return $this->monthlink($str, $y, $m) . "$d/";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	function cache_create() {
 | 
						function cache_create() {
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		$this->index = array();
 | 
							$this->index = array();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		$o =& entry_init();
 | 
							 * $o =& entry_init();
 | 
				
			||||||
		
 | 
							 *
 | 
				
			||||||
		$entries = $o->getList();
 | 
							 * $entries = $o->getList();
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$o = new FPDB_Query(array('start'=>0,'count'=>-1,'fullparse'=>false), null);
 | 
							$o = new FPDB_Query(array(
 | 
				
			||||||
 | 
								'start' => 0,
 | 
				
			||||||
 | 
								'count' => -1,
 | 
				
			||||||
 | 
								'fullparse' => false
 | 
				
			||||||
 | 
							), null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
							// foreach ($entries as $id => $contents) {
 | 
				
			||||||
		#foreach ($entries as $id => $contents) {
 | 
					 | 
				
			||||||
		while ($o->hasMore()) {
 | 
							while ($o->hasMore()) {
 | 
				
			||||||
			list($id, $contents) = $o->getEntry();
 | 
								list ($id, $contents) = $o->getEntry();
 | 
				
			||||||
			$date = date_from_id($id);
 | 
								$date = date_from_id($id);
 | 
				
			||||||
			echo $contents['subject'], "\n";
 | 
								echo $contents ['subject'], "\n";
 | 
				
			||||||
			$md5 = md5(sanitize_title($contents['subject']));
 | 
								$md5 = md5(sanitize_title($contents ['subject']));
 | 
				
			||||||
			$this->index[$date['y']][$date['m']][$date['d']][$md5] = $id;		
 | 
								$this->index [$date ['y']] [$date ['m']] [$date ['d']] [$md5] = $id;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		#}
 | 
							// }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->cache_save();
 | 
							$this->cache_save();
 | 
				
			||||||
		io_write_file(PRETTYURLS_CACHE, 'dummy');
 | 
							io_write_file(PRETTYURLS_CACHE, 'dummy');
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	function handle_categories($matches) {
 | 
						function handle_categories($matches) {
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
		if (!$this->categories)
 | 
							if (!$this->categories)
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (PRETTYURLS_TITLES) {
 | 
							if (PRETTYURLS_TITLES) {
 | 
				
			||||||
			if ($c = array_search($matches[1], $this->categories))
 | 
								if ($c = array_search($matches [1], $this->categories))
 | 
				
			||||||
				$this->fp_params['cat'] = $c;
 | 
									$this->fp_params ['cat'] = $c;
 | 
				
			||||||
			else return $matches[0];
 | 
								else
 | 
				
			||||||
 | 
									return $matches [0];
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			$this->fp_params['cat'] = $matches[1];
 | 
								$this->fp_params ['cat'] = $matches [1];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
		named matches are not supported here
 | 
						 * named matches are not supported here
 | 
				
			||||||
	*/
 | 
						 */
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	function handle_date($matches) {
 | 
						function handle_date($matches) {
 | 
				
			||||||
	
 | 
							$this->fp_params ['y'] = $matches [1];
 | 
				
			||||||
		$this->fp_params['y'] = $matches[1];
 | 
							if (isset($matches [3]))
 | 
				
			||||||
		if (isset($matches[3])) $this->fp_params['m'] = $matches[3] ;
 | 
								$this->fp_params ['m'] = $matches [3];
 | 
				
			||||||
		if (isset($matches[5])) $this->fp_params['d'] = $matches[5];
 | 
							if (isset($matches [5]))
 | 
				
			||||||
 | 
								$this->fp_params ['d'] = $matches [5];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->date_handled = true;
 | 
							$this->date_handled = true;
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	function handle_static($matches) {
 | 
						function handle_static($matches) {
 | 
				
			||||||
		$this->fp_params['page'] = $matches[1];
 | 
							$this->fp_params ['page'] = $matches [1];
 | 
				
			||||||
		$this->status = 2;
 | 
							$this->status = 2;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function handle_entry($matches) {
 | 
						function handle_entry($matches) {
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if (PRETTYURLS_TITLES) {
 | 
							if (PRETTYURLS_TITLES) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			#isset($this->index[
 | 
								// isset($this->index[
 | 
				
			||||||
			if ($this->cache_get($this->fp_params['y'],$this->fp_params['m'], $this->fp_params['d'], md5($matches[1]))) {
 | 
								if ($this->cache_get($this->fp_params ['y'], $this->fp_params ['m'], $this->fp_params ['d'], md5($matches [1]))) {
 | 
				
			||||||
				$this->fp_params['entry'] = $this->index[$this->fp_params['y']][$this->fp_params['m']][$this->fp_params['d']][md5($matches[1])];
 | 
									$this->fp_params ['entry'] = $this->index [$this->fp_params ['y']] [$this->fp_params ['m']] [$this->fp_params ['d']] [md5($matches [1])];
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				// a bit hackish: we make up a fake url when there is no match,
 | 
									// a bit hackish: we make up a fake url when there is no match,
 | 
				
			||||||
				// so that at the higher level the system will 404...
 | 
									// so that at the higher level the system will 404...
 | 
				
			||||||
				$this->fp_params['entry'] = 'a';
 | 
									$this->fp_params ['entry'] = 'a';
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			$this->fp_params['entry'] = $matches[1];
 | 
								$this->fp_params ['entry'] = $matches [1];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function handle_page($matches) {
 | 
						function handle_page($matches) {
 | 
				
			||||||
		$this->fp_params['paged'] = $matches[1];
 | 
							$this->fp_params ['paged'] = $matches [1];
 | 
				
			||||||
		$this->status = 2;
 | 
							$this->status = 2;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	function handle_comment($matches) {
 | 
						function handle_comment($matches) {
 | 
				
			||||||
		$this->fp_params['comments'] = true;
 | 
							$this->fp_params ['comments'] = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function handle_feed($matches) {
 | 
						function handle_feed($matches) {
 | 
				
			||||||
	
 | 
							$this->fp_params ['feed'] = isset($matches [2]) ? $matches [2] : 'rss2';
 | 
				
			||||||
		$this->fp_params['feed'] = isset($matches[2])? $matches[2]:'rss2';
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	function get_url() {
 | 
						function get_url() {
 | 
				
			||||||
		$baseurl = BLOG_BASEURL;
 | 
							$baseurl = BLOG_BASEURL;
 | 
				
			||||||
		$opt = plugin_getoptions('prettyurls', 'mode');
 | 
							$opt = plugin_getoptions('prettyurls', 'mode');
 | 
				
			||||||
		$url = substr($_SERVER['REQUEST_URI'], strlen(BLOG_ROOT)-1);
 | 
							$url = substr($_SERVER ['REQUEST_URI'], strlen(BLOG_ROOT) - 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $urllenght = strlen($url);
 | 
							$urllenght = strlen($url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (isset($_SERVER['PATH_INFO'])) {
 | 
							if (isset($_SERVER ['PATH_INFO'])) {
 | 
				
			||||||
      $pathinfo = $_SERVER['PATH_INFO'];
 | 
								$pathinfo = $_SERVER ['PATH_INFO'];
 | 
				
			||||||
    } else {
 | 
							} else {
 | 
				
			||||||
      $pathinfo = '';
 | 
								$pathinfo = '';
 | 
				
			||||||
    }
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		switch($opt) {
 | 
							switch ($opt) {
 | 
				
			||||||
			case null:
 | 
								case null:
 | 
				
			||||||
			case 0:
 | 
								case 0:
 | 
				
			||||||
				$opt = file_exists(ABS_PATH . '.htaccess') ? 3 : 1;
 | 
									$opt = file_exists(ABS_PATH . '.htaccess') ? 3 : 1;
 | 
				
			||||||
			case 1:
 | 
								case 1:
 | 
				
			||||||
				$baseurl .= 'index.php/';
 | 
									$baseurl .= 'index.php/';
 | 
				
			||||||
        if ($urllenght < 2) {
 | 
									if ($urllenght < 2) {
 | 
				
			||||||
          $url = "/";
 | 
										$url = "/";
 | 
				
			||||||
        } else {
 | 
									} else {
 | 
				
			||||||
          // $url = $_SERVER['PATH_INFO'];
 | 
										// $url = $_SERVER['PATH_INFO'];
 | 
				
			||||||
          $url = $pathinfo;
 | 
										$url = $pathinfo;
 | 
				
			||||||
        }
 | 
									}
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case 2:
 | 
								case 2:
 | 
				
			||||||
				$baseurl .= '?u=/';
 | 
									$baseurl .= '?u=/';
 | 
				
			||||||
				$url = @$_GET['u'];
 | 
									$url = @$_GET ['u'];
 | 
				
			||||||
			/* case 3: do nothing, it's BLOG_BASEURL */
 | 
								/* case 3: do nothing, it's BLOG_BASEURL */
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -267,11 +248,8 @@ class Plugin_PrettyURLs {
 | 
				
			|||||||
		$this->mode = $opt;
 | 
							$this->mode = $opt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return $url;
 | 
							return $url;
 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * here is where the real work is done.
 | 
						 * here is where the real work is done.
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
@ -285,40 +263,34 @@ class Plugin_PrettyURLs {
 | 
				
			|||||||
	 * so that FlatPress can find it where it is expected
 | 
						 * so that FlatPress can find it where it is expected
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	function cache_init() {
 | 
						function cache_init() {
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
		global $fp_params;
 | 
							global $fp_params;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->fp_params =& $fp_params;
 | 
							$this->fp_params = & $fp_params;
 | 
				
			||||||
		$url = $this->get_url();
 | 
							$url = $this->get_url();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (PRETTYURLS_TITLES) {
 | 
							if (PRETTYURLS_TITLES) {
 | 
				
			||||||
			#if ($f = io_load_file(PRETTYURLS_CACHE))
 | 
								// if ($f = io_load_file(PRETTYURLS_CACHE))
 | 
				
			||||||
			$this->index = array(); #unserialize($f);
 | 
								$this->index = array(); // unserialize($f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (!file_exists(PRETTYURLS_CACHE))
 | 
								if (!file_exists(PRETTYURLS_CACHE))
 | 
				
			||||||
				$this->cache_create();
 | 
									$this->cache_create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
			$this->categories(false);
 | 
								$this->categories(false);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!defined('MOD_INDEX'))
 | 
							if (!defined('MOD_INDEX'))
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
							// # this is not working if you reach flatpress via symlink
 | 
				
			||||||
 | 
							// # unless you don't edit manually defaults.php
 | 
				
			||||||
//		# this is not working if you reach flatpress via symlink
 | 
							// if (strpos($_SERVER['REQUEST_URI'], BLOG_ROOT)!==false) {
 | 
				
			||||||
//		# unless you don't edit manually defaults.php
 | 
							// $url = $_SERVER['REQUEST_URI'];
 | 
				
			||||||
//		if (strpos($_SERVER['REQUEST_URI'], BLOG_ROOT)!==false) {
 | 
							// $del = BLOG_ROOT;
 | 
				
			||||||
//			$url = $_SERVER['REQUEST_URI'];
 | 
							// if (strpos($url, 'index.php')!==false)
 | 
				
			||||||
//			$del = BLOG_ROOT;
 | 
							// $del = $del . 'index.php/';
 | 
				
			||||||
//			if (strpos($url, 'index.php')!==false)
 | 
							// $url = substr($url, strlen($del)-1);
 | 
				
			||||||
//				$del = $del . 'index.php/';
 | 
							// }
 | 
				
			||||||
//			$url = substr($url, strlen($del)-1);
 | 
					 | 
				
			||||||
//		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// removes querystrings
 | 
							// removes querystrings
 | 
				
			||||||
		if (false !== $i = strpos($url, '?'))
 | 
							if (false !== $i = strpos($url, '?'))
 | 
				
			||||||
@ -328,125 +300,128 @@ class Plugin_PrettyURLs {
 | 
				
			|||||||
		if (false !== $i = strpos($url, '#'))
 | 
							if (false !== $i = strpos($url, '#'))
 | 
				
			||||||
			$url = substr($url, 0, $i);
 | 
								$url = substr($url, 0, $i);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
							if (strrpos($url, '/') != (strlen($url) - 1)) {
 | 
				
			||||||
		if (strrpos($url, '/') != (strlen($url)-1)) {
 | 
					 | 
				
			||||||
			$url .= '/';
 | 
								$url .= '/';
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if ($url == '/')
 | 
				
			||||||
		if ($url=='/')
 | 
					 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// date
 | 
				
			||||||
 | 
							$url = preg_replace_callback('!^/[0-9]{2}(?P<y>[0-9]{2})(/(?P<m>[0-9]{2})(/(?P<d>[0-9]{2}))?)?!', array(
 | 
				
			||||||
 | 
								&$this,
 | 
				
			||||||
 | 
								'handle_date'
 | 
				
			||||||
 | 
							), $url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
							if (!$this->date_handled) {
 | 
				
			||||||
		//date
 | 
					 | 
				
			||||||
		$url = preg_replace_callback(
 | 
					 | 
				
			||||||
			'!^/[0-9]{2}(?P<y>[0-9]{2})(/(?P<m>[0-9]{2})(/(?P<d>[0-9]{2}))?)?!', 
 | 
					 | 
				
			||||||
			array(&$this, 'handle_date'), 
 | 
					 | 
				
			||||||
			$url
 | 
					 | 
				
			||||||
			);
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if (!$this->date_handled){
 | 
					 | 
				
			||||||
			// static page
 | 
								// static page
 | 
				
			||||||
			$url = preg_replace_callback('|^/([a-zA-Z0-9_-]+)/$|', array(&$this, 'handle_static'), $url);
 | 
								$url = preg_replace_callback('|^/([a-zA-Z0-9_-]+)/$|', array(
 | 
				
			||||||
 | 
									&$this,
 | 
				
			||||||
 | 
									'handle_static'
 | 
				
			||||||
 | 
								), $url);
 | 
				
			||||||
			if ($this->status == 2)
 | 
								if ($this->status == 2)
 | 
				
			||||||
				return $this->check_url($url);
 | 
									return $this->check_url($url);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							$url = preg_replace_callback('{category/([^/]+)/}', array(
 | 
				
			||||||
 | 
								&$this,
 | 
				
			||||||
 | 
								'handle_categories'
 | 
				
			||||||
 | 
							), $url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$url = preg_replace_callback('{category/([^/]+)/}', array(&$this, 'handle_categories'), $url);
 | 
							$url = preg_replace_callback('|page/([0-9]+)/$|', array(
 | 
				
			||||||
		
 | 
								&$this,
 | 
				
			||||||
		
 | 
								'handle_page'
 | 
				
			||||||
		$url = preg_replace_callback('|page/([0-9]+)/$|', array(&$this, 'handle_page'), $url);		
 | 
							), $url);
 | 
				
			||||||
		if ($this->status == 2)
 | 
							if ($this->status == 2)
 | 
				
			||||||
			return $this->check_url($url);
 | 
								return $this->check_url($url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ($this->date_handled){
 | 
							if ($this->date_handled) {
 | 
				
			||||||
			$url = preg_replace_callback('|^/([^/]+)|', array(&$this, 'handle_entry'), $url);
 | 
								$url = preg_replace_callback('|^/([^/]+)|', array(
 | 
				
			||||||
 | 
									&$this,
 | 
				
			||||||
 | 
									'handle_entry'
 | 
				
			||||||
 | 
								), $url);
 | 
				
			||||||
			// if status = 2
 | 
								// if status = 2
 | 
				
			||||||
				/*
 | 
								/*
 | 
				
			||||||
					utils_error(404);
 | 
								 * utils_error(404);
 | 
				
			||||||
				*/
 | 
								 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			$url = preg_replace_callback('|^/comments|', array(&$this, 'handle_comment'), $url);
 | 
								$url = preg_replace_callback('|^/comments|', array(
 | 
				
			||||||
 | 
									&$this,
 | 
				
			||||||
 | 
									'handle_comment'
 | 
				
			||||||
 | 
								), $url);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
							$url = preg_replace_callback('|^/feed(/([^/]*))?|', array(
 | 
				
			||||||
		$url = preg_replace_callback('|^/feed(/([^/]*))?|', array(&$this, 'handle_feed'), $url);
 | 
								&$this,
 | 
				
			||||||
 | 
								'handle_feed'
 | 
				
			||||||
 | 
							), $url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->check_url($url);
 | 
							$this->check_url($url);
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function check_url($url) {
 | 
						function check_url($url) {
 | 
				
			||||||
		if (!empty($url) && $url != '/') {
 | 
							if (!empty($url) && $url != '/') {
 | 
				
			||||||
			$this->fp_params = array('entry'=>'entry000000-000000');
 | 
								$this->fp_params = array(
 | 
				
			||||||
 | 
									'entry' => 'entry000000-000000'
 | 
				
			||||||
 | 
								);
 | 
				
			||||||
			$url = apply_filters('prettyurls_unhandled_url', $url);
 | 
								$url = apply_filters('prettyurls_unhandled_url', $url);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function cache_delete_elem($id, $date) {
 | 
						function cache_delete_elem($id, $date) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# is this a title change?
 | 
							// is this a title change?
 | 
				
			||||||
		if (false !== ($ids = $this->cache_get( $date['y'] ,  $date['m'] ,  $date['d'] )))
 | 
							if (false !== ($ids = $this->cache_get($date ['y'], $date ['m'], $date ['d'])))
 | 
				
			||||||
			$hash = array_search($id, $ids);
 | 
								$hash = array_search($id, $ids);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ($hash) {
 | 
							if ($hash) {
 | 
				
			||||||
			unset($this->index[ $date['y'] ] [ $date['m'] ][ $date['d'] ][ $hash ]);
 | 
								unset($this->index [$date ['y']] [$date ['m']] [$date ['d']] [$hash]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (empty($this->index[ $date['y'] ] [ $date['m'] ][ $date['d'] ])) {
 | 
								if (empty($this->index [$date ['y']] [$date ['m']] [$date ['d']])) {
 | 
				
			||||||
				unset($this->index[ $date['y'] ] [ $date['m'] ][ $date['d'] ]);
 | 
									unset($this->index [$date ['y']] [$date ['m']] [$date ['d']]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (empty($this->index[ $date['y'] ] [ $date['m'] ])) {
 | 
									if (empty($this->index [$date ['y']] [$date ['m']])) {
 | 
				
			||||||
					unset($this->index[ $date['y'] ] [ $date['m'] ]);
 | 
										unset($this->index [$date ['y']] [$date ['m']]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (empty($this->index[ $date['y'] ])) {
 | 
										if (empty($this->index [$date ['y']])) {
 | 
				
			||||||
						unset($this->index[ $date['y'] ]);
 | 
											unset($this->index [$date ['y']]);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->cache_save();
 | 
							$this->cache_save();
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function cache_add($id, $arr) {
 | 
						function cache_add($id, $arr) {
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		$date = date_from_id($id);
 | 
							$date = date_from_id($id);
 | 
				
			||||||
		$title = sanitize_title($arr['subject']);
 | 
							$title = sanitize_title($arr ['subject']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->cache_delete_elem($id, $date);
 | 
							$this->cache_delete_elem($id, $date);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->index[ $date['y'] ] [ $date['m'] ][ $date['d'] ][ md5($title) ] = $id;
 | 
							$this->index [$date ['y']] [$date ['m']] [$date ['d']] [md5($title)] = $id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->cache_save();
 | 
							$this->cache_save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function cache_get($y,$m,$d=null,$h=null) {
 | 
						function cache_get($y, $m, $d = null, $h = null) {
 | 
				
			||||||
		if (!isset($this->index[$y][$m])) {
 | 
							if (!isset($this->index [$y] [$m])) {
 | 
				
			||||||
			$s = @io_load_file(PRETTYURLS_CACHE.$y.$m);
 | 
								$s = @io_load_file(PRETTYURLS_CACHE . $y . $m);
 | 
				
			||||||
			$this->index[$y][$m] = $s? unserialize($s) : false;
 | 
								$this->index [$y] [$m] = $s ? unserialize($s) : false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (is_null($d))
 | 
							if (is_null($d))
 | 
				
			||||||
			return $this->index[$y][$m];
 | 
								return $this->index [$y] [$m];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (is_null($h))
 | 
							if (is_null($h))
 | 
				
			||||||
			return isset($this->index[$y][$m][$d])? $this->index[$y][$m][$d] : false;
 | 
								return isset($this->index [$y] [$m] [$d]) ? $this->index [$y] [$m] [$d] : false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (isset($this->index[$y][$m][$d]))
 | 
							if (isset($this->index [$y] [$m] [$d]))
 | 
				
			||||||
			return isset($this->index[$y][$m][$d][$h]);
 | 
								return isset($this->index [$y] [$m] [$d] [$h]);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -455,77 +430,74 @@ class Plugin_PrettyURLs {
 | 
				
			|||||||
		$date = date_from_id($id);
 | 
							$date = date_from_id($id);
 | 
				
			||||||
		$this->cache_delete_elem($id, $date);
 | 
							$this->cache_delete_elem($id, $date);
 | 
				
			||||||
		$this->cache_save();
 | 
							$this->cache_save();
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function cache_save() {
 | 
						function cache_save() {
 | 
				
			||||||
		if ($this->index) {
 | 
							if ($this->index) {
 | 
				
			||||||
			foreach ($this->index as $year => $months) {
 | 
								foreach ($this->index as $year => $months) {
 | 
				
			||||||
				foreach ($months as $month => $days)
 | 
									foreach ($months as $month => $days)
 | 
				
			||||||
				io_write_file(PRETTYURLS_CACHE.$year.$month, serialize($days));
 | 
										io_write_file(PRETTYURLS_CACHE . $year . $month, serialize($days));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	function nextprevlink($nextprev, $v) {
 | 
						function nextprevlink($nextprev, $v) {
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
		global $fpdb;
 | 
							global $fpdb;
 | 
				
			||||||
		$q =& $fpdb->getQuery();
 | 
							$q = & $fpdb->getQuery();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		list($caption, $id) = call_user_func(array(&$q, 'get'.$nextprev));
 | 
							list ($caption, $id) = call_user_func(array(
 | 
				
			||||||
 | 
								&$q,
 | 
				
			||||||
 | 
								'get' . $nextprev
 | 
				
			||||||
 | 
							));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!$id)
 | 
							if (!$id)
 | 
				
			||||||
			return array();
 | 
								return array();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if ($q->single) {
 | 
							if ($q->single) {
 | 
				
			||||||
			$date = date_from_id($id);
 | 
								$date = date_from_id($id);
 | 
				
			||||||
			if (PRETTYURLS_TITLES)
 | 
								if (PRETTYURLS_TITLES)
 | 
				
			||||||
				$title = sanitize_title($caption);
 | 
									$title = sanitize_title($caption);
 | 
				
			||||||
			else $title = $id;
 | 
								else
 | 
				
			||||||
			$url = $this->baseurl  . "20{$date['y']}/{$date['m']}/{$date['d']}/$title/";
 | 
									$title = $id;
 | 
				
			||||||
 | 
								$url = $this->baseurl . "20{$date['y']}/{$date['m']}/{$date['d']}/$title/";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if ($v>0) 
 | 
								if ($v > 0)
 | 
				
			||||||
				$caption = $caption . ' » ';
 | 
									$caption = $caption . ' » ';
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				$caption = ' « ' . $caption;
 | 
									$caption = ' « ' . $caption;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return array($caption,$url);
 | 
								return array(
 | 
				
			||||||
			
 | 
									$caption,
 | 
				
			||||||
 | 
									$url
 | 
				
			||||||
 | 
								);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		// else, we build a complete url
 | 
							// else, we build a complete url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* todo: clean up this mess... which means cleaning up the mess above. oh, my! */
 | 
							/* todo: clean up this mess... which means cleaning up the mess above. oh, my! */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$l = $this->baseurl ;
 | 
							$l = $this->baseurl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
							if ((is_numeric($cid = @$this->fp_params ['category'])) || is_numeric($cid = @$this->fp_params ['cat']))
 | 
				
			||||||
		if ( ( 	is_numeric($cid = @$this->fp_params['category']) ) ||
 | 
					 | 
				
			||||||
				is_numeric($cid = @$this->fp_params['cat']) ) 
 | 
					 | 
				
			||||||
			$l = $this->categorylink($l, $cid);
 | 
								$l = $this->categorylink($l, $cid);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (isset($this->fp_params['y']) && $this->fp_params['y']) {
 | 
							if (isset($this->fp_params ['y']) && $this->fp_params ['y']) {
 | 
				
			||||||
			$l .= '20'. $this->fp_params['y'] . '/';
 | 
								$l .= '20' . $this->fp_params ['y'] . '/';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (isset($this->fp_params['m']) && $this->fp_params['m']) {
 | 
								if (isset($this->fp_params ['m']) && $this->fp_params ['m']) {
 | 
				
			||||||
				$l .= $this->fp_params['m']  . '/';
 | 
									$l .= $this->fp_params ['m'] . '/';
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
				if (isset($this->fp_params['d']) && $this->fp_params['d'])
 | 
					 | 
				
			||||||
					$l .= $this->fp_params['d']  . '/';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									if (isset($this->fp_params ['d']) && $this->fp_params ['d'])
 | 
				
			||||||
 | 
										$l .= $this->fp_params ['d'] . '/';
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$page = 1;
 | 
							$page = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (isset($this->fp_params['paged']) && $this->fp_params['paged']>1) $page = $this->fp_params['paged'];
 | 
							if (isset($this->fp_params ['paged']) && $this->fp_params ['paged'] > 1)
 | 
				
			||||||
 | 
								$page = $this->fp_params ['paged'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$page += $v;
 | 
							$page += $v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -533,116 +505,150 @@ class Plugin_PrettyURLs {
 | 
				
			|||||||
			$l .= 'page/' . $page . '/';
 | 
								$l .= 'page/' . $page . '/';
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
							return array(
 | 
				
			||||||
		return array($caption,$l);
 | 
								$caption,
 | 
				
			||||||
		
 | 
								$l
 | 
				
			||||||
		
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	global $plugin_prettyurls;
 | 
					global $plugin_prettyurls;
 | 
				
			||||||
	$plugin_prettyurls = new Plugin_PrettyURLs;
 | 
					$plugin_prettyurls = new Plugin_PrettyURLs();
 | 
				
			||||||
	$plugin_prettyurls->categories();
 | 
					$plugin_prettyurls->categories();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (!defined('MOD_ADMIN_PANEL')) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!defined('MOD_ADMIN_PANEL')){
 | 
						if (!function_exists('get_nextpage_link')) :
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
		if (!function_exists('get_nextpage_link')) :
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		function get_nextpage_link() {
 | 
							function get_nextpage_link() {
 | 
				
			||||||
			global $plugin_prettyurls;
 | 
								global $plugin_prettyurls;
 | 
				
			||||||
			return $plugin_prettyurls->nextprevlink('NextPage', 1);
 | 
								return $plugin_prettyurls->nextprevlink('NextPage', 1);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		function get_prevpage_link() {
 | 
							function get_prevpage_link() {
 | 
				
			||||||
			global $plugin_prettyurls;
 | 
								global $plugin_prettyurls;
 | 
				
			||||||
			return $plugin_prettyurls->nextprevlink('PrevPage',-1);
 | 
								return $plugin_prettyurls->nextprevlink('PrevPage', -1);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		endif;
 | 
							endif;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					add_filter('post_link', array(
 | 
				
			||||||
 | 
						&$plugin_prettyurls,
 | 
				
			||||||
 | 
						'permalink'
 | 
				
			||||||
 | 
					), 0, 2);
 | 
				
			||||||
 | 
					add_filter('comments_link', array(
 | 
				
			||||||
 | 
						&$plugin_prettyurls,
 | 
				
			||||||
 | 
						'commentlink'
 | 
				
			||||||
 | 
					), 0, 2);
 | 
				
			||||||
 | 
					add_filter('feed_link', array(
 | 
				
			||||||
 | 
						&$plugin_prettyurls,
 | 
				
			||||||
 | 
						'feedlink'
 | 
				
			||||||
 | 
					), 0, 2);
 | 
				
			||||||
 | 
					add_filter('post_comments_feed_link', array(
 | 
				
			||||||
 | 
						&$plugin_prettyurls,
 | 
				
			||||||
 | 
						'commentsfeedlink'
 | 
				
			||||||
 | 
					), 0, 3);
 | 
				
			||||||
 | 
					add_filter('category_link', array(
 | 
				
			||||||
 | 
						&$plugin_prettyurls,
 | 
				
			||||||
 | 
						'categorylink'
 | 
				
			||||||
 | 
					), 0, 2);
 | 
				
			||||||
 | 
					add_filter('page_link', array(
 | 
				
			||||||
 | 
						&$plugin_prettyurls,
 | 
				
			||||||
 | 
						'staticlink'
 | 
				
			||||||
 | 
					), 0, 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// date related functions
 | 
				
			||||||
 | 
					add_filter('year_link', array(
 | 
				
			||||||
 | 
						&$plugin_prettyurls,
 | 
				
			||||||
 | 
						'yearlink'
 | 
				
			||||||
 | 
					), 0, 2);
 | 
				
			||||||
 | 
					add_filter('month_link', array(
 | 
				
			||||||
 | 
						&$plugin_prettyurls,
 | 
				
			||||||
 | 
						'monthlink'
 | 
				
			||||||
 | 
					), 0, 3);
 | 
				
			||||||
 | 
					add_filter('day_link', array(
 | 
				
			||||||
 | 
						&$plugin_prettyurls,
 | 
				
			||||||
 | 
						'daylink'
 | 
				
			||||||
 | 
					), 0, 4);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	add_filter('post_link', 	array(&$plugin_prettyurls,'permalink'), 0, 2);
 | 
					if (PRETTYURLS_TITLES) {
 | 
				
			||||||
	add_filter('comments_link', array(&$plugin_prettyurls, 'commentlink'), 0, 2);
 | 
						add_filter('publish_post', array(
 | 
				
			||||||
	add_filter('feed_link', 	array(&$plugin_prettyurls, 'feedlink'), 0, 2);
 | 
							&$plugin_prettyurls,
 | 
				
			||||||
	add_filter('post_comments_feed_link', array(&$plugin_prettyurls, 'commentsfeedlink'), 0, 3);
 | 
							'cache_add'
 | 
				
			||||||
	add_filter('category_link', array(&$plugin_prettyurls,'categorylink'), 0, 2);
 | 
						), 5, 2);
 | 
				
			||||||
	add_filter('page_link', 	array(&$plugin_prettyurls, 'staticlink'), 0, 2);
 | 
						add_filter('delete_post', array(
 | 
				
			||||||
 | 
							&$plugin_prettyurls,
 | 
				
			||||||
 | 
							'cache_delete'
 | 
				
			||||||
 | 
						));
 | 
				
			||||||
 | 
						add_action('update_categories', array(
 | 
				
			||||||
 | 
							&$plugin_prettyurls,
 | 
				
			||||||
 | 
							'categories'
 | 
				
			||||||
 | 
						));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// date related functions
 | 
					add_filter('init', array(
 | 
				
			||||||
	add_filter('year_link', 	array(&$plugin_prettyurls,'yearlink'), 0, 2);
 | 
						&$plugin_prettyurls,
 | 
				
			||||||
	add_filter('month_link', 	array(&$plugin_prettyurls,'monthlink'), 0, 3);
 | 
						'cache_init'
 | 
				
			||||||
	add_filter('day_link', 		array(&$plugin_prettyurls,'daylink'), 0, 4);
 | 
					));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (PRETTYURLS_TITLES) {
 | 
					if (class_exists('AdminPanelAction')) {
 | 
				
			||||||
		add_filter('publish_post', 	array(&$plugin_prettyurls, 'cache_add'), 5, 2);
 | 
					 | 
				
			||||||
		add_filter('delete_post', 	array(&$plugin_prettyurls, 'cache_delete'));
 | 
					 | 
				
			||||||
		add_action('update_categories',  array(&$plugin_prettyurls, 'categories'));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	add_filter('init', 			array(&$plugin_prettyurls, 'cache_init'));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if (class_exists('AdminPanelAction')){
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class admin_plugin_prettyurls extends AdminPanelAction {
 | 
						class admin_plugin_prettyurls extends AdminPanelAction {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		var $langres = 'plugin:prettyurls';
 | 
							var $langres = 'plugin:prettyurls';
 | 
				
			||||||
		var $_config = array('mode'=>0);
 | 
					
 | 
				
			||||||
 | 
							var $_config = array(
 | 
				
			||||||
 | 
								'mode' => 0
 | 
				
			||||||
 | 
							);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		function setup() {
 | 
							function setup() {
 | 
				
			||||||
			$this->smarty->assign('admin_resource', "plugin:prettyurls/admin.plugin.prettyurls");
 | 
								$this->smarty->assign('admin_resource', "plugin:prettyurls/admin.plugin.prettyurls");
 | 
				
			||||||
			$this->_config['mode'] = plugin_getoptions('prettyurls', 'mode');
 | 
								$this->_config ['mode'] = plugin_getoptions('prettyurls', 'mode');
 | 
				
			||||||
			$this->smarty->assign('pconfig', $this->_config);
 | 
								$this->smarty->assign('pconfig', $this->_config);
 | 
				
			||||||
			$blogroot = BLOG_ROOT;
 | 
								$blogroot = BLOG_ROOT;
 | 
				
			||||||
			$f = ABS_PATH . '.htaccess';
 | 
								$f = ABS_PATH . '.htaccess';
 | 
				
			||||||
			$txt = io_load_file($f);
 | 
								$txt = io_load_file($f);
 | 
				
			||||||
			if (!$txt) {
 | 
								if (!$txt) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$txt =<<<STR
 | 
									$txt = <<<STR
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
# Thanks again WP :)
 | 
									# Thanks again WP :)
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
<IfModule mod_rewrite.c>
 | 
									<IfModule mod_rewrite.c>
 | 
				
			||||||
RewriteEngine On
 | 
									RewriteEngine On
 | 
				
			||||||
RewriteBase {$blogroot}
 | 
									RewriteBase {$blogroot}
 | 
				
			||||||
RewriteCond %{REQUEST_FILENAME} !-f
 | 
									RewriteCond %{REQUEST_FILENAME} !-f
 | 
				
			||||||
RewriteCond %{REQUEST_FILENAME} !-d
 | 
									RewriteCond %{REQUEST_FILENAME} !-d
 | 
				
			||||||
RewriteRule . {$blogroot}index.php [L]
 | 
									RewriteRule . {$blogroot}index.php [L]
 | 
				
			||||||
</IfModule>
 | 
									</IfModule>
 | 
				
			||||||
STR;
 | 
									STR;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			
 | 
								$this->smarty->assign('cantsave', (!is_writable(ABS_PATH) || (file_exists($f) && !is_writable($f))));
 | 
				
			||||||
			$this->smarty->assign('cantsave', 
 | 
					 | 
				
			||||||
				( !is_writable(ABS_PATH) || (file_exists($f) && !is_writable($f)) )
 | 
					 | 
				
			||||||
			);	
 | 
					 | 
				
			||||||
			$this->smarty->assign('htaccess', $txt);
 | 
								$this->smarty->assign('htaccess', $txt);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		function onsubmit($data = null) {
 | 
							function onsubmit($data = null) {
 | 
				
			||||||
			global $fp_config;
 | 
								global $fp_config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (isset($_POST['saveopt'])) {
 | 
								if (isset($_POST ['saveopt'])) {
 | 
				
			||||||
				$this->_config['mode'] = (int) $_POST['mode'] ;
 | 
									$this->_config ['mode'] = (int) $_POST ['mode'];
 | 
				
			||||||
				plugin_addoption('prettyurls', 'mode', $this->_config['mode']);
 | 
									plugin_addoption('prettyurls', 'mode', $this->_config ['mode']);
 | 
				
			||||||
				if( plugin_saveoptions() )
 | 
									if (plugin_saveoptions())
 | 
				
			||||||
					$this->smarty->assign('success', 2);
 | 
										$this->smarty->assign('success', 2);
 | 
				
			||||||
				else	$this->smarty->assign('success', -2); 
 | 
									else
 | 
				
			||||||
 | 
										$this->smarty->assign('success', -2);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (isset($_POST['htaccess-submit'])) {
 | 
								if (isset($_POST ['htaccess-submit'])) {
 | 
				
			||||||
					if (!empty($_POST['htaccess']) && io_write_file(ABS_PATH.'.htaccess', $_POST['htaccess'])){
 | 
									if (!empty($_POST ['htaccess']) && io_write_file(ABS_PATH . '.htaccess', $_POST ['htaccess'])) {
 | 
				
			||||||
						$this->smarty->assign('success', 1);
 | 
										$this->smarty->assign('success', 1);
 | 
				
			||||||
					} else {
 | 
									} else {
 | 
				
			||||||
						$this->smarty->assign('success', -1);
 | 
										$this->smarty->assign('success', -1);
 | 
				
			||||||
					}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return 2;
 | 
								return 2;
 | 
				
			||||||
@ -651,7 +657,6 @@ STR;
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	admin_addpanelaction('plugin', 'prettyurls', true);
 | 
						admin_addpanelaction('plugin', 'prettyurls', true);
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
				
			|||||||
@ -1,20 +1,23 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: QuickSpamFilter
 | 
					 * Plugin Name: QuickSpamFilter
 | 
				
			||||||
Plugin URI: http://flatpress.nowherland.it/
 | 
					 * Version: 3.5.1
 | 
				
			||||||
Description: Quick ban words (edit the plugin to add more to the list) 
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Author: NoWhereMan
 | 
					 * Author: FlatPress
 | 
				
			||||||
Version: 3.5.1
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author URI: http://www.nowhereland.it
 | 
					 * Description: Block comments by "bad" words. Part of the standard distribution.
 | 
				
			||||||
*/
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This plugin denies comments when they're containing "bad words",
 | 
					 * 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
 | 
					 * @global $smarty
 | 
				
			||||||
 * @param boolean $bool
 | 
					 * @param boolean $bool
 | 
				
			||||||
 * @param string $contents The comment
 | 
					 * @param string $contents
 | 
				
			||||||
 | 
					 *        	The comment
 | 
				
			||||||
 * @return unknown
 | 
					 * @return unknown
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function plugin_qspam_validate($bool, $contents) {
 | 
					function plugin_qspam_validate($bool, $contents) {
 | 
				
			||||||
@ -24,35 +27,40 @@ function plugin_qspam_validate($bool, $contents) {
 | 
				
			|||||||
	$qscfg = plugin_getoptions('qspam');
 | 
						$qscfg = plugin_getoptions('qspam');
 | 
				
			||||||
	// We're looking for these words:
 | 
						// We're looking for these words:
 | 
				
			||||||
	$BAN_WORDS = '';
 | 
						$BAN_WORDS = '';
 | 
				
			||||||
	if (isset($qscfg['wordlist'])) {
 | 
						if (isset($qscfg ['wordlist'])) {
 | 
				
			||||||
		$BAN_WORDS = $qscfg['wordlist'];
 | 
							$BAN_WORDS = $qscfg ['wordlist'];
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		// rudimentary ban of links
 | 
							// rudimentary ban of links
 | 
				
			||||||
		$BAN_WORDS = array('href', '[url');
 | 
							$BAN_WORDS = array(
 | 
				
			||||||
 | 
								'href',
 | 
				
			||||||
 | 
								'[url'
 | 
				
			||||||
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	$qscfg['number'] = isset($qscfg['number'])
 | 
						$qscfg ['number'] = isset($qscfg ['number']) ? $qscfg ['number'] : 1;
 | 
				
			||||||
		? $qscfg['number']
 | 
						$txt = strtolower(trim($contents ['content']));
 | 
				
			||||||
		: 1;
 | 
					 | 
				
			||||||
	$txt = strtolower(trim($contents['content']));
 | 
					 | 
				
			||||||
	$count = 0;
 | 
						$count = 0;
 | 
				
			||||||
	while ($w = array_pop($BAN_WORDS)) {
 | 
						while ($w = array_pop($BAN_WORDS)) {
 | 
				
			||||||
		$count += substr_count($txt, strtolower($w));
 | 
							$count += substr_count($txt, strtolower($w));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if ($count >= $qscfg['number']) {
 | 
						if ($count >= $qscfg ['number']) {
 | 
				
			||||||
		global $smarty;
 | 
							global $smarty;
 | 
				
			||||||
		$lang = lang_load('plugin:qspam');
 | 
							$lang = lang_load('plugin:qspam');
 | 
				
			||||||
		$smarty->assign('error', array($lang['plugin']['qspam']['error']));
 | 
							$smarty->assign('error', array(
 | 
				
			||||||
 | 
								$lang ['plugin'] ['qspam'] ['error']
 | 
				
			||||||
 | 
							));
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
add_action('comment_validate', 'plugin_qspam_validate', 5, 2);
 | 
					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.
 | 
						 * Provides an admin panel entry for QuickSpam setup.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	class admin_plugin_qspam extends AdminPanelAction {
 | 
						class admin_plugin_qspam extends AdminPanelAction {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		var $langres = 'plugin:qspam';
 | 
							var $langres = 'plugin:qspam';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/**
 | 
							/**
 | 
				
			||||||
@ -67,12 +75,8 @@ if (class_exists('AdminPanelAction')){
 | 
				
			|||||||
		 */
 | 
							 */
 | 
				
			||||||
		function main() {
 | 
							function main() {
 | 
				
			||||||
			$qscfg = plugin_getoptions('qspam');
 | 
								$qscfg = plugin_getoptions('qspam');
 | 
				
			||||||
			$qscfg['wordlist'] = isset($qscfg['wordlist']) && is_array($qscfg['wordlist'])
 | 
								$qscfg ['wordlist'] = isset($qscfg ['wordlist']) && is_array($qscfg ['wordlist']) ? implode("\n", $qscfg ['wordlist']) : '';
 | 
				
			||||||
				? implode("\n", $qscfg['wordlist'])
 | 
								$qscfg ['number'] = isset($qscfg ['number']) ? $qscfg ['number'] : 1;
 | 
				
			||||||
				: '';
 | 
					 | 
				
			||||||
			$qscfg['number'] = isset($qscfg['number'])
 | 
					 | 
				
			||||||
				? $qscfg['number']
 | 
					 | 
				
			||||||
				: 1;
 | 
					 | 
				
			||||||
			$this->smarty->assign('qscfg', $qscfg);
 | 
								$this->smarty->assign('qscfg', $qscfg);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -82,30 +86,30 @@ if (class_exists('AdminPanelAction')){
 | 
				
			|||||||
		 * @return int
 | 
							 * @return int
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		function onsubmit($data = null) {
 | 
							function onsubmit($data = null) {
 | 
				
			||||||
			if ($_POST['qs-wordlist']){
 | 
								if ($_POST ['qs-wordlist']) {
 | 
				
			||||||
				$wordlist = isset($_POST['qs-wordlist'])
 | 
									$wordlist = isset($_POST ['qs-wordlist']) ? stripslashes($_POST ['qs-wordlist']) : '';
 | 
				
			||||||
					? stripslashes($_POST['qs-wordlist'])
 | 
					 | 
				
			||||||
					: '';
 | 
					 | 
				
			||||||
				$wordlist = str_replace("\r", "\n", $wordlist);
 | 
									$wordlist = str_replace("\r", "\n", $wordlist);
 | 
				
			||||||
				// DMKE: Works neither recursive correct nor in a loop... *grrr*
 | 
									// 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 = explode("\n", $wordlist);
 | 
				
			||||||
				$wordlist = array_filter($wordlist, array($this, '_array_filter'));
 | 
									$wordlist = array_filter($wordlist, array(
 | 
				
			||||||
				$number = isset($_POST['qs-number']) && is_numeric($_POST['qs-number'])
 | 
										$this,
 | 
				
			||||||
					? (int)$_POST['qs-number']
 | 
										'_array_filter'
 | 
				
			||||||
					: 1;
 | 
									));
 | 
				
			||||||
 | 
									$number = isset($_POST ['qs-number']) && is_numeric($_POST ['qs-number']) ? (int) $_POST ['qs-number'] : 1;
 | 
				
			||||||
				plugin_addoption('qspam', 'wordlist', $wordlist);
 | 
									plugin_addoption('qspam', 'wordlist', $wordlist);
 | 
				
			||||||
				plugin_addoption('qspam', 'number', $number);
 | 
									plugin_addoption('qspam', 'number', $number);
 | 
				
			||||||
				plugin_saveoptions('qspam');
 | 
									plugin_saveoptions('qspam');
 | 
				
			||||||
				$this->smarty->assign('success', 1);
 | 
									$this->smarty->assign('success', 1);
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
			 	$this->smarty->assign('success', -1);
 | 
									$this->smarty->assign('success', -1);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			return 2;
 | 
								return 2;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/**
 | 
							/**
 | 
				
			||||||
		 * Array filter callback function. Culls empty array values.
 | 
							 * Array filter callback function.
 | 
				
			||||||
 | 
							 * Culls empty array values.
 | 
				
			||||||
		 * Life is hell ._.
 | 
							 * Life is hell ._.
 | 
				
			||||||
		 *
 | 
							 *
 | 
				
			||||||
		 * @param string $str
 | 
							 * @param string $str
 | 
				
			||||||
@ -114,6 +118,7 @@ if (class_exists('AdminPanelAction')){
 | 
				
			|||||||
		function _array_filter($str) {
 | 
							function _array_filter($str) {
 | 
				
			||||||
			return strlen(trim($str)) > 0;
 | 
								return strlen(trim($str)) > 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	admin_addpanelaction('plugin', 'qspam', true);
 | 
						admin_addpanelaction('plugin', 'qspam', true);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -2,11 +2,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Plugin Name: ReadMore
 | 
					 * Plugin Name: ReadMore
 | 
				
			||||||
 * Plugin URI: http://www.nowhereland.it/
 | 
					 * Version: 1.0
 | 
				
			||||||
 * Description: ReadMore plugin. Chops a lengthy entry and appends a "read more" link :)
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
 * Author: NoWhereMan
 | 
					 * Author: FlatPress
 | 
				
			||||||
 * Version: 0.703
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
 * Author URI: http://www.nowhereland.it/
 | 
					 * 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
 | 
					// $MODE specifies when you want to chop your entry
 | 
				
			||||||
 | 
				
			|||||||
@ -2,10 +2,10 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Plugin Name: SearchBox
 | 
					 * Plugin Name: SearchBox
 | 
				
			||||||
 * Version: 1.0
 | 
					 * Version: 1.0
 | 
				
			||||||
 * Plugin URI: http://flatpress.sf.net
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
 * Description: SearchBox which interfaces with standard search function
 | 
					 * Author: FlatPress
 | 
				
			||||||
 * Author: NoWhereMan
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
 * Author URI: http://flatpress.sf.net
 | 
					 * Description: Adds a search box widget. Part of the standard distribution.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
define('SEARCHBOX_BIG', false);
 | 
					define('SEARCHBOX_BIG', false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,28 +1,24 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
Plugin Name: Thumbnails
 | 
					 * Plugin Name: Thumbnails
 | 
				
			||||||
Plugin URI: http://www.nowhereland.it/
 | 
					 * Version: 1.0
 | 
				
			||||||
Description: Thumbnail plugin. Part of the standard distribution ;) If this is loaded scale parameter of images will create a scaled version of your img
 | 
					 * Plugin URI: https://www.flatpress.org
 | 
				
			||||||
Author: NoWhereMan real_nowhereman at user dot sf dot net
 | 
					 * Author: FlatPress
 | 
				
			||||||
Version: 1.0
 | 
					 * Author URI: https://www.flatpress.org
 | 
				
			||||||
Author URI: http://www.nowhereland.it/
 | 
					 * Description: Creates thumbnails for scaled images. Part of the standard distribution.
 | 
				
			||||||
*/ 
 | 
					 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
define('THUMB_DIR', '.thumbs');
 | 
					define('THUMB_DIR', '.thumbs');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if (!function_exists('imagegd2')) {
 | 
				
			||||||
if (!function_exists('imagegd2'))
 | 
						define('PLUGIN_THUMB_ENABLED', false);
 | 
				
			||||||
		{ define('PLUGIN_THUMB_ENABLED', false);  }
 | 
					} else {
 | 
				
			||||||
else { define('PLUGIN_THUMB_ENABLED', true); }
 | 
						define('PLUGIN_THUMB_ENABLED', true);
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function plugin_thumb_setup() {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return PLUGIN_THUMB_ENABLED? 1 : -1;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function plugin_thumb_setup() {
 | 
				
			||||||
 | 
						return PLUGIN_THUMB_ENABLED ? 1 : -1;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@ -30,17 +26,17 @@ function plugin_thumb_setup() {
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * creates a thumbnail and caches the thumbnail in IMAGES_DIR/.thumb
 | 
					 * creates a thumbnail and caches the thumbnail in IMAGES_DIR/.thumb
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param string $fpath string with filepath
 | 
					 * @param string $fpath
 | 
				
			||||||
 * @param array $infos infos from getimagesize($fpath) function
 | 
					 *        	string with filepath
 | 
				
			||||||
 | 
					 * @param array $infos
 | 
				
			||||||
 | 
					 *        	infos from getimagesize($fpath) function
 | 
				
			||||||
 * @param int $new_width
 | 
					 * @param int $new_width
 | 
				
			||||||
 * @param int $new_height
 | 
					 * @param int $new_height
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * @return array array(string $thumbpath, int $thumbwidth, int $thumbheight)
 | 
					 * @return array array(string $thumbpath, int $thumbwidth, int $thumbheight)
 | 
				
			||||||
 *        
 | 
					 *        
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					 | 
				
			||||||
function plugin_thumb_create($fpath, $infos, $new_width, $new_height) {
 | 
					function plugin_thumb_create($fpath, $infos, $new_width, $new_height) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (!defined('PLUGIN_THUMB_ENABLED')) {
 | 
						if (!defined('PLUGIN_THUMB_ENABLED')) {
 | 
				
			||||||
		return array();
 | 
							return array();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -55,36 +51,40 @@ function plugin_thumb_create($fpath, $infos, $new_width, $new_height) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$thumbname = basename($fpath);
 | 
						$thumbname = basename($fpath);
 | 
				
			||||||
	$thumbdir  = dirname($fpath) . '/' . THUMB_DIR ;
 | 
						$thumbdir = dirname($fpath) . '/' . THUMB_DIR;
 | 
				
			||||||
	$thumbpath = $thumbdir .'/'. $thumbname;
 | 
						$thumbpath = $thumbdir . '/' . $thumbname;
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (file_exists($thumbpath)) {
 | 
						if (file_exists($thumbpath)) {
 | 
				
			||||||
		$oldthumbinfo = getimagesize($thumbpath);
 | 
							$oldthumbinfo = getimagesize($thumbpath);
 | 
				
			||||||
		if ($new_width==$oldthumbinfo[0]) {
 | 
							if ($new_width == $oldthumbinfo [0]) {
 | 
				
			||||||
			// already scaled
 | 
								// already scaled
 | 
				
			||||||
			return array($thumbpath, $new_width, $new_height);
 | 
								return array(
 | 
				
			||||||
 | 
									$thumbpath,
 | 
				
			||||||
 | 
									$new_width,
 | 
				
			||||||
 | 
									$new_height
 | 
				
			||||||
 | 
								);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@fs_mkdir($thumbdir);
 | 
						@fs_mkdir($thumbdir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	// we support only jpeg's, png's and gif's
 | 
						// we support only jpeg's, png's and gif's
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch($infos[2]) {
 | 
						switch ($infos [2]) {
 | 
				
			||||||
		case 1: $image = imagecreatefromgif($fpath); break;
 | 
							case 1:
 | 
				
			||||||
		case 2: $image = imagecreatefromjpeg ($fpath); break;
 | 
								$image = imagecreatefromgif($fpath);
 | 
				
			||||||
		case 3: $image = imagecreatefrompng($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
 | 
						// create empty scaled and copy(resized) the picture
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	$scaled = imagecreatetruecolor($new_width, $new_height);
 | 
						$scaled = imagecreatetruecolor($new_width, $new_height);
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * If gif or png preserve the alpha channel
 | 
						 * 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
 | 
						 * Added by Piero VDFN
 | 
				
			||||||
	 * Kudos to http://www.php.net/manual/en/function.imagecopyresampled.php#104028
 | 
						 * 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));
 | 
							imagecolortransparent($scaled, imagecolorallocatealpha($scaled, 0, 0, 0, 127));
 | 
				
			||||||
		imagealphablending($scaled, false);
 | 
							imagealphablending($scaled, false);
 | 
				
			||||||
		imagesavealpha($scaled, true);
 | 
							imagesavealpha($scaled, true);
 | 
				
			||||||
		$output=$infos[2]==3 ? 'png' : 'gif';
 | 
							$output = $infos [2] == 3 ? 'png' : 'gif';
 | 
				
			||||||
	} else {
 | 
						} 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);
 | 
							imagepng($scaled, $thumbpath);
 | 
				
			||||||
	} elseif($output=='gif') {
 | 
						} elseif ($output == 'gif') {
 | 
				
			||||||
		imagegif($scaled, $thumbpath);
 | 
							imagegif($scaled, $thumbpath);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		imagejpeg($scaled, $thumbpath);
 | 
							imagejpeg($scaled, $thumbpath);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@chmod($thumbpath, FILE_PERMISSIONS);
 | 
						@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){
 | 
					function plugin_thumb_bbcodehook($actualpath, $props, $newsize) {
 | 
				
			||||||
	list($width, $height) = $newsize;
 | 
						list ($width, $height) = $newsize;
 | 
				
			||||||
	if ($thumb = plugin_thumb_create($actualpath, $props, $width, $height))
 | 
						if ($thumb = plugin_thumb_create($actualpath, $props, $width, $height))
 | 
				
			||||||
		$thumb = BBCODE_USE_WRAPPER? 
 | 
							$thumb = BBCODE_USE_WRAPPER ? ("getfile.php?f=" . basename($actualpath) . '&thumb=true') : $thumb [0];
 | 
				
			||||||
				("getfile.php?f=" . basename($actualpath) .'&thumb=true') : $thumb[0];
 | 
					 | 
				
			||||||
	return $thumb;
 | 
						return $thumb;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user