示例#1
0
 function get()
 {
     if (!local_channel()) {
         return;
     }
     $postid = $_REQUEST['postid'];
     if (!$postid) {
         return;
     }
     $emoji = $_REQUEST['emoji'];
     if ($_REQUEST['emoji']) {
         $i = q("select * from item where id = %d and uid = %d", intval($postid), intval(local_channel()));
         if (!$i) {
             return;
         }
         $channel = \App::get_channel();
         $n = array();
         $n['aid'] = $channel['channel_account_id'];
         $n['uid'] = $channel['channel_id'];
         $n['item_origin'] = true;
         $n['parent'] = $postid;
         $n['parent_mid'] = $i[0]['mid'];
         $n['mid'] = item_message_id();
         $n['verb'] = ACTIVITY_REACT . '#' . $emoji;
         $n['body'] = "\n\n[zmg=32x32]" . z_root() . '/images/emoji/' . $emoji . '.png[/zmg]' . "\n\n";
         $n['author_xchan'] = $channel['channel_hash'];
         $x = item_store($n);
         if ($x['success']) {
             $nid = $x['item_id'];
             \Zotlabs\Daemon\Master::Summon(array('Notifier', 'like', $nid));
         }
     }
 }
示例#2
0
function uexport_init(&$a)
{
    if (!local_channel()) {
        killme();
    }
    if (argc() > 1) {
        $channel = App::get_channel();
        require_once 'include/identity.php';
        if (argc() > 1 && intval(argv(1)) > 1900) {
            $year = intval(argv(1));
        }
        if (argc() > 2 && intval(argv(2)) > 0 && intval(argv(2)) <= 12) {
            $month = intval(argv(2));
        }
        header('content-type: application/octet_stream');
        header('content-disposition: attachment; filename="' . $channel['channel_address'] . ($year ? '-' . $year : '') . ($month ? '-' . $month : '') . '.json"');
        if ($year) {
            echo json_encode(identity_export_year(local_channel(), $year, $month));
            killme();
        }
        if (argc() > 1 && argv(1) === 'basic') {
            echo json_encode(identity_basic_export(local_channel()));
            killme();
        }
        // FIXME - this basically doesn't work in the wild with a channel more than a few months old due to memory and execution time limits.
        // It probably needs to be built at the CLI and offered to download as a tarball.  Maybe stored in the members dav.
        if (argc() > 1 && argv(1) === 'complete') {
            echo json_encode(identity_basic_export(local_channel(), true));
            killme();
        }
    }
}
示例#3
0
 function get()
 {
     $o .= '<h3>Probe Diagnostic</h3>';
     $o .= '<form action="probe" method="get">';
     $o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] . '" />';
     $o .= '<input type="submit" name="submit" value="Submit" /></form>';
     $o .= '<br /><br />';
     if (x($_GET, 'addr')) {
         $channel = \App::get_channel();
         $addr = trim($_GET['addr']);
         $do_import = intval($_GET['import']) && is_site_admin() ? true : false;
         $j = \Zotlabs\Zot\Finger::run($addr, $channel, false);
         //			$res = zot_finger($addr,$channel,false);
         $o .= '<pre>';
         if (!$j['success']) {
             $o .= sprintf(t('Fetching URL returns error: %1$s'), $res['error'] . "\r\n\r\n");
             $o .= "<strong>https connection failed. Trying again with auto failover to http.</strong>\r\n\r\n";
             $j = \Zotlabs\Zot\Finger::run($addr, $channel, true);
             if (!$j['success']) {
                 $o .= sprintf(t('Fetching URL returns error: %1$s'), $res['error'] . "\r\n\r\n");
             }
         }
         if ($do_import && $j) {
             $x = import_xchan($j);
         }
         if ($j && $j['permissions'] && $j['permissions']['iv']) {
             $j['permissions'] = json_decode(crypto_unencapsulate($j['permissions'], $channel['channel_prvkey']), true);
         }
         $o .= str_replace("\n", '<br />', print_r($j, true));
         $o .= '</pre>';
     }
     return $o;
 }
