*** empty log message ***

git-svn-id: http://svn.automattic.com/wordpress/trunk@3 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2003-04-01 14:12:34 +00:00
parent 23f1a9d2a4
commit b43564cb29
41 changed files with 7560 additions and 0 deletions

57
b2.php Normal file
View File

@ -0,0 +1,57 @@
<?php /* Don't remove this line, it calls the b2 function files ! */ $blog=1; include ("blog.header.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $blogname ?></title>
<!-- Change charset if needed(?) But please do not remove this metatag -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="reply-to" content="you@somewhere.zzz" />
<meta http-equiv="imagetoolbar" content="no" />
<meta content="TRUE" name="MSSmartTagsPreventParsing" />
<link rel="alternate" type="text/xml" title="RDF" href="<?php bloginfo('rdf_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php comments_popup_script() ?>
</head>
<body>
<!-- // b2 loop start -->
<?php while($row = mysql_fetch_object($result)) { start_b2(); ?>
<?php the_date("d.m.y","<h1>","</h1>"); ?>
<p>
<?php permalink_anchor(); ?>
<strong><?php the_title(); ?></strong> (category: <strong><?php the_category() ?></strong>)<br />
<?php the_content(); ?><?php link_pages("<br />Pages: ","<br />","number") ?>
<br />
<em>posted by <strong><?php the_author() ?></strong> @ <a href="<?php permalink_link() ?>"><?php the_time() ?></a></em>
<br />
<?php comments_popup_link("comments ?", "1 comment", "% comments") ?>
</p>
<?php include ("b2comments.php"); ?>
<!-- // this is just the end of the motor - don't touch that line either :) -->
<?php } ?>
<div align="right">[powered by <a href="http://cafelog.com" target="_blank"><b>b2</b></a>.]<br />
<br />
<a href="b2login.php">login</a><br />
<a href="b2register.php">register</a></div>
<?php
if ($debug=="1") {
echo "<p>$querycount queries - ".number_format(timer_stop(),3)." seconds</p>";
}
?>
</body>
</html>

254
b2bookmarklet.php Normal file
View File

@ -0,0 +1,254 @@
<?php
/* <Bookmarklet> */
$mode = "bookmarklet";
$standalone = 1;
require("./b2header.php");
if ($user_level == 0)
die ("Cheatin' uh ?");
if ($a=="b") {
?><html>
<head>
<script language="javascript">
<!--
window.close()
-->
</script>
</head>
<body></body>
</html><?php
} else {
?><html>
<head>
<title>b2 > bookmarklet</title>
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<?php
if ($use_spellchecker) {
?><script type="text/javascript" language="javascript">
<!--
function DoSpell(formname, subject, body) {
document.SPELLDATA.formname.value=formname
document.SPELLDATA.subjectname.value=subject
document.SPELLDATA.messagebodyname.value=body
document.SPELLDATA.companyID.value="custom\\http://cafelog.com"
document.SPELLDATA.language.value=1033
document.SPELLDATA.opener.value="sproxy.pl"
document.SPELLDATA.formaction.value="http://www.spellchecker.com/spell/startspelling.asp "
window.open("b2spell.php","Spell",
"toolbar=no,directories=no,location=yes,urlbar=yes,resizable=yes,width=620,height=600,top=100,left=100")
}
function preview(form) {
var preview_date = "<?php echo date("Y-m-d H:i:s"); ?>";
var preview_userid = "<?php echo $user_ID ?>";
var preview_title = form.post_title.value;
var preview_category = form.post_category.value;
var preview_content = form.content.value;
var preview_autobr = form.post_autobr.value;
preview_date = escape(preview_date);
preview_userid = escape(preview_userid);
preview_title = escape(preview_title);
preview_category = escape(preview_category);
preview_content = escape(preview_content);
preview_autobr = escape(preview_autobr);
window.open ("<?php echo "$siteurl/$blogfilename" ?>?preview=1&preview_date="+preview_date +"&preview_userid="+preview_userid +"&preview_title="+preview_title +"&preview_category="+preview_category +"&preview_content="+preview_content +"&preview_autobr="+preview_autobr ,"Preview", "location=0,menubar=1,resizable=1,scrollbars=yes,status=1,toolbar=0");
}
function launchupload() {
window.open ("b2upload.php", "b2upload", "width=380,height=360,location=0,menubar=0,resizable=1,scrollbars=yes,status=1,toolbar=0");
}
//-->
</script>
<?php
}
?>
<style type="text/css">
<!--
body {
background-image: url('<?php
if ($is_gecko || $is_IE) {
?>b2-img/bgbookmarklet1.gif<?php
} else {
?>b2-img/bgbookmarklet3.gif<?php
}
?>');
background-repeat: no-repeat;
}
<?php
if (!$is_NS4) {
?>
textarea,input,select {
background-color: transparent;
<?php if ($is_gecko || $is_macIE) { ?>
background-image: url('b2-img/bgbookmarklet.png');
<?php } elseif ($is_winIE) { ?>
background-color: #cccccc;
filter: alpha(opacity:80);
<?php } ?>
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php if (!$is_gecko) { ?>
.checkbox {
background-color: #ffffff;
border-width: 0px;
padding: 0px;
margin: 0px;
}
<?php } ?>
<?php
}
?>
textarea {
font-family: Verdana, Geneva, Arial, Helvetica;
font-size: 0.9em;
}
-->
</style>
</head>
<body>
<form name="post" action="b2edit.php" method="POST">
<input type="hidden" name="action" value="post" />
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="mode" value="bookmarklet" />
<div align="right">
<?php
$popuptitle = stripslashes($popuptitle);
$text = stripslashes($text);
/* big funky fixes for browsers' javascript bugs */
if (($is_macIE) && (!isset($IEMac_bookmarklet_fix))) {
$popuptitle = preg_replace($b2_macIE_correction["in"],$b2_macIE_correction["out"],$popuptitle);
$text = preg_replace($b2_macIE_correction["in"],$b2_macIE_correction["out"],$text);
}
if (($is_winIE) && (!isset($IEWin_bookmarklet_fix))) {
$popuptitle = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $popuptitle);
$text = preg_replace("/\%u([0-9A-F]{4,4})/e", "'&#'.base_convert('\\1',16,10).';'", $text);
}
if (($is_gecko) && (!isset($Gecko_bookmarklet_fix))) {
$popuptitle = preg_replace($b2_gecko_correction["in"],$b2_gecko_correction["out"],$popuptitle);
$text = preg_replace($b2_gecko_correction["in"],$b2_gecko_correction["out"],$text);
}
/* /big funky fixes */
?>
<table width="100%" cellpadding="8" cellspacing="0" width="415">
<tr>
<td width="40">&nbsp;</td>
<td align="left" width="415">
<table cellspacing="0" cellpadding="0">
<td height="50" width="250" align="left" valign="bottom"><b>Title</b><br />
<input type="text" name="post_title" size="20" tabindex="1" style="width: 215px;" value="<?php echo stripslashes($popuptitle) ?>" /></td>
<td width="165" align="left" valign="bottom"><b>Category</b><br /><?php dropdown_categories(); ?></td>
</table>
</td>
</tr>
<tr height="40">
<td width="40">&nbsp;</td>
<td width="415" align="left" height="40">
<table width="415" cellpadding="0" cellspacing="0">
<td align="left" valign="bottom"><b>Post</b></td>
<td align="right" valign="bottom"><?php if ($use_quicktags) include($b2inc."/b2quicktags.php"); ?></td>
</table>
<?php
if ((preg_match("/Nav/",$HTTP_USER_AGENT)) || (preg_match("/Mozilla\/4\.7/",$HTTP_USER_AGENT))) {
$rows="6";
} else {
$rows="8";
} ?>
<?php
// stuff to fix textism.com's WEIRD characters conflict with javascript on IE5Mac
preg_match("/\%u[1-9A-F][1-9A-F][1-9A-F][1-9A-F]/is", $text, $stufftofix);
// ... and so on. currently coding the fix
?>
<textarea rows="<?php echo $rows ?>" cols="48" style="width:415px;" name="content" tabindex="2" class="postform"><?php echo "<a href=\"$popupurl\">$popuptitle</a>\n$text" ?></textarea><br />
<table cellpadding="0" cellspacing="0">
<td align="left" width="90">
<input type="checkbox" name="post_autobr" value="1" <?php if ($autobr) echo " checked" ?> tabindex="4" class="checkbox" id="autobr" /><label for="autobr"> Auto-BR</label>
</td>
<?php if ($pingback) { ?>
<td align="left">
<input type="checkbox" class="checkbox" name="post_pingback" value="1" checked="checked" tabindex="7" id="pingback" /><label for="pingback"> PingBack</label>
</td>
<?php } ?>
</table>
<?php if ($use_preview) { ?>
<input type="button" value="preview" onclick="preview(this.form);" class="search" tabindex="8" />
<?php } ?>
<input type="submit" name="submit" value="Blog this !" class="search" tabindex="3" />
<?php if ($use_spellchecker) { ?>
<!--<input type = "button" value = "Spell Check" onclick="var f=document.forms[0]; doSpell( 'en', f.post_content, '<?php echo $spellchecker_url ?>/sproxy.cgi', true);" class="search" tabindex="5" />-->
<input type="button" value="Spellcheck" onclick="DoSpell
('post','content','');" class="search" />
<?php } ?>
<?php if ( ($use_fileupload) && ($user_level >= $fileupload_minlevel) && ((ereg(" ".$user_login." ", $fileupload_allowedusers)) || (trim($fileupload_allowedusers)=="")) ) { ?>
<input type="button" value="upload a file" onclick="launchupload();" class="search" />
<?php } ?>
<script language="JavaScript">
<!--
window.focus();
// document.blog.post_content.focus();
//-->
</script>
</td>
</tr>
<?php if ($trackback) { ?>
<tr>
<td width="40">&nbsp;</td>
<td width="415" align="left" height="40">
<b>TrackBack</b> an URL:<br />
<input type="text" name="trackback_url" style="width: 415px" />
</td>
</tr>
<?php } ?>
</table>
</div>
</form>
<!-- this is for the spellchecker -->
<form name="SPELLDATA"><div>
<input name="formname" type="hidden" value="">
<input name="messagebodyname" type="hidden" value="">
<input name="subjectname" type="hidden" value="">
<input name="companyID" type="hidden" value="">
<input name="language" type="hidden" value="">
<input name="opener" type="hidden" value="">
<input name="formaction" type="hidden" value="">
</div></form>
</body>
</html><?php
}
?>

283
b2calendar.php Normal file
View File

@ -0,0 +1,283 @@
<?php
// $Id$
// b2 Calendar
//
// Contributed work by:
// Alex King
// http://www.alexking.org
//
// Mike Little for his bug fixes
// http://zed1.com/b2/
//
// Fred Cooper for querystring bugfix
// http://frcooper.com/journal/
//
// b2 is copyright (c) 2001, 2002 by Michel Valdrighi - m@tidakada.com
//
// Contributed portions copyright (c) various authors with permission
//
// original arrow hack by Alex King
$ak_use_arrows = 1; // set to 0 to hide the arrows
$ak_use_tooltip_titles = 1; // set to 0 to hide the tooltip titles
/* customize these as you wish */
$calendarmonthdisplay = 1; // set this to 0 if you don't want to display the month name
$calendarmonthformat = 'F Y';
$calendarmonthstart = '<caption class="b2calendarmonth">';
$calendarmonthend = '</caption>';
$calendartablestart = '<table class="b2calendartable" summary="Monthly calendar with links to each day\'s posts">';
$calendartableend = '</table>';
$calendarrowstart = '<tr class="b2calendarrow">';
$calendarrowend = '</tr>';
$calendarheaderdisplay = 1; // set this to 0 if you don't want to display the "Mon Tue Wed..." header
$calendarheadercellstart = '<th class="b2calendarheadercell" abbr="$abbr">'; // please leave $abbr there !
$calendarheadercellend = '</th>';
$calendarheaderabbrlenght = 3; // lenght of the shortened weekday
$calendarcellstart = '<td class="b2calendarcell">';
$calendarcellend = '</td>';
$calendaremptycellstart = '<td class="b2calendaremptycell">';
$calendaremptycellend = '</td>';
$calendaremptycellcontent = '&nbsp;';
/* stop customizing (unless you really know what you're doing) */
include('b2config.php');
require_once("$b2inc/b2template.functions.php");
require_once("$b2inc/b2functions.php");
require_once("$b2inc/b2vars.php");
dbconnect();
if (isset($calendar) && ($calendar != '')) {
$thisyear = substr($calendar,0,4);
$thismonth = substr($calendar,4,2);
} else {
if (isset($m) && ($m != '')) {
$calendar = substr($m,0,6);
$thisyear = substr($m,0,4);
if (strlen($m) < 6) {
$thismonth = '01';
} else {
$thismonth = substr($m,4,2);
}
} else {
$thisyear = date('Y', time()+($time_difference * 3600));
$thismonth = date('m', time()+($time_difference * 3600));
}
}
$archive_link_m = $siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal;
// original arrow hack by Alex King
$ak_previous_year = $thisyear;
$ak_next_year = $thisyear;
$ak_previous_month = $thismonth - 1;
$ak_next_month = $thismonth + 1;
if ($ak_previous_month == 0) {
$ak_previous_month = 12;
--$ak_previous_year;
}
if ($ak_next_month == 13) {
$ak_next_month = 1;
++$ak_next_year;
}
$ak_first_post = mysql_query("SELECT MONTH(MIN(post_date)), YEAR(MIN(post_date)) FROM $tableposts");
$ak_first_post = mysql_fetch_array($ak_first_post);
// using text links by default
$ak_previous_month_dim = '<span>&lt;</span>&nbsp;&nbsp;';
$ak_previous_month_active = '<a href="'.$archive_link_m.$ak_previous_year.zeroise($ak_previous_month,2).'" style="text-decoration: none;">&lt;</a>&nbsp;&nbsp;';
$ak_next_month_dim = '&nbsp;&nbsp;<span>&gt;</span>';
$ak_next_month_active = '&nbsp;&nbsp;<a href="'.$archive_link_m.$ak_next_year.zeroise($ak_next_month,2).'" style="text-decoration: none;">&gt;</a>';
if ($ak_use_arrows == 1) {
if (mktime(0,0,0,$ak_previous_month,1,$ak_previous_year) < mktime(0,0,0,$ak_first_post[0],1,$ak_first_post[1])) {
$ak_previous_month_link = $ak_previous_month_dim;
}
else {
$ak_previous_month_link = $ak_previous_month_active;
}
if (mktime(0,0,0,$ak_next_month,1,$ak_next_year) > mktime()) {
$ak_next_month_link = $ak_next_month_dim;
}
else {
$ak_next_month_link = $ak_next_month_active;
}
}
else {
$ak_previous_month_link = "";
$ak_next_month_link = "";
}
$end_of_week = (($start_of_week + 7) % 7);
$calendarmonthwithpost = 0;
while($calendarmonthwithpost == 0) {
$arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) FROM $tableposts WHERE MONTH(post_date) = '$thismonth' AND YEAR(post_date) = '$thisyear' ORDER BY post_date DESC";
$querycount++;
$arc_result=mysql_query($arc_sql) or die($arc_sql."<br />".mysql_error());
if (mysql_num_rows($arc_result) > 0) {
$daysinmonthwithposts = '-';
while($arc_row = mysql_fetch_array($arc_result)) {
$daysinmonthwithposts .= $arc_row["DAYOFMONTH(post_date)"].'-';
}
$calendarmonthwithpost = 1;
} elseif ($calendar != '') {
$daysinmonthwithposts = '';
$calendarmonthwithpost = 1;
} else {
$thismonth = zeroise(intval($thismonth)-1,2);
if ($thismonth == '00') {
$thismonth = '12';
$thisyear = ''.(intval($thisyear)-1);
}
}
}
$daysinmonth = intval(date('t', mktime(0,0,0,$thismonth,1,$thisyear)));
$datestartofmonth = $thisyear.'-'.$thismonth.'-01';
$dateendofmonth = $thisyear.'-'.$thismonth.'-'.$daysinmonth;
// caution: offset bug inside
$calendarblah = get_weekstartend($datestartofmonth, $start_of_week);
if (mysql2date('w', $datestartofmonth) == $start_of_week) {
$calendarfirst = $calendarblah['start']+1+3600; // adjust for daylight savings time
} else {
$calendarfirst = $calendarblah['end']-604799+3600; // adjust for daylight savings time
}
$calendarblah = get_weekstartend($dateendofmonth, $end_of_week);
if (mysql2date('w', $dateendofmonth) == $end_of_week) {
$calendarlast = $calendarblah['start']+1;
} else {
$calendarlast = $calendarblah['end']+10000;
}
$beforethismonth = zeroise(intval($thismonth)-1,2);
$afterthismonth = zeroise(intval($thismonth)-1,2);
// here the offset bug is corrected
if ((intval(date('d', $calendarfirst)) > 1) && (intval(date('m', $calendarfirst)) == intval($thismonth))) {
$calendarfirst = $calendarfirst - 604800;
}
// displays everything
echo $calendartablestart."\n";
if ($calendarmonthdisplay) {
echo $calendarmonthstart;
echo $ak_previous_month_link;
echo date_i18n($calendarmonthformat, mktime(0, 0, 0, $thismonth, 1, $thisyear));
echo $ak_next_month_link;
echo $calendarmonthend."\n";
}
if ($calendarheaderdisplay) {
echo $calendarrowstart."\n";
for ($i = $start_of_week; $i<($start_of_week+7); $i = $i + 1) {
echo str_replace('$abbr', $weekday[($i % 7)], $calendarheadercellstart);
echo ucwords(substr($weekday[($i % 7)], 0, $calendarheaderabbrlenght));
echo $calendarheadercellend;
}
echo $calendarrowend."\n";
}
echo $calendarrowstart."\n";
$newrow = 0;
$j = 0;
$k = 1;
// original tooltip hack by Alex King
if ($ak_use_tooltip_titles == 1) {
$ak_days_result = mysql_query("SELECT post_title, post_date FROM $tableposts WHERE YEAR(post_date) = '$thisyear' AND MONTH(post_date) = '$thismonth'");
$ak_day_title_array = array();
while($ak_temp = mysql_fetch_array($ak_days_result)) {
$ak_day_title_array[] = $ak_temp;
}
if (strstr($HTTP_SERVER_VARS["HTTP_USER_AGENT"], "MSIE")) {
$ak_title_separator = "\n";
$ak_trim = 1;
}
else {
$ak_title_separator = ", ";
$ak_trim = 2;
}
}
for($i = $calendarfirst; $i<($calendarlast+86400); $i = $i + 86400) {
if ($newrow == 1) {
if ($k > $daysinmonth) {
break;
}
echo $calendarrowend."\n";
if (($i+86400) < ($calendarlast+86400)) {
echo $calendarrowstart."\n";
}
$newrow = 0;
}
if (date('m',$i) != $thismonth) {
echo $calendaremptycellstart;
echo $calendaremptycellcontent;
echo $calendaremptycellend;
} else {
$k = $k + 1;
echo $calendarcellstart;
$calendarblah = '-'.date('j',$i).'-';
$calendarthereisapost = ereg($calendarblah, $daysinmonthwithposts);
$calendartoday = (date('Ymd',$i) == date('Ymd', (time() + ($time_difference * 3600))));
if ($calendarthereisapost) {
// original tooltip hack by Alex King
if ($ak_use_tooltip_titles == 1) { // check to see if we want to show the tooltip titles
$ak_day_titles = "";
foreach($ak_day_title_array as $post) {
if (substr($post[1], 8, 2) == date('d',$i)) {
$ak_day_titles = $ak_day_titles.stripslashes($post[0]).$ak_title_separator;
}
}
$ak_day_titles = substr($ak_day_titles, 0, strlen($ak_day_titles) - $ak_trim);
echo '<a href="'.$siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal.$thisyear.$thismonth.date('d',$i).'" class="b2calendarlinkpost" title="'.$ak_day_titles.'">';
}
else {
echo '<a href="'.$siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal.$thisyear.$thismonth.date('d',$i).'" class="b2calendarlinkpost">';
}
}
if ($calendartoday) {
echo '<span class="b2calendartoday">';
}
echo date('j',$i);
if ($calendartoday) {
echo '</span>';
}
if ($calendarthereisapost) {
echo '</a>';
}
echo $calendarcellend."\n";
}
$j = $j + 1;
if ($j == 7) {
$j = 0;
$newrow = 1;
}
}
echo $calendarrowend."\n";
echo $calendartableend;
?>

176
b2categories.php Normal file
View File

@ -0,0 +1,176 @@
<?php
$title = "Categories";
/* <Categories> */
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$b2varstoreset = array('action','standalone','cat');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch($action) {
case "addcat":
$standalone = 1;
require_once("./b2header.php");
if ($user_level < 3)
die ("Cheatin' uh ?");
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
$query="INSERT INTO $tablecategories (cat_ID,cat_name) VALUES ('0', '$cat_name')";
$result=mysql_query($query) or die("Couldn't add category <b>$cat_name</b>");
header("Location: b2categories.php");
break;
case "Delete":
$standalone = 1;
require_once("./b2header.php");
$cat_ID = $HTTP_POST_VARS["cat_ID"];
$cat_name=get_catname($cat_ID);
$cat_name=addslashes($cat_name);
if ($cat_ID=="1")
die("Can't delete the <b>$cat_name</b> category: this is the default one");
if ($user_level < 3)
die ("Cheatin' uh ?");
$query="DELETE FROM $tablecategories WHERE cat_ID=\"$cat_ID\"";
$result=mysql_query($query) or die("Couldn't delete category <b>$cat_name</b>".mysql_error());
$query="UPDATE $tableposts SET post_category='1' WHERE post_category='$cat_ID'";
$result=mysql_query($query) or die("Couldn't reset category on posts where category was <b>$cat_name</b>");
header("Location: b2categories.php");
break;
case "Rename":
require_once ("./b2header.php");
$cat_name=get_catname($HTTP_POST_VARS["cat_ID"]);
$cat_name=addslashes($cat_name);
?>
<?php echo $blankline; ?>
<?php echo $tabletop; ?>
<p><b>Old</b> name: <?php echo $cat_name ?></p>
<p>
<form name="renamecat" action="b2categories.php" method="post">
<b>New</b> name:<br />
<input type="hidden" name="action" value="editedcat" />
<input type="hidden" name="cat_ID" value="<?php echo $HTTP_POST_VARS["cat_ID"] ?>" />
<input type="text" name="cat_name" value="<?php echo $cat_name ?>" /><br />
<input type="submit" name="submit" value="Edit it !" class="search" />
</form>
<?php echo $tablebottom; ?>
<?php
break;
case "editedcat":
$standalone = 1;
require_once("./b2header.php");
if ($user_level < 3)
die ("Cheatin' uh ?");
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
$cat_ID=addslashes($HTTP_POST_VARS["cat_ID"]);
$query="UPDATE $tablecategories SET cat_name='$cat_name' WHERE cat_ID=$cat_ID";
$result=mysql_query($query) or die("Couldn't edit category <b>$cat_name</b>: ".mysql_error());
header("Location: b2categories.php");
break;
default:
$standalone=0;
require_once ("./b2header.php");
if ($user_level < 3) {
die("You have no right to edit the categories for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
}
?>
<?php echo $blankline ?>
<?php echo $tabletop ?>
<table width="" cellpadding="5" cellspacing="0">
<form></form>
<tr>
<td>
<form name="cats" method="post">
<b>Edit</b> a category:<br />
<?php
$query="SELECT * FROM $tablecategories ORDER BY cat_ID";
$result=mysql_query($query);
echo "<select name=\"cat_ID\">\n";
while($row = mysql_fetch_object($result)) {
echo "\t<option value=\"".$row->cat_ID."\"";
if ($row->cat_ID == $cat)
echo " selected";
echo ">".$row->cat_ID.": ".$row->cat_name."</option>\n";
}
echo "</select>\n";
?><br />
<input type="submit" name="action" value="Delete" class="search" />
<input type="submit" name="action" value="Rename" class="search" />
</form>
</p>
<p>
<b>Add</b> a category:<br />
<form name="addcat" action="b2categories.php" method="post">
<input type="hidden" name="action" value="addcat" />
<input type="text" name="cat_name" /><br />
<input type="submit" name="submit" value="Add it !" class="search" /></form></td></tr></table>
<?php echo $tablebottom ?>
<br />
<?php echo $tabletop ?>
<b>Note:</b><br />
Deleting a category does not delete posts from that category.<br />It will just set them back to the default category <b><?php echo get_catname(1) ?></b>.
<?php echo $tablebottom ?>
<?php
break;
}
/* </Categories> */
include($b2inc."/b2footer.php"); ?>

94
b2comments.php Normal file
View File

@ -0,0 +1,94 @@
<?php // Do not delete these lines
if (basename($HTTP_SERVER_VARS["SCRIPT_FILENAME"]) == "b2comments.php")
die ("please, do not load this page directly");
if (($withcomments) or ($c)) {
$comment_author = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "name" : $HTTP_COOKIE_VARS["comment_author"];
$comment_author_email = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "email" : trim($HTTP_COOKIE_VARS["comment_author_email"]);
$comment_author_url = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "url" : trim($HTTP_COOKIE_VARS["comment_author_url"]);
$queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_content NOT LIKE '%<trackback />%' AND comment_content NOT LIKE '%<pingback />%' ORDER BY comment_date";
$resultc = mysql_query($queryc);
if ($resultc) {
?>
<!-- you can start editing here -->
<a name="comments"></a>
<p>&nbsp;</p>
<div><strong><span style="color: #0099CC">::</span> comments</strong></div>
<p>&nbsp;</p>
<?php /* this line is b2's motor, do not delete it */ $wxcvbn_c=0; while($rowc = mysql_fetch_object($resultc)) { $wxcvbn_c++; $commentdata = get_commentdata($rowc->comment_ID); ?>
<a name="c<?php comment_ID() ?>"></a>
<!-- comment -->
<p>
<b><?php comment_author() ?> <?php comment_author_email_link("email", " - ", "") ?><?php comment_author_url_link("url", " - ", "") ?></b>
<br />
<?php comment_text() ?>
<br />
<?php comment_date() ?> @ <?php comment_time() ?>
</p>
<p>&nbsp;</p>
<!-- /comment -->
<?php /* end of the loop, don't delete */ } if (!$wxcvbn_c) { ?>
<!-- this is displayed if there are no pingbacks so far -->
<p>No Comment on this post so far.</p>
<?php /* if you delete this the sky will fall on your head */ } ?>
<div><strong><span style="color: #0099CC">::</span> leave a comment</strong></div>
<p>&nbsp;</p>
<!-- form to add a comment -->
<form action="<?php echo $siteurl; ?>/b2comments.post.php" method="post">
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($HTTP_SERVER_VARS["REQUEST_URI"]); ?>" />
<p class="commentfield">
name<br />
<input type="text" name="author" class="textarea" value="<?php echo $comment_author ?>" size="20" tabindex="1" />
</p>
<p class="commentfield">
email<br />
<input type="text" name="email" class="textarea" value="<?php echo $comment_author_email ?>" size="20" tabindex="2" />
</p>
<p class="commentfield">
url<br />
<input type="text" name="url" class="textarea" value="<?php echo $comment_author_url ?>" size="20" tabindex="3" />
</p>
<p class="commentfield">
your comment<br />
<textarea cols="40" rows="4" name="comment" tabindex="4" class="textarea">comment</textarea>
</p>
<p class="commentfield">
<input type="checkbox" name="comment_autobr" value="1" <?php
if ($autobr)
echo " checked=\"checked\"" ?> tabindex="6" /> Auto-BR (line-breaks become &lt;br> tags)<br />
<input type="submit" name="submit" class="buttonarea" value="ok" tabindex="5" />
</p>
</form>
<!-- /form -->
<p>&nbsp;</p>
<div><b><span style="color: #0099CC">::</span> <a href="javascript:history.go(-1)">return to the blog</a></b></div>
<?php // if you delete this the sky will fall on your head
}
} else {
return false;
}
?>

137
b2comments.post.php Normal file
View File

@ -0,0 +1,137 @@
<?php
# if you want to change the paths here, remember to put your new path BEFORE $b2inc,
# like this: "b2/$b2inc/b2functions.php"
require("b2config.php");
require("$b2inc/b2template.functions.php");
include("$b2inc/b2vars.php");
include("$b2inc/b2functions.php");
dbconnect();
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$author = trim($HTTP_POST_VARS["author"]);
$email = trim($HTTP_POST_VARS["email"]);
$url = trim($HTTP_POST_VARS["url"]);
$comment = trim($HTTP_POST_VARS["comment"]);
$original_comment = $comment;
$comment_autobr = $HTTP_POST_VARS["comment_autobr"];
$comment_post_ID = $HTTP_POST_VARS["comment_post_ID"];
if ($require_name_email && ($email == "" || $email == "@" || $author == "" || $author == "name")) { //original fix by Dodo, and then Drinyth
echo "Error: please fill the required fields (name, email)";
exit;
}
if ($comment == "comment" || $comment == "") {
echo "Error: please type a comment";
exit;
}
$user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$user_domain = gethostbyaddr($user_ip);
$time_difference = get_settings("time_difference");
$now = date("Y-m-d H:i:s",(time() + ($time_difference * 3600)));
$author = strip_tags($author);
$email = strip_tags($email);
if (strlen($email) < 6) {
$email = '';
}
$url = trim(strip_tags($url));
$url = ((!stristr($url, '://')) && ($url != '')) ? 'http://'.$url : $url;
if (strlen($url) < 7) {
$url = '';
}
$comment = strip_tags($comment, $comment_allowed_tags);
$comment = balanceTags($comment, 1);
$comment = convert_chars($comment);
$comment = format_to_post($comment);
$comment_author = $author;
$comment_author_email = $email;
$comment_author_url = $url;
$author = addslashes($author);
$email = addslashes($email);
$url = addslashes($url);
/* flood-protection */
$query = "SELECT * FROM $tablecomments WHERE comment_author_IP='$user_ip' ORDER BY comment_date DESC LIMIT 1";
$result = mysql_query($query);
$ok=1;
if (!empty($result)) {
while($row = mysql_fetch_object($result)) {
$then=$row->comment_date;
}
$time_lastcomment=mysql2date("U","$then");
$time_newcomment=mysql2date("U","$now");
if (($time_newcomment - $time_lastcomment) < 30)
$ok=0;
}
/* end flood-protection */
if ($ok) {
$query = "INSERT INTO $tablecomments VALUES ('0','$comment_post_ID','$author','$email','$url','$user_ip','$now','$comment','0')";
$result = mysql_query($query);
if (!$result)
die ("There is an error with the database, it can't store your comment...<br>Contact the <a href=\"mailto:$admin_email\">webmaster</a>");
if ($comments_notify) {
$notify_message = "New comment on your post #$comment_post_ID.\r\n\r\n";
$notify_message .= "author : $comment_author (IP: $user_ip , $user_domain)\r\n";
$notify_message .= "e-mail : $comment_author_email\r\n";
$notify_message .= "url : $comment_author_url\r\n";
$notify_message .= "comment: \n".stripslashes($original_comment)."\r\n\r\n";
$notify_message .= "You can see all comments on this post there: \r\n";
$notify_message .= $siteurl.'/'.$blogfilename.$querystring_start.'p'.$querystring_equal.$comment_post_ID.$querystring_separator.'c'.$querystring_equal.'1'."\r\n\r\n";
$postdata = get_postdata($comment_post_ID);
$authordata = get_userdata($postdata["Author_ID"]);
$recipient = $authordata["user_email"];
$subject = "comment on post #$comment_post_ID \"".$postdata["Title"]."\"";
@mail($recipient, $subject, $notify_message, "From: b2@".$HTTP_SERVER_VARS['SERVER_NAME']."\r\n"."X-Mailer: b2 $b2_version - PHP/" . phpversion());
}
if ($email == "") {
$email = " "; // this to make sure a cookie is set for 'no email'
}
if ($url == "") {
$url = " "; // this to make sure a cookie is set for 'no url'
}
setcookie("comment_author",$author, time()+30000000);
setcookie("comment_author_email",$email, time()+30000000);
setcookie("comment_author_url",$url, time()+30000000);
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
$location = (!empty($HTTP_POST_VARS['redirect_to'])) ? $HTTP_POST_VARS['redirect_to'] : $HTTP_SERVER_VARS["HTTP_REFERER"];
header("Location: $location");
} else {
die("Sorry, you can only post a new comment every 30 seconds");
}
?>

133
b2commentspopup.php Normal file
View File

@ -0,0 +1,133 @@
<?php /* Don't remove this line, it calls the b2 function files ! */
$blog=1; include ("blog.header.php"); while($row = mysql_fetch_object($result)) { start_b2();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $blogname ?> - comments on '<?php the_title() ?>'</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="reply-to" content="you@yourdomain.com" />
<meta http-equiv="imagetoolbar" content="no" />
<meta content="TRUE" name="MSSmartTagsPreventParsing" />
<style type="text/css" media="screen">
@import url( layout2b.css );
</style>
<link rel="stylesheet" type="text/css" media="print" href="b2-include/print.css" />
<link rel="alternate" type="text/xml" title="XML" href="<?php echo $siteurl ?>/b2rss.php" />
</head>
<body>
<div id="header"><a href="" title="<?php echo $blogname ?>"><?php echo $blogname ?></a></div>
<div id="contentcomments">
<div class="storyContent">
<?php
$comment_author = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "name" : $HTTP_COOKIE_VARS["comment_author"];
$comment_author_email = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "email" : trim($HTTP_COOKIE_VARS["comment_author_email"]);
$comment_author_url = (empty($HTTP_COOKIE_VARS["comment_author"])) ? "url" : trim($HTTP_COOKIE_VARS["comment_author_url"]);
$queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_content NOT LIKE '%<trackback />%' ORDER BY comment_date";
$resultc = mysql_query($queryc);
if ($resultc) {
?>
<!-- you can start editing here -->
<a name="comments"></a>
<p>&nbsp;</p>
<div><strong><span style="color: #0099CC">::</span> comments</strong></div>
<p>&nbsp;</p>
<?php // these lines are b2's motor, do not delete
while($rowc = mysql_fetch_object($resultc)) {
$commentdata = get_commentdata($rowc->comment_ID);
?><a name="c<?php comment_ID() ?>"></a>
<!-- comment -->
<p>
<b><?php comment_author() ?> <?php comment_author_email_link("email", " - ", "") ?><?php comment_author_url_link("url", " - ", "") ?></b>
<br />
<?php comment_text() ?>
<br />
<?php comment_date() ?> @ <?php comment_time() ?>
</p>
<p>&nbsp;</p>
<!-- /comment -->
<?php //end of the loop, don't delete
}
?>
<div><strong><span style="color: #0099CC">::</span> leave a comment</strong></div>
<p>&nbsp;</p>
<!-- form to add a comment -->
<form action="b2comments.post.php" method="post">
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($HTTP_SERVER_VARS["REQUEST_URI"]); ?>" />
<p class="commentfield">
name<br />
<input type="text" name="author" class="textarea" value="<?php echo $comment_author ?>" size="20" tabindex="1" />
</p>
<p class="commentfield">
email<br />
<input type="text" name="email" class="textarea" value="<?php echo $comment_author_email ?>" size="20" tabindex="2" />
</p>
<p class="commentfield">
url<br />
<input type="text" name="url" class="textarea" value="<?php echo $comment_author_url ?>" size="20" tabindex="3" />
</p>
<p class="commentfield">
your comment<br />
<textarea cols="40" rows="4" name="comment" tabindex="4" class="textarea">comment</textarea>
</p>
<p class="commentfield">
<input type="checkbox" name="comment_autobr" value="1" <?php
if ($autobr)
echo " checked=\"checked\"" ?> tabindex="6" /> Auto-BR (line-breaks become &lt;br> tags)<br />
<input type="submit" name="submit" class="buttonarea" value="ok" tabindex="5" />
</p>
</form>
<!-- /form -->
<p>&nbsp;</p>
<div><b><span style="color: #0099CC">::</span> <a href="javascript:window.close()">close this window</a></b></div>
<?php // if you delete this the sky will fall on your head
}
?>
</div>
<!-- // this is just the end of the motor - don't touch that line either :) -->
<?php } ?>
</div>
<p class="centerP">
[powered by <a href="http://cafelog.com" target="_blank"><b>b2</b></a>.]
</p>
</body>
</html>

352
b2config.php Normal file
View File

@ -0,0 +1,352 @@
<?php
/* *
* b2's config file *
* */
# Reminder: everything that starts with #, /* or // is a comment
/* Start editing */
# $siteurl is your blog's URL: for example, 'http://mydomain.com' (no trailing slash !)
# $blogfilename is the name of the default file for your blog
# $blogname is the name of your blog
$siteurl = 'http://example.com';
$blogfilename = 'index.php';
$blogname = "my weblog";
$blogdescription = "babblings !";
# fill these only if you have a Cafelog ID,
# this enables your blog to be in the Recently Updated b2 blogs list.
# to obtain this ID, e-mail update@tidakada.com with these details:
# name of the weblog, weblog's URL, your e-mail address, and a password
# in the future, the password will allow you to change these details online
$cafelogID = '';
$use_cafelogping = 0; # set this to 1 if you do have a Cafelog ID
# $pathserver is where you have uploaded b2: for example, 'http://mydomain.com' (no ending slash !)
# by default b2 is set to run in the folder your blog resides, same as $siteurl
$pathserver = 'http://example.com';
# your email (obvious uh ?)
$admin_email = 'you@example.com';
# set this to 0 or 1, whether you want new users to be able to post entries once they registered
$new_users_can_blog = 1;
# set this to 0 or 1, whether you want to allow users to register on your blog.
$users_can_register = 1;
# day at the start of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, etc
$start_of_week = 1;
// ** MySQL settings **
# fill with your database details
$dbname = 'b2'; // the name of the database
$dbhost = 'localhost'; // 99% chances you won't need to change this value
$dbusername = 'user'; // your MySQL username
$dbpassword = 'pass'; // ...and password
# database tables' names (change them if you want to have multiple b2's in a single database)
$tableposts = 'b2posts';
$tableusers = 'b2users';
$tablesettings = 'b2settings';
$tablecategories = 'b2categories';
$tablecomments = 'b2comments';
// ** Post preview function **
# set this to 1 if you want to use the 'preview' function
$use_preview = 1;
// ** Spell Checker functions **
# set this to 0 to disable the spell checker, or 1 to enable it
$use_spellchecker = 1;
// ** Text formatting options **
# these options can help you format your text without using too much html
$use_bbcode = 0; // use BBCode, like [b]bold[/b]
$use_gmcode = 0; // use GreyMatter-styles: **bold** \italic\ __underline__
$use_quicktags = 1; // buttons for HTML tags (they won't work on IE Mac yet)
# IMPORTANT! set this to 0 if you are using Chinese, Japanese, Korean,
# or other double-bytes languages
$use_htmltrans = 1;
# this could help balance your HTML code. if it gives bad results, set it to 0
$use_balanceTags = 1;
# this would convert quotes into smart/curly quotes, set it to 1 to enable it
$use_smartquotes = 0;
// ** Image upload **
# set this to 0 to disable file upload, or 1 to enable it
$use_fileupload = 0;
# enter the real path of the directory where you'll upload the pictures
# if you're unsure about what your real path is, please ask your host's support staff
# note that the directory must be writable by the webserver (ChMod 766)
# note for windows-servers users: use forwardslashes instead of backslashes
#$fileupload_realpath = '/home/your/site/b2/images';
$fileupload_realpath = '/home/example/public_html/images';
# enter the URL of that directory (it's used to generate the links to the pictures)
$fileupload_url = 'http://example.com/images';
# accepted file types, you can add to that list if you want
# note: add a space before and after each file type
# example: $fileupload_allowedtypes = ' jpg gif png ';
$fileupload_allowedtypes = ' jpg gif png ';
# by default, most servers limit the size of uploads to 2048 KB
# if you want to set it to a lower value, here it is (you cannot set a higher value)
$fileupload_maxk = '96';
# you may not want all users to upload pictures/files, so you can set a minimum level for this
$fileupload_minlevel = '1';
# ...or you may authorize only some users. enter their logins here, separated by spaces
# if you leave that variable blank, all users who have the minimum level are authorized to upload
# note: add a space before and after each login name
# example: $fileupload_allowedusers = ' barbara anne ';
$fileupload_allowedusers = '';
// ** RSS syndication options **
# these options are used by b2rdf.php (1.0), b2rss.php (0.92), and b2rss2.php (2.0)
# note: if you don't want to syndicate your news, you can delete these files
# number of last posts to syndicate
$posts_per_rss = 10;
# the language of your blog ( see this: http://backend.userland.com/stories/storyReader$16 )
$rss_language = 'en';
# for b2rss.php: allow encoded HTML in <description> tag? 1=yes, 0=no
$rss_encoded_html = 0;
# length (in words) of excerpts in the RSS feed? 0=unlimited
# note: in b2rss.php, this will be set to 0 if you use encoded HTML
$rss_excerpt_length = 50;
// ** Weblogs.com ping **
# set this to 1 if you want your site to be listed on http://weblogs.com when you add a new post
$use_weblogsping = 0;
// ** Blo.gs ping **
# set this to 1 if you want your site to be listed on http://blo.gs when you add a new post
$use_blodotgsping = 0;
# if you ping blo.gs, this is the URL that will be sent to it (enter your blog's URL):
$blodotgsping_url = 'http://example.com';
// ** Trackback / PingBack **
# set this to 0 or 1, whether you want to allow your posts to be trackback'able or not
# note: setting it to zero would also disable sending trackbacks
$use_trackback = 0;
# set this to 0 or 1, whether you want to allow your posts to be pingback'able or not
# note: setting it to zero would also disable sending pingbacks
$use_pingback = 0;
// ** Comments options **
# set this to 1 to require e-mail and name, or 0 to allow comments without e-mail/name
$require_name_email = 0;
# here is a list of the tags that are allowed in the comments.
# you can add tags to the list, just add them in the string,
# add only the opening tag: for example, only '<a>' instead of '<a href=""></a>'
$comment_allowed_tags = '<b><i><u><strong><em><code><blockquote><p><br><strike><a>';
# set this to 1 to let every author be notified about comments on their posts
$comments_notify = 0;
// ** Smilies options **
# set this to 1 to enable smiley conversion in posts
# (note: this makes smiley conversion in ALL posts)
$use_smilies = 0;
# the directory where your smilies are (no trailing slash)
$smilies_directory = 'http://example.com/b2-img/smilies';
# here's the conversion table, you can modify it if you know what you're doing
$b2smiliestrans = array(
':)' => 'icon_smile.gif',
':D' => 'icon_biggrin.gif',
':-D' => 'icon_biggrin.gif',
':grin:' => 'icon_biggrin.gif',
':)' => 'icon_smile.gif',
':-)' => 'icon_smile.gif',
':smile:' => 'icon_smile.gif',
':(' => 'icon_sad.gif',
':-(' => 'icon_sad.gif',
':sad:' => 'icon_sad.gif',
':o' => 'icon_surprised.gif',
':-o' => 'icon_surprised.gif',
':eek:' => 'icon_surprised.gif',
'8O' => 'icon_eek.gif',
'8-O' => 'icon_eek.gif',
':shock:' => 'icon_eek.gif',
':?' => 'icon_confused.gif',
':-?' => 'icon_confused.gif',
':???:' => 'icon_confused.gif',
'8)' => 'icon_cool.gif',
'8-)' => 'icon_cool.gif',
':cool:' => 'icon_cool.gif',
':lol:' => 'icon_lol.gif',
':x' => 'icon_mad.gif',
':-x' => 'icon_mad.gif',
':mad:' => 'icon_mad.gif',
':P' => 'icon_razz.gif',
':-P' => 'icon_razz.gif',
':razz:' => 'icon_razz.gif',
':oops:' => 'icon_redface.gif',
':cry:' => 'icon_cry.gif',
':evil:' => 'icon_evil.gif',
':twisted:' => 'icon_twisted.gif',
':roll:' => 'icon_rolleyes.gif',
':wink:' => 'icon_wink.gif',
';)' => 'icon_wink.gif',
';-)' => 'icon_wink.gif',
':!:' => 'icon_exclaim.gif',
':?:' => 'icon_question.gif',
':idea:' => 'icon_idea.gif',
':arrow:' => 'icon_arrow.gif',
':|' => 'icon_neutral.gif',
':-|' => 'icon_neutral.gif',
':neutral:' => 'icon_neutral.gif',
':mrgreen:' => 'icon_mrgreen.gif',
);
# the weekdays and the months.. translate them if necessary
$weekday[0]='Sunday';
$weekday[1]='Monday';
$weekday[2]='Tuesday';
$weekday[3]='Wednesday';
$weekday[4]='Thursday';
$weekday[5]='Friday';
$weekday[6]='Saturday';
# the months, translate them if necessary - note: this isn't active everywhere yet
$month['01']='January';
$month['02']='February';
$month['03']='March';
$month['04']='April';
$month['05']='May';
$month['06']='June';
$month['07']='July';
$month['08']='August';
$month['09']='September';
$month['10']='October';
$month['11']='November';
$month['12']='December';
# $b2inc is where the included b2 files are: that's generally the directory b2-include,
# so you shouldn't have to change that setting
$b2inc = './b2-include';
// ** Querystring Configuration ** (don't change if you don't know what you're doing)
$querystring_start = '?';
$querystring_equal = '=';
$querystring_separator = '&amp;';
// ** Configuration for b2mail.php ** (skip this if you don't intend to blog via email)
# mailserver settings
$mailserver_url = 'mail.example.com';
$mailserver_login = 'login@example.com';
$mailserver_pass = 'password';
$mailserver_port = 110;
# by default posts will have this category
$default_category = 1;
# subject prefix
$subjectprefix = 'blog:';
# body terminator string (starting from this string, everything will be ignored, including this string)
$bodyterminator = "___";
# set this to 1 to run in test mode
$thisisforfunonly = 0;
### Special Configuration for some phone email services
# some mobile phone email services will send identical subject & content on the same line
# if you use such a service, set $use_phoneemail to 1, and indicate a separator string
# when you compose your message, you'll type your subject then the separator string
# then you type your login:password, then the separator, then content
$use_phoneemail = 0;
$phoneemail_separator = ':::';
/* Stop editing */
$HTTP_HOST=getenv('HTTP_HOST'); /* domain name */
$REMOTE_ADDR=getenv('REMOTE_ADDR'); /* visitor's IP */
$HTTP_USER_AGENT=getenv('HTTP_USER_AGENT'); /* visitor's browser */
$server = $dbhost;
$loginsql = $dbusername;
$passsql = $dbpassword;
$path = $pathserver;
$base = $dbname;
?>

342
b2edit.php Normal file
View File

@ -0,0 +1,342 @@
<?php
$title = "Post / Edit";
/* <Edit> */
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$b2varstoreset = array('action','safe_mode','withcomments','c','posts','poststart','postend','content','edited_post_title','comment_error','profile', 'trackback_url');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch($action) {
case 'post':
$standalone = 1;
require_once('./b2header.php');
$post_autobr = intval($HTTP_POST_VARS["post_autobr"]);
$post_pingback = intval($HTTP_POST_VARS["post_pingback"]);
$content = balanceTags($HTTP_POST_VARS["content"]);
$content = format_to_post($content);
$post_title = addslashes($HTTP_POST_VARS["post_title"]);
$post_category = intval($HTTP_POST_VARS["post_category"]);
if ($user_level == 0)
die ("Cheatin' uh ?");
if (($user_level > 4) && (!empty($HTTP_POST_VARS["edit_date"]))) {
$aa = $HTTP_POST_VARS["aa"];
$mm = $HTTP_POST_VARS["mm"];
$jj = $HTTP_POST_VARS["jj"];
$hh = $HTTP_POST_VARS["hh"];
$mn = $HTTP_POST_VARS["mn"];
$ss = $HTTP_POST_VARS["ss"];
$jj = ($jj > 31) ? 31 : $jj;
$hh = ($hh > 23) ? $hh - 24 : $hh;
$mn = ($mn > 59) ? $mn - 60 : $mn;
$ss = ($ss > 59) ? $ss - 60 : $ss;
$now = "$aa-$mm-$jj $hh:$mn:$ss";
} else {
$now = date("Y-m-d H:i:s",(time() + ($time_difference * 3600)));
}
$query = "INSERT INTO $tableposts (ID, post_author, post_date, post_content, post_title, post_category) VALUES ('0','$user_ID','$now','$content','".$post_title."','".$post_category."')";
$result = mysql_query($query) or mysql_oops($query);
$post_ID = mysql_insert_id();
if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
sleep($sleep_after_edit);
}
rss_update($blog_ID);
pingWeblogs($blog_ID);
pingCafelog($cafelogID, $post_title, $post_ID);
pingBlogs($blog_ID);
if ($post_pingback) {
pingback($content, $post_ID);
}
if (!empty($HTTP_POST_VARS['trackback_url'])) {
$excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252).'...' : strip_tags($content);
$excerpt = stripslashes($excerpt);
$trackback_urls = explode(',', $HTTP_POST_VARS['trackback_url']);
foreach($trackback_urls as $tb_url) {
$tb_url = trim($tb_url);
trackback($tb_url, stripslashes($post_title), $excerpt, $post_ID);
}
}
if (!empty($HTTP_POST_VARS["mode"])) {
switch($HTTP_POST_VARS["mode"]) {
case "bookmarklet":
$location="b2bookmarklet.php?a=b";
break;
case "sidebar":
$location="b2sidebar.php?a=b";
break;
default:
$location="b2edit.php";
break;
}
} else {
$location="b2edit.php";
}
header("Location: $location");
exit();
break;
case "edit":
$standalone=0;
require_once ("./b2header.php");
$post = $HTTP_GET_VARS["post"];
if ($user_level > 0) {
$postdata=get_postdata($post) or die("Oops, no post with this ID. <a href=\"b2edit.php\">Go back</a> !");
$authordata = get_userdata($postdata["Author_ID"]);
if ($user_level < $authordata[13])
die ("You don't have the right to edit <b>".$authordata[1]."</b>'s posts.");
$content = $postdata["Content"];
$content = format_to_edit($content);
$edited_post_title = format_to_edit($postdata["Title"]);
echo $blankline;
include($b2inc."/b2edit.form.php");
} else {
?>
Since you're a newcomer, you'll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />You can also <a href="mailto:<?php echo $admin_email ?>?subject=b2-promotion">e-mail the admin</a> to ask for a promotion.<br />When you're promoted, just reload this page and you'll be able to blog. :)
<?php
}
break;
case "editpost":
$standalone = 1;
require_once("./b2header.php");
if ($user_level == 0)
die ("Cheatin' uh ?");
if (!isset($blog_ID)) {
$blog_ID = 1;
}
$post_ID = $HTTP_POST_VARS["post_ID"];
$post_category = intval($HTTP_POST_VARS["post_category"]);
$post_autobr = intval($HTTP_POST_VARS["post_autobr"]);
$content = balanceTags($HTTP_POST_VARS["content"]);
$content = format_to_post($content);
$post_title = addslashes($HTTP_POST_VARS["post_title"]);
if (($user_level > 4) && (!empty($HTTP_POST_VARS["edit_date"]))) {
$aa = $HTTP_POST_VARS["aa"];
$mm = $HTTP_POST_VARS["mm"];
$jj = $HTTP_POST_VARS["jj"];
$hh = $HTTP_POST_VARS["hh"];
$mn = $HTTP_POST_VARS["mn"];
$ss = $HTTP_POST_VARS["ss"];
$jj = ($jj > 31) ? 31 : $jj;
$hh = ($hh > 23) ? $hh - 24 : $hh;
$mn = ($mn > 59) ? $mn - 60 : $mn;
$ss = ($ss > 59) ? $ss - 60 : $ss;
$datemodif = ", post_date=\"$aa-$mm-$jj $hh:$mn:$ss\"";
} else {
$datemodif = "";
}
$query = "UPDATE $tableposts SET post_content=\"$content\", post_title=\"$post_title\", post_category=\"$post_category\"".$datemodif." WHERE ID=$post_ID";
$result = mysql_query($query) or mysql_oops($query);
if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
sleep($sleep_after_edit);
}
rss_update($blog_ID);
// pingWeblogs($blog_ID);
$location = "Location: b2edit.php";
header ($location);
break;
case "delete":
$standalone = 1;
require_once("./b2header.php");
if ($user_level == 0)
die ("Cheatin' uh ?");
$post = $HTTP_GET_VARS['post'];
$postdata=get_postdata($post) or die("Oops, no post with this ID. <a href=\"b2edit.php\">Go back</a> !");
$authordata = get_userdata($postdata["Author_ID"]);
if ($user_level < $authordata[13])
die ("You don't have the right to delete <b>".$authordata[1]."</b>'s posts.");
$query = "DELETE FROM $tableposts WHERE ID=$post";
$result = mysql_query($query) or die("Oops, no post with this ID. <a href=\"b2edit.php\">Go back</a> !");
if (!$result)
die("Error in deleting... contact the <a href=\"mailto:$admin_email\">webmaster</a>...");
$query = "DELETE FROM $tablecomments WHERE comment_post_ID=$post";
$result = mysql_query($query) or die("Oops, no comment associated to that post. <a href=\"b2edit.php\">Go back</a> !");
if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
sleep($sleep_after_edit);
}
rss_update($blog_ID);
// pingWeblogs($blog_ID);
header ("Location: b2edit.php");
break;
case "editcomment":
$standalone=0;
require_once ("./b2header.php");
get_currentuserinfo();
if ($user_level == 0) {
die ("Cheatin' uh ?");
}
$comment = $HTTP_GET_VARS['comment'];
$commentdata = get_commentdata($comment,1) or die("Oops, no comment with this ID. <a href=\"javascript:history.go(-1)\">Go back</a> !");
$content = $commentdata["comment_content"];
$content = format_to_edit($content);
echo $blankline;
include($b2inc."/b2edit.form.php");
break;
case "deletecomment":
$standalone = 1;
require_once("./b2header.php");
if ($user_level == 0)
die ("Cheatin' uh ?");
$comment = $HTTP_GET_VARS['comment'];
$p = $HTTP_GET_VARS['p'];
$commentdata=get_commentdata($comment) or die("Oops, no comment with this ID. <a href=\"b2edit.php\">Go back</a> !");
$query = "DELETE FROM $tablecomments WHERE comment_ID=$comment";
$result = mysql_query($query) or die("Oops, no comment with this ID. <a href=\"b2edit.php\">Go back</a> !");
header ("Location: b2edit.php?p=$p&c=1#comments"); //?a=dc");
break;
case "editedcomment":
$standalone = 1;
require_once("./b2header.php");
if ($user_level == 0)
die ("Cheatin' uh ?");
$comment_ID = $HTTP_POST_VARS['comment_ID'];
$comment_post_ID = $HTTP_POST_VARS['comment_post_ID'];
$newcomment_author = $HTTP_POST_VARS['newcomment_author'];
$newcomment_author_email = $HTTP_POST_VARS['newcomment_author_email'];
$newcomment_author_url = $HTTP_POST_VARS['newcomment_author_url'];
$newcomment_author = addslashes($newcomment_author);
$newcomment_author_email = addslashes($newcomment_author_email);
$newcomment_author_url = addslashes($newcomment_author_url);
$post_autobr = $HTTP_POST_VARS["post_autobr"];
if (($user_level > 4) && (!empty($HTTP_POST_VARS["edit_date"]))) {
$aa = $HTTP_POST_VARS["aa"];
$mm = $HTTP_POST_VARS["mm"];
$jj = $HTTP_POST_VARS["jj"];
$hh = $HTTP_POST_VARS["hh"];
$mn = $HTTP_POST_VARS["mn"];
$ss = $HTTP_POST_VARS["ss"];
$jj = ($jj > 31) ? 31 : $jj;
$hh = ($hh > 23) ? $hh - 24 : $hh;
$mn = ($mn > 59) ? $mn - 60 : $mn;
$ss = ($ss > 59) ? $ss - 60 : $ss;
$datemodif = ", comment_date=\"$aa-$mm-$jj $hh:$mn:$ss\"";
} else {
$datemodif = "";
}
$content = balanceTags($content);
$content = format_to_post($content);
$query = "UPDATE $tablecomments SET comment_content=\"$content\", comment_author=\"$newcomment_author\", comment_author_email=\"$newcomment_author_email\", comment_author_url=\"$newcomment_author_url\"".$datemodif." WHERE comment_ID=$comment_ID";
$result = mysql_query($query) or mysql_oops($query);
header ("Location: b2edit.php?p=$comment_post_ID&c=1#comments"); //?a=ec");
break;
default:
$standalone=0;
require_once ("./b2header.php");
if ($user_level > 0) {
if ((!$withcomments) && (!$c)) {
$action="post";
include($b2inc."/b2edit.form.php");
echo "<br /><br />";
}
} else {
echo $tabletop; ?>
Since you're a newcomer, you'll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />You can also <a href="mailto:<?php echo $admin_email ?>?subject=b2-promotion">e-mail the admin</a> to ask for a promotion.<br />When you're promoted, just reload this page and you'll be able to blog. :)
<?php
echo $tablebottom;
echo "<br /><br />";
}
include($b2inc."/b2edit.showposts.php");
}
/* </Edit> */
include($b2inc."/b2footer.php") ?>

