From b43564cb29d88cbd5295c5f4b52884a8e530929e Mon Sep 17 00:00:00 2001 From: saxmatt Date: Tue, 1 Apr 2003 14:12:34 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: http://svn.automattic.com/wordpress/trunk@3 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- b2.php | 57 +++ b2bookmarklet.php | 254 ++++++++++++ b2calendar.php | 283 ++++++++++++++ b2categories.php | 176 +++++++++ b2comments.php | 94 +++++ b2comments.post.php | 137 +++++++ b2commentspopup.php | 133 +++++++ b2config.php | 352 +++++++++++++++++ b2edit.php | 342 ++++++++++++++++ b2header.php | 177 +++++++++ b2install.php | 102 +++++ b2login.php | 382 ++++++++++++++++++ b2mail.php | 262 +++++++++++++ b2options.php | 219 +++++++++++ b2pingbacks.php | 50 +++ b2pingbackspopup.php | 75 ++++ b2profile.php | 468 ++++++++++++++++++++++ b2rdf.php | 53 +++ b2register.php | 342 ++++++++++++++++ b2rss.php | 34 ++ b2rss.xml | 1 + b2rss2.php | 45 +++ b2sidebar.php | 168 ++++++++ b2spell.php | 97 +++++ b2team.php | 212 ++++++++++ b2template.php | 156 ++++++++ b2trackback.php | 158 ++++++++ b2trackbackpopup.php | 80 ++++ b2upload.php | 250 ++++++++++++ blog.header.php | 272 +++++++++++++ blogger-2-b2.php | 229 +++++++++++ example.htaccess | 15 + gm-2-b2.php | 326 ++++++++++++++++ index.php | 123 ++++++ layout2b.css | 179 +++++++++ license.txt | 280 +++++++++++++ phpinfo.php | 3 + print.css | 20 + readme.html | 912 +++++++++++++++++++++++++++++++++++++++++++ readme.txt | 1 + sproxy.pl | 41 ++ 41 files changed, 7560 insertions(+) create mode 100644 b2.php create mode 100644 b2bookmarklet.php create mode 100644 b2calendar.php create mode 100644 b2categories.php create mode 100644 b2comments.php create mode 100644 b2comments.post.php create mode 100644 b2commentspopup.php create mode 100644 b2config.php create mode 100644 b2edit.php create mode 100644 b2header.php create mode 100644 b2install.php create mode 100644 b2login.php create mode 100644 b2mail.php create mode 100644 b2options.php create mode 100644 b2pingbacks.php create mode 100644 b2pingbackspopup.php create mode 100644 b2profile.php create mode 100644 b2rdf.php create mode 100644 b2register.php create mode 100644 b2rss.php create mode 100644 b2rss.xml create mode 100644 b2rss2.php create mode 100644 b2sidebar.php create mode 100644 b2spell.php create mode 100644 b2team.php create mode 100644 b2template.php create mode 100644 b2trackback.php create mode 100644 b2trackbackpopup.php create mode 100644 b2upload.php create mode 100644 blog.header.php create mode 100644 blogger-2-b2.php create mode 100644 example.htaccess create mode 100644 gm-2-b2.php create mode 100644 index.php create mode 100644 layout2b.css create mode 100644 license.txt create mode 100644 phpinfo.php create mode 100644 print.css create mode 100644 readme.html create mode 100644 readme.txt create mode 100644 sproxy.pl diff --git a/b2.php b/b2.php new file mode 100644 index 0000000000..e485826010 --- /dev/null +++ b/b2.php @@ -0,0 +1,57 @@ + + + + +<?php echo $blogname ?> + + + + + + + + + + + + + + + + + + +",""); ?> + +

+ + + (category: )
+Pages: ","
","number") ?> +
+posted by @ +
+ + +

+ + + + + + + +
[powered by b2.]
+
+login
+register
+ +$querycount queries - ".number_format(timer_stop(),3)." seconds

"; +} +?> + + + \ No newline at end of file diff --git a/b2bookmarklet.php b/b2bookmarklet.php new file mode 100644 index 0000000000..b45fd2c3c4 --- /dev/null +++ b/b2bookmarklet.php @@ -0,0 +1,254 @@ + */ + +$mode = "bookmarklet"; + +$standalone = 1; +require("./b2header.php"); + +if ($user_level == 0) +die ("Cheatin' uh ?"); + +if ($a=="b") { + +?> + + + + + + +b2 > bookmarklet + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + +
  + + + +
Title
+
Category
+
  + + + +
Post
+ + + + +
+ + + + + + +
+ tabindex="4" class="checkbox" id="autobr" /> + + +
+ + + + + + + + + + + + += $fileupload_minlevel) && ((ereg(" ".$user_login." ", $fileupload_allowedusers)) || (trim($fileupload_allowedusers)=="")) ) { ?> + + + + +
  +TrackBack an URL:
+ +
+
+ +
+ + +
+ + + + + + + +
+ + + \ No newline at end of file diff --git a/b2calendar.php b/b2calendar.php new file mode 100644 index 0000000000..1567ceabd4 --- /dev/null +++ b/b2calendar.php @@ -0,0 +1,283 @@ +'; +$calendarmonthend = ''; + +$calendartablestart = ''; +$calendartableend = '
'; + +$calendarrowstart = ''; +$calendarrowend = ''; + +$calendarheaderdisplay = 1; // set this to 0 if you don't want to display the "Mon Tue Wed..." header +$calendarheadercellstart = ''; // please leave $abbr there ! +$calendarheadercellend = ''; +$calendarheaderabbrlenght = 3; // lenght of the shortened weekday + +$calendarcellstart = ''; +$calendarcellend = ''; + +$calendaremptycellstart = ''; +$calendaremptycellend = ''; + +$calendaremptycellcontent = ' '; + +/* 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 = '<  '; + $ak_previous_month_active = '<  '; + $ak_next_month_dim = '  >'; + $ak_next_month_active = '  >'; +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."
".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 ''; + } + else { + echo ''; + } + } + if ($calendartoday) { + echo ''; + } + echo date('j',$i); + if ($calendartoday) { + echo ''; + } + if ($calendarthereisapost) { + echo ''; + } + echo $calendarcellend."\n"; + } + $j = $j + 1; + if ($j == 7) { + $j = 0; + $newrow = 1; + } +} + +echo $calendarrowend."\n"; +echo $calendartableend; + +?> diff --git a/b2categories.php b/b2categories.php new file mode 100644 index 0000000000..0b73da77ee --- /dev/null +++ b/b2categories.php @@ -0,0 +1,176 @@ + */ + +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$cat_name"); + + 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 $cat_name 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 $cat_name".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 $cat_name"); + + 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); + ?> + + +

Old name:

+

+

+ New name:
+ + " /> +
+ +
+ + + $cat_name: ".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.
Ask for a promotion to your blog admin :)"); + } + ?> + + + + + + +
+
+ Edit a category:
+ \n"; + while($row = mysql_fetch_object($result)) { + echo "\t\n"; + } + echo "\n"; + ?>
+ + +
+

+

+ Add a category:
+

+ +
+
+ + +
+ + + Note:
+ Deleting a category does not delete posts from that category.
It will just set them back to the default category . + + + */ +include($b2inc."/b2footer.php"); ?> \ No newline at end of file diff --git a/b2comments.php b/b2comments.php new file mode 100644 index 0000000000..669a24f034 --- /dev/null +++ b/b2comments.php @@ -0,0 +1,94 @@ + %' AND comment_content NOT LIKE '%%' ORDER BY comment_date"; + $resultc = mysql_query($queryc); + if ($resultc) { + ?> + + + + +

 

+
:: comments
+

 

+ + comment_ID); ?> + + + + +

+ +
+ +
+ @ +

+

 

+ + + + + + +

No Comment on this post so far.

+ + + +
:: leave a comment
+

 

+ + + + +
+ + " /> + +

+ name
+ +

+ +

+ email
+ +

