X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=ljpost%2Fljpost.php;h=dc17e83fc8e7d667b71c1bad2a440ba8c2d03238;hb=0d6a2e7e93357eecd2954dae6b81b20b09ee0315;hp=8910adb6b37676b262a4ecb1e2a8f0e49399a764;hpb=734d400b2f1a29ab595d1db0ee43be812a0fbdd7;p=friendica-addons.git diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php old mode 100644 new mode 100755 index 8910adb6..dc17e83f --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -4,8 +4,9 @@ * Name: LiveJournal Post Connector * Description: Post to LiveJournal * Version: 1.0 - * Author: Tony Baldwin + * Author: Tony Baldwin * Author: Michael Johnston + * Author: Cat Gray */ function ljpost_install() { @@ -82,11 +83,6 @@ function ljpost_settings(&$a,&$s) { $s .= ''; $s .= '
'; - $s .= '
'; - $s .= ''; - $s .= ''; - $s .= '
'; - $s .= '
'; $s .= ''; $s .= ''; @@ -166,18 +162,25 @@ function ljpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $lj_username = get_pconfig($b['uid'],'ljpost','lj_username'); - $lj_password = get_pconfig($b['uid'],'ljpost','lj_password'); - $lj_blog = '$lj_url/interface/xmlrpc'; + $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 = $b['title']; + $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)); @@ -195,7 +198,6 @@ function ljpost_send(&$a,&$b) { username$lj_username password$lj_password - usejournal$lj_username event$post subject$title lineendingsunix @@ -204,6 +206,22 @@ function ljpost_send(&$a,&$b) { day$day hour$hour min$min + usejournal$lj_username + + props + + + + useragent + Friendica + + + taglist + $tags + + + + @@ -214,9 +232,15 @@ EOT; logger('ljpost: data: ' . $xml, LOGGER_DATA); if($lj_blog !== 'test') - $x = post_url($lj_blog,$xml); + $x = post_url($lj_blog,$xml,array("Content-Type: text/xml")); logger('posted to livejournal: ' . ($x) ? $x : '', LOGGER_DEBUG); } } +function ljpost_get_tags($post) +{ + preg_match_all("/\]([^\[#]+)\[/",$post,$matches); + $tags = implode(', ',$matches[1]); + return $tags; +}