diff options
author | friendica <info@friendica.com> | 2014-05-18 18:21:20 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-05-18 18:21:20 -0700 |
commit | 466fe725bc056ad7ed2c3bf24783b65565293472 (patch) | |
tree | 89fa59a2450ed62ce390110b56dca091169b7c60 | |
parent | 68ca4ef19e0617904d8557e95ec74d09af833d00 (diff) | |
download | volse-hubzilla-466fe725bc056ad7ed2c3bf24783b65565293472.tar.gz volse-hubzilla-466fe725bc056ad7ed2c3bf24783b65565293472.tar.bz2 volse-hubzilla-466fe725bc056ad7ed2c3bf24783b65565293472.zip |
start to build out the apps
-rw-r--r-- | include/apps.php | 62 | ||||
-rw-r--r-- | include/bbcode.php | 14 |
2 files changed, 70 insertions, 6 deletions
diff --git a/include/apps.php b/include/apps.php index 09aee0389..ac6f34ee5 100644 --- a/include/apps.php +++ b/include/apps.php @@ -119,10 +119,8 @@ function translate_system_apps(&$arr) { } function app_render($app) { - - - - +//debugging + return print_r($app,true); } @@ -177,8 +175,11 @@ function app_store($arr) { $darray['app_desc'] = ((x($arr,'desc')) ? escape_tags($arr['desc']) : ''); $darray['app_photo'] = ((x($arr,'photo')) ? $arr['photo'] : z_root() . '/' . get_default_profile_photo(80)); $darray['app_version'] = ((x($arr,'version')) ? escape_tags($arr['version']) : ''); + $darray['app_addr'] = ((x($arr,'addr')) ? escape_tags($arr['addr']) : ''); + $darray['app_price'] = ((x($arr,'price')) ? escape_tags($arr['price']) : ''); + $darray['app_page'] = ((x($arr,'page')) ? escape_tags($arr['page']) : ''); - $r = q("insert into app ( app_id, app_sig, app_author, app_name, app_desc, app_url, app_photo, app_version, app_channel) values ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d )", + $r = q("insert into app ( app_id, app_sig, app_author, app_name, app_desc, app_url, app_photo, app_version, app_channel, app_addr, app_price, app_page ) values ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s' )", dbesc($darray['app_id']), dbesc($darray['app_sig']), dbesc($darray['app_author']), @@ -187,7 +188,10 @@ function app_store($arr) { dbesc($darray['app_url']), dbesc($darray['app_photo']), dbesc($darray['app_version']), - intval($darray['app_channel']) + intval($darray['app_channel']), + dbesc($darray['app_addr']), + dbesc($darray['app_price']), + dbesc($darray['app_page']) ); if($r) $ret['success'] = true; @@ -201,4 +205,50 @@ function app_update($arr) { +} + + +function app_encode($app) { + + $ret = array(); + + if($app['app_id']) + $ret['guid'] = $app['app_id']; + + if($app['app_id']) + $ret['guid'] = $app['app_id']; + + if($app['app_sig']) + $ret['sig'] = $app['app_sig']; + + if($app['app_author']) + $ret['author'] = $app['app_author']; + + if($app['app_name']) + $ret['name'] = $app['app_name']; + + if($app['app_desc']) + $ret['desc'] = $app['app_desc']; + + if($app['app_url']) + $ret['url'] = $app['app_url']; + + if($app['app_photo']) + $ret['photo'] = $app['app_photo']; + + if($app['app_version']) + $ret['version'] = $app['app_version']; + + if($app['app_addr']) + $ret['addr'] = $app['app_addr']; + + if($app['app_price']) + $ret['price'] = $app['app_price']; + + if($app['app_page']) + $ret['page'] = $app['app_page']; + + $j = json_encode($ret); + return '[app]' . base64_encode($j) . '[/app]'; + }
\ No newline at end of file diff --git a/include/bbcode.php b/include/bbcode.php index a4e7560d6..674b5f45a 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -166,6 +166,15 @@ function bb_parse_crypt($match) { } +function bb_parse_app($match) { + require_once('include/apps.php'); + + $app = app_decode($match[1]); + if($app) + return app_render($app); + +} + function bb_qr($match) { return '<img class="zrl" src="' . z_root() . '/photo/qr?f=&qr=' . urlencode($match[1]) . '" alt="' . t('QR code') . '" title="' . htmlspecialchars($match[1],ENT_QUOTES,'UTF-8') . '" />'; } @@ -684,6 +693,11 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true) { $Text = preg_replace_callback("/\[crypt (.*?)\](.*?)\[\/crypt\]/ism", 'bb_parse_crypt', $Text); } + if(strpos($Text,'[/app]') !== false) { + $Text = preg_replace_callback("/\[app\](.*?)\[\/app\]/ism",'bb_parse_app', $Text); + } + + // html5 video and audio if (strpos($Text,'[/video]') !== false) { $Text = preg_replace_callback("/\[video\](.*?\.(ogg|ogv|oga|ogm|webm|mp4))\[\/video\]/ism", 'tryzrlvideo', $Text); |