Example #1
0
function profile_photo_init(&$a)
{
    if (!local_user()) {
        return;
    }
    profile_load($a, $a->user['nickname']);
}
Example #2
0
function settings_init(&$a)
{
    if (local_user()) {
        profile_load($a, $a->user['nickname']);
    }
    // These lines provide the javascript needed by the acl selector
    $a->page['htmlhead'] .= "<script> var ispublic = '" . t('everybody') . "';";
    $a->page['htmlhead'] .= <<<EOT

\t\$(document).ready(function() {

\t\t\$('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
\t\t\tvar selstr;
\t\t\t\$('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
\t\t\t\tselstr = \$(this).text();
\t\t\t\t\$('#jot-perms-icon').removeClass('unlock').addClass('lock');
\t\t\t\t\$('#jot-public').hide();
\t\t\t});
\t\t\tif(selstr == null) { 
\t\t\t\t\$('#jot-perms-icon').removeClass('lock').addClass('unlock');
\t\t\t\t\$('#jot-public').show();
\t\t\t}

\t\t}).trigger('change');

\t});

\t</script>
EOT;
}
Example #3
0
 function init()
 {
     $which = null;
     if (argc() > 1) {
         $which = argv(1);
     }
     if (!$which) {
         if (local_channel()) {
             $channel = \App::get_channel();
             if ($channel && $channel['channel_address']) {
                 $which = $channel['channel_address'];
             }
         }
     }
     if (!$which) {
         notice(t('You must be logged in to see this page.') . EOL);
         return;
     }
     $profile = 0;
     $channel = \App::get_channel();
     if (local_channel() && argc() > 2 && argv(2) === 'view') {
         $which = $channel['channel_address'];
         $profile = argv(1);
     }
     \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Posts and comments') . '" href="' . z_root() . '/feed/' . $which . '" />' . "\r\n";
     \App::$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" title="' . t('Only posts') . '" href="' . z_root() . '/feed/' . $which . '?top=1" />' . "\r\n";
     // Not yet ready for prime time
     //	\App::$page['htmlhead'] .= '<link rel="openid.server" href="' . z_root() . '/id/' . $which .'?f=" />' . "\r\n" ;
     //	\App::$page['htmlhead'] .= '<link rel="openid.delegate" href="' . z_root() . '/channel/' . $which .'" />' . "\r\n" ;
     // Run profile_load() here to make sure the theme is set before
     // we start loading content
     profile_load($a, $which, $profile);
 }
Example #4
0
function settings_init(&$a)
{
    if (local_user()) {
        require_once "mod/profile.php";
        profile_load($a, $a->user['nickname']);
    }
}
Example #5
0
function chat_init(&$a)
{
    $which = null;
    if (argc() > 1) {
        $which = argv(1);
    }
    if (!$which) {
        if (local_channel()) {
            $channel = $a->get_channel();
            if ($channel && $channel['channel_address']) {
                $which = $channel['channel_address'];
            }
        }
    }
    if (!$which) {
        notice(t('You must be logged in to see this page.') . EOL);
        return;
    }
    $profile = 0;
    $channel = $a->get_channel();
    if (local_channel() && argc() > 2 && argv(2) === 'view') {
        $which = $channel['channel_address'];
        $profile = argv(1);
    }
    $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which . '" />' . "\r\n";
    // Run profile_load() here to make sure the theme is set before
    // we start loading content
    profile_load($a, $which, $profile);
}
Example #6
0
function viewcontacts_init(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        return;
    }
    profile_load($a, $a->argv[1]);
}
Example #7
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);
 }