示例#4
0
 function get()
 {
     if (!local_channel()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     //	if(! \App::$data['target']) {
     //		notice( t('No recipients.') . EOL);
     //		return;
     //	}
     $rating_enabled = get_config('system', 'rating_enabled');
     if (!$rating_enabled) {
         notice('Ratings are disabled on this site.');
         return;
     }
     $channel = \App::get_channel();
     $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1", dbesc($channel['channel_hash']), dbesc(\App::$data['target']));
     if ($r) {
         \App::$data['xlink'] = $r[0];
         $rating_val = $r[0]['xlink_rating'];
         $rating_text = $r[0]['xlink_rating_text'];
     } else {
         $rating_val = 0;
         $rating_text = '';
     }
     if ($rating_enabled) {
         $rating = replace_macros(get_markup_template('rating_slider.tpl'), array('$min' => -10, '$val' => $rating_val));
     } else {
         $rating = false;
     }
     $o = replace_macros(get_markup_template('rating_form.tpl'), array('$header' => t('Rating'), '$website' => t('Website:'), '$site' => \App::$data['site'] ? '<a href="' . \App::$data['site']['site_url'] . '" >' . \App::$data['site']['site_url'] . '</a>' : '', 'target' => \App::$data['target'], '$tgt_name' => \App::$poi && \App::$poi['xchan_name'] ? \App::$poi['xchan_name'] : sprintf(t('Remote Channel [%s] (not yet known on this site)'), substr(\App::$data['target'], 0, 16)), '$lbl_rating' => t('Rating (this information is public)'), '$lbl_rating_txt' => t('Optionally explain your rating (this information is public)'), '$rating_txt' => $rating_text, '$rating' => $rating, '$rating_val' => $rating_val, '$slide' => $slide, '$submit' => t('Submit')));
     return $o;
 }
示例#5
0
function bookmarks_content(&$a)
{
    if (!local_channel()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    require_once 'include/menu.php';
    require_once 'include/conversation.php';
    $channel = App::get_channel();
    $o = profile_tabs($a, true, $channel['channel_address']);
    $o .= '<div class="generic-content-wrapper-styled">';
    $o .= '<h3>' . t('My Bookmarks') . '</h3>';
    $x = menu_list(local_channel(), '', MENU_BOOKMARK);
    if ($x) {
        foreach ($x as $xx) {
            $y = menu_fetch($xx['menu_name'], local_channel(), get_observer_hash());
            $o .= menu_render($y, '', true);
        }
    }
    $o .= '<h3>' . t('My Connections Bookmarks') . '</h3>';
    $x = menu_list(local_channel(), '', MENU_SYSTEM | MENU_BOOKMARK);
    if ($x) {
        foreach ($x as $xx) {
            $y = menu_fetch($xx['menu_name'], local_channel(), get_observer_hash());
            $o .= menu_render($y, '', true);
        }
    }
    $o .= '</div>';
    return $o;
}
示例#6
0
function redred_settings_post($a, $post)
{
    if (!local_channel()) {
        return;
    }
    // don't check redred settings if redred submit button is not clicked
    if (!x($_POST, 'redred-submit')) {
        return;
    }
    $channel = App::get_channel();
    // Don't let somebody post to their self channel. Since we aren't passing message-id this would be very very bad.
    if (!trim($_POST['redred_channel'])) {
        notice(t('Channel is required.') . EOL);
        return;
    }
    if ($channel['channel_address'] === trim($_POST['redred_channel'])) {
        notice(t('Invalid channel.') . EOL);
        return;
    }
    set_pconfig(local_channel(), 'redred', 'baseapi', trim($_POST['redred_baseapi']));
    set_pconfig(local_channel(), 'redred', 'username', trim($_POST['redred_username']));
    set_pconfig(local_channel(), 'redred', 'password', z_obscure(trim($_POST['redred_password'])));
    set_pconfig(local_channel(), 'redred', 'channel', trim($_POST['redred_channel']));
    set_pconfig(local_channel(), 'redred', 'post', intval($_POST['redred_enable']));
    set_pconfig(local_channel(), 'redred', 'post_by_default', intval($_POST['redred_default']));
    info(t('redred Settings saved.') . EOL);
}
示例#7
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')));
 }
示例#8
0
 function init()
 {
     if (argc() > 1) {
         $which = argv(1);
     } else {
         notice(t('Requested profile is not available.') . EOL);
         \App::$error = 404;
         return;
     }
     $profile = '';
     $channel = \App::get_channel();
     if (local_channel() && argc() > 2 && argv(2) === 'view') {
         $which = $channel['channel_address'];
         $profile = argv(1);
         $r = q("select profile_guid from profile where id = %d and uid = %d limit 1", intval($profile), intval(local_channel()));
         if (!$r) {
             $profile = '';
         }
         $profile = $r[0]['profile_guid'];
     }
     \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n";
     if (!$profile) {
         $x = q("select channel_id as profile_uid from channel where channel_address = '%s' limit 1", dbesc(argv(1)));
         if ($x) {
             \App::$profile = $x[0];
         }
     }
     profile_load($a, $which, $profile);
 }
示例#9
0
 function init()
 {
     $ret = array();
     call_hooks('home_init', $ret);
     $splash = argc() > 1 && argv(1) === 'splash' ? true : false;
     $channel = \App::get_channel();
     if (local_channel() && $channel && $channel['xchan_url'] && !$splash) {
         $dest = $channel['channel_startpage'];
         if (!$dest) {
             $dest = get_pconfig(local_channel(), 'system', 'startpage');
         }
         if (!$dest) {
             $dest = get_config('system', 'startpage');
         }
         if (!$dest) {
             $dest = z_root() . '/network';
         }
         goaway($dest);
     }
     if (remote_channel() && !$splash && $_SESSION['atoken']) {
         $r = q("select * from atoken where atoken_id = %d", intval($_SESSION['atoken']));
         if ($r) {
             $x = channelx_by_n($r[0]['atoken_uid']);
             if ($x) {
                 goaway(z_root() . '/channel/' . $x['channel_address']);
             }
         }
     }
     if (get_account_id() && !$splash) {
         goaway(z_root() . '/new_channel');
     }
 }
示例#10
0
function likebanner_content(&$a)
{
    if (local_channel()) {
        $channel = App::get_channel();
    } else {
        $channel = null;
    }
    $o = '<h1>Like Banner</h1>';
    $def = $_REQUEST['addr'];
    if ($channel && !$def) {
        $def = $channel['xchan_addr'];
    }
    $o .= '<form action="likebanner" method="get" >';
    $o .= t('Your Webbie:');
    $o .= '<br /><br />';
    $o .= '<input type="text" name="addr" size="32" value="' . $def . '" />';
    $o .= '<br /><br />' . t('Fontsize (px):');
    $o .= '<br /><br />';
    $o .= '<input type="text" name="size" size="32" value="' . ($_REQUEST['size'] ? $_REQUEST['size'] : 28) . '" /><br /><br />';
    $o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form><br /><br/>';
    if ($_REQUEST['addr']) {
        $o .= '<img style="border: 1px solid #000;" src="likebanner/show/?f=&addr=' . urlencode($_REQUEST['addr']) . '&size=' . $_REQUEST['size'] . '" alt="banner" />';
        if ($channel) {
            $p = q("select profile_guid from profile where uid = %d and is_default = 1 limit 1", intval($channel['channel_id']));
            if ($p) {
                $link = z_root() . '/like/profile/' . $p[0]['profile_guid'] . '?f=&verb=like&interactive=1';
                $o .= EOL . EOL . t('Link:') . EOL . '<input type="text" size="64" onclick="this.select();" value="' . $link . '" />';
                $html = '<a href="' . $link . '" ><img src="' . z_root() . '/likebanner?f=&addr=' . $def . '&size=' . $_REQUEST['size'] . '" alt="' . t('Like us on Hubzilla') . '" /></a>';
                $o .= EOL . EOL . t('Embed:') . EOL . '<input type="text" size="64" onclick="this.select();" value="' . htmlspecialchars($html, ENT_QUOTES, 'UTF-8') . '" />';
            }
        }
    }
    return $o;
}
示例#11
0
 function get()
 {
     if (!\App::$profile) {
         notice(t('Requested profile is not available.') . EOL);
         \App::$error = 404;
         return;
     }
     $which = argv(1);
     $uid = local_channel();
     $owner = 0;
     $channel = null;
     $observer = \App::get_observer();
     $channel = \App::get_channel();
     if (\App::$is_sys && is_site_admin()) {
         $sys = get_sys_channel();
         if ($sys && intval($sys['channel_id'])) {
             $uid = $owner = intval($sys['channel_id']);
             $channel = $sys;
             $observer = $sys;
         }
     }
     if (!$owner) {
         // Figure out who the page owner is.
         $r = q("select channel_id from channel where channel_address = '%s'", dbesc($which));
         if ($r) {
             $owner = intval($r[0]['channel_id']);
         }
     }
     $ob_hash = $observer ? $observer['xchan_hash'] : '';
     if (!perm_is_allowed($owner, $ob_hash, 'write_pages')) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $is_owner = $uid && $uid == $owner ? true : false;
     $o = '';
     // Figure out which post we're editing
     $post_id = argc() > 2 ? intval(argv(2)) : 0;
     if (!$post_id) {
         notice(t('Item not found') . EOL);
         return;
     }
     // Now we've got a post and an owner, let's find out if we're allowed to edit it
     $ob_hash = $observer ? $observer['xchan_hash'] : '';
     $perms = get_all_perms($owner, $ob_hash);
     if (!$perms['write_pages']) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1", intval($post_id), intval($owner));
     $item_id = q("select * from item_id where service = 'PDL' and iid = %d limit 1", intval($itm[0]['id']));
     if ($item_id) {
         $layout_title = $item_id[0]['sid'];
     }
     $rp = 'layouts/' . $which;
     $x = array('webpage' => ITEM_TYPE_PDL, 'nickname' => $channel['channel_address'], 'editor_autocomplete' => true, 'bbco_autocomplete' => 'comanche', 'return_path' => $rp, 'button' => t('Edit'), 'hide_voting' => true, 'hide_future' => true, 'hide_expire' => true, 'hide_location' => true, 'hide_weblink' => true, 'hide_attach' => true, 'hide_preview' => true, 'ptyp' => $itm[0]['obj_type'], 'body' => undo_post_tagging($itm[0]['body']), 'post_id' => $post_id, 'title' => htmlspecialchars($itm[0]['title'], ENT_COMPAT, 'UTF-8'), 'pagetitle' => $layout_title, 'ptlabel' => t('Layout Name'), 'placeholdertitle' => t('Layout Description (Optional)'), 'showacl' => false, 'profile_uid' => intval($owner));
     $editor = status_editor($a, $x);
     $o .= replace_macros(get_markup_template('edpost_head.tpl'), array('$title' => t('Edit Layout'), '$delete' => $itm[0]['author_xchan'] === $ob_hash || $itm[0]['owner_xchan'] === $ob_hash ? t('Delete') : false, '$id' => $itm[0]['id'], '$editor' => $editor));
     return $o;
 }
示例#12
0
 function init()
 {
     if (!is_dir('store')) {
         os_mkdir('store', STORAGE_DEFAULT_PERMISSIONS, false);
     }
     $which = null;
     if (argc() > 1) {
         $which = argv(1);
     }
     $profile = 0;
     \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n";
     if ($which) {
         profile_load($which, $profile);
     }
     $auth = new \Zotlabs\Storage\BasicAuth();
     $ob_hash = get_observer_hash();
     if ($ob_hash) {
         if (local_channel()) {
             $channel = \App::get_channel();
             $auth->setCurrentUser($channel['channel_address']);
             $auth->channel_id = $channel['channel_id'];
             $auth->channel_hash = $channel['channel_hash'];
             $auth->channel_account_id = $channel['channel_account_id'];
             if ($channel['channel_timezone']) {
                 $auth->setTimezone($channel['channel_timezone']);
             }
         }
         $auth->observer = $ob_hash;
     }
     if ($_GET['davguest']) {
         $_SESSION['davguest'] = true;
     }
     $_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']);
     $_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']);
     $_SERVER['QUERY_STRING'] = preg_replace('/[\\?&]davguest=(.*?)([\\?&]|$)/ism', '', $_SERVER['QUERY_STRING']);
     $_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']);
     $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']);
     $_SERVER['REQUEST_URI'] = preg_replace('/[\\?&]davguest=(.*?)([\\?&]|$)/ism', '', $_SERVER['REQUEST_URI']);
     $rootDirectory = new \Zotlabs\Storage\Directory('/', $auth);
     // A SabreDAV server-object
     $server = new SDAV\Server($rootDirectory);
     // prevent overwriting changes each other with a lock backend
     $lockBackend = new SDAV\Locks\Backend\File('store/[data]/locks');
     $lockPlugin = new SDAV\Locks\Plugin($lockBackend);
     $server->addPlugin($lockPlugin);
     $is_readable = false;
     // provide a directory view for the cloud in Hubzilla
     $browser = new \Zotlabs\Storage\Browser($auth);
     $auth->setBrowserPlugin($browser);
     $server->addPlugin($browser);
     // Experimental QuotaPlugin
     //	require_once('\Zotlabs\Storage/QuotaPlugin.php');
     //	$server->addPlugin(new \Zotlabs\Storage\\QuotaPlugin($auth));
     ob_start();
     // All we need to do now, is to fire up the server
     $server->exec();
     ob_end_flush();
     killme();
 }
示例#13
0
 function get()
 {
     if (!\App::$profile) {
         notice(t('Requested profile is not available.') . EOL);
         \App::$error = 404;
         return;
     }
     $which = argv(1);
     $uid = local_channel();
     $owner = 0;
     $channel = null;
     $observer = \App::get_observer();
     $channel = \App::get_channel();
     if (\App::$is_sys && is_site_admin()) {
         $sys = get_sys_channel();
         if ($sys && intval($sys['channel_id'])) {
             $uid = $owner = intval($sys['channel_id']);
             $channel = $sys;
             $observer = $sys;
         }
     }
     if (!$owner) {
         // Figure out who the page owner is.
         $r = q("select channel_id from channel where channel_address = '%s'", dbesc($which));
         if ($r) {
             $owner = intval($r[0]['channel_id']);
         }
     }
     $ob_hash = $observer ? $observer['xchan_hash'] : '';
     if (!perm_is_allowed($owner, $ob_hash, 'write_pages')) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $is_owner = $uid && $uid == $owner ? true : false;
     $o = '';
     // Figure out which post we're editing
     $post_id = argc() > 2 ? intval(argv(2)) : 0;
     if (!($post_id && $owner)) {
         notice(t('Item not found') . EOL);
         return;
     }
     $itm = q("SELECT * FROM `item` WHERE `id` = %d and uid = %s LIMIT 1", intval($post_id), intval($owner));
     if ($itm) {
         $item_id = q("select * from item_id where service = 'BUILDBLOCK' and iid = %d limit 1", intval($itm[0]['id']));
         if ($item_id) {
             $block_title = $item_id[0]['sid'];
         }
     } else {
         notice(t('Item not found') . EOL);
         return;
     }
     $mimetype = $itm[0]['mimetype'];
     $rp = 'blocks/' . $channel['channel_address'];
     $x = array('nickname' => $channel['channel_address'], 'bbco_autocomplete' => $mimetype == 'text/bbcode' ? 'bbcode' : 'comanche-block', 'return_path' => $rp, 'webpage' => ITEM_TYPE_BLOCK, 'ptlabel' => t('Block Name'), 'button' => t('Edit'), 'writefiles' => $mimetype == 'text/bbcode' ? perm_is_allowed($owner, get_observer_hash(), 'write_storage') : false, 'weblink' => $mimetype == 'text/bbcode' ? t('Insert web link') : false, 'hide_voting' => true, 'hide_future' => true, 'hide_location' => true, 'hide_expire' => true, 'showacl' => false, 'ptyp' => $itm[0]['type'], 'mimeselect' => true, 'mimetype' => $itm[0]['mimetype'], 'body' => undo_post_tagging($itm[0]['body']), 'post_id' => $post_id, 'visitor' => true, 'title' => htmlspecialchars($itm[0]['title'], ENT_COMPAT, 'UTF-8'), 'placeholdertitle' => t('Title (optional)'), 'pagetitle' => $block_title, 'profile_uid' => intval($channel['channel_id']), 'bbcode' => $mimetype == 'text/bbcode' ? true : false);
     $editor = status_editor($a, $x);
     $o .= replace_macros(get_markup_template('edpost_head.tpl'), array('$title' => t('Edit Block'), '$delete' => $itm[0]['author_xchan'] === $ob_hash || $itm[0]['owner_xchan'] === $ob_hash ? t('Delete') : false, '$id' => $itm[0]['id'], '$editor' => $editor));
     return $o;
 }
示例#14
0
 function get()
 {
     $o = '';
     if (!local_channel()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $post_id = argc() > 1 ? intval(argv(1)) : 0;
     if (!$post_id) {
         notice(t('Item not found') . EOL);
         return;
     }
     $itm = q("SELECT * FROM `item` WHERE `id` = %d AND ( owner_xchan = '%s' OR author_xchan = '%s' ) LIMIT 1", intval($post_id), dbesc(get_observer_hash()), dbesc(get_observer_hash()));
     if (!count($itm)) {
         notice(t('Item is not editable') . EOL);
         return;
     }
     if ($itm[0]['resource_type'] === 'event' && $itm[0]['resource_id']) {
         goaway(z_root() . '/events/' . $itm[0]['resource_id'] . '?expandform=1');
     }
     $owner_uid = $itm[0]['uid'];
     $channel = \App::get_channel();
     if (intval($itm[0]['item_obscured'])) {
         $key = get_config('system', 'prvkey');
         if ($itm[0]['title']) {
             $itm[0]['title'] = crypto_unencapsulate(json_decode_plus($itm[0]['title']), $key);
         }
         if ($itm[0]['body']) {
             $itm[0]['body'] = crypto_unencapsulate(json_decode_plus($itm[0]['body']), $key);
         }
     }
     $category = '';
     $catsenabled = feature_enabled($owner_uid, 'categories') ? 'categories' : '';
     if ($catsenabled) {
         $itm = fetch_post_tags($itm);
         $cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY);
         foreach ($cats as $cat) {
             if (strlen($category)) {
                 $category .= ', ';
             }
             $category .= $cat['term'];
         }
     }
     if ($itm[0]['attach']) {
         $j = json_decode($itm[0]['attach'], true);
         if ($j) {
             foreach ($j as $jj) {
                 $itm[0]['body'] .= "\n" . '[attachment]' . basename($jj['href']) . ',' . $jj['revision'] . '[/attachment]' . "\n";
             }
         }
     }
     $x = array('nickname' => $channel['channel_address'], 'editor_autocomplete' => true, 'bbco_autocomplete' => 'bbcode', 'return_path' => $_SESSION['return_url'], 'button' => t('Edit'), 'hide_voting' => true, 'hide_future' => true, 'hide_location' => true, 'mimetype' => $itm[0]['mimetype'], 'ptyp' => $itm[0]['obj_type'], 'body' => undo_post_tagging($itm[0]['body']), 'post_id' => $post_id, 'defloc' => $channel['channel_location'], 'visitor' => true, 'title' => htmlspecialchars($itm[0]['title'], ENT_COMPAT, 'UTF-8'), 'category' => $category, 'showacl' => false, 'profile_uid' => $owner_uid, 'catsenabled' => $catsenabled, 'hide_expire' => true, 'bbcode' => true);
     $editor = status_editor($a, $x);
     $o .= replace_macros(get_markup_template('edpost_head.tpl'), array('$title' => t('Edit post'), '$editor' => $editor));
     return $o;
 }
示例#15
0
function tasks_post(&$a)
{
    //	logger('post: ' . print_r($_POST,true));
    if (!local_channel()) {
        return;
    }
    $channel = App::get_channel();
    if (argc() > 2 && argv(1) === 'complete' && intval(argv(2))) {
        $ret = array('success' => false);
        $r = q("select * from event where `type` = 'task' and uid = %d and id = %d limit 1", intval(local_channel()), intval(argv(2)));
        if ($r) {
            $event = $r[0];
            if ($event['event_status'] === 'COMPLETED') {
                $event['event_status'] = 'IN-PROCESS';
                $event['event_status_date'] = NULL_DATE;
                $event['event_percent'] = 0;
                $event['event_sequence'] = $event['event_sequence'] + 1;
                $event['edited'] = datetime_convert();
            } else {
                $event['event_status'] = 'COMPLETED';
                $event['event_status_date'] = datetime_convert();
                $event['event_percent'] = 100;
                $event['event_sequence'] = $event['event_sequence'] + 1;
                $event['edited'] = datetime_convert();
            }
            $x = event_store_event($event);
            if ($x) {
                $ret['success'] = true;
            }
        }
        json_return_and_die($ret);
    }
    if (argc() == 2 && argv(1) === 'new') {
        $text = escape_tags(trim($_REQUEST['summary']));
        if (!$text) {
            return array('success' => false);
        }
        $event = array();
        $event['account'] = $channel['channel_account_id'];
        $event['uid'] = $channel['channel_id'];
        $event['event_xchan'] = $channel['channel_hash'];
        $event['type'] = 'task';
        $event['nofinish'] = true;
        $event['created'] = $event['edited'] = $event['start'] = datetime_convert();
        $event['adjust'] = 1;
        $event['allow_cid'] = '<' . $channel['channel_hash'] . '>';
        $event['summary'] = escape_tags($_REQUEST['summary']);
        $x = event_store_event($event);
        if ($x) {
            $x['success'] = true;
        } else {
            $x = array('success' => false);
        }
        json_return_and_die($x);
    }
}
示例#16
0
function connections_init(&$a)
{
    if (!local_channel()) {
        return;
    }
    $channel = App::get_channel();
    if ($channel) {
        head_set_icon($channel['xchan_photo_s']);
    }
}
示例#17
0
 function init()
 {
     if (!local_channel()) {
         return;
     }
     $channel = \App::get_channel();
     $which = $channel['channel_address'];
     $profile = \App::$argv[1];
     profile_load($a, $which, $profile);
 }
示例#18
0
 function init()
 {
     if (!local_channel()) {
         return;
     }
     $channel = \App::get_channel();
     if ($channel) {
         head_set_icon($channel['xchan_photo_s']);
     }
 }
示例#19
0
 function get()
 {
     if (!local_channel()) {
         notice(t('Permission denied.') . EOL);
         return;
     }
     $channel = \App::get_channel();
     $is_owner = local_channel() && local_channel() == $channel['channel_id'];
     //check for updated items and remove them
     require_once 'include/sharedwithme.php';
     apply_updates();
     //drop single file - localuser
     if (argc() > 2 && argv(2) === 'drop') {
         $id = intval(argv(1));
         q("DELETE FROM item WHERE id = %d AND uid = %d", intval($id), intval(local_channel()));
         goaway(z_root() . '/sharedwithme');
     }
     //drop all files - localuser
     if (argc() > 1 && argv(1) === 'dropall') {
         q("DELETE FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d", dbesc(ACTIVITY_POST), dbesc(ACTIVITY_OBJ_FILE), intval(local_channel()));
         goaway(z_root() . '/sharedwithme');
     }
     //list files
     $r = q("SELECT id, uid, object, item_unseen FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d AND owner_xchan != '%s'", dbesc(ACTIVITY_POST), dbesc(ACTIVITY_OBJ_FILE), intval(local_channel()), dbesc($channel['channel_hash']));
     $items = array();
     $ids = '';
     if ($r) {
         foreach ($r as $rr) {
             $object = json_decode($rr['object'], true);
             $item = array();
             $item['id'] = $rr['id'];
             $item['objfiletype'] = $object['filetype'];
             $item['objfiletypeclass'] = getIconFromType($object['filetype']);
             $item['objurl'] = rawurldecode(get_rel_link($object['link'], 'alternate')) . '?f=&zid=' . $channel['xchan_addr'];
             $item['objfilename'] = $object['filename'];
             $item['objfilesize'] = userReadableSize($object['filesize']);
             $item['objedited'] = $object['edited'];
             $item['unseen'] = $rr['item_unseen'];
             $items[] = $item;
             if ($item['unseen'] > 0) {
                 $ids .= " '" . $rr['id'] . "',";
             }
         }
     }
     if ($ids) {
         //remove trailing ,
         $ids = rtrim($ids, ",");
         q("UPDATE item SET item_unseen = 0 WHERE id IN ( {$ids} ) AND uid = %d", intval(local_channel()));
     }
     $o = profile_tabs($a, $is_owner, $channel['channel_address']);
     $o .= replace_macros(get_markup_template('sharedwithme.tpl'), array('$header' => t('Files: shared with me'), '$name' => t('Name'), '$label_new' => t('NEW'), '$size' => t('Size'), '$lastmod' => t('Last Modified'), '$dropall' => t('Remove all files'), '$drop' => t('Remove this file'), '$items' => $items));
     return $o;
 }
示例#20
0
function cdav_feature_settings(&$b)
{
    $channel = App::get_channel();
    $enabled = get_pconfig(local_channel(), 'cdav', 'enabled');
    $sc .= '<div class="settings-block">';
    $sc .= '<div id="cdav-wrapper">';
    $sc .= '<div class="section-content-warning-wrapper">' . t('<strong>WARNING:</strong> Please note that this plugin is in early alpha state and highly experimental. You will likely loose your data at some point!') . '</div>';
    $sc .= replace_macros(get_markup_template('field_checkbox.tpl'), array('$field' => array('cdav_enabled', t('Enable CalDAV/CardDAV Server for this channel'), $enabled, '', array(t('No'), t('Yes')))));
    $sc .= '<div class="descriptive-text">' . sprintf(t('Your CalDAV resources are located at %s '), z_root() . '/cdav/calendars/' . $channel['channel_address']) . '</div>';
    $sc .= '<div class="descriptive-text">' . sprintf(t('Your CardDAV resources are located at %s '), z_root() . '/cdav/addressbooks/' . $channel['channel_address']) . '</div>';
    $sc .= '</div>';
    $b .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array('$addon' => array('cdav', t('CalDAV/CardDAV Settings'), '', t('Submit')), '$content' => $sc));
}
示例#21
0
 function get()
 {
     $uid = local_channel();
     if (\App::$is_sys && is_site_admin()) {
         $sys = get_sys_channel();
         $uid = intval($sys['channel_id']);
     }
     if (!$uid) {
         notice(t('Permission denied.') . EOL);
         return '';
     }
     if (argc() == 1) {
         $channel = $sys ? $sys : \App::get_channel();
         // list menus
         $x = menu_list($uid);
         if ($x) {
             for ($y = 0; $y < count($x); $y++) {
                 $m = menu_fetch($x[$y]['menu_name'], $uid, get_observer_hash());
                 if ($m) {
                     $x[$y]['element'] = '[element]' . base64url_encode(json_encode(menu_element($channel, $m))) . '[/element]';
                 }
                 $x[$y]['bookmark'] = $x[$y]['menu_flags'] & MENU_BOOKMARK ? true : false;
             }
         }
         $create = replace_macros(get_markup_template('menuedit.tpl'), array('$menu_name' => array('menu_name', t('Menu Name'), '', t('Unique name (not visible on webpage) - required'), '*'), '$menu_desc' => array('menu_desc', t('Menu Title'), '', t('Visible on webpage - leave empty for no title'), ''), '$menu_bookmark' => array('menu_bookmark', t('Allow Bookmarks'), 0, t('Menu may be used to store saved bookmarks'), array(t('No'), t('Yes'))), '$submit' => t('Submit and proceed'), '$sys' => \App::$is_sys, '$display' => 'none'));
         $o = replace_macros(get_markup_template('menulist.tpl'), array('$title' => t('Menus'), '$create' => $create, '$menus' => $x, '$nametitle' => t('Menu Name'), '$desctitle' => t('Menu Title'), '$edit' => t('Edit'), '$drop' => t('Drop'), '$created' => t('Created'), '$edited' => t('Edited'), '$new' => t('New'), '$bmark' => t('Bookmarks allowed'), '$hintnew' => t('Create'), '$hintdrop' => t('Delete this menu'), '$hintcontent' => t('Edit menu contents'), '$hintedit' => t('Edit this menu'), '$sys' => \App::$is_sys));
         return $o;
     }
     if (argc() > 1) {
         if (intval(argv(1))) {
             if (argc() == 3 && argv(2) == 'drop') {
                 menu_sync_packet($uid, get_observer_hash(), intval(argv(1)), true);
                 $r = menu_delete_id(intval(argv(1)), $uid);
                 if (!$r) {
                     notice(t('Menu could not be deleted.') . EOL);
                 }
                 goaway(z_root() . '/menu' . (\App::$is_sys ? '?f=&sys=1' : ''));
             }
             $m = menu_fetch_id(intval(argv(1)), $uid);
             if (!$m) {
                 notice(t('Menu not found.') . EOL);
                 return '';
             }
             $o = replace_macros(get_markup_template('menuedit.tpl'), array('$header' => t('Edit Menu'), '$sys' => \App::$is_sys, '$menu_id' => intval(argv(1)), '$menu_edit_link' => 'mitem/' . intval(argv(1)) . (\App::$is_sys ? '?f=&sys=1' : ''), '$hintedit' => t('Add or remove entries to this menu'), '$editcontents' => t('Edit menu contents'), '$menu_name' => array('menu_name', t('Menu name'), $m['menu_name'], t('Must be unique, only seen by you'), '*'), '$menu_desc' => array('menu_desc', t('Menu title'), $m['menu_desc'], t('Menu title as seen by others'), ''), '$menu_bookmark' => array('menu_bookmark', t('Allow bookmarks'), $m['menu_flags'] & MENU_BOOKMARK ? 1 : 0, t('Menu may be used to store saved bookmarks'), array(t('No'), t('Yes'))), '$menu_system' => $m['menu_flags'] & MENU_SYSTEM ? 1 : 0, '$submit' => t('Submit and proceed')));
             return $o;
         } else {
             notice(t('Not found.') . EOL);
             return;
         }
     }
 }
