aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mod/appman.php44
-rw-r--r--view/tpl/app_create.tpl26
2 files changed, 70 insertions, 0 deletions
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
diff --git a/view/tpl/app_create.tpl b/view/tpl/app_create.tpl
new file mode 100644
index 000000000..540effe75
--- /dev/null
+++ b/view/tpl/app_create.tpl
@@ -0,0 +1,26 @@
+<h2>{{$banner}}</h2>
+
+
+<form action="appman" method="post">
+{{if $guid}}
+<input type="hidden" name="guid" value="{{$guid}}" />
+{{/if}}
+{{if $author}}
+<input type="hidden" name="author" value="{{$author}}" />
+{{/if}}
+{{if $addr}}
+<input type="hidden" name="addr" value="{{$addr}}" />
+{{/if}}
+
+{{include file="field_input.tpl" field=$name}}
+{{include file="field_input.tpl" field=$url}}
+{{include file="field_input.tpl" field=$desc}}
+{{include file="field_input.tpl" field=$photo}}
+{{include file="field_input.tpl" field=$version}}
+{{include file="field_input.tpl" field=$price}}
+{{include file="field_input.tpl" field=$page}}
+
+<input type="submit" name="submit" value="{{$submit}}" />
+
+</form>
+