+ +

+ url
+ +

+ +

+ your comment
+ +

+ +

+ tabindex="6" /> Auto-BR (line-breaks become <br> tags)
+ +

+ +
+ + + +

 

+
:: return to the blog
+ + \ No newline at end of file diff --git a/b2comments.post.php b/b2comments.post.php new file mode 100644 index 0000000000..c5f01794c4 --- /dev/null +++ b/b2comments.post.php @@ -0,0 +1,137 @@ + $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...
Contact the webmaster"); + + 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"); +} + +?> diff --git a/b2commentspopup.php b/b2commentspopup.php new file mode 100644 index 0000000000..f2d18f7395 --- /dev/null +++ b/b2commentspopup.php @@ -0,0 +1,133 @@ + + + +<?php echo $blogname ?> - comments on '<?php the_title() ?>' + + + + + + + + + + + + + + +
+ +
+ +%' ORDER BY comment_date"; +$resultc = mysql_query($queryc); +if ($resultc) { +?> + + + + + + +

 

+
:: comments
+

 

+ +comment_ID); +?> + + +

+ +
+ +
+ @ +

+

 

+ + + + + +
:: leave a comment
+

 

+ + + + +
+ + " /> + +

+ name
+ +

+ +

+ email
+ +

+ +

+ url
+ +

+ +

+ your comment
+ +

+ +

+ tabindex="6" /> Auto-BR (line-breaks become <br> tags)
+ +

+ +
+ + + + +

 

+ + + + +
+ + + + + + +
+ +

+[powered by b2.] +

+ + + + \ No newline at end of file diff --git a/b2config.php b/b2config.php new file mode 100644 index 0000000000..15ad079376 --- /dev/null +++ b/b2config.php @@ -0,0 +1,352 @@ + 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 '' instead of '' + +$comment_allowed_tags = '


'; + +# 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 = '&'; + + + + +// ** 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; + +?> \ No newline at end of file diff --git a/b2edit.php b/b2edit.php new file mode 100644 index 0000000000..a5a2f5c9da --- /dev/null +++ b/b2edit.php @@ -0,0 +1,342 @@ + */ + +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 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. Go back !"); + $authordata = get_userdata($postdata["Author_ID"]); + if ($user_level < $authordata[13]) + die ("You don't have the right to edit ".$authordata[1]."'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.
You can also e-mail the admin to ask for a promotion.
When you're promoted, just reload this page and you'll be able to blog. :) + + 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. Go back !"); + $authordata = get_userdata($postdata["Author_ID"]); + + if ($user_level < $authordata[13]) + die ("You don't have the right to delete ".$authordata[1]."'s posts."); + + $query = "DELETE FROM $tableposts WHERE ID=$post"; + $result = mysql_query($query) or die("Oops, no post with this ID. Go back !"); + if (!$result) + die("Error in deleting... contact the webmaster..."); + + $query = "DELETE FROM $tablecomments WHERE comment_post_ID=$post"; + $result = mysql_query($query) or die("Oops, no comment associated to that post. Go back !"); + + 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. Go back !"); + $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. Go back !"); + + $query = "DELETE FROM $tablecomments WHERE comment_ID=$comment"; + $result = mysql_query($query) or die("Oops, no comment with this ID. Go back !"); + + 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 "

"; + + } + + } 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.
You can also e-mail the admin to ask for a promotion.
When you're promoted, just reload this page and you'll be able to blog. :) +
"; + + } + + include($b2inc."/b2edit.showposts.php"); + +} + + +/* */ +include($b2inc."/b2footer.php") ?> \ No newline at end of file diff --git a/b2header.php b/b2header.php new file mode 100644 index 0000000000..f1d43ddfa6 --- /dev/null +++ b/b2header.php @@ -0,0 +1,177 @@ +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 + + +b2 > <?php echo $title; ?> + + + + + + + + + + + + + + + + + +
+ +
+ +
+ \ No newline at end of file diff --git a/b2install.php b/b2install.php new file mode 100644 index 0000000000..8715650e63 --- /dev/null +++ b/b2install.php @@ -0,0 +1,102 @@ + + +b2 > Installation + + + +$msg

"; + echo "

query:
$sql

"; + echo "

error:
$error

"; + die(); +} + +$connexion = mysql_connect($server,$loginsql,$passsql) or die("Can't connect to the database
".mysql_error()); +$dbconnexion = mysql_select_db($base, $connexion); + +if (!$dbconnexion) { + echo mysql_error(); + die(); +} + +echo "Now creating the necessary tables in the database...

"; + + +# 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
"; + +// $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
"; + +// $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.
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
"; + +// $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
"; + +// $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
"; +?> + +
+Installation successful !
+
+Now you can log in with the login "admin" and password "".

+
+Note that password carefully ! It is a random 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. + + + \ No newline at end of file diff --git a/b2login.php b/b2login.php new file mode 100644 index 0000000000..9ed4c29a43 --- /dev/null +++ b/b2login.php @@ -0,0 +1,382 @@ + $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
".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="ERROR: the login field is empty"; + return false; + } + + if (!$password) { + $error="ERROR: 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="ERROR: 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="ERROR: 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": + + ?> + +b2 > Lost password ? + + + + + + + + + +
+ + + + + + + + + + +
+visit b2's homepage + 
+ +

Type your login here and click OK. You will receive an email with your password.

+$error
 "; +?> + +
+ + + + + + +
login   
    
+ +
+ +
+
+ + + + The email could not be sent.
\n"; + echo "Possible reason: your host may have disabled the mail() function...

"; + die(); + } else { + echo "

The email was sent successfully to $user_login's email address.
\n"; + echo "Click here to login !

"; + 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(); + } + ?> + +b2 > Login form + + + + + + + + + +
+ + + + + + + + + + +
+visit b2's homepage + +register ?
+lost your password ? +
+ +$error
 "; +?> + +
+ + + + + + + + + + + + + + + +
login   
password   
    
+ +
+ +
+
+ + + + \ No newline at end of file diff --git a/b2mail.php b/b2mail.php new file mode 100644 index 0000000000..1539eaae2c --- /dev/null +++ b/b2mail.php @@ -0,0 +1,262 @@ +connect($mailserver_url, $mailserver_port)) { + echo "Ooops $pop3->ERROR
\n"; + exit; +} + +$Count = $pop3->login($mailserver_login, $mailserver_pass); +if((!$Count) || ($Count == -1)) { + echo "

Login Failed: $pop3->ERROR

\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
\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
'; + continue; + } + + if (preg_match('/'.$subjectprefix.'/', $subject)) { + + $userpassstring = ''; + + echo '
'; + echo "

$iCount

Subject: $subject

\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], '


'); + } + $content = trim($content); + + echo "

Content-type: $content_type, boundary: $boundary

\n"; + echo "

Raw content:

".$content.'

'; + + $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 "

Login: $user_login, Pass: $user_pass

"; + + $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 '

Wrong login or password.

'; + 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

Posted title: $post_title
"; + echo "\nPosted content:

".$content.'

'; + + if(!$pop3->delete($iCount)) { + echo '

oops '.$pop3->ERROR.'

'; + $pop3->reset(); + exit; + } else { + echo "

Mission complete, message $iCount deleted

"; + } + + } else { + echo '

Level 0 users can\'t post.

'; + } + echo '
'; + if ($output_debugging_info) { + ob_end_flush(); + } else { + ob_end_clean(); + } + } +} + +$pop3->quit(); + +timer_stop($output_debugging_info); +exit; + +?> diff --git a/b2options.php b/b2options.php new file mode 100644 index 0000000000..b27cd85fca --- /dev/null +++ b/b2options.php @@ -0,0 +1,219 @@ + */ + +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; $iwebmaster !

".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.
Ask for a promotion to your blog admin :)"); + } + ?> + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Show:" size="3"> + +
Archive mode: +
Time difference: + if you're not on the timezone of your server +
AutoBR: + converts line-breaks into <br /> tags. (note) +
Date format: + (note) +
Time format: + (note) +
  + +
