From c35b9f94ba65c2156e477e4723eee5fa5b710210 Mon Sep 17 00:00:00 2001 From: Tony Baldwin Date: Sat, 3 Mar 2012 09:12:33 -0500 Subject: [PATCH 01/10] added a link in the IRC page to the tldp.org Beginner's Guide to IRC. --- irc/irc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/irc/irc.php b/irc/irc.php index 397844e0..a66fc826 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -35,6 +35,7 @@ $o = ''; // add the chatroom frame and some html $o .= <<< EOT

IRC chat

+

a beginner's guid to using IRC.

EOT; From 7949cf3f5332352065ff3730b9d0d3b47e223d11 Mon Sep 17 00:00:00 2001 From: Tony Baldwin Date: Sat, 17 Mar 2012 16:40:17 -0400 Subject: [PATCH 02/10] cleaned up where "lj" was included in dwpost.css changed my profile url to the current, free-haven profile, in all plugins to which I have contributed added insanejournal.com plugin, ijpost other minor cleanup of details, where a plugin was copied and modified but incorrect details were left. --- dwpost/dwpost.css | 8 +- dwpost/dwpost.php | 2 +- ijpost.tar.gz | Bin 0 -> 20480 bytes ijpost/ijpost.css | 15 ++++ ijpost/ijpost.php | 218 ++++++++++++++++++++++++++++++++++++++++++++++ irc/irc.php | 2 +- ljpost/ljpost.php | 2 +- 7 files changed, 240 insertions(+), 7 deletions(-) create mode 100644 ijpost.tar.gz create mode 100644 ijpost/ijpost.css create mode 100644 ijpost/ijpost.php diff --git a/dwpost/dwpost.css b/dwpost/dwpost.css index 8edab3d9..3b0ee32a 100644 --- a/dwpost/dwpost.css +++ b/dwpost/dwpost.css @@ -1,15 +1,15 @@ -#ljpost-enable-label, #ljpost-username-label, #ljpost-password-label, #ljpost-bydefault-label { +#dwpost-enable-label, #dwpost-username-label, #dwpost-password-label, #dwpost-bydefault-label { float: left; width: 200px; margin-top: 10px; } -#ljpost-checkbox, #ljpost-username, #ljpost-password, #ljpost-bydefault { +#dwpost-checkbox, #dwpost-username, #dwpost-password, #dwpost-bydefault { float: left; margin-top: 10px; } -#ljpost-submit { +#dwpost-submit { margin-top: 15px; -} \ No newline at end of file +} diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index c7bfd939..bb455726 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -4,7 +4,7 @@ * Name: Dreamwidth Post Connector * Description: Post to dreamwidth * Version: 1.0 - * Author: Tony Baldwin + * Author: Tony Baldwin * Author: Michael Johnston */ diff --git a/ijpost.tar.gz b/ijpost.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..c274902c05308c6dd20bfbad08813f95aad69375 GIT binary patch literal 20480 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 + */ + +function ijpost_install() { + register_hook('post_local', 'addon/ijpost/ijpost.php', 'ijpost_post_local'); + register_hook('notifier_normal', 'addon/ijpost/ijpost.php', 'ijpost_send'); + register_hook('jot_networks', 'addon/ijpost/ijpost.php', 'ijpost_jot_nets'); + register_hook('connector_settings', 'addon/ijpost/ijpost.php', 'ijpost_settings'); + register_hook('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post'); + +} +function ijpost_uninstall() { + unregister_hook('post_local', 'addon/ijpost/ijpost.php', 'ijpost_post_local'); + unregister_hook('notifier_normal', 'addon/ijpost/ijpost.php', 'ijpost_send'); + unregister_hook('jot_networks', 'addon/ijpost/ijpost.php', 'ijpost_jot_nets'); + unregister_hook('connector_settings', 'addon/ijpost/ijpost.php', 'ijpost_settings'); + unregister_hook('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post'); + +} + + +function ijpost_jot_nets(&$a,&$b) { + if(! local_user()) + return; + + $dw_post = get_pconfig(local_user(),'ijpost','post'); + if(intval($dw_post) == 1) { + $dw_defpost = get_pconfig(local_user(),'ijpost','post_by_default'); + $selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : ''); + $b .= '
' + . t('Post to InsaneJournal') . '
'; + } +} + + +function ijpost_settings(&$a,&$s) { + + if(! local_user()) + return; + + /* Add our stylesheet to the page so we can make our settings look nice */ + + $a->page['htmlhead'] .= '' . "\r\n"; + + /* Get the current state of our config variables */ + + $enabled = get_pconfig(local_user(),'ijpost','post'); + + $checked = (($enabled) ? ' checked="checked" ' : ''); + + $def_enabled = get_pconfig(local_user(),'ijpost','post_by_default'); + + $def_checked = (($def_enabled) ? ' checked="checked" ' : ''); + + $dw_username = get_pconfig(local_user(), 'ijpost', 'dw_username'); + $dw_password = get_pconfig(local_user(), 'ijpost', 'dw_password'); + + + /* Add some HTML to the existing form */ + + $s .= '
'; + $s .= '

