Ejemplo n.º 1
0
 function get()
 {
     if (!local_channel()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $channel = \App::get_channel();
     $app = null;
     $embed = null;
     if ($_REQUEST['appid']) {
         $r = q("select * from app where app_id = '%s' and app_channel = %d limit 1", dbesc($_REQUEST['appid']), dbesc(local_channel()));
         if ($r) {
             $app = $r[0];
             $term = q("select * from term where otype = %d and oid = %d", intval(TERM_OBJ_APP), intval($r[0]['id']));
             if ($term) {
                 $app['categories'] = '';
                 foreach ($term as $t) {
                     if ($app['categories']) {
                         $app['categories'] .= ',';
                     }
                     $app['categories'] .= $t['term'];
                 }
             }
         }
         $embed = array('embed', t('Embed code'), app_encode($app, true), '', 'onclick="this.select();"');
     }
     return replace_macros(get_markup_template('app_create.tpl'), array('$banner' => $app ? t('Edit App') : 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_photo'] : '', t('80 x 80 pixels - optional')), '$categories' => array('categories', t('Categories (optional, comma separated list)'), $app ? $app['categories'] : '', ''), '$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'] : '', ''), '$system' => $app ? intval($app['app_system']) : 0, '$requires' => $app ? $app['app_requires'] : '', '$embed' => $embed, '$submit' => t('Submit')));
 }
Ejemplo n.º 2
0
 function get()
 {
     if (argc() == 2 && argv(1) == 'edit') {
         $mode = 'edit';
     } else {
         $mode = 'list';
     }
     $_SESSION['return_url'] = \App::$cmd;
     $apps = array();
     if (local_channel()) {
         import_system_apps();
         $syslist = array();
         $list = app_list(local_channel(), false, $_GET['cat']);
         if ($list) {
             foreach ($list as $x) {
                 $syslist[] = app_encode($x);
             }
         }
         translate_system_apps($syslist);
     } else {
         $syslist = get_system_apps(true);
     }
     usort($syslist, 'app_name_compare');
     //	logger('apps: ' . print_r($syslist,true));
     foreach ($syslist as $app) {
         $apps[] = app_render($app, $mode);
     }
     return replace_macros(get_markup_template('myapps.tpl'), array('$sitename' => get_config('system', 'sitename'), '$cat' => array_key_exists('cat', $_GET) && $_GET['cat'] ? ' - ' . escape_tags($_GET['cat']) : '', '$title' => t('Apps'), '$apps' => $apps));
 }
Ejemplo n.º 3
0
function apps_content(&$a)
{
    if (argc() == 2 && argv(1) == 'edit') {
        $mode = 'edit';
    } else {
        $mode = 'list';
    }
    $_SESSION['return_url'] = $a->cmd;
    $apps = array();
    $syslist = get_system_apps();
    if (local_channel()) {
        $list = app_list(local_channel());
        if ($list) {
            foreach ($list as $x) {
                $syslist[] = app_encode($x);
            }
        }
    }
    usort($syslist, 'app_name_compare');
    //	logger('apps: ' . print_r($syslist,true));
    foreach ($syslist as $app) {
        $apps[] = app_render($app, $mode);
    }
    return replace_macros(get_markup_template('myapps.tpl'), array('$sitename' => get_config('system', 'sitename'), '$title' => t('Apps'), '$apps' => $apps));
}
Ejemplo n.º 4
0
Archivo: appman.php Proyecto: Mauru/red
function appman_content(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $channel = $a->get_channel();
    $app = null;
    $embed = 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];
        }
        $embed = array('embed', t('Embed code'), app_encode($app, true), '', 'onclick="this.select();"');
    }
    return replace_macros(get_markup_template('app_create.tpl'), array('$banner' => $app ? t('Edit App') : 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_photo'] : '', 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'] : '', ''), '$embed' => $embed, '$submit' => t('Submit')));
}