From fc0967b84b5e1301c0ce3a9a41c00985ce16bc82 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 20 May 2014 18:08:49 -0700 Subject: most of the remaining apps basic infrastructure except a form to create the things. Don't let this fool you - there is still a lot of work, but there isn't a whole lot of work to create a demo; in fact you can demo it now. --- mod/appman.php | 26 ++++++++++++++++++++++++++ mod/apps.php | 26 ++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 mod/appman.php (limited to 'mod') diff --git a/mod/appman.php b/mod/appman.php new file mode 100644 index 000000000..48389a637 --- /dev/null +++ b/mod/appman.php @@ -0,0 +1,26 @@ + 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, )); -- cgit v1.2.3 From cad481d94fb8cfb350e931620c788f1a2a47a994 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 20 May 2014 21:22:19 -0700 Subject: unfinished work for creating app --- mod/appman.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'mod') diff --git a/mod/appman.php b/mod/appman.php index 48389a637..4fc247a42 100644 --- a/mod/appman.php +++ b/mod/appman.php @@ -22,5 +22,49 @@ function appman_post(&$a) { app_destroy(local_user(),$papp); } + 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; + } + + $channel = $a->get_channel(); + $app = 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]; + } + + return replace_macros(get_markup_template('app_create.tpl'), array( + + '$banner' => 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'] : ''), ''), + '$submit' => t('Submit') + )); + } \ No newline at end of file -- cgit v1.2.3 From 5d9f924642872e30c83ac0de4807e0beb2c15011 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 20 May 2014 22:25:36 -0700 Subject: more app work --- mod/appman.php | 60 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 18 deletions(-) (limited to 'mod') diff --git a/mod/appman.php b/mod/appman.php index 4fc247a42..6570e2fd9 100644 --- a/mod/appman.php +++ b/mod/appman.php @@ -7,6 +7,28 @@ 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(),$app)) + info( t('App installed.') . EOL); + return; + } + + $papp = app_decode($_POST['papp']); if(! is_array($papp)) { @@ -39,7 +61,7 @@ function appman_content(&$a) { $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']), @@ -47,24 +69,26 @@ function appman_content(&$a) { ); 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' => 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'] : ''), ''), - '$submit' => t('Submit') - )); - + return replace_macros(get_markup_template('app_create.tpl'), array( + + '$banner' => 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 -- cgit v1.2.3 From 9365b7f632e06183946c78c8a70de95f36f3fef3 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 20 May 2014 22:45:56 -0700 Subject: this is why I didn't see the "app installed" message.... --- mod/appman.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/appman.php b/mod/appman.php index 6570e2fd9..6d5127b51 100644 --- a/mod/appman.php +++ b/mod/appman.php @@ -23,7 +23,7 @@ function appman_post(&$a) { ); $_REQUEST['appid'] = app_install(local_user(),$arr); - if(app_installed(local_user(),$app)) + if(app_installed(local_user(),$arr)) info( t('App installed.') . EOL); return; } -- cgit v1.2.3 From 77ca117218382b57e2d0590466d9fc38dc016e80 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 21 May 2014 01:55:32 -0700 Subject: make it possible to edit/delete apps via /apps/personal/edit --- mod/apps.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mod') diff --git a/mod/apps.php b/mod/apps.php index aeedb5cda..34bbc7142 100644 --- a/mod/apps.php +++ b/mod/apps.php @@ -27,8 +27,11 @@ function apps_content(&$a) { $apps = array(); $list = app_list(local_user()); if($list) { - foreach($list as $app) + foreach($list as $app) { + if($mode == 'edit') + $app['alt_url'] = z_root() . '/appman/?f=&appid=' . $app['app_id']; $apps[] = app_render(app_encode($app),$mode); + } } return replace_macros(get_markup_template('myapps.tpl'), array( -- cgit v1.2.3 From 751fda97045ad4e399e9a01cc14d8eb058b361a8 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 21 May 2014 20:54:09 -0700 Subject: more app work --- mod/appman.php | 8 ++++++-- mod/apps.php | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/appman.php b/mod/appman.php index 6d5127b51..15f27676c 100644 --- a/mod/appman.php +++ b/mod/appman.php @@ -44,6 +44,10 @@ function appman_post(&$a) { app_destroy(local_user(),$papp); } + if($_POST['edit']) { + return; + } + if($_SESSION['return_url']) goaway(z_root() . '/' . $_SESSION['return_url']); goaway(z_root() . '/apps/personal'); @@ -58,7 +62,7 @@ function appman_content(&$a) { notice( t('Permission denied.') . EOL); return; } - +logger('content'); $channel = $a->get_channel(); $app = null; $embed = null; @@ -75,7 +79,7 @@ function appman_content(&$a) { return replace_macros(get_markup_template('app_create.tpl'), array( - '$banner' => t('Create App'), + '$banner' => (($app) ? t('Edit App') : t('Create App')), '$app' => $app, '$guid' => (($app) ? $app['app_id'] : ''), '$author' => (($app) ? $app['app_author'] : $channel['channel_hash']), diff --git a/mod/apps.php b/mod/apps.php index 34bbc7142..e88c54c66 100644 --- a/mod/apps.php +++ b/mod/apps.php @@ -28,8 +28,6 @@ function apps_content(&$a) { $list = app_list(local_user()); if($list) { foreach($list as $app) { - if($mode == 'edit') - $app['alt_url'] = z_root() . '/appman/?f=&appid=' . $app['app_id']; $apps[] = app_render(app_encode($app),$mode); } } -- cgit v1.2.3 From 71a4abe293c12bed82f18a8118c7d0530009d369 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 21 May 2014 21:33:31 -0700 Subject: Time to flip the switch. --- mod/home.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mod') 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); } -- cgit v1.2.3