New admin file locations.

git-svn-id: https://develop.svn.wordpress.org/trunk@38 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2003-05-22 12:12:53 +00:00
parent b978238183
commit 316db55cda
17 changed files with 3585 additions and 0 deletions

176
wp-admin/b2categories.php Normal file
View File

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

150
wp-admin/b2edit.form.php Normal file
View File

@ -0,0 +1,150 @@
<?php
echo $tabletop;
switch($action) {
case "post":
$submitbutton_text = "Blog this !";
$toprow_title = "New Post";
$form_action = "post";
$form_extra = "";
if ($use_pingback) {
$form_pingback = '<input type="checkbox" class="checkbox" name="post_pingback" value="1" checked="checked" tabindex="7" id="pingback" /><label for="pingback"> PingBack the URLs in this post</label><br />';
} else {
$form_pingback = '';
}
if ($use_trackback) {
$form_trackback = '<br /><br /><label for="trackback"><b>TrackBack</b> an URL:</label><br /><input type="text" name="trackback_url" style="width: 415px" id="trackback" />';
} else {
$form_trackback = '';
}
$colspan = 3;
break;
case "edit":
$submitbutton_text ="Edit this !";
$toprow_title = "Editing Post #".$postdata["ID"];
$form_action = "editpost";
$form_extra = "\" />\n<input type=\"hidden\" name=\"post_ID\" value=\"$post";
$colspan = 2;
$form_pingback = '<input type="hidden" name="post_pingback" value="0" />';
$form_trackback = '';
break;
case "editcomment":
$submitbutton_text ="Edit this !";
$toprow_title = "Editing Comment #".$commentdata["comment_ID"];
$form_action = "editedcomment";
$form_extra = "\" />\n<input type=\"hidden\" name=\"comment_ID\" value=\"$comment\" />\n<input type=\"hidden\" name=\"comment_post_ID\" value=\"".$commentdata["comment_post_ID"];
$colspan = 3;
$form_pingback = '<input type="hidden" name="post_pingback" value="0" />';
$form_trackback = '';
break;
}
?>
<form name="post" action="b2edit.php" method="POST">
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="action" value="<?php echo $form_action.$form_extra ?>" />
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<?php if ($action != "editcomment") {
// this is for everything but comment editing
?> <td>
<table height="60" align="left" cellpadding="0" cellspacing="0">
<td height="60" width="190">
<label for="title"><b>Title :</b></label><br />
<input type="text" name="post_title" size="20" tabindex="1" style="width: 170px;" value="<?php echo $edited_post_title; ?>" id="title" />
</td>
<td>
<label for="category"><b>Category :</b></label><br /><?php dropdown_categories(); ?>
</td>
</table>
<?php
} else {
// this is for comment editing
?> <td colspan="2">&nbsp;</td>
</tr>
<tr>
<td>
<label for="name"><b>Name :</b></label><br />
<input type="text" name="newcomment_author" size="20" value="<?php echo format_to_edit($commentdata["comment_author"]) ?>" tabindex="1" id="name" /></td>
<td>
<label for="email"><b>E-mail :</b></label><br />
<input type="text" name="newcomment_author_email" size="20" value="<?php echo format_to_edit($commentdata["comment_author_email"]) ?>" tabindex="2" id="email" /></td>
<td>
<label for="URL"><b>URL :</b></label><br />
<input type="text" name="newcomment_author_url" size="20" value="<?php echo format_to_edit($commentdata["comment_author_url"]) ?>" tabindex="3" id="URL" />
<?php
} // end else comment editing
?>
</td>
</tr>
<tr>
<td colspan="<?php echo $colspan; ?>">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<td valign="bottom">
<?php
if ($action != 'editcomment') {
echo '<label for="excerpt"><b>Excerpt :</b></label>';
} else {
echo '<br /><label for="content"><b>Comment :</b></label>';
}
?>
</td>
<td valign="bottom" align="right">&nbsp;</td>
</table>
<textarea rows="3" cols="40" style="width:100%" name="excerpt" tabindex="4" wrap="virtual" id="excerpt"><?php echo $excerpt ?></textarea><br />
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<?php
if ($action != 'editcomment') {
echo '<label for="content"><b>Post :</b></label>';
} else {
echo '<br /><label for="content"><b>Comment :</b></label>';
}
?>
</td>
<td valign="bottom" align="right">
<?php if ($use_quicktags) include('b2quicktags.php'); ?>
</td>
</table>
<textarea rows="9" cols="40" style="width:100%" name="content" tabindex="4" wrap="virtual" id="content"><?php echo $content ?></textarea><br />
<?php echo $form_pingback ?>
<?php if ($use_preview) { ?>
<input type="button" value="preview" onclick="preview(this.form);" class="search" tabindex="8" />
<?php } ?>
<input type="submit" name="submit" value="<?php echo $submitbutton_text ?>" class="search" style="font-weight: bold;" tabindex="5" />
<?php if ( ($use_fileupload) && ($user_level >= $fileupload_minlevel) && ((ereg(" ".$user_login." ", $fileupload_allowedusers)) || (trim($fileupload_allowedusers)=="")) ) { ?>
<input type="button" value="upload a file/image" onclick="launchupload();" class="search" tabindex="10" />
<?php }
echo $form_trackback;
// if the level is 5+, allow user to edit the timestamp - not on 'new post' screen though
#if (($user_level > 4) && ($action != "post"))
if ($user_level > 4) {
touch_time(($action=="edit"));
}
?>
<script language="JavaScript" type="text/javascript">
<!--
// document.blog.post_content.focus();
//-->
</script>
</td>
</tr>
</table>
<?php echo $tablebottom ?>
</form>

349
wp-admin/b2edit.php Normal file
View File

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

View File

