corrections, minor alterations

This commit is contained in:
Tony Baldwin 2012-03-17 18:34:25 -04:00
parent f26c87aaea
commit 3d38180d8f
4 changed files with 52 additions and 84 deletions

View File

@ -150,7 +150,7 @@ function dwpost_send(&$a,&$b) {
if($b['parent'] != $b['id']) if($b['parent'] != $b['id'])
return; return;
// dreamwidth post in the DW user's timezone. // dreamwidth post in the LJ user's timezone.
// Hopefully the person's Friendica account // Hopefully the person's Friendica account
// will be set to the same thing. // will be set to the same thing.
@ -166,10 +166,6 @@ function dwpost_send(&$a,&$b) {
$dw_password = get_pconfig($b['uid'],'dwpost','dw_password'); $dw_password = get_pconfig($b['uid'],'dwpost','dw_password');
$dw_blog = 'http://www.dreamwidth.org/interface/xmlrpc'; $dw_blog = 'http://www.dreamwidth.org/interface/xmlrpc';
$dw_blog = xmlify(get_pconfig($b['uid'],'dwpost','dw_blog'));
if(! strlen($dw_blog))
$dw_blog = xmlify('http://www.dreamwidth.org/interface/xmlrpc');
if($dw_username && $dw_password && $dw_blog) { if($dw_username && $dw_password && $dw_blog) {
require_once('include/bbcode.php'); require_once('include/bbcode.php');
@ -189,40 +185,27 @@ function dwpost_send(&$a,&$b) {
$xml = <<< EOT $xml = <<< EOT
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<methodCall> <methodCall><methodName>LJ.XMLRPC.postevent</methodName>
<methodName>LJ.XMLRPC.postevent</methodName> <params><param>
<params> <value><struct>
<param><value>
<struct>
<member><name>username</name><value><string>$dw_username</string></value></member>
<member><name>password</name><value><string>$dw_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>year</name><value><int>$year</int></value></member>
<member><name>mon</name><value><int>$mon</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>day</name><value><int>$day</int></value></member>
<member><name>hour</name><value><int>$hour</int></value></member> <member><name>hour</name><value><int>$hour</int></value></member>
<member><name>min</name><value><int>$min</int></value></member> <member><name>min</name><value><int>$min</int></value></member>
<member><name>usejournal</name><value><string>$lj_username</string></value></member> <member><name>event</name><value><string>$post</string></value></member>
<member> <member><name>username</name><value><string>$dw_username</string></value></member>
<name>props</name> <member><name>password</name><value><string>$dw_password</string></value></member>
<value> <member><name>subject</name><value><string>$title</string></value></member>
<struct> <member><name>lineendings</name><value><string>unix</string></value></member>
<member> <member><name>ver</name><value><int>1</int></value></member>
<name>useragent</name> <member><name>props</name>
<value><string>Friendica</string></value> <value><struct>
</member> <member><name>useragent</name><value><string>Friendica</string></value></member>
<member> <member><name>taglist</name><value><string>$tags</string></value></member>
<name>taglist</name> </struct></value></member>
<value><string>$tags</string></value> </struct></value>
</member> </param></params>
</struct>
</value>
</member>
</struct>
</value></param>
</params>
</methodCall> </methodCall>
EOT; EOT;

Binary file not shown.

View File

@ -2,7 +2,7 @@
/** /**
* Name: Insanejournal Post Connector * Name: Insanejournal Post Connector
* Description: Post to insanejournal * Description: Post to Insanejournal
* Version: 1.0 * Version: 1.0
* Author: Tony Baldwin <https://free-haven.org/profile/tony> * Author: Tony Baldwin <https://free-haven.org/profile/tony>
* Author: Michael Johnston * Author: Michael Johnston
@ -67,7 +67,7 @@ function ijpost_settings(&$a,&$s) {
/* Add some HTML to the existing form */ /* Add some HTML to the existing form */
$s .= '<div class="settings-block">'; $s .= '<div class="settings-block">';
$s .= '<h3>' . t('insanejournal Post Settings') . '</h3>'; $s .= '<h3>' . t('Insanejournal Post Settings') . '</h3>';
$s .= '<div id="ijpost-enable-wrapper">'; $s .= '<div id="ijpost-enable-wrapper">';
$s .= '<label id="ijpost-enable-label" for="ijpost-checkbox">' . t('Enable insanejournal Post Plugin') . '</label>'; $s .= '<label id="ijpost-enable-label" for="ijpost-checkbox">' . t('Enable insanejournal Post Plugin') . '</label>';
$s .= '<input id="ijpost-checkbox" type="checkbox" name="ijpost" value="1" ' . $checked . '/>'; $s .= '<input id="ijpost-checkbox" type="checkbox" name="ijpost" value="1" ' . $checked . '/>';
@ -150,7 +150,7 @@ function ijpost_send(&$a,&$b) {
if($b['parent'] != $b['id']) if($b['parent'] != $b['id'])
return; return;
// insanejournal post in the LJ user's timezone. // insanejournal post in the IJ user's timezone.
// Hopefully the person's Friendica account // Hopefully the person's Friendica account
// will be set to the same thing. // will be set to the same thing.
@ -162,20 +162,16 @@ function ijpost_send(&$a,&$b) {
if($x && strlen($x[0]['timezone'])) if($x && strlen($x[0]['timezone']))
$tz = $x[0]['timezone']; $tz = $x[0]['timezone'];
$ij_username = xmlify(get_pconfig($b['uid'],'ijpost','ij_username')); $ij_username = get_pconfig($b['uid'],'ijpost','ij_username');
$ij_password = xmlify(get_pconfig($b['uid'],'ijpost','ij_password')); $ij_password = get_pconfig($b['uid'],'ijpost','ij_password');
$ij_journal = xmlify(get_pconfig($b['uid'],'ijpost','ij_journal')); $ij_blog = 'http://www.insanejournal.com/interface/xmlrpc';
$ij_blog = xmlify(get_pconfig($b['uid'],'ijpost','ij_blog'));
if(! strlen($ij_blog))
$ij_blog = xmlify('http://www.insanejournal.com/interface/xmlrpc');
if($ij_username && $ij_password && $ij_blog) { if($ij_username && $ij_password && $ij_blog) {
require_once('include/bbcode.php'); require_once('include/bbcode.php');
require_once('include/datetime.php'); require_once('include/datetime.php');
$title = xmlify($b['title']); $title = $b['title'];
$post = bbcode($b['body']); $post = bbcode($b['body']);
$post = xmlify($post); $post = xmlify($post);
$tags = ijpost_get_tags($b['tag']); $tags = ijpost_get_tags($b['tag']);
@ -189,40 +185,27 @@ function ijpost_send(&$a,&$b) {
$xml = <<< EOT $xml = <<< EOT
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<methodCall> <methodCall><methodName>LJ.XMLRPC.postevent</methodName>
<methodName>LJ.XMLRPC.postevent</methodName> <params><param>
<params> <value><struct>
<param><value>
<struct>
<member><name>username</name><value><string>$ij_username</string></value></member>
<member><name>password</name><value><string>$ij_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>year</name><value><int>$year</int></value></member>
<member><name>mon</name><value><int>$mon</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>day</name><value><int>$day</int></value></member>
<member><name>hour</name><value><int>$hour</int></value></member> <member><name>hour</name><value><int>$hour</int></value></member>
<member><name>min</name><value><int>$min</int></value></member> <member><name>min</name><value><int>$min</int></value></member>
<member><name>usejournal</name><value><string>$ij_username</string></value></member> <member><name>event</name><value><string>$post</string></value></member>
<member> <member><name>username</name><value><string>$ij_username</string></value></member>
<name>props</name> <member><name>password</name><value><string>$ij_password</string></value></member>
<value> <member><name>subject</name><value><string>$title</string></value></member>
<struct> <member><name>lineendings</name><value><string>unix</string></value></member>
<member> <member><name>ver</name><value><int>1</int></value></member>
<name>useragent</name> <member><name>props</name>
<value><string>Friendica</string></value> <value><struct>
</member> <member><name>useragent</name><value><string>Friendica</string></value></member>
<member> <member><name>taglist</name><value><string>$tags</string></value></member>
<name>taglist</name> </struct></value></member>
<value><string>$tags</string></value> </struct></value>
</member> </param></params>
</struct>
</value>
</member>
</struct>
</value></param>
</params>
</methodCall> </methodCall>
EOT; EOT;

View File

@ -165,6 +165,8 @@ function ljpost_send(&$a,&$b) {
$lj_username = xmlify(get_pconfig($b['uid'],'ljpost','lj_username')); $lj_username = xmlify(get_pconfig($b['uid'],'ljpost','lj_username'));
$lj_password = xmlify(get_pconfig($b['uid'],'ljpost','lj_password')); $lj_password = xmlify(get_pconfig($b['uid'],'ljpost','lj_password'));
$lj_journal = xmlify(get_pconfig($b['uid'],'ljpost','lj_journal')); $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')); $lj_blog = xmlify(get_pconfig($b['uid'],'ljpost','lj_blog'));
if(! strlen($lj_blog)) if(! strlen($lj_blog))