177
b2header.php Normal file
View File

@ -0,0 +1,177 @@
<?php
require_once("b2config.php");
require_once($b2inc."/b2template.functions.php");
require_once($b2inc."/b2verifauth.php");
require_once($b2inc."/b2vars.php");
require_once($b2inc."/b2functions.php");
require_once($b2inc."/xmlrpc.inc");
require_once($b2inc."/xmlrpcs.inc");
if (!isset($use_cache)) $use_cache=1;
if (!isset($blogID)) $blog_ID=1;
if (!isset($debug)) $debug=0;
timer_start();
get_currentuserinfo();
$request = " SELECT * FROM $tablesettings ";
$result = mysql_query($request);
$querycount++;
while($row = mysql_fetch_object($result)) {
$posts_per_page=$row->posts_per_page;
$what_to_show=$row->what_to_show;
$archive_mode=$row->archive_mode;
$time_difference=$row->time_difference;
$autobr=$row->AutoBR;
$date_format=stripslashes($row->date_format);
$time_format=stripslashes($row->time_format);
}
// let's deactivate quicktags on IE Mac and Lynx, because they don't work there.
if (($is_macIE) || ($is_lynx))
$use_quicktags=0;
$b2varstoreset = array('profile','standalone','redirect','redirect_url','a','popuptitle','popupurl','text', 'trackback', 'pingback');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
if ($standalone == 0) {
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>b2 > <?php echo $title; ?></title>
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<style type="text/css">
<!--
<?php
if (!$is_NS4) {
?>
td.menutop {
padding-top: 2px;
padding-bottom: 2px;
border-color: #999999;
border-top-width: 1px;
border-bottom-width: 1px;
border-left-width: 0px;
border-right-width: 0px;
border-style: dashed;
}
textarea,input,select {
background-color: #f0f0f0;
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
.checkbox {
<?php
if ((preg_match("/MSIE/",$HTTP_USER_AGENT)) && (!preg_match("/Mac/",$HTTP_USER_AGENT))) {
?> background-color: #ffffff;
border-width: 0px;
padding: 0px;
margin: 0px;
}
<?php
}
}
?>
-->
</style>
<?php
if ($use_spellchecker) {
?><script type="text/javascript" language="javascript">
<!--
function DoSpell(formname, subject, body)
{
document.SPELLDATA.formname.value=formname
document.SPELLDATA.subjectname.value=subject
document.SPELLDATA.messagebodyname.value=body
document.SPELLDATA.companyID.value="custom\\http://cafelog.com"
document.SPELLDATA.language.value=1033
document.SPELLDATA.opener.value="<?php echo $pathserver ?>/sproxy.pl"
document.SPELLDATA.formaction.value="http://www.spellchecker.com/spell/startspelling.asp "
window.open("<?php echo $pathserver ?>/b2spell.php","Spell",
"toolbar=no,directories=no,location=yes,resizable=yes,width=620,height=400,top=100,left=100")
}
//-->
</script><?php
}
if ($redirect==1) {
?>
<script language="javascript">
<!--
function redirect() {
window.location = "<?php echo $redirect_url; ?>";
}
setTimeout("redirect();", 600);
//-->
</script>
<?php
}
?>
<script language="javascript">
<!-- hiding from old terrible browsers
function profile(userID) {
window.open ("b2profile.php?action=viewprofile&user="+userID, "Profile", "width=500, height=450, location=0, menubar=0, resizable=0, scrollbars=1, status=1, titlebar=0, toolbar=0, screenX=60, left=60, screenY=60, top=60");
}
function preview(form) {
var preview_date = "<?php echo date("Y-m-d H:i:s"); ?>";
var preview_userid = "<?php echo $user_ID ?>";
var preview_title = form.post_title.value;
var preview_category = form.post_category.value;
var preview_content = form.content.value;
var preview_autobr = form.post_autobr.value;
preview_date = escape(preview_date);
preview_userid = escape(preview_userid);
preview_title = escape(preview_title);
preview_category = escape(preview_category);
preview_content = escape(preview_content);
preview_autobr = escape(preview_autobr);
window.open ("<?php echo "$siteurl/$blogfilename" ?>?preview=1&preview_date="+preview_date +"&preview_userid="+preview_userid +"&preview_title="+preview_title +"&preview_category="+preview_category +"&preview_content="+preview_content +"&preview_autobr="+preview_autobr ,"Preview", "location=0,menubar=1,resizable=1,scrollbars=yes,status=1,toolbar=0");
}
function launchupload() {
window.open ("b2upload.php", "b2upload", "width=380,height=360,location=0,menubar=0,resizable=1,scrollbars=yes,status=1,toolbar=0");
}
// End -->
</script>
</head>
<body bgcolor="#ffffff" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellpadding="0" cellspacing="0" align="center">
<?php
if ($profile==0) {
?>
<tr height="60">
<td valign="top">
<?php include($b2inc."/b2menutop.php") ?>
</td>
</tr><tr>
<?php
}
?>
<td valign="top">
<img src="b2-img/blank.gif" border="0" width="35" height="24" />
<div class="panelbody">
<?php
}
?>

102
b2install.php Normal file
View File

@ -0,0 +1,102 @@
<html>
<head>
<title>b2 > Installation</title>
</head>
<body>
<?php
include ("b2config.php");
function mysql_doh($msg,$sql,$error) {
echo "<p>$msg</p>";
echo "<p>query:<br />$sql</p>";
echo "<p>error:<br />$error</p>";
die();
}
$connexion = mysql_connect($server,$loginsql,$passsql) or die("Can't connect to the database<br>".mysql_error());
$dbconnexion = mysql_select_db($base, $connexion);
if (!$dbconnexion) {
echo mysql_error();
die();
}
echo "Now creating the necessary tables in the database...<br /><br />";
# Note: if you want to start again with a clean b2 database,
# just remove the // in this file
// $query = "DROP TABLE IF EXISTS $tableposts";
// $q = mysql_query($query) or die ("doh, can't drop the table \"$tableposts\" in the database.");
$query = "CREATE TABLE $tableposts ( ID int(10) unsigned NOT NULL auto_increment, post_author int(4) DEFAULT '0' NOT NULL, post_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, post_content text NOT NULL, post_title text NOT NULL, post_category int(4) DEFAULT '0' NOT NULL, post_karma int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (ID), UNIQUE ID (ID) )";
$q = mysql_query($query) or mysql_doh("doh, can't create the table \"$tableposts\" in the database.", $query, mysql_error());
$now = date('Y-m-d H:i:s');
$query = "INSERT INTO $tableposts (post_author, post_date, post_content, post_title, post_category) VALUES ('1', '$now', 'This is the first post. Edit or delete it, then start blogging !', 'Hello world !', '1')";
$q = mysql_query($query) or mysql_doh("doh, can't insert a first post in the table \"$tableposts\" in the database.", $query, mysql_error());
echo "posts: OK<br />";
// $query = "DROP TABLE IF EXISTS $tablecategories";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tablecategories\" in the database.");
$query="CREATE TABLE $tablecategories (cat_ID int(4) NOT NULL auto_increment, cat_name TINYTEXT not null , KEY (cat_ID))";
$q = mysql_query($query) or mysql_doh("doh, can't create the table \"$tablecategories\" in the database.", $query, mysql_error());
$query = "INSERT INTO $tablecategories (cat_ID, cat_name) VALUES ('0', 'General')";
$q = mysql_query($query) or mysql_doh("doh, can't set the default category in the table \"$tablecategories\" in the database.", $query, mysql_error());
$query = "UPDATE $tableposts SET post_category=\"1\"";
$result = mysql_query($query) or mysql_doh("Oops, can't set the default category on $tableposts.", $query, mysql_error());
echo "b2categories: OK<br />";
// $query = "DROP TABLE IF EXISTS $tablecomments";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tablecomments\" in the database.");
$query = "CREATE TABLE $tablecomments ( comment_ID int(11) unsigned NOT NULL auto_increment, comment_post_ID int(11) DEFAULT '0' NOT NULL, comment_author tinytext NOT NULL, comment_author_email varchar(100) NOT NULL, comment_author_url varchar(100) NOT NULL, comment_author_IP varchar(100) NOT NULL, comment_date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, comment_content text NOT NULL, comment_karma int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (comment_ID) )";
$q = mysql_query($query) or mysql_doh("doh, can't create the table \"$tablecomments\" in the database.", $query, mysql_error());
$now = date('Y-m-d H:i:s');
$query = "INSERT INTO $tablecomments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_content) VALUES ('1', 'miss b2', 'missb2@example.com', 'http://example.com', '127.0.0.1', '$now', 'Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.')";
$q = mysql_query($query) or mysql_doh("doh, can't insert a first comment in the table \"$tablecomments\" in the database.", $query, mysql_error());
echo "comments: OK<br />";
// $query = "DROP TABLE IF EXISTS $tablesettings";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tablesettings\" in the database.");
$query = "CREATE TABLE $tablesettings ( ID tinyint(3) DEFAULT '1' NOT NULL, posts_per_page int(4) unsigned DEFAULT '7' NOT NULL, what_to_show varchar(5) DEFAULT 'days' NOT NULL, archive_mode varchar(10) DEFAULT 'weekly' NOT NULL, time_difference tinyint(4) DEFAULT '0' NOT NULL, AutoBR tinyint(1) DEFAULT '1' NOT NULL, time_format varchar(20) DEFAULT 'H:i:s' NOT NULL, date_format varchar(20) DEFAULT 'Y/m/d' NOT NULL, PRIMARY KEY (ID), KEY ID (ID) )";
$q = mysql_query($query) or mysql_doh("doh, can't create the table \"$tablesettings\" in the database.", $query, mysql_error());
$query = "INSERT INTO $tablesettings ( ID, posts_per_page, what_to_show, archive_mode, time_difference, AutoBR, time_format, date_format) VALUES ( '1', '20', 'posts', 'monthly', '0', '1', 'H:i:s', 'd.m.y')";
$q = mysql_query($query) or mysql_doh("doh, can't set the default settings in the table \"$tablesettings\" in the database.", $query, mysql_error());
echo "settings: OK<br />";
// $query = "DROP TABLE IF EXISTS $tableusers";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tableusers\" in the database.");
$query = "CREATE TABLE $tableusers ( ID int(10) unsigned NOT NULL auto_increment, user_login varchar(20) NOT NULL, user_pass varchar(20) NOT NULL, user_firstname varchar(50) NOT NULL, user_lastname varchar(50) NOT NULL, user_nickname varchar(50) NOT NULL, user_icq int(10) unsigned DEFAULT '0' NOT NULL, user_email varchar(100) NOT NULL, user_url varchar(100) NOT NULL, user_ip varchar(15) NOT NULL, user_domain varchar(200) NOT NULL, user_browser varchar(200) NOT NULL, dateYMDhour datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, user_level int(2) unsigned DEFAULT '0' NOT NULL, user_aim varchar(50) NOT NULL, user_msn varchar(100) NOT NULL, user_yim varchar(50) NOT NULL, user_idmode varchar(20) NOT NULL, PRIMARY KEY (ID), UNIQUE ID (ID), UNIQUE (user_login) )";
$q = mysql_query($query) or mysql_doh("doh, can't create the table \"$tableusers\" in the database.", $query, mysql_error());
$random_password = substr(md5(uniqid(microtime())),0,6);
$query = "INSERT INTO $tableusers (ID, user_login, user_pass, user_firstname, user_lastname, user_nickname, user_icq, user_email, user_url, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_aim, user_msn, user_yim, user_idmode) VALUES ( '1', 'admin', '$random_password', '', '', 'admin', '0', '$admin_email', '', '127.0.0.1', '127.0.0.1', '', '00-00-0000 00:00:01', '10', '', '', '', 'nickname')";
$q = mysql_query($query) or mysql_doh("doh, can't set the default user in the table \"$tableusers\" in the database.", $query, mysql_error());
echo "users: OK<br />";
?>
<br />
Installation successful !<br />
<br/ >
Now you can <a href="b2login.php">log in</a> with the login "admin" and password "<?php echo $random_password; ?>".<br /><br />
<br />
Note that password carefully ! It is a <em>random</em> password that is given to you when you install b2. If you lose it, you will have to delete the tables from the database yourself, and re-install b2.
</body>
</html>

382
b2login.php Normal file
View File

@ -0,0 +1,382 @@
<?php
require('./b2config.php');
require_once($b2inc.'/b2template.functions.php');
require_once($b2inc.'/b2functions.php');
require_once($b2inc.'/b2vars.php');
if (!function_exists('add_magic_quotes')) {
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$b2varstoreset = array('action','mode','error','text','popupurl','popuptitle');
for ($i = 0; $i < count($b2varstoreset); $i = $i + 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
/* connecting the db */
$connexion = @mysql_connect($server,$loginsql,$passsql) or die("Can't connect to the database<br>".mysql_error());
mysql_select_db("$base");
switch($action) {
case "logout":
setcookie("cafeloguser");
setcookie("cafelogpass");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate"); // for HTTP/1.1
header("Pragma: no-cache");
if ($is_IIS) {
header("Refresh: 0;url=b2login.php");
} else {
header("Location: b2login.php");
}
exit();
break;
case "login":
if(!empty($HTTP_POST_VARS)) {
$log = $HTTP_POST_VARS["log"];
$pwd = $HTTP_POST_VARS["pwd"];
$redirect_to = $HTTP_POST_VARS["redirect_to"];
}
function login() {
global $server,$loginsql,$passsql,$base,$log,$pwd,$error,$user_ID;
global $tableusers, $pass_is_md5;
$user_login=$log;
$password=$pwd;
if (!$user_login) {
$error="<b>ERROR</b>: the login field is empty";
return false;
}
if (!$password) {
$error="<b>ERROR</b>: the password field is empty";
return false;
}
if (substr($password,0,4)=="md5:") {
$pass_is_md5 = 1;
$password = substr($password,4,strlen($password));
$query = " SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND MD5(user_pass) = '$password' ";
} else {
$pass_is_md5 = 0;
$query = " SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND user_pass = '$password' ";
}
$result = mysql_query($query) or die("Incorrect Login/Password request: ".mysql_error());
$lines = mysql_num_rows($result);
if ($lines<1) {
$error="<b>ERROR</b>: wrong login or password";
$pwd="";
return false;
} else {
$res=mysql_fetch_row($result);
$user_ID=$res[0];
if (($pass_is_md5==0 && $res[1]==$user_login && $res[2]==$password) || ($pass_is_md5==1 && $res[1]==$user_login && md5($res[2])==$password)) {
return true;
} else {
$error="<b>ERROR</b>: wrong login or password";
$pwd="";
return false;
}
}
}
if (!login()) {
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
if ($is_IIS) {
header("Refresh: 0;url=b2login.php");
} else {
header("Location: b2login.php");
}
exit();
} else {
$user_login=$log;
$user_pass=$pwd;
setcookie("cafeloguser",$user_login,time()+31536000);
if ($pass_is_md5) {
setcookie("cafelogpass",$user_pass,time()+31536000);
} else {
setcookie("cafelogpass",md5($user_pass),time()+31536000);
}
if (empty($HTTP_COOKIE_VARS["cafelogblogid"])) {
setcookie("cafelogblogid","1",time()+31536000);
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
switch($mode) {
case "bookmarklet":
$location="b2bookmarklet.php?text=$text&popupurl=$popupurl&popuptitle=$popuptitle";
break;
case "sidebar":
$location="sidebar.php?text=$text&popupurl=$popupurl&popuptitle=$popuptitle";
break;
case "profile":
$location="profile.php?text=$text&popupurl=$popupurl&popuptitle=$popuptitle";
break;
default:
$location="$redirect_to";
break;
}
if ($is_IIS) {
header("Refresh: 0;url=$location");
} else {
header("Location: $location");
}
}
break;
case "lostpassword":
?><html>
<head>
<title>b2 > Lost password ?</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<style type="text/css">
<!--
<?php
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
?>
textarea,input,select {
background-color: #f0f0f0;
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php
}
?>
-->
</style>
</head>
<body bgcolor="#ffffff" text="#000000" link="#cccccc" vlink="#cccccc" alink="#ff0000">
<table width="100%" height="100%">
<td align="center" valign="middle">
<table width="200" height="200" style="border: 1px solid #cccccc;" cellpadding="0" cellspacing="0">
<tr height="50">
<td height="50" width="50">
<a href="http://cafelog.com" target="_blank"><img src="b2-img/b2minilogo.png" border="0" alt="visit b2's homepage" /></a>
</td>
<td align="right" valign="top">&nbsp;</td>
</tr>
<tr height="150"><td align="right" valign="bottom" height="150" colspan="2">
<p align="center" style="color: #b0b0b0">Type your login here and click OK. You will receive an email with your password.</p>
<?php
if ($error) echo "<div align=\"right\" style=\"padding:4px;\"><font color=\"#FF0000\">$error</font><br />&nbsp;</div>";
?>
<form name="" action="b2login.php" method="post">
<input type="hidden" name="action" value="retrievepassword" />
<table width="100" style="background-color: #ffffff">
<tr><td align="right">login</td>
<td><input type="text" name="user_login" value="" size="8" />&nbsp;&nbsp;&nbsp;</td></tr>
<tr><td>&nbsp;</td>
<td><input type="submit" name="Submit2" value="OK" class="search">&nbsp;&nbsp;&nbsp;</td></tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
break;
case "retrievepassword":
$user_login = $HTTP_POST_VARS["user_login"];
$user_data = get_userdatabylogin($user_login);
$user_email = $user_data["user_email"];
$user_pass = $user_data["user_pass"];
$message = "Login: $user_login\r\n";
$message .= "Password: $user_pass\r\n";
$m = mail($user_email, "your weblog's login/password", $message);
if ($m == false) {
echo "<p>The email could not be sent.<br />\n";
echo "Possible reason: your host may have disabled the mail() function...</p>";
die();
} else {
echo "<p>The email was sent successfully to $user_login's email address.<br />\n";
echo "<a href=\"b2login.php\">Click here to login !</a></p>";
die();
}
break;
default:
if((!empty($HTTP_COOKIE_VARS["cafeloguser"])) && (!empty($HTTP_COOKIE_VARS["cafelogpass"]))) {
$user_login = $HTTP_COOKIE_VARS["cafeloguser"];
$user_pass_md5 = $HTTP_COOKIE_VARS["cafelogpass"];
}
function checklogin() {
global $server,$loginsql,$passsql,$base;
global $user_login,$user_pass_md5,$user_ID;
$userdata = get_userdatabylogin($user_login);
if ($user_pass_md5 != md5($userdata["user_pass"])) {
return false;
} else {
return true;
}
}
if ( !(checklogin()) ) {
if (!empty($HTTP_COOKIE_VARS["cafeloguser"])) {
$error="Error: wrong login/password"; //, or your session has expired.";
}
} else {
header("Expires: Wed, 5 Jun 1979 23:41:00 GMT"); /* private joke: this is my birthdate - though officially it's on the 6th, since I'm GMT+1 :) */
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); /* different all the time */
header("Cache-Control: no-cache, must-revalidate"); /* to cope with HTTP/1.1 */
header("Pragma: no-cache");
header("Location: b2edit.php");
exit();
}
?><html>
<head>
<title>b2 > Login form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<style type="text/css">
<!--
<?php
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
?>
textarea,input,select {
background-color: #f0f0f0;
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php
}
?>
-->
</style>
</head>
<body bgcolor="#ffffff" text="#000000" link="#cccccc" vlink="#cccccc" alink="#ff0000">
<table width="100%" height="100%">
<td align="center" valign="middle">
<table width="200" height="200" style="border: 1px solid #cccccc;" cellpadding="0" cellspacing="0">
<tr height="50">
<td height="50" width="50">
<a href="http://cafelog.com" target="_blank"><img src="b2-img/b2minilogo.png" border="0" alt="visit b2's homepage" /></a>
</td>
<td align="right" valign="top">
<a href="b2register.php" class="b2menutop">register ?</a><br />
<a href="b2login.php?action=lostpassword" class="b2menutop">lost your password ?</a>
</td>
</tr>
<tr height="150"><td align="right" valign="bottom" height="150" colspan="2">
<?php
if ($error) echo "<div align=\"right\" style=\"padding:4px;\"><font color=\"#FF0000\">$error</font><br />&nbsp;</div>";
?>
<form name="" action="b2login.php" method="post">
<?php if ($mode=="bookmarklet") { ?>
<input type="hidden" name="mode" value="<?php echo $mode ?>" />
<input type="hidden" name="text" value="<?php echo $text ?>" />
<input type="hidden" name="popupurl" value="<?php echo $popupurl ?>" />
<input type="hidden" name="popuptitle" value="<?php echo $popuptitle ?>" />
<?php } ?>
<input type="hidden" name="redirect_to" value="b2edit.php" />
<input type="hidden" name="action" value="login" />
<table width="100" style="background-color: #ffffff">
<tr><td align="right">login</td>
<td><input type="text" name="log" value="" size="8" />&nbsp;&nbsp;&nbsp;</td></tr>
<tr><td align="right">password</td>
<td><input type="password" name="pwd" value="" size="8" />&nbsp;&nbsp;&nbsp;</td></tr>
<tr><td>&nbsp;</td>
<td><input type="submit" name="Submit2" value="OK" class="search">&nbsp;&nbsp;&nbsp;</td></tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
break;
}
?>

262
b2mail.php Normal file
View File

@ -0,0 +1,262 @@
<?php
# pop3-2-b2 mail to blog
# v0.3 20020716
require('b2config.php');
require($b2inc."/b2template.functions.php");
require($b2inc.'/b2vars.php');
require($b2inc.'/class.POP3.php');
require($b2inc.'/b2functions.php');
require($b2inc."/xmlrpc.inc");
require($b2inc."/xmlrpcs.inc");
dbconnect();
timer_start();
$use_cache = 1;
$output_debugging_info = 0; # =1 if you want to output debugging info
$autobr = get_settings('AutoBR');
$time_difference = get_settings('time_difference');
if ($use_phoneemail) {
// if you're using phone email, the email will already be in your timezone
$time_difference = 0;
}
error_reporting(2037);
$pop3 = new POP3();
if(!$pop3->connect($mailserver_url, $mailserver_port)) {
echo "Ooops $pop3->ERROR <br />\n";
exit;
}
$Count = $pop3->login($mailserver_login, $mailserver_pass);
if((!$Count) || ($Count == -1)) {
echo "<h1>Login Failed: $pop3->ERROR</h1>\n";
$pop3->quit();
exit;
}
// ONLY USE THIS IF YOUR PHP VERSION SUPPORTS IT!
//register_shutdown_function($pop3->quit());
for ($iCount=1; $iCount<=$Count; $iCount++) {
$MsgOne = $pop3->get($iCount);
if((!$MsgOne) || (gettype($MsgOne) != 'array')) {
echo "oops, $pop3->ERROR<br />\n";
$pop3->quit();
exit;
}
$content = '';
$content_type = '';
$boundary = '';
$bodysignal = 0;
$dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
while ( list ( $lineNum,$line ) = each ($MsgOne) ) {
if (strlen($line) < 3) {
$bodysignal = 1;
}
if ($bodysignal) {
$content .= $line;
} else {
if (preg_match('/Content-Type: /', $line)) {
$content_type = trim($line);
$content_type = substr($content_type, 14, strlen($content_type)-14);
$content_type = explode(';', $content_type);
$content_type = $content_type[0];
}
if (($content_type == 'multipart/alternative') && (preg_match('/boundary="/', $line)) && ($boundary == '')) {
$boundary = trim($line);
$boundary = explode('"', $boundary);
$boundary = $boundary[1];
}
if (preg_match('/Subject: /', $line)) {
$subject = trim($line);
$subject = substr($subject, 9, strlen($subject)-9);
if ($use_phoneemail) {
$subject = explode($phoneemail_separator, $subject);
$subject = trim($subject[0]);
}
if (!ereg($subjectprefix, $subject)) {
continue;
}
}
if (preg_match('/Date: /', $line)) { // of the form '20 Mar 2002 20:32:37'
$ddate = trim($line);
$ddate = str_replace('Date: ', '', $ddate);
if (strpos($ddate, ',')) {
$ddate = trim(substr($ddate, strpos($ddate, ',')+1, strlen($ddate)));
}
$date_arr = explode(' ', $ddate);
$date_time = explode(':', $date_arr[3]);
$ddate_H = $date_time[0];
$ddate_i = $date_time[1];
$ddate_s = $date_time[2];
$ddate_m = $date_arr[1];
$ddate_d = $date_arr[0];
$ddate_Y = $date_arr[2];
for ($i=0; $i<12; $i++) {
if ($ddate_m == $dmonths[$i]) {
$ddate_m = $i+1;
}
}
$ddate_U = mktime($ddate_H, $ddate_i, $ddate_s, $ddate_m, $ddate_d, $ddate_Y);
$ddate_U = $ddate_U + ($time_difference * 3600);
$post_date = date('Y-m-d H:i:s', $ddate_U);
}
}
}
$ddate_today = time() + ($time_difference * 3600);
$ddate_difference_days = ($ddate_today - $ddate_U) / 86400;
# starts buffering the output
ob_start();
if ($ddate_difference_days > 14) {
echo 'too old<br />';
continue;
}
if (preg_match('/'.$subjectprefix.'/', $subject)) {
$userpassstring = '';
echo '<div style="border: 1px dashed #999; padding: 10px; margin: 10px;">';
echo "<p><b>$iCount</b></p><p><b>Subject: </b>$subject</p>\n";
$subject = trim(str_replace($subjectprefix, '', $subject));
if ($content_type == 'multipart/alternative') {
$content = explode('--'.$boundary, $content);
$content = $content[2];
$content = explode('Content-Transfer-Encoding: quoted-printable', $content);
$content = strip_tags($content[1], '<img><p><br><i><b><u><em><strong><strike><font><span><div>');
}
$content = trim($content);
echo "<p><b>Content-type:</b> $content_type, <b>boundary:</b> $boundary</p>\n";
echo "<p><b>Raw content:</b><br /><xmp>".$content.'</xmp></p>';
$btpos = strpos($content, $bodyterminator);
if ($btpos) {
$content = substr($content, 0, $btpos);
}
$content = trim($content);
$blah = explode("\n", $content);
$firstline = $blah[0];
if ($use_phoneemail) {
$btpos = strpos($firstline, $phoneemail_separator);
if ($btpos) {
$userpassstring = trim(substr($firstline, 0, $btpos));
$content = trim(substr($content, $btpos+strlen($phoneemail_separator), strlen($content)));
$btpos = strpos($content, $phoneemail_separator);
if ($btpos) {
$userpassstring = trim(substr($content, 0, $btpos));
$content = trim(substr($content, $btpos+strlen($phoneemail_separator), strlen($content)));
}
}
$contentfirstline = $blah[1];
} else {
$userpassstring = $firstline;
$contentfirstline = '';
}
$blah = explode(':', $userpassstring);
$user_login = $blah[0];
$user_pass = $blah[1];
$content = $contentfirstline.str_replace($firstline, '', $content);
$content = trim($content);
echo "<p><b>Login:</b> $user_login, <b>Pass:</b> $user_pass</p>";
$sql = "SELECT ID, user_level FROM $tableusers WHERE user_login='$user_login' AND user_pass='$user_pass' ORDER BY ID DESC LIMIT 1";
$result = mysql_query($sql);
if (!mysql_num_rows($result)) {
echo '<p><b>Wrong login or password.</b></p></div>';
continue;
}
$row = mysql_fetch_object($result);
$user_level = $row->user_level;
$post_author = $row->ID;
if ($user_level > 0) {
$post_title = xmlrpc_getposttitle($content);
$post_category = xmlrpc_getpostcategory($content);
if ($post_title == '') {
$post_title = $subject;
}
if ($post_category == '') {
$post_category = $default_category;
}
if ($autobr) {
$content = autobrize($content);
}
if (!$thisisforfunonly) {
$post_title = addslashes(trim($post_title));
$content = addslashes(trim($content));
$sql = "INSERT INTO $tableposts (post_author, post_date, post_content, post_title, post_category) VALUES ($post_author, '$post_date', '$content', '$post_title', $post_category)";
$result = mysql_query($sql) or die('Couldn\'t add post: '.mysql_error());
$post_ID = mysql_insert_id();
if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
sleep($sleep_after_edit);
}
$blog_ID = 1;
rss_update($blog_ID);
pingWeblogs($blog_ID);
pingCafelog($cafelogID, $post_title, $post_ID);
pingBlogs($blog_ID);
pingback($content, $post_ID);
}
echo "\n<p><b>Posted title:</b> $post_title<br />";
echo "\n<b>Posted content:</b><br /><xmp>".$content.'</xmp></p>';
if(!$pop3->delete($iCount)) {
echo '<p>oops '.$pop3->ERROR.'</p></div>';
$pop3->reset();
exit;
} else {
echo "<p>Mission complete, message <b>$iCount</b> deleted </p>";
}
} else {
echo '<p><b>Level 0 users can\'t post.</b></p>';
}
echo '</div>';
if ($output_debugging_info) {
ob_end_flush();
} else {
ob_end_clean();
}
}
}
$pop3->quit();
timer_stop($output_debugging_info);
exit;
?>

219
b2options.php Normal file
View File

@ -0,0 +1,219 @@
<?php
$title = "Options";
/* <Options> */
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$b2varstoreset = array('action','standalone');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch($action) {
case "update":
$standalone = 1;
include ("./b2header.php");
$newposts_per_page=addslashes($HTTP_POST_VARS["newposts_per_page"]);
$newwhat_to_show=addslashes($HTTP_POST_VARS["newwhat_to_show"]);
$newarchive_mode=addslashes($HTTP_POST_VARS["newarchive_mode"]);
$newtime_difference=addslashes($HTTP_POST_VARS["newtime_difference"]);
$newautobr=addslashes($HTTP_POST_VARS["newautobr"]);
$newtime_format=addslashes($HTTP_POST_VARS["newtime_format"]);
$newdate_format=addslashes($HTTP_POST_VARS["newdate_format"]);
$query = "UPDATE $tablesettings SET posts_per_page=$newposts_per_page, what_to_show='$newwhat_to_show', archive_mode='$newarchive_mode', time_difference=$newtime_difference, AutoBR=$newautobr, time_format='$newtime_format', date_format='$newdate_format' WHERE ID = 1";
$result = mysql_query($query);
if ($result==false) {
$oops = "<b>ERROR</b>: couldn't update the options... please contact the <a href=\"mailto:$admin_email\">webmaster</a> !<br /><br />".mysql_errno().": ".mysql_error();
die ($oops);
}
header ("Location: b2options.php");
break;
default:
$standalone=0;
include ("./b2header.php");
if ($user_level <= 3) {
die("You have no right to edit the options for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
}
?>
<form name="form" action="b2options.php" method="post">
<input type="hidden" name="action" value="update" />
<?php echo $blankline ?>
<?php echo $tabletop ?>
<table width="550" cellpadding="5" cellspacing="0">
<tr height="40">
<td width="150" height="40">Show:</td>
<td width="350"><input type="text" name="newposts_per_page" value="<?php echo get_settings("posts_per_page") ?>" size="3">
<select name="newwhat_to_show">
<option value="days" <?php
$i = $what_to_show;
if ($i == "days")
echo " selected";
?>>days</option>
<option value="posts" <?php
if ($i == "posts")
echo " selected";
?>>posts</option>
<option value="paged" <?php
if ($i == "paged")
echo " selected";
?>>posts paged</option>
</select>
</td>
</tr>
<tr height="40">
<td height="40">Archive mode:</td>
<td><select name="newarchive_mode">
<?php $i = $archive_mode; ?>
<option value="daily"<?php
if ($i == "daily")
echo " selected";
?>>daily</option>
<option value="weekly"<?php
if ($i == "weekly")
echo " selected";
?>>weekly</option>
<option value="monthly"<?php
if ($i == "monthly")
echo " selected";
?>>monthly</option>
<option value="postbypost"<?php
if ($i == "postbypost")
echo " selected";
?>>post by post</option>
</select>
</tr>
<tr height="40">
<td height="40">Time difference:</td>
<td><input type="text" name="newtime_difference" value="<?php echo $time_difference ?>" size="2">
<i> if you're not on the timezone of your server</i>
</td>
</tr>
<tr height="40">
<td height="40" width="150">AutoBR:</td>
<td><select name="newautobr">
<option value="1" <?php
if ($autobr)
echo " selected";
?>>on</option>
<option value="0" <?php
if (!$autobr)
echo " selected";
?>>off</option>
</select>
<i>converts line-breaks into &lt;br /> tags. (<a href="#autobr">note</a>)</i>
</td>
</tr>
<tr height="40">
<td height="40">Date format:</td>
<td><input type="text" name="newdate_format" value="<?php echo $date_format ?>" size="10">
<i> (<a href="#dateformat">note</a>)</i>
</td>
</tr>
<tr height="40">
<td height="40">Time format:</td>
<td><input type="text" name="newtime_format" value="<?php echo $time_format ?>" size="10">
<i> (<a href="#dateformat">note</a>)</i>
</td>
</tr>
<tr height="40">
<td height="40">&nbsp;</td>
<td>
<input type="submit" name="submit" value="Update" class="search">
</td>
</tr>
</table>
<?php echo $tablebottom ?>
</form>
<br />
<?php echo $tabletop ?>
<a name="dateformat"></a><b>About Date & Time formats:</b><br />
<br />
You can format the date & time in many ways, using the PHP syntax.<br />
As quoted from the PHP manual, here are the letters you can use:<br />
<blockquote>
The following characters are recognized in the format string:<br />
a - "am" or "pm"<br />
A - "AM" or "PM"<br />
B - Swatch Internet time<br />
d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"<br />
D - day of the week, textual, 3 letters; i.e. "Fri"<br />
F - month, textual, long; i.e. "January"<br />
g - hour, 12-hour format without leading zeros; i.e. "1" to "12"<br />
G - hour, 24-hour format without leading zeros; i.e. "0" to "23"<br />
h - hour, 12-hour format; i.e. "01" to "12"<br />
H - hour, 24-hour format; i.e. "00" to "23"<br />
i - minutes; i.e. "00" to "59"<br />
I (capital i) - "1" if Daylight Savings Time, "0" otherwise.<br />
j - day of the month without leading zeros; i.e. "1" to "31"<br />
l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"<br />
L - boolean for whether it is a leap year; i.e. "0" or "1"<br />
m - month; i.e. "01" to "12"<br />
M - month, textual, 3 letters; i.e. "Jan"<br />
n - month without leading zeros; i.e. "1" to "12"<br />
r - RFC 822 formatted date; i.e. "Thu, 21 Dec 2000 16:01:07 +0200" (added in PHP 4.0.4)<br />
s - seconds; i.e. "00" to "59"<br />
S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"<br />
t - number of days in the given month; i.e. "28" to "31"<br />
T - Timezone setting of this machine; i.e. "MDT"<br />
U - seconds since the epoch<br />
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)<br />
Y - year, 4 digits; i.e. "1999"<br />
y - year, 2 digits; i.e. "99"<br />
z - day of the year; i.e. "0" to "365"<br />
Z - timezone offset in seconds (i.e. "-43200" to "43200"). The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.<br />
<br />
Unrecognized characters in the format string will be printed as-is.
</blockquote>
For more information and examples, check the PHP manual on <a href="http://www.php.net/manual/en/function.date.php">this page</a>.
<?php echo $tablebottom ?>
<?php
break;
}
/* </Options> */
include($b2inc."/b2footer.php") ?>

50
b2pingbacks.php Normal file
View File

@ -0,0 +1,50 @@
<?php if (!empty($pb)) { ?>
<?php // Do not delete these lines
if (basename($HTTP_SERVER_VARS["SCRIPT_FILENAME"]) == "b2pingbacks.php")
die ("please, do not load this page directly");
$queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_content LIKE '%<pingback />%' ORDER BY comment_date";
$resultc = mysql_query($queryc); if ($resultc) {
?>
<!-- you can START editing here -->
<a name="pingbacks"></a>
<div><strong><span style="color: #0099CC">::</span> pingbacks</strong></div>
<?php /* this line is b2's motor, do not delete it */ $wxcvbn_pb=0; while($rowc = mysql_fetch_object($resultc)) { $wxcvbn_pb++; $commentdata = get_commentdata($rowc->comment_ID); ?>
<a name="pb<?php comment_ID() ?>"></a>
<!-- pingback -->
<p>
<?php comment_text() ?>
<br />
<strong><span style="color: #0099CC">&middot;</span></strong>
<em>Pingback from <a href="<?php comment_author_url(); ?>" title="<?php comment_author() ?>"><?php comment_author() ?></a> on <?php comment_date() ?> @ <?php comment_time() ?></em>
</p>
<p>&nbsp;</p>
<!-- /pingback -->
<?php /* end of the loop, don't delete */ }
if (!$wxcvbn_pb) { ?>
<!-- this is displayed if there are no pingbacks so far -->
<p>No Pingback on this post so far.</p>
<?php /* if you delete this the sky will fall on your head */ } ?>
<p>&nbsp;</p>
<div><b><span style="color: #0099CC">::</span> <a href="javascript:history.go(-1)">return to the blog</a></b></div>
<?php /* if you delete this the sky will fall on your head */ } ?>
</div>
<?php /* if you delete this the sky will fall on your head */ } ?>

75
b2pingbackspopup.php Normal file
View File

@ -0,0 +1,75 @@
<?php /* Don't remove this line, it calls the b2 function files ! */
$blog=1; include ("blog.header.php"); while($row = mysql_fetch_object($result)) { start_b2();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $blogname ?> - pingbacks on '<?php the_title() ?>'</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="reply-to" content="you@yourdomain.com" />
<meta http-equiv="imagetoolbar" content="no" />
<meta content="TRUE" name="MSSmartTagsPreventParsing" />
<style type="text/css" media="screen">
@import url( layout2b.css );
</style>
<link rel="stylesheet" type="text/css" media="print" href="b2-include/print.css" />
<link rel="alternate" type="text/xml" title="XML" href="<?php echo $siteurl ?>/b2rss.php" />
</head>
<body>
<div id="header"><a title="<?php echo $blogname ?>"><?php echo $blogname ?></a></div>
<div id="contentcomments">
<div class="storyContent">
<?php /* do not delete this line */ $queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_content LIKE '%<pingback />%' ORDER BY comment_date"; $resultc = mysql_query($queryc); if ($resultc) { ?>
<a name="pingbacks"></a>
<p>&nbsp;</p>
<div><strong><span style="color: #0099CC">::</span> pingbacks</strong></div>
<p>&nbsp;</p>
<?php /* this line is b2's motor, do not delete it */ $wxcvbn_pb=0; while($rowc = mysql_fetch_object($resultc)) { $commentdata = get_commentdata($rowc->comment_ID); $wxcvbn_pb++; ?>
<a name="pb<?php comment_ID() ?>"></a>
<!-- pingback -->
<p>
<?php comment_text() ?>
<br />
<strong><span style="color: #0099CC">&middot;</span></strong>
<em>Pingback from <a href="<?php comment_author_url(); ?>" title="<?php comment_author() ?>"><?php comment_author() ?></a> on <?php comment_date() ?> @ <?php comment_time() ?></em>
</p>
<p>&nbsp;</p>
<!-- /pingback -->
<?php /* end of the loop, don't delete */ }
if (!$wxcvbn_pb) { ?>
<!-- this is displayed if there are no pingbacks so far -->
<p>No Pingback on this post so far.</p>
<?php /* if you delete this the sky will fall on your head */ } ?>
<p>&nbsp;</p>
<div><b><span style="color: #0099CC">::</span> <a href="javascript:window.close()">close this window</a></b></div>
<?php /* if you delete this the sky will fall on your head */ } ?>
</div>
<?php /* this is just the end of the motor - don't touch that line either :) */ } ?>
</div>
<p class="centerP">
[powered by <a href="http://cafelog.com" target="_blank"><b>b2</b></a>.]
</p>
</body>
</html>

468
b2profile.php Normal file
View File

@ -0,0 +1,468 @@
<?php $title = "Profile";
/* <Profile | My Profile> */
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$b2varstoreset = array('action','standalone','redirect','profile','user');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
require_once("b2config.php");
require_once("$b2inc/b2functions.php");
dbconnect();
switch($action) {
case "update":
require_once("$b2inc/b2verifauth.php");
get_currentuserinfo();
/* checking the nickname has been typed */
if (empty($HTTP_POST_VARS["newuser_nickname"])) {
die ("<strong>ERROR</strong>: please enter your nickname (can be the same as your login)");
return false;
}
/* if the ICQ UIN has been entered, check to see if it has only numbers */
if (!empty($HTTP_POST_VARS["newuser_icq"])) {
if ((ereg("^[0-9]+$",$HTTP_POST_VARS["newuser_icq"]))==false) {
die ("<strong>ERROR</strong>: your ICQ UIN can only be a number, no letters allowed");
return false;
}
}
/* checking e-mail address */
if (empty($HTTP_POST_VARS["newuser_email"])) {
die ("<strong>ERROR</strong>: please type your e-mail address");
return false;
} else if (!is_email($HTTP_POST_VARS["newuser_email"])) {
die ("<strong>ERROR</strong>: the email address isn't correct");
return false;
}
if ($HTTP_POST_VARS["pass1"] == "") {
if ($HTTP_POST_VARS["pass2"] != "")
die ("<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice.");
$updatepassword = "";
} else {
if ($HTTP_POST_VARS["pass2"] == "")
die ("<strong>ERROR</strong>: you typed your new password only once. Go back to type it twice.");
if ($HTTP_POST_VARS["pass1"] != $HTTP_POST_VARS["pass2"])
die ("<strong>ERROR</strong>: you typed two different passwords. Go back to correct that.");
$newuser_pass = $HTTP_POST_VARS["pass1"];
$updatepassword = "user_pass='$newuser_pass', ";
setcookie("cafelogpass",md5($newuser_pass),time()+31536000);
}
$newuser_firstname=addslashes($HTTP_POST_VARS["newuser_firstname"]);
$newuser_lastname=addslashes($HTTP_POST_VARS["newuser_lastname"]);
$newuser_nickname=addslashes($HTTP_POST_VARS["newuser_nickname"]);
$newuser_icq=addslashes($HTTP_POST_VARS["newuser_icq"]);
$newuser_aim=addslashes($HTTP_POST_VARS["newuser_aim"]);
$newuser_msn=addslashes($HTTP_POST_VARS["newuser_msn"]);
$newuser_yim=addslashes($HTTP_POST_VARS["newuser_yim"]);
$newuser_email=addslashes($HTTP_POST_VARS["newuser_email"]);
$newuser_url=addslashes($HTTP_POST_VARS["newuser_url"]);
$newuser_idmode=addslashes($HTTP_POST_VARS["newuser_idmode"]);
$query = "UPDATE $tableusers SET user_firstname='$newuser_firstname', ".$updatepassword."user_lastname='$newuser_lastname', user_nickname='$newuser_nickname', user_icq='$newuser_icq', user_email='$newuser_email', user_url='$newuser_url', user_aim='$newuser_aim', user_msn='$newuser_msn', user_yim='$newuser_yim', user_idmode='$newuser_idmode' WHERE ID = $user_ID";
$result = mysql_query($query);
if ($result==false) {
die ("<strong>ERROR</strong>: couldn't update your profile... please contact the <a href=\"mailto:$admin_email\">webmaster</a> !<br /><br />$query<br /><br />".mysql_error());
}
?>
<html>
<body onload="window.close();">
Profile updated !<br />
If that window doesn't close itself, close it yourself :p
</body>
</html>
<?php
break;
case "viewprofile":
require_once("$b2inc/b2verifauth.php");
/* $profile=1;
get_currentuserinfo();
*/ $profiledata=get_userdata($user);
if ($HTTP_COOKIE_VARS["cafeloguser"] == $profiledata["user_login"])
header ("Location: b2profile.php");
$profile=1; /**/
include("b2header.php");
?>
<div class="menutop" align="center">
<?php echo $profiledata["user_login"] ?>
</div>
<form name="form" action="b2profile.php" method="post">
<input type="hidden" name="action" value="update" />
<table width="100%">
<tr><td width="250">
<table cellpadding="5" cellspacing="0">
<tr>
<td align="right"><strong>login</strong></td>
<td><?php echo $profiledata["user_login"] ?></td>
</tr>
<tr>
<td align="right"><strong>first name</strong></td>
<td><?php echo $profiledata["user_firstname"] ?></td>
</tr>
<tr>
<td align="right"><strong>last name</strong></td>
<td><?php echo $profiledata["user_lastname"] ?></td>
</tr>
<tr>
<td align="right"><strong>nickname</strong></td>
<td><?php echo $profiledata["user_nickname"] ?></td>
</tr>
<tr>
<td align="right"><strong>email</strong></td>
<td><?php echo make_clickable($profiledata["user_email"]) ?></td>
</tr>
<tr>
<td align="right"><strong>URL</strong></td>
<td><?php echo $profiledata["user_url"] ?></td>
</tr>
<tr>
<td align="right"><strong>ICQ</strong></td>
<td><?php if ($profiledata["user_icq"] > 0) { echo make_clickable("icq:".$profiledata["user_icq"]); } ?></td>
</tr>
<tr>
<td align="right"><strong>AIM</strong></td>
<td><?php echo make_clickable("aim:".$profiledata["user_aim"]) ?></td>
</tr>
<tr>
<td align="right"><strong>MSN IM</strong></td>
<td><?php echo $profiledata["user_msn"] ?></td>
</tr>
<tr>
<td align="right"><strong>YahooIM</strong></td>
<td><?php echo $profiledata["user_yim"] ?></td>
</tr>
</table>
</td>
<td valign="top">
<table cellpadding="5" cellspacing="0">
<tr>
<td>
<strong>ID</strong> <?php echo $profiledata["ID"] ?></td>
</tr>
<tr>
<td>
<strong>level</strong> <?php echo $profiledata["user_level"] ?>
</td>
</tr>
<tr>
<td>
<strong>posts</strong>
<?php
$posts=get_usernumposts($user);
echo $posts;
?>
</td>
</tr>
<tr>
<td>
<strong>identity</strong><br />
<?php
switch($profiledata["user_idmode"]) {
case "nickname":
$r=$profiledata["user_nickname"];
break;
case "login":
$r=$profiledata["user_login"];
break;
case "firstname":
$r=$profiledata["user_firstname"];
break;
case "lastname":
$r=$profiledata["user_lastname"];
break;
case "namefl":
$r=$profiledata["user_firstname"]." ".$profiledata["user_lastname"];
break;
case "namelf":
$r=$profiledata["user_lastname"]." ".$profiledata["user_firstname"];
break;
}
echo $r;
?>
</td>
</tr>
</table>
</td>
</table>
</form>
<?php
break;
case 'IErightclick':
$profile = 1;
include ('b2header.php');
$bookmarklet_tbpb = ($use_trackback) ? '&trackback=1' : '';
$bookmarklet_tbpb .= ($use_pingback) ? '&pingback=1' : '';
$bookmarklet_height= ($use_trackback) ? 340 : 300;
?>
<div class="menutop">&nbsp;IE one-click bookmarklet</div>
<table width="100%" cellpadding="20">
<tr><td>
<p>To have a one-click bookmarklet, just copy and paste this<br />into a new text file:</p>
<?php
$regedit = "REGEDIT4\r\n[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Post To &b2 : ".$blogname."]\r\n@=\"javascript:doc=external.menuArguments.document;Q=doc.selection.createRange().text;void(btw=window.open('".$pathserver."/b2bookmarklet.php?text='+escape(Q)+'".$bookmarklet_tbpb."&popupurl='+escape(doc.location.href)+'&popuptitle='+escape(doc.title),'b2bookmarklet','scrollbars=no,width=480,height=".$bookmarklet_height.",left=100,top=150,status=yes'));btw.focus();\"\r\n\"contexts\"=hex:31\"";
?>
<pre style="margin: 20px; background-color: #cccccc; border: 1px dashed #333333; padding: 5px; font-size: 12px;"><?php echo $regedit; ?></pre>
<p>Save it as b2.reg, and double-click on this file in an Explorer<br />
window. Answer Yes to the question, and restart Internet Explorer.<br /><br />
That's it, you can now right-click in an IE window and select <br />
'Post to b2' to make the bookmarklet appear :)</p>
<p align="center">
<form>
<input class="search" type="button" value="1" name="Close this window" />
</form>
</p>
</td></tr>
</table>
<?php
break;
default:
$profile=1;
include ("b2header.php");
$profiledata=get_userdata($user_ID);
$bookmarklet_tbpb = ($use_trackback) ? '&trackback=1' : '';
$bookmarklet_tbpb .= ($use_pingback) ? '&pingback=1' : '';
$bookmarklet_height= ($use_trackback) ? 340 : 300;
?>
<form name="form" action="b2profile.php" method="post">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
<table width="100%">
<td width="200" valign="top">
<table cellpadding="5" cellspacing="0">
<tr>
<td align="right"><strong>login</strong></td>
<td><?php echo $profiledata["user_login"] ?></td>
</tr>
<tr>
<td align="right"><strong>first name</strong></td>
<td><input type="text" name="newuser_firstname" value="<?php echo $profiledata["user_firstname"] ?>" class="postform" /></td>
</tr>
<tr>
<td align="right"><strong>last name</strong></td>
<td><input type="text" name="newuser_lastname" value="<?php echo $profiledata["user_lastname"] ?>" class="postform" /></td>
</tr>
<tr>
<td align="right"><strong>nickname</strong></td>
<td><input type="text" name="newuser_nickname" value="<?php echo $profiledata["user_nickname"] ?>" class="postform" /></td>
</tr>
<tr>
<td align="right"><strong>email</strong></td>
<td><input type="text" name="newuser_email" value="<?php echo $profiledata["user_email"] ?>" class="postform" /></td>
</tr>
<tr>
<td align="right"><strong>URL</strong></td>
<td><input type="text" name="newuser_url" value="<?php echo $profiledata["user_url"] ?>" class="postform" /></td>
</tr>
<tr>
<td align="right"><strong>ICQ</strong></td>
<td><input type="text" name="newuser_icq" value="<?php if ($profiledata["user_icq"] > 0) { echo $profiledata["user_icq"]; } ?>" class="postform" /></td>
</tr>
<tr>
<td align="right"><strong>AIM</strong></td>
<td><input type="text" name="newuser_aim" value="<?php echo $profiledata["user_aim"] ?>" class="postform" /></td>
</tr>
<tr>
<td align="right"><strong>MSN IM</strong></td>
<td><input type="text" name="newuser_msn" value="<?php echo $profiledata["user_msn"] ?>" class="postform" /></td>
</tr>
<tr>
<td align="right"><strong>YahooIM</strong></td>
<td><input type="text" name="newuser_yim" value="<?php echo $profiledata["user_yim"] ?>" class="postform" /></td>
</tr>
</table>
</td>
<td valign="top">
<table cellpadding="5" cellspacing="0">
<tr>
<td>
<strong>ID</strong> <?php echo $profiledata["ID"] ?></td>
</tr>
<tr>
<td>
<strong>level</strong> <?php echo $profiledata["user_level"] ?>
</td>
</tr>
<tr>
<td>
<strong>posts</strong>
<?php
$posts=get_usernumposts($user_ID);
echo $posts;
?>
</td>
</tr>
<tr>
<td>
<strong>identity</strong> on the blog:<br>
<select name="newuser_idmode" class="postform">
<option value="nickname"<?php
if ($profiledata["user_idmode"]=="nickname")
echo " selected"; ?>><?php echo $profiledata["user_nickname"] ?></option>
<option value="login"<?php
if ($profiledata["user_idmode"]=="login")
echo " selected"; ?>><?php echo $profiledata["user_login"] ?></option>
<option value="firstname"<?php
if ($profiledata["user_idmode"]=="firstname")
echo " selected"; ?>><?php echo $profiledata["user_firstname"] ?></option>
<option value="lastname"<?php
if ($profiledata["user_idmode"]=="lastname")
echo " selected"; ?>><?php echo $profiledata["user_lastname"] ?></option>
<option value="namefl"<?php
if ($profiledata["user_idmode"]=="namefl")
echo " selected"; ?>><?php echo $profiledata["user_firstname"]." ".$profiledata["user_lastname"] ?></option>
<option value="namelf"<?php
if ($profiledata["user_idmode"]=="namelf")
echo " selected"; ?>><?php echo $profiledata["user_lastname"]." ".$profiledata["user_firstname"] ?></option>
</select>
</td>
</tr>
<tr>
<td>
<br />
new <strong>password</strong> (twice)<br>
<input type="password" name="pass1" size="16" value="" class="postform" /><br>
<input type="password" name="pass2" size="16" value="" class="postform" />
</td>
</tr>
<?php
if ($user_level > 0) {
?> <tr>
<td><br /><strong>bookmarklet</strong><br />add the link to your Favorites/Bookmarks<br />
<?php
if ($is_NS4 || $is_gecko) {
?>
<a href="javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('<?php echo $path ?>/b2bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'b2 bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));">b2 - <?php echo $blogname ?></a>
<?php
} else if ($is_winIE) {
?>
<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo $path ?>/b2bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'b2bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();">b2 - <?php echo $blogname ?></a>
<script type="text/javascript" language="javascript">
<!--
function oneclickbookmarklet(blah) {
window.open ("b2profile.php?action=IErightclick", "oneclickbookmarklet", "width=500, height=450, location=0, menubar=0, resizable=0, scrollbars=1, status=1, titlebar=0, toolbar=0, screenX=120, left=120, screenY=120, top=120");
}
// -->
</script>
<br /><br />
One-click bookmarklet:<br />
<a href="javascript:oneclickbookmarklet(0);">click here</a>
<?php
} else if ($is_opera) {
?>
<a href="javascript:void(window.open('<?php echo $path ?>/b2bookmarklet.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','b2bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));">b2 - <?php echo $blogname ?></a>
<?php
} else if ($is_macIE) {
?>
<a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo $path ?>/b2bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','b2bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();">b2 - <?php echo $blogname ?></a> <?php
}
?>
<?php if ($is_gecko) { ?>
<br /><br />
<script language="JavaScript">
function addPanel()
{
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function"))
window.sidebar.addPanel("b2 post: <?php echo $blogname ?>","<?php echo $pathserver ?>/b2sidebar.php","");
else
alert('No Sidebar found! You must use Mozilla 0.9.4 or later!');
}
</script>
<strong>SideBar</strong><br />
Add the <a href="#" onClick="addPanel()">b2 Sidebar</a> !
<?php } elseif (($is_winIE) || ($is_macIE)) { ?>
<br /><br />
<strong>SideBar</strong><br />
Add this link to your favorites:<br /><a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(_search=open('<?php echo $pathserver ?>/b2sidebar.php?text='+escape(Q)+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'_search'))">b2 Sidebar</a>.
<?php } ?>
</td>
</tr>
<?php
}
?> </table>
</td></tr>
<tr>
<td colspan="2" align="center"><br /><input class="search" type="submit" value="Update" name="submit"><br />Note: closes the popup window.</td>
</tr>
</table>
</form>
<?php
break;
}
/* </Profile | My Profile> */
include($b2inc."/b2footer.php") ?>

