function bookmarks_content(&$a) { if (!local_user()) { notice(t('Permission denied.') . EOL); return; } require_once 'include/menu.php'; require_once 'include/conversation.php'; $channel = $a->get_channel(); $o = profile_tabs($a, true, $channel['channel_address']); $o .= '<h3>' . t('My Bookmarks') . '</h3>'; $x = menu_list(local_user(), '', MENU_BOOKMARK); if ($x) { foreach ($x as $xx) { $y = menu_fetch($xx['menu_name'], local_user(), get_observer_hash()); $o .= menu_render($y, '', true); } } $o .= '<h3>' . t('My Connections Bookmarks') . '</h3>'; $x = menu_list(local_user(), '', MENU_SYSTEM | MENU_BOOKMARK); if ($x) { foreach ($x as $xx) { $y = menu_fetch($xx['menu_name'], local_user(), get_observer_hash()); $o .= menu_render($y, '', true); } } return $o; }
function menu_render($menu, $class = '', $edit = false, $var = array()) { if (!$menu) { return ''; } $channel_id = is_array(get_app()->profile) ? get_app()->profile['profile_uid'] : 0; if (!$channel_id && local_channel()) { $channel_id = local_channel(); } $menu_list = menu_list($channel_id); $menu_names = array(); foreach ($menu_list as $menus) { if ($menus['menu_name'] != $menu['menu']['menu_name']) { $menu_names[] = $menus['menu_name']; } } for ($x = 0; $x < count($menu['items']); $x++) { if (in_array($menu['items'][$x]['mitem_link'], $menu_names)) { $m = menu_fetch($menu['items'][$x]['mitem_link'], $channel_id, get_observer_hash()); $submenu = menu_render($m, 'dropdown-menu', $edit = false, array('wrap' => 'none')); $menu['items'][$x]['submenu'] = $submenu; } if ($menu['items'][$x]['mitem_flags'] & MENU_ITEM_ZID) { $menu['items'][$x]['mitem_link'] = zid($menu['items'][$x]['mitem_link']); } if ($menu['items'][$x]['mitem_flags'] & MENU_ITEM_NEWWIN) { $menu['items'][$x]['newwin'] = '1'; } $menu['items'][$x]['mitem_desc'] = bbcode($menu['items'][$x]['mitem_desc']); } $wrap = $var['wrap'] === 'none' ? false : true; $ret = replace_macros(get_markup_template('usermenu.tpl'), array('$menu' => $menu['menu'], '$class' => $class, '$edit' => $edit ? t("Edit") : '', '$id' => $menu['menu']['menu_id'], '$items' => $menu['items'], '$wrap' => $wrap)); return $ret; }
function comanche_menu($name, $class = '') { $channel_id = comanche_get_channel_id(); if ($channel_id) { $m = menu_fetch($name, $channel_id, get_observer_hash()); return menu_render($m, $class); } }
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; } } }
function mitem_content(&$a) { if (!local_user()) { notice(t('Permission denied.') . EOL); return ''; } if (argc() < 2 || !$a->data['menu']) { notice(t('Not found.') . EOL); return ''; } $channel = $a->get_channel(); $m = menu_fetch($a->data['menu']['menu_name'], local_user(), get_observer_hash()); $a->data['menu_item'] = $m; if (argc() == 2) { $r = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d order by mitem_order asc, mitem_desc asc", intval($a->data['menu']['menu_id']), local_user()); $o .= replace_macros(get_markup_template('mitemlist.tpl'), array('$title' => t('Manage Menu Elements'), '$menuname' => $a->data['menu']['menu_name'], '$menudesc' => $a->data['menu']['menu_desc'], '$edmenu' => t('Edit menu'), '$menu_id' => $a->data['menu']['menu_id'], '$mlist' => $r, '$edit' => t('Edit element'), '$drop' => t('Drop element'), '$new' => t('New element'), '$hintmenu' => t('Edit this menu container'), '$hintnew' => t('Add menu element'), '$hintdrop' => t('Delete this menu item'), '$hintedit' => t('Edit this menu item'))); return $o; } if (argc() > 2) { if (argv(2) === 'new') { $perm_defaults = array('allow_cid' => $channel['channel_allow_cid'], 'allow_gid' => $channel['channel_allow_gid'], 'deny_cid' => $channel['channel_deny_cid'], 'deny_gid' => $channel['channel_deny_gid']); $o = replace_macros(get_markup_template('mitemedit.tpl'), array('$header' => t('New Menu Element'), '$menu_id' => $a->data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("(click to open/close)"), '$aclselect' => populate_acl($perm_defaults, false), '$mitem_desc' => array('mitem_desc', t('Link text'), '', '', '*'), '$mitem_link' => array('mitem_link', t('URL of link'), '', '', '*'), '$usezid' => array('usezid', t('Use Red magic-auth if available'), true, ''), '$newwin' => array('newwin', t('Open link in new window'), false, ''), '$mitem_order' => array('mitem_order', t('Order in list'), '0', t('Higher numbers will sink to bottom of listing')), '$submit' => t('Create'))); return $o; } elseif (intval(argv(2))) { $m = q("select * from menu_item where mitem_id = %d and mitem_channel_id = %d limit 1", intval(argv(2)), intval(local_user())); if (!$m) { notice(t('Menu item not found.') . EOL); goaway(z_root() . '/menu'); } $mitem = $m[0]; if (argc() == 4 && argv(3) == 'drop') { $r = menu_del_item($mitem['mitem_menu_id'], local_user(), intval(argv(2))); if ($r) { info(t('Menu item deleted.') . EOL); } else { notice(t('Menu item could not be deleted.') . EOL); } goaway(z_root() . '/mitem/' . $mitem['mitem_menu_id']); } else { // edit menu item $o = replace_macros(get_markup_template('mitemedit.tpl'), array('$header' => t('Edit Menu Element'), '$menu_id' => $a->data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("(click to open/close)"), '$aclselect' => populate_acl($mitem, false), '$mitem_id' => intval(argv(2)), '$mitem_desc' => array('mitem_desc', t('Link text'), $mitem['mitem_desc'], '', '*'), '$mitem_link' => array('mitem_link', t('URL of link'), $mitem['mitem_link'], '', '*'), '$usezid' => array('usezid', t('Use Red magic-auth if available'), $mitem['mitem_flags'] & MENU_ITEM_ZID ? 1 : 0, ''), '$newwin' => array('newwin', t('Open link in new window'), $mitem['mitem_flags'] & MENU_ITEM_NEWWIN ? 1 : 0, ''), '$mitem_order' => array('mitem_order', t('Order in list'), $mitem['mitem_order'], t('Higher numbers will sink to bottom of listing')), '$submit' => t('Modify'))); return $o; } } } }
/** * @brief Formats a profile for display in the sidebar. * * It is very difficult to templatise the HTML completely * because of all the conditional logic. * * @param array $profile * @param int $block * @param boolean $show_connect * * @return HTML string suitable for sidebar inclusion * Exceptions: Returns empty string if passed $profile is wrong type or not populated */ function profile_sidebar($profile, $block = 0, $show_connect = true) { $a = get_app(); $observer = $a->get_observer(); $o = ''; $location = false; $pdesc = true; $reddress = true; if (!is_array($profile) && !count($profile)) { return $o; } head_set_icon($profile['thumb']); $is_owner = $profile['uid'] == local_channel() ? true : false; if (is_sys_channel($profile['uid'])) { $show_connect = false; } $profile['picdate'] = urlencode($profile['picdate']); call_hooks('profile_sidebar_enter', $profile); require_once 'include/Contact.php'; if ($show_connect) { // This will return an empty string if we're already connected. $connect_url = rconnect_url($profile['uid'], get_observer_hash()); $connect = $connect_url ? t('Connect') : ''; if ($connect_url) { $connect_url = sprintf($connect_url, urlencode($profile['channel_address'] . '@' . $a->get_hostname())); } // premium channel - over-ride if ($profile['channel_pageflags'] & PAGE_PREMIUM) { $connect_url = z_root() . '/connect/' . $profile['channel_address']; } } // show edit profile to yourself if ($is_owner) { $profile['menu'] = array('chg_photo' => t('Change profile photo'), 'entries' => array()); $multi_profiles = feature_enabled(local_channel(), 'multi_profiles'); if ($multi_profiles) { $profile['edit'] = array($a->get_baseurl() . '/profiles', t('Profiles'), "", t('Manage/edit profiles')); $profile['menu']['cr_new'] = t('Create New Profile'); } else { $profile['edit'] = array($a->get_baseurl() . '/profiles/' . $profile['id'], t('Edit Profile'), '', t('Edit Profile')); } $r = q("SELECT * FROM `profile` WHERE `uid` = %d", local_channel()); if ($r) { foreach ($r as $rr) { if (!($multi_profiles || $rr['is_default'])) { continue; } $profile['menu']['entries'][] = array('photo' => $rr['thumb'], 'id' => $rr['id'], 'alt' => t('Profile Image'), 'profile_name' => $rr['profile_name'], 'isdefault' => $rr['is_default'], 'visible_to_everybody' => t('visible to everybody'), 'edit_visibility' => t('Edit visibility')); } } } if (x($profile, 'address') == 1 || x($profile, 'locality') == 1 || x($profile, 'region') == 1 || x($profile, 'postal_code') == 1 || x($profile, 'country_name') == 1) { $location = t('Location:'); } $profile['homepage'] = linkify($profile['homepage'], true); $gender = x($profile, 'gender') == 1 ? t('Gender:') : False; $marital = x($profile, 'marital') == 1 ? t('Status:') : False; $homepage = x($profile, 'homepage') == 1 ? t('Homepage:') : False; $profile['online'] = $profile['online_status'] === 'online' ? t('Online Now') : False; // logger('online: ' . $profile['online']); if (!perm_is_allowed($profile['uid'], is_array($observer) ? $observer['xchan_hash'] : '', 'view_profile')) { $block = true; } if ($profile['hidewall'] && !local_channel() && !remote_channel() || $block) { $location = $reddress = $pdesc = $gender = $marital = $homepage = False; } $firstname = strpos($profile['channel_name'], ' ') ? trim(substr($profile['channel_name'], 0, strpos($profile['channel_name'], ' '))) : $profile['channel_name']; $lastname = $firstname === $profile['channel_name'] ? '' : trim(substr($profile['channel_name'], strlen($firstname))); $diaspora = array('podloc' => z_root(), 'searchable' => $block ? 'false' : 'true', 'nickname' => $profile['channel_address'], 'fullname' => $profile['channel_name'], 'firstname' => $firstname, 'lastname' => $lastname, 'photo300' => z_root() . '/photo/profile/300/' . $profile['uid'] . '.jpg', 'photo100' => z_root() . '/photo/profile/100/' . $profile['uid'] . '.jpg', 'photo50' => z_root() . '/photo/profile/50/' . $profile['uid'] . '.jpg'); $contact_block = contact_block(); $channel_menu = false; $menu = get_pconfig($profile['uid'], 'system', 'channel_menu'); if ($menu && !$block) { require_once 'include/menu.php'; $m = menu_fetch($menu, $profile['uid'], $observer['xchan_hash']); if ($m) { $channel_menu = menu_render($m); } } $menublock = get_pconfig($profile['uid'], 'system', 'channel_menublock'); if ($menublock && !$block) { require_once 'include/comanche.php'; $channel_menu .= comanche_block($menublock); } $tpl = get_markup_template('profile_vcard.tpl'); require_once 'include/widgets.php'; $z = widget_rating(array('target' => $profile['channel_hash'])); $o .= replace_macros($tpl, array('$profile' => $profile, '$connect' => $connect, '$connect_url' => $connect_url, '$location' => $location, '$gender' => $gender, '$pdesc' => $pdesc, '$marital' => $marital, '$homepage' => $homepage, '$chanmenu' => $channel_menu, '$diaspora' => $diaspora, '$reddress' => $reddress, '$rating' => $z, '$contact_block' => $contact_block)); $arr = array('profile' => &$profile, 'entry' => &$o); call_hooks('profile_sidebar', $arr); return $o; }
function mitem_content(&$a) { $uid = local_channel(); $channel = $a->get_channel(); $observer = $a->get_observer(); $ob_hash = $observer ? $observer['xchan_hash'] : ''; if ($a->is_sys && is_site_admin()) { $sys = get_sys_channel(); $uid = intval($sys['channel_id']); $channel = $sys; $ob_hash = $sys['xchan_hash']; } if (!$uid) { notice(t('Permission denied.') . EOL); return ''; } if (argc() < 2 || !$a->data['menu']) { notice(t('Not found.') . EOL); return ''; } $m = menu_fetch($a->data['menu']['menu_name'], $uid, $ob_hash); $a->data['menu_item'] = $m; $menu_list = menu_list($uid); foreach ($menu_list as $menus) { if ($menus['menu_name'] != $m['menu']['menu_name']) { $menu_names[] = $menus['menu_name']; } } $acl = new AccessList($channel); $lockstate = $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid'] ? 'lock' : 'unlock'; if (argc() == 2) { $r = q("select * from menu_item where mitem_menu_id = %d and mitem_channel_id = %d order by mitem_order asc, mitem_desc asc", intval($a->data['menu']['menu_id']), intval($uid)); if ($_GET['display']) { $display = $_GET['display']; } else { $display = $r ? 'none' : 'block'; } $create = replace_macros(get_markup_template('mitemedit.tpl'), array('$menu_id' => $a->data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("(click to open/close)"), '$aclselect' => populate_acl($acl->get(), false), '$mitem_desc' => array('mitem_desc', t('Link Name'), '', 'Visible name of the link', '*'), '$mitem_link' => array('mitem_link', t('Link or Submenu Target'), '', t('Enter URL of the link or select a menu name to create a submenu'), '*', 'list="menu-names"'), '$usezid' => array('usezid', t('Use magic-auth if available'), true, '', array(t('No'), t('Yes'))), '$newwin' => array('newwin', t('Open link in new window'), false, '', array(t('No'), t('Yes'))), '$mitem_order' => array('mitem_order', t('Order in list'), '0', t('Higher numbers will sink to bottom of listing')), '$submit' => t('Submit and finish'), '$submit_more' => t('Submit and continue'), '$display' => $display, '$lockstate' => $lockstate, '$menu_names' => $menu_names, '$sys' => $a->is_sys)); $o .= replace_macros(get_markup_template('mitemlist.tpl'), array('$title' => t('Menu:'), '$create' => $create, '$nametitle' => t('Link Name'), '$targettitle' => t('Link Target'), '$menuname' => $a->data['menu']['menu_name'], '$menudesc' => $a->data['menu']['menu_desc'], '$edmenu' => t('Edit menu'), '$menu_id' => $a->data['menu']['menu_id'], '$mlist' => $r, '$edit' => t('Edit element'), '$drop' => t('Drop element'), '$new' => t('New element'), '$hintmenu' => t('Edit this menu container'), '$hintnew' => t('Add menu element'), '$hintdrop' => t('Delete this menu item'), '$hintedit' => t('Edit this menu item'))); return $o; } if (argc() > 2) { if (intval(argv(2))) { $m = q("select * from menu_item where mitem_id = %d and mitem_channel_id = %d limit 1", intval(argv(2)), intval($uid)); if (!$m) { notice(t('Menu item not found.') . EOL); goaway(z_root() . '/menu' . ($a->is_sys ? '?f=&sys=1' : '')); } $mitem = $m[0]; $lockstate = $mitem['allow_cid'] || $mitem['allow_gid'] || $mitem['deny_cid'] || $mitem['deny_gid'] ? 'lock' : 'unlock'; if (argc() == 4 && argv(3) == 'drop') { menu_sync_packet($uid, get_observer_hash(), $mitem['mitem_menu_id']); $r = menu_del_item($mitem['mitem_menu_id'], $uid, intval(argv(2))); menu_sync_packet($uid, get_observer_hash(), $mitem['mitem_menu_id']); if ($r) { info(t('Menu item deleted.') . EOL); } else { notice(t('Menu item could not be deleted.') . EOL); } goaway(z_root() . '/mitem/' . $mitem['mitem_menu_id'] . ($a->is_sys ? '?f=&sys=1' : '')); } // edit menu item $o = replace_macros(get_markup_template('mitemedit.tpl'), array('$header' => t('Edit Menu Element'), '$menu_id' => $a->data['menu']['menu_id'], '$permissions' => t('Menu Item Permissions'), '$permdesc' => t("(click to open/close)"), '$aclselect' => populate_acl($mitem, false), '$mitem_id' => intval(argv(2)), '$mitem_desc' => array('mitem_desc', t('Link text'), $mitem['mitem_desc'], '', '*'), '$mitem_link' => array('mitem_link', t('Link or Submenu Target'), $mitem['mitem_link'], 'Enter URL of the link or select a menu name to create a submenu', '*', 'list="menu-names"'), '$usezid' => array('usezid', t('Use magic-auth if available'), $mitem['mitem_flags'] & MENU_ITEM_ZID ? 1 : 0, '', array(t('No'), t('Yes'))), '$newwin' => array('newwin', t('Open link in new window'), $mitem['mitem_flags'] & MENU_ITEM_NEWWIN ? 1 : 0, '', array(t('No'), t('Yes'))), '$mitem_order' => array('mitem_order', t('Order in list'), $mitem['mitem_order'], t('Higher numbers will sink to bottom of listing')), '$submit' => t('Submit'), '$lockstate' => $lockstate, '$menu_names' => $menu_names)); return $o; } } }
function menu($s, $class = '') { $channel_id = $this->get_channel_id(); $name = $s; $cnt = preg_match_all("/\\[var=(.*?)\\](.*?)\\[\\/var\\]/ism", $s, $matches, PREG_SET_ORDER); if ($cnt) { foreach ($matches as $mtch) { $var[$mtch[1]] = $mtch[2]; $name = str_replace($mtch[0], '', $name); } } if ($channel_id) { $m = menu_fetch($name, $channel_id, get_observer_hash()); return menu_render($m, $class, $edit = false, $var); } }
/** * @brief Formats a profile for display in the sidebar. * * It is very difficult to templatise the HTML completely * because of all the conditional logic. * * @param array $profile * @param int $block * @param boolean $show_connect * * @return HTML string suitable for sidebar inclusion * Exceptions: Returns empty string if passed $profile is wrong type or not populated */ function profile_sidebar($profile, $block = 0, $show_connect = true, $zcard = false) { $observer = App::get_observer(); $o = ''; $location = false; $pdesc = true; $reddress = true; if (!perm_is_allowed($profile['uid'], is_array($observer) ? $observer['xchan_hash'] : '', 'view_profile')) { $block = true; } if (!is_array($profile) && !count($profile)) { return $o; } head_set_icon($profile['thumb']); if (is_sys_channel($profile['uid'])) { $show_connect = false; } $profile['picdate'] = urlencode($profile['picdate']); call_hooks('profile_sidebar_enter', $profile); if ($show_connect) { // This will return an empty string if we're already connected. $connect_url = rconnect_url($profile['uid'], get_observer_hash()); $connect = $connect_url ? t('Connect') : ''; if ($connect_url) { $connect_url = sprintf($connect_url, urlencode(channel_reddress($profile))); } // premium channel - over-ride if ($profile['channel_pageflags'] & PAGE_PREMIUM) { $connect_url = z_root() . '/connect/' . $profile['channel_address']; } } if (x($profile, 'address') == 1 || x($profile, 'locality') == 1 || x($profile, 'region') == 1 || x($profile, 'postal_code') == 1 || x($profile, 'country_name') == 1) { $location = t('Location:'); } $profile['homepage'] = linkify($profile['homepage'], true); $gender = x($profile, 'gender') == 1 ? t('Gender:') : False; $marital = x($profile, 'marital') == 1 ? t('Status:') : False; $homepage = x($profile, 'homepage') == 1 ? t('Homepage:') : False; $profile['online'] = $profile['online_status'] === 'online' ? t('Online Now') : False; // logger('online: ' . $profile['online']); if ($profile['hidewall'] && !local_channel() && !remote_channel() || $block) { $location = $reddress = $pdesc = $gender = $marital = $homepage = False; } $firstname = strpos($profile['channel_name'], ' ') ? trim(substr($profile['channel_name'], 0, strpos($profile['channel_name'], ' '))) : $profile['channel_name']; $lastname = $firstname === $profile['channel_name'] ? '' : trim(substr($profile['channel_name'], strlen($firstname))); $diaspora = array('podloc' => z_root(), 'guid' => $profile['channel_guid'] . str_replace('.', '', App::get_hostname()), 'pubkey' => pemtorsa($profile['channel_pubkey']), 'searchable' => $block ? 'false' : 'true', 'nickname' => $profile['channel_address'], 'fullname' => $profile['channel_name'], 'firstname' => $firstname, 'lastname' => $lastname, 'photo300' => z_root() . '/photo/profile/300/' . $profile['uid'] . '.jpg', 'photo100' => z_root() . '/photo/profile/100/' . $profile['uid'] . '.jpg', 'photo50' => z_root() . '/photo/profile/50/' . $profile['uid'] . '.jpg'); $contact_block = contact_block(); $channel_menu = false; $menu = get_pconfig($profile['uid'], 'system', 'channel_menu'); if ($menu && !$block) { require_once 'include/menu.php'; $m = menu_fetch($menu, $profile['uid'], $observer['xchan_hash']); if ($m) { $channel_menu = menu_render($m); } } $menublock = get_pconfig($profile['uid'], 'system', 'channel_menublock'); if ($menublock && !$block) { $comanche = new Zotlabs\Render\Comanche(); $channel_menu .= $comanche->block($menublock); } if ($zcard) { $tpl = get_markup_template('profile_vcard_short.tpl'); } else { $tpl = get_markup_template('profile_vcard.tpl'); } require_once 'include/widgets.php'; // if(! feature_enabled($profile['uid'],'hide_rating')) $z = widget_rating(array('target' => $profile['channel_hash'])); $o .= replace_macros($tpl, array('$zcard' => $zcard, '$profile' => $profile, '$connect' => $connect, '$connect_url' => $connect_url, '$location' => $location, '$gender' => $gender, '$pdesc' => $pdesc, '$marital' => $marital, '$homepage' => $homepage, '$chanmenu' => $channel_menu, '$diaspora' => $diaspora, '$reddress' => $reddress, '$rating' => $z, '$contact_block' => $contact_block, '$editmenu' => profile_edit_menu($profile['uid']))); $arr = array('profile' => &$profile, 'entry' => &$o); call_hooks('profile_sidebar', $arr); return $o; }
function menu_sync_packet($uid, $observer_hash, $menu_id, $delete = false) { $r = menu_fetch_id($menu_id, $uid); if ($r) { $m = menu_fetch($r['menu_name'], $uid, $observer_hash); if ($m) { if ($delete) { $m['menu_delete'] = 1; } build_sync_packet($uid, array('menu' => array(menu_element($m)))); } } }