@ -0,0 +1,412 @@
<?php
echo $tabletop;
require_once('b2config.php');
if (!$posts) {
if ($posts_per_page) {
$posts=$posts_per_page;
} else {
$posts=10;
$posts_per_page=$posts;
}
}
if ((!empty($poststart)) && (!empty($postend)) && ($poststart == $postend)) {
$p=$poststart;
$poststart=0;
$postend=0;
}
if (!$poststart) {
$poststart=0;
$postend=$posts;
}
$nextXstart=$postend;
$nextXend=$postend+$posts;
$previousXstart=($poststart-$posts);
$previousXend=$poststart;
if ($previousXstart < 0) {
$previousXstart=0;
$previousXend=$posts;
}
?>
<table width="100%">
<tr>
<td valign="top" width="200">
Show posts:
</td>
<td>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2" align="center"><!-- show next/previous X posts -->
<form name="previousXposts" method="get">
<?php
if ($previousXstart > 0) {
?>
<input type="hidden" name="poststart" value="<?php echo $previousXstart; ?>" />
<input type="hidden" name="postend" value="<?php echo $previousXend; ?>" />
<input type="submit" name="submitprevious" class="search" value="< <?php echo $posts ?>" />
<?php
}
?>
</form>
</td>
<td>
<form name="nextXposts" method="get">
<input type="hidden" name="poststart" value="<?php echo $nextXstart; ?>" />
<input type="hidden" name="postend" value="<?php echo $nextXend; ?>" />
<input type="submit" name="submitnext" class="search" value="<?php echo $posts ?> >" />
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="200"><!-- show X first/last posts -->
<form name="showXfirstlastposts" method="get">
<input type="text" name="posts" value="<?php echo $posts ?>" style="width:40px;" /?>
<?php
if (!isset($order))
$order="DESC";
$i = $order;
if ($i == "DESC")
$besp_selected = "selected";
?>
<select name="order">&nbsp;
<option value="DESC" "<?= $besp_selected ?>">last posts</option>
<?php
$besp_selected = "";
if ($i == "ASC")
$besp_selected = "selected";
?>
<option value="ASC" "<?= $besp_selected?>">first posts</option>
</select>&nbsp;
<input type="submit" name="submitfirstlast" class="search" value="OK" />
</form>
</td>
<td valign="top"><!-- show post X to post X -->
<form name="showXfirstlastposts" method="get">
<input type="text" name="poststart" value="<?php echo $poststart ?>" style="width:40px;" /?>&nbsp;to&nbsp;<input type="text" name="postend" value="<?php echo $postend ?>" style="width:40px;" /?>&nbsp;
<select name="order">
<?php
$besp_selected = "";
$i = $order;
if ($i == "DESC")
$besp_selected = "selected";
?>
<option value="DESC" "<?= $besp_selected ?>">from the end</option>
<?php
$besp_selected = "";
if ($i == "ASC")
$besp_selected = "selected";
?> <option value="ASC" "<?= $besp_selected ?>">from the start</option>
</select>&nbsp;
<input type="submit" name="submitXtoX" class="search" value="OK" />
</form>
</td>
</tr>
</table>
<?php echo $tablebottom ?>
<br />
<?php echo $tabletop ?>
<table width="100%">
<td valign="top" width="33%">
<form name="searchform" action="b2edit.php" method="get">
<input type="hidden" name="a" value="s" />
<input onFocus="this.value='';" onBlur="if (this.value=='') {this.value='search...';}" type="text" name="s" value="search..." size="7" style="width: 100px;" />
<input type="submit" name="submit" value="search" class="search" />
</form>
</td>
<td valign="top" width="33%" align="center">
<form name="viewcat" action="b2edit.php" method="get">
<select name="cat" style="width:140px;">
<option value="all">All Categories</option>
<?php
$query="SELECT * FROM $tablecategories";
$result=mysql_query($query);
$querycount++;
$width = ($mode=="sidebar") ? "100%" : "170px";
while($row = mysql_fetch_object($result)) {
echo "<option value=\"".$row->cat_ID."\"";
if ($row->cat_ID == $postdata["Category"])
echo " selected";
echo ">".$row->cat_name."</option>";
}
?>
</select>
<input type="submit" name="submit" value="View" class="search" />
</form>
</td>
<td valign="top" width="33%" align="right">
<form name="viewarc" action="b2edit.php" method="get">
<?php
if ($archive_mode == "monthly") {
echo "<select name=\"m\" style=\"width:120px;\">";
$arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date) FROM $tableposts ORDER BY post_date DESC";
$querycount++;
$arc_result=mysql_query($arc_sql) or die($arc_sql."<br />".mysql_error());
while($arc_row = mysql_fetch_array($arc_result)) {
$arc_year = $arc_row["YEAR(post_date)"];
$arc_month = $arc_row["MONTH(post_date)"];
echo "<option value=\"$arc_year".zeroise($arc_month,2)."\">";
echo $month[zeroise($arc_month,2)]." $arc_year";
echo "</option>\n";
}
} elseif ($archive_mode == "daily") {
echo "<select name=\"d\" style=\"width:120px;\">";
$archive_day_date_format = "Y/m/d";
$arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) FROM $tableposts ORDER BY post_date DESC";
$querycount++;
$arc_result=mysql_query($arc_sql) or die($arc_sql."<br />".mysql_error());
while($arc_row = mysql_fetch_array($arc_result)) {
$arc_year = $arc_row["YEAR(post_date)"];
$arc_month = $arc_row["MONTH(post_date)"];
$arc_dayofmonth = $arc_row["DAYOFMONTH(post_date)"];
echo "<option value=\"$arc_year".zeroise($arc_month,2).zeroise($arc_dayofmonth,2)."\">";
echo mysql2date($archive_day_date_format, $arc_year.zeroise($arc_month,2).zeroise($arc_dayofmonth,2)." 00:00:00");
echo "</option>\n";
}
} elseif ($archive_mode == "weekly") {
echo "<select name=\"w\" style=\"width:120px;\">";
if (!isset($start_of_week)) {
$start_of_week = 1;
}
$archive_week_start_date_format = "Y/m/d";
$archive_week_end_date_format = "Y/m/d";
$archive_week_separator = " - ";
$arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date), WEEK(post_date) FROM $tableposts ORDER BY post_date DESC";
$querycount++;
$arc_result=mysql_query($arc_sql) or die($arc_sql."<br />".mysql_error());
$arc_w_last = '';
while($arc_row = mysql_fetch_array($arc_result)) {
$arc_year = $arc_row["YEAR(post_date)"];
$arc_w = $arc_row["WEEK(post_date)"];
if ($arc_w != $arc_w_last) {
$arc_w_last = $arc_w;
$arc_ymd = $arc_year."-".zeroise($arc_row["MONTH(post_date)"],2)."-" .zeroise($arc_row["DAYOFMONTH(post_date)"],2);
$arc_week = get_weekstartend($arc_ymd, $start_of_week);
$arc_week_start = date($archive_week_start_date_format, $arc_week['start']);
$arc_week_end = date($archive_week_end_date_format, $arc_week['end']);
echo "<option value=\"$arc_w\">";
echo $arc_week_start.$archive_week_separator.$arc_week_end;
echo "</option>\n";
}
}
} elseif ($archive_mode == "postbypost") {
echo '<input type="hidden" name="more" value="1" />';
echo '<select name="p" style="width:120px;">';
$requestarc = " SELECT ID,post_date,post_title FROM $tableposts ORDER BY post_date DESC";
$querycount++;
$resultarc = mysql_query($requestarc);
while($row=mysql_fetch_object($resultarc)) {
if ($row->post_date != "0000-00-00 00:00:00") {
echo "<option value=\"".$row->ID."\">";
if (strip_tags($row->post_title)) {
echo strip_tags(stripslashes($row->post_title));
} else {
echo $row->ID;
}
echo "</option>\n";
}
}
}
echo "</select>";
?>
<input type="submit" name="submit" value="View" class="search" />
</form>
</td>
</table>
<br />
<table cellspacing="0" cellpadding="5" border="0" width="100%">
<?php
// these lines are b2's "motor", do not alter nor remove them
include("blog.header.php");
while($row = mysql_fetch_object($result)) {
$posts_per_page = 10;
start_b2(); ?>
<tr>
<td>
<p>
<b><?php the_time('Y/m/d @ H:i:s'); ?></b> [ <a href="b2edit.php?p=<?php echo $id ?>&c=1"><?php comments_number('no comment', '1 comment', "% comments") ?><?php trackback_number('', ', 1 trackback', ', % trackbacks') ?><?php pingback_number('', ', 1 pingback', ', % pingbacks') ?></a>
<?php
if (($user_level > $authordata[13]) or ($user_login == $authordata[1])) {
echo " - <a href=\"b2edit.php?action=edit&post=".$postdata["ID"];
if ($m)
echo "&m=$m";
echo "\">Edit</a>";
echo " - <a href=\"b2edit.php?action=delete&post=".$postdata["ID"]."\" onclick=\"return confirm('You are about to delete this post \'".$row->post_title."\'\\n \'Cancel\' to stop, \'OK\' to delete.')\">Delete</a> ";
}
?>
]
<br />
<font color="#999999"><b><a href="<?php permalink_single($blogfilename); ?>" title="permalink"><?php the_title() ?></a></b> by <b><?php the_author() ?> (<a href="javascript:profile(<?php the_author_ID() ?>)"><?php the_author_nickname() ?></a>)</b>, in <b><?php the_category() ?></b></font><br />
<?php permalink_anchor(); ?>
<?php
if ($safe_mode)
echo "<xmp>";
the_excerpt();
echo '<br />';
if ($safe_mode)
echo "</xmp>";
?>
<?php
if ($safe_mode)
echo "<xmp>";
the_content();
if ($safe_mode)
echo "</xmp>";
?>
</p>
<?php
// comments
if (($withcomments) or ($c)) {
$queryc = "SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date";
$resultc = mysql_query($queryc);
if ($resultc) {
?>
<a name="comments"></a>
<p><b><font color="#ff3300">::</font> comments</b></p>
<?php
while($rowc = mysql_fetch_object($resultc)) {
$commentdata = get_commentdata($rowc->comment_ID);
?>
<!-- comment -->
<p>
<b><?php comment_author() ?> ( <?php comment_author_email_link() ?> / <?php comment_author_url_link() ?> )</b> (IP: <?php comment_author_IP() ?>)
<br />
<?php comment_text() ?>
<br />
<?php comment_date('Y/m/d') ?> @ <?php comment_time() ?><br />
<?php
if (($user_level > $authordata[13]) or ($user_login == $authordata[1])) {
echo "[ <a href=\"b2edit.php?action=editcomment&comment=".$commentdata["comment_ID"]."\">Edit</a>";
echo " - <a href=\"b2edit.php?action=deletecomment&p=".$postdata["ID"]."&comment=".$commentdata["comment_ID"]."\">Delete</a> ]";
}
?>
</p>
<!-- /comment -->
<?php //end of the loop, don't delete
}
if ($comment_error)
echo "<p><font color=\"red\">Error: please fill the required fields (name & comment)</font></p>";
?>
<p><b><font color="#ff3300">::</font> leave a comment</b></p>
<!-- form to add a comment -->
<form action="b2comments.post.php" method="post">
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<input type="hidden" name="redirect_to" value="<?php echo $HTTP_SERVER_VARS["REQUEST_URI"]; ?>" />
<input type="text" name="author" class="textarea" value="<?php echo $user_nickname ?>" size="20" tabindex="1" /><br />
<input type="text" name="email" class="textarea" value="<?php echo $user_email ?>" size="20" tabindex="2" /><br />
<input type="text" name="url" class="textarea" value="<?php echo $user_url ?>" size="20" tabindex="3" /><br />
<textarea cols="40" rows="4" name="comment" tabindex="4" class="textarea">comment</textarea><br />
<input type="checkbox" name="comment_autobr" value="1" checked tabindex="6" class="checkbox" /> Auto-BR (line-breaks become &lt;br> tags)<br />
<input type="submit" name="submit" class="buttonarea" value="ok" tabindex="5" />
</form>
<!-- /form -->
<?php // if you delete this the sky will fall on your head
}
}
?>
<br />
</td>
</tr>
<?php
}
?>
</table>
<?php echo $tablebottom ?>
<br />
<?php echo $tabletop ?>
<table width="100%">
<tr>
<td valign="top" width="200">Show posts: </td>
<td>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2" align="center"><!-- show next/previous X posts -->
<form name="previousXposts" method="get"><?php
if ($previousXstart > -1) {
?>
<input type="hidden" name="poststart" value="<?php echo $previousXstart; ?>" />
<input type="hidden" name="postend" value="<?php echo $previousXend; ?>" />
<input type="submit" name="submitprevious" class="search" value="< Previous <?php echo $posts ?>" /><?php
}
?>
</form>
</td>
<td>
<form name="nextXposts" method="get">
<input type="hidden" name="poststart" value="<?php echo $nextXstart; ?>" />
<input type="hidden" name="postend" value="<?php echo $nextXend; ?>" />
<input type="submit" name="submitnext" class="search" value="Next <?php echo $posts ?> >" />
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" width="200"><!-- show X first/last posts -->
<form name="showXfirstlastposts" method="get">
<input type="text" name="posts" value="<?php echo $posts ?>" style="width:40px;" /?>
<select name="order">&nbsp;<option value="DESC" <?php
$i = $order;
if ($i == "DESC")
echo " selected";
?>>last posts</option>
<option value="ASC" <?php
if ($i == "ASC")
echo " selected";
?>>first posts</option>
</select>&nbsp;<input type="submit" name="submitfirstlast" class="search" value="OK" />
</form>
</td>
<td valign="top"><!-- show post X to post X -->
<form name="showXfirstlastposts" method="get">
<input type="text" name="poststart" value="<?php echo $poststart ?>" style="width:40px;" /?>&nbsp;to&nbsp;<input type="text" name="postend" value="<?php echo $postend ?>" style="width:40px;" /?>&nbsp;<select name="order">
<option value="DESC" <?php
$i = $order;
if ($i == "DESC")
echo " selected";
?>>from the end</option>
<option value="ASC" <?php
if ($i == "ASC")
echo " selected";
?>>from the start</option>
</select>&nbsp;<input type="submit" name="submitXtoX" class="search" value="OK" />
</form>
</td>
</tr>
</table>
<?php echo $tablebottom ?>