+ + + +
+ +
+ + + + About Date & Time formats:
+
+ + You can format the date & time in many ways, using the PHP syntax.
+ As quoted from the PHP manual, here are the letters you can use:
+
+ The following characters are recognized in the format string:
+ a - "am" or "pm"
+ A - "AM" or "PM"
+ B - Swatch Internet time
+ d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
+ D - day of the week, textual, 3 letters; i.e. "Fri"
+ F - month, textual, long; i.e. "January"
+ g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
+ G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
+ h - hour, 12-hour format; i.e. "01" to "12"
+ H - hour, 24-hour format; i.e. "00" to "23"
+ i - minutes; i.e. "00" to "59"
+ I (capital i) - "1" if Daylight Savings Time, "0" otherwise.
+ j - day of the month without leading zeros; i.e. "1" to "31"
+ l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"
+ L - boolean for whether it is a leap year; i.e. "0" or "1"
+ m - month; i.e. "01" to "12"
+ M - month, textual, 3 letters; i.e. "Jan"
+ n - month without leading zeros; i.e. "1" to "12"
+ r - RFC 822 formatted date; i.e. "Thu, 21 Dec 2000 16:01:07 +0200" (added in PHP 4.0.4)
+ s - seconds; i.e. "00" to "59"
+ S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"
+ t - number of days in the given month; i.e. "28" to "31"
+ T - Timezone setting of this machine; i.e. "MDT"
+ U - seconds since the epoch
+ w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
+ Y - year, 4 digits; i.e. "1999"
+ y - year, 2 digits; i.e. "99"
+ z - day of the year; i.e. "0" to "365"
+ 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.
+
+ Unrecognized characters in the format string will be printed as-is. +
+ For more information and examples, check the PHP manual on this page. + + + + */ +include($b2inc."/b2footer.php") ?> \ No newline at end of file diff --git a/b2pingbacks.php b/b2pingbacks.php new file mode 100644 index 0000000000..efed31b90e --- /dev/null +++ b/b2pingbacks.php @@ -0,0 +1,50 @@ + + + %' ORDER BY comment_date"; + $resultc = mysql_query($queryc); if ($resultc) { + ?> + + + + +
:: pingbacks
+ + + comment_ID); ?> + + + + + + +

+ +
+· +Pingback from on @ +

+

 

+ + + + + + +

No Pingback on this post so far.

+ + + + +

 

+ + + + + + + + diff --git a/b2pingbackspopup.php b/b2pingbackspopup.php new file mode 100644 index 0000000000..5048a30a9f --- /dev/null +++ b/b2pingbackspopup.php @@ -0,0 +1,75 @@ + + + +<?php echo $blogname ?> - pingbacks on '<?php the_title() ?>' + + + + + + + + + + + + + + +
+ +
+ + %' ORDER BY comment_date"; $resultc = mysql_query($queryc); if ($resultc) { ?> + + +

 

+
:: pingbacks
+

 

+ + comment_ID); $wxcvbn_pb++; ?> + + + + +

+ +
+· +Pingback from on @ +

+

 

+ + + + + + +

No Pingback on this post so far.

+ + + +

 

+ + + + +
+ + + +
+ +

+[powered by b2.] +

+ + + + \ No newline at end of file diff --git a/b2profile.php b/b2profile.php new file mode 100644 index 0000000000..67f1e94408 --- /dev/null +++ b/b2profile.php @@ -0,0 +1,468 @@ + */ + +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; $iERROR
: 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 ("ERROR: 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 ("ERROR: please type your e-mail address"); + return false; + } else if (!is_email($HTTP_POST_VARS["newuser_email"])) { + die ("ERROR: the email address isn't correct"); + return false; + } + + if ($HTTP_POST_VARS["pass1"] == "") { + if ($HTTP_POST_VARS["pass2"] != "") + die ("ERROR: you typed your new password only once. Go back to type it twice."); + $updatepassword = ""; + } else { + if ($HTTP_POST_VARS["pass2"] == "") + die ("ERROR: you typed your new password only once. Go back to type it twice."); + if ($HTTP_POST_VARS["pass1"] != $HTTP_POST_VARS["pass2"]) + die ("ERROR: 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 ("ERROR: couldn't update your profile... please contact the webmaster !

$query

".mysql_error()); + } + + ?> + + + Profile updated !
+ If that window doesn't close itself, close it yourself :p + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
login
first name
last name
nickname
email
URL
ICQ 0) { echo make_clickable("icq:".$profiledata["user_icq"]); } ?>
AIM
MSN IM
YahooIM
+ +
+ + + + + + + + + + + + + + +
+ ID
+ level +
+ posts + +
+ identity
+ +
+ +
+ +
+ + + + + + +
+ +

To have a one-click bookmarklet, just copy and paste this
into a new text file:

+ +
+

Save it as b2.reg, and double-click on this file in an Explorer
+ window. Answer Yes to the question, and restart Internet Explorer.

+ That's it, you can now right-click in an IE window and select
+ 'Post to b2' to make the bookmarklet appear :)

+ +

+

+ +
+

