<?
/***********************************************************************************
Copyright (C) 2006 Mike Ramirez Da-Shiznit Blogger, a simple blogging script.
This program 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.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Contact me: hide@address.com
*************************************************************************************/
//database variables
//DB info
$dbserver = "localhost"; //database host, if it is remotely hosted, the ip or url must be put here
$dbname = ""; //database name
$dbuser = ""; //database user
$dbpass = ""; //database user pass
//Gallery variables
// Location of dirs for the random images gallery.
/***************DO NOT EDIT BELOW THIS LINE**************************************/
global $dbx = mysql_connect($dbserver, $dbuser, $dbpass);
if (!$dbx)
{
die ("Could not connect to database with this error: " . mysql_error());
}
if (!mysql_select_db($dbname))
{
echo "Unable to select to " . $dbname ." with this errer: " . mysql_error();
exit;
}
function bbcode($text)
{
$bbcodetext = $text;
//set an array to find the bbcode
$find = array(
"'\[b\](.*?)\[/b\]'is",
"'\[i\](.*?)\[/i\]'is",
"'\[u\](.*?)\[/u\]'is",
"'\[center\](.*?)\[/center\]'is",
"'\[image\](.*?)\[/image\]'is",
"'\[link\](.*?)\[/link\]'is",
"'\[link=(.*?)\](.*?)\[/link\]'is"
);
$replace = array(
//set an array that holds the styles for the bbcode
"<span class=\"bbbold\"\\1</span>",
"<span class=\"bbitalics\">\\1</span>",
"<span class=bbunderline>\\1</span>",
"<span class=\"bbcenter\">\\1</span>",
"<span class=\"bbbcode\">\\1</span>",
"<img src=\"\\1\" alt=\"\\1\" border=\"0\" />",
"<a href=\"\\1\">\\1</a>",
"<a href=\"\\1\">\\2</a>"
);
// Replace the [bbcode] with the styles in the text.
$parsedtext = preg_replace($find,$replace,$bbcodetext);
return $parsedtext;
}
?>