示例#22
0
 function init()
 {
     logger('id: ' . print_r($_REQUEST, true));
     if (argc() > 1) {
         $which = argv(1);
     } else {
         \App::$error = 404;
         return;
     }
     $profile = '';
     $channel = \App::get_channel();
     profile_load($which, $profile);
     $op = new \Openid\MysqlProvider();
     $op->server();
 }
示例#23
0
function wholikesme_content(&$a)
{
    if (!local_channel()) {
        return;
    }
    $channel = App::get_channel();
    $r = q("select count(mid) as total, author_xchan, xchan_name from item left join xchan on author_xchan = xchan_hash where uid = %d and verb = '%s' and owner_xchan = '%s' group by author_xchan order by total desc", intval(local_channel()), dbesc(ACTIVITY_LIKE), dbesc($channel['xchan_hash']));
    if ($r) {
        $o = '<h3>' . t('Who likes me?') . '</h3>';
        $o .= '<ul>';
        foreach ($r as $rr) {
            $o .= '<li>' . $rr['xchan_name'] . ' ' . $rr['total'] . '</li>';
        }
        $o .= '</ul>';
    }
    return $o;
}
示例#24
0
function frphotos_init(&$a)
{
    if (!local_channel()) {
        return;
    }
    if (intval(get_pconfig(local_channel(), 'frphotos', 'complete'))) {
        return;
    }
    $channel = App::get_channel();
    $fr_server = $_REQUEST['fr_server'];
    $fr_username = $_REQUEST['fr_username'];
    $fr_password = $_REQUEST['fr_password'];
    $cookies = 'store/[data]/frphoto_cookie_' . $channel['channel_address'];
    if ($fr_server && $fr_username && $fr_password) {
        $ch = curl_init($fr_server . '/api/friendica/photos/list');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookies);
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookies);
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
        curl_setopt($ch, CURLOPT_USERPWD, $fr_username . ':' . $fr_password);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_USERAGENT, 'Hubzilla');
        $output = curl_exec($ch);
        curl_close($ch);
        $j = json_decode($output, true);
        //		echo print_r($j,true);
        $total = 0;
        if (count($j)) {
            foreach ($j as $jj) {
                $r = q("select uid from photo where resource_id = '%s' and uid = %d limit 1", dbesc($jj), intval($channel['channel_id']));
                if ($r) {
                    continue;
                }
                $total++;
                proc_run('php', 'addon/frphotos/frphotohelper.php', $jj, $channel['channel_address'], urlencode($fr_server));
                sleep(3);
            }
        }
        if ($total) {
            set_pconfig(local_channel(), 'frphotos', 'complete', '1');
        }
        @unlink($cookies);
        goaway(z_root() . '/photos/' . $channel['channel_address']);
    }
}
示例#25
0
 function get()
 {
     nav_set_selected('settings');
     if (!local_channel() || $_SESSION['delegate']) {
         notice(t('Permission denied.') . EOL);
         return login();
     }
     $channel = \App::get_channel();
     if ($channel) {
         head_set_icon($channel['xchan_photo_s']);
     }
     $o = $this->sm->call('get');
     if ($o !== false) {
         return $o;
     }
     $o = '';
 }