' . t('InsaneJournal Post Settings') . '

'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + /* provide a submit button */ + + $s .= '
'; + +} + + +function ijpost_settings_post(&$a,&$b) { + + if(x($_POST,'ijpost-submit')) { + + set_pconfig(local_user(),'ijpost','post',intval($_POST['ijpost'])); + set_pconfig(local_user(),'ijpost','post_by_default',intval($_POST['dw_bydefault'])); + set_pconfig(local_user(),'ijpost','dw_username',trim($_POST['dw_username'])); + set_pconfig(local_user(),'ijpost','dw_password',trim($_POST['dw_password'])); + + } + +} + +function ijpost_post_local(&$a,&$b) { + + // This can probably be changed to allow editing by pointing to a different API endpoint + + if($b['edit']) + return; + + if((! local_user()) || (local_user() != $b['uid'])) + return; + + if($b['private'] || $b['parent']) + return; + + $dw_post = intval(get_pconfig(local_user(),'ijpost','post')); + + $dw_enable = (($dw_post && x($_REQUEST,'ijpost_enable')) ? intval($_REQUEST['ijpost_enable']) : 0); + + if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ijpost','post_by_default'))) + $dw_enable = 1; + + if(! $dw_enable) + return; + + if(strlen($b['postopts'])) + $b['postopts'] .= ','; + $b['postopts'] .= 'ijpost'; +} + + + + +function ijpost_send(&$a,&$b) { + + if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) + return; + + if(! strstr($b['postopts'],'ijpost')) + return; + + if($b['parent'] != $b['id']) + return; + + // InsaneJournal post in the IJ 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']; + + $dw_username = get_pconfig($b['uid'],'ijpost','dw_username'); + $dw_password = get_pconfig($b['uid'],'ijpost','dw_password'); + $dw_blog = 'http://www.insanejournal.com/interface/xmlrpc'; + + if($dw_username && $dw_password && $dw_blog) { + + require_once('include/bbcode.php'); + require_once('include/datetime.php'); + + $title = $b['title']; + $post = bbcode($b['body']); + $post = xmlify($post); + + $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 + +LJ.XMLRPC.postevent + + +year$year +mon$mon +day$day +hour$hour +min$min +event$post +username$dw_username +password$dw_password +subject$title +lineendingsunix +ver1 +props + +useragentFriendica +taglistfriendica + + + + + +EOT; + + logger('ijpost: data: ' . $xml, LOGGER_DATA); + + if($dw_blog !== 'test') + $x = post_url($dw_blog,$xml); + logger('posted to insanejournal: ' . ($x) ? $x : '', LOGGER_DEBUG); + + } +} + diff --git a/irc/irc.php b/irc/irc.php index a66fc826..cf86a446 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -3,7 +3,7 @@ * Name: IRC Chat Plugin * Description: add an Internet Relay Chat chatroom * Version: 1.0 -* Author: tony baldwin +* Author: tony baldwin */ diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 8431b134..14bac69e 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -4,7 +4,7 @@ * Name: LiveJournal Post Connector * Description: Post to LiveJournal * Version: 1.0 - * Author: Tony Baldwin + * Author: Tony Baldwin * Author: Michael Johnston */ From 6696cc4cd1dc42bdd5d0ec38b8b18af6c3d64193 Mon Sep 17 00:00:00 2001 From: Tony Baldwin Date: Sat, 17 Mar 2012 16:49:40 -0400 Subject: [PATCH 03/10] minor adjustment to ijpost.php --- ijpost/ijpost.php | 48 +++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index df7fc781..20d4f81d 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -29,10 +29,10 @@ function ijpost_jot_nets(&$a,&$b) { if(! local_user()) return; - $dw_post = get_pconfig(local_user(),'ijpost','post'); - if(intval($dw_post) == 1) { - $dw_defpost = get_pconfig(local_user(),'ijpost','post_by_default'); - $selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : ''); + $ij_post = get_pconfig(local_user(),'ijpost','post'); + if(intval($ij_post) == 1) { + $ij_defpost = get_pconfig(local_user(),'ijpost','post_by_default'); + $selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' . t('Post to InsaneJournal') . '
'; } @@ -58,8 +58,8 @@ function ijpost_settings(&$a,&$s) { $def_checked = (($def_enabled) ? ' checked="checked" ' : ''); - $dw_username = get_pconfig(local_user(), 'ijpost', 'dw_username'); - $dw_password = get_pconfig(local_user(), 'ijpost', 'dw_password'); + $ij_username = get_pconfig(local_user(), 'ijpost', 'ij_username'); + $ij_password = get_pconfig(local_user(), 'ijpost', 'ij_password'); /* Add some HTML to the existing form */ @@ -73,17 +73,17 @@ function ijpost_settings(&$a,&$s) { $s .= '
'; $s .= ''; - $s .= ''; + $s .= ''; $s .= '
'; $s .= '
'; $s .= ''; - $s .= ''; + $s .= ''; $s .= '
'; $s .= '
'; $s .= ''; - $s .= ''; + $s .= ''; $s .= '
'; /* provide a submit button */ @@ -98,9 +98,9 @@ function ijpost_settings_post(&$a,&$b) { if(x($_POST,'ijpost-submit')) { set_pconfig(local_user(),'ijpost','post',intval($_POST['ijpost'])); - set_pconfig(local_user(),'ijpost','post_by_default',intval($_POST['dw_bydefault'])); - set_pconfig(local_user(),'ijpost','dw_username',trim($_POST['dw_username'])); - set_pconfig(local_user(),'ijpost','dw_password',trim($_POST['dw_password'])); + set_pconfig(local_user(),'ijpost','post_by_default',intval($_POST['ij_bydefault'])); + set_pconfig(local_user(),'ijpost','ij_username',trim($_POST['ij_username'])); + set_pconfig(local_user(),'ijpost','ij_password',trim($_POST['ij_password'])); } @@ -119,14 +119,14 @@ function ijpost_post_local(&$a,&$b) { if($b['private'] || $b['parent']) return; - $dw_post = intval(get_pconfig(local_user(),'ijpost','post')); + $ij_post = intval(get_pconfig(local_user(),'ijpost','post')); - $dw_enable = (($dw_post && x($_REQUEST,'ijpost_enable')) ? intval($_REQUEST['ijpost_enable']) : 0); + $ij_enable = (($ij_post && x($_REQUEST,'ijpost_enable')) ? intval($_REQUEST['ijpost_enable']) : 0); if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'ijpost','post_by_default'))) - $dw_enable = 1; + $ij_enable = 1; - if(! $dw_enable) + if(! $ij_enable) return; if(strlen($b['postopts'])) @@ -160,11 +160,11 @@ function ijpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $dw_username = get_pconfig($b['uid'],'ijpost','dw_username'); - $dw_password = get_pconfig($b['uid'],'ijpost','dw_password'); - $dw_blog = 'http://www.insanejournal.com/interface/xmlrpc'; + $ij_username = get_pconfig($b['uid'],'ijpost','ij_username'); + $ij_password = get_pconfig($b['uid'],'ijpost','ij_password'); + $ij_blog = 'http://www.insanejournal.com/interface/xmlrpc'; - if($dw_username && $dw_password && $dw_blog) { + if($ij_username && $ij_password && $ij_blog) { require_once('include/bbcode.php'); require_once('include/datetime.php'); @@ -191,8 +191,8 @@ function ijpost_send(&$a,&$b) { hour$hour min$min event$post -username$dw_username -password$dw_password +username$ij_username +password$ij_password subject$title lineendingsunix ver1 @@ -209,8 +209,8 @@ EOT; logger('ijpost: data: ' . $xml, LOGGER_DATA); - if($dw_blog !== 'test') - $x = post_url($dw_blog,$xml); + if($ij_blog !== 'test') + $x = post_url($ij_blog,$xml); logger('posted to insanejournal: ' . ($x) ? $x : '', LOGGER_DEBUG); } From 06e04aca2ff0665a90028e70d3f8ba6a8f173eb2 Mon Sep 17 00:00:00 2001 From: Tony Baldwin Date: Sat, 17 Mar 2012 17:30:21 -0400 Subject: [PATCH 04/10] added Cat's tag stuff to ijpost --- dwpost/dwpost.php | 2 +- ijpost.tar.gz | Bin 20480 -> 20480 bytes ijpost/ijpost.php | 11 ++++++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index 85e808c0..4e4d45e2 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -150,7 +150,7 @@ function dwpost_send(&$a,&$b) { if($b['parent'] != $b['id']) return; - // dreamwidth post in the LJ user's timezone. + // dreamwidth post in the DW user's timezone. // Hopefully the person's Friendica account // will be set to the same thing. diff --git a/ijpost.tar.gz b/ijpost.tar.gz index c274902c05308c6dd20bfbad08813f95aad69375..58da8759efc0c5d00e77d6f3c448782496256e3f 100644 GIT binary patch delta 774 zcmZvZF>ljA7>096Q0o+v7D`)^id-C1JJd>iDW(#r0mOiWR6xLl6U;R^5=V}0*$xPG zXc0>nB*cv@5g-Hu1M-CU3kW8D2Y-M8UqT{FVfyag@A3P6ukUaO4u{~?%f*_i)-*Mt zB7|xv0X2$1I|SebICDYUP9U_sg{H_Bx~L|gI!03O0IFx;d3bFQbRF*!+%;QWOe}cQ z>Dqqa*zw+V9KahMent<{#rYNvY~uU%@O`?Jo-=!f>-Yivy-=Zl=Cet&M|p0I6^S#V z5*~4nQtVpIt67^rJv=J7;MmAFl0L9NpNb+YKZ_3z9uMqRU^@2fKsLXe+0SsUM><9y2d%Dw zElU=vji#(WZ0M!tX1SqP1w~}2B90K^kDh;$qVHNxo5+#^r757JCSyDj47@oTjyF3i J{dy}Ze*u}-^-TZ( delta 566 zcmZozz}T>WaYC zWJ)RDyqk9?lQfdNl0sQxPHC#GlDdMP0#M!NegOqWpu));1;s(?PYLRQxSM|o@iT#h zxkXJuE`?dAu2WK!nX91^AK)Jx60HtY5F=^=_DW)Lae01G3WkEsYedz-7F-o`5Coc( znwOZAld52=prHYBrkeO>Rb){^Yc6m=WTt5-g4_pHugNv}zJ&N@QHdh3t2(80uzLCg zM7#jz7+7GiOWP|U`9eWW4Qw_{9h5&gLwdz#GZ}Bx0KPA;IeDwRJSb4E$uDALOq;Bw cs4{t`VizcQRFzafl($mUW+nCOjEhus03^(?UH||9 diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 20d4f81d..4eb1d890 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -5,6 +5,8 @@ * Description: Post to insanejournal * Version: 1.0 * Author: Tony Baldwin + * Author: Michael Johnston + * Author: Cat Gray */ function ijpost_install() { @@ -172,6 +174,7 @@ function ijpost_send(&$a,&$b) { $title = $b['title']; $post = bbcode($b['body']); $post = xmlify($post); + $tags = ijpost_get_tags($b['tag']); $date = datetime_convert('UTC',$tz,$b['created'],'Y-m-d H:i:s'); $year = intval(substr($date,0,4)); @@ -199,7 +202,7 @@ function ijpost_send(&$a,&$b) { props useragentFriendica -taglistfriendica +taglist$tags @@ -216,3 +219,9 @@ EOT; } } +function ijpost_get_tags($post) +{ + preg_match_all("/\]([^\[#]+)\[/",$post,$matches); + $tags = implode(', ',$matches[1]); + return $tags; +} From f26c87aaeaf4f6e11034729f6e642104a107cfb9 Mon Sep 17 00:00:00 2001 From: Tony Baldwin Date: Sat, 17 Mar 2012 17:53:53 -0400 Subject: [PATCH 05/10] minor alterations, mostly to ijpost --- dwpost/dwpost.php | 59 +++++++++++++++++++++------------ ijpost.tar.gz | Bin 20480 -> 20480 bytes ijpost/ijpost.php | 81 ++++++++++++++++++++++++++++------------------ ljpost/ljpost.php | 2 -- 4 files changed, 87 insertions(+), 55 deletions(-) diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index 4e4d45e2..1717be11 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -166,6 +166,10 @@ function dwpost_send(&$a,&$b) { $dw_password = get_pconfig($b['uid'],'dwpost','dw_password'); $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) { require_once('include/bbcode.php'); @@ -185,27 +189,40 @@ function dwpost_send(&$a,&$b) { $xml = <<< EOT -LJ.XMLRPC.postevent - - -year$year -mon$mon -day$day -hour$hour -min$min -event$post -username$dw_username -password$dw_password -subject$title -lineendingsunix -ver1 -props - -useragentFriendica -taglist$tags - - - + + LJ.XMLRPC.postevent + + + + username$dw_username + password$dw_password + event$post + subject$title + lineendingsunix + year$year + mon$mon + day$day + hour$hour + min$min + usejournal$lj_username + + props + + + + useragent + Friendica + + + taglist + $tags + + + + + + + EOT; diff --git a/ijpost.tar.gz b/ijpost.tar.gz index 58da8759efc0c5d00e77d6f3c448782496256e3f..635eee21ef39aaa02a71735113ed0521807619c6 100644 GIT binary patch delta 878 zcmZvZKX21O7{+rXYH?6gi6WuKYI0EmiIFPXaiR`A+=!u4q=*G1281eyT*F2FC)?rg zK(n<=i*#az3I-MiB!2@I2E@!K;7c&!v(K?x;pv{|{k_k7=lAFw9G!!AXBDm2QwoZz zs@;A8_NfXcApi>?b`?$O7F2adQ=?-7X=+a^KqY~Sn*hwHSlSIAl}0OcSXv9em5+<7 z#P$sv&*)y|V|ot%RK6Bt;=}dtD8$3`gOc%_>-ZX_@5kRfoQ> zZqvouMou@IuHpMH9B!J)Ks*9%^d|+$*xE+wd#O)_i_*?u8ie(7t>#gk_2$5@ehUM## zlL{R@H_SOstk{kQ&z}aFK_Av1TxAvZ(Jy&%tv<{uf9s=6?8Ez+__1{_6GCl}iD6!x z)N*|lH+x=O@_Z3+7&tg)~D8;e`?+DZ2$lO delta 504 zcmZXPJxjw-6oz|M{D@jbYSl)X+gdCYB)P4zpfQwg6|sZjBBH6i)JmI#+_Zv|;;!Nm z#6?9B5!~_%#KpfMIJ!Bx8Eh()4u|vcK8JJOqdRnThtALZQc{+D5+Ni>d{_p8iVi}@ zh$rbeIqf4PogzuegHmK(@?og~bxt6(41Cuj>T@=_R=Rs~I@5Hz>^yU)oy`VR|828& zKK(EMf^#+U-pzX}M$OW-3N{U9F~47+)3+|(F5Fsx!c zvB>qs%KO`eic!K#7~XghzWLMsSYb16m+cCTZ#kEf4+s{*vsf`TORF-qkyTEqYn2*R z6=qwtU0dZKkF#)%Gw|U?B9a9b$-ughgPZUg{J8NbtiX@3I;>P_wLmRZ(X}d7>lAiy z01q;UpTmh;qG61YV;72nxgS6&-cwvLbpv dE28H?^j_lHBzN-XTXlA(QXTixGY^?W$1g(wqrm_G diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 4eb1d890..a166e319 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -1,8 +1,8 @@ * Author: Michael Johnston @@ -36,7 +36,7 @@ function ijpost_jot_nets(&$a,&$b) { $ij_defpost = get_pconfig(local_user(),'ijpost','post_by_default'); $selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : ''); $b .= '
' - . t('Post to InsaneJournal') . '
'; + . t('Post to insanejournal') . ''; } } @@ -67,9 +67,9 @@ function ijpost_settings(&$a,&$s) { /* Add some HTML to the existing form */ $s .= '
'; - $s .= '