Example #8
0
function achievements_content(&$a)
{
    // This doesn't work, so
    if (!is_developer()) {
        return;
    }
    if (argc() > 1) {
        $which = argv(1);
    } else {
        notice(t('Requested profile is not available.') . EOL);
        return;
    }
    $profile = 0;
    $profile = argv(1);
    profile_load($a, $which, $profile);
    $r = q("select channel_id from channel where channel_address = '%s'", dbesc($which));
    if ($r) {
        $owner = intval($r[0]['channel_id']);
    }
    $observer = $a->get_observer();
    $ob_hash = $observer ? $observer['xchan_hash'] : '';
    $perms = get_all_perms($owner, $ob_hash);
    if (!$perms['view_profile']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $newmembertext = t('Some blurb about what to do when you\'re new here');
    //	By default, all badges are false
    $contactbadge = false;
    $profilebadge = false;
    $keywordsbadge = false;
    // Check number of contacts.  Award a badge if over 10
    // We'll figure these out on each page load instead of
    // writing them to the DB because that will mean one needs
    // to retain their achievements - eg, you can't add
    // a bunch of channels just to get your badge, and then
    // delete them all again.  If these become popular or
    // used in profiles or something, we may need to reconsider
    // and add a table for this - because this won't scale.
    $r = q("select * from abook where abook_channel = %d", intval($owner));
    if (count($r)) {
        $contacts = count($r);
    }
    // We're checking for 11 to adjust for the abook record for self
    if ($contacts >= 11) {
        $contactbadge = true;
    }
    //	Check if an about field in the profile has been created.
    $r = q("select * from profile where uid = %d and about <> ''", intval($owner));
    if ($r) {
        $profilebadge = 1;
    }
    // Check if keywords have been set
    $r = q("select * from profile where uid = %d and keywords <> ''", intval($owner));
    if ($r) {
        $keywordsbadge = 1;
    }
    return replace_macros(get_markup_template("achievements.tpl"), array('$newmembertext' => $newmembertext, '$profilebadge' => $profilebadge, '$contactbadge' => $contactbadge, '$keywordsbadge' => $keywordsbadge, '$channelsbadge' => $channelsbadge));
}
Example #9
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();
 }
function profile_photo_init(&$a)
{
    if (!local_channel()) {
        return;
    }
    $channel = App::get_channel();
    profile_load($a, $channel['channel_address']);
}
 function init()
 {
     if (!local_channel()) {
         return;
     }
     $channel = \App::get_channel();
     profile_load($a, $channel['channel_address']);
 }
function profile_photo_init(&$a)
{
    if (!local_user()) {
        return;
    }
    require_once "mod/profile.php";
    profile_load($a, $a->user['nickname']);
}
Example #13
0
 function dfrn_request_init(&$a)
 {
     if ($a->argc > 1) {
         $which = $a->argv[1];
     }
     profile_load($a, $which);
     return;
 }
