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 (app_installed(local_user(), $papp)) { info(t('App installed.') . EOL); } } 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 app_install($uid, $app) { $app['uid'] = $uid; if (app_installed($uid, $app)) { $x = app_update($app); } else { $x = app_store($app); } if ($x['success']) { return $x['app_id']; } return false; }
function app_install($uid, $app) { $app['uid'] = $uid; if (app_installed($uid, $app)) { $x = app_update($app); } else { $x = app_store($app); } 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_install($uid, $app) { $app['uid'] = $uid; if (app_installed($uid, $app)) { $x = app_update($app); } else { $x = app_store($app); } 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) { if (!$r[0]['app_system']) { if ($app['categories'] && !$app['term']) { $r[0]['term'] = q("select * from term where otype = %d and oid = d", intval(TERM_OBJ_APP), intval($r[0]['id'])); build_sync_packet($uid, array('app' => $r[0])); } } } return $x['app_id']; } return false; }