' . t('InsaneJournal Post Settings') . '

'; + $s .= '

' . t('insanejournal Post Settings') . '

'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; @@ -84,7 +84,7 @@ function ijpost_settings(&$a,&$s) { $s .= '
'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; @@ -150,7 +150,7 @@ function ijpost_send(&$a,&$b) { if($b['parent'] != $b['id']) return; - // InsaneJournal post in the IJ user's timezone. + // insanejournal post in the LJ user's timezone. // Hopefully the person's Friendica account // will be set to the same thing. @@ -162,16 +162,20 @@ function ijpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $ij_username = get_pconfig($b['uid'],'ijpost','ij_username'); - $ij_password = get_pconfig($b['uid'],'ijpost','ij_password'); - $ij_blog = 'http://www.insanejournal.com/interface/xmlrpc'; + $ij_username = xmlify(get_pconfig($b['uid'],'ijpost','ij_username')); + $ij_password = xmlify(get_pconfig($b['uid'],'ijpost','ij_password')); + $ij_journal = xmlify(get_pconfig($b['uid'],'ijpost','ij_journal')); + + $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) { 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 = ijpost_get_tags($b['tag']); @@ -185,27 +189,40 @@ function ijpost_send(&$a,&$b) { $xml = <<< EOT -LJ.XMLRPC.postevent - - -year$year -mon$mon -day$day -hour$hour -min$min -event$post -username$ij_username -password$ij_password -subject$title -lineendingsunix -ver1 -props - -useragentFriendica -taglist$tags - - - + + LJ.XMLRPC.postevent + + + + username$ij_username + password$ij_password + event$post + subject$title + lineendingsunix + year$year + mon$mon + day$day + hour$hour + min$min + usejournal$ij_username + + props + + + + useragent + Friendica + + + taglist + $tags + + + + + + + EOT; diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index ddcd2890..717b77c1 100755 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -165,8 +165,6 @@ function ljpost_send(&$a,&$b) { $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)) From 3d38180d8f61c9922f4bbdbda0ac5010463a0b0e Mon Sep 17 00:00:00 2001 From: Tony Baldwin Date: Sat, 17 Mar 2012 18:34:25 -0400 Subject: [PATCH 06/10] corrections, minor alterations --- dwpost/dwpost.php | 61 ++++++++++++++------------------------ ijpost.tar.gz | Bin 20480 -> 20480 bytes ijpost/ijpost.php | 73 ++++++++++++++++++---------------------------- ljpost/ljpost.php | 2 ++ 4 files changed, 52 insertions(+), 84 deletions(-) diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index 1717be11..85e808c0 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -150,7 +150,7 @@ function dwpost_send(&$a,&$b) { if($b['parent'] != $b['id']) return; - // dreamwidth post in the DW user's timezone. + // dreamwidth post in the LJ user's timezone. // Hopefully the person's Friendica account // 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_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) { require_once('include/bbcode.php'); @@ -189,40 +185,27 @@ function dwpost_send(&$a,&$b) { $xml = <<< EOT - - LJ.XMLRPC.postevent - - - - username$dw_username - password$dw_password - event$post - subject$title - lineendingsunix - year$year - mon$mon - day$day - hour$hour - min$min - usejournal$lj_username - - props - - - - useragent - Friendica - - - taglist - $tags - - - - - - - +LJ.XMLRPC.postevent + + +year$year +mon$mon +day$day +hour$hour +min$min +event$post +username$dw_username +password$dw_password +subject$title +lineendingsunix +ver1 +props + +useragentFriendica +taglist$tags + + + EOT; diff --git a/ijpost.tar.gz b/ijpost.tar.gz index 635eee21ef39aaa02a71735113ed0521807619c6..2903c31752eccdf59dbe0ab5d12f2744733dc457 100644 GIT binary patch delta 429 zcmZozz}T>WaY7%zp@Ff934?*5p`no(gM#T~L&lWNjEs$p(uU?Hre+L=hUUhGMleOj zhGr%V3I-5G%pQ!4o}0Z`-f{vd3qD6~AXOzP#W>lYmuK>FDaFZ+ymCNVT%sVcxVSvO zC`DbL$wT&(CYIYi!b@;tfV z$v=U3sl3nRpYnbJHo2*}NvTD4HhGD;sdiSh~#s2}v9 aPU6Cl0*ZkBZMQi=*@S74n$}_mO(p>8f{6kE delta 828 zcmZvZ!Aj#m7{@!SpsAn-7ZzJ=Cs=K>ph=n*1;zbj}bGp86=+P&K4839GpvIwzeE_WRaPmotUK_JJGvFw^S}1_2AC7IE zU)Jc)!fHX;%u5yP;ky(o_ORodk&_A&eZ%&Ea4WW>#)Gp!81$rkGR-RNp?|U>Up^3(=kk#dyYN_u$Hh-V zOqW_h>}SPoDTDnjwF;7i9OATzXCfCn#2ok}`I8jOALy{WaxIYP_edP;d%eDo)c8p3 zCO3=#38lAVVieCPCetn+?h-f1M6e=HVF8xgHTOJ=xE;DCzu)Gkk($h!$T5{f2e@ln w{;Od6RbD=QD+8&SVUaqzh3Le060LGXGABim8n2seGW;hu-q9AYe^oxd02O51TmS$7 diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index a166e319..00bc375e 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -2,7 +2,7 @@ /** * Name: Insanejournal Post Connector - * Description: Post to insanejournal + * Description: Post to Insanejournal * Version: 1.0 * Author: Tony Baldwin * Author: Michael Johnston @@ -67,7 +67,7 @@ function ijpost_settings(&$a,&$s) { /* Add some HTML to the existing form */ $s .= '
'; - $s .= '