53
b2rdf.php Normal file
View File

@ -0,0 +1,53 @@
<?php /* RDF 1.0 generator, original version by garym@teledyn.com */
$blog=1; // enter your blog's ID
header("Content-type: text/xml");
include ("blog.header.php");
add_filter('the_content', 'trim');
if (!isset($rss_language)) { $rss_language = 'en'; }
?><?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?".">\n"; ?>
<!-- generator="b2/<?php echo $b2_version ?>" -->
<rdf:RDF
xmlns="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
>
<channel rdf:about="<?php bloginfo_rss("url") ?>">
<title><?php bloginfo_rss('name') ?></title>
<link><?php bloginfo_rss('url') ?></link>
<description><?php bloginfo_rss('description') ?></description>
<dc:language><?php echo $rss_language ?></dc:language>
<dc:date><?php echo gmdate('Y-m-d\TH:i:s'); ?></dc:date>
<dc:creator><?php echo $admin_email ?></dc:creator>
<admin:generatorAgent rdf:resource="http://cafelog.com/?v=<?php echo $b2_version ?>"/>
<admin:errorReportsTo rdf:resource="mailto:<?php echo $admin_email ?>"/>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<items>
<rdf:Seq>
<?php $items_count = 0; while($row = mysql_fetch_object($result)) { start_b2(); ?>
<rdf:li rdf:resource="<?php permalink_single_rss() ?>"/>
<?php $b2_items[] = $row; $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } ?>
</rdf:Seq>
</items>
</channel>
<?php foreach($b2_items as $row) { start_b2(); ?>
<item rdf:about="<?php permalink_single_rss() ?>">
<title><?php the_title_rss() ?></title>
<link><?php permalink_single_rss() ?></link>
<dc:date><?php the_time('Y-m-d\TH:i:s'); ?></dc:date>
<dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator>
<dc:subject><?php the_category_rss() ?></dc:subject>
<description><?php the_content_rss('', 0, '', $rss_excerpt_length, 2) ?></description>
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
</item>
<?php } ?>
</rdf:RDF>

