Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Vanilla 0.9.3+ versions of WhosOnline & PHPBBCode

Hi,

I tried to debug WhosOnline & PHPBBCode to make them available on Vanilla 0.9.3+. I don't know if anyone was on this project or did this already, but here they are :

WhosOnline version 1.1
PHPBBCode version 1.2

Comments

  • Options
    I'm like halfway through my BBCode extension; it works but there are some bugs. The WhosOnline plugin is much appreciated though :D
  • Options
    NickENickE New
    edited March 2006
    Besides the fact that the author name and version entries are changed, your bbcode 'conversion' looks exactly the same as the current 0.9.3 bbcode extension file to me.
  • Options
    edited March 2006
    SirNot : Damn... wrong zip :-)

    Now corrected, same address !
  • Options
    Still looks the same to me.
  • Options
    Hmmmm, either I'm mad (which is possible) or you have the wrong zip too ! :-).

    I checked it, and it's the right one. It's effectively based on the BBCode script, and modified with part of Garth Henson PHPMod for 0.9.2.
  • Options
    NickENickE New
    edited March 2006
    Well, I downloaded it just a minute ago, and the contents are still the same:
    <?php
    /*
    Extension Name: BB Code (PHP Mod)
    Extension Url: http://lussumo.com/docs/
    Description: A BBCode-to-HTML conversion tool for discussion comments
    Version: 1.2
    Author: Mark O'Sullivan and Garth Henson, Vanilla 0.9.3+ version by Julien Cassignol.
    Author Url: http://markosullivan.ca/
    */
    
    /*
    [copyright stuff...]
    */
    
    class BBCodeFormatter extends StringFormatter {
    	var $AllowedProtocols = array('http', 'https', 'ftp', 'news', 'nntp', 'feed', 'gopher', 'mailto');
    	var $DefaultProtocol = 'http://';
    	
    	function Parse($String, $Object, $FormatPurpose) {
    		if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) {
    			$String = $this->ProtectString($String);
    			return $this->BBEncode($String);
    		} else {
    			return $String;
    		}
    	}
    	function ProtectString ($String) {
    		$String = str_replace("<", "<", $String);
          $String = str_replace("\r\n", "<br />", $String);
    		return $String;
    	}
       
       function Url($String)
       {
       	   	$String = str_replace("\\\"", '"', $String);
    		$SplitUrl = explode('://', $String);
    		
    		if(count($SplitUrl) < 2) return $this->DefaultProtocol.$String;
    		else if(!in_array($SplitUrl[0], $this->AllowedProtocols)) return $this->DefaultProtocol.$String;
    		else return $String;
       }
       
       function BBEncode($String)
       {
       	   $Patterns = array(
    	      "/\[img\](.+?)\[\/img\]/ei", 
    	      "/\[url\=(.+?)\](.+?)\[\/url\]/ei", 
    	      "/\[url\](.+?)\[\/url\]/ei", 
    	      "/\[b\](.+?)\[\/b\]/is", 
    	      "/\[i\](.+?)\[\/i\]/is", 
    	      "/\[u\](.+?)\[\/u\]/is"
    	  );
          
          $Replacements = array(
    	      '\'<img src="\'.$this->Url(\'$1\').\'" />\'', 
    	      '\'<a href="\'.$this->Url(\'$1\').\'" target="_blank">$2</a>\'', 
    	      '\'<a href="\'.$this->Url(\'$1\').\'">$1</a>\'', 
    	      '<strong>$1</strong>', 
    	      '<em>$1</em>', 
    	      '<u>$1</u>'
    	  );
          
          return preg_replace($Patterns, $Replacements, $String);
       }
    }
    // Instantiate the bbcode object and add it to the string manipulation methods
    $BBCodeFormatter = $Context->ObjectFactory->NewObject($Context, "BBCodeFormatter");
    $Context->StringManipulator->AddManipulator("BBCode", $BBCodeFormatter);
    ?>
    
  • Options
    edited March 2006
    I downloaded it too just a minute ago and it's :

    <?php /* Extension Name: BB Code (PHP Mod) Extension Url: http://lussumo.com/docs/ Description: A BBCode-to-HTML conversion tool for discussion comments Version: 1.2 Author: Mark O'Sullivan and Garth Henson, Vanilla 0.9.3+ version by Julien Cassignol. Author Url: http://markosullivan.ca/ */ /* * Copyright 2003 - 2005 Mark O'Sullivan * This file is part of Vanilla. * Vanilla is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. * Vanilla is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with Vanilla; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * The latest source code for Vanilla is available at www.lussumo.com * Contact Mark O'Sullivan at mark [at] lussumo [dot] com */ /* Snip : Too long... */ $Replacements = array( '\'<img src="\'.$this->Url(\'$1\').\'" />\'', '\'<a href="\'.$this->Url(\'$1\').\'" target="_blank">$2</a>\'', '\'<a href="\'.$this->Url(\'$1\').\'">$1</a>\'', '<strong>$1</strong>', '<em>$1</em>', '<u>$1</u>' ); return $this->PHPCode(preg_replace($Patterns, $Replacements, $String)); } function PHPCode($String) { preg_match_all("|\[php\].+?\[/php\]|ims", $String, $matches); $phpOld = array(); $phpNew = array(); foreach ($matches[0] as $orig) { $phpOld[] = $orig; $new = str_replace(array('<','>','<br />','<br>'), array('<','>',"\n","\n"), $orig); $new = trim(preg_replace("|\[php\](.+?)\[/php\]|ims", "$1", $new)); $phpNew[] = "<div class='snippetTitle'>PHP Code:</div>\n<div class='codeSnippet'>" . highlight_string($new, true) . "</div>\n"; } $String = str_replace($phpOld, $phpNew, $String); preg_match_all("|\[code\].+?\[/code\]|ims", $String, $matches); $codeOld = array(); $codeNew = array(); foreach ($matches[0] as $orig) { $codeOld[] = $orig; $new = str_replace(array('<br />','<br>'), array("\n","\n"), $orig); $new = trim(preg_replace('|\[code\](.+?)\[/code\]|ims', "$1", $new)); $new = str_replace("\n", '<br />', $new); $codeNew[] = "<div class='snippetTitle'>Code:</div>\n<div class='codeSnippet'><code>$new< /code></div>\n"; } $String = str_replace($codeOld, $codeNew, $String); return $String; } } // Instantiate the bbcode object and add it to the string manipulation methods $BBCodeFormatter = $Context->ObjectFactory->NewObject($Context, "BBCodeFormatter"); $Context->StringManipulator->AddManipulator("BBCode", $BBCodeFormatter); ?>

    I had to add an extra space on </code> by the way :-)
  • Options
    Oh, weird. Must be a browser cache issue or something.

    It also looks like the html formatter dosn't seem to be properly replacing ampersands all of a sudden...
  • Options
    WOOT for whosonline. a favorite extension of mine and my users.
  • Options
    i'll let david know you updated it.
  • Options
    Cool. I updated http://www.thirty5.net/code/vanilla/whosonline/ with your version. :)
  • Options
    edited June 2007
    [moved to its own discussion - sorry]
This discussion has been closed.