' . t('insanejournal Post Settings') . '

'; + $s .= '

' . t('Insanejournal Post Settings') . '

'; $s .= '
'; $s .= ''; $s .= ''; @@ -150,7 +150,7 @@ function ijpost_send(&$a,&$b) { if($b['parent'] != $b['id']) return; - // insanejournal post in the LJ user's timezone. + // insanejournal post in the IJ user's timezone. // Hopefully the person's Friendica account // will be set to the same thing. @@ -162,20 +162,16 @@ function ijpost_send(&$a,&$b) { if($x && strlen($x[0]['timezone'])) $tz = $x[0]['timezone']; - $ij_username = xmlify(get_pconfig($b['uid'],'ijpost','ij_username')); - $ij_password = xmlify(get_pconfig($b['uid'],'ijpost','ij_password')); - $ij_journal = xmlify(get_pconfig($b['uid'],'ijpost','ij_journal')); - - $ij_blog = xmlify(get_pconfig($b['uid'],'ijpost','ij_blog')); - if(! strlen($ij_blog)) - $ij_blog = xmlify('http://www.insanejournal.com/interface/xmlrpc'); + $ij_username = get_pconfig($b['uid'],'ijpost','ij_username'); + $ij_password = get_pconfig($b['uid'],'ijpost','ij_password'); + $ij_blog = 'http://www.insanejournal.com/interface/xmlrpc'; if($ij_username && $ij_password && $ij_blog) { require_once('include/bbcode.php'); require_once('include/datetime.php'); - $title = xmlify($b['title']); + $title = $b['title']; $post = bbcode($b['body']); $post = xmlify($post); $tags = ijpost_get_tags($b['tag']); @@ -189,40 +185,27 @@ function ijpost_send(&$a,&$b) { $xml = <<< EOT - - LJ.XMLRPC.postevent - - - - username$ij_username - password$ij_password - event$post - subject$title - lineendingsunix - year$year - mon$mon - day$day - hour$hour - min$min - usejournal$ij_username - - props - - - - useragent - Friendica - - - taglist - $tags - - - - - - - +LJ.XMLRPC.postevent + + +year$year +mon$mon +day$day +hour$hour +min$min +event$post +username$ij_username +password$ij_password +subject$title +lineendingsunix +ver1 +props + +useragentFriendica +taglist$tags + + + EOT; diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 717b77c1..ddcd2890 100755 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -165,6 +165,8 @@ function ljpost_send(&$a,&$b) { $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)) From b1fb01437fd54dd0946a043b14f85c75fa416bdb Mon Sep 17 00:00:00 2001 From: Tony Baldwin Date: Sat, 17 Mar 2012 19:17:07 -0400 Subject: [PATCH 07/10] another attempt having difficulties perhaps resolved? --- ijpost.tar.gz | Bin 20480 -> 20480 bytes ijpost/ijpost.php | 14 +++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ijpost.tar.gz b/ijpost.tar.gz index 2903c31752eccdf59dbe0ab5d12f2744733dc457..4c67d491fe871bcc1408017595db64a468050e1e 100644 GIT binary patch delta 156 zcmZozz}T>WaY8?zsga>MgMp!;p|KHzg6U*K#+1#BjD3tSabrVs0|o^Hh&b~?_Q{?s zyqni^^)WMgO}68k&+eI5oS2vDwfPC3J|mnXC18Ny1PaWaY8?zfw74RgMp!;p^+Jbg6U*K#+1#BjD3tSabrU>69xqXh&b~?cE-%j zi@9boGiFV; ' - . t('Post to insanejournal') . '
'; + . t('Post to Insanejournal') . '
'; } } @@ -67,24 +67,24 @@ function ijpost_settings(&$a,&$s) { /* Add some HTML to the existing form */ $s .= '
'; - $s .= '

