aboutsummaryrefslogtreecommitdiffstats
path: root/include/apps.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/apps.php')
-rw-r--r--include/apps.php53
1 files changed, 42 insertions, 11 deletions
diff --git a/include/apps.php b/include/apps.php
index 504641102..0a62dc5a8 100644
--- a/include/apps.php
+++ b/include/apps.php
@@ -130,7 +130,7 @@ function translate_system_apps(&$arr) {
'Address Book' => t('Address Book'),
'Login' => t('Login'),
'Channel Manager' => t('Channel Manager'),
- 'Matrix' => t('Matrix'),
+ 'Grid' => t('Grid'),
'Settings' => t('Settings'),
'Files' => t('Files'),
'Webpages' => t('Webpages'),
@@ -176,14 +176,19 @@ function app_render($papp,$mode = 'view') {
$installed = false;
- if(! $papp['photo'])
- $papp['photo'] = z_root() . '/' . get_default_profile_photo(80);
-
if(! $papp)
return;
+ if(! $papp['photo'])
+ $papp['photo'] = z_root() . '/' . get_default_profile_photo(80);
+
+
+
$papp['papp'] = papp_encode($papp);
+ if(! strstr($papp['url'],'://'))
+ $papp['url'] = z_root() . ((strpos($papp['url'],'/') === 0) ? '' : '/') . $papp['url'];
+
foreach($papp as $k => $v) {
if(strpos($v,'http') === 0 && $k != 'papp')
$papp[$k] = zid($v);
@@ -264,18 +269,37 @@ function app_install($uid,$app) {
else
$x = app_store($app);
- if($x['success'])
- return $x['app_id'];
+ if($x['success']) {
+ $r = q("select * from app where app_id = '%s' and app_channel = %d limit 1",
+ dbesc($x['app_id']),
+ intval($uid)
+ );
+ if($r)
+ build_sync_packet($uid,array('app' => $r[0]));
+ return $x['app_id'];
+ }
return false;
}
function app_destroy($uid,$app) {
+
+
if($uid && $app['guid']) {
+
+ $x = q("select * from app where app_id = '%s' and app_channel = %d limit 1",
+ dbesc($app['guid']),
+ intval($uid)
+ );
+ $x[0]['app_deleted'] = 1;
+
+
$r = q("delete from app where app_id = '%s' and app_channel = %d",
dbesc($app['guid']),
intval($uid)
);
+
+ build_sync_packet($uid,array('app' => $x));
}
}
@@ -325,7 +349,7 @@ function app_store($arr) {
return $ret;
if($arr['photo'] && ! strstr($arr['photo'],z_root())) {
- $x = import_profile_photo($arr['photo'],get_observer_hash(),true);
+ $x = import_xchan_photo($arr['photo'],get_observer_hash(),true);
$arr['photo'] = $x[1];
}
@@ -342,7 +366,9 @@ function app_store($arr) {
$darray['app_page'] = ((x($arr,'page')) ? escape_tags($arr['page']) : '');
$darray['app_requires'] = ((x($arr,'requires')) ? escape_tags($arr['requires']) : '');
- $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, app_requires ) values ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
+ $created = datetime_convert();
+
+ $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, app_requires, app_created, app_edited ) values ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s' )",
dbesc($darray['app_id']),
dbesc($darray['app_sig']),
dbesc($darray['app_author']),
@@ -355,7 +381,9 @@ function app_store($arr) {
dbesc($darray['app_addr']),
dbesc($darray['app_price']),
dbesc($darray['app_page']),
- dbesc($darray['app_requires'])
+ dbesc($darray['app_requires']),
+ dbesc($created),
+ dbesc($created)
);
if($r) {
$ret['success'] = true;
@@ -378,7 +406,7 @@ function app_update($arr) {
return $ret;
if($arr['photo'] && ! strstr($arr['photo'],z_root())) {
- $x = import_profile_photo($arr['photo'],get_observer_hash(),true);
+ $x = import_xchan_photo($arr['photo'],get_observer_hash(),true);
$arr['photo'] = $x[1];
}
@@ -393,7 +421,9 @@ function app_update($arr) {
$darray['app_page'] = ((x($arr,'page')) ? escape_tags($arr['page']) : '');
$darray['app_requires'] = ((x($arr,'requires')) ? escape_tags($arr['requires']) : '');
- $r = q("update app set app_sig = '%s', app_author = '%s', app_name = '%s', app_desc = '%s', app_url = '%s', app_photo = '%s', app_version = '%s', app_addr = '%s', app_price = '%s', app_page = '%s', app_requires = '%s' where app_id = '%s' and app_channel = %d",
+ $edited = datetime_convert();
+
+ $r = q("update app set app_sig = '%s', app_author = '%s', app_name = '%s', app_desc = '%s', app_url = '%s', app_photo = '%s', app_version = '%s', app_addr = '%s', app_price = '%s', app_page = '%s', app_requires = '%s', app_edited = '%s' where app_id = '%s' and app_channel = %d",
dbesc($darray['app_sig']),
dbesc($darray['app_author']),
dbesc($darray['app_name']),
@@ -405,6 +435,7 @@ function app_update($arr) {
dbesc($darray['app_price']),
dbesc($darray['app_page']),
dbesc($darray['app_requires']),
+ dbesc($edited),
dbesc($darray['app_id']),
intval($darray['app_channel'])
);