23
wp-admin/b2footer.php Normal file
View File

@ -0,0 +1,23 @@
</div>
</td></table>
<?php
if ($debug=="1") {
echo "<p>$querycount queries - ".number_format(timer_stop(),3)." seconds";
}
?>
<p>&nbsp;</p>
<div align="center" style="width: 100%" class="tabletoprow"><strong><a href="http://wordpress.org">WordPress</a></strong> <?php echo $b2_version ?> <a href="http://wordpress.org/support/">Support Forums</a></div>
<!-- this is for the spellchecker -->
<form name="SPELLDATA"><div>
<input name="formname" type="hidden" value="">
<input name="messagebodyname" type="hidden" value="">
<input name="subjectname" type="hidden" value="">
<input name="companyID" type="hidden" value="">
<input name="language" type="hidden" value="">
<input name="opener" type="hidden" value="">
<input name="formaction" type="hidden" value="">
</div></form>
</body>
</html>

159
wp-admin/b2header.php Normal file
View File

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

102
wp-admin/b2install.php Normal file
View File

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

30
wp-admin/b2menutop.php Normal file
View File

@ -0,0 +1,30 @@
<h1 id="wphead"><a href="http://wordpress.org" rel="external"><span>WordPress</span></a></h1>
<ul id="adminmenu">
<li><a href="b2edit.php"><strong>Post / Edit</strong></a></li>
<li><a href="javascript:profile(<?php echo $user_ID ?>)">My Profile</a></li>
<li><a href="b2team.php">Team</a></li>
<?php
if ($pagenow != "b2profile.php") {
$menu = file("b2menutop.txt");
$i=0;
$j=$menu[0];
while ($j != "") {
$k = explode("\t",$j);
if ($user_level >= $k[0]) {
echo "\n<li><a href='".$k[1]."'>".trim($k[2]).'</a></li>';
}
$i=$i+1;
$j=$menu[$i];
if (trim($j) == "***")
$j="";
}
}
?>
<li><a href="<?php echo $siteurl."/".$blogfilename; ?>">View site</a></li>
<li><a href="<?php echo $siteurl ?>/b2login.php?action=logout">Logout</a></li>
</ul>
<h2><?php echo $title; ?></h2>

