本文整理汇总了PHP中profile_tabs函数的典型用法代码示例。如果您正苦于以下问题:PHP profile_tabs函数的具体用法?PHP profile_tabs怎么用?PHP profile_tabs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了profile_tabs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bookmarks_content
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;
}
示例2: get
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;
}
示例3: notes_content
function notes_content(&$a, $update = false)
{
if (!local_user()) {
notice(t('Permission denied.') . EOL);
return;
}
require_once "include/bbcode.php";
require_once 'include/security.php';
require_once 'include/conversation.php';
require_once 'include/acl_selectors.php';
$groups = array();
$o = '';
$remote_contact = false;
$contact_id = $_SESSION['cid'];
$contact = $a->contact;
$is_owner = true;
$o = "";
$o .= profile_tabs($a, True);
if (!$update) {
$o .= '<h3>' . t('Personal Notes') . '</h3>';
$commpage = false;
$commvisitor = false;
$celeb = false;
$x = array('is_owner' => $is_owner, 'allow_location' => $a->user['allow_location'] ? true : false, 'default_location' => $a->user['default-location'], 'nickname' => $a->user['nickname'], 'lockstate' => 'lock', 'acl' => '', 'bang' => '', 'visitor' => 'block', 'profile_uid' => local_user(), 'button' => t('Save'), 'acl_data' => '');
$o .= status_editor($a, $x, $a->contact['id']);
}
// Construct permissions
// default permissions - anonymous user
$sql_extra = " AND `allow_cid` = '<" . $a->contact['id'] . ">' ";
$r = q("SELECT COUNT(*) AS `total`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tWHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 \n\t\tAND `item`.`deleted` = 0 AND `item`.`type` = 'note'\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1\n\t\tAND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0\n\t\t{$sql_extra} ", intval(local_user()));
if (count($r)) {
$a->set_pager_total($r[0]['total']);
$a->set_pager_itemspage(40);
}
$r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`\n\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\tWHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 \n\t\tand `item`.`moderated` = 0 AND `item`.`type` = 'note'\n\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1\n\t\tAND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0\n\t\t{$sql_extra}\n\t\tORDER BY `item`.`created` DESC LIMIT %d ,%d ", intval(local_user()), intval($a->pager['start']), intval($a->pager['itemspage']));
$parents_arr = array();
$parents_str = '';
if (count($r)) {
foreach ($r as $rr) {
$parents_arr[] = $rr['item_id'];
}
$parents_str = implode(', ', $parents_arr);
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`, \n\t\t\t`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`network`, `contact`.`rel`, \n\t\t\t`contact`.`thumb`, `contact`.`self`, `contact`.`writable`, \n\t\t\t`contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`\n\t\t\tFROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`\n\t\t\tWHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0\n\t\t\tAND `contact`.`blocked` = 0 AND `contact`.`pending` = 0\n\t\t\tAND `item`.`parent` IN ( %s )\n\t\t\t{$sql_extra}\n\t\t\tORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ", intval(local_user()), dbesc($parents_str));
if (count($r)) {
$items = conv_sort($r, "`commented`");
$o .= conversation($a, $items, 'notes', $update);
}
}
$o .= paginate($a);
return $o;
}
示例4: viewcontacts_content
function viewcontacts_content(&$a)
{
require_once "mod/proxy.php";
if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
notice(t('Public access denied.') . EOL);
return;
}
if (!count($a->profile) || $a->profile['hide-friends']) {
notice(t('Permission denied.') . EOL);
return;
}
$o = "";
// tabs
$o .= profile_tabs($a, $is_owner, $a->data['user']['nickname']);
$r = q("SELECT COUNT(*) AS `total` FROM `contact`\n\t\tWHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0\n\t\t\tAND `network` IN ('%s', '%s', '%s')", intval($a->profile['uid']), dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS));
if (count($r)) {
$a->set_pager_total($r[0]['total']);
}
$r = q("SELECT * FROM `contact`\n\t\tWHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0\n\t\t\tAND `network` IN ('%s', '%s', '%s')\n\t\tORDER BY `name` ASC LIMIT %d, %d", intval($a->profile['uid']), dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS), intval($a->pager['start']), intval($a->pager['itemspage']));
if (!count($r)) {
info(t('No contacts.') . EOL);
return $o;
}
$contacts = array();
foreach ($r as $rr) {
if ($rr['self']) {
continue;
}
$url = $rr['url'];
// route DFRN profiles through the redirect
$is_owner = local_user() && $a->profile['profile_uid'] == local_user() ? true : false;
if ($is_owner && $rr['network'] === NETWORK_DFRN && $rr['rel']) {
$url = 'redir/' . $rr['id'];
} else {
$url = zrl($url);
}
$contact_details = get_contact_details_by_url($rr['url'], $a->profile['uid']);
$contacts[] = array('id' => $rr['id'], 'img_hover' => sprintf(t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']), 'photo_menu' => contact_photo_menu($rr), 'thumb' => proxy_url($rr['thumb'], false, PROXY_SIZE_THUMB), 'name' => htmlentities(substr($rr['name'], 0, 20)), 'username' => htmlentities($rr['name']), 'details' => $contact_details['location'], 'tags' => $contact_details['keywords'], 'about' => $contact_details['about'], 'account_type' => $contact_details['community'] ? t('Forum') : '', 'url' => $url, 'sparkle' => '', 'itemurl' => $contact_details['addr'] != "" ? $contact_details['addr'] : $rr['url'], 'network' => network_to_name($rr['network'], $rr['url']));
}
$tpl = get_markup_template("viewcontact_template.tpl");
$o .= replace_macros($tpl, array('$title' => t('Contacts'), '$contacts' => $contacts, '$paginate' => paginate($a)));
return $o;
}
示例5: profile_content
function profile_content(&$a, $update = 0)
{
if (get_config('system', 'block_public') && !get_account_id() && !remote_channel()) {
return login();
}
$groups = array();
$tab = 'profile';
$o = '';
if (!perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_profile')) {
notice(t('Permission denied.') . EOL);
return;
}
$is_owner = local_channel() && local_channel() == $a->profile['profile_uid'] ? true : false;
if ($a->profile['hidewall'] && !$is_owner && !remote_channel()) {
notice(t('Permission denied.') . EOL);
return;
}
$o .= profile_tabs($a, $is_owner, $a->profile['channel_address']);
$o .= advanced_profile($a);
call_hooks('profile_advanced', $o);
return $o;
}
示例6: profile_content
function profile_content(&$a, $update = 0)
{
if (get_config('system', 'block_public') && !get_account_id() && !remote_channel()) {
return login();
}
$groups = array();
$tab = 'profile';
$o = '';
if (!perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_profile')) {
notice(t('Permission denied.') . EOL);
return;
}
$is_owner = local_channel() && local_channel() == $a->profile['profile_uid'] ? true : false;
if ($a->profile['hidewall'] && !$is_owner && !remote_channel()) {
notice(t('Permission denied.') . EOL);
return;
}
$o .= profile_tabs($a, $is_owner, $a->profile['channel_address']);
$a->page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . $a->query_string) . '" title="oembed" />' . "\r\n";
$o .= advanced_profile($a);
call_hooks('profile_advanced', $o);
return $o;
}
示例7: get
function get()
{
if (observer_prohibited(true)) {
return login();
}
$groups = array();
$tab = 'profile';
$o = '';
if (!perm_is_allowed(\App::$profile['profile_uid'], get_observer_hash(), 'view_profile')) {
notice(t('Permission denied.') . EOL);
return;
}
$is_owner = local_channel() && local_channel() == \App::$profile['profile_uid'] ? true : false;
if (\App::$profile['hidewall'] && !$is_owner && !remote_channel()) {
notice(t('Permission denied.') . EOL);
return;
}
$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']);
\App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string) . '" title="oembed" />' . "\r\n";
$o .= advanced_profile($a);
call_hooks('profile_advanced', $o);
return $o;
}
示例8: photos_content
//.........这里部分代码省略.........
if (remote_user() && !$visitor) {
$contact_id = 0;
if (is_array($_SESSION['remote'])) {
foreach ($_SESSION['remote'] as $v) {
if ($v['uid'] == $owner_uid) {
$contact_id = $v['cid'];
break;
}
}
}
if ($contact_id) {
$groups = init_groups_visitor($contact_id);
$r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1", intval($contact_id), intval($owner_uid));
if (count($r)) {
$contact = $r[0];
$remote_contact = true;
}
}
}
if (!$remote_contact) {
if (local_user()) {
$contact_id = $_SESSION['cid'];
$contact = $a->contact;
}
}
if ($a->data['user']['hidewall'] && local_user() != $owner_uid && !$remote_contact) {
notice(t('Access to this item is restricted.') . EOL);
return;
}
$sql_extra = permissions_sql($owner_uid, $remote_contact, $groups);
$o = "";
// tabs
$_is_owner = local_user() && local_user() == $owner_uid;
$o .= profile_tabs($a, $_is_owner, $a->data['user']['nickname']);
//
// dispatch request
//
if ($datatype === 'upload') {
if (!$can_post) {
notice(t('Permission denied.'));
return;
}
$selname = $datum ? hex2bin($datum) : '';
$albumselect = '';
$albumselect .= '<option value="" ' . (!$selname ? ' selected="selected" ' : '') . '> </option>';
if (count($a->data['albums'])) {
foreach ($a->data['albums'] as $album) {
if ($album['album'] === '' || $album['album'] === 'Contact Photos' || $album['album'] === t('Contact Photos')) {
continue;
}
$selected = $selname === $album['album'] ? ' selected="selected" ' : '';
$albumselect .= '<option value="' . $album['album'] . '"' . $selected . '>' . $album['album'] . '</option>';
}
}
$celeb = $a->user['page-flags'] == PAGE_SOAPBOX || $a->user['page-flags'] == PAGE_COMMUNITY ? true : false;
$uploader = '';
$ret = array('post_url' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'], 'addon_text' => $uploader, 'default_upload' => true);
call_hooks('photo_upload_form', $ret);
$default_upload_box = replace_macros(get_markup_template('photos_default_uploader_box.tpl'), array());
$default_upload_submit = replace_macros(get_markup_template('photos_default_uploader_submit.tpl'), array('$submit' => t('Submit')));
$usage_message = '';
$limit = service_class_fetch($a->data['user']['uid'], 'photo_upload_limit');
if ($limit !== false) {
$r = q("select sum(datasize) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ", intval($a->data['user']['uid']));
$usage_message = sprintf(t("You have used %1\$.2f Mbytes of %2\$.2f Mbytes photo storage."), $r[0]['total'] / 1024000, $limit / 1024000);
}
示例9: photos_content
function photos_content(&$a)
{
// URLs:
// photos/name
// photos/name/upload
// photos/name/upload/xxxxx (xxxxx is album name)
// photos/name/album/xxxxx
// photos/name/album/xxxxx/edit
// photos/name/image/xxxxx
// photos/name/image/xxxxx/edit
if (get_config('system', 'block_public') && !local_user() && !remote_user()) {
notice(t('Public access denied.') . EOL);
return;
}
require_once 'include/bbcode.php';
require_once 'include/security.php';
require_once 'include/conversation.php';
if (!x($a->data, 'user')) {
notice(t('No photos selected') . EOL);
return;
}
$_SESSION['photo_return'] = $a->cmd;
//
// Parse arguments
//
if ($a->argc > 3) {
$datatype = $a->argv[2];
$datum = $a->argv[3];
} elseif ($a->argc > 2 && $a->argv[2] === 'upload') {
$datatype = 'upload';
} else {
$datatype = 'summary';
}
if ($a->argc > 4) {
$cmd = $a->argv[4];
} else {
$cmd = 'view';
}
//
// Setup permissions structures
//
$can_post = false;
$visitor = 0;
$contact = null;
$remote_contact = false;
$owner_uid = $a->data['user']['uid'];
$community_page = $a->data['user']['page-flags'] == PAGE_COMMUNITY ? true : false;
if (local_user() && local_user() == $owner_uid) {
$can_post = true;
} else {
if ($community_page && remote_user()) {
$r = q("SELECT `uid` FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1", intval(remote_user()), intval($owner_uid));
if (count($r)) {
$can_post = true;
$contact = $r[0];
$remote_contact = true;
$visitor = remote_user();
}
}
}
// perhaps they're visiting - but not a community page, so they wouldn't have write access
if (remote_user() && !$visitor) {
$contact_id = $_SESSION['visitor_id'];
$groups = init_groups_visitor($contact_id);
$r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `id` = %d AND `uid` = %d LIMIT 1", intval(remote_user()), intval($owner_uid));
if (count($r)) {
$contact = $r[0];
$remote_contact = true;
}
}
if (!$remote_contact) {
if (local_user()) {
$contact_id = $_SESSION['cid'];
$contact = $a->contact;
}
}
if ($a->data['user']['hidewall'] && local_user() != $owner_uid && !$remote_contact) {
notice(t('Access to this item is restricted.') . EOL);
return;
}
$sql_extra = permissions_sql($owner_uid, $remote_contact, $groups);
$o = "";
// tabs
$_is_owner = local_user() && local_user() == $owner_uid;
$o .= profile_tabs($a, $_is_owner, $a->data['user']['nickname']);
//
// dispatch request
//
if ($datatype === 'upload') {
if (!$can_post) {
notice(t('Permission denied.'));
return;
}
$selname = $datum ? hex2bin($datum) : '';
$albumselect = '<select id="photos-upload-album-select" name="album" size="4">';
$albumselect .= '<option value="" ' . (!$selname ? ' selected="selected" ' : '') . '> </option>';
if (count($a->data['albums'])) {
foreach ($a->data['albums'] as $album) {
if ($album['album'] === '' || $album['album'] === 'Contact Photos' || $album['album'] === t('Contact Photos')) {
continue;
//.........这里部分代码省略.........
示例10: get
function get($update = 0, $load = false)
{
if ($load) {
$_SESSION['loadtime'] = datetime_convert();
}
$checkjs = new \Zotlabs\Web\CheckJS(1);
$category = $datequery = $datequery2 = '';
$mid = x($_REQUEST, 'mid') ? $_REQUEST['mid'] : '';
$datequery = x($_GET, 'dend') && is_a_date_arg($_GET['dend']) ? notags($_GET['dend']) : '';
$datequery2 = x($_GET, 'dbegin') && is_a_date_arg($_GET['dbegin']) ? notags($_GET['dbegin']) : '';
if (observer_prohibited(true)) {
return login();
}
$category = x($_REQUEST, 'cat') ? $_REQUEST['cat'] : '';
$hashtags = x($_REQUEST, 'tag') ? $_REQUEST['tag'] : '';
$groups = array();
$o = '';
if ($update) {
// Ensure we've got a profile owner if updating.
\App::$profile['profile_uid'] = \App::$profile_uid = $update;
} else {
if (\App::$profile['profile_uid'] == local_channel()) {
nav_set_selected('home');
}
}
$is_owner = local_channel() && \App::$profile['profile_uid'] == local_channel() ? true : false;
$channel = \App::get_channel();
$observer = \App::get_observer();
$ob_hash = $observer ? $observer['xchan_hash'] : '';
$perms = get_all_perms(\App::$profile['profile_uid'], $ob_hash);
if (!$perms['view_stream']) {
// We may want to make the target of this redirect configurable
if ($perms['view_profile']) {
notice(t('Insufficient permissions. Request redirected to profile page.') . EOL);
goaway(z_root() . "/profile/" . \App::$profile['channel_address']);
}
notice(t('Permission denied.') . EOL);
return;
}
if (!$update) {
$o .= profile_tabs($a, $is_owner, \App::$profile['channel_address']);
$o .= common_friends_visitor_widget(\App::$profile['profile_uid']);
if ($channel && $is_owner) {
$channel_acl = 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']);
} else {
$channel_acl = array();
}
if ($perms['post_wall']) {
$x = array('is_owner' => $is_owner, 'allow_location' => ($is_owner || $observer) && intval(get_pconfig(\App::$profile['profile_uid'], 'system', 'use_browser_location')) ? true : false, 'default_location' => $is_owner ? \App::$profile['channel_location'] : '', 'nickname' => \App::$profile['channel_address'], 'lockstate' => strlen(\App::$profile['channel_allow_cid']) || strlen(\App::$profile['channel_allow_gid']) || strlen(\App::$profile['channel_deny_cid']) || strlen(\App::$profile['channel_deny_gid']) ? 'lock' : 'unlock', 'acl' => $is_owner ? populate_acl($channel_acl, true, \PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post') : '', 'showacl' => $is_owner ? 'yes' : '', 'bang' => '', 'visitor' => $is_owner || $observer ? true : false, 'profile_uid' => \App::$profile['profile_uid'], 'editor_autocomplete' => true, 'bbco_autocomplete' => 'bbcode', 'bbcode' => true);
$o .= status_editor($a, $x);
}
}
/**
* Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
*/
$item_normal = item_normal();
$sql_extra = item_permissions_sql(\App::$profile['profile_uid']);
if (get_pconfig(\App::$profile['profile_uid'], 'system', 'channel_list_mode') && !$mid) {
$page_mode = 'list';
} else {
$page_mode = 'client';
}
$abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " ";
$simple_update = $update ? " AND item_unseen = 1 " : '';
\App::$page['htmlhead'] .= "\r\n" . '<link rel="alternate" type="application/json+oembed" href="' . z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string) . '" title="oembed" />' . "\r\n";
if ($update && $_SESSION['loadtime']) {
$simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC', 'UTC', $_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC', 'UTC', $_SESSION['loadtime']) . "' ) ";
}
if ($load) {
$simple_update = '';
}
if ($update && !$load) {
if ($mid) {
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d {$item_normal}\n\t\t\t\t\tAND item_wall = 1 AND item_unseen = 1 {$sql_extra} limit 1", dbesc($mid . '%'), intval(\App::$profile['profile_uid']));
} else {
$r = q("SELECT distinct parent AS `item_id`, created from item\n\t\t\t\t\tleft join abook on ( item.owner_xchan = abook.abook_xchan {$abook_uids} )\n\t\t\t\t\tWHERE uid = %d {$item_normal}\n\t\t\t\t\tAND item_wall = 1 {$simple_update}\n\t\t\t\t\tAND (abook.abook_blocked = 0 or abook.abook_flags is null)\n\t\t\t\t\t{$sql_extra}\n\t\t\t\t\tORDER BY created DESC", intval(\App::$profile['profile_uid']));
$_SESSION['loadtime'] = datetime_convert();
}
} else {
if (x($category)) {
$sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY));
}
if (x($hashtags)) {
$sql_extra .= protect_sprintf(term_query('item', $hashtags, TERM_HASHTAG, TERM_COMMUNITYTAG));
}
if ($datequery) {
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(), '', $datequery))));
}
if ($datequery2) {
$sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(), '', $datequery2))));
}
$itemspage = get_pconfig(local_channel(), 'system', 'itemspage');
\App::set_pager_itemspage(intval($itemspage) ? $itemspage : 20);
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
if ($load || $checkjs->disabled()) {
if ($mid) {
$r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d {$item_normal}\n\t\t\t\t\t\tAND item_wall = 1 {$sql_extra} limit 1", dbesc($mid), intval(\App::$profile['profile_uid']));
if (!$r) {
notice(t('Permission denied.') . EOL);
}
//.........这里部分代码省略.........
示例11: events_content
function events_content(&$a)
{
if (!local_channel()) {
notice(t('Permission denied.') . EOL);
return;
}
nav_set_selected('all_events');
if (argc() > 2 && argv(1) === 'ignore' && intval(argv(2))) {
$r = q("update event set ignore = 1 where id = %d and uid = %d", intval(argv(2)), intval(local_channel()));
}
if (argc() > 2 && argv(1) === 'unignore' && intval(argv(2))) {
$r = q("update event set ignore = 0 where id = %d and uid = %d", intval(argv(2)), intval(local_channel()));
}
$plaintext = true;
// if(feature_enabled(local_channel(),'richtext'))
// $plaintext = false;
$htpl = get_markup_template('event_head.tpl');
$a->page['htmlhead'] .= replace_macros($htpl, array('$baseurl' => $a->get_baseurl(), '$editselect' => $plaintext ? 'none' : 'textareas'));
$o = "";
// tabs
$channel = $a->get_channel();
$tabs = profile_tabs($a, True, $channel['channel_address']);
$mode = 'view';
$y = 0;
$m = 0;
$ignored = x($_REQUEST, 'ignored') ? " and ignored = " . intval($_REQUEST['ignored']) . " " : '';
if (argc() > 1) {
if (argc() > 2 && argv(1) == 'event') {
$mode = 'edit';
$event_id = argv(2);
}
if (argc() > 2 && argv(1) === 'add') {
$mode = 'add';
$item_id = intval(argv(2));
}
if (argc() > 2 && argv(1) === 'drop') {
$mode = 'drop';
$event_id = argv(2);
}
if (argv(1) === 'new') {
$mode = 'new';
$event_id = '';
}
if (argc() > 2 && intval(argv(1)) && intval(argv(2))) {
$mode = 'view';
$y = intval(argv(1));
$m = intval(argv(2));
}
}
if ($mode === 'add') {
event_addtocal($item_id, local_channel());
killme();
}
if ($mode == 'view') {
$thisyear = datetime_convert('UTC', date_default_timezone_get(), 'now', 'Y');
$thismonth = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm');
if (!$y) {
$y = intval($thisyear);
}
if (!$m) {
$m = intval($thismonth);
}
$export = false;
if (argc() === 4 && argv(3) === 'export') {
$export = true;
}
// Put some limits on dates. The PHP date functions don't seem to do so well before 1900.
// An upper limit was chosen to keep search engines from exploring links millions of years in the future.
if ($y < 1901) {
$y = 1900;
}
if ($y > 2099) {
$y = 2100;
}
$nextyear = $y;
$nextmonth = $m + 1;
if ($nextmonth > 12) {
$nextmonth = 1;
$nextyear++;
}
$prevyear = $y;
if ($m > 1) {
$prevmonth = $m - 1;
} else {
$prevmonth = 12;
$prevyear--;
}
$dim = get_dim($y, $m);
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
if (argv(1) === 'json') {
if (x($_GET, 'start')) {
$start = date("Y-m-d h:i:s", $_GET['start']);
}
if (x($_GET, 'end')) {
$finish = date("Y-m-d h:i:s", $_GET['end']);
}
}
$start = datetime_convert('UTC', 'UTC', $start);
$finish = datetime_convert('UTC', 'UTC', $finish);
//.........这里部分代码省略.........
示例12: usersMenus
// CicapEnabled
//ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string','');
$user = new usersMenus();
if ($user->AsDansGuardianAdministrator == false) {
die('not allowed');
}
if (isset($_GET["profiles-list"])) {
profiles_list();
exit;
}
if (isset($_GET["profile-js"])) {
profile_js();
exit;
}
if (isset($_GET["profile-tabs"])) {
profile_tabs();
exit;
}
if (isset($_GET["profile-popup"])) {
profile_popup();
exit;
}
if (isset($_GET["delete-profile-js"])) {
profile_delete_js();
exit;
}
if (isset($_POST["rulename"])) {
profile_save();
exit;
}
if (isset($_POST["delete-profile"])) {
示例13: chat_content
function chat_content(&$a)
{
if (local_channel()) {
$channel = $a->get_channel();
}
$ob = $a->get_observer();
$observer = get_observer_hash();
if (!$observer) {
notice(t('Permission denied.') . EOL);
return;
}
if (!perm_is_allowed($a->profile['profile_uid'], $observer, 'chat')) {
notice(t('Permission denied.') . EOL);
return;
}
if (argc() > 3 && intval(argv(2)) && argv(3) === 'leave') {
chatroom_leave($observer, argv(2), $_SERVER['REMOTE_ADDR']);
goaway(z_root() . '/channel/' . argv(1));
}
if (argc() > 3 && intval(argv(2)) && argv(3) === 'status') {
$ret = array('success' => false);
$room_id = intval(argv(2));
if (!$room_id || !$observer) {
return;
}
$r = q("select * from chatroom where cr_id = %d limit 1", intval($room_id));
if (!$r) {
json_return_and_die($ret);
}
require_once 'include/security.php';
$sql_extra = permissions_sql($r[0]['cr_uid']);
$x = q("select * from chatroom where cr_id = %d and cr_uid = %d {$sql_extra} limit 1", intval($room_id), intval($r[0]['cr_uid']));
if (!$x) {
json_return_and_die($ret);
}
$y = q("select count(*) as total from chatpresence where cp_room = %d", intval($room_id));
if ($y) {
$ret['success'] = true;
$ret['chatroom'] = $r[0]['cr_name'];
$ret['inroom'] = $y[0]['total'];
}
// figure out how to present a timestamp of the last activity, since we don't know the observer's timezone.
$z = q("select created from chat where chat_room = %d order by created desc limit 1", intval($room_id));
if ($z) {
$ret['last'] = $z[0]['created'];
}
json_return_and_die($ret);
}
if (argc() > 2 && intval(argv(2))) {
$room_id = intval(argv(2));
$bookmark_link = get_bookmark_link($ob);
$x = chatroom_enter($observer, $room_id, 'online', $_SERVER['REMOTE_ADDR']);
if (!$x) {
return;
}
$x = q("select * from chatroom where cr_id = %d and cr_uid = %d {$sql_extra} limit 1", intval($room_id), intval($a->profile['profile_uid']));
if ($x) {
$acl = new AccessList(false);
$acl->set($x[0]);
$private = $acl->is_private();
$room_name = $x[0]['cr_name'];
if ($bookmark_link) {
$bookmark_link .= '&url=' . z_root() . '/chat/' . argv(1) . '/' . argv(2) . '&title=' . urlencode($x[0]['cr_name']) . ($private ? '&private=1' : '') . '&ischat=1';
}
} else {
notice(t('Room not found') . EOL);
return;
}
$o = replace_macros(get_markup_template('chat.tpl'), array('$is_owner' => local_channel() && local_channel() == $x[0]['cr_uid'] ? true : false, '$room_name' => $room_name, '$room_id' => $room_id, '$baseurl' => z_root(), '$nickname' => argv(1), '$submit' => t('Submit'), '$leave' => t('Leave Room'), '$drop' => t('Delete This Room'), '$away' => t('I am away right now'), '$online' => t('I am online'), '$bookmark_link' => $bookmark_link, '$bookmark' => t('Bookmark this room')));
return $o;
}
if (local_channel() && argc() > 2 && argv(2) === 'new') {
$acl = new AccessList($channel);
$channel_acl = $acl->get();
require_once 'include/acl_selectors.php';
$o = replace_macros(get_markup_template('chatroom_new.tpl'), array('$header' => t('New Chatroom'), '$name' => array('room_name', t('Chatroom Name'), '', ''), '$chat_expire' => array('chat_expire', t('Expiration of chats (minutes)'), 120, ''), '$permissions' => t('Permissions'), '$acl' => populate_acl($channel_acl, false), '$submit' => t('Submit')));
return $o;
}
require_once 'include/conversation.php';
$o = profile_tabs($a, local_channel() && local_channel() == $a->profile['profile_uid'] ? true : false, $a->profile['channel_address']);
require_once 'include/widgets.php';
$o .= replace_macros(get_markup_template('chatrooms.tpl'), array('$header' => sprintf(t('%1$s\'s Chatrooms'), $a->profile['name']), '$baseurl' => z_root(), '$nickname' => $channel['channel_address'], '$rooms' => widget_chatroom_list(array()), '$newroom' => t('New Chatroom'), '$is_owner' => local_channel() && local_channel() == $a->profile['profile_uid'] ? 1 : 0));
return $o;
}
示例14: webpages_content
function webpages_content(&$a)
{
if (!App::$profile) {
notice(t('Requested profile is not available.') . EOL);
App::$error = 404;
return;
}
$which = argv(1);
$_SESSION['return_url'] = App::$query_string;
$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'] : '';
$perms = get_all_perms($owner, $ob_hash);
if (!$perms['write_pages']) {
notice(t('Permission denied.') . EOL);
return;
}
$mimetype = $_REQUEST['mimetype'] ? $_REQUEST['mimetype'] : get_pconfig($owner, 'system', 'page_mimetype');
if (!$mimetype) {
$mimetype = 'choose';
}
$layout = $_REQUEST['layout'] ? $_REQUEST['layout'] : get_pconfig($owner, 'system', 'page_layout');
if (!$layout) {
$layout = 'choose';
}
// 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 owner's.
// This lets you post pages at other people's channels.
if (!$channel && $uid && $uid == App::$profile_uid) {
$channel = App::get_channel();
}
if ($channel) {
$channel_acl = 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']);
} else {
$channel_acl = array();
}
$is_owner = $uid && $uid == $owner;
$o = profile_tabs($a, $is_owner, App::$profile['channel_address']);
$x = array('webpage' => ITEM_TYPE_WEBPAGE, 'is_owner' => true, 'nickname' => App::$profile['channel_address'], 'lockstate' => $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid'] ? 'lock' : 'unlock', 'bang' => '', 'acl' => $is_owner ? populate_acl($channel_acl, false) : '', 'showacl' => $is_owner ? true : false, 'visitor' => true, 'profile_uid' => intval($owner), 'mimetype' => $mimetype, 'layout' => $layout, 'expanded' => true, 'novoting' => true, 'bbco_autocomplete' => 'bbcode', 'bbcode' => true);
if ($_REQUEST['title']) {
$x['title'] = $_REQUEST['title'];
}
if ($_REQUEST['body']) {
$x['body'] = $_REQUEST['body'];
}
if ($_REQUEST['pagetitle']) {
$x['pagetitle'] = $_REQUEST['pagetitle'];
}
$editor = status_editor($a, $x);
// Get a list of webpages. 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 */
$sql_extra = item_permissions_sql($owner);
$r = q("select * from item_id left join item on item_id.iid = item.id \n\t\twhere item_id.uid = %d and service = 'WEBPAGE' and item_type = %d {$sql_extra} order by item.created desc", intval($owner), intval(ITEM_TYPE_WEBPAGE));
$pages = null;
if ($r) {
$pages = array();
foreach ($r as $rr) {
unobscure($rr);
$lockstate = $rr['allow_cid'] || $rr['allow_gid'] || $rr['deny_cid'] || $rr['deny_gid'] ? 'lock' : 'unlock';
$element_arr = array('type' => 'webpage', 'title' => $rr['title'], 'body' => $rr['body'], 'created' => $rr['created'], 'edited' => $rr['edited'], 'mimetype' => $rr['mimetype'], 'pagetitle' => $rr['sid'], 'mid' => $rr['mid'], 'layout_mid' => $rr['layout_mid']);
$pages[$rr['iid']][] = array('url' => $rr['iid'], 'pagetitle' => $rr['sid'], 'title' => $rr['title'], 'created' => datetime_convert('UTC', date_default_timezone_get(), $rr['created']), 'edited' => datetime_convert('UTC', date_default_timezone_get(), $rr['edited']), 'bb_element' => '[element]' . base64url_encode(json_encode($element_arr)) . '[/element]', 'lockstate' => $lockstate);
}
}
//Build the base URL for edit links
$url = z_root() . '/editwebpage/' . $which;
$o .= replace_macros(get_markup_template('webpagelist.tpl'), array('$listtitle' => t('Webpages'), '$baseurl' => $url, '$create' => t('Create'), '$edit' => t('Edit'), '$share' => t('Share'), '$delete' => t('Delete'), '$pages' => $pages, '$channel' => $which, '$editor' => $editor, '$view' => t('View'), '$preview' => t('Preview'), '$actions_txt' => t('Actions'), '$pagelink_txt' => t('Page Link'), '$title_txt' => t('Page Title'), '$created_txt' => t('Created'), '$edited_txt' => t('Edited')));
return $o;
}
示例15: generateDirectoryIndex
/**
* @brief Creates the directory listing for the given path.
*
* @param string $path which should be displayed
*/
public function generateDirectoryIndex($path)
{
// (owner_id = channel_id) is visitor owner of this directory?
$is_owner = local_user() && $this->auth->owner_id == local_user() ? true : false;
if ($this->auth->timezone) {
date_default_timezone_set($this->auth->timezone);
}
require_once 'include/conversation.php';
if ($this->auth->owner_nick) {
$html = profile_tabs(get_app(), $is_owner ? true : false, $this->auth->owner_nick);
}
$files = $this->server->getPropertiesForPath($path, array('{DAV:}displayname', '{DAV:}resourcetype', '{DAV:}getcontenttype', '{DAV:}getcontentlength', '{DAV:}getlastmodified'), 1);
$parent = $this->server->tree->getNodeForPath($path);
$parentpath = array();
// only show parent if not leaving /cloud/; TODO how to improve this?
if ($path && $path != "cloud") {
list($parentUri) = DAV\URLUtil::splitPath($path);
$fullPath = DAV\URLUtil::encodePath($this->server->getBaseUri() . $parentUri);
$parentpath['icon'] = $this->enableAssets ? '<a href="' . $fullPath . '"><img src="' . $this->getAssetUrl('icons/parent' . $this->iconExtension) . '" width="24" alt="' . t('parent') . '"></a>' : '';
$parentpath['path'] = $fullPath;
}
$f = array();
foreach ($files as $file) {
$ft = array();
$type = null;
// This is the current directory, we can skip it
if (rtrim($file['href'], '/') == $path) {
continue;
}
list(, $name) = DAV\URLUtil::splitPath($file['href']);
if (isset($file[200]['{DAV:}resourcetype'])) {
$type = $file[200]['{DAV:}resourcetype']->getValue();
// resourcetype can have multiple values
if (!is_array($type)) {
$type = array($type);
}
foreach ($type as $k => $v) {
// Some name mapping is preferred
switch ($v) {
case '{DAV:}collection':
$type[$k] = t('Collection');
break;
case '{DAV:}principal':
$type[$k] = t('Principal');
break;
case '{urn:ietf:params:xml:ns:carddav}addressbook':
$type[$k] = t('Addressbook');
break;
case '{urn:ietf:params:xml:ns:caldav}calendar':
$type[$k] = t('Calendar');
break;
case '{urn:ietf:params:xml:ns:caldav}schedule-inbox':
$type[$k] = t('Schedule Inbox');
break;
case '{urn:ietf:params:xml:ns:caldav}schedule-outbox':
$type[$k] = t('Schedule Outbox');
break;
case '{http://calendarserver.org/ns/}calendar-proxy-read':
$type[$k] = 'Proxy-Read';
break;
case '{http://calendarserver.org/ns/}calendar-proxy-write':
$type[$k] = 'Proxy-Write';
break;
}
}
$type = implode(', ', $type);
}
// If no resourcetype was found, we attempt to use
// the contenttype property
if (!$type && isset($file[200]['{DAV:}getcontenttype'])) {
$type = $file[200]['{DAV:}getcontenttype'];
}
if (!$type) {
$type = t('Unknown');
}
$size = isset($file[200]['{DAV:}getcontentlength']) ? (int) $file[200]['{DAV:}getcontentlength'] : '';
$lastmodified = isset($file[200]['{DAV:}getlastmodified']) ? $file[200]['{DAV:}getlastmodified']->getTime()->format('Y-m-d H:i:s') : '';
$fullPath = DAV\URLUtil::encodePath('/' . trim($this->server->getBaseUri() . ($path ? $path . '/' : '') . $name, '/'));
$displayName = isset($file[200]['{DAV:}displayname']) ? $file[200]['{DAV:}displayname'] : $name;
$displayName = $this->escapeHTML($displayName);
$type = $this->escapeHTML($type);
$icon = '';
if ($this->enableAssets) {
$node = $this->server->tree->getNodeForPath(($path ? $path . '/' : '') . $name);
foreach (array_reverse($this->iconMap) as $class => $iconName) {
if ($node instanceof $class) {
$icon = '<a href="' . $fullPath . '"><img src="' . $this->getAssetUrl($iconName . $this->iconExtension) . '" alt="" width="24"></a>';
break;
}
}
}
$parentHash = "";
$owner = $this->auth->owner_id;
$splitPath = split("/", $fullPath);
if (count($splitPath) > 3) {
//.........这里部分代码省略.........