342
b2register.php Normal file
View File

@ -0,0 +1,342 @@
<?php
/* <Register> */
include("./b2config.php");
include($b2inc."/b2functions.php");
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$b2varstoreset = array('action');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
if (!$users_can_register) {
$action = 'disabled';
}
switch($action) {
case "register":
function filter($value) {
return ereg("^[a-zA-Z0-9\_-\|]+$",$value);
}
$user_login = $HTTP_POST_VARS["user_login"];
$pass1 = $HTTP_POST_VARS["pass1"];
$pass2 = $HTTP_POST_VARS["pass2"];
$user_email = $HTTP_POST_VARS["user_email"];
$user_login = $HTTP_POST_VARS["user_login"];
/* declaring global fonctions */
# global $user_login,$pass1,$pass2,$user_firstname,$user_nickname,$user_icq,$user_email,$user_url;
/* checking login has been typed */
if ($user_login=='') {
die ("<b>ERROR</b>: please enter a Login");
}
/* checking the password has been typed twice */
if ($pass1=='' ||$pass2=='') {
die ("<b>ERROR</b>: please enter your password twice");
}
/* checking the password has been typed twice the same */
if ($pass1!=$pass2) {
die ("<b>ERROR</b>: please type the same password in the two password fields");
}
$user_nickname=$user_login;
/* checking e-mail address */
if ($user_email=="") {
die ("<b>ERROR</b>: please type your e-mail address");
} else if (!is_email($user_email)) {
die ("<b>ERROR</b>: the email address isn't correct");
}
$id=mysql_connect($server,$loginsql,$passsql);
if ($id==false) {
die ("<b>OOPS</b>: can't connect to the server !".mysql_error());
}
mysql_select_db("$base") or die ("<b>OOPS</b>: can't select the database $base : ".mysql_error());
/* checking the login isn't already used by another user */
$request = " SELECT user_login FROM $tableusers WHERE user_login = '$user_login'";
$result = mysql_query($request,$id) or die ("<b>OOPS</b>: can't check the login...");
$lines = mysql_num_rows($result);
mysql_free_result($result);
if ($lines>=1) {
die ("<b>ERROR</b>: this login is already registered, please choose another one");
}
$user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'] ;
$user_domain = gethostbyaddr($HTTP_SERVER_VARS['REMOTE_ADDR'] );
$user_browser = $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
$user_login=addslashes($user_login);
$pass1=addslashes($pass1);
$user_nickname=addslashes($user_nickname);
$query = "INSERT INTO $tableusers (user_login, user_pass, user_nickname, user_email, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_ip','$user_domain','$user_browser',NOW(),'$new_users_can_blog','nickname')";
$result = mysql_query($query);
if ($result==false) {
die ("<b>ERROR</b>: couldn't register you... please contact the <a href=\"mailto:$admin_email\">webmaster</a> !".mysql_error());
}
$stars="";
for ($i = 0; $i < strlen($pass1); $i = $i + 1) {
$stars .= "*";
}
$message = "new user registration on your blog $blogname:\r\n\r\n";
$message .= "login: $user_login\r\n\r\ne-mail: $user_email";
@mail($admin_email,"new user registration on your blog $blogname",$message);
?><html>
<head>
<title>b2 > Registration complete</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<style type="text/css">
<!--
<?php
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
?>
textarea,input,select {
background-color: #f0f0f0;
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php
}
?>
-->
</style>
</head>
<body bgcolor="#ffffff" text="#000000" link="#cccccc" vlink="#cccccc" alink="#ff0000">
<table width="100%" height="100%">
<td align="center" valign="middle">
<table width="200" height="200" style="border: 1px solid #cccccc;" cellpadding="0" cellspacing="0">
<tr height="50">
<td height="50" width="50">
<a href="http://cafelog.com" target="_blank"><img src="b2-img/b2minilogo.png" border="0" alt="visit b2's homepage" /></a>
</td>
<td class="b2menutop" align="center">
registration<br />complete
</td>
</tr>
<tr height="150"><td align="right" valign="bottom" height="150" colspan="2">
<table width="180">
<tr><td align="right" colspan="2">login: <b><?php echo $user_login ?>&nbsp;</b></td></tr>
<tr><td align="right" colspan="2">password: <b><?php echo $stars ?>&nbsp;</b></td></tr>
<tr><td align="right" colspan="2">e-mail: <b><?php echo $user_email ?>&nbsp;</b></td></tr>
<tr><td width="90">&nbsp;</td>
<td><form name="login" action="b2login.php" method="post">
<input type="hidden" name="log" value="<?php echo $user_login ?>" />
<input type="submit" class="search" value="Login" name="submit" /></form></td></tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>
<?php
break;
case "disabled":
?><html>
<head>
<title>b2 > Registration Currently Disabled</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<style type="text/css">
<!--
<?php
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
?>
textarea,input,select {
background-color: #f0f0f0;
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php
}
?>
-->
</style>
</head>
<body bgcolor="#ffffff" text="#000000" link="#cccccc" vlink="#cccccc" alink="#ff0000">
<table width="100%" height="100%">
<td align="center" valign="middle">
<table width="200" height="200" style="border: 1px solid #cccccc;" cellpadding="0" cellspacing="0">
<tr height="50">
<td height="50" width="50">
<a href="http://cafelog.com" target="_blank"><img src="b2-img/b2minilogo.png" border="0" alt="visit b2's homepage" /></a>
</td>
<td class="b2menutop" align="center">
registration disabled<br />
</td>
</tr>
<tr height="150">
<td align="center" valign="center" height="150" colspan="2">
<table width="80%" height="100%">
<tr><td class="b2menutop">
User registration is currently not allowed.<br />
<a href="<?php echo $siteurl.'/'.$blogfilename; ?>" >Home</a>
</td></tr></table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
break;
default:
?><html>
<head>
<title>b2 > Register form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<style type="text/css">
<!--
<?php
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
?>
textarea,input,select {
background-color: #f0f0f0;
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php
}
?>
-->
</style>
</head>
<body bgcolor="#ffffff" text="#000000" link="#cccccc" vlink="#cccccc" alink="#ff0000">
<table width="100%" height="100%">
<td align="center" valign="middle">
<table width="200" height="200" style="border: 1px solid #cccccc;" cellpadding="0" cellspacing="0">
<tr height="50">
<td height="50" width="50">
<a href="http://cafelog.com" target="_blank"><img src="b2-img/b2minilogo.png" border="0" alt="visit b2's homepage" /></a>
</td>
<td class="b2menutop" align="center">
registration<br />
</td>
</tr>
<tr height="150"><td align="right" valign="bottom" height="150" colspan="2">
<form method="post" action="b2register.php">
<input type="hidden" name="action" value="register" />
<table border="0" width="180" class="menutop" style="background-color: #ffffff">
<tr>
<td width="150" align="right">login</td>
<td>
<input type="text" name="user_login" size="8" maxlength="20" />
</td>
</tr>
<tr>
<td align="right">password<br />(twice)</td>
<td>
<input type="password" name="pass1" size="8" maxlength="100" />
<br />
<input type="password" name="pass2" size="8" maxlength="100" />
</td>
</tr>
<tr>
<td align="right">e-mail</td>
<td>
<input type="text" name="user_email" size="8" maxlength="100" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="OK" class="search" name="submit">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<?php
break;
}

