diff options
author | Thomas Willingham <founder@kakste.com> | 2014-05-22 19:39:28 +0100 |
---|---|---|
committer | Thomas Willingham <founder@kakste.com> | 2014-05-22 19:39:28 +0100 |
commit | 292601728430469f21b81d7055cd485a0efb491c (patch) | |
tree | 4d35371f101a26b69eb8dc6dc15c3be4a884258e /mod | |
parent | b06fd69da84626c1e8c1d8b5dbda6f181027a782 (diff) | |
parent | 8e2771cbd409d56917e7d249d80a2c422609f540 (diff) | |
download | volse-hubzilla-292601728430469f21b81d7055cd485a0efb491c.tar.gz volse-hubzilla-292601728430469f21b81d7055cd485a0efb491c.tar.bz2 volse-hubzilla-292601728430469f21b81d7055cd485a0efb491c.zip |
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'mod')
-rw-r--r-- | mod/appman.php | 98 | ||||
-rw-r--r-- | mod/apps.php | 27 | ||||
-rw-r--r-- | mod/home.php | 6 |
3 files changed, 125 insertions, 6 deletions
diff --git a/mod/appman.php b/mod/appman.php new file mode 100644 index 000000000..15f27676c --- /dev/null +++ b/mod/appman.php @@ -0,0 +1,98 @@ +<?php /** @file */ + +require_once('include/apps.php'); + +function appman_post(&$a) { + + if(! local_user()) + return; + + if($_POST['url']) { + $arr = array( + 'uid' => intval($_REQUEST['uid']), + 'url' => escape_tags($_REQUEST['url']), + 'guid' => escape_tags($_REQUEST['guid']), + 'author' => escape_tags($_REQUEST['author']), + 'addr' => escape_tags($_REQUEST['addr']), + 'name' => escape_tags($_REQUEST['name']), + 'desc' => escape_tags($_REQUEST['desc']), + 'photo' => escape_tags($_REQUEST['photo']), + 'version' => escape_tags($_REQUEST['version']), + 'price' => escape_tags($_REQUEST['price']), + 'sig' => escape_tags($_REQUEST['sig']) + ); + + $_REQUEST['appid'] = app_install(local_user(),$arr); + if(app_installed(local_user(),$arr)) + info( t('App installed.') . EOL); + return; + } + + + $papp = app_decode($_POST['papp']); + + if(! is_array($papp)) { + notice( t('Malformed app.') . EOL); + return; + } + + if($_POST['install']) { + app_install(local_user(),$papp); + } + + if($_POST['delete']) { + app_destroy(local_user(),$papp); + } + + if($_POST['edit']) { + return; + } + + if($_SESSION['return_url']) + goaway(z_root() . '/' . $_SESSION['return_url']); + goaway(z_root() . '/apps/personal'); + + +} + + +function appman_content(&$a) { + + if(! local_user()) { + notice( t('Permission denied.') . EOL); + return; + } +logger('content'); + $channel = $a->get_channel(); + $app = null; + $embed = null; + if($_REQUEST['appid']) { + $r = q("select * from app where app_id = '%s' and app_channel = %d limit 1", + dbesc($_REQUEST['appid']), + dbesc(local_user()) + ); + if($r) + $app = $r[0]; + $embed = array('embed', t('Embed code'), app_encode($app,true),''); + + } + + return replace_macros(get_markup_template('app_create.tpl'), array( + + '$banner' => (($app) ? t('Edit App') : t('Create App')), + '$app' => $app, + '$guid' => (($app) ? $app['app_id'] : ''), + '$author' => (($app) ? $app['app_author'] : $channel['channel_hash']), + '$addr' => (($app) ? $app['app_addr'] : $channel['xchan_addr']), + '$name' => array('name', t('Name of app'),(($app) ? $app['app_name'] : ''), t('Required')), + '$url' => array('url', t('Location (URL) of app'),(($app) ? $app['app_url'] : ''), t('Required')), + '$desc' => array('desc', t('Description'),(($app) ? $app['app_desc'] : ''), ''), + '$photo' => array('photo', t('Photo icon URL'),(($app) ? $app['app_url'] : ''), t('80 x 80 pixels - optional')), + '$version' => array('version', t('Version ID'),(($app) ? $app['app_version'] : ''), ''), + '$price' => array('price', t('Price of app'),(($app) ? $app['app_price'] : ''), ''), + '$page' => array('page', t('Location (URL) to purchase app'),(($app) ? $app['app_page'] : ''), ''), + '$embed' => $embed, + '$submit' => t('Submit') + )); + +}
\ No newline at end of file diff --git a/mod/apps.php b/mod/apps.php index 3d06abd49..e88c54c66 100644 --- a/mod/apps.php +++ b/mod/apps.php @@ -5,15 +5,34 @@ require_once('include/apps.php'); function apps_content(&$a) { + if(argc() == 1 || (! local_user())) { - $apps = get_system_apps(); + $apps = get_system_apps(); -// $o .= print_r($apps,true); + // $o .= print_r($apps,true); -// return $o; + // return $o; + return replace_macros(get_markup_template('apps.tpl'), array( + '$title' => t('Apps'), + '$apps' => $apps, + )); + } - return replace_macros(get_markup_template('apps.tpl'), array( + if(argc() == 3 && argv(2) == 'edit') + $mode = 'edit'; + else + $mode = 'list'; + + $apps = array(); + $list = app_list(local_user()); + if($list) { + foreach($list as $app) { + $apps[] = app_render(app_encode($app),$mode); + } + } + + return replace_macros(get_markup_template('myapps.tpl'), array( '$title' => t('Apps'), '$apps' => $apps, )); diff --git a/mod/home.php b/mod/home.php index 05626dcb5..862f6303c 100644 --- a/mod/home.php +++ b/mod/home.php @@ -12,9 +12,11 @@ function home_init(&$a) { $channel = $a->get_channel(); if(local_user() && $channel && $channel['xchan_url']) { - $dest = get_pconfig(local_user(),'system','startpage'); + $dest = $channel['channel_startpage']; if(! $dest) - $dest = z_root() . '/network'; + $dest = get_pconfig(local_user(),'system','startpage'); + if(! $dest) + $dest = z_root() . '/apps'; goaway($dest); } |