<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/wiki/views/wiki_pages/_revisions.html</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -72,6 +72,8 @@ function set_up_new_shortener( &amp;$model, &amp;$rec ) {
   global $request;
   if (!($request-&gt;resource == 'blogs'))
     return;
+  if (!isset($_POST['shortener_domain']))
+    return;
   // XXX subdomain upgrade
   $url = $request-&gt;url_for(array('resource'=&gt;'twitter/'.$rec-&gt;nickname));
   require_once(ABSPATH.WPINC.'/class-snoopy.php');</diff>
      <filename>app/shortener/shortener.php</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,8 @@ function post( &amp;$vars ) {
 
 function put( &amp;$vars ) {
   extract( $vars );
+
+
   $resource-&gt;update_from_post( $request, true );
   header_status( '200 OK' );
   redirect_to( array('resource'=&gt;'wikis','id'=&gt;$request-&gt;params['id']) );
@@ -76,7 +78,7 @@ function _index( &amp;$vars ) {
 
 function _revisions( &amp;$vars ) {
   extract($vars);
-
+echo 'a';
   $Member = $collection-&gt;MoveFirst();
   $Entry = $Member-&gt;FirstChild( 'entries' );
 
@@ -89,9 +91,10 @@ function _revisions( &amp;$vars ) {
   );
   $Revision-&gt;set_param( 'find_by', $where );
   $Revision-&gt;find();
+echo 'rev';
 
   while ($r = $Revision-&gt;MoveNext()) {
-    $wp = mb_unserialize($r-&gt;data);
+echo 1;    $wp = mb_unserialize($r-&gt;data);
     if (is_object($wp)){
 	    if ($wp-&gt;id == $Member-&gt;id) {
         $revisor = get_profile($r-&gt;profile_id);
@@ -100,7 +103,7 @@ echo '&lt;img width=&quot;20&quot; height=&quot;20&quot; src=&quot;'.$revisor-&gt;avatar.'&quot;&gt;&lt;span&gt;&amp;nbsp;&lt;a href
     	}
     }
   }
-
+echo 'do';
   extract( $vars );
   return vars(
     array( &amp;$collection, &amp;$profile ),
@@ -115,8 +118,14 @@ function _entry( &amp;$vars ) {
   extract( $vars );
   $Member = $collection-&gt;MoveNext();
   $Entry = $Member-&gt;FirstChild( 'entries' );
+  $Wiki =&amp; $db-&gt;model('Wiki');
+  $w = $Wiki-&gt;find($Member-&gt;parent_id);
+  $Blog =&amp; $db-&gt;model('Blog');
+  $b = $Blog-&gt;find($w-&gt;blog_id);
+  $blognick = $b-&gt;nickname;
+  $blogprefix = $b-&gt;prefix.&quot;_&quot;;
   return vars(
-    array( &amp;$collection, &amp;$Member, &amp;$Entry, &amp;$profile ),
+    array( &amp;$collection, &amp;$Member, &amp;$Entry, &amp;$profile, &amp;$blognick, &amp;$blogprefix ),
     get_defined_vars()
   );
 }</diff>
      <filename>app/wiki/controllers/wiki_pages.php</filename>
    </modified>
    <modified>
      <diff>@@ -9,10 +9,15 @@ class Wiki extends Model {
     $this-&gt;char_field( 'title' );
     $this-&gt;char_field( 'prefix', 2 );
     $this-&gt;char_field( 'nickname' );
+
+    $this-&gt;char_field( 'password' );
     
     $this-&gt;time_field( 'created' );
     $this-&gt;time_field( 'modified' );
     
+    $this-&gt;int_field( 'profile_id' );
+    $this-&gt;int_field( 'blog_id' );
+
     $this-&gt;int_field( 'entry_id' );
     
     $this-&gt;auto_field( 'id' );
@@ -69,3 +74,45 @@ function wiki_urls(){
 }
 
 
+
+after_filter( 'do_realtime_page_update', 'update_from_post' );
+
+function do_realtime_page_update( &amp;$model, &amp;$rec ) {
+
+  global $request,$db;
+
+  if (!($rec-&gt;table == 'wiki_pages'))
+    return;
+
+  $Wiki =&amp; $db-&gt;model('Wiki');
+  $w = $Wiki-&gt;find($rec-&gt;parent_id);
+  $Blog =&amp; $db-&gt;model('Blog');
+  $b = $Blog-&gt;find($w-&gt;blog_id);
+  $blognick = $b-&gt;nickname;
+  $blogprefix = $b-&gt;prefix.&quot;_&quot;;
+
+  $changed = false;
+
+	if (isset($request-&gt;params['wikipage']['header']))
+	  $changed = 'header';
+
+	if (isset($request-&gt;params['wikipage']['body']))
+	  $changed = 'body';
+
+	if (isset($request-&gt;params['wikipage']['footer']))
+	  $changed = 'footer';
+	
+	if ($changed)
+    realtime(
+	    'page_update',
+      array(
+	      'div'=&gt;$changed,
+	      'html'=&gt;$rec-&gt;$changed
+  	  ), 
+      $blogprefix
+    );
+   
+}
+
+
+</diff>
      <filename>app/wiki/models/Wiki.php</filename>
    </modified>
    <modified>
      <diff>@@ -14,6 +14,8 @@ class WikiPage extends Model {
 
     $this-&gt;text_field( 'header' );
     $this-&gt;text_field( 'footer' );
+
+    $this-&gt;int_field( 'blog_id' );
     
     $this-&gt;text_field( 'summary' );
     
@@ -63,3 +65,6 @@ class WikiPage extends Model {
 }
 
 
+  
+
+</diff>
      <filename>app/wiki/models/WikiPage.php</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,8 @@
 &lt;html&gt;
 &lt;head&gt;
+	&lt;?php if (REALTIME_HOST) : ?&gt;
+	  &lt;script type=&quot;text/javascript&quot; src=&quot;http://&lt;?php echo REALTIME_HOST; ?&gt;/meteor.js&quot;&gt;&lt;/script&gt;
+	&lt;?php endif; ?&gt;
 &lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php base_path(); ?&gt;resource/jquery-1.2.6.min.js&quot;&gt;&lt;/script&gt;
 &lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php base_path(); ?&gt;resource/tinymce/jscripts/tiny_mce/tiny_mce_src.js&quot;&gt;&lt;/script&gt;
 &lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php base_path(); ?&gt;resource/jeditable/jquery.jeditable.js&quot;&gt;&lt;/script&gt;
@@ -12,6 +15,10 @@ $.fn.tinymce = function(options){
    });
 }
 
+function page_update(data){
+	$(&quot;#jeditable_&quot;+data['div']).html(data['html']);
+}
+
 function initMCE(){
    tinyMCE.init({mode : &quot;none&quot;,
       theme : &quot;advanced&quot;,
@@ -69,7 +76,7 @@ $.editable.addInputType('mce', {
 &lt;div class=&quot;jeditable_footer&quot; id=&quot;jeditable_footer&quot;&gt;&lt;?php echo $Member-&gt;footer; ?&gt;&lt;/div&gt;
 
 
-&lt;?php $stream = 'http://openmicroblogger.com/twitter/documentation/'; ?&gt;
+&lt;?php $stream = blog_url($blognick); ?&gt;
 
 &lt;?php $timeline_callback = $stream.'api/statuses/public_timeline.json?callback=twitterCallback2'; ?&gt;
 
@@ -85,6 +92,22 @@ $.editable.addInputType('mce', {
 
 &lt;script type=&quot;text/javascript&quot;&gt;
 // &lt;![CDATA[
+
+var formb = '&lt;p style=&quot;font-size:10pt;&quot;&gt;(&lt;a style=&quot;font-size:10pt;&quot; href=&quot;&lt;?php echo $login_url; ?&gt;&quot;&gt;sign in w/Twitter&lt;/a&gt;)&lt;/p&gt;';
+var forma = '&lt;form onsubmit=&quot;return do_wiki_comment()&quot; method=&quot;post&quot; action=&quot;&lt;?php echo $post_to; ?&gt;&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;method&quot; value=&quot;post&quot;&gt;&lt;textarea name=&quot;post[title]&quot; id=&quot;post_title&quot; cols=&quot;15&quot; rows=&quot;2&quot;&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;input type=&quot;checkbox&quot; name=&quot;tweet_it&quot; id=&quot;tweet_it&quot;&gt;post to Twitter&lt;br /&gt;&lt;input type=&quot;submit&quot; value=&quot;Post comment&quot;&gt;&lt;/form&gt;';
+
+function do_wiki_comment(){
+	var someurl = &quot;&lt;?php echo $post_to; ?&gt;&quot;;
+  var submitdata = {};
+  submitdata['post[title]'] = $(&quot;#post_title&quot;).val();
+  submitdata['method'] = 'post';
+  $(&quot;#loginform&quot;).html(&quot;&lt;img src='&lt;?php base_path(); ?&gt;resource/jeditable/indicator.gif'&gt;&quot;);
+	$.post(someurl, submitdata, function(str) {
+    $(&quot;#loginform&quot;).html(forma);
+  });
+	return false;
+}
+
 function twitterCallback2(C){
   var A=[];
   for ( var D=0; D&lt;C.length; D++ ) {
@@ -100,8 +123,6 @@ function twitterCallback2(C){
 document.getElementById(&quot;tweetlist&quot;).innerHTML=A.join(&quot;&quot;);
 }
 function loginCallback(C){
-  var formb = '&lt;p style=&quot;font-size:10pt;&quot;&gt;(&lt;a style=&quot;font-size:10pt;&quot; href=&quot;&lt;?php echo $login_url; ?&gt;&quot;&gt;sign in w/Twitter&lt;/a&gt;)&lt;/p&gt;';
-	var forma = '&lt;form method=&quot;post&quot; action=&quot;&lt;?php echo $post_to; ?&gt;&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;method&quot; value=&quot;post&quot;&gt;&lt;textarea name=&quot;post[title]&quot; cols=&quot;15&quot; rows=&quot;2&quot;&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;input type=&quot;submit&quot; value=&quot;Post comment&quot;&gt;&lt;/form&gt;';
   if (C == 1){
   	document.getElementById(&quot;loginform&quot;).innerHTML=forma;
   }else {
@@ -140,28 +161,72 @@ function tweetime(C){
 $(function(){
    
 	&lt;?php 
+	global $request;
+	
 $field='header';
 $nam=&quot;header&quot;;
 $post='wikipage';
-$namurl='http://openmicroblogger.com/wiki_pages';
+$namurl=$request-&gt;url_for('wiki_pages');
 	tinymce_widget_text_post_helper($nam,$namurl,$post,$field,$Entry);
 
 	$field='body';
 	$nam=&quot;body&quot;;
-	$post='wikipage';
-	$namurl='http://openmicroblogger.com/wiki_pages';
 		tinymce_widget_text_post_helper($nam,$namurl,$post,$field,$Entry);
 
 		$field='footer';
 		$nam=&quot;footer&quot;;
-		$post='wikipage';
-		$namurl='http://openmicroblogger.com/wiki_pages';
 			tinymce_widget_text_post_helper($nam,$namurl,$post,$field,$Entry);
 	
 	?&gt;
 
 });
 &lt;/script&gt;
+
+&lt;?php if (REALTIME_HOST) : ?&gt;
+  
+  &lt;?php
+    
+     $chan = $blogprefix;
+  ?&gt;
+  
+  &lt;script type=&quot;text/javascript&quot;&gt;
+    // &lt;![CDATA[
+    Meteor.hostid = '&lt;?php echo get_profile_id(); ?&gt;';
+    Meteor.host = &quot;&lt;?php echo REALTIME_HOST; ?&gt;&quot;;
+    Meteor.registerEventCallback(&quot;process&quot;, test);
+    Meteor.joinChannel(&quot;&lt;?php echo $chan; ?&gt;&quot;, 0);
+    Meteor.mode = 'stream';
+    Meteor.connect();
+    function test(data) {
+      data = data.substring(0,(data.length - 10));
+      eval( &quot;data = &quot; + data );
+      if (data['callback'].length &gt;0) {
+	      eval( data['callback']+&quot;(data)&quot; );
+      } else if (data['in_reply_to']) {
+        var selectr = data['in_reply_to'];
+        $(selectr).append(render_a_tweet(data));
+        //$(selectr).append(data['html']);
+      } else {
+        $(&quot;#postlist&quot;).prepend(render_a_tweet(data));
+        //$(&quot;#postlist&quot;).prepend(data['html']);
+      }
+      &lt;?php if (environment('oembed')) : ?&gt;
+      $('a.oembed').oembed();
+      &lt;?php endif; ?&gt;
+    };
+
+
+		function render_a_tweet(data){
+			
+			var tweetit = '&lt;li&gt;&lt;img width=&quot;20&quot; height=&quot;20&quot; src=&quot;'+data['avatar']+&quot;\&quot;&gt;&lt;span&gt;&amp;nbsp;&quot;+'&lt;a href=&quot;'+data['profile_url']+'&quot;&gt;'+data['nickname']+&quot;&lt;/a&gt;&quot;+' '+data['tweet']+'&lt;/span&gt; &lt;a href=&quot;'+data['link']+'&quot;&gt;'+data['created']+&quot;&lt;/a&gt;&lt;/li&gt;&quot;;
+			$(&quot;#tweetlist&quot;).prepend(tweetit);
+			
+		}
+
+    // ]]&gt;
+  &lt;/script&gt;
+&lt;?php endif; ?&gt;
+
 &lt;p&gt;Page revisions:&lt;/p&gt;
 &lt;?php render_partial('revisions'); ?&gt;
 &lt;/body&gt;</diff>
      <filename>app/wiki/views/wiki_pages/_entry.html</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,9 @@
 &lt;?php include 'wp-content/language/lang_chooser.php'; //Loads the language-file ?&gt;
 
-&lt;form action=&quot;&lt;?php url_for( 'wikis' ); ?&gt;&quot; method=&quot;post&quot; name=&quot;wikis&quot; id=&quot;wikis&quot;&gt;
+&lt;form action=&quot;&lt;?php url_for( array('resource'=&gt;'blogs') ); ?&gt;&quot; method=&quot;post&quot; name=&quot;blogs&quot; id=&quot;blogs&quot;&gt;
 &lt;div&gt;
 &lt;input name=&quot;method&quot; type=&quot;hidden&quot; value=&quot;post&quot; /&gt;
-&lt;input name=&quot;submit_form&quot; type=&quot;hidden&quot; value=&quot;wikis&quot; /&gt;
+&lt;input name=&quot;submit_form&quot; type=&quot;hidden&quot; value=&quot;blogs&quot; /&gt;
 &lt;table border=&quot;0&quot;&gt;
 
 &lt;tr&gt;&lt;th colspan=&quot;2&quot;&gt;
@@ -11,12 +11,16 @@
 &lt;/th&gt;&lt;/tr&gt;
 
 	&lt;tr&gt;
-		&lt;td align=&quot;right&quot; valign=&quot;top&quot;&gt;&lt;p&gt;&lt;?php echo $txt['wikis_edit_title']; ?&gt;&lt;/p&gt;&lt;/td&gt;
-		&lt;td valign=&quot;top&quot; align=&quot;left&quot;&gt;&lt;input size=&quot;50&quot; maxlength=&quot;255&quot; id=&quot;wiki_title&quot; name=&quot;wiki[title]&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;&lt;/td&gt;
+		&lt;td align=&quot;right&quot; valign=&quot;top&quot;&gt;&lt;?php echo $txt['wikis_index_create_new_wiki']; ?&gt; http://&lt;/td&gt;
+		&lt;td valign=&quot;top&quot; align=&quot;left&quot;&gt;&lt;input size=&quot;3&quot; maxlength=&quot;10&quot; id=&quot;blog_title&quot; name=&quot;blog[title]&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;.&lt;?php global $request; echo $request-&gt;domain; ?&gt;&lt;/td&gt;
+	&lt;/tr&gt;
+	&lt;tr&gt;
+		&lt;td align=&quot;right&quot; valign=&quot;top&quot;&gt;Wiki Title&lt;/td&gt;
+		&lt;td valign=&quot;top&quot; align=&quot;left&quot;&gt;&lt;input size=&quot;14&quot; maxlength=&quot;255&quot; id=&quot;wiki_title&quot; name=&quot;wiki_title&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;&lt;/td&gt;
 	&lt;/tr&gt;
 	&lt;tr&gt;
 		&lt;td align=&quot;right&quot; valign=&quot;top&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/td&gt;
-		&lt;td valign=&quot;top&quot; align=&quot;left&quot;&gt;&lt;input onclick=&quot;JavaScript:history.back();&quot; name=&quot;button_group[Cancel]&quot; value=&quot;&lt;?php echo $txt['wikis_edit_cancel']; ?&gt;&quot; type=&quot;button&quot; /&gt;
+		&lt;td valign=&quot;top&quot; align=&quot;left&quot;&gt;&lt;input onclick=&quot;JavaScript:history.back();&quot; name=&quot;button_group[Cancel]&quot; value=&quot;&lt;?php echo $txt['blogs_edit_cancel']; ?&gt;&quot; type=&quot;button&quot; /&gt;
 
 &lt;input value=&quot;&lt;?php echo $txt['wikis_edit_save_stream']; ?&gt;&quot; type=&quot;submit&quot; name=&quot;button_group&quot; /&gt;&lt;/td&gt;
 	&lt;/tr&gt;</diff>
      <filename>app/wiki/views/wikis/_new.html</filename>
    </modified>
    <modified>
      <diff>@@ -20,3 +20,59 @@ global $prefix;
  function wiki_post() {
  }
 
+after_filter( 'set_up_new_wiki', 'insert_from_post' );
+
+function set_up_new_wiki( &amp;$model, &amp;$rec ) {
+  global $request,$db;
+  if (!($request-&gt;resource == 'blogs'))
+    return;
+  if (!isset($_POST['wiki_title']))
+    return;
+  $url = $request-&gt;url_for(array('resource'=&gt;'twitter/'.$rec-&gt;nickname));
+  require_once(ABSPATH.WPINC.'/class-snoopy.php');
+  $snoop = new Snoopy;
+  $snoop-&gt;agent = 'OpenMicroBlogger http://openmicroblogger.org';
+  $snoop-&gt;submit($url);
+  if (!(strpos($snoop-&gt;response_code, '200')))
+    trigger_error('could not configure the new wiki', E_USER_ERROR);
+  if (!(signed_in()))
+   trigger_error('sorry, you must be signed in to do that', E_USER_ERROR);
+  $profile = get_profile();
+  $Wiki =&amp; $db-&gt;model('Wiki');
+  $s = $Wiki-&gt;base();
+  $s-&gt;set_value('profile_id',$profile-&gt;id);
+  $s-&gt;set_value('nickname',$rec-&gt;nickname);
+  $s-&gt;set_value('blog_id',$rec-&gt;id);
+  $s-&gt;set_value('title',$_POST['wiki_title']);
+  $s-&gt;save_changes();
+  $s-&gt;set_etag();
+  //
+  global $prefix;
+  $prefix = $rec-&gt;prefix.&quot;_&quot;;
+  $db-&gt;prefix = $prefix;
+  $Person =&amp; $db-&gt;model('Person');
+  $Person-&gt;save();
+  $Identity =&amp; $db-&gt;model('Identity');
+  $Identity-&gt;save();
+	$i = make_identity(array(
+    $profile-&gt;nickname,
+    $profile-&gt;avatar,
+    $profile-&gt;fullname,
+    $profile-&gt;bio,
+    $profile-&gt;homepage,
+    $profile-&gt;locality
+  ),true);
+
+	$Setting =&amp; $db-&gt;model('Setting');
+	$tp = $Setting-&gt;base();
+	$tp-&gt;set_value('name','config.env.theme');
+	$tp-&gt;set_value('value','p2');
+	$tp-&gt;save_changes();
+
+  $person_id = 1;
+  set_cookie($person_id);
+  $_SESSION['openid_complete'] = true;
+
+  redirect_to($url);
+
+}
\ No newline at end of file</diff>
      <filename>app/wiki/wiki.php</filename>
    </modified>
    <modified>
      <diff>@@ -3260,7 +3260,7 @@ function readUrl($url){
   return false;
 }
 
-function realtime($callback,$payload){
+function realtime($callback,$payload,$prefix=false){
 
   if (!PING)
     return;
@@ -3270,7 +3270,9 @@ function realtime($callback,$payload){
 
   global $db;
   
-  if (!empty($db-&gt;prefix))
+  if ($prefix)
+    $chan = $prefix;
+  elseif (!empty($db-&gt;prefix))
     $chan = $db-&gt;prefix;
   else
     $chan = &quot;chan&quot;;</diff>
      <filename>db/library/dbscript/_functions.php</filename>
    </modified>
    <modified>
      <diff>@@ -279,6 +279,7 @@ class Record {
     $result = $db-&gt;save_record($this);
     if ($result)
       $this-&gt;exists = true;
+    trigger_after('save_changes',$db,$this);
     return $result;
   }
   </diff>
      <filename>db/library/dbscript/record.php</filename>
    </modified>
    <modified>
      <diff>@@ -606,6 +606,11 @@ $txt['config_lang'] = 'Language';
 $txt['wikis_edit_title'] = &quot;Title&quot;;
 $txt['wikis_edit_cancel'] = &quot;Cancel&quot;;
 $txt['wikis_edit_save_stream'] = &quot;Save Wiki&quot;;
+
+
+/////////////////////////////////////
+# /app/wiki/views/wikis/_index.html
+/////////////////////////////////////
 $txt['wikis_index'] = &quot;Wikis&quot;;
 $txt['wikis_index_create_new_wiki'] = &quot;Create a Wiki&quot;;
 </diff>
      <filename>wp-content/language/eng.php</filename>
    </modified>
    <modified>
      <diff>@@ -606,3 +606,9 @@ $txt['wikis_edit_cancel'] = &quot;Cancel&quot;;
 $txt['wikis_edit_save_stream'] = &quot;Save Wiki&quot;;
 
 
+/////////////////////////////////////
+# /app/wiki/views/wikis/_index.html
+/////////////////////////////////////
+$txt['wikis_index'] = &quot;Wikis&quot;;
+$txt['wikis_index_create_new_wiki'] = &quot;Create a Wiki&quot;;
+</diff>
      <filename>wp-content/language/ger.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c0f2104bb7c88db35e90056c17059d0d4a8cc690</id>
    </parent>
  </parents>
  <author>
    <name>Brian Hendrickson</name>
    <email>brian@brian-hendricksons-macbook-pro.local</email>
  </author>
  <url>http://github.com/voitto/openmicroblogger/commit/1c25bae58a71cd65ca50284e42e2e41c5ad3da83</url>
  <id>1c25bae58a71cd65ca50284e42e2e41c5ad3da83</id>
  <committed-date>2009-10-26T23:44:26-07:00</committed-date>
  <authored-date>2009-10-26T23:44:26-07:00</authored-date>
  <message>wiki revs partial</message>
  <tree>9922996d67507b6511c8bc39a6c2061eed359697</tree>
  <committer>
    <name>Brian Hendrickson</name>
    <email>brian@brian-hendricksons-macbook-pro.local</email>
  </committer>
</commit>