34
b2rss.php Normal file
View File

@ -0,0 +1,34 @@
<?php /* These first lines are the first part of a CaféLog template.
In every template you do, you got to copy them before the CaféLog 'loop' */
$blog=1; // enter your blog's ID
header("Content-type: text/xml");
include ("blog.header.php");
if (!isset($rss_language)) { $rss_language = 'en'; }
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
?><?php echo "<?xml version=\"1.0\"?".">\n"; ?>
<!-- generator="b2/<?php echo $b2_version ?>" -->
<rss version="0.92">
<channel>
<title><?php bloginfo_rss("name") ?></title>
<link><?php bloginfo_rss("url") ?></link>
<description><?php bloginfo_rss("description") ?></description>
<lastBuildDate><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</lastBuildDate>
<docs>http://backend.userland.com/rss092</docs>
<managingEditor><?php echo $admin_email ?></managingEditor>
<webMaster><?php echo $admin_email ?></webMaster>
<language><?php echo $rss_language ?></language>
<?php $items_count = 0; while($row = mysql_fetch_object($result)) { start_b2(); ?>
<item>
<title><?php the_title_rss() ?></title><?php
// we might use this in the future, but not now, that's why it's commented in PHP
// so that it doesn't appear at all in the RSS
// echo "<category>"; the_category_unicode(); echo "</category>"; ?>
<description><?php the_content_rss('', 0, '', $rss_excerpt_length, $rss_encoded_html) ?></description>
<link><?php permalink_single_rss() ?></link>
</item>
<?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } ?>
</channel>
</rss>

1
b2rss.xml Normal file
View File

@ -0,0 +1 @@
this file is blank because you either don't use the RSS function, or you forgot to ChMod that file (chmod 666)

45
b2rss2.php Normal file
View File

@ -0,0 +1,45 @@
<?php /* These first lines are the first part of a CafeLog template.
In every template you do, you got to copy them before the CafeLog 'loop' */
$blog=1; // enter your blog's ID
header("Content-type: text/xml");
include ("blog.header.php");
if (!isset($rss_language)) { $rss_language = 'en'; }
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
?><?php echo "<?xml version=\"1.0\"?".">\n"; ?>
<!-- generator="b2/<?php echo $b2_version ?>" -->
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title><?php bloginfo_rss("name") ?></title>
<link><?php bloginfo_rss("url") ?></link>
<description><?php bloginfo_rss("description") ?></description>
<dc:language><?php echo $rss_language ?></dc:language>
<dc:creator><?php echo $admin_email ?></dc:creator>
<dc:rights>Copyright <?php echo mysql2date('Y', get_lastpostdate()); ?></dc:rights>
<dc:date><?php echo gmdate('Y-m-d\TH:i:s'); ?></dc:date>
<admin:generatorAgent rdf:resource="http://cafelog.com/?v=<?php echo $b2_version ?>"/>
<admin:errorReportsTo rdf:resource="mailto:<?php echo $admin_email ?>"/>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
<?php $items_count = 0; while($row = mysql_fetch_object($result)) { start_b2(); ?>
<item rdf:about="<?php permalink_single_rss() ?>">
<title><?php the_title_rss() ?></title>
<link><?php permalink_single_rss() ?></link>
<dc:date><?php the_time('Y-m-d\TH:i:s'); ?></dc:date>
<dc:creator><?php the_author() ?> (mailto:<?php the_author_email() ?>)</dc:creator>
<dc:subject><?php the_category_rss() ?></dc:subject>
<guid isPermaLink="false"><?php echo $id; ?>@<?php bloginfo_rss("url") ?></guid>
<description><?php the_content_rss('', 0, '', $rss_excerpt_length, 2) ?></description>
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
</item>
<?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } ?>
</channel>
</rss>

168
b2sidebar.php Normal file
View File

@ -0,0 +1,168 @@
<?php
/* <Sidebar> */
$mode = "sidebar";
$standalone = 1;
require_once("./b2header.php");
get_currentuserinfo();
// just your usual browser thing because we're still too far from standards
$is_gecko = preg_match("/Gecko/",$HTTP_USER_AGENT);
$is_winIE = ((preg_match("/MSIE/",$HTTP_USER_AGENT)) && (preg_match("/Win/",$HTTP_USER_AGENT)));
$is_macIE = ((preg_match("/MSIE/",$HTTP_USER_AGENT)) && (preg_match("/Mac/",$HTTP_USER_AGENT)));
$is_IE = (($is_macIE) || ($is_winIE));
if ($user_level == 0)
die ("Cheatin' uh ?");
$request = " SELECT * FROM $tablesettings ";
$result = mysql_query($request);
while($row = mysql_fetch_object($result)) {
$time_difference=$row->time_difference;
$autobr=$row->AutoBR;
}
if ($a=="b") {
?><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
</head>
<body>
<br />
<table cellspacing="0" cellpadding="15" width="90%" border="0" style="border-color: #cccccc; border-width:1; border-style: solid;" align="center">
<td>
<p>Posted !</p>
<p><a href="b2sidebar.php">Click here</a> to post again.</p>
</td>
</table>
</body>
</html><?php
} else {
?><html>
<head>
<title>b2 > sidebar</title>
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<?php
if ($use_spellchecker) {
?><script type="text/javascript" language="javascript">
<!--
function DoSpell(formname, subject, body)
{
document.SPELLDATA.formname.value=formname
document.SPELLDATA.subjectname.value=subject
document.SPELLDATA.messagebodyname.value=body
document.SPELLDATA.companyID.value="custom\\http://cafelog.com"
document.SPELLDATA.language.value=1033
document.SPELLDATA.opener.value="<?php echo $pathserver ?>/sproxy.pl"
document.SPELLDATA.formaction.value="http://www.spellchecker.com/spell/startspelling.asp "
window.open("<?php echo $pathserver ?>/b2spell.php","Spell",
"toolbar=no,directories=no,location=yes,resizable=yes,width=620,height=400,top=100,left=100")
}
//-->
</script><?php
}
?>
<style type="text/css">
<!--
body {
background-image: url('b2-img/b2minilogo.png');
background-repeat: no-repeat;
background-position: 50px 90px;
padding: 3px;
}
textarea,input,select {
font-family: arial,helvetica,sans serif;
font-size: 12px;
background-color: transparent;
<?php if ($is_gecko || $is_macIE) { ?>
background-image: url('b2-img/bgbookmarklet.png');
<?php } elseif ($is_winIE) { ?>
background-color: #dddddd;
filter: alpha(opacity:80);
<?php } ?>
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php if (!$is_gecko) { ?>
.checkbox {
background-color: #ffffff;
border-width: 0px;
padding: 0px;
margin: 0px;
}
<?php } ?>
-->
</style>
</head>
<body>
<!--<table width="100%" cellpadding="0" cellspacing="0">
<td><img src="b2-img/b2minilogo.png"></td>
</table>
-->
<form name="post" action="b2edit.php" method="POST" accept-charset="iso-8859-1">
<input type="hidden" name="action" value="post" />
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="mode" value="sidebar" />
<input type="text" name="post_title" size="20" tabindex="1" style="width: 100%;" value="Title" onFocus="if (this.value=='Title') { this.value='';}" onBlur="if (this.value=='') {this.value='Title';}" />
<?php dropdown_categories(); ?>
<textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2" class="postform" wrap="virtual" onFocus="if (this.value=='Post') { this.value='';}" onBlur="if (this.value=='') {this.value='Post';}">Post</textarea>
<input type="checkbox" name="post_autobr" value="1" <?php if ($autobr) echo " checked" ?> tabindex="4" class="checkbox" id="autobr" /><label for="autobr"> Auto-BR</label><br />
<?php if ($use_pingback) { ?>
<input type="checkbox" class="checkbox" name="post_pingback" value="1" checked="checked" tabindex="5" id="pingback" /><label for="pingback"> PingBack</label>
<?php } ?>
<input type="submit" name="submit" value="Blog this !" class="search" tabindex="3" />
<?php if ($use_spellchecker) { ?>
<!--<input type = "button" value = "Spell Check" onclick="var f=document.forms[0]; doSpell( 'en', f.post_content, '<?php echo $spellchecker_url ?>/sproxy.cgi', true);" class="search" tabindex="5" />-->
<input type="button" value="Spellcheck" onclick="DoSpell
('post','content','');" class="search" tabindex="9"/>
<?php }
if ($use_trackback) { ?>
<br /><label for="trackback"><b>TrackBack</b> an URL:</label><br /><input type="text" name="trackback_url" style="width: 100%" id="trackback" tabindex="7" />
<?php } ?>
<script language="JavaScript">
<!--
// document.blog.post_content.focus();
//-->
</script>
</td>
</tr>
</table>
</div>
</form>
<!-- this is for the spellchecker -->
<form name="SPELLDATA"><div>
<input name="formname" type="hidden" value="">
<input name="messagebodyname" type="hidden" value="">
<input name="subjectname" type="hidden" value="">
<input name="companyID" type="hidden" value="">
<input name="language" type="hidden" value="">
<input name="opener" type="hidden" value="">
<input name="formaction" type="hidden" value="">
</div></form>
</body>
</html><?php
}
?>

97
b2spell.php Normal file
View File

@ -0,0 +1,97 @@
<HTML>
<HEAD><TITLE>Loading Spell Checker</TITLE>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function window_onload() {
document.SPELLDATA.formname.value=opener.document.SPELLDATA.formname.value
document.SPELLDATA.subjectname.value=opener.document.SPELLDATA.subjectname.value
document.SPELLDATA.messagebodyname.value=opener.document.SPELLDATA.messagebodyname.value
document.SPELLDATA.companyID.value=opener.document.SPELLDATA.companyID.value
document.SPELLDATA.language.value=opener.document.SPELLDATA.language.value
document.SPELLDATA.opener.value=opener.document.SPELLDATA.opener.value
document.SPELLDATA.action=opener.document.SPELLDATA.formaction.value
var flen=opener.document.forms.length
var index=flen
for(i=0; i<flen; i++){
if(opener.document.forms[i].name==document.SPELLDATA.formname.value){
index=i
i=flen
}
}
if(index<flen){
var ilen=opener.document.forms[index].elements.length
var indexcontrol=ilen
if(document.SPELLDATA.subjectname.value!=""){
for(i=0; i<ilen; i++){
if(opener.document.forms[index].elements[i].name==document.SPELLDATA.subjectname.value){
indexcontrol=i
i=ilen
}
}
if(indexcontrol<ilen)
document.SPELLDATA.subject.value=opener.document.forms[index].elements[indexcontrol].value
}
if(document.SPELLDATA.messagebodyname.value!=""){
indexcontrol=ilen
for(i=0; i<ilen; i++){
if(opener.document.forms[index].elements[i].name==document.SPELLDATA.messagebodyname.value){
indexcontrol=i
i=ilen
}
}
if(indexcontrol<ilen)
document.SPELLDATA.messagebody.value=opener.document.forms[index].elements[indexcontrol].value
}
document.SPELLDATA.submit()
}else{
alert("no form found. Check java function call")
window.close()
}
}
//-->
</SCRIPT>
</HEAD>
<BODY LANGUAGE=javascript onload="return window_onload()">
<FORM action="" method=post name=SPELLDATA LANGUAGE=javascript>
<H1>Loading Spell Checker. Please wait</H1>
<INPUT name="formname" type=hidden >
<INPUT name="messagebodyname" type=hidden >
<INPUT name="subjectname" type=hidden >
<INPUT name="companyID" type=hidden >
<INPUT name="language" type=hidden >
<INPUT name="opener" type=hidden >
<INPUT name="closer" type=hidden value="finish.asp">
<INPUT name="IsHTML" type=hidden value=0>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
<TEXTAREA name=subject></TEXTAREA>
<TEXTAREA name=messagebody></TEXTAREA>
</FORM>
</BODY>
</HTML>

212
b2team.php Normal file
View File

@ -0,0 +1,212 @@
<?php
$title = "Team management";
/* <Team> */
$b2varstoreset = array('action','standalone','redirect','profile');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch ($action) {
case "promote":
$standalone = 1;
require_once("./b2header.php");
if (empty($HTTP_GET_VARS["prom"])) {
header("Location: b2team.php");
}
$id = $HTTP_GET_VARS["id"];
$prom = $HTTP_GET_VARS["prom"];
$user_data=get_userdata($id);
$usertopromote_level=$user_data[13];
if ($user_level <= $usertopromote_level) {
die("Can't change the level of an user whose level is higher than yours.");
}
if ($prom == "up") {
$sql="UPDATE $tableusers SET user_level=user_level+1 WHERE ID = $id";
} elseif ($prom == "down") {
$sql="UPDATE $tableusers SET user_level=user_level-1 WHERE ID = $id";
}
$result=mysql_query($sql) or die("Couldn't change $id's level.");
header("Location: b2team.php");
break;
case "delete":
$standalone = 1;
require_once("./b2header.php");
$id = $HTTP_GET_VARS["id"];
if (!$id) {
header("Location: b2team.php");
}
$user_data=get_userdata($id);
$usertodelete_level=$user_data[13];
if ($user_level <= $usertodelete_level)
die("Can't delete an user whose level is higher than yours.");
$sql="DELETE FROM $tableusers WHERE ID = $id";
$result=mysql_query($sql) or die("Couldn't delete user #$id.");
$sql="DELETE FROM $tableposts WHERE post_author = $id";
$result=mysql_query($sql) or die("Couldn't delete user #$id's posts.");
header("Location: b2team.php");
break;
default:
$standalone=0;
include ("./b2header.php");
?>
<?php echo $blankline.$tabletop ?>
<table cellspacing="0" cellpadding="5" border="0" width="100%">
<tr>
<td>Click on an user's login name to see his/her complete Profile.<br />
To edit your Profile, click on your login name.</td>
</tr>
</table>
<?php echo $tablebottom ?>
<br />
<?php echo $tabletop ?>
<p><b>Active users</b>
<table cellpadding="5" cellspacing="0">
<tr>
<td class="tabletoprow">ID</td>
<td class="tabletoprow">Nickname</td>
<td class="tabletoprow">Name</td>
<td class="tabletoprow">E-mail</td>
<td class="tabletoprow">URL</td>
<td class="tabletoprow">Level</td>
<?php if ($user_level > 3) { ?>
<td class="tabletoprow">Login</td>
<?php } ?>
</tr>
<?php
$request = " SELECT * FROM $tableusers WHERE user_level>0 ORDER BY ID";
$result = mysql_query($request);
while($row = mysql_fetch_object($result)) {
$user_data = get_userdata2($row->ID);
echo "<tr>\n<!--".$user_data["user_login"]."-->\n";
$email = $user_data["user_email"];
$url = $user_data["user_url"];
$bg1 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('b2-img/b2button.gif');\"" : "bgcolor=\"#dddddd\"";
$bg2 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('b2-img/b2button.gif');\"" : "bgcolor=\"#eeeeee\"";
echo "<td $bg1>".$user_data["ID"]."</td>\n";
echo "<td $bg2><b><a href=\"javascript:profile(".$user_data["ID"].")\">".$user_data["user_nickname"]."</a></b></td>\n";
echo "<td $bg1>".$user_data["user_firstname"]."&nbsp;".$user_data["user_lastname"]."</td>\n";
echo "<td $bg2>&nbsp;<a href=\"mailto:$email\" title=\"e-mail: $email\"><img src=\"b2-img/email.gif\" border=\"0\" alt=\"e-mail: $email\" /></a>&nbsp;</td>";
echo "<td $bg1>&nbsp;";
if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != ""))
echo "<a href=\"$url\" target=\"_blank\" title=\"website: $url\"><img src=\"b2-img/url.gif\" border=\"0\" alt=\"website: $url\" /></a>&nbsp;";
echo "</td>\n";
echo "<td $bg2>".$user_data["user_level"];
if (($user_level >= 2) and ($user_level > ($user_data["user_level"] + 1)))
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=up\">+</a> ";
if (($user_level >= 2) and ($user_level > $user_data["user_level"]) and ($user_data["user_level"] > 0))
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=down\">-</a> ";
echo "</td>\n";
if ($user_level > 3) {
echo "<td $bg1>".$user_data["user_login"]."</td>\n";
}
echo "</tr>\n";
}
?>
</table>
</p>
<?php echo $tablebottom ?>
<?php
$request = " SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID";
$result = mysql_query($request);
if (mysql_num_rows($result)) {
?>
<br />
<?php echo $tabletop ?>
<p><b>Inactive users (level 0)</b>
<table cellpadding="5" cellspacing="0">
<tr>
<td class="tabletoprow">ID</td>
<td class="tabletoprow">Nickname</td>
<td class="tabletoprow">Name</td>
<td class="tabletoprow">E-mail</td>
<td class="tabletoprow">URL</td>
<td class="tabletoprow">Level</td>
<?php if ($user_level > 3) { ?>
<td class="tabletoprow">Login</td>
<?php } ?>
</tr>
<?php
while($row = mysql_fetch_object($result)) {
$user_data = get_userdata2($row->ID);
echo "<tr>\n<!--".$user_data["user_login"]."-->\n";
$email = $user_data["user_email"];
$url = $user_data["user_url"];
$bg1 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('b2-img/b2button.gif');\"" : "bgcolor=\"#dddddd\"";
$bg2 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('b2-img/b2button.gif');\"" : "bgcolor=\"#eeeeee\"";
echo "<td $bg1>".$user_data["ID"]."</td>\n";
echo "<td $bg2><b><a href=\"javascript:profile(".$user_data["ID"].")\">".$user_data["user_nickname"]."</a></b></td>\n";
echo "<td $bg1>".$user_data["user_firstname"]."&nbsp;".$user_data["user_lastname"]."</td>\n";
echo "<td $bg1>&nbsp;<a href=\"mailto:".antispambot($email)."\" title=\"e-mail: ".antispambot($email)."\"><img src=\"b2-img/email.gif\" border=\"0\" alt=\"e-mail: ".antispambot($email)."\" /></a>&nbsp;</td>";
echo "<td $bg2>&nbsp;";
if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != ""))
echo "<a href=\"$url\" target=\"_blank\" title=\"website: $url\"><img src=\"b2-img/url.gif\" border=\"0\" alt=\"website: $url\" /></a>&nbsp;";
echo "</td>\n";
echo "<td $bg1>".$user_data["user_level"];
if ($user_level >= 2)
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=up\">+</a> ";
if ($user_level >= 3)
echo " <a href=\"b2team.php?action=delete&id=".$user_data["ID"]."\" style=\"color:red;font-weight:bold;\">X</a> ";
echo "</td>\n";
if ($user_level > 3) {
echo "<td $bg2>".$user_data["user_login"]."</td>\n";
}
echo "</tr>\n";
}
?>
</table>
</p>
<?php echo $tablebottom ?>
<?php
}
if ($user_level >= 3) { ?>
<br />
<?php echo $tabletop ?>
To delete an user, bring his/her level to zero, then click on the red cross.<br />
<b>Warning:</b> deleting an user also deletes all posts made by this user.
<?php echo $tablebottom ?>
<?php
}
break;
}
/* </Team> */
include($b2inc."/b2footer.php") ?>

156
b2template.php Normal file
View File

@ -0,0 +1,156 @@
<?php
$title = "Template(s) & file editing";
/* <Template> */
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
if (!get_magic_quotes_gpc()) {
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
}
$b2varstoreset = array('action','standalone','redirect','profile','error','warning','a','file');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch($action) {
case "update":
$standalone=1;
require_once("./b2header.php");
if ($user_level < 3) {
die("You have no right to edit the template for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
}
$newcontent = stripslashes($HTTP_POST_VARS["newcontent"]);
$file = $HTTP_POST_VARS["file"];
$f = fopen($file,"w+");
fwrite($f,$newcontent);
fclose($f);
header("Location: b2template.php?file=$file&a=te");
exit();
break;
default:
include("./b2header.php");
if ($user_level <= 3) {
die("You have no right to edit the template for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
}
if ($file=="") {
if ($blogfilename != "") {
$file = $blogfilename;
} else {
$file = "b2.php";
}
}
if (substr($file,0,2) == "..")
die ("Sorry, can't edit files that are up one directory or more.");
if (substr($file,1,1) == ":")
die ("Sorry, can't call files with their real path.");
if (substr($file,0,1) == "/")
$file = ".".$file;
if (!is_file($file))
$error = 1;
$file = stripslashes($file);
if ((substr($file,0,2) == "b2") and (substr($file,-4,4) == ".php") and ($file != "b2.php"))
$warning = " - this is a b2 file, be careful when editing it !";
if (!$error) {
$f = fopen($file,"r");
$content = fread($f,filesize($file));
// $content = template_simplify($content);
$content = htmlspecialchars($content);
// $content = str_replace("</textarea","&lt;/textarea",$content);
}
echo $blankline;
echo $tabletop;
?>
<table width="100%" cellpadding="5" cellspacing="0">
<tr>
<td>
<?php
echo "Listing <b>$file</b>".$warning;
if ($a == "te")
echo "<i> [ file edited ! ]</i>";
if (!$error) {
?>
<form name="template" action="b2template.php" method="post">
<textarea cols="80" rows="20" style="width:100%" name="newcontent" tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" />
<br />
<?php
if (is_writeable($file)) {
echo "<input type=\"submit\" name=\"submit\" class=\"search\" value=\"update template !\" tabindex=\"2\" />";
} else {
echo "<input type=\"button\" name=\"oops\" class=\"search\" value=\"(you cannot update that file/template: must make it writable, e.g. CHMOD 766)\" tabindex=\"2\" />";
}
?>
</form>
<?php
} else {
echo "<p>oops, no such file !</p>";
}
echo $tablebottom;
?>
</td>
</table>
<br />
<?php echo $tabletop; ?>
You can also edit the <a href="b2template.php?file=b2comments.php">comments' template</a> or the <a href="b2template.php?file=b2commentspopup.php">popup comments' template</a>, or edit any other file (provided it's writable by the server, e.g. CHMOD 766).<br />
<br />
To edit a file, type its name here:
<form name="file" action="b2template.php" method="get">
<input type="text" name="file" />
<input type="submit" name="submit" class="search" value="go" />
</form>
<br />
Note: of course, you can also edit the files/templates in your text editor and upload them. This online editor is only meant to be used when you don't have access to a text editor...
<?php echo $tablebottom; ?>
<?php
break;
}
/* </Template> */
include($b2inc."/b2footer.php") ?>

158
b2trackback.php Normal file
View File

@ -0,0 +1,158 @@
<?php if (!empty($tb)) { ?>
<!-- you can START editing here -->
<?php // don't touch these 2 lines
$queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_content LIKE '%<trackback />%' ORDER BY comment_date";
$resultc = mysql_query($queryc); if ($resultc) {
?>
<a name="trackbacks"></a>
<div><strong><span style="color: #0099CC">::</span> trackbacks</strong></div>
<p>
( The URL to TrackBack this entry is:<br />
&nbsp;&nbsp;<em><?php trackback_url() ?></em> )
</p>
<?php /* this line is b2's motor, do not delete it */ while($rowc = mysql_fetch_object($resultc)) { $commentdata = get_commentdata($rowc->comment_ID); ?>
<a name="tb<?php comment_ID() ?>"></a>
<!-- trackback -->
<p>
<?php comment_text() ?>
<br />
<strong><span style="color: #0099CC">&middot;</span></strong>
<em>Tracked on <a href="<?php comment_author_url(); ?>" title="<?php comment_author() ?>"><?php comment_author() ?></a> on <?php comment_date() ?> @ <?php comment_time() ?></em>
</p>
<p>&nbsp;</p>
<!-- /trackback -->
<?php /* end of the loop, don't delete */ } ?>
<p>&nbsp;</p>
<div><b><span style="color: #0099CC">::</span> <a href="javascript:history.go(-1)">return to the blog</a></b></div>
<?php /* if you delete this the sky will fall on your head */ } ?>
</div>
<!-- STOP editing there -->
<?php
} else {
if (!empty($HTTP_GET_VARS['tb_id'])) {
// trackback is done by a GET
$tb_id = $HTTP_GET_VARS['tb_id'];
$url = $HTTP_GET_VARS['url'];
$title = $HTTP_GET_VARS['title'];
$excerpt = $HTTP_GET_VARS['excerpt'];
$blog_name = $HTTP_GET_VARS['blog_name'];
} elseif (!empty($HTTP_POST_VARS['url'])) {
// trackback is done by a POST
$request_array = 'HTTP_POST_VARS';
$tb_id = explode('/', $HTTP_SERVER_VARS['REQUEST_URI']);
$tb_id = $tb_id[count($tb_id)-1];
$url = $HTTP_POST_VARS['url'];
$title = $HTTP_POST_VARS['title'];
$excerpt = $HTTP_POST_VARS['excerpt'];
$blog_name = $HTTP_POST_VARS['blog_name'];
}
if ((strlen(''.$tb_id)) && (empty($HTTP_GET_VARS['__mode'])) && (strlen(''.$url))) {
@header('Content-Type: text/xml');
require_once("b2config.php");
require_once("$b2inc/b2template.functions.php");
require_once("$b2inc/b2vars.php");
require_once("$b2inc/b2functions.php");
if (!$use_trackback) {
trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.');
}
dbconnect();
$url = addslashes($url);
$title = strip_tags($title);
$title = (strlen($title) > 255) ? substr($title, 0, 252).'...' : $title;
$excerpt = strip_tags($excerpt);
$excerpt = (strlen($excerpt) > 255) ? substr($excerpt, 0, 252).'...' : $excerpt;
$blog_name = htmlspecialchars($blog_name);
$blog_name = (strlen($blog_name) > 255) ? substr($blog_name, 0, 252).'...' : $blog_name;
$comment = '<trackback />';
$comment .= "<b>$title</b><br />$excerpt";
$author = addslashes($blog_name);
$email = '';
$original_comment = $comment;
$comment_post_ID = $tb_id;
$autobr = 1;
$user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$user_domain = gethostbyaddr($user_ip);
$time_difference = get_settings('time_difference');
$now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600)));
$comment = convert_chars($comment);
$comment = format_to_post($comment);
$comment_author = $author;
$comment_author_email = $email;
$comment_author_url = $url;
$author = addslashes($author);
$query = "INSERT INTO $tablecomments VALUES ('0','$comment_post_ID','$author','$email','$url','$user_ip','$now','$comment','0')";
$result = mysql_query($query);
if (!$result) {
die ("There is an error with the database, it can't store your comment...<br>Contact the <a href=\"mailto:$admin_email\">webmaster</a>");
} else {
if ($comments_notify) {
$notify_message = "New trackback on your post #$comment_post_ID.\r\n\r\n";
$notify_message .= "website: $comment_author (IP: $user_ip , $user_domain)\r\n";
$notify_message .= "url : $comment_author_url\r\n";
$notify_message .= "excerpt: \n".stripslashes($original_comment)."\r\n\r\n";
$notify_message .= "You can see all trackbacks on this post there: \r\n";
$notify_message .= "$siteurl/$blogfilename?p=$comment_post_ID&tb=1\r\n\r\n";
$postdata = get_postdata($comment_post_ID);
$authordata = get_userdata($postdata["Author_ID"]);
$recipient = $authordata["user_email"];
$subject = "trackback on post #$comment_post_ID \"".$postdata["Title"]."\"";
@mail($recipient, $subject, $notify_message, "From: b2@".$HTTP_SERVER_VARS['SERVER_NAME']."\r\n"."X-Mailer: b2 $b2_version - PHP/" . phpversion());
}
trackback_response(0);
}
}/* elseif (empty($HTTP_GET_VARS['__mode'])) {
header('Content-type: application/xml');
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">\n<response>\n<error>1</error>\n";
echo "<message>Tell me a lie. \nOr just a __mode or url parameter ?</message>\n";
echo "</response>";
}*/
}
?>

80
b2trackbackpopup.php Normal file
View File

@ -0,0 +1,80 @@
<?php /* Don't remove this line, it calls the b2 function files ! */
$blog=1; include ("blog.header.php"); while($row = mysql_fetch_object($result)) { start_b2();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $blogname ?> - trackbacks on '<?php the_title() ?>'</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="reply-to" content="you@yourdomain.com" />
<meta http-equiv="imagetoolbar" content="no" />
<meta content="TRUE" name="MSSmartTagsPreventParsing" />
<style type="text/css" media="screen">
@import url( layout2b.css );
</style>
<link rel="stylesheet" type="text/css" media="print" href="b2-include/print.css" />
<link rel="alternate" type="text/xml" title="XML" href="<?php echo $siteurl ?>/b2rss.php" />
</head>
<body>
<div id="header"><a title="<?php echo $blogname ?>"><?php echo $blogname ?></a></div>
<div id="contentcomments">
<div class="storyContent">
<p>
The URL to TrackBack this entry is:<br />
&nbsp;&nbsp;<em><?php trackback_url() ?></em>
</p>
<?php /* do not delete this line */ $queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_content LIKE '%<trackback />%' ORDER BY comment_date"; $resultc = mysql_query($queryc); if ($resultc) { ?>
<a name="trackbacks"></a>
<p>&nbsp;</p>
<div><strong><span style="color: #0099CC">::</span> trackbacks</strong></div>
<p>&nbsp;</p>
<?php /* this line is b2's motor, do not delete it */ $wxcvbn_tb=0; while($rowc = mysql_fetch_object($resultc)) { $commentdata = get_commentdata($rowc->comment_ID); $wxcvbn_tb++; ?>
<a name="tb<?php comment_ID() ?>"></a>
<!-- trackback -->
<p>
<?php comment_text() ?>
<br />
<strong><span style="color: #0099CC">&middot;</span></strong>
<em>Tracked on <a href="<?php comment_author_url(); ?>" title="<?php comment_author() ?>"><?php comment_author() ?></a> on <?php comment_date() ?> @ <?php comment_time() ?></em>
</p>
<p>&nbsp;</p>
<!-- /trackback -->
<?php /* end of the loop, don't delete */ }
if (!$wxcvbn_tb) { ?>
<!-- this is displayed if there are no trackbacks so far -->
<p>No Trackback on this post so far.</p>
<?php /* if you delete this the sky will fall on your head */ } ?>
<p>&nbsp;</p>
<div><b><span style="color: #0099CC">::</span> <a href="javascript:window.close()">close this window</a></b></div>
<?php /* if you delete this the sky will fall on your head */ } ?>
</div>
<?php /* this is just the end of the motor - don't touch that line either :) */ } ?>
</div>
<p class="centerP">
[powered by <a href="http://cafelog.com" target="_blank"><b>b2</b></a>.]
</p>
</body>
</html>

