本文整理汇总了PHP中xmlify函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlify函数的具体用法?PHP xmlify怎么用?PHP xmlify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlify函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: p_init
function p_init(&$a)
{
if (argc() < 2) {
http_status_exit(401);
}
$mid = str_replace('.xml', '', argv(1));
$r = q("select * from item where mid = '%s' and item_wall = 1 and item_private = 0 limit 1", dbesc($mid));
if (!$r || !perm_is_allowed($r[0]['uid'], '', 'view_stream')) {
http_status_exit(404);
}
$c = q("select * from channel where channel_id = %d limit 1", intval($r[0]['uid']));
if (!$c) {
http_status_exit(404);
}
$myaddr = $c[0]['channel_address'] . '@' . App::get_hostname();
$item = $r[0];
$title = $item['title'];
$body = bb2diaspora_itembody($item);
$created = datetime_convert('UTC', 'UTC', $item['created'], 'Y-m-d H:i:s \\U\\T\\C');
$tpl = get_markup_template('diaspora_post.tpl', 'addon/diaspora');
$msg = replace_macros($tpl, array('$body' => xmlify($body), '$guid' => $item['mid'], '$handle' => xmlify($myaddr), '$public' => 'true', '$created' => $created, '$provider' => $item['app'] ? $item['app'] : t('$projectname')));
header('Content-type: text/xml');
echo $msg;
killme();
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:25,代码来源:p.php
示例2: qcomment_addon_settings_post
function qcomment_addon_settings_post(&$a, &$b)
{
if (!local_user()) {
return;
}
if ($_POST['qcomment-submit']) {
set_pconfig(local_user(), 'qcomment', 'words', xmlify($_POST['qcomment-words']));
info(t('Quick Comment settings saved.') . EOL);
}
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:10,代码来源:qcomment.php
示例3: testXmlifyDocument
/**
* xmlify and put in a document
*/
public function testXmlifyDocument()
{
$tag = "<tag>I want to break</tag>";
$xml = xmlify($tag);
$text = '<text>' . $xml . '</text>';
$xml_parser = xml_parser_create();
//should be possible to parse it
$values = array();
$index = array();
$this->assertEquals(1, xml_parse_into_struct($xml_parser, $text, $values, $index));
$this->assertEquals(array('TEXT' => array(0)), $index);
$this->assertEquals(array(array('tag' => 'TEXT', 'type' => 'complete', 'level' => 1, 'value' => $tag)), $values);
xml_parser_free($xml_parser);
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:17,代码来源:xss_filter_test.php
示例4: categories_widget
function categories_widget($baseurl, $selected = '')
{
$a = get_app();
$saved = get_pconfig($a->profile['profile_uid'], 'system', 'filetags');
if (!strlen($saved)) {
return;
}
$matches = false;
$terms = array();
$cnt = preg_match_all('/<(.*?)>/', $saved, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
$unescaped = xmlify(file_tag_decode($mtch[1]));
$terms[] = array('name' => $unescaped, 'selected' => $selected == $unescaped ? 'selected' : '');
}
}
return replace_macros(get_markup_template('categories_widget.tpl'), array('$title' => t('Categories'), '$desc' => '', '$sel_all' => $selected == '' ? 'selected' : '', '$all' => t('Everything'), '$terms' => $terms, '$base' => $baseurl));
}
开发者ID:robhell,项目名称:friendica,代码行数:18,代码来源:contact_widgets.php
示例5: notifier_run
//.........这里部分代码省略.........
$conversants[] = $item['contact-id'];
// pull out additional tagged people to notify (if public message)
if ($public_message && strlen($item['inform'])) {
$people = explode(',', $item['inform']);
foreach ($people as $person) {
if (substr($person, 0, 4) === 'cid:') {
$recipients[] = intval(substr($person, 4));
$conversants[] = intval(substr($person, 4));
} else {
$url_recipients[] = substr($person, 4);
}
}
}
}
logger('notifier: url_recipients' . print_r($url_recipients, true));
$conversants = array_unique($conversants);
$recipients = array_unique(array_merge($recipients, $allow_people, $allow_groups));
$deny = array_unique(array_merge($deny_people, $deny_groups));
$recipients = array_diff($recipients, $deny);
$conversant_str = dbesc(implode(', ', $conversants));
}
$r = q("SELECT * FROM `contact` WHERE `id` IN ( {$conversant_str} ) AND `blocked` = 0 AND `pending` = 0");
if (count($r)) {
$contacts = $r;
}
}
$feed_template = get_markup_template('atom_feed.tpl');
$mail_template = get_markup_template('atom_mail.tpl');
$atom = '';
$slaps = array();
$hubxml = feed_hublinks();
$birthday = feed_birthday($owner['uid'], $owner['timezone']);
if (strlen($birthday)) {
$birthday = '<dfrn:birthday>' . xmlify($birthday) . '</dfrn:birthday>';
}
$atom .= replace_macros($feed_template, array('$version' => xmlify(FRIENDICA_VERSION), '$feed_id' => xmlify($a->get_baseurl() . '/profile/' . $owner['nickname']), '$feed_title' => xmlify($owner['name']), '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', $updated . '+00:00', ATOM_TIME)), '$hub' => $hubxml, '$salmon' => '', '$name' => xmlify($owner['name']), '$profile_page' => xmlify($owner['url']), '$photo' => xmlify($owner['photo']), '$thumb' => xmlify($owner['thumb']), '$picdate' => xmlify(datetime_convert('UTC', 'UTC', $owner['avatar-date'] . '+00:00', ATOM_TIME)), '$uridate' => xmlify(datetime_convert('UTC', 'UTC', $owner['uri-date'] . '+00:00', ATOM_TIME)), '$namdate' => xmlify(datetime_convert('UTC', 'UTC', $owner['name-date'] . '+00:00', ATOM_TIME)), '$birthday' => $birthday));
if ($mail) {
$public_message = false;
// mail is not public
$body = fix_private_photos($item['body'], $owner['uid']);
$atom .= replace_macros($mail_template, array('$name' => xmlify($owner['name']), '$profile_page' => xmlify($owner['url']), '$thumb' => xmlify($owner['thumb']), '$item_id' => xmlify($item['uri']), '$subject' => xmlify($item['title']), '$created' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00', ATOM_TIME)), '$content' => xmlify($body), '$parent_id' => xmlify($item['parent-uri'])));
} elseif ($fsuggest) {
$public_message = false;
// suggestions are not public
$sugg_template = get_markup_template('atom_suggest.tpl');
$atom .= replace_macros($sugg_template, array('$name' => xmlify($item['name']), '$url' => xmlify($item['url']), '$photo' => xmlify($item['photo']), '$request' => xmlify($item['request']), '$note' => xmlify($item['note'])));
// We don't need this any more
q("DELETE FROM `fsuggest` WHERE `id` = %d LIMIT 1", intval($item['id']));
} else {
if ($followup) {
foreach ($items as $item) {
// there is only one item
if (!$item['parent']) {
continue;
}
if ($item['id'] == $item_id) {
logger('notifier: followup: item: ' . print_r($item, true), LOGGER_DATA);
$slap = atom_entry($item, 'html', $owner, $owner, false);
$atom .= atom_entry($item, 'text', $owner, $owner, false);
}
}
} else {
foreach ($items as $item) {
if (!$item['parent']) {
continue;
}
开发者ID:ryivhnn,项目名称:friendica,代码行数:67,代码来源:notifier.php
示例6: photos_post
//.........这里部分代码省略.........
}
if (count($taginfo)) {
foreach ($taginfo as $tagged) {
$uri = item_new_uri($a->get_hostname(), $page_owner_uid);
$arr = array();
$arr['uid'] = $page_owner_uid;
$arr['uri'] = $uri;
$arr['parent-uri'] = $uri;
$arr['type'] = 'activity';
$arr['wall'] = 1;
$arr['contact-id'] = $owner_record['id'];
$arr['owner-name'] = $owner_record['name'];
$arr['owner-link'] = $owner_record['url'];
$arr['owner-avatar'] = $owner_record['thumb'];
$arr['author-name'] = $owner_record['name'];
$arr['author-link'] = $owner_record['url'];
$arr['author-avatar'] = $owner_record['thumb'];
$arr['title'] = '';
$arr['allow_cid'] = $p[0]['allow_cid'];
$arr['allow_gid'] = $p[0]['allow_gid'];
$arr['deny_cid'] = $p[0]['deny_cid'];
$arr['deny_gid'] = $p[0]['deny_gid'];
$arr['last-child'] = 1;
$arr['visible'] = 1;
$arr['verb'] = ACTIVITY_TAG;
$arr['object-type'] = ACTIVITY_OBJ_PERSON;
$arr['target-type'] = ACTIVITY_OBJ_PHOTO;
$arr['tag'] = $tagged[4];
$arr['inform'] = $tagged[2];
$arr['origin'] = 1;
$arr['body'] = '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]' . ' ' . t('was tagged in a') . ' ' . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('photo') . '[/url]' . ' ' . t('by') . ' ' . '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]';
$arr['body'] .= "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . '[img]' . $a->get_baseurl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.jpg' . '[/img][/url]' . "\n";
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n");
if ($tagged[3]) {
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $tagged[3]['photo'] . '" />' . "\n");
}
$arr['object'] .= '</link></object>' . "\n";
$arr['target'] = '<target><type>' . ACTIVITY_OBJ_PHOTO . '</type><title>' . $p[0]['desc'] . '</title><id>' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '</id>';
$arr['target'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . '" />' . "\n" . '<link rel="preview" type="image/jpeg" href="' . $a->get_baseurl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.jpg' . '" />') . '</link></target>';
$item_id = item_store($arr);
if ($item_id) {
q("UPDATE `item` SET `plink` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1", dbesc($a->get_baseurl() . '/display/' . $owner_record['nickname'] . '/' . $item_id), intval($page_owner_uid), intval($item_id));
proc_run('php', "include/notifier.php", "tag", "{$item_id}");
}
}
}
}
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
return;
// NOTREACHED
}
/**
* default post action - upload a photo
*/
call_hooks('photo_post_init', $_POST);
/**
* Determine the album to use
*/
$album = notags(trim($_REQUEST['album']));
$newalbum = notags(trim($_REQUEST['newalbum']));
logger('mod/photos.php: photos_post(): album= ' . $album . ' newalbum= ' . $newalbum, LOGGER_DEBUG);
if (!strlen($album)) {
if (strlen($newalbum)) {
$album = $newalbum;
} else {
开发者ID:robhell,项目名称:friendica,代码行数:67,代码来源:photos.php
示例7: diaspora_post
function diaspora_post($importer, $xml, $msg)
{
$guid = notags(unxmlify($xml['guid']));
$diaspora_handle = notags(diaspora_get_author($xml));
$app = notags(xmlify($xml['provider_display_name']));
if ($diaspora_handle != $msg['author']) {
logger('diaspora_post: Potential forgery. Message handle is not the same as envelope sender.');
return 202;
}
$xchan = find_diaspora_person_by_handle($diaspora_handle);
if (!$xchan || !strstr($xchan['xchan_network'], 'diaspora')) {
logger('Cannot resolve diaspora handle ' . $diaspora_handle);
return;
}
$contact = diaspora_get_contact_by_handle($importer['channel_id'], $diaspora_handle);
if (!$app) {
if (strstr($xchan['xchan_network'], 'friendica')) {
$app = 'Friendica';
} else {
$app = 'Diaspora';
}
}
$search_guid = strlen($guid) == 64 ? $guid . '%' : $guid;
$r = q("SELECT id FROM item WHERE uid = %d AND mid like '%s' LIMIT 1", intval($importer['channel_id']), dbesc($search_guid));
if ($r) {
// check dates if post editing is implemented
logger('diaspora_post: message exists: ' . $guid);
return;
}
$created = unxmlify($xml['created_at']);
$private = unxmlify($xml['public']) == 'false' ? 1 : 0;
$body = diaspora2bb($xml['raw_message']);
if ($xml['photo']) {
$body = '[img]' . $xml['photo']['remote_photo_path'] . $xml['photo']['remote_photo_name'] . '[/img]' . "\n\n" . $body;
$body = scale_external_images($body);
}
$maxlen = get_max_import_size();
if ($maxlen && mb_strlen($body) > $maxlen) {
$body = mb_substr($body, 0, $maxlen, 'UTF-8');
logger('message length exceeds max_import_size: truncated');
}
$datarray = array();
// Look for tags and linkify them
$results = linkify_tags(get_app(), $body, $importer['channel_id'], true);
$datarray['term'] = array();
if ($results) {
foreach ($results as $result) {
$success = $result['success'];
if ($success['replaced']) {
$datarray['term'][] = array('uid' => $importer['channel_id'], 'ttype' => $success['termtype'], 'otype' => TERM_OBJ_POST, 'term' => $success['term'], 'url' => $success['url']);
}
}
}
$found_tags = false;
$followed_tags = get_pconfig($importer['channel_id'], 'diaspora', 'followed_tags');
if ($followed_tags && $datarray['term']) {
foreach ($datarray['term'] as $t) {
if (in_array($t['term'], $followed_tags)) {
$found_tags = true;
break;
}
}
}
if (!$found_tags && !$contact) {
logger('Author is not a connection and no followed tags.');
return;
}
$cnt = preg_match_all('/@\\[url=(.*?)\\](.*?)\\[\\/url\\]/ism', $body, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
$datarray['term'][] = array('uid' => $importer['channel_id'], 'ttype' => TERM_MENTION, 'otype' => TERM_OBJ_POST, 'term' => $mtch[2], 'url' => $mtch[1]);
}
}
$cnt = preg_match_all('/@\\[zrl=(.*?)\\](.*?)\\[\\/zrl\\]/ism', $body, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
// don't include plustags in the term
$term = substr($mtch[2], -1, 1) === '+' ? substr($mtch[2], 0, -1) : $mtch[2];
$datarray['term'][] = array('uid' => $importer['channel_id'], 'ttype' => TERM_MENTION, 'otype' => TERM_OBJ_POST, 'term' => $term, 'url' => $mtch[1]);
}
}
$plink = service_plink($xchan, $guid);
$datarray['aid'] = $importer['channel_account_id'];
$datarray['uid'] = $importer['channel_id'];
$datarray['verb'] = ACTIVITY_POST;
$datarray['mid'] = $datarray['parent_mid'] = $guid;
$datarray['changed'] = $datarray['created'] = $datarray['edited'] = datetime_convert('UTC', 'UTC', $created);
$datarray['item_private'] = $private;
$datarray['plink'] = $plink;
$datarray['author_xchan'] = $xchan['xchan_hash'];
$datarray['owner_xchan'] = $xchan['xchan_hash'];
$datarray['body'] = $body;
$datarray['app'] = $app;
$datarray['item_unseen'] = 1;
$datarray['item_thread_top'] = 1;
$tgroup = tgroup_check($importer['channel_id'], $datarray);
if (!$importer['system'] && !perm_is_allowed($importer['channel_id'], $xchan['xchan_hash'], 'send_stream') && !$tgroup && !$found_tags) {
logger('diaspora_post: Ignoring this author.');
return 202;
}
//.........这里部分代码省略.........
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:101,代码来源:inbound.php
示例8: item_getfeedattach
function item_getfeedattach($item)
{
$ret = '';
$arr = explode(',', $item['attach']);
if (count($arr)) {
foreach ($arr as $r) {
$matches = false;
$cnt = preg_match('|\\[attach\\]href=\\"(.*?)\\" length=\\"(.*?)\\" type=\\"(.*?)\\" title=\\"(.*?)\\"\\[\\/attach\\]|', $r, $matches);
if ($cnt) {
$ret .= '<link rel="enclosure" href="' . xmlify($matches[1]) . '" type="' . xmlify($matches[3]) . '" ';
if (intval($matches[2])) {
$ret .= 'length="' . intval($matches[2]) . '" ';
}
if ($matches[4] !== ' ') {
$ret .= 'title="' . xmlify(trim($matches[4])) . '" ';
}
$ret .= ' />' . "\r\n";
}
}
}
return $ret;
}
开发者ID:einervonvielen,项目名称:redmatrix,代码行数:22,代码来源:items.php
示例9: tagger_content
function tagger_content(&$a)
{
if (!local_user() && !remote_user()) {
return;
}
$term = notags(trim($_GET['term']));
// no commas allowed
$term = str_replace(array(',', ' '), array('', '_'), $term);
if (!$term) {
return;
}
$item_id = $a->argc > 1 ? notags(trim($a->argv[1])) : 0;
logger('tagger: tag ' . $term . ' item ' . $item_id);
$r = q("SELECT * FROM `item` WHERE `id` = '%s' LIMIT 1", dbesc($item_id));
if (!$item_id || !count($r)) {
logger('tagger: no item ' . $item_id);
return;
}
$item = $r[0];
$owner_uid = $item['uid'];
$r = q("select `nickname`,`blocktags` from user where uid = %d limit 1", intval($owner_uid));
if (count($r)) {
$owner_nick = $r[0]['nickname'];
$blocktags = $r[0]['blocktags'];
}
if (local_user() != $owner_uid) {
return;
}
if (remote_user()) {
$r = q("select * from contact where id = %d AND `uid` = %d limit 1", intval(remote_user()), intval($item['uid']));
} else {
$r = q("select * from contact where self = 1 and uid = %d limit 1", intval(local_user()));
}
if (count($r)) {
$contact = $r[0];
} else {
logger('tagger: no contact_id');
return;
}
$uri = item_new_uri($a->get_hostname(), $owner_uid);
$post_type = $item['resource-id'] ? t('photo') : t('status');
$targettype = $item['resource-id'] ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE;
$link = xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n");
$body = $item['body'];
$target = <<<EOT
\t<target>
\t\t<type>{$targettype}</type>
\t\t<local>1</local>
\t\t<id>{$item['uri']}</id>
\t\t<link>{$link}</link>
\t\t<title></title>
\t\t<content>{$body}</content>
\t</target>
EOT;
$tagid = $a->get_baseurl() . '/search?search=' . $term;
$objtype = ACTIVITY_OBJ_TAGTERM;
$obj = <<<EOT
\t<object>
\t\t<type>{$objtype}</type>
\t\t<local>1</local>
\t\t<id>{$tagid}</id>
\t\t<link>{$tagid}</link>
\t\t<title>{$term}</title>
\t\t<content>{$term}</content>
\t</object>
EOT;
$bodyverb = t('%1$s tagged %2$s\'s %3$s with %4$s');
if (!isset($bodyverb)) {
return;
}
$termlink = html_entity_decode('⌗') . '[url=' . $a->get_baseurl() . '/search?search=' . urlencode($term) . ']' . $term . '[/url]';
$arr = array();
$arr['uri'] = $uri;
$arr['uid'] = $owner_uid;
$arr['contact-id'] = $contact['id'];
$arr['type'] = 'activity';
$arr['wall'] = $item['wall'];
$arr['gravity'] = GRAVITY_COMMENT;
$arr['parent'] = $item['id'];
$arr['parent-uri'] = $item['uri'];
$arr['owner-name'] = $item['author-name'];
$arr['owner-link'] = $item['author-link'];
$arr['owner-avatar'] = $item['author-avatar'];
$arr['author-name'] = $contact['name'];
$arr['author-link'] = $contact['url'];
$arr['author-avatar'] = $contact['thumb'];
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
$plink = '[url=' . $item['plink'] . ']' . $post_type . '[/url]';
$arr['body'] = sprintf($bodyverb, $ulink, $alink, $plink, $termlink);
$arr['verb'] = ACTIVITY_TAG;
$arr['target-type'] = $targettype;
$arr['target'] = $target;
$arr['object-type'] = $objtype;
$arr['object'] = $obj;
$arr['allow_cid'] = $item['allow_cid'];
$arr['allow_gid'] = $item['allow_gid'];
$arr['deny_cid'] = $item['deny_cid'];
$arr['deny_gid'] = $item['deny_gid'];
$arr['visible'] = 1;
//.........这里部分代码省略.........
开发者ID:nextgensh,项目名称:friendica,代码行数:101,代码来源:tagger.php
示例10: ljpost_send
function ljpost_send(&$a, &$b)
{
if ($b['deleted'] || $b['private'] || $b['created'] !== $b['edited']) {
return;
}
if (!strstr($b['postopts'], 'ljpost')) {
return;
}
if ($b['parent'] != $b['id']) {
return;
}
// LiveJournal post in the LJ user's timezone.
// Hopefully the person's Friendica account
// will be set to the same thing.
$tz = 'UTC';
$x = q("select timezone from user where uid = %d limit 1", intval($b['uid']));
if ($x && strlen($x[0]['timezone'])) {
$tz = $x[0]['timezone'];
}
$lj_username = xmlify(get_pconfig($b['uid'], 'ljpost', 'lj_username'));
$lj_password = xmlify(get_pconfig($b['uid'], 'ljpost', 'lj_password'));
$lj_journal = xmlify(get_pconfig($b['uid'], 'ljpost', 'lj_journal'));
// if(! $lj_journal)
// $lj_journal = $lj_username;
$lj_blog = xmlify(get_pconfig($b['uid'], 'ljpost', 'lj_blog'));
if (!strlen($lj_blog)) {
$lj_blog = xmlify('http://www.livejournal.com/interface/xmlrpc');
}
if ($lj_username && $lj_password && $lj_blog) {
require_once 'include/bbcode.php';
require_once 'include/datetime.php';
$title = xmlify($b['title']);
$post = bbcode($b['body']);
$post = xmlify($post);
$tags = ljpost_get_tags($b['tag']);
$date = datetime_convert('UTC', $tz, $b['created'], 'Y-m-d H:i:s');
$year = intval(substr($date, 0, 4));
$mon = intval(substr($date, 5, 2));
$day = intval(substr($date, 8, 2));
$hour = intval(substr($date, 11, 2));
$min = intval(substr($date, 14, 2));
$xml = <<<EOT
<?xml version="1.0" encoding="utf-8"?>
<methodCall>
<methodName>LJ.XMLRPC.postevent</methodName>
<params>
<param><value>
<struct>
<member><name>username</name><value><string>{$lj_username}</string></value></member>
<member><name>password</name><value><string>{$lj_password}</string></value></member>
<member><name>event</name><value><string>{$post}</string></value></member>
<member><name>subject</name><value><string>{$title}</string></value></member>
<member><name>lineendings</name><value><string>unix</string></value></member>
<member><name>year</name><value><int>{$year}</int></value></member>
<member><name>mon</name><value><int>{$mon}</int></value></member>
<member><name>day</name><value><int>{$day}</int></value></member>
<member><name>hour</name><value><int>{$hour}</int></value></member>
<member><name>min</name><value><int>{$min}</int></value></member>
\t\t<member><name>usejournal</name><value><string>{$lj_username}</string></value></member>
\t\t<member>
\t\t\t<name>props</name>
\t\t\t<value>
\t\t\t\t<struct>
\t\t\t\t\t<member>
\t\t\t\t\t\t<name>useragent</name>
\t\t\t\t\t\t<value><string>Friendica</string></value>
\t\t\t\t\t</member>
\t\t\t\t\t<member>
\t\t\t\t\t\t<name>taglist</name>
\t\t\t\t\t\t<value><string>{$tags}</string></value>
\t\t\t\t\t</member>
\t\t\t\t</struct>
\t\t\t</value>
\t\t</member>
</struct>
</value></param>
</params>
</methodCall>
EOT;
logger('ljpost: data: ' . $xml, LOGGER_DATA);
if ($lj_blog !== 'test') {
$x = post_url($lj_blog, $xml, array("Content-Type: text/xml"));
}
logger('posted to livejournal: ' . $x ? $x : '', LOGGER_DEBUG);
}
}
开发者ID:robhell,项目名称:friendica-addons,代码行数:87,代码来源:ljpost.php
示例11: xmlize
function xmlize($href, $name, $url, $photo, $date, $message)
{
$notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s">%s</note>';
return sprintf($notsxml, xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($message));
}
开发者ID:ryivhnn,项目名称:friendica,代码行数:5,代码来源:ping.php
示例12: pumpio_dolike
function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = true)
{
require_once 'include/items.php';
// Searching for the liked post
// Two queries for speed issues
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($post->object->id), intval($uid));
if (count($r)) {
$orig_post = $r[0];
} else {
$r = q("SELECT * FROM `item` WHERE `extid` = '%s' AND `uid` = %d LIMIT 1", dbesc($post->object->id), intval($uid));
if (!count($r)) {
return;
} else {
$orig_post = $r[0];
}
}
// thread completion
if ($threadcompletion) {
pumpio_fetchallcomments($a, $uid, $post->object->id);
}
$contactid = 0;
if (link_compare($post->actor->url, $own_id)) {
$contactid = $self[0]['id'];
$post->actor->displayName = $self[0]['name'];
$post->actor->url = $self[0]['url'];
$post->actor->image->url = $self[0]['photo'];
} else {
$r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1", dbesc($post->actor->url), intval($uid));
if (count($r)) {
$contactid = $r[0]['id'];
}
if ($contactid == 0) {
$contactid = $orig_post['contact-id'];
}
}
$r = q("SELECT parent FROM `item` WHERE `verb` = '%s' AND `uid` = %d AND `contact-id` = %d AND `thr-parent` = '%s' LIMIT 1", dbesc(ACTIVITY_LIKE), intval($uid), intval($contactid), dbesc($orig_post['uri']));
if (count($r)) {
logger("pumpio_dolike: found existing like. User " . $own_id . " " . $uid . " Contact: " . $contactid . " Url " . $orig_post['uri']);
return;
}
$likedata = array();
$likedata['parent'] = $orig_post['id'];
$likedata['verb'] = ACTIVITY_LIKE;
$likedata['gravity'] = 3;
$likedata['uid'] = $uid;
$likedata['wall'] = 0;
$likedata['uri'] = item_new_uri($a->get_baseurl(), $uid);
$likedata['parent-uri'] = $orig_post["uri"];
$likedata['contact-id'] = $contactid;
$likedata['app'] = $post->generator->displayName;
$likedata['author-name'] = $post->actor->displayName;
$likedata['author-link'] = $post->actor->url;
$likedata['author-avatar'] = $post->actor->image->url;
$author = '[url=' . $likedata['author-link'] . ']' . $likedata['author-name'] . '[/url]';
$objauthor = '[url=' . $orig_post['author-link'] . ']' . $orig_post['author-name'] . '[/url]';
$post_type = t('status');
$plink = '[url=' . $orig_post['plink'] . ']' . $post_type . '[/url]';
$likedata['object-type'] = ACTIVITY_OBJ_NOTE;
$likedata['body'] = sprintf(t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
$likedata['object'] = '<object><type>' . ACTIVITY_OBJ_NOTE . '</type><local>1</local>' . '<id>' . $orig_post['uri'] . '</id><link>' . xmlify('<link rel="alternate" type="text/html" href="' . xmlify($orig_post['plink']) . '" />') . '</link><title>' . $orig_post['title'] . '</title><content>' . $orig_post['body'] . '</content></object>';
$ret = item_store($likedata);
logger("pumpio_dolike: " . $ret . " User " . $own_id . " " . $uid . " Contact: " . $contactid . " Url " . $orig_post['uri']);
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:63,代码来源:pumpio.php
示例13: subthread_content
function subthread_content(&$a)
{
if (!local_user() && !remote_user()) {
return;
}
$activity = ACTIVITY_FOLLOW;
$item_id = $a->argc > 1 ? notags(trim($a->argv[1])) : 0;
$r = q("SELECT * FROM `item` WHERE `parent` = '%s' OR `parent-uri` = '%s' and parent = id LIMIT 1", dbesc($item_id), dbesc($item_id));
if (!$item_id || !count($r)) {
logger('subthread: no item ' . $item_id);
return;
}
$item = $r[0];
$owner_uid = $item['uid'];
if (!can_write_wall($a, $owner_uid)) {
return;
}
$remote_owner = null;
if (!$item['wall']) {
// The top level post may have been written by somebody on another system
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($item['contact-id']), intval($item['uid']));
if (!count($r)) {
return;
}
if (!$r[0]['self']) {
$remote_owner = $r[0];
}
}
// this represents the post owner on this system.
$r = q("SELECT `contact`.*, `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`\n\t\tWHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1", intval($owner_uid));
if (count($r)) {
$owner = $r[0];
}
if (!$owner) {
logger('like: no owner');
return;
}
if (!$remote_owner) {
$remote_owner = $owner;
}
// This represents the person posting
if (local_user() && local_user() == $owner_uid) {
$contact = $owner;
} else {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($_SESSION['visitor_id']), intval($owner_uid));
if (count($r)) {
$contact = $r[0];
}
}
if (!$contact) {
return;
}
$uri = item_new_uri($a->get_hostname(), $owner_uid);
$post_type = $item['resource-id'] ? t('photo') : t('status');
$objtype = $item['resource-id'] ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE;
$link = xmlify('<link rel="alternate" type="text/html" href="' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n");
$body = $item['body'];
$obj = <<<EOT
\t<object>
\t\t<type>{$objtype}</type>
\t\t<local>1</local>
\t\t<id>{$item['uri']}</id>
\t\t<link>{$link}</link>
\t\t<title></title>
\t\t<content>{$body}</content>
\t</object>
EOT;
$bodyverb = t('%1$s is following %2$s\'s %3$s');
if (!isset($bodyverb)) {
return;
}
$arr = array();
$arr['uri'] = $uri;
$arr['uid'] = $owner_uid;
$arr['contact-id'] = $contact['id'];
$arr['type'] = 'activity';
$arr['wall'] = $item['wall'];
$arr['origin'] = 1;
$arr['gravity'] = GRAVITY_LIKE;
$arr['parent'] = $item['id'];
$arr['parent-uri'] = $item['uri'];
$arr['thr-parent'] = $item['uri'];
$arr['owner-name'] = $remote_owner['name'];
$arr['owner-link'] = $remote_owner['url'];
$arr['owner-avatar'] = $remote_owner['thumb'];
$arr['author-name'] = $contact['name'];
$arr['author-link'] = $contact['url'];
$arr['author-avatar'] = $contact['thumb'];
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
$plink = '[url=' . $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . ']' . $post_type . '[/url]';
$arr['body'] = sprintf($bodyverb, $ulink, $alink, $plink);
$arr['verb'] = $activity;
$arr['object-type'] = $objtype;
$arr['object'] = $obj;
$arr['allow_cid'] = $item['allow_cid'];
$arr['allow_gid'] = $item['allow_gid'];
$arr['deny_cid'] = $item['deny_cid'];
$arr['deny_gid'] = $item['deny_gid'];
//.........这里部分代码省略.........
开发者ID:ridcully,项目名称:friendica,代码行数:101,代码来源:subthread.php
示例14: xmlize
function xmlize($href, $name, $url, $photo, $date, $seen, $message)
{
require_once "mod/proxy.php";
$photo = proxy_url($photo);
$data = array('href' => &$href, 'name' => &$name, 'url' => &$url, 'photo' => &$photo, 'date' => &$date, 'seen' => &$seen, 'messsage' => &$message);
call_hooks('ping_xmlize', $data);
$notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" >%s</note>';
return sprintf($notsxml, xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($seen), xmlify($message));
}
开发者ID:jzacman,项目名称:friendica,代码行数:9,代码来源:ping.php
示例15: diaspora_send_mail
function diaspora_send_mail($item, $owner, $contact)
{
$a = get_app();
$myaddr = $owner['channel_address'] . '@' . get_app()->get_hostname();
$r = q("select * from conv where id = %d and uid = %d limit 1", intval($item['convid']), intval($item['channel_id']));
if (!count($r)) {
logger('diaspora_send_mail: conversation not found.');
return;
}
$cnv = $r[0];
$conv = array('guid' => xmlify($cnv['guid']), 'subject' => xmlify($cnv['subject']), 'created_at' => xmlify(datetime_convert('UTC', 'UTC', $cnv['created'], 'Y-m-d H:i:s \\U\\T\\C')), 'diaspora_handle' => xmlify($cnv['creator']), 'participant_handles' => xmlify($cnv['recips']));
if (array_key_exists('mail_flags', $item) && $item['mail_flags'] & MAIL_OBSCURED) {
$key = get_config('system', 'prvkey');
// if($item['title'])
// $item['title'] = crypto_unencapsulate(json_decode_plus($item['title']),$key);
if ($item['body']) {
$item['body'] = crypto_unencapsulate(json_decode_plus($item['body']), $key);
}
}
$body = bb2diaspora($item['body']);
$created = datetime_convert('UTC', 'UTC', $item['created'], 'Y-m-d H:i:s \\U\\T\\C');
$signed_text = $item['mid'] . ';' . $cnv['guid'] . ';' . $body . ';' . $created . ';' . $myaddr . ';' . $cnv['guid'];
$sig = base64_encode(rsa_sign($signed_text, $owner['channel_prvkey'], 'sha256'));
$msg = array('guid' => xmlify($item['mid']), 'parent_guid' => xmlify($cnv['guid']), 'parent_author_signature' => $item['reply'] ? null : xmlify($sig), 'author_signature' => xmlify($sig), 'text' => xmlify($body), 'created_at' => xmlify($created), 'diaspora_handle' => xmlify($myaddr), 'conversation_guid' => xmlify($cnv['guid']));
if ($item['reply']) {
$tpl = get_markup_template('diaspora_message.tpl');
$xmsg = replace_macros($tpl, array('$msg' => $msg));
} else {
$conv['messages'] = array($msg);
$tpl = get_markup_template('diaspora_conversation.tpl');
$xmsg = replace_macros($tpl, array('$conv' => $conv));
}
logger('diaspora_conversation: ' . print_r($xmsg, true), LOGGER_DATA);
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($xmsg, $owner, $contact, $owner['channel_prvkey'], $contact['xchan_pubkey'], false)));
return diaspora_transmit($owner, $contact, $slap, false);
}
开发者ID:redmatrix,项目名称:red,代码行数:36,代码来源:diaspora.php
示例16: diaspora_profile_change
function diaspora_profile_change($channel, $recip, $public_batch = false)
{
$channel_id = $channel['channel_id'];
$r = q("SELECT profile.uid AS profile_uid, profile.* , channel.* FROM profile\n\t\tleft join channel on profile.uid = channel.channel_id\n\t\tWHERE channel.channel_id = %d and profile.is_default = 1 ", intval($channel_id));
$profile_visible = perm_is_allowed($channel_id, '', 'view_profile');
if (!$r) {
return;
}
$profile = $r[0];
$handle = xmlify($channel['channel_address'] . '@' . App::get_hostname());
$first = xmlify(strpos($profile['channel_name'], ' ') ? trim(substr($profile['channel_name'], 0, strpos($profile['channel_name'], ' '))) : $profile['channel_name']);
$last = xmlify($first === $profile['channel_name'] ? '' : trim(substr($profile['channel_name'], strlen($first))));
$large = xmlify(z_root() . '/photo/profile/300/' . $profile['profile_uid'] . '.jpg');
$medium = xmlify(z_root() . '/photo/profile/100/' . $profile['profile_uid'] . '.jpg');
$small = xmlify(z_root() . '/photo/profile/50/' . $profile['profile_uid'] . '.jpg');
$searchable = xmlify($profile_visible ? 'true' : 'false');
$nsfw = $channel['channel_pageflags'] & (PAGE_ADULT | PAGE_CENSORED) ? 'true' : 'false';
if ($searchable === 'true') {
$dob = '1000-00-00';
if ($profile['dob'] && $profile['dob'] != '0000-00-00') {
$dob = (intval($profile['dob']) ? intval($profile['dob']) : '1000') . '-' . datetime_convert('UTC', 'UTC', $profile['dob'], 'm-d');
}
if ($dob === '1000-00-00') {
$dob = '';
}
$gender = xmlify($profile['gender']);
$about = $profile['about'];
require_once 'include/bbcode.php';
$about = xmlify(strip_tags(bbcode($about)));
$location = '';
if ($profile['locality']) {
$location .= $profile['locality'];
}
if ($profile['region']) {
if ($location) {
$location .= ', ';
}
$location .= $profile['region'];
}
if ($profile['country_name']) {
if ($location) {
$location .= ', ';
}
$location .= $profile['country_name'];
}
$location = xmlify($location);
$tags = '';
if ($profile['keywords']) {
$kw = str_replace(',', ' ', $profile['keywords']);
$kw = str_replace(' ', ' ', $kw);
$arr = explode(' ', $profile['keywords']);
if (count($arr)) {
for ($x = 0; $x < 5; $x++) {
if (trim($arr[$x])) {
$tags .= '#' . trim($arr[$x]) . ' ';
}
}
}
}
$tags = xmlify(trim($tags));
}
$tpl = get_markup_template('diaspora_profile.tpl', 'addon/diaspora');
$msg = replace_macros($tpl, array('$handle' => $handle, '$first' => $first, '$last' => $last, '$large' => $large, '$medium' => $medium, '$small' => $small, '$dob' => $dob, '$gender' => $gender, '$about' => $about, '$location' => $location, '$searchable' => $searchable, '$nsfw' => $nsfw, '$tags' => $tags));
logger('profile_change: ' . $msg, LOGGER_ALL, LOG_DEBUG);
$slap = 'xml=' . urlencode(urlencode(diaspora_msg_build($msg, $channel, $recip, $channel['channel_prvkey'], $recip['xchan_pubkey'], $public_batch)));
return diaspora_queue($channel, $recip, $slap, $public_batch);
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:67,代码来源:outbound.php
示例17: profile_activity
function profile_activity($changed, $value)
{
$a = get_app();
if (!local_user() || !is_array($changed) || !count($changed))
|
请发表评论