Example #14
0
function display_init(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        return;
    }
    $nick = $a->argc > 1 ? $a->argv[1] : '';
    profile_load($a, $nick);
}
Example #15
0
function display_init(&$a)
{
    if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
        return;
    }
    $nick = $a->argc > 1 ? $a->argv[1] : '';
    $profiledata = array();
    // If there is only one parameter, then check if this parameter could be a guid
    if ($a->argc == 2) {
        $nick = "";
        $itemuid = 0;
        // Does the local user have this item?
        if (local_user()) {
            $r = q("SELECT `id`, `parent`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`\n\t\t\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\t\t\t\tAND `guid` = '%s' AND `uid` = %d", $a->argv[1], local_user());
            if (count($r)) {
                $nick = $a->user["nickname"];
                $itemuid = local_user();
            }
        }
        // Or is it anywhere on the server?
        if ($nick == "") {
            $r = q("SELECT `user`.`nickname`, `item`.`id`, `item`.`parent`, `item`.`author-name`,\n\t\t\t\t`item`.`author-link`, `item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`body`\n\t\t\t\tFROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`\n\t\t\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\t\t\t\tAND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''\n\t\t\t\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''\n\t\t\t\t\tAND `item`.`private` = 0 AND NOT `user`.`hidewall`\n\t\t\t\t\tAND `item`.`guid` = '%s'", $a->argv[1]);
            //	AND `item`.`private` = 0 AND `item`.`wall` = 1
            if (count($r)) {
                $nick = $r[0]["nickname"];
                $itemuid = $r[0]["uid"];
            }
        }
        // Is it an item with uid=0?
        if ($nick == "") {
            $r = q("SELECT `item`.`id`, `item`.`parent`, `item`.`author-name`,\n\t\t\t\t`item`.`author-link`, `item`.`author-avatar`, `item`.`network`, `item`.`uid`, `item`.`body`\n\t\t\t\tFROM `item` WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\t\t\t\tAND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''\n\t\t\t\t\tAND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = ''\n\t\t\t\t\tAND `item`.`private` = 0 AND `item`.`uid` = 0\n\t\t\t\t\tAND `item`.`guid` = '%s'", $a->argv[1]);
            //	AND `item`.`private` = 0 AND `item`.`wall` = 1
        }
        if (count($r)) {
            if ($r[0]["id"] != $r[0]["parent"]) {
                $r = q("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid` FROM `item`\n\t\t\t\t\tWHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0\n\t\t\t\t\t\tAND `id` = %d", $r[0]["parent"]);
            }
            $profiledata = display_fetchauthor($a, $r[0]);
            if (strstr(normalise_link($profiledata["url"]), normalise_link($a->get_baseurl()))) {
                $nickname = str_replace(normalise_link($a->get_baseurl()) . "/profile/", "", normalise_link($profiledata["url"]));
                if ($nickname != $a->user["nickname"]) {
                    $r = q("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`\n\t\t\t\t\t\tINNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` INNER JOIN `user` ON `profile`.`uid` = `user`.`uid`\n\t\t\t\t\t\tWHERE `user`.`nickname` = '%s' AND `profile`.`is-default` = 1 and `contact`.`self` = 1 LIMIT 1", dbesc($nickname));
                    if (count($r)) {
                        $profiledata = $r[0];
                    }
                    $profiledata["network"] = NETWORK_DFRN;
                } else {
                    $profiledata = array();
                }
            }
        } else {
            $a->error = 404;
            notice(t('Item not found.') . EOL);
            return;
        }
    }
    profile_load($a, $nick, 0, $profiledata);
}
Example #16
0
File: blocks.php Project: Mauru/red
function blocks_content(&$a)
{
    if (argc() > 1) {
        $which = argv(1);
    } else {
        notice(t('Requested profile is not available.') . EOL);
        $a->error = 404;
        return;
    }
    profile_load($a, $which, 0);
    // 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']);
    }
    // Block design features from visitors
    if (!local_user() || local_user() != $owner) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    // Get the observer, check their permissions
    $observer = $a->get_observer();
    $ob_hash = $observer ? $observer['xchan_hash'] : '';
    $perms = get_all_perms($owner, $ob_hash);
    if (!$perms['write_pages']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    // Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
    // Nickname is set to the observers xchan, and profile_uid to the owners.
    // This lets you post pages at other people's channels.
    require_once 'include/conversation.php';
    $x = array('webpage' => ITEM_BUILDBLOCK, 'is_owner' => true, 'nickname' => $a->profile['channel_address'], 'lockstate' => $group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid'] ? 'lock' : 'unlock', 'bang' => $group || $cid ? '!' : '', 'showacl' => false, 'visitor' => true, 'mimetype' => 'choose', 'ptlabel' => t('Block Name'), 'profile_uid' => intval($owner));
    if ($_REQUEST['title']) {
        $x['title'] = $_REQUEST['title'];
    }
    if ($_REQUEST['body']) {
        $x['body'] = $_REQUEST['body'];
    }
    if ($_REQUEST['pagetitle']) {
        $x['pagetitle'] = $_REQUEST['pagetitle'];
    }
    $o .= status_editor($a, $x);
    //Get a list of blocks.  We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
    //TODO - this should be replaced with pagelist_widget
    $r = q("select * from item_id where uid = %d and service = 'BUILDBLOCK' order by sid asc", intval($owner));
    $pages = null;
    if ($r) {
        $pages = array();
        foreach ($r as $rr) {
            $pages[$rr['iid']][] = array('url' => $rr['iid'], 'title' => $rr['sid']);
        }
    }
    //Build the base URL for edit links
    $url = z_root() . "/editblock/" . $which;
    // This isn't pretty, but it works.  Until I figure out what to do with the UI, it's Good Enough(TM).
    return $o . replace_macros(get_markup_template("blocklist.tpl"), array('$baseurl' => $url, '$edit' => t('Edit'), '$pages' => $pages, '$channel' => $which, '$view' => t('View'), '$preview' => '1'));
}
Example #17
0
function page_init(&$a)
{
    // We need this to make sure the channel theme is always loaded.
    $which = argv(1);
    $profile = 0;
    profile_load($a, $which, $profile);
    if ($a->profile['profile_uid']) {
        head_set_icon($a->profile['thumb']);
    }
    // load the item here in the init function because we need to extract
    // the page layout and initialise the correct theme.
    $observer = $a->get_observer();
    $ob_hash = $observer ? $observer['xchan_hash'] : '';
    $perms = get_all_perms($a->profile['profile_uid'], $ob_hash);
    if (!$perms['view_pages']) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    if (argc() < 3) {
        notice(t('Invalid item.') . EOL);
        return;
    }
    $channel_address = argv(1);
    $page_id = argv(2);
    $u = q("select channel_id from channel where channel_address = '%s' limit 1", dbesc($channel_address));
    if (!$u) {
        notice(t('Channel not found.') . EOL);
        return;
    }
    if ($_REQUEST['rev']) {
        $revision = " and revision = " . intval($_REQUEST['rev']) . " ";
    } else {
        $revision = " order by revision desc ";
    }
    require_once 'include/security.php';
    $sql_options = item_permissions_sql($u[0]['channel_id']);
    $r = q("select item.* from item left join item_id on item.id = item_id.iid\n\t\twhere item.uid = %d and sid = '%s' and service = 'WEBPAGE' and \n\t\titem_restrict = %d {$sql_options} {$revision} limit 1", intval($u[0]['channel_id']), dbesc($page_id), intval(ITEM_WEBPAGE));
    if (!$r) {
        // Check again with no permissions clause to see if it is a permissions issue
        $x = q("select item.* from item left join item_id on item.id = item_id.iid\n\t\twhere item.uid = %d and sid = '%s' and service = 'WEBPAGE' and \n\t\titem_restrict = %d {$revision} limit 1", intval($u[0]['channel_id']), dbesc($page_id), intval(ITEM_WEBPAGE));
        if ($x) {
            // Yes, it's there. You just aren't allowed to see it.
            notice(t('Permission denied.') . EOL);
        } else {
            notice(t('Page not found.') . EOL);
        }
        return;
    }
    if ($r[0]['layout_mid']) {
        $l = q("select body from item where mid = '%s' and uid = %d limit 1", dbesc($r[0]['layout_mid']), intval($u[0]['channel_id']));
        if ($l) {
            require_once 'include/comanche.php';
            comanche_parser(get_app(), $l[0]['body']);
            get_app()->pdl = $l[0]['body'];
        }
    }
    $a->data['webpage'] = $r;
}
Example #18
0
function block_init(&$a)
{
    $which = argv(1);
    $profile = 0;
    profile_load($a, $which, $profile);
    if ($a->profile['profile_uid']) {
        head_set_icon($a->profile['thumb']);
    }
}
Example #19
0
 function init()
 {
     if (observer_prohibited()) {
         return;
     }
     if (argc() > 1) {
         profile_load(argv(1));
     }
 }
Example #20
0
function viewconnections_init(&$a)
{
    if (get_config('system', 'block_public') && !local_channel() && !remote_channel()) {
        return;
    }
    if (argc() > 1) {
        profile_load($a, argv(1));
    }
}
Example #21
0
function profperm_init(&$a)
{
    if (!local_user()) {
        return;
    }
    $which = $a->user['nickname'];
    $profile = $a->argv[1];
    profile_load($a, $which, $profile);
}
Example #22
0
function profile_init(&$a)
{
    if (!x($a->page, 'aside')) {
        $a->page['aside'] = '';
    }
    if ($a->argc > 1) {
        $which = $a->argv[1];
    } else {
        $r = q("select nickname from user where blocked = 0 and account_expired = 0 and account_removed = 0 and verified = 1 order by rand() limit 1");
        if (count($r)) {
            goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']);
        } else {
            logger('profile error: mod_profile ' . $a->query_string, LOGGER_DEBUG);
            notice(t('Requested profile is not available.') . EOL);
            $a->error = 404;
            return;
        }
    }
    $profile = 0;
    if (local_user() && $a->argc > 2 && $a->argv[2] === 'view') {
        $which = $a->user['nickname'];
        $profile = $a->argv[1];
    } else {
        auto_redir($a, $which);
    }
    profile_load($a, $which, $profile);
    $blocked = get_config('system', 'block_public') && !local_user() && !remote_user() ? true : false;
    $userblock = $a->profile['hidewall'] && !local_user() && !remote_user() ? true : false;
    if (x($a->profile, 'page-flags') && $a->profile['page-flags'] == PAGE_COMMUNITY) {
        $a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
    }
    if (x($a->profile, 'openidserver')) {
        $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
    }
    if (x($a->profile, 'openid')) {
        $delegate = strstr($a->profile['openid'], '://') ? $a->profile['openid'] : 'https://' . $a->profile['openid'];
        $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
    }
    // site block
    if (!$blocked && !$userblock) {
        $keywords = x($a->profile, 'pub_keywords') ? $a->profile['pub_keywords'] : '';
        $keywords = str_replace(array('#', ',', ' ', ',,'), array('', ' ', ',', ','), $keywords);
        if (strlen($keywords)) {
            $a->page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n";
        }
    }
    $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($a->profile['net-publish'] ? 'true' : 'false') . '" />' . "\r\n";
    $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/dfrn_poll/' . $which . '" />' . "\r\n";
    $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->path ? '/' . $a->path : ''));
    $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
    header('Link: <' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
    $dfrn_pages = array('request', 'confirm', 'notify', 'poll');
    foreach ($dfrn_pages as $dfrn) {
        $a->page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"" . $a->get_baseurl() . "/dfrn_{$dfrn}/{$which}\" />\r\n";
    }
    $a->page['htmlhead'] .= "<link rel=\"dfrn-poco\" href=\"" . $a->get_baseurl() . "/poco/{$which}\" />\r\n";
}
Example #23
0
 function init()
 {
     $which = argv(1);
     $profile = 0;
     profile_load($which, $profile);
     if (\App::$profile['profile_uid']) {
         head_set_icon(\App::$profile['thumb']);
     }
 }
