http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90106

Revision: 90106
Author:   faurethomas
Date:     2011-06-15 09:48:07 +0000 (Wed, 15 Jun 2011)
Log Message:
-----------
Add a key 'inherit' to create dependances between rooms. Add a key 'email' to 
totally deactivate email sending. Fix a problem with lock-small.png image.

Modified Paths:
--------------
    trunk/extensions/WikiTweet/WikiTweet.api.php
    trunk/extensions/WikiTweet/WikiTweet.config.php
    trunk/extensions/WikiTweet/WikiTweet.functions.php
    trunk/extensions/WikiTweet/WikiTweet.i18n.php

Modified: trunk/extensions/WikiTweet/WikiTweet.api.php
===================================================================
--- trunk/extensions/WikiTweet/WikiTweet.api.php        2011-06-15 07:35:47 UTC 
(rev 90105)
+++ trunk/extensions/WikiTweet/WikiTweet.api.php        2011-06-15 09:48:07 UTC 
(rev 90106)
@@ -115,6 +115,18 @@
                        $type = $row1->type;
                        $sql_subscriptions .= " OR `$type`='$link'";
                }
+               $roomssons = array();
+               foreach($wgWikiTweet['inherit'] as 
$roominherit=>$roominheritvalue)
+               {
+                       if($roominherit == $room or 
in_array($roominherit,$roomssons))
+                       {
+                               foreach($wgWikiTweet['inherit'][$roominherit] 
as $roomson)
+                               {
+                                       $sql_subscriptions .= " OR 
`room`='$roomson'";
+                                       $roomssons[] = $roomson;
+                               }
+                       }
+               }
 
                if($tag!=''){
                        $res = $dbr->select( 
@@ -164,7 +176,7 @@
                        }
                        if ( $show == 2 ) {
                                $background_color = "#C6DEFE";
-                               $private = "<img 
src='$wgScriptPath/Extensions/WikiTweet/images/lock-small.png' />";
+                               $private = "<img 
src='$wgScriptPath/extensions/WikiTweet/images/lock-small.png' />";
                        }
                        
                        $dateSrc = $date.' GMT';
@@ -177,7 +189,7 @@
                        
                        $conversion_tab = array(
                                "/\>(\S*)/is"   => "><a 
href='$wgScriptPath/index.php/$1'>$1</a>",
-                               "/\@(\S*)/is"   => "@<a 
href='$wgScriptPath/index.php/User:$1'>$1</a>", // TODO en anglais
+                               "/\@(\S*)/is"   => "@<a 
href='$wgScriptPath/index.php/User:$1'>$1</a>",
                                "/\#(\S*)/is"   => "<a class='handmouse tag' 
value='$1'>#$1</a>",
                                "/http(\S*)/is" => "<a href='http$1' 
target='_blank'>http$1</a>",
                                "/ www(\S*)/is" => " <a href='http://www$1' 
target='_blank'>www$1</a>",
@@ -330,8 +342,7 @@
                }
 
                mysql_close(); 
-               $o__response = new AjaxResponse($text);
-               return $o__response;
+               return $text;
        }
        public static function fnSubscribeAjax($link, $user, $type){
                $o__text = '';

Modified: trunk/extensions/WikiTweet/WikiTweet.config.php
===================================================================
--- trunk/extensions/WikiTweet/WikiTweet.config.php     2011-06-15 07:35:47 UTC 
(rev 90105)
+++ trunk/extensions/WikiTweet/WikiTweet.config.php     2011-06-15 09:48:07 UTC 
(rev 90106)
@@ -10,6 +10,7 @@
                'refreshTime'       => 15000,                  // Time to 
refresh in milliseconds
                
                // SMTP configuration :
+               'email'=> True, // True or False
                'SMTP'         => array(
                         'host'    => "smtphost", //could also be an IP address
                         'IDHost'  => "idhost",
@@ -47,5 +48,8 @@
                                'margin_left'       => '0px',
                                ),
                        ),
+               'inherit'      => array(
+                       'main' => array('room1','room2','room3')                
+                       )
                );
 ?>

Modified: trunk/extensions/WikiTweet/WikiTweet.functions.php
===================================================================
--- trunk/extensions/WikiTweet/WikiTweet.functions.php  2011-06-15 07:35:47 UTC 
(rev 90105)
+++ trunk/extensions/WikiTweet/WikiTweet.functions.php  2011-06-15 09:48:07 UTC 
(rev 90106)
@@ -13,6 +13,7 @@
        }
        public static function send( $to, $from, $subject, $body, $replyto=null 
)
        {
+               if(!$wgWikiTweet['email']){return false;}
                $wgOutputEncoding = 'UTF-8';
                $wgEnotifImpersonal = false;
                $wgErrorString = '';

Modified: trunk/extensions/WikiTweet/WikiTweet.i18n.php
===================================================================
--- trunk/extensions/WikiTweet/WikiTweet.i18n.php       2011-06-15 07:35:47 UTC 
(rev 90105)
+++ trunk/extensions/WikiTweet/WikiTweet.i18n.php       2011-06-15 09:48:07 UTC 
(rev 90106)
@@ -12,7 +12,7 @@
  */
 $messages['en'] = array(
        'wikitweet-desc' => 'Create a Twitter-like feed into MediaWiki',
-       'wikitweet-name' => 'MorphoTweets', // Do not translate, used as 
pagename
+       'wikitweet-name' => 'WikiTweet', // Do not translate, used as pagename
        'wikitweet-pleaselogin' => 'Please login to tweet.',
        'wikitweet-moretweets' => 'More tweets...',
        'wikitweet-infoajax' => 'uses the AJAX technology and refresh itself 
every 5 seconds without loading the page.',


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to