aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-05-15 16:43:42 -0700
committerfriendica <info@friendica.com>2014-05-15 16:43:42 -0700
commite68bb132a701d170ef1e13752a8f64107eac7353 (patch)
tree1e4aa3ca794a3f17d166318805622786f2f68a59
parent8b233723c5a6cbf18de438efa1d832691b0d9cce (diff)
downloadvolse-hubzilla-e68bb132a701d170ef1e13752a8f64107eac7353.tar.gz
volse-hubzilla-e68bb132a701d170ef1e13752a8f64107eac7353.tar.bz2
volse-hubzilla-e68bb132a701d170ef1e13752a8f64107eac7353.zip
some backend stuff for apps
-rw-r--r--include/apps.php53
-rwxr-xr-xinclude/plugin.php11
-rw-r--r--mod/apps.php20
-rw-r--r--version.inc2
4 files changed, 77 insertions, 9 deletions
diff --git a/include/apps.php b/include/apps.php
new file mode 100644
index 000000000..38812ef83
--- /dev/null
+++ b/include/apps.php
@@ -0,0 +1,53 @@
+<?php /** @file */
+
+/**
+ * apps
+ *
+ */
+
+require_once('include/plugin.php');
+
+function get_system_apps() {
+
+ $ret = array();
+ $files = glob('app/*.apd');
+ if($files) {
+ foreach($files as $f) {
+ $x = parse_app_description($f);
+ if($x) {
+ $ret[] = $x;
+ }
+ }
+ }
+ $files = glob('addon/*/*.apd');
+ if($files) {
+ foreach($files as $f) {
+ $n = basename($f,'.apd');
+ if(plugin_is_installed($n)) {
+ $x = parse_app_description($f);
+ if($x) {
+ $ret[] = $x;
+ }
+ }
+ }
+ }
+
+ return $ret;
+
+}
+
+
+function parse_app_description($f) {
+ $ret = array();
+
+ $lines = @file($f);
+ if($lines) {
+ foreach($lines as $x) {
+ if(preg_match('/^([a-zA-Z].*?):(.*?)$/ism',$x,$matches)) {
+ $ret[$matches[1]] = trim($matches[2]);
+ }
+ }
+ }
+
+ return $ret;
+}
diff --git a/include/plugin.php b/include/plugin.php
index 9982a48a2..ace00d43a 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -94,6 +94,17 @@ function load_plugin($plugin) {
}
+function plugin_is_installed($name) {
+ $r = q("select name from addon where name = '%s' and installed = 1 limit 1",
+ dbesc($name)
+ );
+ if($r)
+ return true;
+ return false;
+}
+
+
+
// reload all updated plugins
function reload_plugins() {
diff --git a/mod/apps.php b/mod/apps.php
index 43540a3de..678af74e7 100644
--- a/mod/apps.php
+++ b/mod/apps.php
@@ -1,17 +1,21 @@
<?php
+require_once('include/apps.php');
+
function apps_content(&$a) {
- $apps = $a->get_apps();
- if(count($apps) == 0)
- notice( t('No installed applications.') . EOL);
+ $apps = get_system_apps();
+
+ $o .= print_r($apps,true);
+
+ return $o;
- $tpl = get_markup_template("apps.tpl");
- return replace_macros($tpl, array(
- '$title' => t('Applications'),
- '$apps' => $apps,
- ));
+// $tpl = get_markup_template("apps.tpl");
+// return replace_macros($tpl, array(
+// '$title' => t('Applications'),
+// '$apps' => $apps,
+// ));
}
diff --git a/version.inc b/version.inc
index bb7d12c4b..3a42d37e3 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2014-05-14.675
+2014-05-15.676