Example #24
0
function settings_init(&$a)
{
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    require_once "mod/profile.php";
    profile_load($a, $a->user['nickname']);
}
Example #25
0
function profperm_init(&$a)
{
    if (!local_user()) {
        return;
    }
    $channel = $a->get_channel();
    $which = $channel['channel_address'];
    $profile = $a->argv[1];
    profile_load($a, $which, $profile);
}
Example #26
0
 function init()
 {
     if (!local_channel()) {
         return;
     }
     $channel = \App::get_channel();
     $which = $channel['channel_address'];
     $profile = \App::$argv[1];
     profile_load($a, $which, $profile);
 }
Example #27
0
File: page.php Project: Mauru/red
function page_init(&$a)
{
    // We need this to make sure the channel theme is always loaded.
    $which = argv(1);
    $profile = 0;
    profile_load($a, $which, $profile);
    if ($a->profile['profile_uid']) {
        head_set_icon($a->profile['thumb']);
    }
}
Example #28
0
function allfriends_content(&$a)
{
    $o = '';
    if (!local_user()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    if ($a->argc > 1) {
        $cid = intval($a->argv[1]);
    }
    if (!$cid) {
        return;
    }
    $uid = $a->user[uid];
    $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($cid), intval(local_user()));
    if (!count($c)) {
        return;
    }
    $a->page['aside'] = "";
    profile_load($a, "", 0, get_contact_details_by_url($c[0]["url"]));
    $total = count_all_friends(local_user(), $cid);
    if (count($total)) {
        $a->set_pager_total($total);
    }
    $r = all_friends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
    if (!count($r)) {
        $o .= t('No friends to display.');
        return $o;
    }
    $id = 0;
    foreach ($r as $rr) {
        //get further details of the contact
        $contact_details = get_contact_details_by_url($rr['url'], $uid);
        $photo_menu = '';
        // $rr[cid] is only available for common contacts. So if the contact is a common one, use contact_photo_menu to generate the photo_menu
        // If the contact is not common to the user, Connect/Follow' will be added to the photo menu
        if ($rr[cid]) {
            $rr[id] = $rr[cid];
            $photo_menu = contact_photo_menu($rr);
        } else {
            $connlnk = $a->get_baseurl() . '/follow/?url=' . $rr['url'];
            $photo_menu = array(array(t("View Profile"), zrl($rr['url'])));
            $photo_menu[] = array(t("Connect/Follow"), $connlnk);
        }
        $entry = array('url' => $rr['url'], 'itemurl' => $contact_details['addr'] != "" ? $contact_details['addr'] : $rr['url'], 'name' => htmlentities($rr['name']), 'thumb' => proxy_url($rr['photo'], false, PROXY_SIZE_THUMB), 'img_hover' => htmlentities($rr['name']), 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], 'account_type' => $contact_details['community'] ? t('Forum') : '', 'network' => network_to_name($contact_details['network'], $contact_details['url']), 'photo_menu' => $photo_menu, 'conntxt' => t('Connect'), 'connlnk' => $connlnk, 'id' => ++$id);
        $entries[] = $entry;
    }
    $tab_str = contacts_tab($a, $cid, 3);
    $tpl = get_markup_template('viewcontact_template.tpl');
    $o .= replace_macros($tpl, array('$tab_str' => $tab_str, '$contacts' => $entries, '$paginate' => paginate($a)));
    return $o;
}
Example #29
0
 function init()
 {
     if (argc() > 1 && intval(argv(1))) {
         $channel_id = intval(argv(1));
     } else {
         notice(t('No channel.') . EOL);
         \App::$error = 404;
         return;
     }
     $x = q("select channel_address from channel where channel_id = %d limit 1", intval($channel_id));
     if ($x) {
         profile_load($a, $x[0]['channel_address'], 0);
     }
 }
Example #30
0
function connect_init(&$a)
{
    if (argc() > 1) {
        $which = argv(1);
    } else {
        notice(t('Requested profile is not available.') . EOL);
        $a->error = 404;
        return;
    }
    $r = q("select * from channel where channel_address = '%s' limit 1", dbesc($which));
    if ($r) {
        $a->data['channel'] = $r[0];
    }
    profile_load($a, $which, '');
}