aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/AConfig.php4
-rw-r--r--Zotlabs/Lib/AbConfig.php4
-rw-r--r--Zotlabs/Lib/Config.php6
-rw-r--r--Zotlabs/Lib/Enotify.php2
-rw-r--r--Zotlabs/Lib/IConfig.php6
-rw-r--r--Zotlabs/Lib/PConfig.php6
-rw-r--r--Zotlabs/Lib/System.php24
-rw-r--r--Zotlabs/Lib/XConfig.php6
8 files changed, 41 insertions, 17 deletions
diff --git a/Zotlabs/Lib/AConfig.php b/Zotlabs/Lib/AConfig.php
index ab8648a18..4e7c5483f 100644
--- a/Zotlabs/Lib/AConfig.php
+++ b/Zotlabs/Lib/AConfig.php
@@ -10,8 +10,8 @@ class AConfig {
return XConfig::Load('a_' . $account_id);
}
- static public function Get($account_id,$family,$key) {
- return XConfig::Get('a_' . $account_id,$family,$key);
+ static public function Get($account_id,$family,$key,$default = false) {
+ return XConfig::Get('a_' . $account_id,$family,$key, $default);
}
static public function Set($account_id,$family,$key,$value) {
diff --git a/Zotlabs/Lib/AbConfig.php b/Zotlabs/Lib/AbConfig.php
index cb5d96951..dfc9efc6c 100644
--- a/Zotlabs/Lib/AbConfig.php
+++ b/Zotlabs/Lib/AbConfig.php
@@ -16,7 +16,7 @@ class AbConfig {
}
- static public function Get($chan,$xhash,$family,$key) {
+ static public function Get($chan,$xhash,$family,$key, $default = false) {
$r = q("select * from abconfig where chan = %d and xchan = '%s' and cat = '%s' and k = '%s' limit 1",
intval($chan),
dbesc($xhash),
@@ -26,7 +26,7 @@ class AbConfig {
if($r) {
return ((preg_match('|^a:[0-9]+:{.*}$|s', $r[0]['v'])) ? unserialize($r[0]['v']) : $r[0]['v']);
}
- return false;
+ return $default;
}
diff --git a/Zotlabs/Lib/Config.php b/Zotlabs/Lib/Config.php
index d4ee1aeda..5625a3f79 100644
--- a/Zotlabs/Lib/Config.php
+++ b/Zotlabs/Lib/Config.php
@@ -98,13 +98,13 @@ class Config {
* @return mixed Return value or false on error or if not set
*/
- static public function Get($family,$key) {
+ static public function Get($family,$key,$default = false) {
if((! array_key_exists($family, \App::$config)) || (! array_key_exists('config_loaded', \App::$config[$family])))
self::Load($family);
if(array_key_exists('config_loaded', \App::$config[$family])) {
if(! array_key_exists($key, \App::$config[$family])) {
- return false;
+ return $default;
}
return ((! is_array(\App::$config[$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', \App::$config[$family][$key]))
? unserialize(\App::$config[$family][$key])
@@ -112,7 +112,7 @@ class Config {
);
}
- return false;
+ return $default;
}
/**
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index b6f4d3351..c64ff9868 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -102,7 +102,7 @@ class Enotify {
$title = $params['item']['title'];
$body = $params['item']['body'];
}
- if($item['created'] < datetime_convert('UTC','UTC','now - 1 month')) {
+ if($params['item']['created'] < datetime_convert('UTC','UTC','now - 1 month')) {
logger('notification invoked for an old item which may have been refetched.',LOGGER_DEBUG,LOG_INFO);
return;
}
diff --git a/Zotlabs/Lib/IConfig.php b/Zotlabs/Lib/IConfig.php
index 28c9ab58e..33d94bd49 100644
--- a/Zotlabs/Lib/IConfig.php
+++ b/Zotlabs/Lib/IConfig.php
@@ -10,7 +10,7 @@ class IConfig {
return;
}
- static public function Get(&$item, $family, $key) {
+ static public function Get(&$item, $family, $key, $default = false) {
$is_item = false;
@@ -28,7 +28,7 @@ class IConfig {
$iid = $item;
if(! $iid)
- return false;
+ return $default;
if(is_array($item) && array_key_exists('iconfig',$item) && is_array($item['iconfig'])) {
foreach($item['iconfig'] as $c) {
@@ -48,7 +48,7 @@ class IConfig {
$item['iconfig'][] = $r[0];
return $r[0]['v'];
}
- return false;
+ return $default;
}
diff --git a/Zotlabs/Lib/PConfig.php b/Zotlabs/Lib/PConfig.php
index 3b47a250a..d70697fbc 100644
--- a/Zotlabs/Lib/PConfig.php
+++ b/Zotlabs/Lib/PConfig.php
@@ -67,16 +67,16 @@ class PConfig {
* @return mixed Stored value or false if it does not exist
*/
- static public function Get($uid,$family,$key,$instore = false) {
+ static public function Get($uid,$family,$key,$default = false) {
if(is_null($uid) || $uid === false)
- return false;
+ return $default;
if(! array_key_exists($uid, \App::$config))
self::Load($uid);
if((! array_key_exists($family, \App::$config[$uid])) || (! array_key_exists($key, \App::$config[$uid][$family])))
- return false;
+ return $default;
return ((! is_array(\App::$config[$uid][$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', \App::$config[$uid][$family][$key]))
? unserialize(\App::$config[$uid][$family][$key])
diff --git a/Zotlabs/Lib/System.php b/Zotlabs/Lib/System.php
index 32aaa82a9..306c90f4a 100644
--- a/Zotlabs/Lib/System.php
+++ b/Zotlabs/Lib/System.php
@@ -42,6 +42,20 @@ class System {
}
+ static public function get_project_link() {
+ if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['project_link'])
+ return \App::$config['system']['project_link'];
+ return 'https://hubzilla.org';
+ }
+
+ static public function get_project_srclink() {
+ if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['project_srclink'])
+ return \App::$config['system']['project_srclink'];
+ return 'https://github.com/redmatrix/hubzilla';
+ }
+
+
+
static public function get_server_role() {
if(is_array(\App::$config) && is_array(\App::$config['system']) && \App::$config['system']['server_role'])
return \App::$config['system']['server_role'];
@@ -54,5 +68,15 @@ class System {
return '0.0.0';
}
+ static public function compatible_project($p) {
+ if(get_directory_realm() != DIRECTORY_REALM)
+ return true;
+
+ foreach(['hubzilla','zap'] as $t) {
+ if(stristr($p,$t))
+ return true;
+ }
+ return false;
+ }
}
diff --git a/Zotlabs/Lib/XConfig.php b/Zotlabs/Lib/XConfig.php
index 7f3d0f2cd..bf78c360f 100644
--- a/Zotlabs/Lib/XConfig.php
+++ b/Zotlabs/Lib/XConfig.php
@@ -59,16 +59,16 @@ class XConfig {
* @return mixed Stored $value or false if it does not exist
*/
- static public function Get($xchan, $family, $key) {
+ static public function Get($xchan, $family, $key, $default = false) {
if(! $xchan)
- return false;
+ return $default;
if(! array_key_exists($xchan, \App::$config))
load_xconfig($xchan);
if((! array_key_exists($family, \App::$config[$xchan])) || (! array_key_exists($key, \App::$config[$xchan][$family])))
- return false;
+ return $default;
return ((! is_array(\App::$config[$xchan][$family][$key])) && (preg_match('|^a:[0-9]+:{.*}$|s', \App::$config[$xchan][$family][$key]))
? unserialize(\App::$config[$xchan][$family][$key])