aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/config.php4
-rw-r--r--include/dba.php4
-rw-r--r--include/plugin.php16
3 files changed, 17 insertions, 7 deletions
diff --git a/include/config.php b/include/config.php
index 1f2a70e5a..44606e329 100644
--- a/include/config.php
+++ b/include/config.php
@@ -68,7 +68,7 @@ function get_config($family, $key, $instore = false) {
);
if(count($ret)) {
// manage array value
- $val = (preg_match("|^a:[0-9]+:{.*}$|", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
+ $val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
$a->config[$family][$key] = $val;
return $val;
}
@@ -162,7 +162,7 @@ function get_pconfig($uid,$family, $key, $instore = false) {
);
if(count($ret)) {
- $val = (preg_match("|^a:[0-9]+:{.*}$|", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
+ $val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
$a->config[$uid][$family][$key] = $val;
return $val;
}
diff --git a/include/dba.php b/include/dba.php
index 879d7e67e..8d224b570 100644
--- a/include/dba.php
+++ b/include/dba.php
@@ -78,7 +78,7 @@ class dba {
$this->error = '';
- if ($a->config["system"]["db_log"] != "")
+ if(x($a->config,'system') && x($a->config['system'],'db_log'))
$stamp1 = microtime(true);
if($this->mysqli)
@@ -86,7 +86,7 @@ class dba {
else
$result = @mysql_query($sql,$this->db);
- if ($a->config["system"]["db_log"] != "") {
+ if(x($a->config,'system') && x($a->config['system'],'db_log')) {
$stamp2 = microtime(true);
$duration = round($stamp2-$stamp1, 3);
if ($duration > $a->config["system"]["db_loglimit"]) {
diff --git a/include/plugin.php b/include/plugin.php
index 7202ccaa9..c6d62f36e 100644
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -8,7 +8,10 @@ function uninstall_plugin($plugin){
q("DELETE FROM `addon` WHERE `name` = '%s' ",
dbesc($plugin)
);
-
+
+ // define THISPLUGIN, make life easy to plugin devs :-)
+ define("THISPLUGIN", 'addon/' . $plugin . '/' . $plugin . '.php');
+
@include_once('addon/' . $plugin . '/' . $plugin . '.php');
if(function_exists($plugin . '_uninstall')) {
$func = $plugin . '_uninstall';
@@ -18,9 +21,11 @@ function uninstall_plugin($plugin){
if (! function_exists('install_plugin')){
function install_plugin($plugin) {
-
// silently fail if plugin was removed
+ // define THISPLUGIN, make life easy to plugin devs :-)
+ define("THISPLUGIN", 'addon/' . $plugin . '/' . $plugin . '.php');
+
if(! file_exists('addon/' . $plugin . '/' . $plugin . '.php'))
return false;
logger("Addons: installing " . $plugin);
@@ -77,7 +82,10 @@ function reload_plugins() {
$pl = trim($pl);
$fname = 'addon/' . $pl . '/' . $pl . '.php';
-
+
+ // define THISPLUGIN, make life easy to plugin devs :-)
+ define("THISPLUGIN", $fname);
+
if(file_exists($fname)) {
$t = @filemtime($fname);
foreach($installed as $i) {
@@ -163,6 +171,8 @@ function call_hooks($name, &$data = null) {
if((is_array($a->hooks)) && (array_key_exists($name,$a->hooks))) {
foreach($a->hooks[$name] as $hook) {
+ // define THISPLUGIN, make life easy to plugin devs :-)
+ define("THISPLUGIN", $hook[0]);
@include_once($hook[0]);
if(function_exists($hook[1])) {
$func = $hook[1];