From a99d28dea939abc7eb9fbfcfcc966c40215a94b6 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 18 Dec 2015 13:46:03 -0800 Subject: sql delete with limit --- include/deliver.php | 2 +- include/zot.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/deliver.php b/include/deliver.php index 60d935d02..7ff0fa125 100644 --- a/include/deliver.php +++ b/include/deliver.php @@ -66,7 +66,7 @@ function deliver_run($argv, $argc) { } } - q("delete from dreport where dreport_queue = '%s' limit 1", + q("delete from dreport where dreport_queue = '%s'", dbesc($argv[$x]) ); } diff --git a/include/zot.php b/include/zot.php index ce3bef783..922637bc1 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1000,7 +1000,7 @@ function zot_process_response($hub, $arr, $outq) { // we have a more descriptive delivery report, so discard the per hub 'queued' report. - q("delete from dreport where dreport_queue = '%s' limit 1", + q("delete from dreport where dreport_queue = '%s' ", dbesc($outq['outq_hash']) ); -- cgit v1.2.3 From 8d61efa0e865203df5eb4fae90b7bbd48597cf03 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 18 Dec 2015 14:10:06 -0800 Subject: allow widget 'packages' as well as individual files --- include/comanche.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/comanche.php b/include/comanche.php index ef71886f2..5bffc3dbf 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -284,8 +284,13 @@ function comanche_widget($name, $text) { $func = 'widget_' . trim($name); - if((! function_exists($func)) && file_exists('widget/' . trim($name) . '.php')) - require_once('widget/' . trim($name) . '.php'); + if(! function_exists($func)) { + if(file_exists('widget/' . trim($name) . '.php')) + require_once('widget/' . trim($name) . '.php'); + elseif(is_dir('widget/'. trim($name)) + && (file_exists('widget/' . trim($name) . '/' . trim($name) . '.php'))) + require_once('widget/' . trim($name) . '/' . trim($name) . '.php'); + } else { $theme_widget = $func . '.php'; if((! function_exists($func)) && theme_include($theme_widget)) -- cgit v1.2.3 From ed5ca9e4ccb2741c33ac2c88082728066bc715fb Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 18 Dec 2015 14:55:19 -0800 Subject: use realpath to bypass symlinks and check actually directory --- include/comanche.php | 2 +- include/plugin.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/comanche.php b/include/comanche.php index 5bffc3dbf..1537226ca 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -287,7 +287,7 @@ function comanche_widget($name, $text) { if(! function_exists($func)) { if(file_exists('widget/' . trim($name) . '.php')) require_once('widget/' . trim($name) . '.php'); - elseif(is_dir('widget/'. trim($name)) + elseif(folder_exists('widget/'. trim($name)) && (file_exists('widget/' . trim($name) . '/' . trim($name) . '.php'))) require_once('widget/' . trim($name) . '/' . trim($name) . '.php'); } diff --git a/include/plugin.php b/include/plugin.php index 1f4d60736..4a35a0170 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -636,3 +636,13 @@ function get_std_version() { return STD_VERSION; return '0.0.0'; } + + +function folder_exists($folder) +{ + // Get canonicalized absolute pathname + $path = realpath($folder); + + // If it exist, check if it's a directory + return (($path !== false) && is_dir($path)) ? $path : false; +} \ No newline at end of file -- cgit v1.2.3