250
b2upload.php Normal file
View File

@ -0,0 +1,250 @@
<?php
/* b2 File Upload - original hack by shockingbird.com */
$standalone="1";
require_once("./b2header.php");
if ($user_level == 0) //Checks to see if user has logged in
die ("Cheatin' uh ?");
if (!$use_fileupload) //Checks if file upload is enabled in the config
die ("The admin disabled this function");
?><html>
<head>
<title>b2 > upload images/files</title>
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<?php if ($use_spellchecker) { ?>
<script type="text/javascript" language="javascript" src="<?php echo $spch_url; ?>"></script><?php } ?>
<style type="text/css">
<!--
body {
background-image: url('<?php
if ($is_gecko || $is_macIE) {
?>b2-img/bgbookmarklet1.gif<?php
} else {
?>b2-img/bgbookmarklet3.gif<?php
}
?>');
background-repeat: no-repeat;
margin: 30px;
}
<?php
if (!$is_NS4) {
?>
textarea,input,select {
background-color: white;
/*<?php if ($is_gecko || $is_macIE) { ?>
background-image: url('b2-img/bgbookmarklet.png');
<?php } elseif ($is_winIE) { ?>
background-color: #cccccc;
filter: alpha(opacity:80);
<?php } ?>
*/ border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php if (!$is_gecko) { ?>
.checkbox {
border-width: 0px;
border-color: transparent;
border-style: solid;
padding: 0px;
margin: 0px;
}
.uploadform {
background-color: white;
<?php if ($is_winIE) { ?>
filter: alpha(opacity:100);
<?php } ?>
border-width: 1px;
border-color: #333333;
border-style: solid;
padding: 2px;
margin: 1px;
width: 265px;
height: 24px;
}
<?php } ?>
<?php
}
?>
-->
</style>
<script type="text/javascript">
<!-- // idocs.com's popup tutorial rules !
function targetopener(blah, closeme, closeonly) {
if (! (window.focus && window.opener))return true;
window.opener.focus();
if (! closeonly)window.opener.document.post.content.value += blah;
if (closeme)window.close();
return false;
}
//-->
</script>
</head>
<body>
<table align="center" width="100%" height="100%" cellpadding="15" cellspacing="0" border="1" style="border-width: 1px; border-color: #cccccc;">
<tbody>
<tr>
<td valign="top" style="background-color: transparent; <?php if ($is_gecko || $is_macIE) { ?>background-image: url('b2-img/bgbookmarklet.png');<?php } elseif ($is_winIE) { ?>background-color: #cccccc; filter: alpha(opacity:60);<?php } ?>;">
<?php
if (!$HTTP_POST_VARS["submit"]) {
$i = explode(" ",$fileupload_allowedtypes);
$i = implode(", ",array_slice($i, 1, count($i)-2));
?>
<p><strong>File upload</strong></p>
<p>You can upload files of type:<br /><em><?php echo $i ?></em></p>
<p>The maximum size of the file should be:<br /><em><?php echo $fileupload_maxk ?> KB</em></p>
<form action="b2upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $fileupload_maxk*1024 ?>" />
<input type="file" name="img1" size="30" class="uploadform" />
<br /><br />
Description:<br />
<input type="text" name="imgdesc" size="30" class="uploadform" />
<br /><br />
<input type="submit" name="submit" value="upload !" class="search" />
</form>
</td>
</tr>
</tbody>
</table>
</body>
</html><?php die();
}
?>
<?php //Makes sure they choose a file
//print_r($HTTP_POST_FILES);
//die();
if (!empty($HTTP_POST_VARS)) { //$img1_name != "") {
$imgalt = (isset($HTTP_POST_VARS['imgalt'])) ? $HTTP_POST_VARS['imgalt'] : $imgalt;
$img1_name = (strlen($imgalt)) ? $HTTP_POST_VARS['imgalt'] : $HTTP_POST_FILES['img1']['name'];
$img1_type = (strlen($imgalt)) ? $HTTP_POST_VARS['img1_type'] : $HTTP_POST_FILES['img1']['type'];
$imgdesc = str_replace('"', '&amp;quot;', $HTTP_POST_VARS['imgdesc']);
$imgtype = explode(".",$img1_name);
$imgtype = " ".$imgtype[count($imgtype)-1]." ";
if (!ereg(strtolower($imgtype), strtolower($fileupload_allowedtypes))) {
die("File $img1_name of type $imgtype is not allowed.");
}
if (strlen($imgalt)) {
$pathtofile = $fileupload_realpath."/".$imgalt;
$img1 = $HTTP_POST_VARS['img1'];
} else {
$pathtofile = $fileupload_realpath."/".$img1_name;
$img1 = $HTTP_POST_FILES['img1']['tmp_name'];
}
// makes sure not to upload duplicates, rename duplicates
$i = 1;
$pathtofile2 = $pathtofile;
$tmppathtofile = $pathtofile2;
$img2_name = $img1_name;
while (file_exists($pathtofile2)) {
$pos = strpos($tmppathtofile, '.'.trim($imgtype));
$pathtofile_start = substr($tmppathtofile, 0, $pos);
$pathtofile2 = $pathtofile_start.'_'.zeroise($i++, 2).'.'.trim($imgtype);
$img2_name = explode('/', $pathtofile2);
$img2_name = $img2_name[count($img2_name)-1];
}
if (file_exists($pathtofile) && !strlen($imgalt)) {
$i = explode(" ",$fileupload_allowedtypes);
$i = implode(", ",array_slice($i, 1, count($i)-2));
move_uploaded_file($img1, $pathtofile2)
or die("Couldn't Upload Your File to $pathtofile2.");
// duplicate-renaming function contributed by Gary Lawrence Murphy
?>
<p><strong>Duplicate File?</strong></p>
<p><b><em>The filename '<?php echo $img1_name; ?>' already exists!</em></b></p>
<p> filename '<?php echo $img1; ?>' moved to '<?php echo "$pathtofile2 - $img2_name"; ?>'</p>
<p>Confirm or rename:</p>
<form action="b2upload.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $fileupload_maxk*1024 ?>" />
<input type="hidden" name="img1_type" value="<?php echo $img1_type;?>" />
<input type="hidden" name="img1_name" value="<?php echo $img2_name;?>" />
<input type="hidden" name="img1" value="<?php echo $pathtofile2;?>" />
Alternate name:<br /><input type="text" name="imgalt" size="30" class="uploadform" value="<?php echo $img2_name;?>" /><br />
<br />
Description:<br /><input type="text" name="imgdesc" size="30" class="uploadform" value="<?php echo $imgdesc;?>" />
<br />
<input type="submit" name="submit" value="confirm !" class="search" />
</form>
</td>
</tr>
</tbody>
</table>
</body>
</html><?php die();
}
if (!strlen($imgalt)) {
move_uploaded_file($img1, $pathtofile) //Path to your images directory, chmod the dir to 777
or die("Couldn't Upload Your File to $pathtofile.");
} else {
rename($img1, $pathtofile)
or die("Couldn't Upload Your File to $pathtofile.");
}
}
if ( ereg('image/',$img1_type)) {
$piece_of_code = "&lt;img src=&quot;$fileupload_url/$img1_name&quot; border=&quot;0&quot; alt=&quot;$imgdesc&quot; /&gt;";
} else {
$piece_of_code = "&lt;a href=&quot;$fileupload_url/$img1_name&quot; title=&quot;$imgdesc&quot; /&gt;$imgdesc&lt;/a&gt;";
};
?>
<p><strong>File uploaded !</strong></p>
<p>Your file <b><?php echo "$img1_name"; ?></b> was uploaded successfully !</p>
<p>Here's the code to display it:</p>
<p><form>
<!--<textarea cols="25" rows="3" wrap="virtual"><?php echo "&lt;img src=&quot;$fileupload_url/$img1_name&quot; border=&quot;0&quot; alt=&quot;&quot; /&gt;"; ?></textarea>-->
<input type="text" name="imgpath" value="<?php echo $piece_of_code; ?>" size="38" style="padding: 5px; margin: 2px;" /><br />
<input type="button" name="close" value="Add the code to your post !" class="search" onClick="targetopener('<?php echo $piece_of_code; ?>')" style="margin: 2px;" />
</form>
</p>
<p><strong>Image Details</strong>: <br />
name:
<?php echo "$img1_name"; ?>
<br />
size:
<?php echo round($img1_size/1024,2); ?> KB
<br />
type:
<?php echo "$img1_type"; ?>
</p>
<p align="right">
<form>
<input type="button" name="close" value="Close this window" class="search" onClick="window.close()" />
</form>
</p>
</td>
</tr>
</tbody>
</table>
</body>
</html>

272
blog.header.php Normal file
View File

@ -0,0 +1,272 @@
<?php
$use_cache = 1;
$use_gzipcompression = 1;
/* Including config and functions files */
require_once (dirname(__FILE__).'/b2config.php');
$b2blah = dirname(__FILE__).'/';
if ( (substr($b2inc,0,1)=='/') || (substr($b2inc,1,1)==':') ) {
$b2blah='./';
}
require_once ($b2blah.$b2inc.'/b2template.functions.php');
require_once ($b2blah.$b2inc.'/b2vars.php');
require_once ($b2blah.$b2inc.'/b2functions.php');
require_once ($b2blah.$b2inc.'/xmlrpc.inc');
require_once ($b2blah.$b2inc.'/xmlrpcs.inc');
$b2varstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS[$b2var])) {
if (empty($HTTP_GET_VARS[$b2var])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS[$b2var];
}
} else {
$$b2var = $HTTP_POST_VARS[$b2var];
}
}
}
/* Connecting to the db */
dbconnect();
/* Sending HTTP headers */
$last_modified_header = mysql2date('D, d M Y H:i:s', get_lastpostdate());
@header ("X-Pingback: $pathserver/xmlrpc.php");
if (!$is_winIE) {
@header ("Last-Modified: $last_modified_header");
@header ('ETag: "'.md5($last_modified_header.$pagenow).'"');
}
/* Getting settings from db */
$posts_per_page = get_settings('posts_per_page');
$what_to_show = get_settings('what_to_show');
$archive_mode = get_settings('archive_mode');
$dateformat = stripslashes(get_settings('date_format'));
$timeformat = stripslashes(get_settings('time_format'));
$autobr = get_settings('AutoBR');
$time_difference = get_settings('time_difference');
/* First let's clear some variables */
$whichcat = '';
$whichauthor = '';
$result = '';
$where = '';
$limits = '';
$distinct = '';
if ($pagenow != 'b2edit.php') { timer_start(); }
if ($posts)
$posts_per_page=$posts;
// if a month is specified in the querystring, load that month
if ($m != '') {
$m = ''.intval($m);
$where .= ' AND YEAR(post_date)='.substr($m,0,4);
if (strlen($m)>5)
$where .= ' AND MONTH(post_date)='.substr($m,4,2);
if (strlen($m)>7)
$where .= ' AND DAYOFMONTH(post_date)='.substr($m,6,2);
if (strlen($m)>9)
$where .= ' AND HOUR(post_date)='.substr($m,8,2);
if (strlen($m)>11)
$where .= ' AND MINUTE(post_date)='.substr($m,10,2);
if (strlen($m)>13)
$where .= ' AND SECOND(post_date)='.substr($m,12,2);
}
if ($w != '') {
$w = ''.intval($w);
$where .= ' AND WEEK(post_date,1)='.$w;
}
// if a post number is specified, load that post
if (($p != '') && ($p != 'all')) {
$p = intval($p);
$where = ' AND ID = '.$p;
}
// if a search pattern is specified, load the posts that match
if (!empty($s)) {
$s = addslashes_gpc($s);
$search = ' AND (';
// puts spaces instead of commas
$s = preg_replace('/, +/', '', $s);
$s = str_replace(',', ' ', $s);
$s = str_replace('"', ' ', $s);
$s = trim($s);
if ($exact) {
$n = '';
} else {
$n = '%';
}
if (!$sentence) {
$s_array = explode(' ',$s);
$search .= '(post_title LIKE \''.$n.$s_array[0].$n.'\') OR (post_content LIKE \''.$s_array[0].'\')';
for ( $i = 1; $i < count($s_array); $i = $i + 1) {
$search .= ' OR (post_title LIKE \''.$n.$s_array[$i].$n.'\') OR (post_content LIKE \''.$n.$s_array[$i].$n.'\')';
}
$search .= ' OR (post_title LIKE \''.$n.$s.$n.'\') OR (post_content LIKE \''.$n.$s.$n.'\')';
$search .= ')';
} else {
$search = ' AND ((post_title LIKE \''.$n.$s.$n.'\') OR (post_content LIKE \''.$n.$s.$n.'\'))';
}
}
// category stuff
if ((empty($cat)) || ($cat == 'all') || ($cat == '0')) {
$whichcat='';
} else {
$cat = ''.urldecode($cat).'';
$cat = addslashes_gpc($cat);
if (stristr($cat,'-')) {
$eq = '!=';
$andor = 'AND';
$cat = explode('-',$cat);
$cat = $cat[1];
} else {
$eq = '=';
$andor = 'OR';
}
$cat_array = explode(' ',$cat);
$whichcat .= ' AND (post_category '.$eq.' '.$cat_array[0];
for ($i = 1; $i < (count($cat_array)); $i = $i + 1) {
$whichcat .= ' '.$andor.' post_category '.$eq.' '.$cat_array[$i];
}
$whichcat .= ')';
}
// author stuff
if ((empty($author)) || ($author == 'all') || ($cat == '0')) {
$whichauthor='';
} elseif (intval($author)) {
$author = intval($author);
if (stristr($author, '-')) {
$eq = '!=';
$andor = 'AND';
$author = explode('-', $author);
$author = $author[1];
} else {
$eq = '=';
$andor = 'OR';
}
$author_array = explode(' ', $author);
$whichauthor .= ' AND post_author '.$eq.' '.$author_array[0];
for ($i = 1; $i < (count($author_array)); $i = $i + 1) {
$whichauthor .= ' '.$andor.' post_author '.$eq.' '.$author_array[$i];
}
}
$where .= $search.$whichcat.$whichauthor;
if ((empty($order)) || ((strtoupper($order) != 'ASC') && (strtoupper($order) != 'DESC'))) {
$order='DESC';
}
// order by stuff
if (empty($orderby)) {
$orderby='date '.$order;
} else {
$orderby = urldecode($orderby);
$orderby = addslashes_gpc($orderby);
$orderby_array = explode(' ',$orderby);
$orderby = $orderby_array[0].' '.$order;
if (count($orderby_array)>1) {
for ($i = 1; $i < (count($orderby_array)); $i = $i + 1) {
$orderby .= ',post_'.$orderby_array[$i].' '.$order;
}
}
}
if ((!$whichcat) && (!$m) && (!$p) && (!$w) && (!$s) && empty($poststart) && empty($postend)) {
if ($what_to_show == 'posts') {
$limits = ' LIMIT '.$posts_per_page;
} elseif ($what_to_show == 'days') {
$lastpostdate = get_lastpostdate();
$lastpostdate = mysql2date('Y-m-d 00:00:00',$lastpostdate);
$lastpostdate = mysql2date('U',$lastpostdate);
$otherdate = date('Y-m-d H:i:s', ($lastpostdate - (($posts_per_page-1) * 86400)));
$where .= ' AND post_date > \''.$otherdate.'\'';
}
}
if ( !empty($postend) && ($postend > $poststart) && (!$m) &&(!$w) && (!$whichcat) && (!$s) && (!$p)) {
if ($what_to_show == 'posts' || ($what_to_show == 'paged' && (!$paged))) {
$poststart = intval($poststart);
$postend = intval($postend);
$posts = $postend - $poststart;
$limits = ' LIMIT '.$poststart.','.$posts;
} elseif ($what_to_show == 'days') {
$poststart = intval($poststart);
$postend = intval($postend);
$posts = $postend - $poststart;
$lastpostdate = get_lastpostdate();
$lastpostdate = mysql2date('Y-m-d 00:00:00',$lastpostdate);
$lastpostdate = mysql2date('U',$lastpostdate);
$startdate = date('Y-m-d H:i:s', ($lastpostdate - (($poststart -1) * 86400)));
$otherdate = date('Y-m-d H:i:s', ($lastpostdate - (($postend -1) * 86400)));
$where .= ' AND post_date > \''.$otherdate.'\' AND post_date < \''.$startdate.'\'';
}
} else {
if (($what_to_show == 'paged') && (!$p) && (!$more)) {
if ($pagenow != 'b2edit.php') {
$pgstrt = '';
if ($paged) {
$pgstrt = (intval($paged) -1) * $posts_per_page . ', ';
}
$limits = 'LIMIT '.$pgstrt.$posts_per_page;
} else {
if (($m) || ($p) || ($w) || ($s) || ($whichcat)) {
$limits = '';
} else {
$pgstrt = '';
if ($paged) {
$pgstrt = (intval($paged) -1) * $posts_per_page . ', ';
}
$limits = 'LIMIT '.$pgstrt.$posts_per_page;
}
}
}
elseif (($m) || ($p) || ($w) || ($s) || ($whichcat) || ($author)) {
$limits = '';
}
}
if ($p == 'all') {
$where = '';
}
$now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600)));
if ($pagenow != 'b2edit.php') {
if ((empty($poststart)) || (empty($postend)) || !($postend > $poststart)) {
$where .= ' AND post_date <= \''.$now.'\'';
}
$where .= ' AND post_category > 0';
$distinct = 'DISTINCT';
if ($use_gzipcompression) {
// gzipping the output of the script
gzip_compression();
}
}
$request = " SELECT $distinct * FROM $tableposts WHERE 1=1".$where." ORDER BY post_$orderby $limits";
if ($preview) {
$request = 'SELECT 1-1'; // dummy mysql query for the preview
// little funky fix for IEwin, rawk on that code
$is_winIE = ((preg_match('/MSIE/',$HTTP_USER_AGENT)) && (preg_match('/Win/',$HTTP_USER_AGENT)));
if (($is_winIE) && (!isset($IEWin_bookmarklet_fix))) {
$preview_content = preg_replace('/\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $preview_content);
}
}
//echo $request;
$result = mysql_query($request);
?>

229
blogger-2-b2.php Normal file
View File

@ -0,0 +1,229 @@
<?php // rename this to blogger-2-b2.php
$b2varstoreset = array('action');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch ($action) {
case "step1":
include("b2config.php");
include("$b2inc/b2functions.php");
include("$b2inc/b2vars.php");
?>
<html>
<head>
<title>blogger 2 b2 - converting...</title>
<link rel="stylesheet" href="b2.css" type="text/css">
<style type="text/css">
<!--
<?php
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
?>
textarea,input,select {
background-color: #f0f0f0;
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php
}
?>
-->
</style>
</head>
<body style="margin: 20px;">
<p><font face="times new roman" style="font-size: 39px;">blogger 2 <img src="b2-img/b2minilogo.png" width="50" height="50" border="0" alt="b2" align="top" /></font></p>
<p>The importer is running...</p>
<ul>
<?php
$connexion = mysql_connect($server,$loginsql,$passsql) or die ("Oops, MySQL connection error ! Couldn't connect to $server with the username $loginsql");
$bdd = mysql_select_db($dbname,$connexion) or die ("Oops, can't find any database named $dbname here !");
?>
<li>importing posts and users<br /><ul><?php
for($bgy=1999; $bgy<=(date("Y")); $bgy++) {
for($bgm=1; $bgm<13; $bgm++) {
$bgmm=zeroise($bgm,2);
$archivefile = "$bgy"."_"."$bgmm"."_01_cafelog.php";
if (file_exists($archivefile)) {
$f=fopen($archivefile,"r");
$archive=fread($f,filesize($archivefile));
fclose($f);
echo "<li>$bgy/$bgmm ";
$posts = explode("<cafelogpost>",$archive);
for ($i = 1; $i < (count($posts)+1); $i = $i + 1) {
$postinfo=explode("|||",$posts[$i]);
$post_date=$postinfo[0];
$post_content=$postinfo[2];
$post_number=$postinfo[3];
$post_author=trim(addslashes($postinfo[1]));
// we'll check the author is registered already
$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
$result = mysql_query($sql);
if (!mysql_num_rows($result)) { // seems s/he's not, so let's register
$user_ip="127.0.0.1";
$user_domain="localhost";
$user_browser="server";
$user_joindate="1979-06-06 00:41:00"; // that's my birthdate (gmt+1) - I could choose any other date. You could change the date too. Just remember the year must be >=1970 or the world would just randomly fall on your head (everything might look fine, and then blam! major headache!)
$user_login=addslashes($post_author);
$pass1=addslashes("password");
$user_nickname=addslashes($post_author);
$user_email=addslashes("user@cafelog.com");
$user_url=addslashes("");
$user_joindate=addslashes($user_joindate);
$query = "INSERT INTO $tableusers (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')";
$result = mysql_query($query);
if ($result==false) {
die ("<b>ERROR</b>: couldn't register an user... please contact the <a href=\"mailto:$admin_email\">webmaster</a> !");
}
echo ": registered user <i>$user_login</i>";
}
$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$post_author_ID=$myrow[0];
$post_date = explode(" ",$post_date);
$post_date_Ymd = explode("/", $post_date[0]);
$postyear=$post_date_Ymd[2];
$postmonth=zeroise($post_date_Ymd[0],2);
$postday=zeroise($post_date_Ymd[1],2);
$post_date_His = explode(":", $post_date[1]);
$posthour=zeroise($post_date_His[0],2);
$postminute=zeroise($post_date_His[1],2);
$postsecond=zeroise($post_date_His[2],2);
if (($post_date[2]=="PM") && ($posthour!="12"))
$posthour=$posthour+12;
$post_date="$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
$post_content=addslashes($post_content);
$post_content=str_replace("<br>","<br />",$post_content); // the XHTML touch... ;)
$post_title="";
$query = "INSERT INTO $tableposts (ID, post_author,post_date,post_content,post_title,post_category) VALUES ('$post_number','$post_author_ID','$post_date','$post_content','$post_title','1')";
$result = mysql_query($query) or die(mysql_error());
if (!$result)
die ("Error in posting... contact the <a href=\"mailto:$admin_email\">webmaster</a>");
} echo "... <b>Done</b></li>";
}}
}
/* we've still got a bug that adds some empty posts with the date 0000-00-00 00:00:00
here's the bugfix: */
$query="DELETE FROM $tableposts WHERE post_date=\"0000-00-00 00:00:00\"";
$result = mysql_query($query) or die(mysql_error());
?>
</ul><b>Done</b></li></ul>
<p>&nbsp;</p>
<p>Completed Blogger 2 b2 import !</p>
<p>Now you can go and <a href="b2login.php">log in</a>, have fun !</p>
<?php
break;
default:
?><html>
<head>
<title>blogger 2 b2 importer utility</title>
<link rel="stylesheet" href="b2.css" type="text/css">
<style type="text/css">
<!--
<?php
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
?>
textarea,input,select {
background-color: #f0f0f0;
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php
}
?>
-->
</style>
</head>
<body style="margin: 20px;">
<p><font face="times new roman" style="font-size: 39px;">blogger 2 <img src="b2-img/b2minilogo.png" width="50" height="50" border="0" alt="b2" align="top" /></font></p>
<p>This is a basic Blogger to b2 import script.</p>
<p>What it does:</p>
<ul>
<li>parses your archives to retrieve your blogger posts</li>
<li>adds an author whenever it sees a new nickname, all authors are imported at level 1, with a default profile and the password 'password'</li>
</ul>
<p>What it does not:</p>
<ul>
<li>it sucks at making coffee, and is not toilet-trained yet</li>
</ul>
<p>&nbsp;</p>
<h3>First step: install b2</h3>
<p>Install the b2 blog as explained in the <a href="readme.html" target="_blank">ReadMe</a>, then immediately come back here.</p>
<h3>Second step: let's play with Blogger</h3>
<p>Log into your Blogger account.<br />
Go to the Settings, and make Blogger publish your files in the directory where your b2 resides. Change the Date/Time format to be mm/dd/yyyy hh:mm:ss AM/PM (the first choice in the dropdown menu). In Archives: set the frequency to 'monthly' and the archive filename to 'cafelog.php' (without the quotes), set the ftp archive path to make Blogger publish the archives in your b2 directory. Click 'save changes'.<br />
Go to the Templates. Replace your existing template with this line (copy and paste):
<blockquote>&lt;Blogger>&lt;cafelogpost>&lt;$BlogItemDateTime$>|||&lt;$BlogItemAuthorNickname$>|||&lt;$BlogItemBody$>|||&lt;$BlogItemNumber$>&lt;/Blogger></blockquote>
Go to the Archives, and click 'republish all'.<br />
Check in your FTP that you've got the archive files published. They should look like this example: <i>2001_10_01_cafelog.php</i>. If they aren't there, redo the republish process.<br /><br />You're done with the hard part. :)</p>
<form name="stepOne" method="get">
<input type="hidden" name="action" value="step1" />
<h3>Third step: w00t, let's click OK:</h3>
<p>When you're ready, click OK to start importing: <input type="submit" name="submit" value="OK" class="search" /><br /><br />
<i>Note: the script might take some time, like 1 second for 100 entries imported. DO NOT STOP IT or else you won't have a complete import, and running the script again might just make you have double posts.</i></p>
</form>
</body>
</html>
<?php
break;
}
?>

15
example.htaccess Normal file
View File

@ -0,0 +1,15 @@
# this will make register globals off in b2's directory
# just put a '#' sign before these three lines if you don't want that
<IfModule mod_php4.c>
php_flag register_globals off
</IfModule>
# this is used to make b2 produce links like http://example.com/archives/m/200209
# if you renamed the file 'archives' to another name, please change it here too
<Files archives>
ForceType application/x-httpd-php
</Files>

326
gm-2-b2.php Normal file
View File

@ -0,0 +1,326 @@
<?php
// 1. save as gm-2-b2.php
// 2. upload on your server in the directory where your b2 files are
// 3. load in the browser from there
include("b2config.php");
include($b2inc."/b2functions.php");
$b2varstoreset = array('action', 'gmpath', 'archivespath');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch ($action) {
case "step1":
function gm2autobr($string) { // transforms GM's |*| into b2's <br />\n
$string = str_replace("|*|","<br />\n",$string);
return($string);
}
if (!chdir($archivespath))
alert_error("Wrong path, $archivespath\ndoesn't exist\non the server");
if (!chdir($gmpath))
alert_error("Wrong path, $gmpath\ndoesn't exist\non the server");
?>
<html>
<head>
<title>GM 2 b2 - converting...</title>
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<style type="text/css">
<!--
<?php
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
?>
textarea,input,select {
background-color: #f0f0f0;
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php
}
?>
-->
</style>
</head>
<body style="margin: 20px;">
<p><font face="times new roman" style="font-size: 39px;">gm 2 <img src="b2-img/b2minilogo.png" width="50" height="50" border="0" alt="b2" align="top" /></font></p>
<p>The importer is running...</p>
<ul>
<li>importing users... <ul><?php
chdir($gmpath);
$userbase = file("gm-authors.cgi");
$connexion = mysql_connect($server,$loginsql,$passsql) or die ("Oops, MySQL connection error ! Couldn't connect to $server with the username $loginsql");
$bdd = mysql_select_db($dbname,$connexion) or die ("Oops, can't find any database named $dbname here !");
foreach($userbase as $user) {
$userdata=explode("|", $user);
$user_ip="127.0.0.1";
$user_domain="localhost";
$user_browser="server";
$s=$userdata[4];
$user_joindate=substr($s,6,4)."-".substr($s,0,2)."-".substr($s,3,2)." 00:00:00";
$user_login=addslashes($userdata[0]);
$pass1=addslashes($userdata[1]);
$user_nickname=addslashes($userdata[0]);
$user_email=addslashes($userdata[2]);
$user_url=addslashes($userdata[3]);
$user_joindate=addslashes($user_joindate);
$query = "INSERT INTO $tableusers (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')";
$result = mysql_query($query);
if ($result==false) {
die ("<b>ERROR</b>: couldn't register an user... please contact the <a href=\"mailto:$admin_email\">webmaster</a> !");
}
echo "<li>user <i>$user_login</i>... <b>Done</b></li>";
}
?></ul><b>Done</b></li>
<li>importing posts, comments, and karma...<br /><ul><?php
chdir($archivespath);
for($i = 0; $i <= $lastentry; $i = $i + 1) {
$entryfile = "";
if ($i<10000000) {
$entryfile .= "0";
if ($i<1000000) {
$entryfile .= "0";
if ($i<100000) {
$entryfile .= "0";
if ($i<10000) {
$entryfile .= "0";
if ($i<1000) {
$entryfile .= "0";
if ($i<100) {
$entryfile .= "0";
if ($i<10) {
$entryfile .= "0";
}}}}}}}
$entryfile .= "$i";
if (is_file($entryfile.".cgi")) {
$entry=file($entryfile.".cgi");
echo "<li>entry # $entryfile ";
$postinfo=explode("|",$entry[0]);
$postmaincontent=gm2autobr($entry[2]);
$postmorecontent=gm2autobr($entry[3]);
$post_author=trim(addslashes($postinfo[1]));
// we'll check the author is registered, or if it's a deleted author
$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
$result = mysql_query($sql);
if (!mysql_num_rows($result)) { // if deleted from GM, we register the author as a level 0 user in b2
$user_ip="127.0.0.1";
$user_domain="localhost";
$user_browser="server";
$user_joindate="1979-06-06 00:41:00";
$user_login=addslashes($post_author);
$pass1=addslashes("password");
$user_nickname=addslashes($post_author);
$user_email=addslashes("user@deleted.com");
$user_url=addslashes("");
$user_joindate=addslashes($user_joindate);
$query = "INSERT INTO $tableusers (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,dateYMDhour,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','0','nickname')";
$result = mysql_query($query);
if ($result==false) {
die ("<b>ERROR</b>: couldn't register an user... please contact the <a href=\"mailto:$admin_email\">webmaster</a> !");
}
echo ": registered deleted user <i>$user_login</i> at level 0 ";
}
$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$post_author_ID=$myrow[0];
$post_title=gm2autobr($postinfo[2]);
$post_title=addslashes($post_title);
$postyear=$postinfo[6];
$postmonth=zeroise($postinfo[4],2);
$postday=zeroise($postinfo[5],2);
$posthour=zeroise($postinfo[7],2);
$postminute=zeroise($postinfo[8],2);
$postsecond=zeroise($postinfo[9],2);
if (($postinfo[10]=="PM") && ($posthour!="12"))
$posthour=$posthour+12;
$post_date="$postyear-$postmonth-$postday $posthour:$postminute:$postsecond";
$post_category="1";
$post_content=$postmaincontent;
if (strlen($postmorecontent)>3)
$post_content .= "<!--more--><br /><br />".$postmorecontent;
$post_content=addslashes($post_content);
$post_karma=$postinfo[12];
$query = "INSERT INTO $tableposts (post_author,post_date,post_content,post_title,post_category,post_karma) VALUES ('$post_author_ID','$post_date','$post_content','$post_title','1','$post_karma')";
$result = mysql_query($query) or die(mysql_error());
if (!$result)
die ("Error in posting... contact the <a href=\"mailto:$admin_email\">webmaster</a>");
$sql2 = "SELECT * FROM $tableposts WHERE 1=1 ORDER BY ID DESC LIMIT 1";
$result2 = mysql_query($sql2);
$myrow2 = mysql_fetch_array($result2);
$post_ID=$myrow2[0];
$c=count($entry);
if ($c>4) {
for ($j=4;$j<$c;$j++) {
$entry[$j]=gm2autobr($entry[$j]);
$commentinfo=explode("|",$entry[$j]);
$comment_post_ID=$post_ID;
$comment_author=addslashes($commentinfo[0]);
$comment_author_email=addslashes($commentinfo[2]);
$comment_author_url=addslashes($commentinfo[3]);
$comment_author_IP=addslashes($commentinfo[1]);
$commentyear=$commentinfo[7];
$commentmonth=zeroise($commentinfo[5],2);
$commentday=zeroise($commentinfo[6],2);
$commenthour=zeroise($commentinfo[8],2);
$commentminute=zeroise($commentinfo[9],2);
$commentsecond=zeroise($commentinfo[10],2);
if (($commentinfo[11]=="PM") && ($commenthour!="12"))
$commenthour=$commenthour+12;
$comment_date="$commentyear-$commentmonth-$commentday $commenthour:$commentminute:$commentsecond";
$comment_content=addslashes($commentinfo[12]);
$sql3 = "INSERT INTO $tablecomments (comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content) VALUES ('$comment_post_ID','$comment_author','$comment_author_email','$comment_author_url','$comment_author_IP','$comment_date','$comment_content')";
$result3 = mysql_query($sql3);
if (!$result3)
die ("There is an error with the database, it can't store your comment...<br>Contact the <a href=\"mailto:$admin_email\">webmaster</a>");
}
$comments=$c-4;
echo ": imported $comments comment";
if ($comments>1)
echo "s";
}
echo "... <b>Done</b></li>";
}
} ?>
</ul><b>Done</b></li></ul>
<p>&nbsp;</p>
<p>Completed GM 2 b2 import !</p>
<p>Now you can go and <a href="b2login.php">log in</a>, have fun !</p>
<?php
break;
default:
?><html>
<head>
<title>GM 2 b2 importer utility</title>
<link rel="stylesheet" href="<?php echo $b2inc; ?>/b2.css" type="text/css">
<style type="text/css">
<!--
<?php
if (!preg_match("/Nav/",$HTTP_USER_AGENT)) {
?>
textarea,input,select {
background-color: #f0f0f0;
border-width: 1px;
border-color: #cccccc;
border-style: solid;
padding: 2px;
margin: 1px;
}
<?php
}
?>
-->
</style>
</head>
<body style="margin: 20px;">
<p><font face="times new roman" style="font-size: 39px;">gm 2 <img src="b2-img/b2minilogo.png" width="50" height="50" border="0" alt="b2" align="top" /></font></p>
<p>This is a basic GreyMatter to b2 import script.</p>
<p>What it does:</p>
<ul>
<li>parses gm-authors.cgi to import authors: everyone is imported at level 1</li>
<li>parses the entries cgi files to import posts, comments, and karma on posts (although karma is not used on b2 yet)<br />if authors are found not to be in gm-authors.cgi, imports them at level 0</li>
</ul>
<p>What it does not:</p>
<ul>
<li>parse gm-counter.cgi (what's the use of that file ?), gm-banlist.cgi, gm-cplog.cgi (you can make a CP log hack if you really feel like it, but I question the need of a CP log)</li>
<li>import gm-templates. you'll start with the basic template b2.php</li>
<li>doesn't keep entries on top</li>
</ul>
<p>&nbsp;</p>
<h3>First step: install b2</h3>
<p>Install the b2 blog as explained in the <a href="readme.html" target="_blank">ReadMe</a>, then immediately come back here.</p>
<form name="stepOne" method="get">
<input type="hidden" name="action" value="step1" />
<h3>Second step: GreyMatter details:</h3>
<p><table cellpadding="0">
<tr>
<td>Path to GM files:</td>
<td><input type="text" style="width:300px" name="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
</tr>
<tr>
<td>Path to GM entries:</td>
<td><input type="text" style="width:300px" name="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
</tr>
<tr>
<td colspan="2"><br />This importer will search for files 00000001.cgi to 000-whatever.cgi,<br />so you need to enter the number of the last GM post here.<br />(if you don't know that number, just log into your FTP and look it out<br />in the entries' folder)</td>
</tr>
<tr>
<td>Last entry's number:</td>
<td><input type="text" name="lastentry" value="00000001" /></td>
</tr>
</table>
</p>
<p>When you're ready, click OK to start importing: <input type="submit" name="submit" value="OK" class="search" /></p>
</form>
</body>
</html>
<?php
break;
}
?>

123
index.php Normal file
View File

@ -0,0 +1,123 @@
<?php /* Don't remove this line, it calls the b2 function files ! */ $blog=1; include ("blog.header.php"); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- layout credits goto http://bluerobot.com/web/layouts/layout2.html -->
<head>
<title><?php bloginfo('name') ?><?php single_post_title(' :: ') ?><?php single_cat_title(' :: ') ?><?php single_month_title(' :: ') ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="reply-to" content="<?php bloginfo('admin_email'); ?>" />
<meta http-equiv="imagetoolbar" content="no" />
<meta content="TRUE" name="MSSmartTagsPreventParsing" />
<style type="text/css" media="screen">
@import url( layout2b.css );
</style>
<link rel="stylesheet" type="text/css" media="print" href="print.css" />
<link rel="alternate" type="text/xml" title="RDF" href="<?php bloginfo('rdf_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php comments_popup_script() ?>
</head>
<body>
<div id="header"><a href="" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></div>
<div id="content">
<!-- // b2 loop start -->
<?php while($row = mysql_fetch_object($result)) { start_b2(); ?>
<?php the_date("","<h2>","</h2>"); ?>
<?php permalink_anchor(); ?>
<div class="storyTitle"><?php the_title(); ?>
<a href="?cat=<?php the_category_ID() ?>" title="category: <?php the_category() ?>"><span class="storyCategory">[<?php the_category() ?>]</span></a>&nbsp;-&nbsp;
<span class="storyAuthor"><?php the_author() ?> - <?php the_author_email() ?></span> @ <a href="<?php permalink_link() ?>"><?php the_time() ?></a>
</div>
<div class="storyContent">
<?php the_content(); ?>
<div class="rightFlush">
<?php link_pages("<br />Pages: ","<br />","number") ?>
<?php comments_popup_link("Comments (0)", "Comments (1)", "Comments (%)") ?>
<?php trackback_popup_link("TrackBack (0)", "TrackBack (1)", "TrackBack (%)") ?>
<?php pingback_popup_link("PingBack (0)", "PingBack (1)", "PingBack (%)") ?>
<?php trackback_rdf() ?>
<!-- this includes the comments and a form to add a new comment -->
<?php include ("b2comments.php"); ?>
<!-- this includes the trackbacks -->
<?php include ("b2trackback.php"); ?>
<!-- this includes the pingbacks -->
<?php include ("b2pingbacks.php"); ?>
</div>
</div>
<!-- // this is just the end of the motor - don't touch that line either :) -->
<?php } ?>
</div>
<p class="centerP"><?php timer_stop(1); ?>
[powered by <a href="http://cafelog.com" target="_blank"><b>b2</b></a>.]
</p>
<div id="menu">
<h4>quick links:</h4>
<a href="http://www.cafelog.com" title="b2's homepage">cafelog.com</a><br />
<a href="http://some other site" title="another link">another link</a><br />
<a href="http://some other site" title="another link">another link</a><br />
<a href="http://some other site" title="another link">another link</a><br />
<h4>categories:</h4>
<?php list_cats(0, 'All', 'name'); ?>
<h4>search:</h4>
<form name="searchform" method="get" action="<?php echo $PHP_SELF; /*$siteurl."/".$blogfilename*/ ?>">
<p>
<input type="text" name="s" size="15" /><br />
<input type="submit" name="submit" value="search" />
</p>
</form>
<h4>archives:</h4>
<?php include("b2archives.php"); ?>
<br />
<h4>other:</h4>
<a href="b2login.php">login</a><br />
<a href="b2register.php">register</a><br />
<br />
<a href="b2rss.php"><img src="b2-img/xml.gif" alt="view this weblog as RSS !" width="36" height="14" border="0" /></a><br />
<a href="http://validator.w3.org/check/referer" title="this page validates as XHTML 1.0 Transitional"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" border="0" /></a>
</div>
<div id="chaff">
<a href="mailto:abuse@[127.0.0.1]" title="anti sp@mbot addrss">4 sp@mbots e-mail me</a>
</div>
<!-- BlueRobot was here. -->
</body>
</html>

179
layout2b.css Normal file
View File

@ -0,0 +1,179 @@
/*
credit for the original concept and core of the layout comes courtesy of Rob Chandanais via:
http://bluerobot.com/web/layouts/layout2.html
used as default layout for b2, with permission from Dean Peters,
who first adapted it ( http://www.deanpeters.com/b2 )
*/
body {
margin:0px;
padding:0px;
font-family:verdana, arial, helvetica, sans-serif;
color:#333;
background-color:white;
}
h2 {
border-bottom:1px solid #999;
border-right:1px solid #999;
margin:15px 300px 15px 0px;
padding:6px;
font-size:14px;
line-height:14px;
font-weight:700;
background-color:#eee;
color:#09c;
}
h1, h4, h5, .storyTitle, .storyCategory, .storyAuthor {
margin:15px 0px 10px 0px;
padding:0px;
font-size:28px;
line-height:28px;
font-weight:900;
color:#ccc;
}
h4, h5, .storyTitle, .storyCategory, .storyAuthor {
font-size:12px;
line-height:12px;
font-weight:800;
color:#999;
}
.storyCategory, .storyAuthor {
font-size:10px;
line-height:10px;
}
h5, .storyAuthor {
font-size:10px;
font-style:italic;
}
p, .storyContent {
font:11px/20px verdana, arial, helvetica, sans-serif;
margin:0px 15px 0px 20px;
padding:0px;
}
#content>p {margin:0px;}
#content>p+p {text-indent:30px;}
.storyContent {
font:11px/16px verdana, arial, helvetica, sans-serif;
}
#content>.storyContent {margin:0px;}
#content>.storyContent+.storyContent {text-indent:30px;}
a {
color:#09c;
font-size:11px;
text-decoration:none;
font-weight:600;
font-family:verdana, arial, helvetica, sans-serif;
}
a:link {color:#09c;}
a:visited {color:#07a;}
a:hover {background-color:#eee;}
#header {
margin:50px 0px 10px 0px;
padding:17px 0px 0px 20px;
/* For IE5/Win's benefit height = [correct height] + [top padding] + [top and bottom border widths] */
height:33px; /* 14px + 17px + 2px = 33px */
/* border-style:solid;
border-color:black;
border-width:1px 0px;
*/ /* top and bottom borders: 1px; left and right borders: 0px */
border-bottom:1px solid #999;
border-right:1px solid #999;
line-height:11px;
background-color:#eee;
/* Here is the ugly brilliant hack that protects IE5/Win from its own stupidity.
Thanks to Tantek Celik for the hack and to Eric Costello for publicizing it.
IE5/Win incorrectly parses the "\"}"" value, prematurely closing the style
declaration. The incorrect IE5/Win value is above, while the correct value is
below. See http://glish.com/css/hacks.asp for details. */
voice-family: "\"}\"";
voice-family:inherit;
height:14px; /* the correct height */
}
/* I've heard this called the "be nice to Opera 5" rule. Basically, it feeds correct
length values to user agents that exhibit the parsing error exploited above yet get
the CSS box model right and understand the CSS2 parent-child selector. ALWAYS include
a "be nice to Opera 5" rule every time you use the Tantek Celik hack (above). */
body>#header {height:14px;}
#header a {
font-size:18px;
font-weight:800;
}
#content {
margin:0px 210px 50px 10px;
padding:10px;
}
#contentcomments {
margin:0px 0px 50px 10px;
padding:10px;
}
#menu {
position:absolute;
top:100px;
right:20px;
width:172px;
padding:10px;
background-color:#eee;
border-bottom:1px solid #999;
border-right:1px solid #999;
line-height:17px;
/* Again, the ugly brilliant hack. */
voice-family: "\"}\"";
voice-family:inherit;
width:150px;
}
/* Again, "be nice to Opera 5". */
body>#menu {width:150px;}
#menu a {
margin: 0px 0px 0px 0px;
padding: 0px 0px 0px 10px;
}
#menu h4 {
margin: 12px 0px 4px 0px;
}
#chaff {
text-align: right;
}
#chaff a {
color: #fff;
font-size:2px;
}
#chaff a:link { color: #fff; }
#chaff a:visited { color: #fff; }
#chaff a:hover { background-color:#fff; }
.centerP {
text-align: center;
}
#contentcomments input, #content input, #menu input {
margin: 1px;
padding: 1px 1px 4px 1px;
border: 1px solid #ccc;
font:11px/14px verdana, arial, helvetica, sans-serif;
}
#contentcomments textarea, #content textarea, #menu textarea {
margin: 1px;
padding: 1px;
border: 1px solid #ccc;
font:11px/14px verdana, arial, helvetica, sans-serif;
}
.commentfield {
margin-bottom: 4px;
}

