Included Matthias Mauch's PHP7.1 patch. Besides other changes regarding PHP7 compatibility, it replaces all the class-named constructors with __construct(). Thanks a lot, Matthias!
Please visit his website http://www.aadmm.org/fp-patch/ and read patch-description.txt to learn more about the details of the patch. I adapted the patch slighty: It now does not just add a __construct() function to the existing class-named one, instead it replaces it completely. Therefore, some parent::__construct() calls had to be changed, too.
This commit is contained in:
parent
11818bd4e7
commit
6b8a4776df
@ -22,7 +22,7 @@
|
|||||||
var $actionpanel = null;
|
var $actionpanel = null;
|
||||||
|
|
||||||
|
|
||||||
function AdminPanel(&$smarty) {
|
function __construct(&$smarty) {
|
||||||
$this->smarty =& $smarty;
|
$this->smarty =& $smarty;
|
||||||
if (!$this->panelname)
|
if (!$this->panelname)
|
||||||
trigger_error("Variable \$panelname is not defined!", E_USER_ERROR);
|
trigger_error("Variable \$panelname is not defined!", E_USER_ERROR);
|
||||||
@ -100,7 +100,7 @@
|
|||||||
|
|
||||||
var $langres = '';
|
var $langres = '';
|
||||||
|
|
||||||
function AdminPanelAction(&$smarty) {
|
function __construct(&$smarty) {
|
||||||
$this->smarty =& $smarty;
|
$this->smarty =& $smarty;
|
||||||
$the_action_panel = get_class($this);
|
$the_action_panel = get_class($this);
|
||||||
$this->smarty->assign('admin_panel_id', $the_action_panel);
|
$this->smarty->assign('admin_panel_id', $the_action_panel);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
/* utility class */
|
/* utility class */
|
||||||
class tpl_deleter extends fs_filelister {
|
class tpl_deleter extends fs_filelister {
|
||||||
|
|
||||||
function tpl_deleter() {
|
function __construct() {
|
||||||
|
|
||||||
//$this->smarty = $GLOBALS['_FP_SMARTY'];
|
//$this->smarty = $GLOBALS['_FP_SMARTY'];
|
||||||
|
|
||||||
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
var $_directory = CONTENT_DIR;
|
var $_directory = CONTENT_DIR;
|
||||||
|
|
||||||
function s_entry_crawler() {
|
function __construct() {
|
||||||
$this->index = entry_init();
|
$this->index = entry_init();
|
||||||
parent::fs_filelister();
|
parent::fs_filelister();
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
var $panelname = 'themes';
|
var $panelname = 'themes';
|
||||||
var $actions = array('default' => true);
|
var $actions = array('default' => true);
|
||||||
|
|
||||||
function admin_themes(&$smarty) {
|
function __construct(&$smarty) {
|
||||||
global $theme;
|
global $theme;
|
||||||
|
|
||||||
if ($theme['version'] > 0.703)
|
if ($theme['version'] > 0.703)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
class admin_themes_obj_style_idx extends fs_filelister {
|
class admin_themes_obj_style_idx extends fs_filelister {
|
||||||
|
|
||||||
function admin_themes_obj_style_idx() {
|
function __construct() {
|
||||||
$this->_directory = THEMES_DIR . THE_THEME;
|
$this->_directory = THEMES_DIR . THE_THEME;
|
||||||
parent::fs_filelister();
|
parent::fs_filelister();
|
||||||
}
|
}
|
||||||
|
59
defaults.php
59
defaults.php
@ -103,16 +103,69 @@
|
|||||||
|
|
||||||
|
|
||||||
set_include_path(ABS_PATH);
|
set_include_path(ABS_PATH);
|
||||||
|
|
||||||
|
//
|
||||||
|
// original Flatpress 1.0.3 coding disabled
|
||||||
|
//
|
||||||
// compatibility with ISS
|
// compatibility with ISS
|
||||||
|
// if (!isset($_SERVER['REQUEST_URI']))
|
||||||
|
// $_SERVER['REQUEST_URI'] = 'http://localhost/flatpress/';
|
||||||
|
|
||||||
|
// #define('BLOG_ROOT', dirname($_SERVER['PHP_SELF']) . '/');
|
||||||
|
// define('BLOG_ROOT', ('/'==($v=dirname($_SERVER['SCRIPT_NAME']))? $v : $v.'/') );
|
||||||
|
|
||||||
|
// define('BLOG_BASEURL', 'http://'.$_SERVER['HTTP_HOST']. BLOG_ROOT);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Adding security and HTTPS support
|
||||||
|
//
|
||||||
|
|
||||||
|
ini_set('session.cookie_httponly', 1);
|
||||||
|
ini_set('session.use_only_cookies', 1);
|
||||||
|
|
||||||
|
if (isset($_SERVER['HTTPS'])) {
|
||||||
|
$_SERVER['HTTPS'] = htmlspecialchars($_SERVER['HTTPS'], ENT_QUOTES, "UTF-8");
|
||||||
|
}
|
||||||
|
$serverport = "false";
|
||||||
|
// Unterstützung für Apache und IIS
|
||||||
|
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == '1' || strtolower($_SERVER['HTTPS'])=='on')) {
|
||||||
|
$serverport = "https://";
|
||||||
|
// Uses a secure connection (HTTPS) if possible
|
||||||
|
ini_set('session.cookie_secure', 1);
|
||||||
|
} else {
|
||||||
|
$serverport = "http://";
|
||||||
|
}
|
||||||
|
|
||||||
|
// compatibility with ISS
|
||||||
|
$_SERVER["REQUEST_URI"] = htmlspecialchars($_SERVER["REQUEST_URI"], ENT_QUOTES, "UTF-8");
|
||||||
if (!isset($_SERVER['REQUEST_URI']))
|
if (!isset($_SERVER['REQUEST_URI']))
|
||||||
$_SERVER['REQUEST_URI'] = 'http://localhost/flatpress/';
|
$_SERVER['REQUEST_URI'] = $serverport . 'localhost/flatpress/';
|
||||||
|
|
||||||
#define('BLOG_ROOT', dirname($_SERVER['PHP_SELF']) . '/');
|
#define('BLOG_ROOT', dirname($_SERVER['PHP_SELF']) . '/');
|
||||||
define('BLOG_ROOT', ('/'==($v=dirname($_SERVER['SCRIPT_NAME']))? $v : $v.'/') );
|
define('BLOG_ROOT', ('/'==($v=dirname($_SERVER['SCRIPT_NAME']))? $v : $v.'/') );
|
||||||
|
|
||||||
|
|
||||||
define('BLOG_BASEURL', 'http://'.$_SERVER['HTTP_HOST']. BLOG_ROOT);
|
define('BLOG_BASEURL', $serverport . $_SERVER['HTTP_HOST'] . BLOG_ROOT);
|
||||||
|
|
||||||
|
//
|
||||||
|
// OWASP - Browser Cache - How can the browser cache be used in attacks?
|
||||||
|
// https://www.owasp.org/index.php/OWASP_Application_Security_FAQ#How_can_the_browser_cache_be_used_in_attacks.3F
|
||||||
|
//
|
||||||
|
// http://stackoverflow.com/questions/13640109/how-to-prevent-browser-cache-for-php-site
|
||||||
|
//
|
||||||
|
header('Expires: Sun, 01 Jan 2015 00:00:00 GMT');
|
||||||
|
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||||
|
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
||||||
|
header('Pragma: no-cache');
|
||||||
|
//
|
||||||
|
// http://de.wikipedia.org/wiki/Liste_der_HTTP-Headerfelder
|
||||||
|
//
|
||||||
|
header('X-Frame-Options: SAMEORIGIN');
|
||||||
|
header('X-XSS-Protection: 1; mode=block');
|
||||||
|
header('X-Content-Type-Options: nosniff');
|
||||||
|
//
|
||||||
|
// End of send header
|
||||||
|
//
|
||||||
|
|
||||||
#function _dummy() {}
|
#function _dummy() {}
|
||||||
#set_error_handler('_dummy');
|
#set_error_handler('_dummy');
|
||||||
|
@ -206,7 +206,7 @@ class pairs {
|
|||||||
* @parma array $b array of the second elements of each pair
|
* @parma array $b array of the second elements of each pair
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function pairs($a, $b) {
|
function __construct($a, $b) {
|
||||||
if (($v=count($a))!=count($b))
|
if (($v=count($a))!=count($b))
|
||||||
trigger_error("Size of params must match", E_USER_ERROR);
|
trigger_error("Size of params must match", E_USER_ERROR);
|
||||||
$this->a=$a; $this->b=$b;
|
$this->a=$a; $this->b=$b;
|
||||||
@ -388,7 +388,7 @@ class BPlusTree_Node_Fifo {
|
|||||||
* constructor
|
* constructor
|
||||||
* @param int $size specifies size (defaults to 30)
|
* @param int $size specifies size (defaults to 30)
|
||||||
*/
|
*/
|
||||||
function BPlusTree_Node_Fifo($size=30) {
|
function __construct($size=30) {
|
||||||
$this->fifosize=$size;
|
$this->fifosize=$size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -491,7 +491,7 @@ class BPlusTree_Node {
|
|||||||
* @param resource resource stream (opened file)
|
* @param resource resource stream (opened file)
|
||||||
* @param BPlusTree_Node object from which cloning properties
|
* @param BPlusTree_Node object from which cloning properties
|
||||||
*/
|
*/
|
||||||
function BPlusTree_Node($flag,
|
function __construct($flag,
|
||||||
$size,
|
$size,
|
||||||
$keylen,
|
$keylen,
|
||||||
$position,
|
$position,
|
||||||
@ -1509,7 +1509,7 @@ class BPlusTree {
|
|||||||
* @param int $keylen maximum lenght of a key in bytes (unicode extended chars evaluate to two chars)
|
* @param int $keylen maximum lenght of a key in bytes (unicode extended chars evaluate to two chars)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function BPlusTree($infile, $pos=null, $nodesize=null, $keylen=10) {
|
function __construct($infile, $pos=null, $nodesize=null, $keylen=10) {
|
||||||
if (!is_null($keylen) && $keylen<=2) {
|
if (!is_null($keylen) && $keylen<=2) {
|
||||||
trigger_error("$keylen must be greater than 2", E_USER_ERROR);
|
trigger_error("$keylen must be greater than 2", E_USER_ERROR);
|
||||||
}
|
}
|
||||||
@ -2347,7 +2347,7 @@ class BPlusWalker {
|
|||||||
var $includeupper;
|
var $includeupper;
|
||||||
|
|
||||||
|
|
||||||
function BPlusWalker(
|
function __construct(
|
||||||
&$tree,
|
&$tree,
|
||||||
&$keylower,
|
&$keylower,
|
||||||
$includelower=null,
|
$includelower=null,
|
||||||
@ -2536,10 +2536,10 @@ class SBPlusTree extends BPlusTree {
|
|||||||
|
|
||||||
var $maxstring; var $stringfile;
|
var $maxstring; var $stringfile;
|
||||||
|
|
||||||
function SBPlusTree($infile, $stringfile,
|
function __construct($infile, $stringfile,
|
||||||
$maxstring = 256,
|
$maxstring = 256,
|
||||||
$pos=null, $nodesize=null, $keylen=null) {
|
$pos=null, $nodesize=null, $keylen=null) {
|
||||||
parent::BPlusTree($infile, $pos, $nodesize, $keylen);
|
parent::__construct($infile, $pos, $nodesize, $keylen);
|
||||||
$this->stringfile = $stringfile;
|
$this->stringfile = $stringfile;
|
||||||
$this->maxstring = $maxstring;
|
$this->maxstring = $maxstring;
|
||||||
}
|
}
|
||||||
@ -2614,11 +2614,11 @@ class caching_SBPT extends SBPlusTree {
|
|||||||
|
|
||||||
var $cache = array();
|
var $cache = array();
|
||||||
|
|
||||||
function caching_SBPT($infile, $stringfile,
|
function __construct($infile, $stringfile,
|
||||||
$maxstring = 256,
|
$maxstring = 256,
|
||||||
$pos=null, $nodesize=null, $keylen=null) {
|
$pos=null, $nodesize=null, $keylen=null) {
|
||||||
|
|
||||||
parent::SBPlusTree($infile, $stringfile,
|
parent::__construct($infile, $stringfile,
|
||||||
$maxstring,
|
$maxstring,
|
||||||
$pos, $nodesize, $keylen);
|
$pos, $nodesize, $keylen);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
var $_keysize = 12;
|
var $_keysize = 12;
|
||||||
|
|
||||||
// sub-classes will fill the above variables on constructing
|
// sub-classes will fill the above variables on constructing
|
||||||
function cache_filelister() {
|
function __construct() {
|
||||||
|
|
||||||
if (!$this->_cachefile)
|
if (!$this->_cachefile)
|
||||||
trigger_error('CACHE: no cache file specified', E_USER_ERROR);
|
trigger_error('CACHE: no cache file specified', E_USER_ERROR);
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
class comment_indexer extends fs_filelister {
|
class comment_indexer extends fs_filelister {
|
||||||
|
|
||||||
function comment_indexer($id) {
|
function __construct($id) {
|
||||||
$f = bdb_idtofile($id,BDB_COMMENT); //todo change
|
$f = bdb_idtofile($id,BDB_COMMENT); //todo change
|
||||||
$this->_directory = $f;
|
$this->_directory = $f;
|
||||||
parent::fs_filelister();
|
parent::__construct();
|
||||||
//substr(bdb_idtofile($id), -strlen(EXT));
|
//substr(bdb_idtofile($id), -strlen(EXT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
var $_cachefile = null;
|
var $_cachefile = null;
|
||||||
var $_directory = DRAFT_DIR;
|
var $_directory = DRAFT_DIR;
|
||||||
|
|
||||||
function draft_indexer() {
|
function __construct() {
|
||||||
$this->_cachefile = CACHE_DIR . 'draft_index.php';
|
$this->_cachefile = CACHE_DIR . 'draft_index.php';
|
||||||
return parent::fs_filelister();
|
return parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* opens the index belonging to a given category
|
* opens the index belonging to a given category
|
||||||
* @params int $id_cat
|
* @params int $id_cat
|
||||||
*/
|
*/
|
||||||
function entry_cached_index($id_cat=0) {
|
function __construct($id_cat=0) {
|
||||||
$F = INDEX_DIR.'index-'.$id_cat.'.dat';
|
$F = INDEX_DIR.'index-'.$id_cat.'.dat';
|
||||||
|
|
||||||
if (!file_exists($F)) {
|
if (!file_exists($F)) {
|
||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::caching_SBPT(
|
parent::__construct(
|
||||||
fopen($F, 'rb'),
|
fopen($F, 'rb'),
|
||||||
fopen(INDEX_DIR.'index.strings.dat', 'rb'),
|
fopen(INDEX_DIR.'index.strings.dat', 'rb'),
|
||||||
256,
|
256,
|
||||||
@ -43,7 +43,7 @@
|
|||||||
var $_lock_file = null;
|
var $_lock_file = null;
|
||||||
|
|
||||||
|
|
||||||
function entry_index() {
|
function __construct() {
|
||||||
$this->_lock_file = CACHE_DIR.'bpt.lock';
|
$this->_lock_file = CACHE_DIR.'bpt.lock';
|
||||||
|
|
||||||
$this->catlist = entry_categories_list();
|
$this->catlist = entry_categories_list();
|
||||||
@ -234,7 +234,7 @@
|
|||||||
|
|
||||||
var $_filter = 'entry*';
|
var $_filter = 'entry*';
|
||||||
|
|
||||||
function entry_archives($y, $m = null, $d = null) {
|
function __construct($y, $m = null, $d = null) {
|
||||||
|
|
||||||
$this->_y = $y;
|
$this->_y = $y;
|
||||||
$this->_m = $m;
|
$this->_m = $m;
|
||||||
@ -252,7 +252,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::fs_filelister();
|
return parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _checkFile($directory, $file) {
|
function _checkFile($directory, $file) {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//constructor
|
//constructor
|
||||||
function fs_filelister($directory = null) {
|
function __construct($directory = null) {
|
||||||
if ($directory) $this->_directory = $directory;
|
if ($directory) $this->_directory = $directory;
|
||||||
$this->_listFiles($this->_directory);
|
$this->_listFiles($this->_directory);
|
||||||
}
|
}
|
||||||
@ -184,11 +184,11 @@
|
|||||||
var $_chmod_dir;
|
var $_chmod_dir;
|
||||||
var $_chmod_file;
|
var $_chmod_file;
|
||||||
|
|
||||||
function fs_chmodder($directory, $ch_file=FILE_PERMISSIONS, $ch_dir=DIR_PERMISSIONS) {
|
function __construct($directory, $ch_file=FILE_PERMISSIONS, $ch_dir=DIR_PERMISSIONS) {
|
||||||
$this->_directory = $directory;
|
$this->_directory = $directory;
|
||||||
$this->_chmod_file = $ch_file;
|
$this->_chmod_file = $ch_file;
|
||||||
$this->_chmod_dir = $ch_dir;
|
$this->_chmod_dir = $ch_dir;
|
||||||
parent::fs_filelister();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _checkFile($directory, $file) {
|
function _checkFile($directory, $file) {
|
||||||
@ -221,7 +221,7 @@
|
|||||||
|
|
||||||
function fs_deleter($directory) {
|
function fs_deleter($directory) {
|
||||||
$this->_directory = $directory;
|
$this->_directory = $directory;
|
||||||
parent::fs_filelister();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _checkFile($directory, $file) {
|
function _checkFile($directory, $file) {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
var $fullparse = false;
|
var $fullparse = false;
|
||||||
var $comments = false;
|
var $comments = false;
|
||||||
|
|
||||||
function FPDB_QueryParams($params) {
|
function __construct($params) {
|
||||||
|
|
||||||
if (is_string($params)) {
|
if (is_string($params)) {
|
||||||
$this->parse_string($params);
|
$this->parse_string($params);
|
||||||
@ -152,7 +152,7 @@
|
|||||||
var $secondary_idx = null;
|
var $secondary_idx = null;
|
||||||
var $walker = null;
|
var $walker = null;
|
||||||
|
|
||||||
function FPDB_Query($params, $ID) {
|
function __construct($params, $ID) {
|
||||||
|
|
||||||
global $current_query;
|
global $current_query;
|
||||||
|
|
||||||
@ -297,13 +297,13 @@
|
|||||||
$filteredkeys = $obj->getList();
|
$filteredkeys = $obj->getList();
|
||||||
$index_count = $obj->getCount();
|
$index_count = $obj->getCount();
|
||||||
|
|
||||||
if ($filteredkeys)
|
if ($filteredkeys) {
|
||||||
$this->walker =& $entry_index->walker(
|
$error302var1 = entry_idtokey($filteredkeys[0]);
|
||||||
entry_idtokey($filteredkeys[0]), true,
|
|
||||||
entry_idtokey($filteredkeys[$index_count-1]), true
|
$this->walker = $entry_index->walker(
|
||||||
);
|
$error302var1, true,
|
||||||
|
entry_idtokey($filteredkeys[$index_count-1]), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($qp->count < 0) {
|
if ($qp->count < 0) {
|
||||||
@ -595,7 +595,7 @@
|
|||||||
var $current = '';
|
var $current = '';
|
||||||
var $entryid = '';
|
var $entryid = '';
|
||||||
|
|
||||||
function FPDB_CommentList($ID, $array) {
|
function __construct($ID, $array) {
|
||||||
|
|
||||||
if (is_array($array)) {
|
if (is_array($array)) {
|
||||||
$this->list = $array;
|
$this->list = $array;
|
||||||
@ -641,7 +641,7 @@
|
|||||||
var $queries = array();
|
var $queries = array();
|
||||||
|
|
||||||
|
|
||||||
function FPDB() {
|
function __construct() {
|
||||||
// constructor
|
// constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,7 +769,7 @@
|
|||||||
var $_nodesize = 30;
|
var $_nodesize = 30;
|
||||||
var $_keysize = 12;
|
var $_keysize = 12;
|
||||||
|
|
||||||
function FPDB_transaction($id_cat=0) {
|
function __construct($id_cat=0) {
|
||||||
$this->_index = INDEX_DIR.'index-'.$id_cat;
|
$this->_index = INDEX_DIR.'index-'.$id_cat;
|
||||||
|
|
||||||
$this->_tree = caching_SBPT(
|
$this->_tree = caching_SBPT(
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
var $_enabledlist = null;
|
var $_enabledlist = null;
|
||||||
var $_directory = PLUGINS_DIR;
|
var $_directory = PLUGINS_DIR;
|
||||||
|
|
||||||
function plugin_indexer() {
|
function __construct() {
|
||||||
$this->_enabledlist = CONFIG_DIR . 'plugins.conf.php';
|
$this->_enabledlist = CONFIG_DIR . 'plugins.conf.php';
|
||||||
parent::fs_filelister();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _checkFile($directory, $file) {
|
function _checkFile($directory, $file) {
|
||||||
|
@ -167,7 +167,8 @@
|
|||||||
|
|
||||||
echo "\n<!-- FP STD STYLESHEET -->\n";
|
echo "\n<!-- FP STD STYLESHEET -->\n";
|
||||||
|
|
||||||
echo '<link media="screen,projection,handheld" href="';
|
// echo '<link media="screen,projection,handheld" href="';
|
||||||
|
echo '<link media="screen" href="';
|
||||||
echo BLOG_BASEURL . THEMES_DIR . THE_THEME;
|
echo BLOG_BASEURL . THEMES_DIR . THE_THEME;
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
var $_varname = 'fp_widgets';
|
var $_varname = 'fp_widgets';
|
||||||
var $_enabledlist = null;
|
var $_enabledlist = null;
|
||||||
|
|
||||||
function widget_indexer() {
|
function __construct() {
|
||||||
if (!file_exists(CONFIG_DIR. 'widgets.conf.php'))
|
if (!file_exists(CONFIG_DIR. 'widgets.conf.php'))
|
||||||
trigger_error('widgets.conf.php not found. Blog may not work as expected, create a widgetlist.conf.php
|
trigger_error('widgets.conf.php not found. Blog may not work as expected, create a widgetlist.conf.php
|
||||||
or reinstall completely FlatPress. If you have just installed FlatPress, the package you
|
or reinstall completely FlatPress. If you have just installed FlatPress, the package you
|
||||||
|
160
fp-includes/core/function.list_categories.php
Normal file
160
fp-includes/core/function.list_categories.php
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Smarty plugin
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
* File: function.list_categories.php
|
||||||
|
* Type: function
|
||||||
|
* Name: list_categories
|
||||||
|
* Purpose: print out the comment form
|
||||||
|
*
|
||||||
|
* @param string after
|
||||||
|
* @param string before
|
||||||
|
* -------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
function smarty_function_list_categories($params) //, &$smarty)
|
||||||
|
{
|
||||||
|
$cat_params = array(
|
||||||
|
'ild'=>'<li>','ird'=>"</li>\n",
|
||||||
|
'old'=>"<ul>\n",'ord'=>"</ul>\n",
|
||||||
|
'name' => isset($params['name'])? $params['name'] : '',
|
||||||
|
'selected' => array()
|
||||||
|
);
|
||||||
|
|
||||||
|
//list($catId) = each($categories);
|
||||||
|
$cat_params = array_merge($cat_params, $params);
|
||||||
|
|
||||||
|
// makese 'selected' an arr
|
||||||
|
$cat_params['selected'] = (array)$params['selected'];
|
||||||
|
|
||||||
|
//echo "<pre>" . print_r(entry_categories_get()) . "</pre>";
|
||||||
|
|
||||||
|
if (file_exists(CONTENT_DIR . 'categories.txt')) {
|
||||||
|
$cats = trim(io_load_file(CONTENT_DIR . 'categories.txt'));
|
||||||
|
$stack=array(0);
|
||||||
|
$arr=array();
|
||||||
|
|
||||||
|
$line36error = explode("\n", $cats);
|
||||||
|
$line35error = '<ul>'.do_print_categories_list($line36error, $stack, $arr, $cat_params).'</ul>';
|
||||||
|
|
||||||
|
return $line35error;
|
||||||
|
} else {
|
||||||
|
global $lang;
|
||||||
|
|
||||||
|
$content = '<a href="'.BLOG_BASEURL.'">Unfiled</a>';
|
||||||
|
if (isset($lang['admin']['entry']['publish']['nocategories']))
|
||||||
|
$content = $lang['admin']['entry']['publish']['nocategories'];
|
||||||
|
return '<ul><li>' . $content .'</li></ul>' ;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<label><input name="cats[{$catId}]"
|
||||||
|
//{if (bool)array_intersect(array($catId),$categories) }
|
||||||
|
//checked="checked"{/if} type="checkbox" /> {$cat} </label><br />
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function do_print_categories_list(&$lines, &$indentstack, &$result, $params) {
|
||||||
|
|
||||||
|
global $smarty, $fpdb;
|
||||||
|
|
||||||
|
extract($params);
|
||||||
|
|
||||||
|
if (empty($lines)) {
|
||||||
|
$l = count($indentstack)-1;
|
||||||
|
if ($l > 0)
|
||||||
|
$arr = array_fill(0, $l, $ord.$ird);
|
||||||
|
else
|
||||||
|
$arr = array();
|
||||||
|
|
||||||
|
$result = array_merge($result, $arr);
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$str = '';
|
||||||
|
$v = reset($lines);
|
||||||
|
$vt = ltrim($v);
|
||||||
|
|
||||||
|
$indent = utils_countdashes($vt, $text);
|
||||||
|
$indent_old = end($indentstack);
|
||||||
|
|
||||||
|
$val = explode(':', $text);
|
||||||
|
$vt = $val[0];
|
||||||
|
$vid = trim($val[1]);
|
||||||
|
|
||||||
|
$catname = $params['name'];
|
||||||
|
|
||||||
|
if ($indent > $indent_old) {
|
||||||
|
array_push($indentstack, $indent);
|
||||||
|
|
||||||
|
array_pop($result);
|
||||||
|
array_push($result, $old);
|
||||||
|
//array_push($result, $ild);
|
||||||
|
do_print_categories_list($lines, $indentstack, $result, $params);
|
||||||
|
}elseif($indent < $indent_old) {
|
||||||
|
array_pop($indentstack);
|
||||||
|
|
||||||
|
array_push($result, $ord);
|
||||||
|
array_push($result, $ird);
|
||||||
|
|
||||||
|
do_print_categories_list($lines, $indentstack, $result, $params);
|
||||||
|
}else{
|
||||||
|
array_push($result, $ild);
|
||||||
|
|
||||||
|
|
||||||
|
$cat_entry = $params['selected'];
|
||||||
|
//list($catId) = each($categories);
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($params['type']) && ($params['type']=='form' || $params['type']=='check')) {
|
||||||
|
$string = '<label><input name="'.$catname.'cats['.$vid.']" ';
|
||||||
|
|
||||||
|
if ((bool) array_intersect(array($vid), $cat_entry))
|
||||||
|
$string .= 'checked="checked" ';
|
||||||
|
|
||||||
|
$string .= 'type="checkbox" />';
|
||||||
|
$before = $string;
|
||||||
|
}elseif (isset($params['type']) && $params['type']=='radio') {
|
||||||
|
$string = '<label><input name="'.$catname.'cats" type="radio" value="'.$vid.'"';
|
||||||
|
if ((bool) array_intersect(array($vid), $cat_entry))
|
||||||
|
$string .= 'checked="checked" ';
|
||||||
|
|
||||||
|
$string .= ' />';
|
||||||
|
$before = $string;
|
||||||
|
|
||||||
|
|
||||||
|
}elseif(isset($params['type']) && $params['type']=='linked'){
|
||||||
|
$before = '<a href="'.get_category_link($vid).'">';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
array_push($result, $before);
|
||||||
|
|
||||||
|
|
||||||
|
array_push($result, $vt);
|
||||||
|
|
||||||
|
if (isset($params['type']) && ($params['type']=='form' || $params['type']=='check' || $params['type']=='radio')) {
|
||||||
|
$string = '</label>';
|
||||||
|
$after = $string;
|
||||||
|
}elseif(isset($params['type']) && $params['type']=='linked'){
|
||||||
|
$after='</a>';
|
||||||
|
if (isset($params['count']) && $params['count']) {
|
||||||
|
$index =& $fpdb->get_index($vid);
|
||||||
|
$count = ($index)? $index->length() : 0;
|
||||||
|
$after = " ($count) ". $after;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
array_push($result, $after);
|
||||||
|
|
||||||
|
array_push($result, $ird);
|
||||||
|
array_shift($lines);
|
||||||
|
do_print_categories_list($lines, $indentstack, $result, $params);
|
||||||
|
}
|
||||||
|
|
||||||
|
return implode($result);
|
||||||
|
|
||||||
|
}
|
@ -22,14 +22,14 @@
|
|||||||
* smarty-discussion-subscribe@googlegroups.com
|
* smarty-discussion-subscribe@googlegroups.com
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/
|
* @link http://www.smarty.net/
|
||||||
* @version 2.6.26
|
* @version 2.6.25-dev
|
||||||
* @copyright Copyright: 2001-2005 New Digital Group, Inc.
|
* @copyright Copyright: 2001-2005 New Digital Group, Inc.
|
||||||
* @author Andrei Zmievski <andrei@php.net>
|
* @author Andrei Zmievski <andrei@php.net>
|
||||||
* @access public
|
* @access public
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: Config_File.class.php 3149 2009-05-23 20:59:25Z monte.ohrt $ */
|
/* $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config file reading class
|
* Config file reading class
|
||||||
@ -73,7 +73,7 @@ class Config_File {
|
|||||||
*
|
*
|
||||||
* @param string $config_path (optional) path to the config files
|
* @param string $config_path (optional) path to the config files
|
||||||
*/
|
*/
|
||||||
function Config_File($config_path = NULL)
|
public function __construct($config_path = NULL)
|
||||||
{
|
{
|
||||||
if (isset($config_path))
|
if (isset($config_path))
|
||||||
$this->set_path($config_path);
|
$this->set_path($config_path);
|
||||||
|
@ -20,17 +20,17 @@
|
|||||||
*
|
*
|
||||||
* For questions, help, comments, discussion, etc., please join the
|
* For questions, help, comments, discussion, etc., please join the
|
||||||
* Smarty mailing list. Send a blank e-mail to
|
* Smarty mailing list. Send a blank e-mail to
|
||||||
* smarty-discussion-subscribe@googlegroups.com
|
* smarty-discussion-subscribe@googlegroups.com
|
||||||
*
|
*
|
||||||
* @link http://www.smarty.net/
|
* @link http://www.smarty.net/
|
||||||
* @copyright 2001-2005 New Digital Group, Inc.
|
* @copyright 2001-2005 New Digital Group, Inc.
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author Andrei Zmievski <andrei@php.net>
|
* @author Andrei Zmievski <andrei@php.net>
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
* @version 2.6.26
|
* @version 2.6.30
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: Smarty.class.php 3163 2009-06-17 14:39:24Z monte.ohrt $ */
|
/* $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DIR_SEP isn't used anymore, but third party apps might
|
* DIR_SEP isn't used anymore, but third party apps might
|
||||||
@ -465,7 +465,7 @@ class Smarty
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_version = '2.6.26';
|
var $_version = '2.6.30';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* current template inclusion depth
|
* current template inclusion depth
|
||||||
@ -562,11 +562,17 @@ class Smarty
|
|||||||
*/
|
*/
|
||||||
var $_cache_including = false;
|
var $_cache_including = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* plugin filepath cache
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
var $_filepaths_cache = array();
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
/**
|
/**
|
||||||
* The class constructor.
|
* The class constructor.
|
||||||
*/
|
*/
|
||||||
function Smarty()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
|
$this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
|
||||||
: @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
|
: @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
|
||||||
@ -1058,7 +1064,7 @@ class Smarty
|
|||||||
} else {
|
} else {
|
||||||
// var non-existant, return valid reference
|
// var non-existant, return valid reference
|
||||||
$_tmp = null;
|
$_tmp = null;
|
||||||
return $_tmp;
|
return $_tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1090,7 +1096,8 @@ class Smarty
|
|||||||
*/
|
*/
|
||||||
function trigger_error($error_msg, $error_type = E_USER_WARNING)
|
function trigger_error($error_msg, $error_type = E_USER_WARNING)
|
||||||
{
|
{
|
||||||
trigger_error("Smarty error: $error_msg", $error_type);
|
$msg = htmlentities($error_msg);
|
||||||
|
trigger_error("Smarty error: $msg", $error_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1117,7 +1124,7 @@ class Smarty
|
|||||||
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
|
function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
|
||||||
{
|
{
|
||||||
static $_cache_info = array();
|
static $_cache_info = array();
|
||||||
|
|
||||||
$_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
|
$_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
|
||||||
? $this->error_reporting : error_reporting() & ~E_NOTICE);
|
? $this->error_reporting : error_reporting() & ~E_NOTICE);
|
||||||
|
|
||||||
@ -1933,10 +1940,10 @@ class Smarty
|
|||||||
{
|
{
|
||||||
return eval($code);
|
return eval($code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts the filter name from the given callback
|
* Extracts the filter name from the given callback
|
||||||
*
|
*
|
||||||
* @param callback $function
|
* @param callback $function
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -1951,7 +1958,7 @@ class Smarty
|
|||||||
return $function;
|
return $function;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,16 +35,18 @@ class SmartyValidate {
|
|||||||
/**
|
/**
|
||||||
* Class Constructor
|
* Class Constructor
|
||||||
*/
|
*/
|
||||||
function SmartyValidate() { }
|
public function __construct() { }
|
||||||
|
|
||||||
|
|
||||||
|
// public static function SmartyValidate() { }
|
||||||
|
public function SmartyValidate() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialize the validator
|
* initialize the validator
|
||||||
*
|
*
|
||||||
* @param obj $smarty the smarty object
|
* @param obj $smarty the smarty object
|
||||||
* @param string $reset reset the default form?
|
* @param string $reset reset the default form?
|
||||||
*/
|
*/
|
||||||
function connect(&$smarty, $reset = false) {
|
public static function connect(&$smarty, $reset = false) {
|
||||||
if(SmartyValidate::is_valid_smarty_object($smarty)) {
|
if(SmartyValidate::is_valid_smarty_object($smarty)) {
|
||||||
SmartyValidate::_object_instance('Smarty', $smarty);
|
SmartyValidate::_object_instance('Smarty', $smarty);
|
||||||
SmartyValidate::register_form(SMARTY_VALIDATE_DEFAULT_FORM, $reset);
|
SmartyValidate::register_form(SMARTY_VALIDATE_DEFAULT_FORM, $reset);
|
||||||
@ -59,7 +61,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param obj $smarty_obj the smarty object
|
* @param obj $smarty_obj the smarty object
|
||||||
*/
|
*/
|
||||||
function is_valid_smarty_object(&$smarty_obj) {
|
public static function is_valid_smarty_object(&$smarty_obj) {
|
||||||
return (is_object($smarty_obj) && (strtolower(get_class($smarty_obj)) == 'smarty' || is_subclass_of($smarty_obj, 'smarty')));
|
return (is_object($smarty_obj) && (strtolower(get_class($smarty_obj)) == 'smarty' || is_subclass_of($smarty_obj, 'smarty')));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -68,7 +70,7 @@ class SmartyValidate {
|
|||||||
* clear the entire SmartyValidate session
|
* clear the entire SmartyValidate session
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function disconnect() {
|
public static function disconnect() {
|
||||||
unset($_SESSION['SmartyValidate']);
|
unset($_SESSION['SmartyValidate']);
|
||||||
SmartyValidate::_object_instance('-', $_dummy);
|
SmartyValidate::_object_instance('-', $_dummy);
|
||||||
}
|
}
|
||||||
@ -79,7 +81,7 @@ class SmartyValidate {
|
|||||||
* @param string $form the name of the form being validated
|
* @param string $form the name of the form being validated
|
||||||
* @param string $reset reset an already registered form?
|
* @param string $reset reset an already registered form?
|
||||||
*/
|
*/
|
||||||
function register_form($form, $reset = false) {
|
public static function register_form($form, $reset = false) {
|
||||||
if(SmartyValidate::is_registered_form($form) && !$reset) {
|
if(SmartyValidate::is_registered_form($form) && !$reset) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -99,7 +101,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $form the name of the form being validated
|
* @param string $form the name of the form being validated
|
||||||
*/
|
*/
|
||||||
function unregister_form($form) {
|
public static function unregister_form($form) {
|
||||||
unset($_SESSION['SmartyValidate'][$form]);
|
unset($_SESSION['SmartyValidate'][$form]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,11 +110,11 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $form the name of the form being validated
|
* @param string $form the name of the form being validated
|
||||||
*/
|
*/
|
||||||
function is_registered_form($form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function is_registered_form($form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
return isset($_SESSION['SmartyValidate'][$form]);
|
return isset($_SESSION['SmartyValidate'][$form]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _failed_fields(&$formvars, $form = SMARTY_VALIDATE_DEFAULT_FORM, $revalidate = false)
|
public static function _failed_fields(&$formvars, $form = SMARTY_VALIDATE_DEFAULT_FORM, $revalidate = false)
|
||||||
{
|
{
|
||||||
// keep track of failed fields
|
// keep track of failed fields
|
||||||
static $_failed_fields = array();
|
static $_failed_fields = array();
|
||||||
@ -254,7 +256,7 @@ class SmartyValidate {
|
|||||||
* @param string $formvars the array of submitted for variables
|
* @param string $formvars the array of submitted for variables
|
||||||
* @param string $form the name of the form being validated
|
* @param string $form the name of the form being validated
|
||||||
*/
|
*/
|
||||||
function is_valid(&$formvars, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function is_valid(&$formvars, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
|
|
||||||
static $_is_valid = array();
|
static $_is_valid = array();
|
||||||
|
|
||||||
@ -297,7 +299,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $func_name the function being registered
|
* @param string $func_name the function being registered
|
||||||
*/
|
*/
|
||||||
function register_object($object_name, &$object) {
|
public static function register_object($object_name, &$object) {
|
||||||
if(!is_object($object)) {
|
if(!is_object($object)) {
|
||||||
trigger_error("SmartyValidate: [register_object] not a valid object.");
|
trigger_error("SmartyValidate: [register_object] not a valid object.");
|
||||||
return false;
|
return false;
|
||||||
@ -310,7 +312,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $func_name the function being registered
|
* @param string $func_name the function being registered
|
||||||
*/
|
*/
|
||||||
function is_registered_object($object_name) {
|
public static function is_registered_object($object_name) {
|
||||||
$_object =& SmartyValidate::_object_instance($object_name, $_dummy);
|
$_object =& SmartyValidate::_object_instance($object_name, $_dummy);
|
||||||
return is_object($_object);
|
return is_object($_object);
|
||||||
}
|
}
|
||||||
@ -320,7 +322,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $func_name the function being registered
|
* @param string $func_name the function being registered
|
||||||
*/
|
*/
|
||||||
function register_criteria($name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function register_criteria($name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
return SmartyValidate::_register_function('criteria', $name, $func_name, $form);
|
return SmartyValidate::_register_function('criteria', $name, $func_name, $form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +331,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $func_name the function being registered
|
* @param string $func_name the function being registered
|
||||||
*/
|
*/
|
||||||
function register_transform($name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function register_transform($name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
return SmartyValidate::_register_function('transform', $name, $func_name, $form);
|
return SmartyValidate::_register_function('transform', $name, $func_name, $form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,7 +340,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $var the value being booleanized
|
* @param string $var the value being booleanized
|
||||||
*/
|
*/
|
||||||
function is_registered_criteria($name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function is_registered_criteria($name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
if(!SmartyValidate::is_registered_form($form)) {
|
if(!SmartyValidate::is_registered_form($form)) {
|
||||||
trigger_error("SmartyValidate: [is_registered_criteria] form '$form' is not registered.");
|
trigger_error("SmartyValidate: [is_registered_criteria] form '$form' is not registered.");
|
||||||
return false;
|
return false;
|
||||||
@ -351,7 +353,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $var the value being booleanized
|
* @param string $var the value being booleanized
|
||||||
*/
|
*/
|
||||||
function is_registered_transform($name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function is_registered_transform($name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
if(!SmartyValidate::is_registered_form($form)) {
|
if(!SmartyValidate::is_registered_form($form)) {
|
||||||
trigger_error("SmartyValidate: [is_registered_transform] form '$form' is not registered.");
|
trigger_error("SmartyValidate: [is_registered_transform] form '$form' is not registered.");
|
||||||
return false;
|
return false;
|
||||||
@ -370,7 +372,7 @@ class SmartyValidate {
|
|||||||
* @param string $transform transform function(s) to apply (optional)
|
* @param string $transform transform function(s) to apply (optional)
|
||||||
* @param string $form name of the form (optional)
|
* @param string $form name of the form (optional)
|
||||||
*/
|
*/
|
||||||
function register_validator($id, $field, $criteria, $empty = false, $halt = false, $transform = null, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function register_validator($id, $field, $criteria, $empty = false, $halt = false, $transform = null, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
if(!SmartyValidate::is_registered_form($form)) {
|
if(!SmartyValidate::is_registered_form($form)) {
|
||||||
trigger_error("SmartyValidate: [register_validator] form '$form' is not registered.");
|
trigger_error("SmartyValidate: [register_validator] form '$form' is not registered.");
|
||||||
return false;
|
return false;
|
||||||
@ -408,7 +410,7 @@ class SmartyValidate {
|
|||||||
* @param string $transform the name of the transform function(s)
|
* @param string $transform the name of the transform function(s)
|
||||||
* @param string $form name of the form (optional)
|
* @param string $form name of the form (optional)
|
||||||
*/
|
*/
|
||||||
function set_transform($id, $transform, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function set_transform($id, $transform, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
|
|
||||||
if(($_validator_key = SmartyValidate::is_registered_validator($id,$form)) === false) {
|
if(($_validator_key = SmartyValidate::is_registered_validator($id,$form)) === false) {
|
||||||
trigger_error("SmartyValidate: [set_transform] validator '$id' is not registered.");
|
trigger_error("SmartyValidate: [set_transform] validator '$id' is not registered.");
|
||||||
@ -424,7 +426,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $id the validator to test
|
* @param string $id the validator to test
|
||||||
*/
|
*/
|
||||||
function is_registered_validator($id, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function is_registered_validator($id, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
if(!SmartyValidate::is_registered_form($form)) {
|
if(!SmartyValidate::is_registered_form($form)) {
|
||||||
trigger_error("SmartyValidate: [is_registered_validator] form '$form' is not registered.");
|
trigger_error("SmartyValidate: [is_registered_validator] form '$form' is not registered.");
|
||||||
return false;
|
return false;
|
||||||
@ -444,7 +446,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $id the validator to unregister
|
* @param string $id the validator to unregister
|
||||||
*/
|
*/
|
||||||
function unregister_validator($id, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function unregister_validator($id, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
if(!SmartyValidate::is_registered_form($form)) {
|
if(!SmartyValidate::is_registered_form($form)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -465,7 +467,7 @@ class SmartyValidate {
|
|||||||
* @param string $page the name of the page being validated
|
* @param string $page the name of the page being validated
|
||||||
* @param string $form the name of the form being validated
|
* @param string $form the name of the form being validated
|
||||||
*/
|
*/
|
||||||
function set_page($page, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function set_page($page, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
$_SESSION['SmartyValidate'][$form]['page'] = $page;
|
$_SESSION['SmartyValidate'][$form]['page'] = $page;
|
||||||
$_SESSION['SmartyValidate'][$form]['is_error'] = false;
|
$_SESSION['SmartyValidate'][$form]['is_error'] = false;
|
||||||
$_SESSION['SmartyValidate'][$form]['is_init'] = true;
|
$_SESSION['SmartyValidate'][$form]['is_init'] = true;
|
||||||
@ -478,7 +480,7 @@ class SmartyValidate {
|
|||||||
* @param string $name the registered name
|
* @param string $name the registered name
|
||||||
* @param string $form the form name
|
* @param string $form the form name
|
||||||
*/
|
*/
|
||||||
function _execute_transform($name, $value, $params, &$formvars, $form) {
|
public static function _execute_transform($name, $value, $params, &$formvars, $form) {
|
||||||
|
|
||||||
if(SmartyValidate::is_registered_transform($name, $form)) {
|
if(SmartyValidate::is_registered_transform($name, $form)) {
|
||||||
$_func_name = SmartyValidate::_get_registered_func_name('transform', $name, $form);
|
$_func_name = SmartyValidate::_get_registered_func_name('transform', $name, $form);
|
||||||
@ -515,7 +517,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $func_name the function being registered
|
* @param string $func_name the function being registered
|
||||||
*/
|
*/
|
||||||
function _register_function($type, $name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
public static function _register_function($type, $name, $func_name, $form = SMARTY_VALIDATE_DEFAULT_FORM) {
|
||||||
if(!SmartyValidate::is_registered_form($form)) {
|
if(!SmartyValidate::is_registered_form($form)) {
|
||||||
trigger_error("SmartyValidate: [register_$type] form '$form' is not registered.");
|
trigger_error("SmartyValidate: [register_$type] form '$form' is not registered.");
|
||||||
return false;
|
return false;
|
||||||
@ -552,7 +554,7 @@ class SmartyValidate {
|
|||||||
* @param string $name the registered name
|
* @param string $name the registered name
|
||||||
* @param string $form the form name
|
* @param string $form the form name
|
||||||
*/
|
*/
|
||||||
function _get_registered_func_name($type,$name,$form) {
|
public static function _get_registered_func_name($type,$name,$form) {
|
||||||
return isset($_SESSION['SmartyValidate'][$form]['registered_funcs'][$type][$name])
|
return isset($_SESSION['SmartyValidate'][$form]['registered_funcs'][$type][$name])
|
||||||
? $_SESSION['SmartyValidate'][$form]['registered_funcs'][$type][$name]
|
? $_SESSION['SmartyValidate'][$form]['registered_funcs'][$type][$name]
|
||||||
: false;
|
: false;
|
||||||
@ -564,7 +566,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $var the value being booleanized
|
* @param string $var the value being booleanized
|
||||||
*/
|
*/
|
||||||
function _booleanize($var) {
|
public static function _booleanize($var) {
|
||||||
if(in_array(strtolower($var), array(true, 1, 'true','on','yes','y'),true)) {
|
if(in_array(strtolower($var), array(true, 1, 'true','on','yes','y'),true)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -578,7 +580,7 @@ class SmartyValidate {
|
|||||||
* @param string $value the value being tested
|
* @param string $value the value being tested
|
||||||
* @param string $empty skip empty values or not
|
* @param string $empty skip empty values or not
|
||||||
*/
|
*/
|
||||||
function _is_valid_criteria($criteria, $value, $empty, &$params, &$formvars, $form) {
|
public static function _is_valid_criteria($criteria, $value, $empty, &$params, &$formvars, $form) {
|
||||||
if(SmartyValidate::is_registered_criteria($criteria,$form)) {
|
if(SmartyValidate::is_registered_criteria($criteria,$form)) {
|
||||||
$_func_name = SmartyValidate::_get_registered_func_name('criteria',$criteria, $form);
|
$_func_name = SmartyValidate::_get_registered_func_name('criteria',$criteria, $form);
|
||||||
} else {
|
} else {
|
||||||
@ -615,7 +617,7 @@ class SmartyValidate {
|
|||||||
* @param string $name the object name
|
* @param string $name the object name
|
||||||
* @param object $object the object being set
|
* @param object $object the object being set
|
||||||
*/
|
*/
|
||||||
function &_object_instance($name, &$object) {
|
public static function &_object_instance($name, &$object) {
|
||||||
$return = false;
|
$return = false;
|
||||||
static $_objects = array();
|
static $_objects = array();
|
||||||
if ($name=='-') {
|
if ($name=='-') {
|
||||||
@ -638,7 +640,7 @@ class SmartyValidate {
|
|||||||
*
|
*
|
||||||
* @param string $value the value being tested
|
* @param string $value the value being tested
|
||||||
*/
|
*/
|
||||||
function _smarty_assign($vars = array()) {
|
public static function _smarty_assign($vars = array()) {
|
||||||
|
|
||||||
$_smarty_obj =& SmartyValidate::_object_instance('Smarty', $_dummy);
|
$_smarty_obj =& SmartyValidate::_object_instance('Smarty', $_dummy);
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@
|
|||||||
* @link http://smarty.php.net/
|
* @link http://smarty.php.net/
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @author Andrei Zmievski <andrei@php.net>
|
* @author Andrei Zmievski <andrei@php.net>
|
||||||
* @version 2.6.26
|
* @version 2.6.25-dev
|
||||||
* @copyright 2001-2005 New Digital Group, Inc.
|
* @copyright 2001-2005 New Digital Group, Inc.
|
||||||
* @package Smarty
|
* @package Smarty
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: Smarty_Compiler.class.php 3163 2009-06-17 14:39:24Z monte.ohrt $ */
|
/* $Id$ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Template compiling class
|
* Template compiling class
|
||||||
@ -78,7 +78,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
/**
|
/**
|
||||||
* The class constructor.
|
* The class constructor.
|
||||||
*/
|
*/
|
||||||
function Smarty_Compiler()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// matches double quoted strings:
|
// matches double quoted strings:
|
||||||
// "foobar"
|
// "foobar"
|
||||||
@ -262,11 +262,11 @@ class Smarty_Compiler extends Smarty {
|
|||||||
reset($this->_folded_blocks);
|
reset($this->_folded_blocks);
|
||||||
|
|
||||||
/* replace special blocks by "{php}" */
|
/* replace special blocks by "{php}" */
|
||||||
$source_content = preg_replace($search.'e', "'"
|
$source_content = preg_replace_callback($search, create_function ('$matches', "return '"
|
||||||
. $this->_quote_replace($this->left_delimiter) . 'php'
|
. $this->_quote_replace($this->left_delimiter) . 'php'
|
||||||
. "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
|
. "' . str_repeat(\"\n\", substr_count('\$matches[1]', \"\n\")) .'"
|
||||||
. $this->_quote_replace($this->right_delimiter)
|
. $this->_quote_replace($this->right_delimiter)
|
||||||
. "'"
|
. "';")
|
||||||
, $source_content);
|
, $source_content);
|
||||||
|
|
||||||
/* Gather all template tags. */
|
/* Gather all template tags. */
|
||||||
@ -2122,7 +2122,7 @@ class Smarty_Compiler extends Smarty {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
case 'template':
|
case 'template':
|
||||||
$compiled_ref = "'$this->_current_file'";
|
$compiled_ref = "'" . addslashes($this->_current_file) . "'";
|
||||||
$_max_index = 1;
|
$_max_index = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -14,11 +14,9 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_core_assemble_plugin_filepath($params, &$smarty)
|
function smarty_core_assemble_plugin_filepath($params, &$smarty)
|
||||||
{
|
{
|
||||||
static $_filepaths_cache = array();
|
|
||||||
|
|
||||||
$_plugin_filename = $params['type'] . '.' . $params['name'] . '.php';
|
$_plugin_filename = $params['type'] . '.' . $params['name'] . '.php';
|
||||||
if (isset($_filepaths_cache[$_plugin_filename])) {
|
if (isset($smarty->_filepaths_cache[$_plugin_filename])) {
|
||||||
return $_filepaths_cache[$_plugin_filename];
|
return $smarty->_filepaths_cache[$_plugin_filename];
|
||||||
}
|
}
|
||||||
$_return = false;
|
$_return = false;
|
||||||
|
|
||||||
@ -58,7 +56,7 @@ function smarty_core_assemble_plugin_filepath($params, &$smarty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$_filepaths_cache[$_plugin_filename] = $_return;
|
$smarty->_filepaths_cache[$_plugin_filename] = $_return;
|
||||||
return $_return;
|
return $_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,11 @@ function smarty_function_cycle($params, &$smarty)
|
|||||||
$cycle_vars[$name]['values'] = $params['values'];
|
$cycle_vars[$name]['values'] = $params['values'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$cycle_vars[$name]['delimiter'] = (isset($params['delimiter'])) ? $params['delimiter'] : ',';
|
if (isset($params['delimiter'])) {
|
||||||
|
$cycle_vars[$name]['delimiter'] = $params['delimiter'];
|
||||||
|
} elseif (!isset($cycle_vars[$name]['delimiter'])) {
|
||||||
|
$cycle_vars[$name]['delimiter'] = ',';
|
||||||
|
}
|
||||||
|
|
||||||
if(is_array($cycle_vars[$name]['values'])) {
|
if(is_array($cycle_vars[$name]['values'])) {
|
||||||
$cycle_array = $cycle_vars[$name]['values'];
|
$cycle_array = $cycle_vars[$name]['values'];
|
||||||
|
@ -181,12 +181,12 @@ function smarty_function_fetch($params, &$smarty)
|
|||||||
$content .= fgets($fp,4096);
|
$content .= fgets($fp,4096);
|
||||||
}
|
}
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
$csplit = split("\r\n\r\n",$content,2);
|
$csplit = preg_split("!\r\n\r\n!",$content,2);
|
||||||
|
|
||||||
$content = $csplit[1];
|
$content = $csplit[1];
|
||||||
|
|
||||||
if(!empty($params['assign_headers'])) {
|
if(!empty($params['assign_headers'])) {
|
||||||
$smarty->assign($params['assign_headers'],split("\r\n",$csplit[0]));
|
$smarty->assign($params['assign_headers'],preg_split("!\r\n!",$csplit[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -42,7 +42,7 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
require_once $smarty->_get_plugin_filepath('function','html_options');
|
require_once $smarty->_get_plugin_filepath('function','html_options');
|
||||||
/* Default values. */
|
/* Default values. */
|
||||||
$prefix = "Date_";
|
$prefix = "Date_";
|
||||||
$start_year = date_strformat("%Y");
|
$start_year = strftime("%Y");
|
||||||
$end_year = $start_year;
|
$end_year = $start_year;
|
||||||
$display_days = true;
|
$display_days = true;
|
||||||
$display_months = true;
|
$display_months = true;
|
||||||
@ -142,8 +142,8 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
$time = $found[1];
|
$time = $found[1];
|
||||||
} else {
|
} else {
|
||||||
// use smarty_make_timestamp to get an unix timestamp and
|
// use smarty_make_timestamp to get an unix timestamp and
|
||||||
// date_strformat to make yyyy-mm-dd
|
// strftime to make yyyy-mm-dd
|
||||||
$time = date_strformat('%Y-%m-%d', smarty_make_timestamp($time));
|
$time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
|
||||||
}
|
}
|
||||||
// Now split this in pieces, which later can be used to set the select
|
// Now split this in pieces, which later can be used to set the select
|
||||||
$time = explode("-", $time);
|
$time = explode("-", $time);
|
||||||
@ -151,16 +151,16 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
// make syntax "+N" or "-N" work with start_year and end_year
|
// make syntax "+N" or "-N" work with start_year and end_year
|
||||||
if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
|
if (preg_match('!^(\+|\-)\s*(\d+)$!', $end_year, $match)) {
|
||||||
if ($match[1] == '+') {
|
if ($match[1] == '+') {
|
||||||
$end_year = date_strformat('%Y') + $match[2];
|
$end_year = strftime('%Y') + $match[2];
|
||||||
} else {
|
} else {
|
||||||
$end_year = date_strformat('%Y') - $match[2];
|
$end_year = strftime('%Y') - $match[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
|
if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) {
|
||||||
if ($match[1] == '+') {
|
if ($match[1] == '+') {
|
||||||
$start_year = date_strformat('%Y') + $match[2];
|
$start_year = strftime('%Y') + $match[2];
|
||||||
} else {
|
} else {
|
||||||
$start_year = date_strformat('%Y') - $match[2];
|
$start_year = strftime('%Y') - $match[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strlen($time[0]) > 0) {
|
if (strlen($time[0]) > 0) {
|
||||||
@ -188,8 +188,8 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
$month_values[''] = '';
|
$month_values[''] = '';
|
||||||
}
|
}
|
||||||
for ($i = 1; $i <= 12; $i++) {
|
for ($i = 1; $i <= 12; $i++) {
|
||||||
$month_names[$i] = date_strformat($month_format, mktime(0, 0, 0, $i, 1, 2000));
|
$month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000));
|
||||||
$month_values[$i] = date_strformat($month_value_format, mktime(0, 0, 0, $i, 1, 2000));
|
$month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000));
|
||||||
}
|
}
|
||||||
|
|
||||||
$month_result .= '<select name=';
|
$month_result .= '<select name=';
|
||||||
@ -211,7 +211,7 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
|
|
||||||
$month_result .= smarty_function_html_options(array('output' => $month_names,
|
$month_result .= smarty_function_html_options(array('output' => $month_names,
|
||||||
'values' => $month_values,
|
'values' => $month_values,
|
||||||
'selected' => (int)$time[1] ? date_strformat($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
|
'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
|
||||||
'print_result' => false),
|
'print_result' => false),
|
||||||
$smarty);
|
$smarty);
|
||||||
$month_result .= '</select>';
|
$month_result .= '</select>';
|
||||||
|
@ -32,8 +32,11 @@ function smarty_function_list_categories($params) //, &$smarty)
|
|||||||
$cats = trim(io_load_file(CONTENT_DIR . 'categories.txt'));
|
$cats = trim(io_load_file(CONTENT_DIR . 'categories.txt'));
|
||||||
$stack=array(0);
|
$stack=array(0);
|
||||||
$arr=array();
|
$arr=array();
|
||||||
$explode_result=explode("\n", $cats);
|
|
||||||
return '<ul>'.do_print_categories_list($explode_result, $stack, $arr, $cat_params).'</ul>';
|
$line36error = explode("\n", $cats);
|
||||||
|
$line35error = '<ul>'.do_print_categories_list($line36error, $stack, $arr, $cat_params).'</ul>';
|
||||||
|
|
||||||
|
return $line35error;
|
||||||
} else {
|
} else {
|
||||||
global $lang;
|
global $lang;
|
||||||
|
|
||||||
|
@ -1,85 +1,104 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Smarty plugin
|
* Smarty plugin
|
||||||
* @package Smarty
|
* This plugin is only for Smarty2 BC
|
||||||
* @subpackage plugins
|
*
|
||||||
|
* @package Smarty
|
||||||
|
* @subpackage PluginsFunction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smarty {math} function plugin
|
* Smarty {math} function plugin
|
||||||
*
|
|
||||||
* Type: function<br>
|
* Type: function<br>
|
||||||
* Name: math<br>
|
* Name: math<br>
|
||||||
* Purpose: handle math computations in template<br>
|
* Purpose: handle math computations in template
|
||||||
* @link http://smarty.php.net/manual/en/language.function.math.php {math}
|
*
|
||||||
* (Smarty online manual)
|
* @link http://www.smarty.net/manual/en/language.function.math.php {math}
|
||||||
|
* (Smarty online manual)
|
||||||
* @author Monte Ohrt <monte at ohrt dot com>
|
* @author Monte Ohrt <monte at ohrt dot com>
|
||||||
* @param array
|
*
|
||||||
* @param Smarty
|
* @param array $params parameters
|
||||||
* @return string
|
* @param Smarty_Internal_Template $template template object
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
function smarty_function_math($params, &$smarty)
|
function smarty_function_math($params, $template)
|
||||||
{
|
{
|
||||||
|
static $_allowed_funcs =
|
||||||
|
array('int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
|
||||||
|
'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true, 'rand' => true,
|
||||||
|
'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true, 'tan' => true);
|
||||||
// be sure equation parameter is present
|
// be sure equation parameter is present
|
||||||
if (empty($params['equation'])) {
|
if (empty($params[ 'equation' ])) {
|
||||||
$smarty->trigger_error("math: missing equation parameter");
|
trigger_error("math: missing equation parameter", E_USER_WARNING);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// strip out backticks, not necessary for math
|
$equation = $params[ 'equation' ];
|
||||||
$equation = str_replace('`','',$params['equation']);
|
|
||||||
|
|
||||||
// make sure parenthesis are balanced
|
// make sure parenthesis are balanced
|
||||||
if (substr_count($equation,"(") != substr_count($equation,")")) {
|
if (substr_count($equation, "(") != substr_count($equation, ")")) {
|
||||||
$smarty->trigger_error("math: unbalanced parenthesis");
|
trigger_error("math: unbalanced parenthesis", E_USER_WARNING);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// disallow backticks
|
||||||
|
if (strpos($equation, '`') !== false) {
|
||||||
|
trigger_error("math: backtick character not allowed in equation", E_USER_WARNING);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// also disallow dollar signs
|
||||||
|
if (strpos($equation, '$') !== false) {
|
||||||
|
trigger_error("math: dollar signs not allowed in equation", E_USER_WARNING);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// match all vars in equation, make sure all are passed
|
// match all vars in equation, make sure all are passed
|
||||||
preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match);
|
preg_match_all('!(?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)!', $equation, $match);
|
||||||
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
|
|
||||||
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
|
foreach ($match[ 1 ] as $curr_var) {
|
||||||
|
if ($curr_var && !isset($params[ $curr_var ]) && !isset($_allowed_funcs[ $curr_var ])) {
|
||||||
foreach($match[1] as $curr_var) {
|
trigger_error("math: function call $curr_var not allowed", E_USER_WARNING);
|
||||||
if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
|
|
||||||
$smarty->trigger_error("math: function call $curr_var not allowed");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($params as $key => $val) {
|
foreach ($params as $key => $val) {
|
||||||
if ($key != "equation" && $key != "format" && $key != "assign") {
|
if ($key != "equation" && $key != "format" && $key != "assign") {
|
||||||
// make sure value is not empty
|
// make sure value is not empty
|
||||||
if (strlen($val)==0) {
|
if (strlen($val) == 0) {
|
||||||
$smarty->trigger_error("math: parameter $key is empty");
|
trigger_error("math: parameter $key is empty", E_USER_WARNING);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!is_numeric($val)) {
|
if (!is_numeric($val)) {
|
||||||
$smarty->trigger_error("math: parameter $key: is not numeric");
|
trigger_error("math: parameter $key: is not numeric", E_USER_WARNING);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
|
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$smarty_math_result = null;
|
||||||
|
eval("\$smarty_math_result = " . $equation . ";");
|
||||||
|
|
||||||
eval("\$smarty_math_result = ".$equation.";");
|
if (empty($params[ 'format' ])) {
|
||||||
|
if (empty($params[ 'assign' ])) {
|
||||||
if (empty($params['format'])) {
|
|
||||||
if (empty($params['assign'])) {
|
|
||||||
return $smarty_math_result;
|
return $smarty_math_result;
|
||||||
} else {
|
} else {
|
||||||
$smarty->assign($params['assign'],$smarty_math_result);
|
$template->assign($params[ 'assign' ], $smarty_math_result);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (empty($params['assign'])){
|
if (empty($params[ 'assign' ])) {
|
||||||
printf($params['format'],$smarty_math_result);
|
printf($params[ 'format' ], $smarty_math_result);
|
||||||
} else {
|
} else {
|
||||||
$smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result));
|
$template->assign($params[ 'assign' ], sprintf($params[ 'format' ], $smarty_math_result));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim: set expandtab: */
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
@ -199,6 +199,9 @@ class StringParser {
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
function __construct() {
|
||||||
|
}
|
||||||
|
|
||||||
function StringParser () {
|
function StringParser () {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -910,7 +913,7 @@ class StringParser_Node {
|
|||||||
* occurred at. If not determinable, it is -1.
|
* occurred at. If not determinable, it is -1.
|
||||||
* @global __STRINGPARSER_NODE_ID
|
* @global __STRINGPARSER_NODE_ID
|
||||||
*/
|
*/
|
||||||
function StringParser_Node ($occurredAt = -1) {
|
function __construct ($occurredAt = -1) {
|
||||||
$this->_id = $GLOBALS['__STRINGPARSER_NODE_ID']++;
|
$this->_id = $GLOBALS['__STRINGPARSER_NODE_ID']++;
|
||||||
$this->occurredAt = $occurredAt;
|
$this->occurredAt = $occurredAt;
|
||||||
}
|
}
|
||||||
@ -1486,8 +1489,8 @@ class StringParser_Node_Text extends StringParser_Node {
|
|||||||
* occurred at. If not determinable, it is -1.
|
* occurred at. If not determinable, it is -1.
|
||||||
* @see StringParser_Node_Text::content
|
* @see StringParser_Node_Text::content
|
||||||
*/
|
*/
|
||||||
function StringParser_Node_Text ($content, $occurredAt = -1) {
|
function __construct ($content, $occurredAt = -1) {
|
||||||
parent::StringParser_Node ($occurredAt);
|
parent::__construct ($occurredAt);
|
||||||
$this->content = $content;
|
$this->content = $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ function plugin_calendar_widget() {
|
|||||||
|
|
||||||
global $fpdb;
|
global $fpdb;
|
||||||
|
|
||||||
$q =& new FPDB_Query(array('fullparse'=>false,'y'=>$y,'m'=>$m, 'count' => -1), null);
|
$q = new FPDB_Query(array('fullparse'=>false,'y'=>$y,'m'=>$m, 'count' => -1), null);
|
||||||
|
|
||||||
|
|
||||||
$days = array();
|
$days = array();
|
||||||
|
24
fp-plugins/lastcommentsadmin/lang/lang.de-de.php
Normal file
24
fp-plugins/lastcommentsadmin/lang/lang.de-de.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
$lang['plugin']['lastcommentsadmin ']['errors'] = array (
|
||||||
|
-1 => 'API key not set. Open the plugin to set your API key. Register on <a href="http://wordpress.com">Wordpress.com</a> to get one'
|
||||||
|
);
|
||||||
|
|
||||||
|
$lang['admin']['plugin']['submenu']['lastcommentsadmin'] = 'Last Comments Admin';
|
||||||
|
|
||||||
|
$lang['admin']['plugin']['lastcommentsadmin'] = array(
|
||||||
|
'head' => '"Letzte Kommentare" Cache verwalten',
|
||||||
|
'description'=>'Leert und erneuert den Inhalt für die "Letzte Kommentare" Cache Datei ',
|
||||||
|
'clear' => 'Lösche Cache',
|
||||||
|
'cleardescription' => 'Lösche die vorhandene "Letzte Kommentare" Cache Datei. Eine neue Datei wird nach dem Posten eines Kommentares wieder angelegt.',
|
||||||
|
'rebuild' => 'Cache neu anlegen',
|
||||||
|
'rebuilddescription' => 'Eine neue Cache Datei anlegen. Diese Funktion sucht in allen Blog Beiträgen nach Kommentaren und übernimmt diese in die neue Cache Datei. Das kann einige Zeit dauern, je nachdem wieviele Kommentare gefunden werden!',
|
||||||
|
);
|
||||||
|
$lang['admin']['plugin']['lastcommentsadmin']['msgs'] = array(
|
||||||
|
1 => 'Cache wurde erfolgreich gelöscht',
|
||||||
|
2 => 'Cache wurde erfolgreich erneuert',
|
||||||
|
-1 => 'Fehler!',
|
||||||
|
-2 => 'Dieses Plugin benötigt das in Flatpress integrierte LastComment Plugin. Bitte dieses vorher im Plugin Bereich aktivieren!'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
24
fp-plugins/lastcommentsadmin/lang/lang.en-us.php
Normal file
24
fp-plugins/lastcommentsadmin/lang/lang.en-us.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
$lang['plugin']['lastcommentsadmin ']['errors'] = array (
|
||||||
|
-1 => 'API key not set. Open the plugin to set your API key. Register on <a href="http://wordpress.com">Wordpress.com</a> to get one'
|
||||||
|
);
|
||||||
|
|
||||||
|
$lang['admin']['plugin']['submenu']['lastcommentsadmin'] = 'Last Comments Admin';
|
||||||
|
|
||||||
|
$lang['admin']['plugin']['lastcommentsadmin'] = array(
|
||||||
|
'head' => 'Last Comments Admin',
|
||||||
|
'description'=>'Clear and rebuil last comment cache ',
|
||||||
|
'clear' => 'Clear cache',
|
||||||
|
'cleardescription' => 'Delete last comment cache file. New file cache will created when a new comment will be posted.',
|
||||||
|
'rebuild' => 'Rebuild cache',
|
||||||
|
'rebuilddescription' => 'Rebuild last comment cache file. Could take very long time. Could not work at all. Could burn your mouse up!',
|
||||||
|
);
|
||||||
|
$lang['admin']['plugin']['lastcommentsadmin']['msgs'] = array(
|
||||||
|
1 => 'Cache deleted',
|
||||||
|
2 => 'Cache rebuilded!',
|
||||||
|
-1 => 'Error!',
|
||||||
|
-2 => 'This plugin require LastComments plugin!'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
65
fp-plugins/lastcommentsadmin/plugin.lastcommentsadmin.php
Normal file
65
fp-plugins/lastcommentsadmin/plugin.lastcommentsadmin.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Plugin Name: Last Comments Admin
|
||||||
|
Version: 0.1
|
||||||
|
Plugin URI: http://kirgroup.com/blog/
|
||||||
|
Description: Manage last comments cache. Require LastComment plugin.
|
||||||
|
Author: Fabrixxm
|
||||||
|
Author URI: http://kirgroup.com/blog/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (class_exists('AdminPanelAction')){
|
||||||
|
|
||||||
|
class admin_plugin_lastcommentsadmin extends AdminPanelAction {
|
||||||
|
|
||||||
|
var $langres = 'plugin:lastcommentsadmin';
|
||||||
|
|
||||||
|
function setup() {
|
||||||
|
$this->smarty->assign('admin_resource', "plugin:lastcommentsadmin/admin.plugin.lastcommentsadmin");
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
if (!function_exists('plugin_lastcomments_cache')){
|
||||||
|
$this->smarty->assign('success', -2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onsubmit($data = NULL) {
|
||||||
|
global $fp_config;
|
||||||
|
|
||||||
|
if (isset($_POST['lastcommentadmin_clear'])){
|
||||||
|
fs_delete(LASTCOMMENTS_CACHE_FILE);
|
||||||
|
$this->smarty->assign('success', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['lastcommentadmin_rebuild'])){
|
||||||
|
fs_delete(LASTCOMMENTS_CACHE_FILE);
|
||||||
|
$coms = Array();
|
||||||
|
|
||||||
|
$q = new FPDB_Query(array('fullparse'=>false,'start'=>0,'count'=>-1), null);
|
||||||
|
while ($q->hasmore()) {
|
||||||
|
list($id,$e) = $q->getEntry();
|
||||||
|
$obj = new comment_indexer($id);
|
||||||
|
foreach($obj->getList() as $value){
|
||||||
|
$coms[$value]=$id;
|
||||||
|
}
|
||||||
|
ksort($coms);
|
||||||
|
$coms = array_slice($coms, -LASTCOMMENTS_MAX );
|
||||||
|
}
|
||||||
|
foreach($coms as $cid=>$eid){
|
||||||
|
$c = comment_parse($eid, $cid);
|
||||||
|
plugin_lastcomments_cache($eid, array($cid, $c));
|
||||||
|
}
|
||||||
|
$this->smarty->assign('success', 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
admin_addpanelaction('plugin', 'lastcommentsadmin', true);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
<h2>{$plang.head}</h2>
|
||||||
|
<p>{$plang.description}</p>
|
||||||
|
|
||||||
|
{include file=shared:errorlist.tpl}
|
||||||
|
|
||||||
|
<div style="margin: 0 auto; width: 20em;">
|
||||||
|
|
||||||
|
{html_form}
|
||||||
|
<p><input type="submit" name="lastcommentadmin_clear" value="{$plang.clear}"/> </p><p>{$plang.cleardescription} </p>
|
||||||
|
<p><br></p>
|
||||||
|
<p><input type="submit" name="lastcommentadmin_rebuild" value="{$plang.rebuild}"/> </p><p>{$plang.rebuilddescription} </p>
|
||||||
|
|
||||||
|
{/html_form}
|
||||||
|
|
||||||
|
</div>
|
45
fp-plugins/mediamanager/lang/lang.de-de.php
Normal file
45
fp-plugins/mediamanager/lang/lang.de-de.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
/* MediaManager DE-DE language file by Laborix */
|
||||||
|
|
||||||
|
/* THIS LINE SHOULDN'T BE HERE! */
|
||||||
|
$lang['admin']['uploader']['submenu']['default'] = 'Uploader';
|
||||||
|
|
||||||
|
|
||||||
|
$lang['admin']['uploader']['submenu']['mediamanager'] = 'Media Manager';
|
||||||
|
|
||||||
|
|
||||||
|
$lang['admin']['uploader']['mediamanager'] = array(
|
||||||
|
'head' => 'Media Manager',
|
||||||
|
'description'=>'Der Media Manager schafft einen Überblick der in Flatpress hochgeladenen Dateien und Bilder.',
|
||||||
|
|
||||||
|
'delete' => 'Löschen',
|
||||||
|
'up' => 'Zurück',
|
||||||
|
'page' => 'Seite',
|
||||||
|
'colname' => 'Dateiname',
|
||||||
|
'colsize' => 'Dateigröße in KB',
|
||||||
|
'coltype' => 'Abgelegt in',
|
||||||
|
'colmtime' => 'Hochgeladen am',
|
||||||
|
'colusecount'=>'In Beiträgen genutzt',
|
||||||
|
'nofiles' => 'Keine Mediendaten vorhanden.',
|
||||||
|
'loadfile' => 'Datei/en hochladen',
|
||||||
|
|
||||||
|
'seòected' => 'Ausgewählt',
|
||||||
|
'selectaction' => '-- auswahl --',
|
||||||
|
'addtogallery' => 'Zur Gallery hinzufügen',
|
||||||
|
'newgallery' => 'Neue Gallery',
|
||||||
|
'go' => 'Anlegen',
|
||||||
|
'add' => 'Hinzufügen'
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
$lang['admin']['uploader']['mediamanager']['msgs'] = array(
|
||||||
|
3 => 'Neue Gallery angelegt',
|
||||||
|
2 => 'Bilder in Gallery verschoben',
|
||||||
|
1 => 'Datei gelöscht',
|
||||||
|
-1 => 'Fehler beim Löschen der Datei/en',
|
||||||
|
-2 => 'Fehler beim Erstellen einer neuen Gallery',
|
||||||
|
-3 => 'Bitte einen Namen für die neue Gallery angeben'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
43
fp-plugins/mediamanager/lang/lang.en-us.php
Normal file
43
fp-plugins/mediamanager/lang/lang.en-us.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
/* MediaManager EN-US language file by Fabrix Xm */
|
||||||
|
|
||||||
|
/* THIS LINE SHOULDN'T BE HERE! */
|
||||||
|
$lang['admin']['uploader']['submenu']['default'] = 'Uploader';
|
||||||
|
|
||||||
|
$lang['admin']['uploader']['submenu']['mediamanager'] = 'Media manager';
|
||||||
|
|
||||||
|
|
||||||
|
$lang['admin']['uploader']['mediamanager'] = array(
|
||||||
|
'head' => 'Media manager',
|
||||||
|
'description'=>'Manage your media',
|
||||||
|
|
||||||
|
'delete' => 'delete',
|
||||||
|
'up' => 'Back',
|
||||||
|
'page' => 'Page',
|
||||||
|
'colname' => 'Name',
|
||||||
|
'colsize' => 'Size',
|
||||||
|
'coltype' => 'Type',
|
||||||
|
'colmtime' => 'Uploaded on',
|
||||||
|
'colusecount'=>'# use',
|
||||||
|
'nofiles' => 'No files loaded.',
|
||||||
|
'loadfile' => 'Load file',
|
||||||
|
|
||||||
|
'selected' => 'Selected',
|
||||||
|
'selectaction' => '-- select action --',
|
||||||
|
'addtogallery' => 'Add to gallery',
|
||||||
|
'newgallery' => 'New gallery',
|
||||||
|
'go' => 'Go',
|
||||||
|
'add' => 'Add'
|
||||||
|
|
||||||
|
);
|
||||||
|
$lang['admin']['uploader']['mediamanager']['msgs'] = array(
|
||||||
|
3 => 'New gallery created',
|
||||||
|
2 => 'Images moved to gallery',
|
||||||
|
1 => 'File deleted',
|
||||||
|
-1 => 'Error deleting file',
|
||||||
|
-2 => 'Error creating new gallery',
|
||||||
|
-3 => 'Please specify the name of new gallery'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
42
fp-plugins/mediamanager/lang/lang.es-la.php
Normal file
42
fp-plugins/mediamanager/lang/lang.es-la.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
/* MediaManager ES-LA language file by Agvztíñ IV */
|
||||||
|
/* http://ingeniebrios.com/fp-content/attachs/mediamanager_es-la.zip */
|
||||||
|
|
||||||
|
/* ¡Esta línea no debería estar aquí! */
|
||||||
|
$lang['admin']['uploader']['submenu']['default'] = 'Subir archivos';
|
||||||
|
|
||||||
|
$lang['admin']['uploader']['submenu']['mediamanager'] = 'Administrar Media';
|
||||||
|
|
||||||
|
$lang['admin']['uploader']['mediamanager'] = array(
|
||||||
|
'head' => 'Administrar Media',
|
||||||
|
'description' =>'Administrador de media',
|
||||||
|
|
||||||
|
'delete' => 'eliminar',
|
||||||
|
'up' => 'Atrás',
|
||||||
|
'page' => 'Página',
|
||||||
|
'colname' => 'Nombre',
|
||||||
|
'colsize' => 'Tamaño',
|
||||||
|
'coltype' => 'Tipo',
|
||||||
|
'colmtime' => 'Fecha de subida',
|
||||||
|
'colusecount' =>'# de usos',
|
||||||
|
'nofiles' => 'No hay archivos',
|
||||||
|
'loadfile' => 'Subir archivo',
|
||||||
|
|
||||||
|
'selected' => 'Seleccción',
|
||||||
|
'selectaction' => '-- selecciona acción --',
|
||||||
|
'addtogallery' => 'Agregar a galería',
|
||||||
|
'newgallery' => 'Nueva galería',
|
||||||
|
'go' => 'Ir',
|
||||||
|
'add' => 'Agregar'
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
$lang['admin']['uploader']['mediamanager']['msgs'] = array(
|
||||||
|
3 => 'Nueva galería creada',
|
||||||
|
2 => 'Imágenes movidas a galería',
|
||||||
|
1 => 'Archivo eliminado',
|
||||||
|
-1 => 'Error al eliminar archivo',
|
||||||
|
-2 => 'Error al crear nueva galería',
|
||||||
|
-3 => 'Por favor ingresa el nombre de la galería'
|
||||||
|
);
|
||||||
|
?>
|
43
fp-plugins/mediamanager/lang/lang.it-it.php
Normal file
43
fp-plugins/mediamanager/lang/lang.it-it.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
/* MediaManager IT-IT language file by Fabrix Xm */
|
||||||
|
|
||||||
|
/* THIS LINE SHOULDN'T BE HERE! */
|
||||||
|
$lang['admin']['uploader']['submenu']['default'] = 'Caricatore';
|
||||||
|
|
||||||
|
$lang['admin']['uploader']['submenu']['mediamanager'] = 'Gestore media';
|
||||||
|
|
||||||
|
|
||||||
|
$lang['admin']['uploader']['mediamanager'] = array(
|
||||||
|
'head' => 'Gestore media',
|
||||||
|
'description'=>'Gestisci i tuoi file',
|
||||||
|
|
||||||
|
'delete' => 'cancella',
|
||||||
|
'up' => 'Indietro',
|
||||||
|
'page' => 'Pagina',
|
||||||
|
'colname' => 'Nome',
|
||||||
|
'colsize' => 'Dim.',
|
||||||
|
'coltype' => 'Tipo',
|
||||||
|
'colmtime' => 'Caricato il',
|
||||||
|
'colusecount'=>'usato n.',
|
||||||
|
'nofiles' => 'Nessun file caricato.',
|
||||||
|
'loadfile' => 'Carica file.',
|
||||||
|
|
||||||
|
'selected' => 'Selezionati',
|
||||||
|
'selectaction' => '-- seleziona azione --',
|
||||||
|
'addtogallery' => 'Aggiungi alla galleria',
|
||||||
|
'newgallery' => 'Nuova galleria',
|
||||||
|
'go' => 'Vai',
|
||||||
|
'add' => 'Aggiungi'
|
||||||
|
|
||||||
|
);
|
||||||
|
$lang['admin']['uploader']['mediamanager']['msgs'] = array(
|
||||||
|
3 => 'Nuova galleria creata',
|
||||||
|
2 => 'Immagini aggiunte alla galleria',
|
||||||
|
1 => 'File cancellato',
|
||||||
|
-1 => 'Errore cancellando il file',
|
||||||
|
-2 => 'Errore creando la nuova galleria',
|
||||||
|
-3 => 'Perfavore specifica il nome della nuova galleria'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
247
fp-plugins/mediamanager/panels/panel.mediamanager.file.php
Normal file
247
fp-plugins/mediamanager/panels/panel.mediamanager.file.php
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class admin_uploader_mediamanager extends AdminPanelAction {
|
||||||
|
var $finfo;
|
||||||
|
var $conf;
|
||||||
|
var $langres = 'plugin:mediamanager';
|
||||||
|
|
||||||
|
function cmpfiles($a, $b){
|
||||||
|
$c = strcmp($a['type'],$b['type']);
|
||||||
|
if ($c==0){
|
||||||
|
return strcmp($a['name'],$b['name']);
|
||||||
|
}
|
||||||
|
return $c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function formatBytes($bytes, $precision = 2) {
|
||||||
|
$units = array('B', 'KB', 'MB', 'GB', 'TB');
|
||||||
|
|
||||||
|
$bytes = max($bytes, 0);
|
||||||
|
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
|
||||||
|
$pow = min($pow, count($units) - 1);
|
||||||
|
|
||||||
|
$bytes /= pow(1024, $pow);
|
||||||
|
|
||||||
|
return round($bytes, $precision) . ' ' . $units[$pow];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getFileInfo($filepath){
|
||||||
|
global $fp_config;
|
||||||
|
|
||||||
|
$info = array(
|
||||||
|
"name"=>basename($filepath),
|
||||||
|
"size"=>$this->formatBytes(filesize($filepath)),
|
||||||
|
"mtime"=>date_strformat($fp_config['locale']['dateformatshort'], filemtime($filepath))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($this->conf['usecount'][basename($filepath)])){
|
||||||
|
$info['usecount']=$this->conf['usecount'][basename($filepath)];
|
||||||
|
} else {
|
||||||
|
$info['usecount'] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup() {
|
||||||
|
$this->smarty->assign('admin_resource', "plugin:mediamanager/admin.plugin.mediamanager.files");
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteFolder($folder, $mmbaseurl){
|
||||||
|
if (!file_exists($folder)) return false;
|
||||||
|
$dir = opendir($folder);
|
||||||
|
while (false !== ($file = readdir($dir))) {
|
||||||
|
if (!in_array($file, array(".",".."))) {
|
||||||
|
if (is_dir($folder."/".$file)){
|
||||||
|
$this->deleteFolder($folder."/".$file, $mmbaseurl);
|
||||||
|
} else {
|
||||||
|
if (!unlink($folder."/".$file)) return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rmdir($folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doItemActions($folder, $mmbaseurl){
|
||||||
|
/* delete file*/
|
||||||
|
if (isset($_GET['deletefile'])){
|
||||||
|
list($type, $name) = explode("-", $_GET['deletefile'],2);
|
||||||
|
switch($type){
|
||||||
|
case 'attachs': $type=ABS_PATH.ATTACHS_DIR; break;
|
||||||
|
case 'images': $type=ABS_PATH.IMAGES_DIR.$folder; break;
|
||||||
|
case 'gallery':
|
||||||
|
if ( !$this->deleteFolder(ABS_PATH.IMAGES_DIR.$name, $mmbaseurl))
|
||||||
|
@utils_redirect($mmbaseurl.'&status=-1');
|
||||||
|
@utils_redirect($mmbaseurl.'&status=1');
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
default: { @utils_redirect($mmbaseurl.'&status=-1'); return true; }
|
||||||
|
}
|
||||||
|
if (!file_exists($type.$name)) { @utils_redirect($mmbaseurl.'&status=-1'); return true; }
|
||||||
|
if (!unlink($type.$name)) { @utils_redirect($mmbaseurl.'&status=-1'); return true; }
|
||||||
|
@utils_redirect($mmbaseurl.'&status=1');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (isset($_GET['status'])){
|
||||||
|
$this->smarty->assign('success', $_GET['status']);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function main() {
|
||||||
|
$mmbaseurl="admin.php?p=uploader&action=mediamanager";
|
||||||
|
$folder = ""; $gallery="";
|
||||||
|
if (isset($_GET['gallery'])){
|
||||||
|
$mmbaseurl .= "&gallery=".$_GET['gallery'];
|
||||||
|
$gallery = str_replace("/","",$_GET['gallery']);
|
||||||
|
$folder = $gallery."/";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$weburl = plugin_geturl('mediamanager');
|
||||||
|
$this->conf = plugin_getoptions('mediamanager');
|
||||||
|
if ($this->doItemActions($folder, $mmbaseurl)) return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$files = array();
|
||||||
|
$galleries = array();
|
||||||
|
|
||||||
|
$files_needupdate=array();
|
||||||
|
$galleries_needupdate=array();
|
||||||
|
|
||||||
|
# galleries (alwais from IMAGES_DIR)
|
||||||
|
if (file_exists(ABS_PATH.IMAGES_DIR)){
|
||||||
|
$dir = opendir(ABS_PATH.IMAGES_DIR);
|
||||||
|
while (false !== ($file = readdir($dir))){
|
||||||
|
$fullpath=ABS_PATH.IMAGES_DIR.$file;
|
||||||
|
if (!in_array($file, array(".","..",".thumbs")) && is_dir($fullpath)) {
|
||||||
|
$info = $this->getFileInfo($fullpath);
|
||||||
|
$info['type'] = "gallery";
|
||||||
|
$galleries[$fullpath] = $info;
|
||||||
|
if (is_null($info['usecount'])) { $galleries_needupdate[]=$fullpath;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# attachs (NO attachs in galleries)
|
||||||
|
if ($folder=="" && file_exists(ABS_PATH.ATTACHS_DIR)){
|
||||||
|
$dir = opendir(ABS_PATH.ATTACHS_DIR);
|
||||||
|
while (false !== ($file = readdir($dir))) {
|
||||||
|
if (!in_array($file, array(".",".."))) {
|
||||||
|
$fullpath = ABS_PATH.ATTACHS_DIR.$file;
|
||||||
|
$info=$this->getFileInfo($fullpath);
|
||||||
|
$info['type']="attachs";
|
||||||
|
$info['url']=BLOG_ROOT.ATTACHS_DIR.$file;
|
||||||
|
$files[$fullpath]=$info;
|
||||||
|
if (is_null($info['usecount'])) { $files_needupdate[]=$fullpath;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# images
|
||||||
|
if (file_exists(ABS_PATH.IMAGES_DIR.$folder)){
|
||||||
|
$dir = opendir(ABS_PATH.IMAGES_DIR.$folder);
|
||||||
|
while (false !== ($file = readdir($dir))){
|
||||||
|
$fullpath=ABS_PATH.IMAGES_DIR.$folder.$file;
|
||||||
|
if (!in_array($file, array(".","..",".thumbs")) && !is_dir($fullpath)) {
|
||||||
|
$info=$this->getFileInfo($fullpath);
|
||||||
|
$info['type']="images";
|
||||||
|
$info['url']=BLOG_ROOT.IMAGES_DIR.$folder.$file;
|
||||||
|
$files[$fullpath]=$info;
|
||||||
|
# NO count for images in galleries
|
||||||
|
if ($folder=="" && is_null($info['usecount'])) { $files_needupdate[]=$fullpath; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mediamanager_updateUseCountArr($files,$files_needupdate);
|
||||||
|
mediamanager_updateUseCountArr($galleries,$galleries_needupdate);
|
||||||
|
|
||||||
|
usort($files, Array("admin_uploader_mediamanager","cmpfiles"));
|
||||||
|
$totalfilescount = (string) count($files);
|
||||||
|
#paginator
|
||||||
|
$pages = ceil((count($files)+count($galleries))/ ITEMSPERPAGE);
|
||||||
|
if ($pages==0) $pages=1;
|
||||||
|
if (isset($_GET['page'])){
|
||||||
|
$page = (int) $_GET['page'];
|
||||||
|
} else {
|
||||||
|
$page=1;
|
||||||
|
}
|
||||||
|
if ($page<1) $page=1;
|
||||||
|
if ($page>$pages) $page=$pages;
|
||||||
|
$pagelist = array();
|
||||||
|
for($k=1; $k<=$pages; $k++ ) $pagelist[]=$k;
|
||||||
|
$paginator = array( "total"=>$pages,
|
||||||
|
"current"=>$page,
|
||||||
|
"limit" => ITEMSPERPAGE,
|
||||||
|
"pages" => $pagelist
|
||||||
|
);
|
||||||
|
|
||||||
|
$startfrom = ($page-1)*ITEMSPERPAGE;
|
||||||
|
$galleriesout = count(array_slice($galleries,0, $startfrom));
|
||||||
|
$dropdowngalleries=$galleries;
|
||||||
|
$galleries = array_slice($galleries, $startfrom, ITEMSPERPAGE);
|
||||||
|
|
||||||
|
$files = array_slice($files, $startfrom-$galleriesout, ITEMSPERPAGE- count($galleries));
|
||||||
|
|
||||||
|
$this->smarty->assign('paginator', $paginator);
|
||||||
|
$this->smarty->assign('files', $files);
|
||||||
|
$this->smarty->assign('galleries', $galleries);
|
||||||
|
$this->smarty->assign('dwgalleries', $dropdowngalleries);
|
||||||
|
$this->smarty->assign('mmurl', $weburl);
|
||||||
|
$this->smarty->assign('mmbaseurl', $mmbaseurl);
|
||||||
|
$this->smarty->assign('currentgallery', $gallery);
|
||||||
|
$this->smarty->assign('totalfilescount', $totalfilescount);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onsubmit($data = NULL) {
|
||||||
|
if (isset($_POST['mm-newgallery'])){
|
||||||
|
$newgallery=$_POST['mm-newgallery-name'];
|
||||||
|
if ($newgallery==""){
|
||||||
|
$this->smarty->assign('success', -3);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
$newgallery = str_replace("/","", $newgallery);
|
||||||
|
$newgallery = str_replace(".","", $newgallery);
|
||||||
|
if (mkdir(ABS_PATH.IMAGES_DIR.$newgallery) ) {
|
||||||
|
$this->smarty->assign('success', 3);
|
||||||
|
} else {
|
||||||
|
$this->smarty->assign('success', -2);
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$folder = "";
|
||||||
|
if (isset($_GET['gallery'])){
|
||||||
|
$mmbaseurl .= "&gallery=".$_GET['gallery'];
|
||||||
|
$folder = str_replace("/","",$_GET['gallery'])."/";
|
||||||
|
}
|
||||||
|
|
||||||
|
list($action,$arg) = explode("-",$_POST['action'],2);
|
||||||
|
if (!isset($_POST['file'])) return 2;
|
||||||
|
foreach($_POST['file'] as $file=>$v){
|
||||||
|
list($type,$name) = explode("-",$file,2);
|
||||||
|
if ($action=='atg' && $type=='images'){
|
||||||
|
copy( ABS_PATH.IMAGES_DIR.$folder.$name, ABS_PATH.IMAGES_DIR.$arg.'/'.$name);
|
||||||
|
$this->smarty->assign('success', 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
admin_addpanelaction('uploader', 'mediamanager', true);
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
66
fp-plugins/mediamanager/plugin.mediamanager.php
Normal file
66
fp-plugins/mediamanager/plugin.mediamanager.php
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
Plugin Name: Media Manager
|
||||||
|
Version: 0.4
|
||||||
|
Plugin URI: http://kirgroup.com/blog/
|
||||||
|
Description: Manage uloaded files ad photo galleries
|
||||||
|
Author: Fabrix.xm
|
||||||
|
Author URI: http://kirgroup.com/fabrixxm/
|
||||||
|
*/
|
||||||
|
|
||||||
|
// config
|
||||||
|
define('ITEMSPERPAGE', 10);
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
function mediamanager_updateUseCountArr(&$files,$fupd){
|
||||||
|
$params = array();
|
||||||
|
$params['start']=0;
|
||||||
|
$params['count']=-1;
|
||||||
|
$params['fullparse'] = true;
|
||||||
|
$q = new FPDB_Query($params, null);
|
||||||
|
while ($q->hasMore()) {
|
||||||
|
list($id, $e) = $q->getEntry();
|
||||||
|
if (isset($e['content'])){
|
||||||
|
foreach($fupd as $id){
|
||||||
|
if (is_null($files[$id]['usecount'])) $files[$id]['usecount']=0;
|
||||||
|
if ($files[$id]['type']=='gallery'){
|
||||||
|
$searchterm="[gallery=images/".$files[$id]['name'];
|
||||||
|
} else {
|
||||||
|
$searchterm=$files[$id]['type']."/".$files[$id]['name'];
|
||||||
|
}
|
||||||
|
if (strpos($e['content'], $searchterm) !== false) $files[$id]['usecount']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$usecount=array();
|
||||||
|
foreach($files as $info){
|
||||||
|
$usecount[$info['name']]=$info['usecount'];
|
||||||
|
}
|
||||||
|
plugin_addoption('mediamanager', 'usecount', $usecount);
|
||||||
|
plugin_saveoptions('mediamanager');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (class_exists('AdminPanelAction')){
|
||||||
|
|
||||||
|
|
||||||
|
include(plugin_getdir('mediamanager') .'/panels/panel.mediamanager.file.php');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* invalidate count on entry save and delete */
|
||||||
|
function mediamanager_invalidatecount($arg){
|
||||||
|
plugin_addoption('mediamanager', 'usecount', array());
|
||||||
|
plugin_saveoptions('mediamanager');
|
||||||
|
return $arg;
|
||||||
|
}
|
||||||
|
add_filter('delete_post', 'mediamanager_invalidatecount', 1);
|
||||||
|
add_filter('content_save_pre', 'mediamanager_invalidatecount', 1);
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
BIN
fp-plugins/mediamanager/res/folder.gif
Normal file
BIN
fp-plugins/mediamanager/res/folder.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 225 B |
BIN
fp-plugins/mediamanager/res/image2.gif
Normal file
BIN
fp-plugins/mediamanager/res/image2.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 309 B |
18
fp-plugins/mediamanager/res/style.css
Normal file
18
fp-plugins/mediamanager/res/style.css
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
.type-attachs a {
|
||||||
|
padding-left: 25px;
|
||||||
|
background-image: url('unknown.gif');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: left center;
|
||||||
|
}
|
||||||
|
.type-images a {
|
||||||
|
padding-left: 25px;
|
||||||
|
background-image: url('image2.gif');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: left center;
|
||||||
|
}
|
||||||
|
.type-gallery a {
|
||||||
|
padding-left: 25px;
|
||||||
|
background-image: url('folder.gif');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: left center;
|
||||||
|
}
|
BIN
fp-plugins/mediamanager/res/unknown.gif
Normal file
BIN
fp-plugins/mediamanager/res/unknown.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 245 B |
112
fp-plugins/mediamanager/tpls/admin.plugin.mediamanager.files.tpl
Normal file
112
fp-plugins/mediamanager/tpls/admin.plugin.mediamanager.files.tpl
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<link rel="stylesheet" type="text/css" href="{$mmurl}res/style.css" />
|
||||||
|
<h2>{$plang.head}</h2>
|
||||||
|
<p>{$plang.description}</p>
|
||||||
|
{include file=shared:errorlist.tpl}
|
||||||
|
|
||||||
|
{html_form class=option-set}
|
||||||
|
{$plang.page}: {$paginator.current} / {$paginator.total}</br>
|
||||||
|
{if $currentgallery!=""}<h3>gallery '{$currentgallery}'</h3>{/if}
|
||||||
|
<table class="entrylist">
|
||||||
|
<thead>
|
||||||
|
<colgroup><col/><col width="50%"/><col/><col/><col/></colgroup>
|
||||||
|
<tr>
|
||||||
|
<th> </th>
|
||||||
|
<th>{$plang.colname}</th>
|
||||||
|
<th>{$plang.colusecount}</th>
|
||||||
|
<th>{$plang.colsize}</th>
|
||||||
|
<th>{$plang.colmtime}</th>
|
||||||
|
<th> </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{if $currentgallery!=""}
|
||||||
|
<tr><td> </td>
|
||||||
|
<td class="main-cell type-gallery" colspan="5">
|
||||||
|
<a class="link-general" href="admin.php?p=uploader&action=mediamanager">{$plang.up}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{else}
|
||||||
|
{foreach from=$galleries item=v}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td class="main-cell type-{$v.type}">
|
||||||
|
<a class="link-general" href="admin.php?p=uploader&action=mediamanager&gallery={$v.name}">{$v.name}</a>
|
||||||
|
</td>
|
||||||
|
<td>{if $v.usecount>0}
|
||||||
|
<a class="link-general" href="search.php?q=images%2F{$v.name}&stype=full&Date_Day=&Date_Month=&Date_Year=&submit=Search">{$v.usecount}</a>
|
||||||
|
{else}
|
||||||
|
0
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
<td>{$v.size}</td>
|
||||||
|
<td>{$v.mtime}</td>
|
||||||
|
<td>
|
||||||
|
<a class="link-delete" href="{$mmbaseurl}&deletefile={$v.type}-{$v.name}">{$plang.delete}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
{/if}
|
||||||
|
{if $totalfilescount=="0" }
|
||||||
|
<tr><td colspan="6"><br>{$plang.nofiles} <a class="link-general" href="admin.php?p=uploader&action=default">{$plang.loadfile}</a><br><br></td></tr>
|
||||||
|
{else}
|
||||||
|
{foreach from=$files item=v}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{if $v.type=='images'}
|
||||||
|
<input type='checkbox' name='file[{$v.type}-{$v.name}]'>
|
||||||
|
{else}
|
||||||
|
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
<td class="main-cell type-{$v.type}"><a class="link-general" {if $v.type=='images'}rel="lightbox[mm]"{/if} href="{$v.url}">{$v.name}</a></td>
|
||||||
|
<td>{if $v.usecount>0}
|
||||||
|
<a class="link-general" href="search.php?q={$v.type}%2F{$v.name}&stype=full&Date_Day=&Date_Month=&Date_Year=&submit=Search">{$v.usecount}</a>
|
||||||
|
{else}
|
||||||
|
0
|
||||||
|
{/if}
|
||||||
|
</td>
|
||||||
|
<td>{$v.size}</td>
|
||||||
|
<td>{$v.mtime}</td>
|
||||||
|
<td>
|
||||||
|
<a class="link-delete" href="{$mmbaseurl}&deletefile={$v.type}-{$v.name}">{$plang.delete}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{/foreach}
|
||||||
|
{/if}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- paginator -->
|
||||||
|
<p class="paginator">
|
||||||
|
{foreach name=pagelist from=$paginator.pages item=page}
|
||||||
|
{if $paginator.current==$page}
|
||||||
|
{$page}
|
||||||
|
{else}
|
||||||
|
<a href="{$mmbaseurl}&page={$page}">{$page}</a>
|
||||||
|
{/if}
|
||||||
|
{if $smarty.foreach.pagelist.last==false} - {/if}
|
||||||
|
{/foreach}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{$plang.selected}:
|
||||||
|
<select name='action'>
|
||||||
|
<option value='-'>{$plang.selectaction}</option>
|
||||||
|
<{foreach from=$dwgalleries item=v}
|
||||||
|
<option value='atg-{$v.name}'>{$plang.addtogallery} '{$v.name}'</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
<input type="submit" name="mm-addto" value="{$plang.go}"/>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label>{$plang.newgallery}:
|
||||||
|
<input type="text" name="mm-newgallery-name" />
|
||||||
|
</label>
|
||||||
|
<input type="submit" name="mm-newgallery" value="{$plang.add}"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{/html_form}
|
||||||
|
|
@ -236,13 +236,26 @@ class Plugin_PrettyURLs {
|
|||||||
$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);
|
||||||
|
|
||||||
|
if (isset($_SERVER['PATH_INFO'])) {
|
||||||
|
$pathinfo = $_SERVER['PATH_INFO'];
|
||||||
|
} else {
|
||||||
|
$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/';
|
||||||
$url = $_SERVER['PATH_INFO'];
|
if ($urllenght < 2) {
|
||||||
|
$url = "/";
|
||||||
|
} else {
|
||||||
|
// $url = $_SERVER['PATH_INFO'];
|
||||||
|
$url = $pathinfo;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$baseurl .= '?u=/';
|
$baseurl .= '?u=/';
|
||||||
@ -613,7 +626,7 @@ STR;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function onsubmit() {
|
function onsubmit($data = null) {
|
||||||
global $fp_config;
|
global $fp_config;
|
||||||
|
|
||||||
if (isset($_POST['saveopt'])) {
|
if (isset($_POST['saveopt'])) {
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
add_filter('wp_head', 'myredirect');
|
add_filter('wp_head', 'myredirect');
|
||||||
|
|
||||||
$content = (SHARED_TPLS . 'login_success.tpl');
|
$content = (SHARED_TPLS . 'login.tpl');
|
||||||
|
|
||||||
} elseif (user_loggedin()) {
|
} elseif (user_loggedin()) {
|
||||||
|
|
||||||
|
29
patch-description.txt
Normal file
29
patch-description.txt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Flatpress 1.0.3 Patch for PHP 7.1
|
||||||
|
=================================
|
||||||
|
|
||||||
|
You can use this patch for this Flatpress version:
|
||||||
|
- Flatpress 1.0.3
|
||||||
|
|
||||||
|
This developer snapshot isn't full tested with all
|
||||||
|
available Flatpress plugins from third party developers.
|
||||||
|
So it is possible that some plugins not run.
|
||||||
|
|
||||||
|
|
||||||
|
Please note!
|
||||||
|
------------
|
||||||
|
|
||||||
|
Do a full backup of your Flatpress Blog before making any changes!
|
||||||
|
|
||||||
|
For instructions how to backup please refer the Flatpress Basics Wiki article
|
||||||
|
-> http://wiki.flatpress.org/en:doc:basic:backup
|
||||||
|
|
||||||
|
|
||||||
|
Instructions:
|
||||||
|
-------------
|
||||||
|
|
||||||
|
You need a FTP program to transfer the patch files to your webspace.
|
||||||
|
Override the files on your flatpress installation,
|
||||||
|
then login and clear the cache. That's all.
|
||||||
|
|
||||||
|
|
||||||
|
date: 03/26/2017
|
14
search.php
14
search.php
@ -82,14 +82,19 @@ if (!defined('MOD_INDEX')) {
|
|||||||
isset($_GET['Date_Month']) && ($_GET['Date_Month']!='--')? $params['m'] = $_GET['Date_Month'] : null;
|
isset($_GET['Date_Month']) && ($_GET['Date_Month']!='--')? $params['m'] = $_GET['Date_Month'] : null;
|
||||||
!empty($_GET['Date_Year']) && ($_GET['Date_Year']!='--')? $params['y'] = substr($_GET['Date_Year'], 2) : null;
|
!empty($_GET['Date_Year']) && ($_GET['Date_Year']!='--')? $params['y'] = substr($_GET['Date_Year'], 2) : null;
|
||||||
|
|
||||||
isset($_GET['cats'])? $params = $_GET['cats']: null;
|
// isset($_GET['cats'])? $params = $_GET['cats']: null;
|
||||||
|
isset($_GET['cats'])? $params['cats'] = $_GET['cats']: null;
|
||||||
|
|
||||||
|
|
||||||
$params['fullparse'] = false;
|
$params['fullparse'] = false;
|
||||||
|
|
||||||
if(!empty($_GET['stype']) && $_GET['stype']=='full') {
|
if(!empty($_GET['stype']) && $_GET['stype']=='full') {
|
||||||
$params['fullparse'] = true;
|
$params['fullparse'] = true;
|
||||||
}
|
$fts = "yes";
|
||||||
|
} else {
|
||||||
|
$params['fullparse'] = false;
|
||||||
|
$fts = "no";
|
||||||
|
}
|
||||||
|
|
||||||
$srchparams = $params;
|
$srchparams = $params;
|
||||||
|
|
||||||
@ -113,7 +118,8 @@ if (!defined('MOD_INDEX')) {
|
|||||||
$keywords
|
$keywords
|
||||||
) !== false;
|
) !== false;
|
||||||
|
|
||||||
if (!$match && $params['fullparse']) {
|
// if (!$match && $params['fullparse']) {
|
||||||
|
if (!$match && ($fts === "yes")) {
|
||||||
|
|
||||||
$match = strpos(
|
$match = strpos(
|
||||||
strtolower($e['content']),
|
strtolower($e['content']),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user