+
+ + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
login
first name" class="postform" />
last name" class="postform" />
nickname" class="postform" />
email" class="postform" />
URL" class="postform" />
ICQ 0) { echo $profiledata["user_icq"]; } ?>" class="postform" />
AIM" class="postform" />
MSN IM" class="postform" />
YahooIM" class="postform" />
+ +
+ + + + + + + + + + + + + + + + + + 0) { +?> + + +
+ ID
+ level +
+ posts + +
+ identity on the blog:
+ +
+
+ new password (twice)
+
+ +

bookmarklet
add the link to your Favorites/Bookmarks
+ +b2 - + +b2 - + + + +

+One-click bookmarklet:
+click here + + +b2 - + +b2 - + +

+ +SideBar
+Add the b2 Sidebar ! + +

+SideBar
+Add this link to your favorites:
b2 Sidebar. + +
+


Note: closes the popup window.
+ +
+ */ +include($b2inc."/b2footer.php") ?> \ No newline at end of file diff --git a/b2rdf.php b/b2rdf.php new file mode 100644 index 0000000000..dad5731f2c --- /dev/null +++ b/b2rdf.php @@ -0,0 +1,53 @@ +\n"; ?> + + + +"> + + <?php bloginfo_rss('name') ?> + + + + + + + + hourly + 1 + 2000-01-01T12:00+00:00 + + + + + + + + + + + + + <?php the_title_rss() ?> + + + (mailto:) + + + ]]> + + + + \ No newline at end of file diff --git a/b2register.php b/b2register.php new file mode 100644 index 0000000000..7d6e878b2c --- /dev/null +++ b/b2register.php @@ -0,0 +1,342 @@ + */ + +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; $iERROR
: please enter a Login"); + } + + /* checking the password has been typed twice */ + if ($pass1=='' ||$pass2=='') { + die ("ERROR: please enter your password twice"); + } + + /* checking the password has been typed twice the same */ + if ($pass1!=$pass2) { + die ("ERROR: please type the same password in the two password fields"); + } + $user_nickname=$user_login; + + /* checking e-mail address */ + if ($user_email=="") { + die ("ERROR: please type your e-mail address"); + } else if (!is_email($user_email)) { + die ("ERROR: the email address isn't correct"); + } + + $id=mysql_connect($server,$loginsql,$passsql); + if ($id==false) { + die ("OOPS: can't connect to the server !".mysql_error()); + } + + mysql_select_db("$base") or die ("OOPS: 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 ("OOPS: can't check the login..."); + $lines = mysql_num_rows($result); + mysql_free_result($result); + if ($lines>=1) { + die ("ERROR: 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 ("ERROR: couldn't register you... please contact the webmaster !".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); + + ?> + +b2 > Registration complete + + + + + + + + + +
+ + + + + + + + + + +
+visit b2's homepage + +registration
complete +
+ + + + + + + +
login:  
password:  
e-mail:  
 
+ +
+
+ +
+ + + + + + + +b2 > Registration Currently Disabled + + + + + + + + + +
+ + + + + + + + + + + +
+visit b2's homepage + +registration disabled
+
+ +
+User registration is currently not allowed.
+Home +
+
+ +
+ + + + + + +b2 > Register form + + + + + + + + + +
+ + + + + + + + + + +
+visit b2's homepage + +registration
+
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ + + + \n"; ?> + + + + <?php bloginfo_rss("name") ?> + + + GMT + http://backend.userland.com/rss092 + + + + + + + <?php the_title_rss() ?>"; the_category_unicode(); echo ""; ?> + + + + + + + \ No newline at end of file diff --git a/b2rss.xml b/b2rss.xml new file mode 100644 index 0000000000..8d71eaad9c --- /dev/null +++ b/b2rss.xml @@ -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) \ No newline at end of file diff --git a/b2rss2.php b/b2rss2.php new file mode 100644 index 0000000000..1ad19c888c --- /dev/null +++ b/b2rss2.php @@ -0,0 +1,45 @@ +\n"; ?> + + + + + <?php bloginfo_rss("name") ?> + + + + + Copyright + + + + hourly + 1 + 2000-01-01T12:00+00:00 + + + + <?php the_title_rss() ?> + + + (mailto:) + + @ + + ]]> + + + + \ No newline at end of file diff --git a/b2sidebar.php b/b2sidebar.php new file mode 100644 index 0000000000..04b5beaad3 --- /dev/null +++ b/b2sidebar.php @@ -0,0 +1,168 @@ + */ + +$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") { + +?> + + + + + +
+ + +
+

Posted !

+

Click here to post again.

+
+ + + +b2 > sidebar + + + + + + + +
+ + + + + + + + + + + tabindex="4" class="checkbox" id="autobr" />
+ + + + + + + + + + + + +

+ + + +
+ + + + + +

+ + + + + + + +
+ + + diff --git a/b2spell.php b/b2spell.php new file mode 100644 index 0000000000..59c568a7da --- /dev/null +++ b/b2spell.php @@ -0,0 +1,97 @@ + +Loading Spell Checker + + + +
+ +

Loading Spell Checker. Please wait

+ + + + + + + + + +

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+

 

+ + +
+ + diff --git a/b2team.php b/b2team.php new file mode 100644 index 0000000000..1163191091 --- /dev/null +++ b/b2team.php @@ -0,0 +1,212 @@ + */ + +$b2varstoreset = array('action','standalone','redirect','profile'); +for ($i=0; $i + + + + + +
Click on an user's login name to see his/her complete Profile.
+ To edit your Profile, click on your login name.
+ +
+ +

Active users + + + + + + + + + 3) { ?> + + + + 0 ORDER BY ID"; + $result = mysql_query($request); + while($row = mysql_fetch_object($result)) { + $user_data = get_userdata2($row->ID); + echo "\n\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 "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + if ($user_level > 3) { + echo "\n"; + } + echo "\n"; + } + + ?> + +
IDNicknameNameE-mailURLLevelLogin
".$user_data["ID"]."".$user_data["user_nickname"]."".$user_data["user_firstname"]." ".$user_data["user_lastname"]." \"e-mail:  "; + if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != "")) + echo "\"website: "; + echo "".$user_data["user_level"]; + if (($user_level >= 2) and ($user_level > ($user_data["user_level"] + 1))) + echo " + "; + if (($user_level >= 2) and ($user_level > $user_data["user_level"]) and ($user_data["user_level"] > 0)) + echo " - "; + echo "".$user_data["user_login"]."
+

+ + +
+ +

Inactive users (level 0) + + + + + + + + + 3) { ?> + + + + ID); + echo "\n\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 "\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "\n"; + echo "\n"; + if ($user_level > 3) { + echo "\n"; + } + echo "\n"; + } + + ?> + +
IDNicknameNameE-mailURLLevelLogin
".$user_data["ID"]."".$user_data["user_nickname"]."".$user_data["user_firstname"]." ".$user_data["user_lastname"]." \"e-mail:  "; + if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != "")) + echo "\"website: "; + echo "".$user_data["user_level"]; + if ($user_level >= 2) + echo " + "; + if ($user_level >= 3) + echo " X "; + echo "".$user_data["user_login"]."
+

+ + + = 3) { ?> +
+ + To delete an user, bring his/her level to zero, then click on the red cross.
+ Warning: deleting an user also deletes all posts made by this user. + + */ +include($b2inc."/b2footer.php") ?> \ No newline at end of file diff --git a/b2template.php b/b2template.php new file mode 100644 index 0000000000..c96afab3a0 --- /dev/null +++ b/b2template.php @@ -0,0 +1,156 @@ + */ + +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; $iAsk for a promotion to your blog admin :)"); + } + + $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.
Ask for a promotion to your blog admin :)"); + } + + 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(" + + + +
+ $file".$warning; + if ($a == "te") + echo " [ file edited ! ]"; + + if (!$error) { + ?> +
+ + + +
+ "; + } else { + echo ""; + } + ?> +
+ oops, no such file !

"; + } + echo $tablebottom; + ?> +
+
+ + You can also edit the comments' template or the popup comments' template, or edit any other file (provided it's writable by the server, e.g. CHMOD 766).
+
+ To edit a file, type its name here: +
+ + +
+
+ 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... + + + + + */ +include($b2inc."/b2footer.php") ?> \ No newline at end of file diff --git a/b2trackback.php b/b2trackback.php new file mode 100644 index 0000000000..7e12f2d2a7 --- /dev/null +++ b/b2trackback.php @@ -0,0 +1,158 @@ + + + + %' ORDER BY comment_date"; + $resultc = mysql_query($queryc); if ($resultc) { + ?> + + +
:: trackbacks
+ +

+( The URL to TrackBack this entry is:
+   ) +

+ + comment_ID); ?> + + + + + + +

+ +
+· +Tracked on on @ +

+

 

+ + + + + + +

 

+ + + + + + + + + + + + + 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 = ''; + $comment .= "$title
$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...
Contact the webmaster"); + } 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 "\n\n1\n"; + echo "Tell me a lie. \nOr just a __mode or url parameter ?\n"; + echo ""; + +}*/ + + +} + +?> \ No newline at end of file diff --git a/b2trackbackpopup.php b/b2trackbackpopup.php new file mode 100644 index 0000000000..33d4b6f907 --- /dev/null +++ b/b2trackbackpopup.php @@ -0,0 +1,80 @@ + + + +<?php echo $blogname ?> - trackbacks on '<?php the_title() ?>' + + + + + + + + + + + + + + +
+ +
+ +

+The URL to TrackBack this entry is:
+   +

+ + %' ORDER BY comment_date"; $resultc = mysql_query($queryc); if ($resultc) { ?> + + +

 

+
:: trackbacks
+

 

+ + comment_ID); $wxcvbn_tb++; ?> + + + + +

+ +
+· +Tracked on on @ +

+

 

+ + + + + + +

No Trackback on this post so far.

+ + + +

 

+ + + + +
+ + + +
+ +

+[powered by b2.] +

+ + + + \ No newline at end of file diff --git a/b2upload.php b/b2upload.php new file mode 100644 index 0000000000..da0d70bf91 --- /dev/null +++ b/b2upload.php @@ -0,0 +1,250 @@ + + +b2 > upload images/files + + + + + + + + + + + + + + +
+ +

File upload

+

You can upload files of type:

+

The maximum size of the file should be:
KB

+
+ + +

+ Description:
+ +

+ +
+
+ + + + + + +

Duplicate File?

+

The filename '' already exists!

+

filename '' moved to ''

+

Confirm or rename:

+
+ + + + + Alternate name:

+
+ Description:
+
+ +
+ + + + + + + +

File uploaded !

+

Your file was uploaded successfully !

+

Here's the code to display it:

+

+ +
+ +
+

