本文整理汇总了PHP中fetch_post_tags函数 的典型用法代码示例。如果您正苦于以下问题:PHP fetch_post_tags函数的具体用法?PHP fetch_post_tags怎么用?PHP fetch_post_tags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_post_tags函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get
function get()
{
if (!local_channel()) {
goaway(z_root() . '/' . $_SESSION['photo_return']);
// NOTREACHED
}
// remove tag on the fly if item and tag are provided
if (argc() == 4 && argv(1) === 'drop' && intval(argv(2))) {
$item = intval(argv(2));
$tag = argv(3);
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_channel()));
if (!$r) {
goaway(z_root() . '/' . $_SESSION['photo_return']);
}
$r = fetch_post_tags($r, true);
$item = $r[0];
$new_tags = array();
if ($item['term']) {
for ($x = 0; $x < count($item['term']); $x++) {
if ($item['term'][$x]['term'] !== hex2bin($tag)) {
$new_tags[] = $item['term'][$x];
}
}
}
if ($new_tags) {
$item['term'] = $new_tags;
} else {
unset($item['term']);
}
item_store_update($item);
info(t('Tag removed') . EOL);
goaway(z_root() . '/' . $_SESSION['photo_return']);
}
//if we got only the item print a list of tags to select
if (argc() == 3 && argv(1) === 'drop' && intval(argv(2))) {
$o = '';
$item = intval(argv(2));
$r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item), intval(local_channel()));
if (!$r) {
goaway(z_root() . '/' . $_SESSION['photo_return']);
}
$r = fetch_post_tags($r, true);
if (!count($r[0]['term'])) {
goaway(z_root() . '/' . $_SESSION['photo_return']);
}
$o .= '<h3>' . t('Remove Item Tag') . '</h3>';
$o .= '<p id="tag-remove-desc">' . t('Select a tag to remove: ') . '</p>';
$o .= '<form id="tagrm" action="tagrm" method="post" >';
$o .= '<input type="hidden" name="item" value="' . $item . '" />';
$o .= '<ul>';
foreach ($r[0]['term'] as $x) {
$o .= '<li><input type="checkbox" name="tag" value="' . bin2hex($x['term']) . '" >' . bbcode($x['term']) . '</input></li>';
}
$o .= '</ul>';
$o .= '<input id="tagrm-submit" type="submit" name="submit" value="' . t('Remove') . '" />';
$o .= '<input id="tagrm-cancel" type="submit" name="submit" value="' . t('Cancel') . '" />';
$o .= '</form>';
return $o;
}
}
开发者ID:anmol26s, 项目名称:hubzilla-yunohost, 代码行数:60, 代码来源:Tagrm.php
示例2: bookmarks_init
function bookmarks_init(&$a)
{
if (!local_user()) {
return;
}
$item_id = intval($_REQUEST['item']);
if (!$item_id) {
return;
}
$u = $a->get_channel();
$i = q("select * from item where id = %d and uid = %d limit 1", intval($item_id), intval(local_user()));
if (!$i) {
return;
}
$i = fetch_post_tags($i);
$item = $i[0];
$terms = get_terms_oftype($item['term'], TERM_BOOKMARK);
if ($terms && !$item['item_restrict']) {
require_once 'include/bookmarks.php';
$s = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($item['author_xchan']));
if (!$s) {
logger('mod_bookmarks: author lookup failed.');
killme();
}
foreach ($terms as $t) {
bookmark_add($u, $s[0], $t, $item['item_private']);
info(t('Bookmark added') . EOL);
}
}
killme();
}
开发者ID:Mauru, 项目名称:red, 代码行数:31, 代码来源:bookmarks.php
示例3: search_doc_files
function search_doc_files($s)
{
$a = get_app();
$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']));
$regexop = db_getfunc('REGEXP');
$r = q("select item_id.sid, item.* from item left join item_id on item.id = item_id.iid where service = 'docfile' and\n\t\tbody {$regexop} '%s' and item_type = %d {$pager_sql}", dbesc($s), intval(ITEM_TYPE_DOC));
$r = fetch_post_tags($r, true);
for ($x = 0; $x < count($r); $x++) {
$r[$x]['text'] = $r[$x]['body'];
$r[$x]['rank'] = 0;
if ($r[$x]['term']) {
foreach ($r[$x]['term'] as $t) {
if (stristr($t['term'], $s)) {
$r[$x]['rank']++;
}
}
}
if (stristr($r[$x]['sid'], $s)) {
$r[$x]['rank']++;
}
$r[$x]['rank'] += substr_count(strtolower($r[$x]['text']), strtolower($s));
// bias the results to the observer's native language
if ($r[$x]['lang'] === App::$language) {
$r[$x]['rank'] = $r[$x]['rank'] + 10;
}
}
usort($r, 'doc_rank_sort');
return $r;
}
开发者ID:anmol26s, 项目名称:hubzilla-yunohost, 代码行数:31, 代码来源:help.php
示例4: init
function init()
{
$starred = 0;
if (!local_channel()) {
killme();
}
if (argc() > 1) {
$message_id = intval(argv(1));
}
if (!$message_id) {
killme();
}
$r = q("SELECT item_flags FROM item WHERE uid = %d AND id = %d LIMIT 1", intval(local_channel()), intval($message_id));
if (!count($r)) {
killme();
}
$item_starred = intval($r[0]['item_starred']) ? 0 : 1;
$r = q("UPDATE item SET item_starred = %d WHERE uid = %d and id = %d", intval($item_starred), intval(local_channel()), intval($message_id));
$r = q("select * from item where id = %d", intval($message_id));
if ($r) {
xchan_query($r);
$sync_item = fetch_post_tags($r);
build_sync_packet(local_channel(), ['item' => [encode_item($sync_item[0], true)]]);
}
header('Content-type: application/json');
echo json_encode(array('result' => $item_starred));
killme();
}
开发者ID:BlaBlaNet, 项目名称:hubzilla, 代码行数:28, 代码来源:Starred.php
示例5: init
function init()
{
if (argc() != 3 || !in_array(argv(1), ['post', 'status_message', 'reshare'])) {
http_status_exit(404, 'Not found');
}
$guid = argv(2);
// Fetch the item
$item = q("SELECT * from item where mid = '%s' and item_private = 0 and mid = parent_mid limit 1", dbesc($guid));
if (!$item) {
http_status_exit(404, 'Not found');
}
xchan_query($item);
$item = fetch_post_tags($item, true);
$channel = channelx_by_hash($item[0]['author_xchan']);
if (!$channel) {
$r = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($item[0]['author_xchan']));
if ($r) {
$url = $r[0]['xchan_url'];
if (strpos($url, z_root()) === false) {
$m = parse_url($url);
goaway($m['scheme'] . '://' . $m['host'] . ($m['port'] ? ':' . $m['port'] : '') . '/fetch/' . argv(1) . '/' . argv(2));
}
}
http_status_exit(404, 'Not found');
}
$status = diaspora_build_status($item[0], $channel);
header("Content-type: application/magic-envelope+xml; charset=utf-8");
echo diaspora_magic_env($channel, $status);
killme();
}
开发者ID:phellmes, 项目名称:hubzilla-addons, 代码行数:30, 代码来源:Mod_Fetch.php
示例6: page_content
function page_content(&$a)
{
$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']);
}
}
// logger('layout: ' . print_r($a->layout,true));
// Use of widgets should be determined by Comanche, but we don't have it on system pages yet, so...
if ($perms['write_pages']) {
$chan = $a->channel['channel_id'];
$who = $channel_address;
$which = $r[0]['id'];
$o .= writepages_widget($who, $which);
}
xchan_query($r);
$r = fetch_post_tags($r, true);
$o .= prepare_page($r[0]);
return $o;
}
开发者ID:Mauru, 项目名称:red, 代码行数:59, 代码来源:page.php
示例7: get
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;
}
开发者ID:anmol26s, 项目名称:hubzilla-yunohost, 代码行数:56, 代码来源:Editpost.php
示例8: home_content
function home_content(&$a)
{
$o = '';
if (x($_SESSION, 'theme')) {
unset($_SESSION['theme']);
}
if (x($_SESSION, 'mobile_theme')) {
unset($_SESSION['mobile_theme']);
}
$channel_address = get_config("system", "site_channel");
if ($channel_address) {
// We can do better, but until we figure out auto-linkification, let's keep things simple
$page_id = 'home';
$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;
}
$r = q("select item.* from item left join item_id on item.id = item_id.iid\n\t\t\twhere item.uid = %d and sid = '%s' and service = 'WEBPAGE' and \n\t\t\titem_restrict = %d limit 1", intval($u[0]['channel_id']), dbesc($page_id), intval(ITEM_WEBPAGE));
if (!$r) {
notice(t('Item not found.') . EOL);
return;
}
xchan_query($r);
$r = fetch_post_tags($r, true);
$a->profile = array('profile_uid' => $u[0]['channel_id']);
$o .= prepare_page($r[0]);
return $o;
}
if (get_config('system', 'projecthome')) {
$o .= file_get_contents('assets/home.html');
$a->page['template'] = 'full';
$a->page['title'] = t('Red Matrix - "The Network"');
return $o;
}
if (file_exists('home.html')) {
$o .= file_get_contents('home.html');
} else {
// If there's no site channel or home contents configured, fallback to the old behaviour
$sitename = get_config('system', 'sitename');
if ($sitename) {
$o .= '<h1>' . sprintf(t("Welcome to %s"), $sitename) . '</h1>';
}
if (!$a->config['system']['no_login_on_homepage']) {
$o .= login($a->config['system']['register_policy'] == REGISTER_CLOSED ? 0 : 1);
}
}
call_hooks('home_content', $o);
return $o;
}
开发者ID:Mauru, 项目名称:red, 代码行数:50, 代码来源:home.php
示例9: page_content
function page_content(&$a)
{
$r = $a->data['webpage'];
if (!$r) {
return;
}
if ($r[0]['item_restrict'] == ITEM_PDL) {
$r[0]['body'] = t('Lorem Ipsum');
$r[0]['mimetype'] = 'text/plain';
$r[0]['title'] = '';
}
xchan_query($r);
$r = fetch_post_tags($r, true);
$o .= prepare_page($r[0]);
return $o;
}
开发者ID:HaakonME, 项目名称:redmatrix, 代码行数:16, 代码来源:page.php
示例10: page_content
function page_content(&$a)
{
$r = $a->data['webpage'];
if (!$r) {
return;
}
if ($r[0]['item_type'] == ITEM_TYPE_PDL) {
$r[0]['body'] = t('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.');
$r[0]['mimetype'] = 'text/plain';
$r[0]['title'] = '';
}
xchan_query($r);
$r = fetch_post_tags($r, true);
$o .= prepare_page($r[0]);
return $o;
}
开发者ID:kenrestivo, 项目名称:hubzilla, 代码行数:16, 代码来源:page.php
示例11: page_content
function page_content(&$a)
{
$r = $a->data['webpage'];
if (!$r) {
return;
}
// logger('layout: ' . print_r($a->layout,true));
// Use of widgets should be determined by Comanche, but we don't have it on system pages yet, so...
// I recommend we now get rid of this bit - it's quite a hack to work around... - mike
if ($perms['write_pages']) {
$chan = $a->channel['channel_id'];
$who = $channel_address;
$which = $r[0]['id'];
$o .= writepages_widget($who, $which);
}
xchan_query($r);
$r = fetch_post_tags($r, true);
$o .= prepare_page($r[0]);
return $o;
}
开发者ID:redmatrix, 项目名称:red, 代码行数:20, 代码来源:page.php
示例12: block_content
function block_content(&$a)
{
if (!perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), '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 = 'BUILDBLOCK' and \n\t\titem_type = %d {$sql_options} {$revision} limit 1", intval($u[0]['channel_id']), dbesc($page_id), intval(ITEM_TYPE_BLOCK));
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 = 'BUILDBLOCK' and \n\t\titem_type = %d {$revision} limit 1", intval($u[0]['channel_id']), dbesc($page_id), intval(ITEM_TYPE_BLOCK));
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;
}
xchan_query($r);
$r = fetch_post_tags($r, true);
$o .= prepare_page($r[0]);
return $o;
}
开发者ID:msooon, 项目名称:hubzilla, 代码行数:41, 代码来源:block.php
示例13: ocmx_meta_keywords
function ocmx_meta_keywords()
{
global $post;
$obox_post_keywords = get_post_meta($post->ID, "ocmx_post_meta_keywords", true);
$obox_site_keywords = get_option("ocmx_meta_keywords");
$posttags = get_the_tags($post->ID);
if (get_option("ocmx_seo") == "yes") {
if ($obox_post_keywords !== "") {
echo "\n<meta name=\"keywords\" content=\"" . $obox_post_keywords . "\" />";
} elseif (is_singular() && fetch_post_tags($post->ID) !== "") {
echo "\n<meta name=\"keywords\" content=\"";
if ($posttags) {
foreach ($posttags as $tag) {
echo $tag->name . ',';
}
}
echo "\" />";
} elseif (is_home() && $obox_site_keywords !== "") {
echo "\n<meta name=\"keywords\" content=\"" . $obox_site_keywords . "\" />";
}
}
}
开发者ID:shimion, 项目名称:git, 代码行数:22, 代码来源:seo-functions.php
示例14: init
function init()
{
if (!local_channel()) {
return;
}
$item_id = intval($_REQUEST['item']);
$burl = trim($_REQUEST['burl']);
if (!$item_id) {
return;
}
$u = \App::get_channel();
$item_normal = item_normal();
$i = q("select * from item where id = %d and uid = %d {$item_normal} limit 1", intval($item_id), intval(local_channel()));
if (!$i) {
return;
}
$i = fetch_post_tags($i);
$item = $i[0];
$terms = get_terms_oftype($item['term'], TERM_BOOKMARK);
if ($terms) {
require_once 'include/bookmarks.php';
$s = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($item['author_xchan']));
if (!$s) {
logger('mod_bookmarks: author lookup failed.');
killme();
}
foreach ($terms as $t) {
if ($burl) {
if ($burl == $t['url']) {
bookmark_add($u, $s[0], $t, $item['item_private']);
}
} else {
bookmark_add($u, $s[0], $t, $item['item_private']);
}
info(t('Bookmark added') . EOL);
}
}
killme();
}
开发者ID:BlaBlaNet, 项目名称:hubzilla, 代码行数:39, 代码来源:Bookmarks.php
示例15: get
//.........这里部分代码省略.........
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);
}
} else {
$r = q("SELECT distinct id AS item_id, created FROM item \n\t\t\t\t\t\tleft join abook on item.author_xchan = abook.abook_xchan\n\t\t\t\t\t\tWHERE uid = %d {$item_normal}\n\t\t\t\t\t\tAND item_wall = 1 and item_thread_top = 1\n\t\t\t\t\t\tAND (abook_blocked = 0 or abook.abook_flags is null)\n\t\t\t\t\t\t{$sql_extra} {$sql_extra2}\n\t\t\t\t\t\tORDER BY created DESC {$pager_sql} ", intval(\App::$profile['profile_uid']));
}
} else {
$r = array();
}
}
if ($r) {
$parents_str = ids_to_querystr($r, 'item_id');
$items = q("SELECT `item`.*, `item`.`id` AS `item_id` \n\t\t\t\tFROM `item`\n\t\t\t\tWHERE `item`.`uid` = %d {$item_normal}\n\t\t\t\tAND `item`.`parent` IN ( %s )\n\t\t\t\t{$sql_extra} ", intval(\App::$profile['profile_uid']), dbesc($parents_str));
xchan_query($items);
$items = fetch_post_tags($items, true);
$items = conv_sort($items, 'created');
if ($load && $mid && !count($items)) {
// This will happen if we don't have sufficient permissions
// to view the parent item (or the item itself if it is toplevel)
notice(t('Permission denied.') . EOL);
}
} else {
$items = array();
}
if (!$update && !$load) {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
$maxheight = get_pconfig(\App::$profile['profile_uid'], 'system', 'channel_divmore_height');
if (!$maxheight) {
$maxheight = 400;
}
$o .= '<div id="live-channel"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . \App::$profile['profile_uid'] . "; var netargs = '?f='; var profile_page = " . \App::$pager['page'] . "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
\App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"), array('$baseurl' => z_root(), '$pgtype' => 'channel', '$uid' => \App::$profile['profile_uid'] ? \App::$profile['profile_uid'] : '0', '$gid' => '0', '$cid' => '0', '$cmin' => '0', '$cmax' => '0', '$star' => '0', '$liked' => '0', '$conv' => '0', '$spam' => '0', '$nouveau' => '0', '$wall' => '1', '$fh' => '0', '$page' => \App::$pager['page'] != 1 ? \App::$pager['page'] : 1, '$search' => '', '$order' => '', '$list' => x($_REQUEST, 'list') ? intval($_REQUEST['list']) : 0, '$file' => '', '$cats' => $category ? $category : '', '$tags' => $hashtags ? $hashtags : '', '$mid' => $mid, '$verb' => '', '$dend' => $datequery, '$dbegin' => $datequery2));
}
$update_unseen = '';
if ($page_mode === 'list') {
/**
* in "list mode", only mark the parent item and any like activities as "seen".
* We won't distinguish between comment likes and post likes. The important thing
* is that the number of unseen comments will be accurate. The SQL to separate the
* comment likes could also get somewhat hairy.
*/
if ($parents_str) {
$update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )";
$update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) ";
}
} else {
if ($parents_str) {
$update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )";
}
}
if ($is_owner && $update_unseen) {
$r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d {$update_unseen}", intval(local_channel()));
}
if ($checkjs->disabled()) {
$o .= conversation($a, $items, 'channel', $update, 'traditional');
} else {
$o .= conversation($a, $items, 'channel', $update, $page_mode);
}
if (!$update || $checkjs->disabled()) {
$o .= alt_pager($a, count($items));
if ($mid && $items[0]['title']) {
\App::$page['title'] = $items[0]['title'] . " - " . \App::$page['title'];
}
}
if ($mid) {
$o .= '<div id="content-complete"></div>';
}
return $o;
}
开发者ID:anmol26s, 项目名称:hubzilla-yunohost, 代码行数:101, 代码来源:Channel.php
示例16: event_store_item
function event_store_item($arr, $event)
{
require_once 'include/datetime.php';
require_once 'include/items.php';
require_once 'include/bbcode.php';
$item = null;
if ($arr['mid'] && $arr['uid']) {
$i = q("select * from item where mid = '%s' and uid = %d limit 1", dbesc($arr['mid']), intval($arr['uid']));
if ($i) {
xchan_query($i);
$item = fetch_post_tags($i, true);
}
}
$item_arr = array();
$prefix = '';
// $birthday = false;
if ($event['type'] === 'birthday') {
$prefix = t('This event has been added to your calendar.');
// $birthday = true;
// The event is created on your own site by the system, but appears to belong
// to the birthday person. It also isn't propagated - so we need to prevent
// folks from trying to comment on it. If you're looking at this and trying to
// fix it, you'll need to completely change the way birthday events are created
// and send them out from the source. This has its own issues.
$item_arr['comment_policy'] = 'none';
}
$r = q("SELECT * FROM item left join xchan on author_xchan = xchan_hash WHERE resource_id = '%s' AND resource_type = 'event' and uid = %d LIMIT 1", dbesc($event['event_hash']), intval($arr['uid']));
if ($r) {
$object = json_encode(array('type' => ACTIVITY_OBJ_EVENT, 'id' => z_root() . '/event/' . $r[0]['resource_id'], 'title' => $arr['summary'], 'content' => format_event_bbcode($arr), 'author' => array('name' => $r[0]['xchan_name'], 'address' => $r[0]['xchan_addr'], 'guid' => $r[0]['xchan_guid'], 'guid_sig' => $r[0]['xchan_guid_sig'], 'link' => array(array('rel' => 'alternate', 'type' => 'text/html', 'href' => $r[0]['xchan_url']), array('rel' => 'photo', 'type' => $r[0]['xchan_photo_mimetype'], 'href' => $r[0]['xchan_photo_m'])))));
$private = $arr['allow_cid'] || $arr['allow_gid'] || $arr['deny_cid'] || $arr['deny_gid'] ? 1 : 0;
q("UPDATE item SET title = '%s', body = '%s', object = '%s', allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', edited = '%s', item_flags = %d, item_private = %d, obj_type = '%s' WHERE id = %d AND uid = %d", dbesc($arr['summary']), dbesc($prefix . format_event_bbcode($arr)), dbesc($object), dbesc($arr['allow_cid']), dbesc($arr['allow_gid']), dbesc($arr['deny_cid']), dbesc($arr['deny_gid']), dbesc($arr['edited']), intval($r[0]['item_flags']), intval($private), dbesc(ACTIVITY_OBJ_EVENT), intval($r[0]['id']), intval($arr['uid']));
q("delete from term where oid = %d and otype = %d", intval($r[0]['id']), intval(TERM_OBJ_POST));
if ($arr['term'] && is_array($arr['term'])) {
foreach ($arr['term'] as $t) {
q("insert into term (uid,oid,otype,type,term,url)\n\t\t\t\t\tvalues(%d,%d,%d,%d,'%s','%s') ", intval($arr['uid']), intval($r[0]['id']), intval(TERM_OBJ_POST), intval($t['type']), dbesc($t['term']), dbesc($t['url']));
}
}
$item_id = $r[0]['id'];
call_hooks('event_updated', $event['id']);
return $item_id;
} else {
$z = q("select * from channel where channel_id = %d limit 1", intval($arr['uid']));
$private = $arr['allow_cid'] || $arr['allow_gid'] || $arr['deny_cid'] || $arr['deny_gid'] ? 1 : 0;
if ($item) {
$item_arr['id'] = $item['id'];
} else {
$wall = $z[0]['channel_hash'] == $event['event_xchan'] ? true : false;
$item_flags = ITEM_THREAD_TOP;
if ($wall) {
$item_flags |= ITEM_WALL;
$item_flags |= ITEM_ORIGIN;
}
$item_arr['item_flags'] = $item_flags;
}
if (!$arr['mid']) {
$arr['mid'] = item_message_id();
}
$item_arr['aid'] = $z[0]['channel_account_id'];
$item_arr['uid'] = $arr['uid'];
$item_arr['author_xchan'] = $arr['event_xchan'];
$item_arr['mid'] = $arr['mid'];
$item_arr['parent_mid'] = $arr['mid'];
$item_arr['owner_xchan'] = $wall ? $z[0]['channel_hash'] : $arr['event_xchan'];
$item_arr['author_xchan'] = $arr['event_xchan'];
$item_arr['title'] = $arr['summary'];
$item_arr['allow_cid'] = $arr['allow_cid'];
$item_arr['allow_gid'] = $arr['allow_gid'];
$item_arr['deny_cid'] = $arr['deny_cid'];
$item_arr['deny_gid'] = $arr['deny_gid'];
$item_arr['item_private'] = $private;
$item_arr['verb'] = ACTIVITY_POST;
if (array_key_exists('term', $arr)) {
$item_arr['term'] = $arr['term'];
}
$item_arr['resource_type'] = 'event';
$item_arr['resource_id'] = $event['event_hash'];
$item_arr['obj_type'] = ACTIVITY_OBJ_EVENT;
$item_arr['body'] = $prefix . format_event_bbcode($arr);
// if it's local send the permalink to the channel page.
// otherwise we'll fallback to /display/$message_id
if ($wall) {
$item_arr['plink'] = z_root() . '/channel/' . $z[0]['channel_address'] . '/?f=&mid=' . $item_arr['mid'];
} else {
$item_arr['plink'] = z_root() . '/display/' . $item_arr['mid'];
}
$x = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($arr['event_xchan']));
if ($x) {
$item_arr['object'] = json_encode(array('type' => ACTIVITY_OBJ_EVENT, 'id' => z_root() . '/event/' . $event['event_hash'], 'title' => $arr['summary'], 'content' => format_event_bbcode($arr), 'author' => array('name' => $x[0]['xchan_name'], 'address' => $x[0]['xchan_addr'], 'guid' => $x[0]['xchan_guid'], 'guid_sig' => $x[0]['xchan_guid_sig'], 'link' => array(array('rel' => 'alternate', 'type' => 'text/html', 'href' => $x[0]['xchan_url']), array('rel' => 'photo', 'type' => $x[0]['xchan_photo_mimetype'], 'href' => $x[0]['xchan_photo_m'])))));
}
$res = item_store($item_arr);
$item_id = $res['item_id'];
call_hooks('event_created', $event['id']);
return $item_id;
}
}
开发者ID:HaakonME, 项目名称:redmatrix, 代码行数:95, 代码来源:event.php
示例17: get
//.........这里部分代码省略.........
}
$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(2) === 'json') {
if (x($_GET, 'start')) {
$start = $_GET['start'];
}
if (x($_GET, 'end')) {
$finish = $_GET['end'];
}
}
$start = datetime_convert('UTC', 'UTC', $start);
$finish = datetime_convert('UTC', 'UTC', $finish);
$adjust_start = datetime_convert('UTC', date_default_timezone_get(), $start);
$adjust_finish = datetime_convert('UTC', date_default_timezone_get(), $finish);
if (x($_GET, 'id')) {
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan\n\t from event left join item on resource_id = event_hash where resource_type = 'event' and event.uid = %d and event.id = %d {$sql_extra} limit 1", intval($channel['channel_id']), intval($_GET['id']));
} else {
// fixed an issue with "nofinish" events not showing up in the calendar.
// There's still an issue if the finish date crosses the end of month.
// Noting this for now - it will need to be fixed here and in Friendica.
// Ultimately the finish date shouldn't be involved in the query.
$r = q("SELECT event.*, item.plink, item.item_flags, item.author_xchan, item.owner_xchan\n\t from event left join item on event_hash = resource_id \n\t\t\t\t\twhere resource_type = 'event' and event.uid = %d {$ignored} \n\t\t\t\t\tAND (( adjust = 0 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' ) \n\t\t\t\t\tOR ( adjust = 1 AND ( dtend >= '%s' or nofinish = 1 ) AND dtstart <= '%s' )) {$sql_extra} ", intval($channel['channel_id']), dbesc($start), dbesc($finish), dbesc($adjust_start), dbesc($adjust_finish));
}
$links = array();
if ($r) {
xchan_query($r);
$r = fetch_post_tags($r, true);
$r = sort_by_date($r);
}
if ($r) {
foreach ($r as $rr) {
$j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'j') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'j');
if (!x($links, $j)) {
$links[$j] = z_root() . '/' . \App::$cmd . '#link-' . $j;
}
}
}
$events = array();
$last_date = '';
$fmt = t('l, F j');
if ($r) {
foreach ($r as $rr) {
$j = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'j') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'j');
$d = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], $fmt) : datetime_convert('UTC', 'UTC', $rr['dtstart'], $fmt);
$d = day_translate($d);
$start = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtstart'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtstart'], 'c');
if ($rr['nofinish']) {
$end = null;
} else {
$end = $rr['adjust'] ? datetime_convert('UTC', date_default_timezone_get(), $rr['dtend'], 'c') : datetime_convert('UTC', 'UTC', $rr['dtend'], 'c');
}
$is_first = $d !== $last_date;
$last_date = $d;
$edit = false;
$drop = false;
$title = strip_tags(html_entity_decode(bbcode($rr['summary']), ENT_QUOTES, 'UTF-8'));
if (!$title) {
list($title, $_trash) = explode("<br", bbcode($rr['desc']), 2);
$title = strip_tags(html_entity_decode($title, ENT_QUOTES, 'UTF-8'));
}
$html = format_event_html($rr);
$rr['desc'] = bbcode($rr['desc']);
$rr['location'] = bbcode($rr['location']);
$events[] = array('id' => $rr['id'], 'hash' => $rr['event_hash'], 'start' => $start, 'end' => $end, 'drop' => $drop, 'allDay' => false, 'title' => $title, 'j' => $j, 'd' => $d, 'edit' => $edit, 'is_first' => $is_first, 'item' => $rr, 'html' => $html, 'plink' => array($rr['plink'], t('Link to Source'), '', ''));
}
}
if (argv(2) === 'json') {
echo json_encode($events);
killme();
}
// links: array('href', 'text', 'extra css classes', 'title')
if (x($_GET, 'id')) {
$tpl = get_markup_template("event_cal.tpl");
} else {
$tpl = get_markup_template("events_cal-js.tpl");
}
$nick = $channel['channel_address'];
$o = replace_macros($tpl, array('$baseurl' => z_root(), '$new_event' => array(z_root() . '/cal', $event_id ? t('Edit Event') : t('Create Event'), '', ''), '$previus' => array(z_root() . "/cal/{$nick}/{$prevyear}/{$prevmonth}", t('Previous'), '', ''), '$next' => array(z_root() . "/cal/{$nick}/{$nextyear}/{$nextmonth}", t('Next'), '', ''), '$export' => array(z_root() . "/cal/{$nick}/{$y}/{$m}/export", t('Export'), '', ''), '$calendar' => cal($y, $m, $links, ' eventcal'), '$events' => $events, '$upload' => t('Import'), '$submit' => t('Submit'), '$prev' => t('Previous'), '$next' => t('Next'), '$today' => t('Today'), '$form' => $form, '$expandform' => x($_GET, 'expandform') ? true : false, '$tabs' => $tabs));
if (x($_GET, 'id')) {
echo $o;
killme();
}
return $o;
}
}
开发者ID:BlaBlaNet, 项目名称:hubzilla, 代码行数:101, 代码来源:Cal.php
示例18: randpost_enotify_store
dustinvtran/ml-videos: A collection of video resources for machine learning
阅读:1354| 2022-08-19
首先,来总结一下Win32_OperatingSystem,这个类里面常用的属性有:caption:操作系统
阅读:546| 2022-07-18
ravikumar001/maven
阅读:789| 2022-08-17
更的笔顺是什么?更的笔顺笔画顺序怎么写?还有更的拼音及意思是什么,好多初学练字者
阅读:681| 2022-11-06
参考:http://www.cnblogs.com/railgunman/articles/1800318.html程序设计当中,我们
阅读:2172| 2022-07-22
ceejbot/LOUDBOT: AUTOMATED SHOUTING FOR MASTODON
阅读:1652| 2022-08-18
kali-docs-cn/kali-linux-web-pentest-cookbook-zh: Kali Linux Web 渗透测试秘籍 中
阅读:771| 2022-08-15
liangtengyu/to_markdown: 一键解析Markdown 目前支持: 微信公众号,知乎,知乎专栏,简
阅读:1008| 2022-08-18
http://blog.csdn.net/lailai186/article/details/7390397
阅读:734| 2022-07-18
win7系统电脑使用过程中有不少朋友表示遇到过win7系统删除资源管理器里我们不想要的图
阅读:720| 2022-11-06
请发表评论