193
wp-admin/b2options.php Normal file
View File

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

468
wp-admin/b2profile.php Normal file
View File

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

33
wp-admin/b2quicktags.php Normal file
View File

@ -0,0 +1,33 @@
<script src="b2quicktags.js" language="JavaScript" type="text/javascript">
</script><table border="0" cellspacing="0" cellpadding="0">
<tr align="center" valign="middle">
<td>
<input type="button" class="quicktags" accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; width: 30px" onClick="bbstyle(this.form,0)" />
</td>
<td>
<input type="button" class="quicktags" accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; width: 30px" onClick="bbstyle(this.form,2)" />
</td>
<td>
<input type="button" class="quicktags" accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; width: 30px" onClick="bbstyle(this.form,4)" />
</td>
<td>
<input type="button" class="quicktags" accesskey="s" name="addbbcode6" value="strike" style="text-decoration: line-through;width: 50px" onClick="bbstyle(this.form,6)" />
</td>
<td>
<input type="button" class="quicktags" accesskey="p" name="addbbcode10" value="&lt;p>" style="width: 40px" onClick="bbstyle(this.form,10)" />
</td>
<?php if (basename($HTTP_SERVER_VARS["SCRIPT_FILENAME"]) != "b2bookmarklet.php") { ?><td>
<input type="button" class="quicktags" accesskey="l" name="addbbcode12" value="&lt;li>" style="width: 40px" onClick="bbstyle(this.form,12)" />
</td><?php } ?>
<?php if (basename($HTTP_SERVER_VARS["SCRIPT_FILENAME"]) != "b2bookmarklet.php") { ?><td>
<input type="button" class="quicktags" accesskey="q" name="addbbcode8" value="b-quote" style="width: 60px" onClick="bbstyle(this.form,8)" />
</td><?php } ?>
<td>
<input type="button" class="quicktags" accesskey="m" name="addbbcode14" value="image" title="insert an image" style="width: 40px" onClick="bblink(this.form,14)" />
</td>
<td>
<input type="button" class="quicktags" accesskey="h" name="addbbcode16" value="link" title="insert a link" style="text-decoration: underline; width: 40px" onClick="bblink(this.form,16)" />
</td><td>
<input type="button" class="quicktags" accesskey="c" name="closetags" value="X" title="Close all tags" style="width: 30px; font-weigh: bolder;" onClick="bbstyle(document.post,-1)" /></td>
</tr>
</table>

97
wp-admin/b2spell.php Normal file
View File

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

212
wp-admin/b2team.php Normal file
View File

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

156
wp-admin/b2template.php Normal file
View File

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

250
wp-admin/b2upload.php Normal file
View File

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

208
wp-admin/linkcategories.php Normal file
View File