示例#26
0
 function get()
 {
     $channel = \App::get_channel();
     $atoken = null;
     $atoken_xchan = '';
     if (argc() > 2) {
         $id = argv(2);
         $atoken = q("select * from atoken where atoken_id = %d and atoken_uid = %d", intval($id), intval(local_channel()));
         if ($atoken) {
             $atoken = $atoken[0];
             $atoken_xchan = substr($channel['channel_hash'], 0, 16) . '.' . $atoken['atoken_name'];
         }
         if ($atoken && argc() > 3 && argv(3) === 'drop') {
             atoken_delete($id);
             $atoken = null;
             $atoken_xchan = '';
         }
     }
     $t = q("select * from atoken where atoken_uid = %d", intval(local_channel()));
     $desc = t('Use this form to create temporary access identifiers to share things with non-members. These identities may be used in Access Control Lists and visitors may login using these credentials to access private content.');
     $desc2 = t('You may also provide <em>dropbox</em> style access links to friends and associates by adding the Login Password to any specific site URL as shown. Examples:');
     $global_perms = \Zotlabs\Access\Permissions::Perms();
     $existing = get_all_perms(local_channel(), $atoken_xchan ? $atoken_xchan : '');
     if ($atoken_xchan) {
         $theirs = q("select * from abconfig where chan = %d and xchan = '%s' and cat = 'their_perms'", intval(local_channel()), dbesc($atoken_xchan));
         $their_perms = array();
         if ($theirs) {
             foreach ($theirs as $t) {
                 $their_perms[$t['k']] = $t['v'];
             }
         }
     }
     foreach ($global_perms as $k => $v) {
         $thisperm = get_abconfig(local_channel(), $contact['abook_xchan'], 'my_perms', $k);
         //fixme
         $checkinherited = \Zotlabs\Access\PermissionLimits::Get(local_channel(), $k);
         if ($existing[$k]) {
             $thisperm = "1";
         }
         $perms[] = array('perms_' . $k, $v, array_key_exists($k, $their_perms) ? intval($their_perms[$k]) : '', $thisperm, 1, $checkinherited & PERMS_SPECIFIC ? '' : '1', '', $checkinherited);
     }
     $tpl = get_markup_template("settings_tokens.tpl");
     $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_tokens"), '$title' => t('Guest Access Tokens'), '$desc' => $desc, '$desc2' => $desc2, '$tokens' => $t, '$atoken' => $atoken, '$url1' => z_root() . '/channel/' . $channel['channel_address'], '$url2' => z_root() . '/photos/' . $channel['channel_address'], '$name' => array('name', t('Login Name') . ' <span class="required">*</span>', $atoken ? $atoken['atoken_name'] : '', ''), '$token' => array('token', t('Login Password') . ' <span class="required">*</span>', $atoken ? $atoken['atoken_token'] : autoname(8), ''), '$expires' => array('expires', t('Expires (yyyy-mm-dd)'), $atoken['atoken_expires'] && $atoken['atoken_expires'] > NULL_DATE ? datetime_convert('UTC', date_default_timezone_get(), $atoken['atoken_expires']) : '', ''), '$them' => t('Their Settings'), '$me' => t('My Settings'), '$perms' => $perms, '$inherited' => t('inherited'), '$notself' => '1', '$permlbl' => t('Individual Permissions'), '$permnote' => t('Some permissions may be inherited from your channel\'s <a href="settings"><strong>privacy settings</strong></a>, which have higher priority than individual settings. You can <strong>not</strong> change those settings here.'), '$submit' => t('Submit')));
     return $o;
 }
