예제 #1
0
 function post()
 {
     if (!local_channel()) {
         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']), 'requires' => escape_tags($_REQUEST['requires']), 'system' => intval($_REQUEST['system']), 'sig' => escape_tags($_REQUEST['sig']), 'categories' => escape_tags($_REQUEST['categories']));
         $_REQUEST['appid'] = Zlib\Apps::app_install(local_channel(), $arr);
         if (Zlib\Apps::app_installed(local_channel(), $arr)) {
             info(t('App installed.') . EOL);
         }
         return;
     }
     $papp = Zlib\Apps::app_decode($_POST['papp']);
     if (!is_array($papp)) {
         notice(t('Malformed app.') . EOL);
         return;
     }
     if ($_POST['install']) {
         Zlib\Apps::app_install(local_channel(), $papp);
         if (Zlib\Apps::app_installed(local_channel(), $papp)) {
             info(t('App installed.') . EOL);
         }
     }
     if ($_POST['delete']) {
         Zlib\Apps::app_destroy(local_channel(), $papp);
     }
     if ($_POST['edit']) {
         return;
     }
     if ($_SESSION['return_url']) {
         goaway(z_root() . '/' . $_SESSION['return_url']);
     }
     goaway(z_root() . '/apps');
 }