+

Image Details:
+name: + +
+size: + KB +
+type: + +

+

+

+ +
+

+ + + + + + + + \ No newline at end of file diff --git a/blog.header.php b/blog.header.php new file mode 100644 index 0000000000..ddecc5cc63 --- /dev/null +++ b/blog.header.php @@ -0,0 +1,272 @@ +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); +?> \ No newline at end of file diff --git a/blogger-2-b2.php b/blogger-2-b2.php new file mode 100644 index 0000000000..2aa6ccbc93 --- /dev/null +++ b/blogger-2-b2.php @@ -0,0 +1,229 @@ + + + +blogger 2 b2 - converting... + + + + +

blogger 2 b2

+

The importer is running...

+
    + +
  • importing posts and users
      $bgy/$bgmm "; + + $posts = explode("",$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 ("ERROR: couldn't register an user... please contact the webmaster !"); + } + echo ": registered user $user_login"; + } + + $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("
      ","
      ",$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 webmaster"); + + + } echo "... Done"; + + }} + } + + /* 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()); + + + ?> +
    Done
+

 

+

Completed Blogger 2 b2 import !

+

Now you can go and log in, have fun !

+ + +blogger 2 b2 importer utility + + + + +

blogger 2 b2

+

This is a basic Blogger to b2 import script.

+

What it does:

+
    +
  • parses your archives to retrieve your blogger posts
  • +
  • adds an author whenever it sees a new nickname, all authors are imported at level 1, with a default profile and the password 'password'
  • +
+

What it does not:

+
    +
  • it sucks at making coffee, and is not toilet-trained yet
  • +
+

 

+ +

First step: install b2

+

Install the b2 blog as explained in the ReadMe, then immediately come back here.

+ +

Second step: let's play with Blogger

+

Log into your Blogger account.
+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'.
+Go to the Templates. Replace your existing template with this line (copy and paste): +

<Blogger><cafelogpost><$BlogItemDateTime$>|||<$BlogItemAuthorNickname$>|||<$BlogItemBody$>|||<$BlogItemNumber$></Blogger>
+Go to the Archives, and click 'republish all'.
+Check in your FTP that you've got the archive files published. They should look like this example: 2001_10_01_cafelog.php. If they aren't there, redo the republish process.

You're done with the hard part. :)

+ +
+ +

Third step: w00t, let's click OK:

+

When you're ready, click OK to start importing:

+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.

+
+ + + + \ No newline at end of file diff --git a/example.htaccess b/example.htaccess new file mode 100644 index 0000000000..bc83607aa5 --- /dev/null +++ b/example.htaccess @@ -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 + + + php_flag register_globals off + + + + +# 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 + + + ForceType application/x-httpd-php + \ No newline at end of file diff --git a/gm-2-b2.php b/gm-2-b2.php new file mode 100644 index 0000000000..643d17f86a --- /dev/null +++ b/gm-2-b2.php @@ -0,0 +1,326 @@ +\n + $string = str_replace("|*|","
\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"); +?> + + +GM 2 b2 - converting... + + + + +

gm 2 b2

+

The importer is running...

+
+

 

+

Completed GM 2 b2 import !

+

Now you can go and log in, have fun !

+ + +GM 2 b2 importer utility + + + + +

gm 2 b2

+

This is a basic GreyMatter to b2 import script.

+

What it does:

+
    +
  • parses gm-authors.cgi to import authors: everyone is imported at level 1
  • +
  • parses the entries cgi files to import posts, comments, and karma on posts (although karma is not used on b2 yet)
    if authors are found not to be in gm-authors.cgi, imports them at level 0
  • +
+

What it does not:

+
    +
  • 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)
  • +
  • import gm-templates. you'll start with the basic template b2.php
  • +
  • doesn't keep entries on top
  • +
+

 

+ +

First step: install b2

+

Install the b2 blog as explained in the ReadMe, then immediately come back here.

+ +
+ +

Second step: GreyMatter details:

+

+ + + + + + + + + + + + + + + +
Path to GM files:
Path to GM entries:

This importer will search for files 00000001.cgi to 000-whatever.cgi,
so you need to enter the number of the last GM post here.
(if you don't know that number, just log into your FTP and look it out
in the entries' folder)
Last entry's number:
+

+

When you're ready, click OK to start importing:

+
+ + + + \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000000..48dd5a4f73 --- /dev/null +++ b/index.php @@ -0,0 +1,123 @@ + + + + + +<?php bloginfo('name') ?><?php single_post_title(' :: ') ?><?php single_cat_title(' :: ') ?><?php single_month_title(' :: ') ?> + + + + + + + + + + + + + + + + + +
+ + + + + + +",""); ?> + +
+  -  + @ +
+ +
+ + +
+Pages: ","
","number") ?> + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +

+[powered by b2.] +

+ + + + + + + + + diff --git a/layout2b.css b/layout2b.css new file mode 100644 index 0000000000..b8dd201692 --- /dev/null +++ b/layout2b.css @@ -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; +} \ No newline at end of file diff --git a/license.txt b/license.txt new file mode 100644 index 0000000000..888220587e --- /dev/null +++ b/license.txt @@ -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 + diff --git a/phpinfo.php b/phpinfo.php new file mode 100644 index 0000000000..968c8df790 --- /dev/null +++ b/phpinfo.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/print.css b/print.css new file mode 100644 index 0000000000..d1d4b63b17 --- /dev/null +++ b/print.css @@ -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; +} diff --git a/readme.html b/readme.html new file mode 100644 index 0000000000..e6a878200e --- /dev/null +++ b/readme.html @@ -0,0 +1,912 @@ + + +b2 > ReadMe + + + + + + + + + + +
+


+ 0.6.1
+ 20021102

+ +

weblog / news publishing tool

+ +

requirements - installation + - template(s) - querystring + usage - xmlrpc (Blogger API) - post via email - notes

+ +

requirements:

+

PHP4 (version 4.0.5 or higher)
+ MySQL (version 3.23.23 or higher)
+ Perl (optional - only for the spellchecker)
+ ...and a link to http://cafelog.com + on your site.
+
+ The link will help promoting b2, since this is its only mean of promotion.
+ 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 wishlist :) +

+ + + +

+ +

 

+

installation:

+

New users:

+
+ + 1. Unzip the package in an empty directory.

+ + 2. Open b2config.php in a text editor, and modify the variables + as explained in the comments. Comments are lines that start with # or /* or //

+ + 3. Upload everything. This release is designed to sit in your root folder, + IE the folder where your b2-powered page will reside.

+ + 4. 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 "read-only" mode.
+ +    b. if you want to use the spellchecker, do a CHMOD 755 on sproxy.pl

+ + 5. 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: http://tidakada.com/board, + 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).

+ + 6. Delete b2install.php - this is not necessary since + v0.5, because there's no "drop table" 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).

+ + 7. Go to b2login.php and log in with the login "admin" + and the pass "admin". Then click on the menu 'My Profile', + and change the password. Note: + you need javascript enabled to launch the profile popup window.

+ + 8. Do this if you don't want to blog as "admin": log + out, create an user account on b2register.php, then re-log in as "admin", + 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.

+ + Whenever you want to post something, just open a browser and + go to b2login.php to log in and post.
+ You can also use a bookmarklet and/or a sidebar (IE5+/NS6+) to post.
+ You can also post through the Blogger API, click here for more info.
+ 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).
+ You can also copy b2.php into a new file and modify that new file, it will work too ;)
+ +
+

Users upgrading from v0.5.x to v0.6.1:

+
1. Unzip the package in an empty directory, to avoid + deleting your existing b2config.php file.

+ 2. 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.)

+ 3. if you want to use the new spellchecker, do a CHMOD 755 on sproxy.pl

+ + 4. Edit all 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 * + are tags that were added or modified in v0.6, these are those you got + to update in your templates.
+ 5. Upload the new files, and you're done. :)
+

Users upgrading from v0.6preX to v0.6.1:

+
1. Unzip the package in an empty directory, to avoid + deleting your existing b2config.php file.

+ 2. 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.)
+ 3. Upload the new files, and you're done. :) (Generally, this means every file but your template file index.php/b2.php)
+ 4. 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 :)
+
+

 

+

template(s):

+

First notes:

+
Enclosed is an example of a template, in the file b2.php. You can rename + this file to "index.php"or something else (recent b2 versions have a default index.php, which is an elaborate CSS-based template).
+ You can have any number of template files, since all they do is extract + the posts from the database.
+ Pseudo-template for the comments is in b2comments.php. You needn't rename this + file, but you can edit it.
+ 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 "don't delete + this line", you know you mustn't, unless you want to have a broken + page.
+ Required lines are: the first lines that call blog.header.php, the lines + with the "while" statement, and the ones with just "}" + (it ends the while loop).
+ Between the "while" line and the "}", is the template + for your posts.
+
+
+ +

Notes about parameters:

+
1. Some template tags can accept optional parameters + between the parenthesis ().

+ 2. To add a parameter to a + tag, enclose it between quotes and put it between the ().
+ Example: <?php my_tag("my parameter"); ?>

+ 3. You may have to put several parameters, for that you separate + them with commas.
+ Example: <?php my_tag("first param","second param"); ?>

+ 4. 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.
+ Example: <?php my_tag("","second param"); ?>

+ 5. 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.
+ Example: <?php the_title("<h1>","</h1>"); ?> would display <h1>title + of the post</h1> only if the post has a title
+ +
+ +

Template tags are these:

+ +
+ + <?php the_date() ?> *
+ the date of the post. example: 03.07.01 (default is dd.mm.yy).
+ 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.
+ +
Parameters:
    +
  • format string (default: "d.m.y")
  • +
  • string to display before the date (default is blank)
  • +
  • string to display after the date (default is blank)
  • +
+
+
+ + <?php the_time() ?>
+ the time of the post. example: 18:37:00 (default is hh:mm:ss)
+ +
Parameters:
    +
  • format string (default: "H:i:s")
  • +
+
+ +
+ Note: you can change the way the date & time are displayed + in the Options page.
+ once you understand the format strings for the date & time (explained + in the Options page), you can change the display right on the template: + for example, the_date("d.m.Y") to have + dates like 25.12.2001, the_time("B") to + have Swatch Internet Time.
+ If you change the display of the date on the template, changing it from the + options page won't have any effect.br /> +
+ Note about the_date(): 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 "25.12.2001 @ 8:04:50 AM" + you'll have the_time("d.m.Y @ g:i:s A"). you can also repeat + this template tag 2 times with 2 different formats: the_time("d.m.Y") + for the date, and then later the_time("g:i:s A") for the time + of the day.
+
+ + <?php the_weekday() ?>
+ 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
+ Note: this tag is OBSOLETE, the_time() and the_date() now use weekdays/months from b2config.php
+
+ + <?php the_weekday_date() ?> *
+ Like the_weekday(), but works like the_date(), in that it would appear + only on new days.
+ Note: this tag is OBSOLETE, the_time() and the_date() now use weekdays/months from b2config.php
+ +
Parameters:
    +
  • string to display before the weekday_date (default is blank)
  • +
  • string to display after the weekday_date (default is blank)
  • +
+
+
+ +
+ <?php the_ID() ?>
+
the ID (number) of the post.
+
+ <?php the_title() ?>
+
The title of the post.
+ +
Parameters:
    +
  • string to display before the title (default is blank)
  • +
  • string to display after the title (default is blank)
  • +
+
+
+ +
+ + <?php the_content() ?> *
+
The text of the post.
+ +
Parameters:
    +
  • text to display for the link to the complete entry (default is '(more...)')
  • +
  • 0 or 1, whether you want to show the teaser message or not, when showing + the complete text (default is 1)
  • +
  • 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)
  • +
+
+
+ + For example <?php the_content("read more","0","blah.php") + ?> would display a link to blah.php, with the link text + read more, and won't display the teaser message.
+
+ * + To enter an extended entry, just type <!--more--> 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 <!--noteaser--> somewhere in your entry.
+
+ * + To enter an entry with several pages, just type <!--nextpage--> + in your entry to start a new page.
+

+ + <?php next_post() ?> *
+
Displays a link to the next post(s). (Generally you might want to use that + tag only in single-post templates)
+ +
Parameters:
    +
  • format string for the link (default is "%", where % is replaced with the title + of the next post)
  • +
  • text to display to announce the link (default is "next post: ")
  • +
  • "yes" or "no": display the title of the post, or no (default is "yes")
  • +
  • "yes" or "no": display a link to the next post only if the next post is in + the same category (default is "no")
  • +
  • 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)
  • +
+
+

+ + <?php previous_post() ?> *
+
Displays a link to the previous post(s). (Generally you might want to use + that tag only in single-post templates)
+ +
Parameters:
    +
  • format string for the link (default is "%", where % is replaced with the title of the previous post)
  • +
  • text to display to announce the link (default is "previous post: ")
  • +
  • "yes" or "no": display the title of the post, or no (default is "yes")
  • +
  • "yes" or "no": display a link to the next post only if the previous post is in + the same category (default is "no")
  • +
  • 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)
  • +
+
+

+ + <?php next_posts() ?> *
+
Display the URL portion of a link to the next set of posts.
+ + 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.
+
Parameters:
    +
  • Max page number to use. Default "0"; no limit
  • +
+
+

+ + <?php next_posts_link() ?> *
+ +
+ 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.
+
Parameters:
    +
  • A user supplied string. Default "Next Page >>"
  • +
+
+

+ + + <?php previous_posts() ?> *
+
Displays the URL portion of a link to the previous posts.
+ 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.
+
Parameters:
    +
  • No parameters.
  • + +
+
+

+ + <?php previous_posts_link() ?> *
+
+ 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.
+
Parameters:
    + +
  • A user supplied string. Default "<< Previous Page"
  • +
+
+

+ + <?php posts_nav_link() ?> *
+
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.
+ The default result will produce the following string:
+

<< Previous Page :: Next Page >>

+
Parameters:
    + +
  • A user supplied "separator" string. Default " :: "
  • +
  • A user supplied "previous" string. Default "<< Previous Page"
  • +
  • A user supplied "next" string. Default "Next Page >>"
  • +
+
+

+ + <?php link_pages() ?> *
+
Displays links to the pages of the post if it's a multiple pages post.
+ +
Parameters:
    +
  • string to display before the tag (default is "<br />", a newline)
  • +
  • string to display after the tag (default is "<br />", a newline)
  • +
  • "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")
  • +
  • string to display the "next page" link (default is "next page")
  • +
  • string to display the "previous page" link (default is "previous page")
  • +
  • format string for the "number of page" link (default is "%", where % is replaced by the number of the page)
  • +
  • file name, in case you want to load the posts with multiple pages in a different template (default is the current template)
  • +
+
+

+ + <?php the_author() ?>
+ The author of the post.
+ Depending on the user's profile settings, it can display whether their + nickname, login name, first name, last name, both first& last name, + or last & first name. look below for more author-related template + tags.
+
+ + <?php the_category() ?>
+
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.
+
+ + <?php the_category_ID() ?>
+
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.
+
+ + <?php trackback_rdf() ?> *
+ This will include the RDF data that can be used by some weblog tools to locate your posts' trackback URLs.
+ You should put this tag after the <?php the_content() ?> tag in your template, or just before the end of the loop.
+
+ + <?php dropdown_cats() ?>
+
this is a special tag, meant to be used in the template, but outside of the b2 loop. it will display a list of <option name="x">category-name</option>, where x is the number of the category and category-name is the name of it.
+ +
Parameters:
    +
  • 0 or 1, depending if you want to have an option to display all categories (default is 1)
  • +
  • text to display for the option to show all categories (default is "All")
  • +
+
+
+ + you can use it like this:

+ <form action="<?php echo $PHP_SELF ?>" method="get">
+ <?php dropdown_cats() ?>
+ <input type="submit" name="submit" value="view" />
+ </form>
+
+
+ + <?php list_cats() ?> *
+
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
+ +
Parameters:
    +
  • 0 or 1, depending if you want to have an option to display all categories (default is 1)
  • +
  • text to display for the option to show all categories (default is 'All')
  • +
  • sort by: possible values are 'name' and 'ID' (default is 'ID')
  • +
  • sorting order: possible values are 'asc' for ascending or 'desc' for descending (default is 'asc')
  • +
  • filename, in case you want to display the categories' posts in another template (default is current template)
  • +
+
+
+ + <?php bloginfo() ?> *
+ This tag is out of the b2 loop.
+ It outputs info about your weblog.
+ +
Parameters:
    +
  • 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
    (default string is 'name')
  • +
+
+
+ + <?php single_post_title() ?> *
+ This tag is out of the b2 loop.
+ 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:
+    <title><?php bloginfo('name') ?><?php single_post_title() ?></title>
+ +
Parameters:
    +
  • prefix string that will appear before the post's title (default is ' :: ')
  • +
+
+
+ <?php single_cat_title() ?> *
+ This tag is out of the b2 loop.
+ 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:
+    <title><?php bloginfo('name') ?><?php single_cat_title() ?></title>
+ +
Parameters:
    +
  • prefix string that will appear before the category's title (default is ' :: ')
  • +
+
+
+ <?php single_month_title() ?> *
+ This tag is out of the b2 loop.
+ 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:
+    <title><?php bloginfo('name') ?><?php single_month_title() ?></title>
+ +
Parameters:
    +
  • prefix string that will appear before the month's name (default is ' :: ')
  • +
+
+
+ Note: The above three functions can be used together to produce the Title of the page:
+    <title><?php bloginfo('name') ?><?php single_post_title(' :: ') ?><?php single_cat_title(' :: ') ?><?php single_month_title(' :: ') ?></title>
+ Only one, if any, of these functions will produce output, thus the page Title can be customize to the task being done. +
+
+
+ More about the author of the post ? Here goes:
+
+ <?php the_author_email() ?> - the author's email.
+ <?php the_author_url() ?> - the author's url.
+ <?php the_author_email() ?> - the author's number of posts.
+ <?php the_author_icq() ?> - the author's ICQ number.
+ <?php the_author_aim() ?> - the author's AIM handle.
+ <?php the_author_yim() ?> - the author's Yahoo Messenger + handle.
+ <?php the_author_msn() ?> - the author's MSN Messenger handle.
+ <?php the_author_posts() ?> - the author's post count.
+ <?php the_author_login() ?> - 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: <img src="pictures/<?php + the_author_login() ?>.jpg" border="0">
+ <?php the_author_ID() ?> + - 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.
+
+ +
+ Tags for permalinks
are:
+
+ + <?php permalink_anchor() ?> *
+ this will display <a name="..."></a>, replacing + "..." with the ID or the title of the post in the database.
+
+ +
Parameters:
    +
  • string for kind of anchor: either 'id' that displays '50', or 'title' that displays 'title_of_post_50' (default is 'id')
  • +
+
+
+ + <?php permalink_link() ?> *
+
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".
+ note: this tag does not display the link, for this you've got to type + <a href="<?php permalink_link() ?>">text of the + link</a>.
+ +
Parameters:
    +
  • file name, in case you want to link the archive to a different template (default is the current template)
  • +
  • string for kind of link: either 'id' that appends '#50' to the link, or 'title' that appends '#title_of_post_50' (default is 'id')
  • +
+
+
+ +
+ <?php permalink_single() ?> *
+
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).
+ note: this tag does not display the link, for this you've got to type + <a href="<?php permalink_single() ?>">text of the + link</a>.
+ +
Parameters:
    +
  • file name, in case you want to use a different template for single posts (default is the current template)
  • +
+
+
+ +
+
+ Tags for comments, trackback, and pingback are:
+
+ + <?php comments_popup_script() ?> *
+ This will include the javascript that is required to open comments, trackback and pingback in popup windows.
+ You should put this tag before the </head> tag in your template.
+ +
Parameters:
    +
  • width (default is 400)
  • +
  • height (default is 400)
  • +
  • file name, in case you want to use a different template for comments (default is b2commentspopup.php)
  • +
  • file name, in case you want to use a different template for TrackBacks (default is b2trackbackpopup.php)
  • +
  • file name, in case you want to use a different template for Pingbacks (default is b2pingbackspopup.php)
  • +
+
+
+ +
+ <?php comments_popup_link() ?>*
+ This will display the link to open comments in a popup window, with the number of comments.
+ To edit the popup window's template, edit the file b2commentspopup.php (it's the default one for comments popup).
+
+ Note:
+ The same tags exist for TrackBack and Pingback, respectively named 'trackback_popup_link()' and 'pingback_popup_link()'. They take the same parameters.
+
+ +
Parameters:
    +
  • string for comment-less posts (default is "no comments")
  • +
  • string for posts with one comment (default is "1 comment")
  • +
  • string for posts with 2 or more comments (default is "% comments")
    Note here that the sign "%" is then replaced by the number of + comments.
  • +
  • string for CSS class, so you can have a styled link with class="" (default is empty, no CSS class applied)
  • +
+
+
+ +
+ <?php comments_link() ?>
+
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.
+
+ Note:
+ The same tags exist for TrackBack and Pingback, respectively named 'trackback_link()' and 'pingback_link()'. They take the same parameters.
+
+ +
Parameters:
    +
  • file name, in case you want to use a different template for comments (default is the current template)
  • +
+
+
+ +
+ <?php comments_number() ?>
+ This displays the number of comments that have been posted on this post. + Example: "5 comments".
+
+ Note:
+ The same tags exist for TrackBack and Pingback, respectively named 'trackback_number()' and 'pingback_number()'. They take the same parameters.
+
+ +
Parameters:
    +
  • string for comment-less posts (default is "no comments")
  • +
  • string for posts with one comment (default is "1 comment")
  • +
  • string for posts with 2 or more comments (default is "% comments")
    Note here that the sign "%" is then replaced by the number of + comments.
  • +
+
+
+ + Example: <?php comments_number("no comment","1 comment","% + comments") ?>
+
+ 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 "1 comments" (doh !)
+
+ Necessary: <?php include("b2comments.php") ?>
+ you'll put this line where you want the comments to be placed on your + page.
+ 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)
+
+ Necessary: <?php include("b2trackback.php") ?>
+ you'll put this line where you want the TrackBacks to be placed on your + page.
+ 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)
+
+ Necessary: <?php include("b2pingbacks.php") ?>
+ you'll put this line where you want the Pingbacks to be placed on your + page.
+ 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)
+
+
+ Tags that go in b2comments.php, b2trackback.php, b2pingbacks.php: (these are easy too)
+
+ <?php comment_author() ?>
+ <?php comment_author_email() ?> - displays the e-mail address, but not the link
+ <?php comment_author_url() ?> - displays the url, but not the + link
+
+ + <?php comment_author_email_link() ?> *- displays a link to the comment's author's e-mail
+ <?php comment_author_url_link() ?> *- displays a link to the comment's author's website
+ +
Parameters for comment_author_email_link() and comment_author_url_link():
    +
  • string for the link (default: "email"/"url" depending on the tag)
  • +
  • string to display before the link (default is " - ")
  • +
  • string to display after the link (default is blank)
  • +
+
+
+ + <?php comment_author_IP() ?> + - displays the IP of the comment's author
+ <?php comment_text() ?>
+ <?php comment_date() ?>
- unlike the_date(), this tag + appears on every comment
+ <?php comment_time() ?>

+ +
Parameters for comment_date() and comment_time():
    +
  • format string (default is "d.m.y"/"H:i:s" depending on the tag)
  • +
+
+
+ + <?php trackback_url() ?> *
+ This tag is out of the b2 TrackBacks loop.
+ 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.
+ +
Parameters:
    +
  • no parameter
  • +
+
+
+ +
+ In b2comments.php b2trackback.php and b2pingbacks.php, like in the main template file, please keep the first + PHP lines, the "while" lines, and the "}" lines.
+ You can modify the form, but do not remove "<?php echo ... ?>" + and all the name="..." attributes.
+
+
+ To include your archives:
+
+ <?php include("b2archives.php") ?>
+ this will include the links to your archives, one link per line.
+ if your archive mode is "monthly", it will display the names + of the months and the years, like "july 2001".
+ if your archive mode is "post by post", 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.
+
+
+ To include the calendar:
+
+ <?php include("b2calendar.php") ?>
+ 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: +
+ .b2calendarmonth {}
    the style that is used to display the month and year
+ .b2calendartable {}
    the style of the <table> tag (border etc...)
+ .b2calendarrow {}
    the style of the <tr> tag
+ .b2calendarheadercell {}
    the style of the <td> tag that shows the weekdays on the top of the table
+ .b2calendarcell {}
    the style of the <td> tags that show the days
+ .b2calendaremptycell {}
    the style of the <td> tags that are empty
+ .b2calendarlinkpost {}
    the style of the link to the post
+ .b2calendartoday {}
    the style of the day if it is today +
+

 

+

usage:

+

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 '&' + sign.)
+ 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:

+

How to use the QueryString:

+
index.php?m=200107 will display the month of July 2001.
+
+ index.php?m=20010701 will display all posts from July 1st, 2001.
+
+ index.php?w=20 will display the posts from the 20th week of the year, where January 1st is in the first week (according to PHP).
+
+ index.php?p=50 will display the post labeled #50 in the database.
+
+ index.php?s=blue+house will display the posts that match the + search request "blue house".
+ here is the code for a simple search box:
+
+ <form name="searchform" action="<?php echo + $PHP_SELF ?>" method="get">
+ <input type="text" name="s" />
+ <input type="submit" name="submit" value="search" + />
+ </form>

+
+ index.php?cat=1 will display all posts that belong to category #1 (1 + is the default). you can add/rename/delete categories from b2's interface.
+
+ index.php?author=1 will display all posts from the author #1
+
+ index.php?p=50&c=1 will display the comments + and a form to add a comment below the post.
+ you should use this variable only with p=, example: index.php?p=50&c=1.
+
+ index.php?p=50&tb=1 will display the TrackBacks to the post #50.
+ you should use this variable only with p=, example: index.php?p=50&tb=1.
+
+ index.php?p=50&pb=1 will display the Pingbacks to the post #50.
+ you should use this variable only with p=, example: index.php?p=50&pb=1.
+
+ index.php?p=50&more=1 will display the extended entries' text. this, + too, should be used only with p=, for individual entries.
+
+ index.php?p=50&page=1 will display the first page of post #50. this, + again, should be used only with p=, for individual entries.
+
+ You can also mix these variables, example: index.php?m=200107&s=hotdog + will display the posts that match the search request "hotdog", + but only in July 2001.
+

 

+

XMLRPC interface:

+

b2 now has a XMLRPC interface. The only API available right now is the Blogger + API (complete specs here). 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.
+
+ The Blogger API has been + completely emulated on b2, with some little differences:

+ +
    +
  • using blogger.getRecentPosts with the number 'zero' returns all + posts in the blog
  • +
  • blogger.getTemplate fetches your file $blogfilename (as specified in + the config), while blogger.setTemplate overwrites it with the edited + data
  • +
  • blogger.getUsersBlogs is a dummy function that returns '1' and + $blogname, since b2 supports only one blog as of now
  • +
+ +

If you use blogger.newPost, your post is submitted without title and in category + #1.

+ However, you can type <title>my title</title> and/or <category>2<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.

+
+ You can now post to your b2 blog with tools like BlogBuddy, Bloggar, WapBlogger (post from your Wap cellphone!), Radio Userland (which means you can use Radio's email-to-blog feature), and other tools that support the Blogger API ! :)

+ Your XMLRPC server/path are as described here: if you login to b2 on http://mydomain.com/me/b2login.php, then you have:

+ +
    +
  • server: http://mydomain.com/me
  • +
  • path: /me/xmlrpc.php
  • +
  • complete URL (just in case): http://mydomain.com/me/xmlrpc.php
  • +
+ +

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.
+ +
+

+

 

+

Post via Email:

+

You can post news from an email client !
+ 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).
+
+ 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).
+ 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.
+
+ Preliminary advice:
+ 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...).
+ 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.
+ 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).
+
+ The script will delete 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.
+
+ How to post:
+ Now to post something, here's how your email should look like:

+
+ To: address@domain.com (you set it in the config file)
+ Subject: blog:the post's title (you can change 'blog:' in the config file)
+ Body:
+ login:password (example: Jack:Starwars)
+ The content of the post, blah blah blah.
+ More blah blah. ___ +
+

+ 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).
+ Body's first line must always be login:password, else the script will just skip the email.
+ 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 ?).
+
+ Special cases for mobile phone email:
+ 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 $use_phoneemail = 1 in b2config.php, and then here's how you write the email:

+
+ To: address@domain.com
+ Subject: blog:the post's title :::
+ Body:
+ login:password ::: The content of the post, blah blah blah.___ +
+

You will have to append ':::' (or whatever string you set in the config file) after the subject, and after the login:password.
+
+ 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:

+
+ To: address@domain.com
+ Body:
+ blog:the post's title ::: login:password ::: The content of the post, blah blah blah.___ +
+ +

 

+

notes:

+

On multi-user:

+
You don't invite users, they can register on b2register.php.
+ Then you (as an admin) click the "+" 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 "-" until their + level is 0.
+ Note: you can now disable users registration altogether from the config file.
+ Levels are these:
+ 0 - new user: can't post.
+ 1 - user: can post & edit/delete their own posts.
+ 3 & more - admin: can post, edit/delete other people's posts, and + change the options.
+ 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.
+
+ Usually, you'll want to have a team of only level 1 users except you. + ;)
+ Note: you can modify a variable in b2config.php, to enable new + users to post once they've registered.
+ If you don't want users to register on your blog at all, just delete b2register.php + once you've registered your user account.
+


+ Final notes:

+
b2 is functionnal, but a lot of coding and code clean-up remain + to be done.
+ If you've got suggestions, ideas, or comments, or if you found a bug, + why not joining us in the Forums + ?
+ 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.
+


+ Copyright notes:

+
b2 is ©2001, 2002 Michel Valdrighi - m@tidakada.com + - http://tidakada.com
+ Wherever third party code has been used, credit has been given in the + code's comments.
+ b2 is released under the GPL (see license.txt).
+
+

 

+ + \ No newline at end of file diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000000..ab0455d4d9 --- /dev/null +++ b/readme.txt @@ -0,0 +1 @@ +Holder \ No newline at end of file diff --git a/sproxy.pl b/sproxy.pl new file mode 100644 index 0000000000..e5d2cac07d --- /dev/null +++ b/sproxy.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl +print "Content-type: text/html\n\n"; + +if ($ENV{'REQUEST_METHOD'} ne 'POST') +{ + print <<"HTML"; + + + only method POST is supported here. + + + +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 "" + } + } + +exit; +
    +
  • importing users...
      ERROR: couldn't register an user... please contact the webmaster !"); + } + echo "
    • user $user_login... Done
    • "; + + } + +?>
    Done
  • +
  • importing posts, comments, and karma...
      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 ("ERROR: couldn't register an user... please contact the webmaster !"); + } + echo ": registered deleted user $user_login 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 .= "

      ".$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 webmaster"); + + $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...
      Contact the webmaster"); + } + $comments=$c-4; + echo ": imported $comments comment"; + if ($comments>1) + echo "s"; + } + echo "... Done"; + } + } ?> +
    Done