示例#27
0
 function get()
 {
     // This is just a test utility function and may go away once we build these tools into
     // the address book and directory to do dead site discovery.
     // The response packet include the current URL and key so we can discover if the server
     // has been re-installed and clean up (e.g. get rid of) any old hublocs and xchans.
     // Remember to add '/post' to the url
     if (!local_channel()) {
         return;
     }
     $url = $_REQUEST['url'];
     if (!$url) {
         return;
     }
     $m = zot_build_packet(\App::get_channel(), 'ping');
     $r = zot_zot($url, $m);
     return print_r($r, true);
 }
示例#28
0
function appman_content(&$a)
{
    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];
        }
        $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')));
}
示例#29
0
 function post()
 {
     if (!local_channel()) {
         return;
     }
     if (!feature_enabled(local_channel(), 'channel_sources')) {
         return '';
     }
     $source = intval($_REQUEST['source']);
     $xchan = $_REQUEST['xchan'];
     $abook = intval($_REQUEST['abook']);
     $words = $_REQUEST['words'];
     $frequency = $_REQUEST['frequency'];
     $name = $_REQUEST['name'];
     $tags = $_REQUEST['tags'];
     $channel = \App::get_channel();
     if ($name == '*') {
         $xchan = '*';
     }
     if ($abook) {
         $r = q("select abook_xchan from abook where abook_id = %d and abook_channel = %d limit 1", intval($abook), intval(local_channel()));
         if ($r) {
             $xchan = $r[0]['abook_xchan'];
         }
     }
     if (!$xchan) {
         notice(t('Failed to create source. No channel selected.') . EOL);
         return;
     }
     if (!$source) {
         $r = q("insert into source ( src_channel_id, src_channel_xchan, src_xchan, src_patt, src_tag )\n\t\t\t\tvalues ( %d, '%s', '%s', '%s', '%s' ) ", intval(local_channel()), dbesc($channel['channel_hash']), dbesc($xchan), dbesc($words), dbesc($tags));
         if ($r) {
             info(t('Source created.') . EOL);
         }
         goaway(z_root() . '/sources');
     } else {
         $r = q("update source set src_xchan = '%s', src_patt = '%s', src_tag = '%s' where src_channel_id = %d and src_id = %d", dbesc($xchan), dbesc($words), dbesc($tags), intval(local_channel()), intval($source));
         if ($r) {
             info(t('Source updated.') . EOL);
         }
     }
 }