280
license.txt Normal file
View File

@ -0,0 +1,280 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

3
phpinfo.php Normal file
View File

@ -0,0 +1,3 @@
<?php
phpinfo();
?>

20
print.css Normal file
View File

@ -0,0 +1,20 @@
body {
font-family: serif; font-size: 11pt;;
}
#header, H3, H4, storyTitle {
margin: 0px 0px 0.5in; width: auto;
font-weight: bold; border: none;
}
#main {
float: none; margin: 0px 10%; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: auto
}
#content {
margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: auto
}
#header, H3, H4, storyTitle {
margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: auto;
font-weight: bold; border: none;
}
#menu {
display: none;
}

912
readme.html Normal file
View File

@ -0,0 +1,912 @@
<html>
<head>
<title>b2 > ReadMe</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
<!--
body,p,li { font-family: arial,helvetica,sans-serif; font-size:12px; margin-left: 15px; }
blockquote { font-family: arial,helvetica,sans-serif; font-size:12px; }
h1 { font-family: georgia,times new roman,serif; font-size: 18px; font-weight: lighter; color: #000066; }
.params {
border-color: #cccccc;
border-width: 1px;
border-style: solid;
padding: 5px;
margin: 5px;
margin-left: 20px;
margin-right: 80px;
font-family: arial,helvetica,sans-serif; font-size:12px;
}
ul,ol { margin: 0px; padding: 0px; padding-left: 20px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; }
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<p align="center"><img src="b2-img/b2minilogo.png" width="50" height="50"><br />
<font size="2" face="Georgia, Times New Roman, Times, serif">0.6.1<br />
20021102</font></p>
<p align="center">weblog / news publishing tool</p>
<p align="center"><a href="#requirements">requirements</a> - <a href="#installation">installation</a>
- <a href="#templates">template(s)</a> - <a href="#usage">querystring
usage</a> - <a href="#xmlrpc">xmlrpc (Blogger API)</a> - <a href="#postviaemail">post via email</a> - <a href="#notes">notes</a></p>
<a name="requirements"></a><h1>requirements:</h1>
<p><strong>PHP4</strong> (version 4.0.5 or higher)<br />
<strong>MySQL</strong> (version 3.23.23 or higher)<br />
Perl (optional - only for the spellchecker)<br />
...and a link to <a href="http://cafelog.com" target="_blank">http://cafelog.com</a>
on your site.<br />
<br />
The link will help promoting b2, since this is its only mean of promotion.<br />
If you like b2, you can help me with a donation (even if it's only 2 or 3 dollars, every donation helps), or you can buy me stuff from my <a href="http://www.amazon.com/exec/obidos/registry-address-select-done/1XKLC38KDUPXR/103-8901342-4908609">wishlist</a> :)
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="dieu@paradis.com" />
<input type="image" src="https://www.paypal.com/images/x-click-but04.gif" border="0" name="submit" alt="If you like b2 a lot, you may help me with a donation :)" title="If you like b2 a lot, you may help me with a donation :)" />
</form></p>
<p>&nbsp;</p>
<a name="installation"></a><h1>installation:</h1>
<p>New users:</p>
<blockquote>
<strong>1.</strong> Unzip the package in an empty directory.<br /><br />
<strong>2.</strong> Open b2config.php in a text editor, and modify the variables
as explained in the comments. Comments are lines that start with # or /* or //<br /><br />
<strong>3.</strong> Upload everything. This release is designed to sit in your root folder,
IE the folder where your b2-powered page will reside.<br /><br />
<strong>4.</strong> a. This isn't necessary but ensures your security: With your FTP
program, do a CHMOD 644 on the file b2config.php, so no-one can overwrite
it except you. If your server is on Windows NT, then set the file on &quot;read-only&quot; mode.<br />
&nbsp;&nbsp;&nbsp;b. if you want to use the spellchecker, do a CHMOD 755 on sproxy.pl<br /><br />
<strong>5.</strong> Launch b2install.php in your browser. This should setup the
MySQL database for your blog. If there is an error, double check your
b2config.php file, and try again. If it fails again, please go to the
support forums there: <a href="http://tidakada.com/board" target="_blank">http://tidakada.com/board</a>,
and make a post with all the information about the failure (error messages,
etc), and your setup (the PHP and MySQL versions on your server, and the
browser you were using).<br /><br />
<strong>6.</strong> Delete b2install.php - this is not necessary since
v0.5, because there's no &quot;drop table&quot; instructions in the install
script anymore, but it's better to delete it anyway (or rename it to a
random name in case you need it again in the future).<br /><br />
<strong>7.</strong> Go to b2login.php and log in with the login &quot;admin&quot;
and the pass &quot;admin&quot;. Then click on the menu 'My Profile',
and change the password. Note:
you need javascript enabled to launch the profile popup window.<br /><br />
<strong>8.</strong> Do this if you don't want to blog as &quot;admin&quot;: log
out, create an user account on b2register.php, then re-log in as &quot;admin&quot;,
and update the level of the new user to 5 or more, so that you have all
the admin rights. Logout, then log in as the new user.<br /><br />
Whenever you want to post something, just open a browser and
go to b2login.php to log in and post.<br />
You can also use a bookmarklet and/or a sidebar (IE5+/NS6+) to post.<br />
You can also post through the Blogger API, <a href="#xmlrpc">click here</a> for more info.<br />
Your site's blog is on b2.php (simple template) and index.php (CSS template), you
can rename this file to index.php or any other name you fancy (provided
it bears the php extension or is interpreted as a php file by your server).<br />
You can also copy b2.php into a new file and modify that new file, it will work too ;)<br />
</blockquote>
<p>Users upgrading from v0.5.x to v0.6.1:</p>
<blockquote> <strong>1.</strong> Unzip the package in an empty directory, to avoid
deleting your existing b2config.php file.<br /><br />
<strong>2.</strong> Open the new b2config.php file and your existing b2config.php file. Modify the new b2config.php file in order to use your existing settings there, in addition to the new settings. (There are a lot of additionnal settings, so it's best to edit the new config file than adding on the exisitng one.)<br /><br />
<strong>3.</strong> if you want to use the new spellchecker, do a CHMOD 755 on sproxy.pl<br /><br />
<strong>4.</strong> Edit <u>all</u> your templates and update your template tags
to follow the changes to the template tags here, because there have been some
modifications, and it would cause some errors if you didn't edit the templates.
Tags noted with an orange asterisk <b><font face="Courier New, Courier, mono" color="#FF9900">*</font></b>
are tags that were added or modified in v0.6, these are those you got
to update in your templates.<br />
<strong>5.</strong> Upload the new files, and you're done. :)<br /></blockquote>
<p>Users upgrading from v0.6preX to v0.6.1:</p>
<blockquote> <strong>1.</strong> Unzip the package in an empty directory, to avoid
deleting your existing b2config.php file.<br /><br />
<strong>2.</strong> Open the new b2config.php file and your existing b2config.php file. Modify the new b2config.php file in order to use your existing settings there, in addition to the new settings. (There are a lot of additionnal settings, so it's best to edit the new config file than adding on the existing one.)<br />
<strong>3.</strong> Upload the new files, and you're done. :) (Generally, this means every file but your template file index.php/b2.php)<br />
<strong>4.</strong> To add support of the new TrackBack and Pingback functionnalities, you may want to check the Template tags section for the appropriate new tags, and the default index.php to see how they are used :)<br />
</blockquote>
<p>&nbsp;</p>
<a name="templates"></a><h1>template(s):</h1>
<p>First notes:</p>
<blockquote>Enclosed is an example of a template, in the file b2.php. You can rename
this file to &quot;index.php&quot;or something else (recent b2 versions have a default index.php, which is an elaborate CSS-based template).<br />
You can have any number of template files, since all they do is extract
the posts from the database.<br />
Pseudo-template for the comments is in b2comments.php. You needn't rename this
file, but you can edit it.<br />
The only thing to remember is that it's not actually a template, but a
PHP file that you're manipulating. So when you see &quot;don't delete
this line&quot;, you know you mustn't, unless you want to have a broken
page.<br />
Required lines are: the first lines that call blog.header.php, the lines
with the &quot;while&quot; statement, and the ones with just &quot;}&quot;
(it ends the while loop).<br />
Between the &quot;while&quot; line and the &quot;}&quot;, is the template
for your posts.<br />
<br />
</blockquote>
<p>Notes about parameters:</p>
<blockquote><strong>1.</strong> Some template tags can accept optional parameters
between the parenthesis <strong>()</strong>.<br /><br />
<strong>2.</strong> To add a parameter to a
tag, enclose it between quotes and put it between the <strong>()</strong>.<br />
Example: &lt;?php my_tag("my parameter"); ?><br /><br />
<strong>3.</strong> You may have to put several parameters, for that you separate
them with commas.<br />
Example: &lt;?php my_tag("first param","second param"); ?><br /><br />
<strong>4.</strong> The order of parameters is important. If a function accepts 2
parameters and you only want to set the second one, you still have to provide the
first one, and so on for any number of parameters.<br />
Example: &lt;?php my_tag("","second param"); ?><br /><br />
<strong>5.</strong> Some template tags, like the_date(), display something only
if in some conditions. They generally accept parameters to display something before
and after them only when they display something.<br />
Example: &lt;?php the_title("&lt;h1>","&lt;/h1>"); ?> would display &lt;h1>title
of the post&lt;/h1> only if the post has a title<br />
<br /></blockquote>
<p>Template tags are these:</p>
<blockquote>
<strong>&lt;?php the_date() ?&gt;</strong> <span style="font-family: 'Courier New',Courrier,mono; color: #ff9900; font-weight: bold;">*</span><br />
the date of the post. example: 03.07.01 (default is dd.mm.yy).<br />
the date is displayed only on new days. for example if you got 10 posts
on the same day, the date for this day is displayed only once.<br />
<div class="params">Parameters:<ul>
<li>format string (default: "d.m.y")</li>
<li>string to display before the date (default is blank)</li>
<li>string to display after the date (default is blank)</li>
</ul>
</div>
<br />
<strong>&lt;?php the_time() ?&gt;</strong><br />
the time of the post. example: 18:37:00 (default is hh:mm:ss)<br />
<div class="params">Parameters:<ul>
<li>format string (default: "H:i:s")</li>
</ul>
</div>
<br />
<strong>Note:</strong> you can change the way the date &amp; time are displayed
in the Options page.<br />
once you understand the format strings for the date &amp; time (explained
in the Options page), you can change the display right on the template:
for example, <strong>the_date(</strong><em>&quot;d.m.Y&quot;</em><strong>)</strong> to have
dates like 25.12.2001, <strong>the_time(</strong><em>&quot;B&quot;</em><strong>)</strong> to
have Swatch Internet Time.<br />
If you change the display of the date on the template, changing it from the
options page won't have any effect.br />
<br />
<strong>Note about the_date():</strong> if you want all your posts to bear the date,
you'll have to use the_time() instead, with a date format string. for
example, to have all your posts show like &quot;25.12.2001 @ 8:04:50 AM&quot;
you'll have the_time(&quot;d.m.Y @ g:i:s A&quot;). you can also repeat
this template tag 2 times with 2 different formats: the_time(&quot;d.m.Y&quot;)
for the date, and then later the_time(&quot;g:i:s A&quot;) for the time
of the day.<br />
<br />
<strong>&lt;?php the_weekday() ?&gt;</strong><br />
This displays the day of the week when the post was made. It works like
the_time(), in that it would appear at every post. Weekdays can be obtained
with a custom date format string in the_time() or the_date(), but for
non-english weekdays you have to edit b2config.php<br />
<strong>Note: this tag is OBSOLETE, the_time() and the_date() now use weekdays/months from b2config.php</strong><br />
<br />
<strong>&lt;?php the_weekday_date() ?&gt;</strong> <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
Like the_weekday(), but works like the_date(), in that it would appear
only on new days.<br />
<strong>Note: this tag is OBSOLETE, the_time() and the_date() now use weekdays/months from b2config.php</strong><br />
<div class="params">Parameters:<ul>
<li>string to display before the weekday_date (default is blank)</li>
<li>string to display after the weekday_date (default is blank)</li>
</ul>
</div>
<br />
<br />
<strong>&lt;?php the_ID() ?&gt;<br />
</strong>the ID (number) of the post.<br />
<br />
<strong>&lt;?php the_title() ?&gt;<br />
</strong>The title of the post.<br />
<div class="params">Parameters:<ul>
<li>string to display before the title (default is blank)</li>
<li>string to display after the title (default is blank)</li>
</ul>
</div>
<br />
<br />
<strong>&lt;?php the_content() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>The text of the post.<br />
<div class="params">Parameters:<ul>
<li>text to display for the link to the complete entry (default is <em>'(more...)'</em>)</li>
<li>0 or 1, whether you want to show the teaser message or not, when showing
the complete text (default is 1)</li>
<li>a filename of another template, if you want the 'more' link to link
to a different template for the complete text of the extended entry (default
is the current template)</li>
</ul>
</div>
<br />
For example <em>&lt;?php the_content(&quot;read more&quot;,&quot;0&quot;,&quot;blah.php&quot;)
?&gt;</em> would display a link to <em>blah.php</em>, with the link text
<em>read more</em>, and won't display the teaser message.<br />
<br />
<span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span>
To enter an extended entry, just type <em>&lt;!--more--&gt;</em> in your
entry. The part before that comment is the teaser, the part after it is
the extended entry. To force the extended entry not to show the teaser
message, type <em>&lt;!--noteaser--&gt;</em> somewhere in your entry.<br />
<br />
<span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span>
To enter an entry with several pages, just type <em>&lt;!--nextpage--&gt;</em>
in your entry to start a new page.<br />
<br /><br />
<strong>&lt;?php next_post() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>Displays a link to the next post(s). (Generally you might want to use that
tag only in single-post templates)<br />
<div class="params">Parameters:<ul>
<li>format string for the link (default is "%", where % is replaced with the title
of the next post)</li>
<li>text to display to announce the link (default is "next post: ")</li>
<li>"yes" or "no": display the title of the post, or no (default is "yes")</li>
<li>"yes" or "no": display a link to the next post only if the next post is in
the same category (default is "no")</li>
<li>number: which next post ? if you make it '2', the 2nd next post is linked
instead of the 1st next one (default is "1", which means first next post)</li>
</ul>
</div>
<br /><br />
<strong>&lt;?php previous_post() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>Displays a link to the previous post(s). (Generally you might want to use
that tag only in single-post templates)<br />
<div class="params">Parameters:<ul>
<li>format string for the link (default is "%", where % is replaced with the title of the previous post)</li>
<li>text to display to announce the link (default is "previous post: ")</li>
<li>"yes" or "no": display the title of the post, or no (default is "yes")</li>
<li>"yes" or "no": display a link to the next post only if the previous post is in
the same category (default is "no")</li>
<li>number: which previous post ? if you make it '2', the 2nd previous post is
linked instead of the 1st previous post (default is "1", which means first previous post)</li>
</ul>
</div>
<br /><br />
<strong>&lt;?php next_posts() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>Display the URL portion of a link to the next set of posts. <br />
Generally you would use this in a template to navigate to the next "set" of posts
when the "Show Options" settings for the site is set to "posts paged". The displayed
string can be used to construct a link. When the site options are not set to 'posts paged",
the next and previous functions will display nothing.<br />
<div class="params">Parameters:<ul>
<li>Max page number to use. Default "0"; no limit</li>
</ul>
</div>
<br /><br />
<strong>&lt;?php next_posts_link() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>
Displays a full link to the next "set" of posts only if show options set to "posts paged"
and only if there is another page or partial page of data.<br />
<div class="params">Parameters:<ul>
<li>A user supplied string. Default "Next Page &gt;&gt;"</li>
</ul>
</div>
<br /><br />
<strong>&lt;?php previous_posts() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>Displays the URL portion of a link to the previous posts.<br />
Generally you would use this in a template to navigate to the previous "set" of posts
when the "Show Options" settings for the site is set to "posts paged".
The displayed string can then be used to construct a link. When the site options are not set to 'posts paged",
the next and previous functions will display nothing.<br />
<div class="params">Parameters:<ul>
<li>No parameters.</li>
</ul>
</div>
<br /><br />
<strong>&lt;?php previous_posts_link() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>
Displays a full link to the previous "set" of posts only if show options set to "posts paged" and if there is a previous set, otherwise nothing is displayed.<br />
<div class="params">Parameters:<ul>
<li>A user supplied string. Default "&lt;&lt; Previous Page"</li>
</ul>
</div>
<br /><br />
<strong>&lt;?php posts_nav_link() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>The function displays a complete navigation set of links including a user definable "separator" with the ability to supply a the text string to be used for the "previous" and "next" links.<br />
The default result will produce the following string:<br />
<p align="center">&lt;&lt; Previous Page :: Next Page &gt;&gt;</p>
<div class="params">Parameters:<ul>
<li>A user supplied "separator" string. Default " :: "</li>
<li>A user supplied "previous" string. Default "&lt;&lt; Previous Page"</li>
<li>A user supplied "next" string. Default "Next Page &gt;&gt;"</li>
</ul>
</div>
<br /><br />
<strong>&lt;?php link_pages() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>Displays links to the pages of the post if it's a multiple pages post.<br />
<div class="params">Parameters:<ul>
<li>string to display before the tag (default is "&lt;br />", a newline)</li>
<li>string to display after the tag (default is "&lt;br />", a newline)</li>
<li>"next" or "number": display links like "next/previous page" or links to each page with the number of the page "1 2 3 4 etc" (default is "number")</li>
<li>string to display the "next page" link (default is "next page")</li>
<li>string to display the "previous page" link (default is "previous page")</li>
<li>format string for the "number of page" link (default is "%", where % is replaced by the number of the page)</li>
<li>file name, in case you want to load the posts with multiple pages in a different template (default is the current template)</li>
</ul>
</div>
<br /><br />
<strong>&lt;?php the_author() ?&gt;</strong><br />
The author of the post.<br />
Depending on the user's profile settings, it can display whether their
nickname, login name, first name, last name, both first&amp; last name,
or last &amp; first name. look below for more author-related template
tags. <br />
<br />
<strong>&lt;?php the_category() ?&gt;<br />
</strong>the name of the category the post belongs to. you can as an admin
add categories, and rename them if needed. default category is 'General',
you can rename it too.<br />
<br />
<strong>&lt;?php the_category_ID() ?&gt;<br />
</strong>The ID (number) of the category the post belongs to. This is static
data thatyou can use, for example to associate a category to an image,
or a css style.<br />
<br />
<strong>&lt;?php trackback_rdf() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span></strong><br />
This will include the RDF data that can be used by some weblog tools to locate your posts' trackback URLs.<br />
You should put this tag after the &lt;?php the_content() ?&gt; tag in your template, or just before the end of the loop.<br />
<br />
<strong>&lt;?php dropdown_cats() ?&gt;<br />
</strong>this is a special tag, meant to be used in the template, but outside of the b2 loop. it will display a list of &lt;option name="<em>x</em>"><em>category-name</em>&lt;/option>, where <em>x</em> is the number of the category and <em>category-name</em> is the name of it.<br />
<div class="params">Parameters:<ul>
<li>0 or 1, depending if you want to have an option to display all categories (default is 1)</li>
<li>text to display for the option to show all categories (default is "All")</li>
</ul>
</div>
<br />
you can use it like this: <br /><br />
<code>&lt;form action="&lt;?php echo $PHP_SELF ?>" method="get"><br />
&lt;?php dropdown_cats() ?><br />
&lt;input type="submit" name="submit" value="view" /><br />
&lt;/form></code>
<br />
<br />
<strong>&lt;?php list_cats() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>this is a special tag, meant to be used in the template, but outside of the b2 loop. it will display a list of the categories, with links to them. like in b2archive.php, each category is on a line, the only way you can change this is by editing b2.template.functions.php<br />
<div class="params">Parameters:<ul>
<li>0 or 1, depending if you want to have an option to display all categories (default is 1)</li>
<li>text to display for the option to show all categories (default is 'All')</li>
<li>sort by: possible values are 'name' and 'ID' (default is 'ID')</li>
<li>sorting order: possible values are 'asc' for ascending or 'desc' for descending (default is 'asc')</li>
<li>filename, in case you want to display the categories' posts in another template (default is current template)</li>
</ul>
</div>
<br />
<strong>&lt;?php bloginfo() ?&gt;</strong> <span style="font-family: 'Courier New',Courrier,mono; color: #ff9900; font-weight: bold;">*</span><br />
This tag is out of the b2 loop.<br />
It outputs info about your weblog.<br />
<div class="params">Parameters:<ul>
<li>string: can be 'name' to display the name of your weblog (you set it in b2config.php), 'url', 'description', 'admin_email', 'rss_url' to display the URL of your b2rss.xml file, 'pingback_url' to display the URL of your xmlrpc.php file<br /> (default string is 'name')</li>
</ul>
</div>
<br />
<strong>&lt;?php single_post_title() ?&gt;</strong> <span style="font-family: 'Courier New',Courrier,mono; color: #ff9900; font-weight: bold;">*</span><br />
This tag is out of the b2 loop.<br />
It outputs the title of the post when you load the page with ?p= (see 'Usage' section for explanation). When the weblog page is loaded without ?p=, this tag doesn't display anything. Generally, you could use it like this:<br />
&nbsp; &nbsp;&lt;title&gt;&lt;?php bloginfo('name') ?&gt;&lt;?php single_post_title() ?&gt;&lt;/title&gt;<br />
<div class="params">Parameters:<ul>
<li>prefix string that will appear before the post's title (default is ' :: ')</li>
</ul>
</div>
<br />
<strong>&lt;?php single_cat_title() ?&gt;</strong> <span style="font-family: 'Courier New',Courrier,mono; color: #ff9900; font-weight: bold;">*</span><br />
This tag is out of the b2 loop.<br />
It outputs the title of the category when you load the page with ?cat= (see 'Usage' section for explanation). When the weblog page is loaded without ?cat=, this tag doesn't display anything. Generally, you could use it like this:<br />
&nbsp; &nbsp;&lt;title&gt;&lt;?php bloginfo('name') ?&gt;&lt;?php single_cat_title() ?&gt;&lt;/title&gt;<br />
<div class="params">Parameters:<ul>
<li>prefix string that will appear before the category's title (default is ' :: ')</li>
</ul>
</div>
<br />
<strong>&lt;?php single_month_title() ?&gt;</strong> <span style="font-family: 'Courier New',Courrier,mono; color: #ff9900; font-weight: bold;">*</span><br />
This tag is out of the b2 loop.<br />
It outputs the name of the month when you load the page with ?m= (see 'Usage' section for explanation). When the weblog page is loaded without ?m=, this tag doesn't display anything. Generally, you could use it like this:<br />
&nbsp; &nbsp;&lt;title&gt;&lt;?php bloginfo('name') ?&gt;&lt;?php single_month_title() ?&gt;&lt;/title&gt;<br />
<div class="params">Parameters:<ul>
<li>prefix string that will appear before the month's name (default is ' :: ')</li>
</ul>
</div>
<br />
<strong>Note:</strong> The above three functions can be used together to produce the Title of the page:<br>
&nbsp; &nbsp;&lt;title&gt;&lt;?php bloginfo('name') ?&gt;&lt;?php single_post_title(' :: ') ?&gt;&lt;?php single_cat_title(' :: ') ?&gt;&lt;?php single_month_title(' :: ') ?&gt;&lt;/title&gt;<br />
Only one, if any, of these functions will produce output, thus the page Title can be customize to the task being done.
<br />
<br />
<br />
<strong>More about the author</strong> of the post ? Here goes:<br />
<br />
<strong>&lt;?php the_author_email() ?&gt; - </strong> the author's email.<br />
<strong>&lt;?php the_author_url() ?&gt;</strong> - the author's url.<br />
<strong>&lt;?php the_author_email() ?&gt;</strong> - the author's number of posts.<br />
<strong>&lt;?php the_author_icq() ?&gt;</strong> - the author's ICQ number.<br />
<strong>&lt;?php the_author_aim() ?&gt;</strong> - the author's AIM handle.<br />
<strong>&lt;?php the_author_yim() ?&gt;</strong> - the author's Yahoo Messenger
handle.<br />
<strong>&lt;?php the_author_msn() ?&gt;</strong> - the author's MSN Messenger handle.<br />
<strong>&lt;?php the_author_posts() ?&gt;</strong> - the author's post count.<br />
<strong>&lt;?php the_author_login() ?&gt;</strong> - the author's login name in b2.
If you want some static data about the
author, this is what you're searching for. You can, for example, associate
a picture with an author, like this: <em>&lt;img src=&quot;pictures/&lt;?php
the_author_login() ?&gt;.jpg&quot; border=&quot;0&quot;&gt;</em><br />
<strong>&lt;?php the_author_ID() ?&gt;</strong>
- the author's ID number in b2. This number is automatically set when
the user registers: to see the ID of an user, go to the Team page. This
is static data too, so you can use it like the_author_login() in associating
stuff with authors.<br />
<br />
<strong><br />
Tags for permalinks</strong> are:<br />
<br />
<strong>&lt;?php permalink_anchor() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span></strong><br />
this will display &lt;a name=&quot;...&quot;&gt;&lt;/a&gt;, replacing
&quot;...&quot; with the ID or the title of the post in the database.<br />
<br />
<div class="params">Parameters:<ul>
<li>string for kind of anchor: either 'id' that displays '50', or 'title' that displays 'title_of_post_50' (default is 'id')</li>
</ul>
</div>
<br />
<strong>&lt;?php permalink_link() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>this will display the name of the file followed by #ID to link to
the post, in the month archive if archive-mode is "monthly".<br />
note: this tag does not display the link, for this you've got to type
&lt;a href=&quot;&lt;?php permalink_link() ?&gt;&quot;&gt;text of the
link&lt;/a&gt;.<br />
<div class="params">Parameters:<ul>
<li>file name, in case you want to link the archive to a different template (default is the current template)</li>
<li>string for kind of link: either 'id' that appends '#50' to the link, or 'title' that appends '#title_of_post_50' (default is 'id')</li>
</ul>
</div>
<br />
<br />
<strong>&lt;?php permalink_single() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span><br />
</strong>this will display the name of the file followed by #ID to link to
the entire post (the linked page will also show the extended text on that post if it is an extended entry, and the comments).<br />
note: this tag does not display the link, for this you've got to type
&lt;a href=&quot;&lt;?php permalink_single() ?&gt;&quot;&gt;text of the
link&lt;/a&gt;.<br />
<div class="params">Parameters:<ul>
<li>file name, in case you want to use a different template for single posts (default is the current template)</li>
</ul>
</div>
<br />
<br />
<br />
<strong>Tags for comments, trackback, and pingback</strong> are:<br />
<br />
<strong>&lt;?php comments_popup_script() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span></strong><br />
This will include the javascript that is required to open comments, trackback and pingback in popup windows.<br />
You should put this tag before the &lt;/head> tag in your template.<br />
<div class="params">Parameters:<ul>
<li>width (default is 400)</li>
<li>height (default is 400)</li>
<li>file name, in case you want to use a different template for comments (default is b2commentspopup.php)</li>
<li>file name, in case you want to use a different template for TrackBacks (default is b2trackbackpopup.php)</li>
<li>file name, in case you want to use a different template for Pingbacks (default is b2pingbackspopup.php)</li>
</ul>
</div>
<br />
<br />
<strong>&lt;?php comments_popup_link() ?&gt;<span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span></strong><br />
This will display the link to open comments in a popup window, with the number of comments.<br />
To edit the popup window's template, edit the file b2commentspopup.php (it's the default one for comments popup).<br />
<br />
Note:<br />
The same tags exist for TrackBack and Pingback, respectively named '<b>trackback_popup_link()</b>' and '<b>pingback_popup_link()</b>'. They take the same parameters.<br />
<br />
<div class="params">Parameters:<ul>
<li>string for comment-less posts (default is &quot;no comments&quot;)</li>
<li>string for posts with one comment (default is &quot;1 comment&quot;)</li>
<li>string for posts with 2 or more comments (default is &quot;% comments&quot;)<br />Note here that the sign &quot;%&quot; is then replaced by the number of
comments.</li>
<li>string for CSS class, so you can have a styled link with class="" (default is empty, no CSS class applied)</li>
</ul>
</div>
<br />
<br />
<strong>&lt;?php comments_link() ?&gt;<br />
</strong> This is a bit like permalink_link, it will display an URL to the
comments page, but again you'll have to create the link tag.<br />
<br />
Note:<br />
The same tags exist for TrackBack and Pingback, respectively named '<b>trackback_link()</b>' and '<b>pingback_link()</b>'. They take the same parameters.<br />
<br />
<div class="params">Parameters:<ul>
<li>file name, in case you want to use a different template for comments (default is the current template)</li>
</ul>
</div>
<br />
<br />
<strong>&lt;?php comments_number() ?&gt;</strong> <br />
This displays the number of comments that have been posted on this post.
Example: &quot;5 comments&quot;.<br />
<br />
Note:<br />
The same tags exist for TrackBack and Pingback, respectively named '<b>trackback_number()</b>' and '<b>pingback_number()</b>'. They take the same parameters.<br />
<br />
<div class="params">Parameters:<ul>
<li>string for comment-less posts (default is &quot;no comments&quot;)</li>
<li>string for posts with one comment (default is &quot;1 comment&quot;)</li>
<li>string for posts with 2 or more comments (default is &quot;% comments&quot;)<br />Note here that the sign &quot;%&quot; is then replaced by the number of
comments.</li>
</ul>
</div>
<br />
Example: <em>&lt;?php comments_number(&quot;no comment&quot;,&quot;1 comment&quot;,&quot;%
comments&quot;) ?&gt;</em><br />
<br />
This tag differs from v0.5's tag because in v0.5 and prior, it would only
display a number, not a text with it, so you could have terrible things
like &quot;1 comments&quot; (doh !)<br />
<br />
<strong>Necessary: &lt;?php include(&quot;b2comments.php&quot;) ?&gt;</strong><br />
you'll put this line where you want the comments to be placed on your
page.<br />
typically, under the post itself. don't worry, the comments only appear
if the page is called in the comments mode. (like this: url?c=1)<br />
<br />
<strong>Necessary: &lt;?php include(&quot;b2trackback.php&quot;) ?&gt;</strong><br />
you'll put this line where you want the TrackBacks to be placed on your
page.<br />
typically, under the post itself. don't worry, the TrackBacks only appear
if the page is called in the TrackBacks mode. (like this: url?tb=1)<br />
<br />
<strong>Necessary: &lt;?php include(&quot;b2pingbacks.php&quot;) ?&gt;</strong><br />
you'll put this line where you want the Pingbacks to be placed on your
page.<br />
typically, under the post itself. don't worry, the Pingbacks only appear
if the page is called in the Pingbacks mode. (like this: url?pb=1)<br />
<br />
<br />
<strong>Tags that go in b2comments.php, b2trackback.php, b2pingbacks.php:</strong> (these are easy too)<br />
<br />
<strong>&lt;?php comment_author() ?&gt;</strong><br />
<strong>&lt;?php comment_author_email() ?&gt; </strong> - displays the e-mail address, but not the link<br />
<strong>&lt;?php comment_author_url() ?&gt; </strong>- displays the url, but not the
link<br />
<br />
<strong>&lt;?php comment_author_email_link() ?&gt; </strong> <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span>- displays a link to the comment's author's e-mail<br />
<strong>&lt;?php comment_author_url_link() ?&gt; </strong> <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span>- displays a link to the comment's author's website<br />
<div class="params">Parameters for <strong>comment_author_email_link()</strong> and <strong>comment_author_url_link()</strong>:<ul>
<li>string for the link (default: "email"/"url" depending on the tag)</li>
<li>string to display before the link (default is " - ")</li>
<li>string to display after the link (default is blank)</li>
</ul>
</div>
<br />
<strong>&lt;?php comment_author_IP() ?&gt;</strong>
- displays the IP of the comment's author<br />
<strong>&lt;?php comment_text() ?&gt;<br />
&lt;?php comment_date() ?&gt; </strong>- unlike the_date(), this tag
appears on every comment<strong><br />
&lt;?php comment_time() ?&gt;</strong><br />
<div class="params">Parameters for <strong>comment_date()</strong> and <strong>comment_time()</strong>:<ul>
<li>format string (default is "d.m.y"/"H:i:s" depending on the tag)</li>
</ul>
</div>
<br />
<strong>&lt;?php trackback_url() ?&gt; <span style="font-family: Courier New, Courrier, mono; color: #ff9900; font-weight:bold;">*</span></strong><br />
This tag is out of the b2 TrackBacks loop.<br />
It will output the URL to TrackBack the post, that other people can copy and use in b2's posting interface to trackback this post.<br />
<div class="params">Parameters:<ul>
<li>no parameter</li>
</ul>
</div>
<br />
<br />
In b2comments.php b2trackback.php and b2pingbacks.php, like in the main template file, please keep the first
PHP lines, the &quot;while&quot; lines, and the &quot;}&quot; lines.<br />
You can modify the form, but do not remove &quot;&lt;?php echo ... ?&gt;&quot;
and all the name=&quot;...&quot; attributes.<br />
<br />
<br />
To <strong>include your archives:</strong><br />
<br />
<strong>&lt;?php include(&quot;b2archives.php&quot;) ?&gt;</strong><br />
this will include the links to your archives, one link per line.<br />
if your archive mode is &quot;monthly&quot;, it will display the names
of the months and the years, like &quot;july 2001&quot;.<br />
if your archive mode is &quot;post by post&quot;, it will display the
titles of your posts, one title per line. if a post is untitled it will
display the ID (number) of this post.<br />
<br />
<br />
To <strong>include the calendar:</strong><br />
<br />
<strong>&lt;?php include(&quot;b2calendar.php&quot;) ?&gt;</strong><br />
this will include a table with the current month's calendar, each day when
you posted shows a link to this day's posts. You can customise this table
with CSS classes:
<div class="params">
<strong>.b2calendarmonth {}</strong><br /> &nbsp; &nbsp; <i>the style that is used to display the month and year</i><br />
<strong>.b2calendartable {}</strong><br /> &nbsp; &nbsp; <i>the style of the &lt;table> tag (border etc...)</i><br />
<strong>.b2calendarrow {}</strong><br /> &nbsp; &nbsp; <i>the style of the &lt;tr> tag</i><br />
<strong>.b2calendarheadercell {}</strong><br /> &nbsp; &nbsp; <i>the style of the &lt;td> tag that shows the weekdays on the top of the table</i><br />
<strong>.b2calendarcell {}</strong><br /> &nbsp; &nbsp; <i>the style of the &lt;td> tags that show the days</i><br />
<strong>.b2calendaremptycell {}</strong><br /> &nbsp; &nbsp; <i>the style of the &lt;td> tags that are empty</i><br />
<strong>.b2calendarlinkpost {}</strong><br /> &nbsp; &nbsp; <i>the style of the link to the post</i><br />
<strong>.b2calendartoday {}</strong><br /> &nbsp; &nbsp; <i>the style of the day if it is today</i>
</div></blockquote>
<p>&nbsp;</p>
<a name="usage"></a><h1>usage:</h1>
<p>b2 relies a lot on the querystring, these variables passed with the URL
(note: to pass variables in the querystring, preceed the first variable
name with a '?' question mark and every other variables with a '&amp;'
sign.)<br />
Most of the time you won't have to do anything about it, but if you want
to know how it works, it's here:</p>
<p>How to use the QueryString:</p>
<blockquote> index.php<strong>?m=200107</strong> will display the month of July 2001.<br />
<br />
index.php<strong>?m=20010701</strong> will display all posts from July 1st, 2001.<br />
<br />
index.php<strong>?w=20</strong> will display the posts from the 20th week of the year, where January 1st is in the first week (according to PHP).<br />
<br />
index.php<strong>?p=50</strong> will display the post labeled #50 in the database.<br />
<br />
index.php<strong>?s=blue+house</strong> will display the posts that match the
search request &quot;blue house&quot;.<br />
here is the code for a simple search box:<br />
<br />
<code>&lt;form name=&quot;searchform&quot; action=&quot;&lt;?php echo
$PHP_SELF ?&gt;&quot; method=&quot;get&quot;&gt;<br />
&lt;input type=&quot;text&quot; name=&quot;s&quot; /&gt;<br />
&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;search&quot;
/&gt;<br />
&lt;/form&gt; </code><br />
<br />
index.php<strong>?cat=1</strong> will display all posts that belong to category #1 (1
is the default). you can add/rename/delete categories from b2's interface.<br />
<br />
index.php<strong>?author=1</strong> will display all posts from the author #1<br />
<br />
index.php<strong>?p=50&c=1</strong> will display the comments
and a form to add a comment below the post.<br />
you should use this variable only with <strong>p=</strong>, example: index.php<strong>?p=50&amp;c=1</strong>.<br />
<br />
index.php<strong>?p=50&tb=1</strong> will display the TrackBacks to the post #50.<br />
you should use this variable only with <strong>p=</strong>, example: index.php<strong>?p=50&amp;tb=1</strong>.<br />
<br />
index.php<strong>?p=50&pb=1</strong> will display the Pingbacks to the post #50.<br />
you should use this variable only with <strong>p=</strong>, example: index.php<strong>?p=50&amp;pb=1</strong>.<br />
<br />
index.php<strong>?p=50&more=1</strong> will display the extended entries' text. this,
too, should be used only with <strong>p=</strong>, for individual entries.<br />
<br />
index.php<strong>?p=50&page=1</strong> will display the first page of post #50. this,
again, should be used only with <strong>p=</strong>, for individual entries.<br />
<br />
You can also mix these variables, example: index.php<strong>?m=200107&amp;s=hotdog</strong>
will display the posts that match the search request &quot;hotdog&quot;,
but only in July 2001. </blockquote>
<p>&nbsp;</p>
<a name="xmlrpc"></a><h1>XMLRPC interface:</h1>
<p>b2 now has a XMLRPC interface. The only API available right now is the Blogger
API (complete specs <a href="http://www.tswoam.co.uk/blogger_method_listing.html">here</a>). There are talks about a new API that would cover a lot of weblog/CMS systems
in the future: when it's ready, b2 will support it.<br />
<br />
The <a href="http://plant.blogger.com/api">Blogger API</a> has been
completely emulated on b2, with some little differences:</p>
<ul>
<li>using <em>blogger.getRecentPosts</em> with the number 'zero' returns all
posts in the blog</li>
<li><em>blogger.getTemplate</em> fetches your file $blogfilename (as specified in
the config), while <em>blogger.setTemplate</em> overwrites it with the edited
data</li>
<li><em>blogger.getUsersBlogs</em> is a dummy function that returns '1' and
$blogname, since b2 supports only one blog as of now</li>
</ul>
<p>If you use blogger.newPost, your post is submitted without title and in category
#1.<br /><br />
However, you can type &lt;title>my title&lt;/title> and/or &lt;category>2&lt;category>
in the body of your post to make its title be 'my title' and its category be #2
(refer to your categories section to find out the ID numbers of the categories). b2 would then delete that extra info from the body of your post once it is posted.<br /><br />
<br />
You can now post to your b2 blog with tools like <a href="http://blogbuddy.sourceforge.net">BlogBuddy</a>, <a href="http://bloggar.cjb.net">Bloggar</a>, <a href="http://www.ubique.ch/wapblogger/">WapBlogger</a> (post from your Wap cellphone!), <a href="http://radio.userland.com">Radio Userland</a> (which means you can use Radio's email-to-blog feature), and other tools that support the Blogger API ! :)<br /><br />
Your XMLRPC server/path are as described here: if you login to b2 on http://mydomain.com/me/b2login.php, then you have:</p>
<ul>
<li>server: http://mydomain.com/me</li>
<li>path: /me/xmlrpc.php</li>
<li>complete URL (just in case): http://mydomain.com/me/xmlrpc.php</li>
</ul>
<p>There's also a b2-specific method: b2.getCategories. Request it with 3 strings: blog_ID (use '1'), username, password. The response is an array of structs with strings categoryID and categoryName.<br />
<br />
</p>
<p>&nbsp;</p>
<a name="postviaemail"></a><h1>Post via Email:</h1>
<p>You can post news from an email client !<br />
But first you'll have to edit b2config.php, filling the appropriate values for your POP3 email account (this interface doesn't support IMAP yet, only POP3, sorry).<br />
<br />
Once you have edited the config options, you can make your webserver execute b2mail.php every set amount of time (depending on your host's performance, this script can be resource intensive, so don't make it run every minute or you'll be kicked).<br />
You can do it with Cron-jobs, or if your host doesn't support it you can look into the various website-monitoring services, and make them check your b2mail.php URL.<br />
<br />
<b>Preliminary advice:</b><br />
It is strongly advised to send your email as text-only (Outlook and Outlook Express default to 'html', which may cause problems), but HTML email could work (the script would strip all your html tags though...).<br />
It is also advised not to use your public email address, but create a new one especially for this script. If you use your public email address and the script goes crazy posting every email on your blog and deleting all your emails, I can't take responsibility for this.<br />
Make sure you delete any email sent to your blog in your 'Sent' folder too, just in case (you don't want someone to find your login and password in the 'Sent' folder).<br />
<br />
The script will <i>delete</i> the emails that were used to post stuff on your weblog if it successfully posted your stuff. If it didn't manage to post, the email is not deleted.<br />
<br />
<b>How to post:</b><br />
Now to post something, here's how your email should look like:</p>
<div class="params">
<b>To:</b> address@domain.com <span style='color: #999'>(you set it in the config file)</span><br />
<b>Subject:</b> blog:the post's title <span style='color: #999'>(you can change 'blog:' in the config file)</span><br />
<b>Body:</b><br>
login:password <span style='color: #999'>(example: <i>Jack:Starwars</i>)</span><br />
The content of the post, blah blah blah.<br />
More blah blah. ___
</div>
<p>
Subject must start with 'blog:', or any string you set in the config file (so that the script doesn't check EVERY email in your mailbox).<br />
Body's first line must always be login:password, else the script will just skip the email.<br />
If you don't use '___' (or any body terminator that you set in the config file), the script will post the whole body, which is not what you want if you send email with Yahoo or Hotmail (you don't want their ads on your blog, do you ?).<br />
<br />
<b>Special cases for mobile phone email:</b><br />
Some mobile phone service providers may allow you to send email with your mobile phone or PDA, but on such devices you can't always include line breaks. In such case, you have to set <i>$use_phoneemail = 1</i> in b2config.php, and then here's how you write the email:</p>
<div class="params">
<b>To:</b> address@domain.com<br />
<b>Subject:</b> blog:the post's title <b>:::</b><br />
<b>Body:</b><br>
login:password <b>:::</b> The content of the post, blah blah blah.___
</div>
<p>You will have to append ':::' (or whatever string you set in the config file) after the subject, and after the login:password.<br />
<br />
Some mobile phone service providers may not allow you to set a subject, and they'll make the subject be the first characters of the body, in which case you would send an email like this:</p>
<div class="params">
<b>To:</b> address@domain.com<br />
<b>Body:</b><br>
blog:the post's title <b>:::</b> login:password <b>:::</b> The content of the post, blah blah blah.___
</div>
<p>&nbsp;</p>
<a name="notes"></a><h1>notes: </h1>
<p>On multi-user:</p>
<blockquote>You don't invite users, they can register on b2register.php.<br />
Then you (as an admin) click the &quot;+&quot; next to their name in the
user-list, to upgrade their level to 1 or more, so they can post. If you
don't want an user to post anymore, just click &quot;-&quot; until their
level is 0.<br />
Note: you can now disable users registration altogether from the config file.<br />
<strong>Levels</strong> are these:<br />
0 - new user: can't post.<br />
1 - user: can post &amp; edit/delete their own posts.<br />
3 &amp; more - admin: can post, edit/delete other people's posts, and
change the options.<br />
Any user whose level is higher than 1, can edit/delete the posts and change
the level of users whose level is inferior. Example: a level 2 user is
not an admin, but can edit the posts of level 1 users, and up the level
of a new user from 0 to 1.<br />
<br />
Usually, you'll want to have a team of only level 1 users except you.
;)<br />
<strong>Note:</strong> you can modify a variable in b2config.php, to enable new
users to post once they've registered.<br />
If you don't want users to register on your blog at all, just delete b2register.php
once you've registered your user account.</blockquote>
<p><br />
Final notes:</p>
<blockquote>b2 is functionnal, but a lot of coding and code clean-up remain
to be done.<br />
If you've got suggestions, ideas, or comments, or if you found a bug,
why not joining us in the <a href="http://tidakada.com/board/">Forums</a>
?<br />
If you can code in PHP, you'll see the structure of b2 is flexible enough
to allow for more functions and sections to be added.</blockquote>
<p><br />
Copyright notes:</p>
<blockquote>b2 is &copy;2001, 2002 Michel Valdrighi - <a href="mailto:m@tidakada.com?subject=b2">m@tidakada.com</a>
- <a href="http://tidakada.com" target="_blank">http://tidakada.com</a><br />
Wherever third party code has been used, credit has been given in the
code's comments.<br />
b2 is released under the GPL (see license.txt).</blockquote>
</td>
</tr>
</table>
<p>&nbsp;</p>
</body>
</html>

1
readme.txt Normal file
View File

@ -0,0 +1 @@
Holder

41
sproxy.pl Normal file
View File

@ -0,0 +1,41 @@
#!/usr/bin/perl
print "Content-type: text/html\n\n";
if ($ENV{'REQUEST_METHOD'} ne 'POST')
{
print <<"HTML";
<HTML>
<BODY>
only method POST is supported here.
</BODY>
</HTML>
HTML
exit;
}
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
print $value;
if($name eq "f")
{
print "<textarea name=TextBox1>"
}
if($name eq "g")
{
print "</textarea><textarea name=TextBox2>"
}
if($name eq "h")
{
print "</textarea>"
}
}
exit;