' . t('Insanejournal Post Settings') . '

'; + $s .= '

' . t('InsaneJournal Post Settings') . '

'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; $s .= '
'; @@ -150,7 +150,7 @@ function ijpost_send(&$a,&$b) { if($b['parent'] != $b['id']) return; - // insanejournal post in the IJ user's timezone. + // insanejournal post in the LJ user's timezone. // Hopefully the person's Friendica account // will be set to the same thing. From cf6f514fe977c54a6f1fc5dd5fb1d577bb1520d1 Mon Sep 17 00:00:00 2001 From: Tony Baldwin Date: Sun, 18 Mar 2012 09:37:46 -0400 Subject: [PATCH 08/10] minor alteration --- ijpost/ijpost.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index e535ec2c..d6861f46 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -213,7 +213,7 @@ EOT; logger('ijpost: data: ' . $xml, LOGGER_DATA); if($ij_blog !== 'test') - $x = post_url($ij_blog,$xml); + $x = post_url($ij_blog,$xml,array("Content-Type: text/xml")); logger('posted to insanejournal: ' . ($x) ? $x : '', LOGGER_DEBUG); } From 28a7fb268071406dc3a463fa7869f94b7f7f9dc7 Mon Sep 17 00:00:00 2001 From: Tony Baldwin Date: Sun, 18 Mar 2012 09:47:39 -0400 Subject: [PATCH 09/10] replaces missing semi-colon... --- dwpost/dwpost.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index 85e808c0..2391b571 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -213,7 +213,7 @@ EOT; logger('dwpost: data: ' . $xml, LOGGER_DATA); if($dw_blog !== 'test') - $x = post_url($dw_blog,$xml); + $x = post_url($dw_blog,$xml,array("Content-Type: text/xml")); logger('posted to dreamwidth: ' . ($x) ? $x : '', LOGGER_DEBUG); } From 1f50a421353f413d1a9cd364f87ec640b7198cc5 Mon Sep 17 00:00:00 2001 From: Tony Baldwin Date: Sun, 18 Mar 2012 09:50:50 -0400 Subject: [PATCH 10/10] minor --- ljpost/ljpost.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index ddcd2890..dc17e83f 100755 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -232,7 +232,7 @@ 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); }