<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>inc/app/siteblog/lib/Bitly.php</filename>
    </added>
    <added>
      <filename>inc/app/siteblog/lib/Twitter.php</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -56,9 +56,9 @@ value                   = 10
 
 [split_body]
 
-type					= select
+type                    = select
 
-alt						= &quot;Mark post summary end by &lt;hr /&gt; tag&quot;
+alt                     = Mark post summary end by &lt;hr /&gt; tag
 
 setValues               = &quot;eval: array ('1' =&gt; 'Yes', '0' =&gt; 'No')&quot;
 
@@ -74,6 +74,24 @@ labelPosition           = left
 
 value                   = Off
 
+[twitter]
+
+alt                     = &quot;Twitter Username (auto-post to Twitter)&quot;
+
+extra                   = &quot;autocomplete=`off`&quot;
+
+value                   = Off
+
+[twitter_pass]
+
+alt                     = Twitter Password
+
+type                    = password
+
+extra                   = &quot;autocomplete=`off`&quot;
+
+value                   = Off
+
 ;
 ; THE END
 ;</diff>
      <filename>inc/app/siteblog/conf/settings.ini.php</filename>
    </modified>
    <modified>
      <diff>@@ -31,6 +31,12 @@ class SiteblogEditForm extends MailForm {
         }
 		$this-&gt;widgets['category']-&gt;setValues ($cats);
 
+		$twitter_u = appconf ('twitter');
+		$twitter_p = appconf ('twitter_pass');
+		if (! empty ($twitter_u) &amp;&amp; ! empty ($twitter_p)) {
+			$this-&gt;widgets['twitter'] =&amp; $this-&gt;widgets['twitter']-&gt;changeType ('text');
+		}
+
         if ($add) {
 
             page_title (intl_get ('Adding Blog Post'));
@@ -110,29 +116,48 @@ class SiteblogEditForm extends MailForm {
 	    }
 
 		// ping blog directories via pingomatic.com
-		$host = 'rpc.pingomatic.com';
-		$path = '';
-		
-		$out = template_simple ('ping.spt', $obj);
-		
-		$len = strlen ($out);
-		
-		$req = 'POST /' . $path . &quot; HTTP/1.0\r\n&quot;;
-		$req .= 'User-Agent: Sitellite ' . SITELLITE_VERSION . &quot;/SiteBlog\r\n&quot;;
-		$req .= 'Host: ' . $host . &quot;\r\n&quot;;
-		$req .= &quot;Content-Type: text/xml\r\n&quot;;
-		$req .= 'Content-Length: ' . $len . &quot;\r\n\r\n&quot;;
-		$req .= $out . &quot;\r\n&quot;;
-		
-		if ($ph = @fsockopen ($host, 80)) {
-			@fputs ($ph, $req);
-			//echo '&lt;pre&gt;';
-			//echo htmlentities ($req);
-			while (! @feof ($ph)) {
-				$res = @fgets ($ph, 128);
-				//echo htmlentities ($res);
+		if ($vals['status'] == 'visible') {
+			$host = 'rpc.pingomatic.com';
+			$path = '';
+			
+			$out = template_simple ('ping.spt', $obj);
+			
+			$len = strlen ($out);
+			
+			$req = 'POST /' . $path . &quot; HTTP/1.0\r\n&quot;;
+			$req .= 'User-Agent: Sitellite ' . SITELLITE_VERSION . &quot;/SiteBlog\r\n&quot;;
+			$req .= 'Host: ' . $host . &quot;\r\n&quot;;
+			$req .= &quot;Content-Type: text/xml\r\n&quot;;
+			$req .= 'Content-Length: ' . $len . &quot;\r\n\r\n&quot;;
+			$req .= $out . &quot;\r\n&quot;;
+			
+			if ($ph = @fsockopen ($host, 80)) {
+				@fputs ($ph, $req);
+				//echo '&lt;pre&gt;';
+				//echo htmlentities ($req);
+				while (! @feof ($ph)) {
+					$res = @fgets ($ph, 128);
+					//echo htmlentities ($res);
+				}
+				@fclose ($ph);
+			}
+		}
+
+		// post to twitter
+		if (! empty ($vals['twitter']) &amp;&amp; $vals['status'] == 'visible') {
+			$twitter_u = appconf ('twitter');
+			$twitter_p = appconf ('twitter_pass');
+			if (! empty ($twitter_u) &amp;&amp; ! empty ($twitter_p)) {
+				loader_import ('siteblog.Bitly');
+				$b = new Bitly;
+				$short_link = $b-&gt;shorten ('http://' . site_domain () . site_prefix () . '/index/siteblog-post-action/id.' . $id . '/title.' . siteblog_filter_link_title ($subject));
+
+				loader_import ('siteblog.Twitter');
+				$t = new twitter;
+				$t-&gt;username = $twitter_u;
+				$t-&gt;password = $twitter_p;
+				$t-&gt;update ($vals['twitter'] . ' ' . $short_link);
 			}
-			@fclose ($ph);
 		}
 
         exit;</diff>
      <filename>inc/app/siteblog/forms/edit/index.php</filename>
    </modified>
    <modified>
      <diff>@@ -36,9 +36,16 @@ type = hidden
 [subject]
 
 type        = text
-extra       = &quot;style='width: 575px'&quot;
+extra       = &quot;style='width: 565px'&quot;
 alt			= Post Title
 
+[twitter]
+
+type		= hidden
+alt			= Post to Twitter
+extra		= &quot;style='width: 565px' maxlength='125'&quot;
+append		= &quot;&lt;br /&gt;(note: only sends if status is `published`, automatically adds a link to the post using &lt;a href='http://bit.ly/' target='_blank'&gt;bit.ly&lt;/a&gt;)&quot;
+
 [author]
 
 type        = info</diff>
      <filename>inc/app/siteblog/forms/edit/settings.php</filename>
    </modified>
    <modified>
      <diff>@@ -101,6 +101,7 @@ Changes in 5.0.2-stable
 - Added SiteBlog to admin panel editable settings.
 - Added ShareThis.com widget integration to SiteBlog, simply paste code in settings.
 - Added blog post summary shortening to SiteBlog settings.
+- Added Twitter posting to SiteBlog, just add your Twitter info in the settings.
 
 Changes in 5.0.1-stable
 </diff>
      <filename>install/changes.txt</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>bdf08a8b4a8ca9c9da49dc46b41a97f1aaacb9e0</id>
    </parent>
  </parents>
  <author>
    <name>John Luxford</name>
    <email>john.luxford@gmail.com</email>
  </author>
  <url>http://github.com/lux/sitellite/commit/0519e8f347b380b90a6bb7b27055753da4c1b6ce</url>
  <id>0519e8f347b380b90a6bb7b27055753da4c1b6ce</id>
  <committed-date>2009-04-13T18:33:33-07:00</committed-date>
  <authored-date>2009-04-13T18:33:33-07:00</authored-date>
  <message>Added Twitter posting to SiteBlog, just add your Twitter info in the settings.</message>
  <tree>4fcf174cf1f5820b8a590fe6f8203e2e6708fc86</tree>
  <committer>
    <name>John Luxford</name>
    <email>john.luxford@gmail.com</email>
  </committer>
</commit>