@ -0,0 +1,208 @@
<?php
// $Id$
//
// Links
// Copyright (C) 2002 Mike Little -- mike@zed1.com
//
// This is an add-on to b2 weblog / news publishing tool
// b2 is copyright (c)2001, 2002 by Michel Valdrighi - m@tidakada.com
//
// **********************************************************************
// Copyright (C) 2002 Mike Little
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// Mike Little (mike@zed1.com)
// *****************************************************************
include_once('../wp-links/links.config.php');
include_once('../wp-links/links.php');
$title = "Link Categories";
$b2varstoreset = array('action','standalone','cat', 'auto_toggle');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
switch ($action) {
case "addcat":
{
$standalone = 1;
include_once("./b2header.php");
if ($user_level < $minadminlevel)
die ("Cheatin' uh ?");
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
$auto_toggle = $HTTP_POST_VARS["auto_toggle"];
if ($auto_toggle != 'Y') {
$auto_toggle = 'N';
}
$query="INSERT INTO $tablelinkcategories (cat_id,cat_name, auto_toggle) VALUES ('0', '$cat_name', '$auto_toggle')";
$result=mysql_query($query) or die("Couldn't add category <b>$cat_name</b>".mysql_error());
header("Location: linkcategories.php");
break;
} // end addcat
case "Delete":
{
$standalone = 1;
include_once("./b2header.php");
include_once("./links.php");
$cat_id = $HTTP_POST_VARS["cat_id"];
$cat_name=get_linkcatname($cat_id);
$cat_name=addslashes($cat_name);
if ($cat_id=="1")
die("Can't delete the <b>$cat_name</b> link category: this is the default one");
if ($user_level < $minadminlevel)
die ("Cheatin' uh ?");
$query="DELETE FROM $tablelinkcategories WHERE cat_id=\"$cat_id\"";
$result=mysql_query($query) or die("Couldn't delete link category <b>$cat_name</b>".mysql_error());
$query="UPDATE $tablelinks SET link_category=1 WHERE link_category='$cat_id'";
$result=mysql_query($query) or die("Couldn't reset category on links where category was <b>$cat_name</b>");
header("Location: linkcategories.php");
break;
} // end delete
case "Edit":
{
include_once ("./b2header.php");
include_once("./links.php");
$cat_id = $HTTP_POST_VARS["cat_id"];
$cat_name=get_linkcatname($cat_id);
$cat_name=addslashes($cat_name);
$auto_toggle=get_autotoggle($cat_id);
?>
<?php echo $blankline; ?>
<?php echo $tabletop; ?>
<p><b>Old</b> name: <?php echo $cat_name ?></p>
<p>
<form name="editcat" method="post">
<b>New</b> name:<br />
<input type="hidden" name="action" value="editedcat" />
<input type="hidden" name="cat_id" value="<?php echo $HTTP_POST_VARS["cat_id"] ?>" />
<input type="text" name="cat_name" value="<?php echo $cat_name ?>" /><br />
<input type="checkbox" name="auto_toggle" value="Y" <?php echo $auto_toggle = "Y" ? '"checked"' : ''; ?>/> auto-toggle?<br />
<input type="submit" name="submit" value="Edit it !" class="search" />
</form>
</p>
<?php echo $tablebottom; ?>
<?php
break;
} // end Edit
case "editedcat":
{
$standalone = 1;
include_once("./b2header.php");
if ($user_level < $minadminlevel)
die ("Cheatin' uh ?");
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
$cat_id=$HTTP_POST_VARS["cat_id"];
$auto_toggle=$HTTP_POST_VARS["auto_toggle"];
$query="UPDATE $tablelinkcategories SET cat_name='$cat_name', auto_toggle='$auto_toggle' WHERE cat_id=$cat_id";
$result=mysql_query($query) or die("Couldn't edit link category <b>$cat_name</b>: ".$query.mysql_error());
header("Location: linkcategories.php");
break;
} // end edit
default:
{
$standalone=0;
include_once ("./b2header.php");
if ($user_level < $minadminlevel) {
die("You have no right to edit the link categories for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
}
?>
<?php echo $blankline ?>
<?php echo $tabletop ?>
<table width="" cellpadding="5" cellspacing="0" border="0">
<tr><td><b>Link Categories:</b></td></tr>
<tr>
<td>
<form name="cats" method="post">
<b>Edit</b> a link category:<br />
<?php
$query = "SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id";
$result = mysql_query($query) or die("Couldn't execute query. ".mysql_error());
echo " <select name=\"cat_id\">\n";
while($row = mysql_fetch_object($result)) {
echo " <option value=\"".$row->cat_id."\"";
if ($row->cat_id == $cat_id)
echo ' selected';
echo ">".$row->cat_id.": ".$row->cat_name;
if ($row->auto_toggle == 'Y')
echo ' (auto toggle)';
echo "</option>\n";
}
echo " </select>\n";
?>
<br /><br />
<input type="submit" name="action" value="Delete" class="search" />
<input type="submit" name="action" value="Edit" class="search" />
</form>
</td>
<td>
<?php echo $blankline ?>
</td>
<td>
<b>Add</b> a link category:<br />
<form name="addcat" method="post">
<input type="hidden" name="action" value="addcat" />
<input type="text" name="cat_name" />&nbsp;<input type="checkbox" name="auto_toggle" value="Y" /> auto-toggle?<br /><br />
<input type="submit" name="submit" value="Add it !" class="search" />
</form>
</td>
</tr>
</table>
<?php echo $tablebottom ?>
<?php echo $blankline ?>
<?php echo $tabletop ?>
<b>Note:</b><br />
Deleting a link category does not delete links from that category.<br />It will
just set them back to the default category <b><?php echo get_linkcatname(1) ?></b>.
<?php echo $tablebottom ?>
<?php echo $blankline ?>
<?php
break;
} // end default
} // end case
?>
</table>
<?php include("b2footer.php") ?>

567
wp-admin/linkmanager.php Normal file
View File

@ -0,0 +1,567 @@
<?php
// $Id$
//
// Links
// Copyright (C) 2002 Mike Little -- mike@zed1.com
//
// This is an add-on to b2 weblog / news publishing tool
// b2 is copyright (c)2001, 2002 by Michel Valdrighi - m@tidakada.com
//
// **********************************************************************
// Copyright (C) 2002 Mike Little
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// Mike Little (mike@zed1.com)
// *****************************************************************
include_once('../wp-links/links.config.php');
include_once("../wp-links/links.php");
$title = "Manage Links";
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_id', 'linkurl', 'name', 'image',
'description', 'visible', 'target', 'category', 'link_id',
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel');
for ($i=0; $i<count($b2varstoreset); $i += 1) {
$b2var = $b2varstoreset[$i];
if (!isset($$b2var)) {
if (empty($HTTP_POST_VARS["$b2var"])) {
if (empty($HTTP_GET_VARS["$b2var"])) {
$$b2var = '';
} else {
$$b2var = $HTTP_GET_VARS["$b2var"];
}
} else {
$$b2var = $HTTP_POST_VARS["$b2var"];
}
}
}
$links_show_cat_id = $HTTP_COOKIE_VARS["links_show_cat_id"];
//error_log("start, links_show_cat_id=$links_show_cat_id");
switch ($action) {
case "Add":
{
$standalone = 1;
include_once("./b2header.php");
$link_url = $HTTP_POST_VARS["linkurl"];
$link_name = $HTTP_POST_VARS["name"];
$link_image = $HTTP_POST_VARS["image"];
$link_target = $HTTP_POST_VARS["target"];
$link_category = $HTTP_POST_VARS["category"];
$link_description = $HTTP_POST_VARS["description"];
$link_visible = $HTTP_POST_VARS["visible"];
$link_rating = $HTTP_POST_VARS["rating"];
$link_rel = $HTTP_POST_VARS["rel"];
$auto_toggle = get_autotoggle($link_category);
if ($user_level < $minadminlevel)
die ("Cheatin' uh ?");
// if we are in an auto toggle category and this one is visible then we
// need to make the others invisible before we add this new one.
if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
$sql = "UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category";
$sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());
}
$sql = "INSERT INTO $tablelinks (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel) " .
" VALUES('" . addslashes($link_url) . "','"
. addslashes($link_name) . "', '"
. addslashes($link_image) . "', '$link_target', $link_category, '"
. addslashes($link_description) . "', '$link_visible', $user_ID, $link_rating, '" . addslashes($link_rel) ."')";
$sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());
header("Location: linkmanager.php");
break;
} // end Add
case "editlink":
{
if (isset($submit) && ($submit == "Save")) {
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id;
if (!isset($cat_id) || ($cat_id == '')) {
if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
$cat_id = 'All';
}
$links_show_cat_id = $cat_id;
$standalone = 1;
include_once("./b2header.php");
$link_id = $HTTP_POST_VARS["link_id"];
$link_url = $HTTP_POST_VARS["linkurl"];
$link_name = $HTTP_POST_VARS["name"];
$link_image = $HTTP_POST_VARS["image"];
$link_target = $HTTP_POST_VARS["target"];
$link_category = $HTTP_POST_VARS["category"];
$link_description = $HTTP_POST_VARS["description"];
$link_visible = $HTTP_POST_VARS["visible"];
$link_rating = $HTTP_POST_VARS["rating"];
$link_rel = $HTTP_POST_VARS["rel"];
$auto_toggle = get_autotoggle($link_category);
if ($user_level < $minadminlevel)
die ("Cheatin' uh ?");
// if we are in an auto toggle category and this one is visible then we
// need to make the others invisible before we update this one.
if (($auto_toggle == 'Y') && ($link_visible == 'Y')) {
$sql = "UPDATE $tablelinks set link_visible = 'N' WHERE link_category = $link_category";
$sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());
}
$sql = "UPDATE $tablelinks SET link_url='" . addslashes($link_url) . "',\n " .
" link_name='" . addslashes($link_name) . "',\n link_image='" . addslashes($link_image) . "',\n " .
" link_target='$link_target',\n link_category=$link_category,\n " .
" link_visible='$link_visible',\n link_description='" . addslashes($link_description) . "',\n " .
" link_rating=$link_rating,\n" .
" link_rel='" . addslashes($link_rel) . "'\n" .
" WHERE link_id=$link_id";
//error_log($sql);
$sql_result = mysql_query($sql) or die("Couldn't execute query."."sql=[$sql]". mysql_error());
} // end if save
setcookie('links_show_cat_id', $links_show_cat_id, time()+600);
header("Location: linkmanager.php");
break;
} // end Save
case "Delete":
{
$standalone = 1;
include_once("./b2header.php");
$link_id = $HTTP_POST_VARS["link_id"];
if ($user_level < $minadminlevel)
die ("Cheatin' uh ?");
$sql = "DELETE FROM $tablelinks WHERE link_id = '$link_id'";
$sql_result = mysql_query($sql) or die("Couldn't execute query.".mysql_error());
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id;
if (!isset($cat_id) || ($cat_id == '')) {
if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
$cat_id = 'All';
}
$links_show_cat_id = $cat_id;
setcookie("links_show_cat_id", $links_show_cat_id, time()+600);
header("Location: linkmanager.php");
break;
} // end Delete
case "linkedit":
{
$standalone=0;
include_once ("./b2header.php");
if ($user_level < $minadminlevel) {
die("You have no right to edit the links for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
}
$sql = "SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating, link_rel " .
" FROM $tablelinks " .
" WHERE link_id = $link_id";
$result = mysql_query($sql) or die("Couldn't execute query.".mysql_error());
if ($row = mysql_fetch_object($result)) {
$link_url = $row->link_url;
$link_name = stripslashes($row->link_name);
$link_image = $row->link_image;
$link_target = $row->link_target;
$link_category = $row->cat_id;
$link_description = stripslashes($row->link_description);
$link_visible = $row->link_visible;
$link_rating = $row->link_rating;
$link_rel = stripslashes($row->link_rel);
}
?>
<?php echo $blankline ?>
<?php echo $tabletop ?>
<table width="95%" cellpadding="5" cellspacing="0" border="0">
<form name="editlink" method="post">
<input type="hidden" name="action" value="editlink" />
<input type="hidden" name="link_id" value="<?php echo $link_id; ?>" />
<input type="hidden" name="order_by" value="<?php echo $order_by ?>" />
<input type="hidden" name="cat_id" value="<?php echo $cat_id ?>" />
<tr><td colspan="2"><b>Edit</b> a link:</td></tr>
<tr height="20">
<td height="20" align="right">URL:</td>
<td><input type="text" name="linkurl" size="80" value="<?php echo $link_url; ?>"></td>
</tr>
<tr height="20">
<td height="20" align="right">Display Name/Alt text:</td>
<td><input type="text" name="name" size="80" value="<?php echo $link_name; ?>"></td>
</tr>
<tr height="20">
<td height="20" align="right">Image:</td>
<td><input type="text" name="image" size="80" value="<?php echo $link_image; ?>"></td>
</tr>
<tr height="20">
<td height="20" align="right">Description:</td>
<td><input type="text" name="description" size="80" value="<?php echo $link_description; ?>"></td>
</tr>
<tr height="20">
<td height="20" align="right">Rel:</td>
<td><input type="text" name="rel" size="80" value="<?php echo $link_rel; ?>"></td>
</tr>
<tr height="20">
<td height="20" align="right">Rating:</td>
<td>
<select name="rating" size="1">
<?php
for ($r = 0; $r < 10; $r++) {
echo(' <option value="'.$r.'" ');
if ($link_rating == $r)
echo('selected');
echo('>'.$r.'</option>');
}
?>
</select>&nbsp;(Leave at 0 for no rating.)
</td>
</tr>
<tr height="20">
<td height="20" align="right">Target:</td>
<td><input type="radio" name="target" <?php if ($link_target == '_blank') echo "checked"; ?> value="_blank">_blank&nbsp;<input type="radio" name="target" <?php if ($link_target == '_top') echo "checked"; ?> value="_top">_top</td>
</tr>
<tr height="20">
<td height="20" align="right">Visible:</td>
<td><input type="radio" name="visible" <?php if ($link_visible == 'Y') echo "checked"; ?> value="Y">Y&nbsp;<input type="radio" name="visible" <?php if ($link_visible == 'N') echo "checked"; ?> value="N">N</td>
</tr>
<tr height="20">
<td height="20" align="right">Category:</td>
<td>
<?php
$query = "SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id";
$result = mysql_query($query) or die("Couldn't execute query. ".mysql_error());
echo " <select name=\"category\" size=\"1\">\n";
while($row = mysql_fetch_object($result)) {
echo " <option value=\"".$row->cat_id."\"";
if ($row->cat_id == $link_category)
echo " selected";
echo ">".$row->cat_id.": ".$row->cat_name;
if ($row->auto_toggle == 'Y')
echo ' (auto toggle)';
echo "</option>\n";
}
echo " </select>\n";
?>
</td>
</tr>
<tr height="20">
<td colspan="2" align="center">
<input type="submit" name="submit" value="Save" class="search">&nbsp;<input type="submit" name="submit" value="Cancel" class="search"></a>
</td>
</tr>
</table>
<?php
break;
} // end linkedit
case "Show":
{
if (!isset($cat_id) || ($cat_id == '')) {
if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
$cat_id = 'All';
}
$links_show_cat_id = $cat_id;
//break; fall through
} // end Show
case "popup":
{
$link_url = $HTTP_GET_VARS["linkurl"];
$link_name = $HTTP_GET_VARS["name"];
//break; fall through
}
default:
{
if (isset($links_show_cat_id) && ($links_show_cat_id != ''))
$cat_id = $links_show_cat_id;
if (!isset($cat_id) || ($cat_id == '')) {
if (!isset($links_show_cat_id) || ($links_show_cat_id == ''))
$cat_id = 'All';
}
$links_show_cat_id = $cat_id;
if (!isset($order_by) || ($order_by == ''))
$order_by = 'order_id';
setcookie('links_show_cat_id', $links_show_cat_id, time()+600);
$standalone=0;
include_once ("./b2header.php");
if ($user_level < $minadminlevel) {
die("You have no right to edit the links for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
}
switch ($order_by)
{
case 'order_name': $sqlorderby = 'name'; break;
case 'order_url': $sqlorderby = 'url'; break;
case 'order_desc': $sqlorderby = 'description'; break;
case 'order_owner': $sqlorderby = 'owner'; break;
case 'order_rating': $sqlorderby = 'rating'; break;
case 'order_id': //fall through
default: $sqlorderby = 'id'; break;
}
if ($action != "popup") {
?>
<?php echo $blankline ?>
<?php echo $tabletop ?>
<form name="cats" method="post">
<table width="50%" cellpadding="5" cellspacing="0" border="0">
<tr><td><b>Link Categories:</b></td><td colspan="2"><a href="linkcategories.php">Manage Link Categories</a></td></tr>
<tr>
<td>
<b>Show</b> links in category:<br />
</td>
<td>
<b>Order</b> by:
</td>
</tr>
<tr>
<td>
<?php
$query = "SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id";
$result = mysql_query($query) or die("Couldn't execute query. ".mysql_error());
echo " <select name=\"cat_id\">\n";
echo " <option value=\"All\"";
if ($cat_id == 'All')
echo " selected";
echo "> All</option>\n";
while($row = mysql_fetch_object($result)) {
echo " <option value=\"".$row->cat_id."\"";
if ($row->cat_id == $cat_id)
echo " selected";
echo ">".$row->cat_id.": ".$row->cat_name;
if ($row->auto_toggle == 'Y')
echo ' (auto toggle)';
echo "</option>\n";
}
echo " </select>\n";
?>
</td>
<td>
<select name="order_by">
<option value="order_id" <?php if ($order_by == 'order_id') echo " selected";?>>Id</option>
<option value="order_name" <?php if ($order_by == 'order_name') echo " selected";?>>Name</option>
<option value="order_url" <?php if ($order_by == 'order_url') echo " selected";?>>URL</option>
<option value="order_desc" <?php if ($order_by == 'order_desc') echo " selected";?>>Description</option>
<option value="order_owner" <?php if ($order_by == 'order_owner') echo " selected";?>>Owner</option>
<option value="order_rating" <?php if ($order_by == 'order_rating') echo " selected";?>>Rating</option>
</select>
</td>
<td>
<input type="submit" name="action" value="Show" class="search" />
</td>
</tr>
</table>
</form>
<?php echo $tablebottom ?>
<?php echo $blankline ?>
<?php echo $tabletop ?>
<table width="100%" cellpadding="1" cellspacing="0" border="0">
<form name="links" method="post">
<input type="hidden" name="link_id" value="" />
<input type="hidden" name="action" value="" />
<input type="hidden" name="order_by" value="<?php echo $order_by ?>" />
<input type="hidden" name="cat_id" value="<?php echo $cat_id ?>" />
<tr >
<td style="border-bottom: 1px dotted #9C9A9C;"><b>URL</b></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><b>Name</b></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><b>Img?</b></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><b>Vis?</b></td>
<td style="border-bottom: 1px dotted #9C9A9C;"><b>Category</b></td>
<td style="border-bottom: 1px dotted #9C9A9C;">&nbsp;</td>
<td style="border-bottom: 1px dotted #9C9A9C;">&nbsp;</td>
</tr>
<?php
$sql = "SELECT link_url, link_name, link_image, link_description, link_visible, link_category AS cat_id, cat_name AS category, $tableusers.user_login, link_id, link_rating, link_rel "
. " FROM $tablelinks LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id "
. " LEFT JOIN $tableusers on $tableusers.ID = $tablelinks.link_owner ";
// have we got a where clause?
if (($use_adminlevels) || (isset($cat_id) && ($cat_id != 'All')) ) {
$sql .= " WHERE ";
}
if ($use_adminlevels) {
$sql .= " ($tableusers.user_level <= $user_level"
. " OR $tableusers.ID = $user_ID)";
}
if (isset($cat_id) && ($cat_id != 'All')) {
// have we already started the where clause?
if ($use_adminlevels) {
$sql .= " AND ";
}
$sql .= " link_category = $cat_id ";
}
$sql .= " ORDER BY link_".$sqlorderby;
//echo "$sql";
$result = mysql_query($sql) or die("Couldn't execute query.".mysql_error());
while ($row = mysql_fetch_object($result)) {
$short_url = str_replace('http://', '', $row->link_url);
if (strlen($short_url) > 35) {
$short_url = substr($short_url, 0, 32).'...';
}
echo("<tr>\n");
echo(" <td ><a href=\"".$row->link_url."\">".$short_url."</a></td>\n");
echo(" <td >".stripslashes($row->link_name)."</td>\n");
if ($row->link_image != null) {
echo(" <td align=\"center\">Y</td>\n");
} else {
echo(" <td align=\"center\">N</td>\n");
}
if ($row->link_visible == 'Y') {
echo(" <td align=\"center\">Y</td>\n");
} else {
echo(" <td align=\"center\">N</td>\n");
}
echo(" <td>".stripslashes($row->category)."</td>\n");
echo(" <td><input type=\"submit\" name=\"edit\" onclick=\"forms['links'].link_id.value='$row->link_id'; forms['links'].action.value='linkedit'; \" value=\"Edit\" class=\"search\" /></td>\n");
echo(" <td><input type=\"submit\" name=\"delete\" onclick=\"forms['links'].link_id.value='$row->link_id'; forms['links'].action.value='Delete'; return confirm('You are about to delete this link.\\n \'Cancel\' to stop, \'OK\' to delete.'); \" value=\"Delete\" class=\"search\" /></td>\n");
echo("</tr>\n");
echo("<tr>\n");
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" colspan=\"2\"><b>Desc:</b>&nbsp;".stripslashes($row->link_description)."</td>\n");
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" ><b>Rel:</b></td>\n");
$my_rel = stripslashes($row->link_rel);
if ($my_rel == '') {
$my_rel = '&nbsp;';
}
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" >$my_rel</td>\n");
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" ><b>Rating:</b>&nbsp;".$row->link_rating."</td>\n");
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" valign=\"top\"><b>Owner:</b></td>\n");
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" valign=\"top\">".$row->user_login."</td>\n");
echo("</tr>\n");
}
?>
</form>
</table>
<?php
} // end if !popup
?>
<?php echo $tablebottom ?>
<?php echo $blankline ?>
<?php echo $tabletop ?>
<table width="95%" cellpadding="5" cellspacing="0" border="0">
<form name="addlink" method="post">
<input type="hidden" name="action" value="Add" />
<tr><td colspan="2"><b>Add</b> a link:</td></tr>
<tr height="20">
<td height="20" align="right">URL:</td>
<td><input type="text" name="linkurl" size="80" value="http://<?php echo $link_url; ?>"></td>
</tr>
<tr height="20">
<td height="20" align="right">Display Name/Alt text:</td>
<td><input type="text" name="name" size="80" value="<?php echo $name; ?>"></td>
</tr>
<tr height="20">
<td height="20" align="right">Image:</td>
<td><input type="text" name="image" size="80" value=""></td>
</tr>
<tr height="20">
<td height="20" align="right">Description:</td>
<td><input type="text" name="description" size="80" value=""></td>
</tr>
<tr height="20">
<td height="20" align="right">Rel:</td>
<td><input type="text" name="rel" size="80" value=""></td>
</tr>
<tr height="20">
<td height="20" align="right">Rating:</td>
<td>
<select name="rating" size="1">
<?php
for ($r = 0; $r < 10; $r++) {
echo(' <option value="'.$r.'">'.$r.'</option>');
}
?>
</select>&nbsp;(Leave at 0 for no rating.)
</td>
</tr>
<tr height="20">
<td height="20" align="right">Target:</td>
<td><input type="radio" name="target" checked="checked" value="_blank">_blank&nbsp;<input type="radio" name="target" value="_top">_top</td>
</tr>
<tr height="20">
<td height="20" align="right">Visible:</td>
<td><input type="radio" name="visible" checked="checked" value="Y">Y&nbsp;<input type="radio" name="visible" value="N">N</td>
</tr>
<tr height="20">
<td height="20" align="right">Category:</td>
<td>
<?php
$query = "SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id";
$result = mysql_query($query) or die("Couldn't execute query. ".mysql_error());
echo " <select name=\"category\" size=\"1\">\n";
while($row = mysql_fetch_object($result)) {
echo " <option value=\"".$row->cat_id."\"";
if ($row->cat_id == $cat_id)
echo " selected";
echo ">".$row->cat_id.": ".$row->cat_name;
if ($row->auto_toggle == 'Y')
echo ' (auto toggle)';
echo "</option>\n";
}
echo " </select>\n";
?>
</td>
</tr>
<tr height="20">
<td colspan="2" align="center">
<input type="submit" name="submit" value="Add" class="search">
</td>
</tr>
</table>
<?php
break;
} // end default
} // end case
?>
<?php echo $tablebottom ?>
<?php include("b2footer.php") ?>