示例#30
0
 function init()
 {
     if (!local_channel()) {
         return;
     }
     $uid = local_channel();
     $url = notags(trim($_REQUEST['url']));
     $return_url = $_SESSION['return_url'];
     $confirm = intval($_REQUEST['confirm']);
     $channel = \App::get_channel();
     // Warning: Do not edit the following line. The first symbol is UTF-8 &#65312;
     $url = str_replace('@', '@', $url);
     $result = new_contact($uid, $url, $channel, true, $confirm);
     if ($result['success'] == false) {
         if ($result['message']) {
             notice($result['message']);
         }
         goaway($return_url);
     }
     info(t('Channel added.') . EOL);
     $clone = array();
     foreach ($result['abook'] as $k => $v) {
         if (strpos($k, 'abook_') === 0) {
             $clone[$k] = $v;
         }
     }
     unset($clone['abook_id']);
     unset($clone['abook_account']);
     unset($clone['abook_channel']);
     $abconfig = load_abconfig($channel['channel_id'], $clone['abook_xchan']);
     if ($abconfig) {
         $clone['abconfig'] = $abconfig;
     }
     build_sync_packet(0, array('abook' => array($clone)), true);
     $can_view_stream = intval(get_abconfig($channel['channel_id'], $clone['abook_xchan'], 'their_perms', 'view_stream'));
     // If we can view their stream, pull in some posts
     if ($can_view_stream || $result['abook']['xchan_network'] === 'rss') {
         \Zotlabs\Daemon\Master::Summon(array('Onepoll', $result['abook']['abook_id']));
     }
     goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1');
 }