本文整理汇总了PHP中get_terms_oftype函数的典型用法代码示例。如果您正苦于以下问题:PHP get_terms_oftype函数的具体用法?PHP get_terms_oftype怎么用?PHP get_terms_oftype使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_terms_oftype函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: 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
示例3: 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
示例4: randpost_enotify_store
function randpost_enotify_store(&$a, &$b)
{
if (!($b['ntype'] == NOTIFY_COMMENT || $b['ntype'] == NOTIFY_TAGSELF)) {
return;
}
if (!get_pconfig($b['uid'], 'randpost', 'enable')) {
return;
}
$fort_server = get_config('fortunate', 'server');
if (!$fort_server) {
return;
}
$c = q("select * from channel where channel_id = %d limit 1", intval($b['uid']));
if (!$c) {
return;
}
$my_conversation = false;
$p = q("select id, item_flags, author_xchan from item where parent_mid = mid and parent_mid = '%s' and uid = %d limit 1", dbesc($b['item']['parent_mid']), intval($b['uid']));
if (!$p) {
return;
}
$p = fetch_post_tags($p, true);
if (intval($p[0]['item_obscured'])) {
return;
}
if ($b['ntype'] == NOTIFY_TAGSELF) {
$my_conversation = true;
} elseif ($p[0]['author_xchan'] === $c[0]['channel_hash']) {
$my_conversation = true;
} elseif ($p[0]['term']) {
$v = get_terms_oftype($p[0]['term'], TERM_MENTION);
$link = normalise_link(z_root() . '/channel/' . $c[0]['channel_address']);
if ($v) {
foreach ($v as $vv) {
if (link_compare($vv['url'], $link)) {
$my_conversation = true;
break;
}
}
}
}
// don't hijack somebody else's conversation, but respond (once) if invited to.
if (!$my_conversation) {
return;
}
// This conversation is boring me.
$limit = mt_rand(5, 20);
$h = q("select id, body from item where author_xchan = '%s' and parent_mid = '%s' and uid = %d", dbesc($c[0]['channel_hash']), dbesc($b['item']['parent_mid']), intval($b['uid']));
if ($h && count($h) > $limit) {
return;
}
// Be gracious and not obnoxious if thanked
$replies = array(t('You\'re welcome.'), t('Ah shucks...'), t('Don\'t mention it.'), t('<blush>'), ':like');
// TODO: if you really want to freak somebody out, add a relevance search function to mod_zotfeed and
// use somebody's own words from long ago to craft a reply to them....
require_once 'include/bbcode.php';
require_once 'include/html2plain.php';
if ($b['item'] && $b['item']['body']) {
if (stristr($b['item']['body'], 'nocomment')) {
return;
}
$txt = preg_replace('/\\@\\[z(.*?)\\[\\/zrl\\]/', '', $b['item']['body']);
$txt = html2plain(bbcode($txt));
$pattern = substr($txt, 0, 255);
}
if ($b['item']['author_xchan']) {
$z = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($b['item']['author_xchan']));
if ($z) {
$mention = '@' . '[zrl=' . $z[0]['xchan_url'] . ']' . $z[0]['xchan_name'] . '[/zrl]' . "\n\n";
}
}
if (stristr($b['item']['body'], $c[0]['channel_name']) && mb_strlen($pattern) < 36 && stristr($pattern, 'thank')) {
$reply = $replies[mt_rand(0, count($replies) - 1)];
}
$x = array();
if ($reply) {
$x['body'] = $mention . $reply;
} else {
require_once 'include/html2bbcode.php';
$valid = false;
do {
$url = 'http://' . $fort_server . '/cookie.php?f=&lang=any&off=a&pattern=' . urlencode($pattern);
$s = z_fetch_url($url);
if ($s['success'] && !$s['body']) {
$s = z_fetch_url('http://' . $fort_server . '/cookie.php');
}
if (!$s['success'] || !$s['body']) {
return;
}
// if it might be a quote make it a quote
if (strpos($s['body'], '--')) {
$x['body'] = '[quote]' . html2bbcode($s['body']) . '[/quote]';
} else {
$x['body'] = html2bbcode($s['body']);
}
$found_text = false;
if ($h) {
foreach ($h as $hh) {
if (stripos($hh['body'], $x['body']) !== false) {
$pattern = '';
//.........这里部分代码省略.........
开发者ID:phellmes,项目名称:hubzilla-addons,代码行数:101,代码来源:randpost.php
示例5: item_expire
function item_expire($uid, $days)
{
if (!$uid || $days < 1) {
return;
}
// $expire_network_only = save your own wall posts
// and just expire conversations started by others
// do not enable this until we can pass bulk delete messages through zot
// $expire_network_only = get_pconfig($uid,'expire','network_only');
$expire_network_only = 1;
$expire_limit = get_config('system', 'expire_limit');
if (!intval($expire_limit)) {
$expire_limit = 5000;
}
$sql_extra = intval($expire_network_only) ? " AND (item_flags & " . intval(ITEM_WALL) . ") = 0 " : "";
$r = q("SELECT * FROM `item`\n\t\tWHERE `uid` = %d\n\t\tAND `created` < %s - INTERVAL %s\n\t\tAND `id` = `parent`\n\t\t{$sql_extra}\n\t\tAND ( item_flags & %d ) = 0\n\t\tAND ( item_restrict = 0 ) LIMIT {$expire_limit} ", intval($uid), db_utcnow(), db_quoteinterval(intval($days) . ' DAY'), intval(ITEM_RETAINED));
if (!$r) {
return;
}
$r = fetch_post_tags($r, true);
foreach ($r as $item) {
// don't expire filed items
$terms = get_terms_oftype($item['term'], TERM_FILE);
if ($terms) {
retain_item($item['id']);
continue;
}
// Only expire posts, not photos and photo comments
if ($item['resource_type'] === 'photo') {
retain_item($item['id']);
continue;
}
if ($item['item_flags'] & ITEM_STARRED) {
retain_item($item['id']);
continue;
}
drop_item($item['id'], false);
}
// proc_run('php',"include/notifier.php","expire","$uid");
}
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:40,代码来源:items.php
示例6: conversation
//.........这里部分代码省略.........
$profile_name = $item['author-link'];
}
$tags = array();
$hashtags = array();
$mentions = array();
$sp = false;
$profile_link = best_link_url($item, $sp);
if ($sp) {
$sparkle = ' sparkle';
} else {
$profile_link = zid($profile_link);
}
$normalised = normalise_link(strlen($item['author-link']) ? $item['author-link'] : $item['url']);
$profile_name = $item['author']['xchan_name'];
$profile_link = $item['author']['xchan_url'];
$profile_avatar = $item['author']['xchan_photo_m'];
$location = format_location($item);
localize_item($item);
if ($mode === 'network-new') {
$dropping = true;
} else {
$dropping = false;
}
$drop = array('pagedropping' => $page_dropping, 'dropping' => $dropping, 'select' => t('Select'), 'delete' => t('Delete'));
$star = false;
$isstarred = "unstarred icon-star-empty";
$lock = $item['item_private'] || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid']) ? t('Private Message') : false;
$likebuttons = false;
$shareable = false;
$verified = $item['item_flags'] & ITEM_VERIFIED ? t('Message signature validated') : '';
$forged = $item['sig'] && !($item['item_flags'] & ITEM_VERIFIED) ? t('Message signature incorrect') : '';
$unverified = '';
$tags = array();
$terms = get_terms_oftype($item['term'], array(TERM_HASHTAG, TERM_MENTION, TERM_UNKNOWN));
if (count($terms)) {
foreach ($terms as $tag) {
$tags[] = format_term_for_display($tag);
}
}
$body = prepare_body($item, true);
$tmp_item = array('template' => $tpl, 'toplevel' => 'toplevel_item', 'mode' => $mode, 'id' => $preview ? 'P0' : $item['item_id'], 'linktitle' => sprintf(t('View %s\'s profile @ %s'), $profile_name, $profile_url), 'profile_url' => $profile_link, 'item_photo_menu' => item_photo_menu($item), 'name' => $profile_name, 'sparkle' => $sparkle, 'lock' => $lock, 'thumb' => $profile_avatar, 'title' => $item['title'], 'body' => $body, 'tags' => $tags, 'hashtags' => $hashtags, 'mentions' => $mentions, 'verified' => $verified, 'unverified' => $unverified, 'forged' => $forged, 'txt_cats' => t('Categories:'), 'txt_folders' => t('Filed under:'), 'has_cats' => count($categories) ? 'true' : '', 'has_folders' => count($folders) ? 'true' : '', 'categories' => $categories, 'folders' => $folders, 'text' => strip_tags($body), 'ago' => relative_date($item['created']), 'app' => $item['app'], 'str_app' => sprintf(t(' from %s'), $item['app']), 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'editedtime' => $item['edited'] != $item['created'] ? sprintf(t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : '', 'expiretime' => $item['expires'] !== NULL_DATE ? sprintf(t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')) : '', 'location' => $location, 'indent' => '', 'owner_name' => $owner_name, 'owner_url' => $owner_url, 'owner_photo' => $owner_photo, 'plink' => get_plink($item, false), 'edpost' => false, 'isstarred' => $isstarred, 'star' => $star, 'drop' => $drop, 'vote' => $likebuttons, 'like' => '', 'dislike' => '', 'comment' => '', 'conv' => $preview ? '' : array('href' => z_root() . '/display/' . $item['mid'], 'title' => t('View in context')), 'previewing' => $previewing, 'wait' => t('Please wait'), 'thread_level' => 1);
$arr = array('item' => $item, 'output' => $tmp_item);
call_hooks('display_item', $arr);
// $threads[$threadsid]['id'] = $item['item_id'];
$threads[] = $arr['output'];
}
} else {
// Normal View
// logger('conv: items: ' . print_r($items,true));
require_once 'include/ConversationObject.php';
require_once 'include/ItemObject.php';
$conv = new Conversation($mode, $preview, $prepared_item);
// In the display mode we don't have a profile owner.
if ($mode === 'display' && $items) {
$conv->set_profile_owner($items[0]['uid']);
}
// get all the topmost parents
// this shouldn't be needed, as we should have only them in our array
// But for now, this array respects the old style, just in case
$threads = array();
foreach ($items as $item) {
// Check for any blocked authors
if ($arr_blocked) {
$blocked = false;
foreach ($arr_blocked as $b) {
if ($b && $item['author_xchan'] == $b) {
开发者ID:redmatrix,项目名称:red,代码行数:67,代码来源:conversation.php
示例7: format_filer
function format_filer(&$item)
{
$s = '';
$terms = get_terms_oftype($item['term'], TERM_FILE);
if ($terms) {
$categories = array();
foreach ($terms as $t) {
$term = htmlspecialchars($t['term'], ENT_COMPAT, 'UTF-8', false);
if (!trim($term)) {
continue;
}
$removelink = z_root() . '/filerm/' . $item['id'] . '?f=&term=' . urlencode($t['term']);
$categories[] = array('term' => $term, 'removelink' => $removelink);
}
$s = replace_macros(get_markup_template('item_filer.tpl'), array('$remove' => t('remove from file'), '$categories' => $categories));
}
return $s;
}
开发者ID:23n,项目名称:hubzilla,代码行数:18,代码来源:text.php
示例8: events_content
//.........这里部分代码省略.........
}
}
if ($mode === 'edit' && $event_id) {
$r = q("SELECT * FROM `event` WHERE event_hash = '%s' AND `uid` = %d LIMIT 1", dbesc($event_id), intval(local_channel()));
if (count($r)) {
$orig_event = $r[0];
}
}
$channel = $a->get_channel();
// Passed parameters overrides anything found in the DB
if ($mode === 'edit' || $mode === 'new') {
if (!x($orig_event)) {
$orig_event = array();
}
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
if (x($_REQUEST, 'nofinish')) {
$orig_event['nofinish'] = $_REQUEST['nofinish'];
}
if (x($_REQUEST, 'adjust')) {
$orig_event['adjust'] = $_REQUEST['adjust'];
}
if (x($_REQUEST, 'summary')) {
$orig_event['summary'] = $_REQUEST['summary'];
}
if (x($_REQUEST, 'description')) {
$orig_event['description'] = $_REQUEST['description'];
}
if (x($_REQUEST, 'location')) {
$orig_event['location'] = $_REQUEST['location'];
}
if (x($_REQUEST, 'start')) {
$orig_event['start'] = $_REQUEST['start'];
}
if (x($_REQUEST, 'finish')) {
$orig_event['finish'] = $_REQUEST['finish'];
}
}
if ($mode === 'edit' || $mode === 'new') {
$n_checked = x($orig_event) && $orig_event['nofinish'] ? ' checked="checked" ' : '';
$a_checked = x($orig_event) && $orig_event['adjust'] ? ' checked="checked" ' : '';
$t_orig = x($orig_event) ? $orig_event['summary'] : '';
$d_orig = x($orig_event) ? $orig_event['description'] : '';
$l_orig = x($orig_event) ? $orig_event['location'] : '';
$eid = x($orig_event) ? $orig_event['id'] : 0;
$event_xchan = x($orig_event) ? $orig_event['event_xchan'] : $channel['channel_hash'];
$mid = x($orig_event) ? $orig_event['mid'] : '';
if (!x($orig_event)) {
$sh_checked = '';
} else {
$sh_checked = ($orig_event['allow_cid'] === '<' . $channel['channel_hash'] . '>' || !$orig_event['allow_cid']) && !$orig_event['allow_gid'] && !$orig_event['deny_cid'] && !$orig_event['deny_gid'] ? '' : ' checked="checked" ';
}
if ($orig_event['event_xchan']) {
$sh_checked .= ' disabled="disabled" ';
}
$sdt = x($orig_event) ? $orig_event['start'] : 'now';
$fdt = x($orig_event) ? $orig_event['finish'] : 'now';
$tz = date_default_timezone_get();
if (x($orig_event)) {
$tz = $orig_event['adjust'] ? date_default_timezone_get() : 'UTC';
}
$syear = datetime_convert('UTC', $tz, $sdt, 'Y');
$smonth = datetime_convert('UTC', $tz, $sdt, 'm');
$sday = datetime_convert('UTC', $tz, $sdt, 'd');
$shour = x($orig_event) ? datetime_convert('UTC', $tz, $sdt, 'H') : 0;
$sminute = x($orig_event) ? datetime_convert('UTC', $tz, $sdt, 'i') : 0;
$stext = datetime_convert('UTC', $tz, $sdt);
$stext = substr($stext, 0, 14) . "00:00";
$fyear = datetime_convert('UTC', $tz, $fdt, 'Y');
$fmonth = datetime_convert('UTC', $tz, $fdt, 'm');
$fday = datetime_convert('UTC', $tz, $fdt, 'd');
$fhour = x($orig_event) ? datetime_convert('UTC', $tz, $fdt, 'H') : 0;
$fminute = x($orig_event) ? datetime_convert('UTC', $tz, $fdt, 'i') : 0;
$ftext = datetime_convert('UTC', $tz, $fdt);
$ftext = substr($ftext, 0, 14) . "00:00";
$f = get_config('system', 'event_input_format');
if (!$f) {
$f = 'ymd';
}
$catsenabled = feature_enabled(local_channel(), 'categories');
$category = '';
if ($catsenabled && x($orig_event)) {
$itm = q("select * from item where resource_type = 'event' and resource_id = '%s' and uid = %d limit 1", dbesc($orig_event['event_hash']), intval(local_channel()));
$itm = fetch_post_tags($itm);
if ($itm) {
$cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY);
foreach ($cats as $cat) {
if (strlen($category)) {
$category .= ', ';
}
$category .= $cat['term'];
}
}
}
require_once 'include/acl_selectors.php';
$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']);
$tpl = get_markup_template('event_form.tpl');
$o .= replace_macros($tpl, array('$post' => $a->get_baseurl() . '/events', '$eid' => $eid, '$xchan' => $event_xchan, '$mid' => $mid, '$event_hash' => $event_id, '$title' => t('Event details'), '$desc' => t('Starting date and Title are required.'), '$catsenabled' => $catsenabled, '$placeholdercategory' => t('Categories (comma-separated list)'), '$category' => $category, '$s_text' => t('Event Starts:'), '$stext' => $stext, '$ftext' => $ftext, '$required' => ' <span class="required" title="' . t('Required') . '">*</span>', '$ModalCANCEL' => t('Cancel'), '$ModalOK' => t('OK'), '$s_dsel' => datetimesel($f, new DateTime(), DateTime::createFromFormat('Y', $syear + 5), DateTime::createFromFormat('Y-m-d H:i', "{$syear}-{$smonth}-{$sday} {$shour}:{$sminute}"), 'start_text', true, true, '', '', true), '$n_text' => t('Finish date/time is not known or not relevant'), '$n_checked' => $n_checked, '$f_text' => t('Event Finishes:'), '$f_dsel' => datetimesel($f, new DateTime(), DateTime::createFromFormat('Y', $fyear + 5), DateTime::createFromFormat('Y-m-d H:i', "{$fyear}-{$fmonth}-{$fday} {$fhour}:{$fminute}"), 'finish_text', true, true, 'start_text'), '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked, t('Important for events that happen in a particular place. Not practical for global holidays.')), '$a_text' => t('Adjust for viewer timezone'), '$d_text' => t('Description:'), '$d_orig' => $d_orig, '$l_text' => t('Location:'), '$l_orig' => $l_orig, '$t_text' => t('Title:'), '$t_orig' => $t_orig, '$sh_text' => t('Share this event'), '$sh_checked' => $sh_checked, '$preview' => t('Preview'), '$permissions' => t('Permissions'), '$acl' => $orig_event['event_xchan'] ? '' : populate_acl(x($orig_event) ? $orig_event : $perm_defaults, false), '$submit' => t('Submit')));
return $o;
}
}
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:101,代码来源:events.php
示例9: item_expire
function item_expire($uid, $days)
{
if (!$uid || $days < 1) {
return;
}
// $expire_network_only = save your own wall posts
// and just expire conversations started by others
// do not enable this until we can pass bulk delete messages through zot
// $expire_network_only = get_pconfig($uid,'expire','network_only');
$expire_network_only = 1;
$sql_extra = intval($expire_network_only) ? " AND item_wall = 0 " : "";
$expire_limit = get_config('system', 'expire_limit');
if (!intval($expire_limit)) {
$expire_limit = 5000;
}
$item_normal = item_normal();
$r = q("SELECT id FROM item\n\t\tWHERE uid = %d\n\t\tAND created < %s - INTERVAL %s\n\t\tAND item_retained = 0\n\t\tAND item_thread_top = 1\n\t\tAND resource_type = ''\n\t\tAND item_starred = 0\n\t\t{$sql_extra} {$item_normal} LIMIT {$expire_limit} ", intval($uid), db_utcnow(), db_quoteinterval(intval($days) . ' DAY'));
if (!$r) {
return;
}
$r = fetch_post_tags($r, true);
foreach ($r as $item) {
// don't expire filed items
$terms = get_terms_oftype($item['term'], TERM_FILE);
if ($terms) {
retain_item($item['id']);
continue;
}
drop_item($item['id'], false);
}
// Zotlabs\Daemon\Master::Summon(array('Notifier','expire',$uid));
}
开发者ID:phellmes,项目名称:hubzilla,代码行数:32,代码来源:items.php
示例10: editpost_content
function editpost_content(&$a)
{
$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 `uid` = %d and author_xchan = '%s' LIMIT 1", intval($post_id), intval(local_channel()), dbesc(get_observer_hash()));
if (!count($itm)) {
notice(t('Item is not editable') . EOL);
return;
}
$plaintext = true;
// if(feature_enabled(local_channel(),'richtext'))
// $plaintext = false;
$channel = $a->get_channel();
$a->page['htmlhead'] .= replace_macros(get_markup_template('jot-header.tpl'), array('$baseurl' => $a->get_baseurl(), '$editselect' => $plaintext ? 'none' : '/(profile-jot-text|prvmail-text)/', '$ispublic' => ' ', '$geotag' => $geotag, '$nickname' => $channel['channel_address'], '$expireswhen' => t('Expires YYYY-MM-DD HH:MM'), '$confirmdelete' => t('Delete item?')));
if ($itm[0]['item_flags'] & 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);
}
}
$tpl = get_markup_template("jot.tpl");
$jotplugins = '';
$jotnets = '';
call_hooks('jot_tool', $jotplugins);
call_hooks('jot_networks', $jotnets);
$channel = $a->get_channel();
//$tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
$voting = feature_enabled(local_channel(), 'consensus_tools');
$category = '';
$catsenabled = feature_enabled(local_channel(), '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";
}
}
}
$cipher = get_pconfig(get_app()->profile['profile_uid'], 'system', 'default_cipher');
if (!$cipher) {
$cipher = 'aes256';
}
$editor = replace_macros($tpl, array('$return_path' => $_SESSION['return_url'], '$action' => 'item', '$share' => t('Edit'), '$bold' => t('Bold'), '$italic' => t('Italic'), '$underline' => t('Underline'), '$quote' => t('Quote'), '$code' => t('Code'), '$upload' => t('Upload photo'), '$attach' => t('Attach file'), '$weblink' => t('Insert web link'), '$youtube' => t('Insert YouTube video'), '$video' => t('Insert Vorbis [.ogg] video'), '$audio' => t('Insert Vorbis [.ogg] audio'), '$setloc' => t('Set your location'), '$noloc' => t('Clear browser location'), '$voting' => t('Toggle voting'), '$feature_voting' => $voting, '$consensus' => $itm[0]['item_flags'] & ITEM_CONSENSUS ? 1 : 0, '$wait' => t('Please wait'), '$permset' => t('Permission settings'), '$ptyp' => $itm[0]['type'], '$content' => undo_post_tagging($itm[0]['body']), '$post_id' => $post_id, '$parent' => $itm[0]['parent'] != $itm[0]['id'] ? $itm[0]['parent'] : '', '$baseurl' => $a->get_baseurl(), '$defloc' => $channel['channel_location'], '$visitor' => false, '$public' => t('Public post'), '$jotnets' => $jotnets, '$title' => htmlspecialchars($itm[0]['title'], ENT_COMPAT, 'UTF-8'), '$placeholdertitle' => t('Title (optional)'), '$category' => $category, '$placeholdercategory' => t('Categories (optional, comma-separated list)'), '$emtitle' => t('Example: [email protected], [email protected]'), '$lockstate' => $lockstate, '$acl' => '', '$bang' => '', '$profile_uid' => local_channel(), '$preview' => t('Preview'), '$jotplugins' => $jotplugins, '$sourceapp' => t($a->sourcename), '$catsenabled' => $catsenabled, '$defexpire' => datetime_convert('UTC', date_default_timezone_get(), $itm[0]['expires']), '$feature_expire' => feature_enabled(get_app()->profile['profile_uid'], 'content_expire') && !$webpage ? true : false, '$expires' => t('Set expiration date'), '$feature_encrypt' => feature_enabled(get_app()->profile['profile_uid'], 'content_encrypt') && !$webpage ? true : false, '$encrypt' => t('Encrypt text'), '$cipher' => $cipher, '$expiryModalOK' => t('OK'), '$expiryModalCANCEL' => t('Cancel')));
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array('$title' => t('Edit post'), '$editor' => $editor));
return $o;
}
开发者ID:HaakonME,项目名称:redmatrix,代码行数:67,代码来源:editpost.php
示例11: get
//.........这里部分代码省略.........
$sh_checked .= ' disabled="disabled" ';
}
$sdt = x($orig_event) ? $orig_event['dtstart'] : 'now';
$fdt = x($orig_event) ? $orig_event['dtend'] : '+1 hour';
$tz = date_default_timezone_get();
if (x($orig_event)) {
$tz = $orig_event['adjust'] ? date_default_timezone_get() : 'UTC';
}
$syear = datetime_convert('UTC', $tz, $sdt, 'Y');
$smonth = datetime_convert('UTC', $tz, $sdt, 'm');
$sday = datetime_convert('UTC', $tz, $sdt, 'd');
$shour = datetime_convert('UTC', $tz, $sdt, 'H');
$sminute = datetime_convert('UTC', $tz, $sdt, 'i');
$stext = datetime_convert('UTC', $tz, $sdt);
$stext = substr($stext, 0, 14) . "00:00";
$fyear = datetime_convert('UTC', $tz, $fdt, 'Y');
$fmonth = datetime_convert('UTC', $tz, $fdt, 'm');
$fday = datetime_convert('UTC', $tz, $fdt, 'd');
$fhour = datetime_convert('UTC', $tz, $fdt, 'H');
$fminute = datetime_convert('UTC', $tz, $fdt, 'i');
$ftext = datetime_convert('UTC', $tz, $fdt);
$ftext = substr($ftext, 0, 14) . "00:00";
$type = x($orig_event) ? $orig_event['etype'] : 'event';
$f = get_config('system', 'event_input_format');
if (!$f) {
$f = 'ymd';
}
$catsenabled = feature_enabled(local_channel(), 'categories');
$category = '';
if ($catsenabled && x($orig_event)) {
$itm = q("select * from item where resource_type = 'event' and resource_id = '%s' and uid = %d limit 1", dbesc($orig_event['event_hash']), intval(local_channel()));
$itm = fetch_post_tags($itm);
if ($itm) {
$cats = get_terms_oftype($itm[0]['term'], TERM_CATEGORY);
foreach ($cats as $cat) {
if (strlen($category)) {
$category .= ', ';
}
$category .= $cat['term'];
}
}
}
require_once 'include/acl_selectors.php';
$acl = new \Zotlabs\Access\AccessList($channel);
$perm_defaults = $acl->get();
$permissions = x($orig_event) ? $orig_event : $perm_defaults;
//print_r(acl2json($permissions['allow_gid'])); killme();
$tpl = get_markup_template('event_form.tpl');
$form = replace_macros($tpl, array('$post' => z_root() . '/events', '$eid' => $eid, '$type' => $type, '$xchan' => $event_xchan, '$mid' => $mid, '$event_hash' => $event_id, '$summary' => array('summary', $event_id ? t('Edit event title') : t('Event title'), $t_orig, t('Required'), '*'), '$catsenabled' => $catsenabled, '$placeholdercategory' => t('Categories (comma-separated list)'), '$c_text' => $event_id ? t('Edit Category') : t('Category'), '$category' => $category, '$required' => '<span class="required" title="' . t('Required') . '">*</span>', '$s_dsel' => datetimesel($f, new \DateTime(), \DateTime::createFromFormat('Y', $syear + 5), \DateTime::createFromFormat('Y-m-d H:i', "{$syear}-{$smonth}-{$sday} {$shour}:{$sminute}"), $event_id ? t('Edit start date and time') : t('Start date and time'), 'start_text', true, true, '', '', true, $first_day), '$n_text' => t('Finish date and time are not known or not relevant'), '$n_checked' => $n_checked, '$f_dsel' => datetimesel($f, new \DateTime(), \DateTime::createFromFormat('Y', $fyear + 5), \DateTime::createFromFormat('Y-m-d H:i', "{$fyear}-{$fmonth}-{$fday} {$fhour}:{$fminute}"), $event_id ? t('Edit finish date and time') : t('Finish date and time'), 'finish_text', true, true, 'start_text', '', false, $first_day), '$nofinish' => array('nofinish', t('Finish date and time are not known or not relevant'), $n_checked, '', array(t('No'), t('Yes')), 'onclick="enableDisableFinishDate();"'), '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked, t('Important for events that happen in a particular place. Not practical for global holidays.'), array(t('No'), t('Yes'))), '$a_text' => t('Adjust for viewer timezone'), '$d_text' => $event_id ? t('Edit Description') : t('Description'), '$d_orig' => $d_orig, '$l_text' => $event_id ? t('Edit Location') : t('Location'), '$l_orig' => $l_orig, '$t_orig' => $t_orig, '$sh_text' => t('Share this event'), '$sh_checked' => $sh_checked, '$share' => array('distr', t('Share this event'), $sh_checked, '', array(t('No'), t('Yes'))), '$preview' => t('Preview'), '$perms_label' => t('Permission settings'), '$acl' => $orig_event['event_xchan'] ? '' : populate_acl(x($orig_event) ? $orig_event : $perm_defaults, false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream')), '$allow_cid' => acl2json($permissions['allow_cid']), '$allow_gid' => acl2json($permissions['allow_gid']), '$deny_cid' => acl2json($permissions['deny_cid']), '$deny_gid' => acl2json($permissions['deny_gid']), '$submit' => t('Submit'), '$advanced' => t('Advanced Options')));
/* end edit/create form */
$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;
开发者ID:phellmes,项目名称:hubzilla,代码行数:67,代码来源:Events.php
注:本文中的get_terms_oftype函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论