diff options
author | nobody <nobody@zotlabs.com> | 2021-08-25 19:13:31 -0700 |
---|---|---|
committer | nobody <nobody@zotlabs.com> | 2021-08-25 19:13:31 -0700 |
commit | aa2106f9495bee4dcf0701fbd9fec8de6fa44984 (patch) | |
tree | f2e7178f78311069bd54471f6c063c5901d16fb7 /Zotlabs/Lib/Apps.php | |
parent | 73b53675b1a339cfd950845279438e35b4e2dc7c (diff) | |
parent | 6261d0826c49ca24df9f694931592fbb9bf60f7e (diff) | |
download | volse-hubzilla-aa2106f9495bee4dcf0701fbd9fec8de6fa44984.tar.gz volse-hubzilla-aa2106f9495bee4dcf0701fbd9fec8de6fa44984.tar.bz2 volse-hubzilla-aa2106f9495bee4dcf0701fbd9fec8de6fa44984.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Lib/Apps.php')
-rw-r--r-- | Zotlabs/Lib/Apps.php | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 30c108cc1..ba854197f 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -2,6 +2,7 @@ namespace Zotlabs\Lib; +use App; use Zotlabs\Lib\Libsync; require_once('include/plugin.php'); @@ -537,13 +538,47 @@ class Apps { $install_action = (($installed) ? t('Update') : t('Install')); $icon = ((strpos($papp['photo'],'icon:') === 0) ? substr($papp['photo'],5) : ''); + if (!$installed && $mode === 'module') { + $_SESSION['return_url'] = App::$query_string; + return replace_macros(get_markup_template('app_install.tpl'), [ + '$papp' => $papp, + '$install' => $install_action + ]); + } + if($mode === 'navbar') { + return replace_macros(get_markup_template('app_nav_pinned.tpl'),array( + '$app' => $papp, + '$icon' => $icon, + )); + } + + if($mode === 'nav') { return replace_macros(get_markup_template('app_nav.tpl'),array( '$app' => $papp, '$icon' => $icon, )); } + if($mode === 'inline') { + return replace_macros(get_markup_template('app_inline.tpl'),array( + '$app' => $papp, + '$icon' => $icon, + '$installed' => $installed, + '$purchase' => ((isset($papp['page']) && (! $installed)) ? t('Purchase') : ''), + '$action_label' => $install_action + )); + } + + if(in_array($mode, ['nav-order', 'nav-order-pinned'])) { + return replace_macros(get_markup_template('app_order.tpl'),array( + '$app' => $papp, + '$icon' => $icon, + '$hosturl' => $hosturl, + '$mode' => $mode + )); + } + if($mode === 'install') { $papp['embed'] = true; } @@ -564,8 +599,6 @@ class Apps { '$pin' => ((isset($papp['embed']) || $mode == 'edit') ? false : true), '$featured' => ((strpos($papp['categories'], 'nav_featured_app') === false) ? false : true), '$pinned' => ((strpos($papp['categories'], 'nav_pinned_app') === false) ? false : true), - '$navapps' => (($mode == 'nav') ? true : false), - '$order' => (($mode === 'nav-order' || $mode === 'nav-order-pinned') ? true : false), '$mode' => $mode, '$add' => t('Add to app-tray'), '$remove' => t('Remove from app-tray'), @@ -575,6 +608,7 @@ class Apps { )); } + static public function app_install($uid,$app) { if(! is_array($app)) { @@ -1357,4 +1391,17 @@ class Apps { return chunk_split(base64_encode(json_encode($papp)),72,"\n"); } + static public function get_papp($app) { + + $r = q("select * from app where app_id = '%s' and app_channel = 0 limit 1", + dbesc(hash('whirlpool', $app)) + ); + + if ($r) { + $papp = self::app_encode($r[0]); + return $papp; + } + + return false; + } } |