mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 09:07:59 +01:00
More changes for new admin path. Removed relocated files.
Moved some more files from b2-include to wp-admin. git-svn-id: http://svn.automattic.com/wordpress/trunk@40 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6a2e45d897
commit
fc2d7206bb
@ -1,150 +0,0 @@
|
||||
<?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"> </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"> </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($b2inc.'/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>
|
@ -1,412 +0,0 @@
|
||||
<?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">
|
||||
<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>
|
||||
<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;" /?> to <input type="text" name="postend" value="<?php echo $postend ?>" style="width:40px;" /?>
|
||||
<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>
|
||||
<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 <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"> <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> <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;" /?> to <input type="text" name="postend" value="<?php echo $postend ?>" style="width:40px;" /?> <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> <input type="submit" name="submitXtoX" class="search" value="OK" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php echo $tablebottom ?>
|
@ -1,23 +0,0 @@
|
||||
</div>
|
||||
</td></table>
|
||||
<?php
|
||||
if ($debug=="1") {
|
||||
echo "<p>$querycount queries - ".number_format(timer_stop(),3)." seconds";
|
||||
}
|
||||
?>
|
||||
<p> </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>
|
@ -1,30 +0,0 @@
|
||||
<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($b2inc."/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="b2login.php?action=logout">Logout</a></li>
|
||||
</ul>
|
||||
|
||||
<h2><?php echo $title; ?></h2>
|
@ -1,33 +0,0 @@
|
||||
<script src="<?php echo $b2inc ?>/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="<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="<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>
|
@ -130,7 +130,7 @@ $b2_htmltranswinuni = array(
|
||||
# these are used for b2's interface design
|
||||
$tabletop = "\t<table cellspacing=\"0\" cellpadding=\"1\" width=\"85%\" border=\"0\" bgcolor=\"#cccccc\" align=\"center\">\n\t<td align=\"left\">\n\t\t<table cellspacing=\"0\" cellpadding=\"15\" width=\"100%\" border=\"0\"bgcolor=\"#ffffff\" align=\"center\">\n\t\t<td align=\"left\">\n";
|
||||
$tablebottom = "\t\t</td>\n\t</table>\n\t</td>\n\t</table>\n";
|
||||
$blankline = '<img src="b2-img/blank.gif" width="10" height="5" border="0" /><br />';
|
||||
$blankline = '<img src="../b2-img/blank.gif" width="10" height="5" border="0" /><br />';
|
||||
|
||||
# on which page are we ?
|
||||
$PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
|
||||
|
176
b2categories.php
176
b2categories.php
@ -1,176 +0,0 @@
|
||||
<?php
|
||||
$title = "Categories";
|
||||
/* <Categories> */
|
||||
|
||||
function add_magic_quotes($array) {
|
||||
foreach ($array as $k => $v) {
|
||||
if (is_array($v)) {
|
||||
$array[$k] = add_magic_quotes($v);
|
||||
} else {
|
||||
$array[$k] = addslashes($v);
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
if (!get_magic_quotes_gpc()) {
|
||||
$HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS);
|
||||
$HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS);
|
||||
$HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS);
|
||||
}
|
||||
|
||||
$b2varstoreset = array('action','standalone','cat');
|
||||
for ($i=0; $i<count($b2varstoreset); $i += 1) {
|
||||
$b2var = $b2varstoreset[$i];
|
||||
if (!isset($$b2var)) {
|
||||
if (empty($HTTP_POST_VARS["$b2var"])) {
|
||||
if (empty($HTTP_GET_VARS["$b2var"])) {
|
||||
$$b2var = '';
|
||||
} else {
|
||||
$$b2var = $HTTP_GET_VARS["$b2var"];
|
||||
}
|
||||
} else {
|
||||
$$b2var = $HTTP_POST_VARS["$b2var"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch($action) {
|
||||
|
||||
case "addcat":
|
||||
|
||||
$standalone = 1;
|
||||
require_once("./b2header.php");
|
||||
|
||||
if ($user_level < 3)
|
||||
die ("Cheatin' uh ?");
|
||||
|
||||
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
|
||||
|
||||
$query="INSERT INTO $tablecategories (cat_ID,cat_name) VALUES ('0', '$cat_name')";
|
||||
$result=mysql_query($query) or die("Couldn't add category <b>$cat_name</b>");
|
||||
|
||||
header("Location: b2categories.php");
|
||||
|
||||
break;
|
||||
|
||||
case "Delete":
|
||||
|
||||
$standalone = 1;
|
||||
require_once("./b2header.php");
|
||||
|
||||
$cat_ID = $HTTP_POST_VARS["cat_ID"];
|
||||
$cat_name=get_catname($cat_ID);
|
||||
$cat_name=addslashes($cat_name);
|
||||
|
||||
if ($cat_ID=="1")
|
||||
die("Can't delete the <b>$cat_name</b> category: this is the default one");
|
||||
|
||||
if ($user_level < 3)
|
||||
die ("Cheatin' uh ?");
|
||||
|
||||
$query="DELETE FROM $tablecategories WHERE cat_ID=\"$cat_ID\"";
|
||||
$result=mysql_query($query) or die("Couldn't delete category <b>$cat_name</b>".mysql_error());
|
||||
|
||||
$query="UPDATE $tableposts SET post_category='1' WHERE post_category='$cat_ID'";
|
||||
$result=mysql_query($query) or die("Couldn't reset category on posts where category was <b>$cat_name</b>");
|
||||
|
||||
header("Location: b2categories.php");
|
||||
|
||||
break;
|
||||
|
||||
case "Rename":
|
||||
|
||||
require_once ("./b2header.php");
|
||||
$cat_name=get_catname($HTTP_POST_VARS["cat_ID"]);
|
||||
$cat_name=addslashes($cat_name);
|
||||
?>
|
||||
<?php echo $blankline; ?>
|
||||
<?php echo $tabletop; ?>
|
||||
<p><b>Old</b> name: <?php echo $cat_name ?></p>
|
||||
<p>
|
||||
<form name="renamecat" action="b2categories.php" method="post">
|
||||
<b>New</b> name:<br />
|
||||
<input type="hidden" name="action" value="editedcat" />
|
||||
<input type="hidden" name="cat_ID" value="<?php echo $HTTP_POST_VARS["cat_ID"] ?>" />
|
||||
<input type="text" name="cat_name" value="<?php echo $cat_name ?>" /><br />
|
||||
<input type="submit" name="submit" value="Edit it !" class="search" />
|
||||
</form>
|
||||
<?php echo $tablebottom; ?>
|
||||
|
||||
<?php
|
||||
|
||||
break;
|
||||
|
||||
case "editedcat":
|
||||
|
||||
$standalone = 1;
|
||||
require_once("./b2header.php");
|
||||
|
||||
if ($user_level < 3)
|
||||
die ("Cheatin' uh ?");
|
||||
|
||||
$cat_name=addslashes($HTTP_POST_VARS["cat_name"]);
|
||||
$cat_ID=addslashes($HTTP_POST_VARS["cat_ID"]);
|
||||
|
||||
$query="UPDATE $tablecategories SET cat_name='$cat_name' WHERE cat_ID=$cat_ID";
|
||||
$result=mysql_query($query) or die("Couldn't edit category <b>$cat_name</b>: ".mysql_error());
|
||||
|
||||
header("Location: b2categories.php");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
$standalone=0;
|
||||
require_once ("./b2header.php");
|
||||
if ($user_level < 3) {
|
||||
die("You have no right to edit the categories for this blog.<br>Ask for a promotion to your <a href=\"mailto:$admin_email\">blog admin</a> :)");
|
||||
}
|
||||
?>
|
||||
|
||||
<?php echo $blankline ?>
|
||||
<?php echo $tabletop ?>
|
||||
<table width="" cellpadding="5" cellspacing="0">
|
||||
<form></form>
|
||||
<tr>
|
||||
<td>
|
||||
<form name="cats" method="post">
|
||||
<b>Edit</b> a category:<br />
|
||||
<?php
|
||||
$query="SELECT * FROM $tablecategories ORDER BY cat_ID";
|
||||
$result=mysql_query($query);
|
||||
echo "<select name=\"cat_ID\">\n";
|
||||
while($row = mysql_fetch_object($result)) {
|
||||
echo "\t<option value=\"".$row->cat_ID."\"";
|
||||
if ($row->cat_ID == $cat)
|
||||
echo " selected";
|
||||
echo ">".$row->cat_ID.": ".$row->cat_name."</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
?><br />
|
||||
<input type="submit" name="action" value="Delete" class="search" />
|
||||
<input type="submit" name="action" value="Rename" class="search" />
|
||||
</form>
|
||||
</p>
|
||||
<p>
|
||||
<b>Add</b> a category:<br />
|
||||
<form name="addcat" action="b2categories.php" method="post">
|
||||
<input type="hidden" name="action" value="addcat" />
|
||||
<input type="text" name="cat_name" /><br />
|
||||
<input type="submit" name="submit" value="Add it !" class="search" /></form></td></tr></table>
|
||||
<?php echo $tablebottom ?>
|
||||
|
||||
<br />
|
||||
|
||||
<?php echo $tabletop ?>
|
||||
<b>Note:</b><br />
|
||||
Deleting a category does not delete posts from that category.<br />It will just set them back to the default category <b><?php echo get_catname(1) ?></b>.
|
||||
<?php echo $tablebottom ?>
|
||||
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
|
||||
/* </Categories> */
|
||||
include($b2inc."/b2footer.php"); ?>
|
155
b2config.php
155
b2config.php
@ -5,13 +5,13 @@
|
||||
* */
|
||||
|
||||
|
||||
# Reminder: everything that starts with #, /* or // is a comment
|
||||
// Reminder: everything that starts with #, /* or // is a comment
|
||||
|
||||
/* Start editing */
|
||||
|
||||
# $siteurl is your blog's URL: for example, 'http://mydomain.com' (no trailing slash !)
|
||||
# $blogfilename is the name of the default file for your blog
|
||||
# $blogname is the name of your blog
|
||||
// $siteurl is your blog's URL: for example, 'http://mydomain.com' (no trailing slash !)
|
||||
// $blogfilename is the name of the default file for your blog
|
||||
// $blogname is the name of your blog
|
||||
|
||||
$siteurl = 'http://example.com';
|
||||
$blogfilename = 'index.php';
|
||||
@ -20,38 +20,38 @@ $blogdescription = "babblings !";
|
||||
|
||||
|
||||
|
||||
# $pathserver is where you have uploaded b2: for example, 'http://mydomain.com' (no ending slash !)
|
||||
# by default b2 is set to run in the folder your blog resides, same as $siteurl
|
||||
// $pathserver is where you have uploaded b2: for example, 'http://mydomain.com' (no ending slash !)
|
||||
// by default b2 is set to run in the folder your blog resides, same as $siteurl
|
||||
|
||||
$pathserver = 'http://example.com';
|
||||
|
||||
|
||||
# your email (obvious eh ?)
|
||||
// your email (obvious eh ?)
|
||||
$admin_email = 'you@example.com';
|
||||
|
||||
|
||||
# set this to 0 or 1, whether you want new users to be able to post entries once they registered
|
||||
// set this to 0 or 1, whether you want new users to be able to post entries once they registered
|
||||
$new_users_can_blog = 0;
|
||||
|
||||
|
||||
# set this to 0 or 1, whether you want to allow users to register on your blog.
|
||||
// set this to 0 or 1, whether you want to allow users to register on your blog.
|
||||
$users_can_register = 1;
|
||||
|
||||
|
||||
# day at the start of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, etc
|
||||
// day at the start of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, etc
|
||||
$start_of_week = 1;
|
||||
|
||||
|
||||
|
||||
// ** MySQL settings **
|
||||
|
||||
# fill with your database details
|
||||
// fill with your database details
|
||||
$dbname = 'b2'; // the name of the database
|
||||
$dbusername = 'user'; // your MySQL username
|
||||
$dbpassword = 'pass'; // ...and password
|
||||
$dbhost = 'localhost'; // 99% chances you won't need to change this value
|
||||
|
||||
# database tables' names (change them if you want to have multiple b2's in a single database)
|
||||
// database tables' names (change them if you want to have multiple b2's in a single database)
|
||||
$tableposts = 'b2posts';
|
||||
$tableusers = 'b2users';
|
||||
$tablesettings = 'b2settings';
|
||||
@ -61,7 +61,7 @@ $tablecomments = 'b2comments';
|
||||
|
||||
// ** Post preview function **
|
||||
|
||||
# set this to 1 if you want to use the 'preview' function
|
||||
// set this to 1 if you want to use the 'preview' function
|
||||
$use_preview = 1;
|
||||
|
||||
|
||||
@ -69,137 +69,137 @@ $use_preview = 1;
|
||||
// ** Spell Checker functions **
|
||||
|
||||
|
||||
# set this to 0 to disable the spell checker, or 1 to enable it
|
||||
// set this to 0 to disable the spell checker, or 1 to enable it
|
||||
$use_spellchecker = 0;
|
||||
|
||||
|
||||
|
||||
// ** Text formatting options **
|
||||
|
||||
# these options can help you format your text without using too much html
|
||||
// these options can help you format your text without using too much html
|
||||
$use_bbcode = 0; // use BBCode, like [b]bold[/b]
|
||||
$use_gmcode = 0; // use GreyMatter-styles: **bold** \italic\ __underline__
|
||||
$use_quicktags = 1; // buttons for HTML tags (they won't work on IE Mac yet)
|
||||
|
||||
# IMPORTANT! set this to 0 if you are using Chinese, Japanese, Korean,
|
||||
# or other double-bytes languages
|
||||
// IMPORTANT! set this to 0 if you are using Chinese, Japanese, Korean,
|
||||
// or other double-bytes languages
|
||||
$use_htmltrans = 1;
|
||||
|
||||
# this could help balance your HTML code. if it gives bad results, set it to 0
|
||||
// this could help balance your HTML code. if it gives bad results, set it to 0
|
||||
$use_balanceTags = 1;
|
||||
|
||||
|
||||
// ** Image upload **
|
||||
|
||||
|
||||
# set this to 0 to disable file upload, or 1 to enable it
|
||||
$use_fileupload = 0;
|
||||
// set this to 0 to disable file upload, or 1 to enable it
|
||||
$use_fileupload = 1;
|
||||
|
||||
# enter the real path of the directory where you'll upload the pictures
|
||||
# if you're unsure about what your real path is, please ask your host's support staff
|
||||
# note that the directory must be writable by the webserver (ChMod 766)
|
||||
# note for windows-servers users: use forwardslashes instead of backslashes
|
||||
#$fileupload_realpath = '/home/your/site/b2/images';
|
||||
// enter the real path of the directory where you'll upload the pictures
|
||||
// if you're unsure about what your real path is, please ask your host's support staff
|
||||
// note that the directory must be writable by the webserver (ChMod 766)
|
||||
// note for windows-servers users: use forwardslashes instead of backslashes
|
||||
//$fileupload_realpath = '/home/your/site/b2/images';
|
||||
$fileupload_realpath = '/home/example/public_html/images';
|
||||
|
||||
# enter the URL of that directory (it's used to generate the links to the pictures)
|
||||
// enter the URL of that directory (it's used to generate the links to the pictures)
|
||||
$fileupload_url = 'http://example.com/images';
|
||||
|
||||
# accepted file types, you can add to that list if you want
|
||||
# note: add a space before and after each file type
|
||||
# example: $fileupload_allowedtypes = ' jpg gif png ';
|
||||
// accepted file types, you can add to that list if you want
|
||||
// note: add a space before and after each file type
|
||||
// example: $fileupload_allowedtypes = ' jpg gif png ';
|
||||
$fileupload_allowedtypes = ' jpg gif png ';
|
||||
|
||||
# by default, most servers limit the size of uploads to 2048 KB
|
||||
# if you want to set it to a lower value, here it is (you cannot set a higher value)
|
||||
// by default, most servers limit the size of uploads to 2048 KB
|
||||
// if you want to set it to a lower value, here it is (you cannot set a higher value)
|
||||
$fileupload_maxk = '96';
|
||||
|
||||
# you may not want all users to upload pictures/files, so you can set a minimum level for this
|
||||
// you may not want all users to upload pictures/files, so you can set a minimum level for this
|
||||
$fileupload_minlevel = '1';
|
||||
|
||||
# ...or you may authorize only some users. enter their logins here, separated by spaces
|
||||
# if you leave that variable blank, all users who have the minimum level are authorized to upload
|
||||
# note: add a space before and after each login name
|
||||
# example: $fileupload_allowedusers = ' barbara anne ';
|
||||
// ...or you may authorize only some users. enter their logins here, separated by spaces
|
||||
// if you leave that variable blank, all users who have the minimum level are authorized to upload
|
||||
// note: add a space before and after each login name
|
||||
// example: $fileupload_allowedusers = ' barbara anne ';
|
||||
$fileupload_allowedusers = '';
|
||||
|
||||
|
||||
|
||||
// ** RSS syndication options **
|
||||
|
||||
# these options are used by b2rdf.php (1.0), b2rss.php (0.92), and b2rss2.php (2.0)
|
||||
# note: if you don't want to syndicate your news, you can delete these files
|
||||
// these options are used by b2rdf.php (1.0), b2rss.php (0.92), and b2rss2.php (2.0)
|
||||
// note: if you don't want to syndicate your news, you can delete these files
|
||||
|
||||
# number of last posts to syndicate
|
||||
// number of last posts to syndicate
|
||||
$posts_per_rss = 10;
|
||||
|
||||
# the language of your blog ( see this: http://backend.userland.com/stories/storyReader$16 )
|
||||
// the language of your blog ( see this: http://backend.userland.com/stories/storyReader$16 )
|
||||
$rss_language = 'en';
|
||||
|
||||
# for b2rss.php: allow encoded HTML in <description> tag? 1=yes, 0=no
|
||||
// for b2rss.php: allow encoded HTML in <description> tag? 1=yes, 0=no
|
||||
$rss_encoded_html = 0;
|
||||
|
||||
# length (in words) of excerpts in the RSS feed? 0=unlimited
|
||||
# note: in b2rss.php, this will be set to 0 if you use encoded HTML
|
||||
// length (in words) of excerpts in the RSS feed? 0=unlimited
|
||||
// note: in b2rss.php, this will be set to 0 if you use encoded HTML
|
||||
$rss_excerpt_length = 50;
|
||||
#use the excerpt field for rss feed.
|
||||
//use the excerpt field for rss feed.
|
||||
$rss_use_excerpt = 1;
|
||||
|
||||
|
||||
// ** Weblogs.com ping **
|
||||
|
||||
# set this to 1 if you want your site to be listed on http://weblogs.com when you add a new post
|
||||
// set this to 1 if you want your site to be listed on http://weblogs.com when you add a new post
|
||||
$use_weblogsping = 0;
|
||||
|
||||
|
||||
// ** Blo.gs ping **
|
||||
|
||||
# set this to 1 if you want your site to be listed on http://blo.gs when you add a new post
|
||||
// set this to 1 if you want your site to be listed on http://blo.gs when you add a new post
|
||||
$use_blodotgsping = 0;
|
||||
|
||||
# if you ping blo.gs, this is the URL that will be sent to it (enter your blog's URL):
|
||||
// if you ping blo.gs, this is the URL that will be sent to it (enter your blog's URL):
|
||||
$blodotgsping_url = 'http://example.com';
|
||||
|
||||
|
||||
|
||||
// ** Trackback / PingBack **
|
||||
|
||||
# set this to 0 or 1, whether you want to allow your posts to be trackback'able or not
|
||||
# note: setting it to zero would also disable sending trackbacks
|
||||
// set this to 0 or 1, whether you want to allow your posts to be trackback'able or not
|
||||
// note: setting it to zero would also disable sending trackbacks
|
||||
$use_trackback = 1;
|
||||
|
||||
# set this to 0 or 1, whether you want to allow your posts to be pingback'able or not
|
||||
# note: setting it to zero would also disable sending pingbacks
|
||||
// set this to 0 or 1, whether you want to allow your posts to be pingback'able or not
|
||||
// note: setting it to zero would also disable sending pingbacks
|
||||
$use_pingback = 1;
|
||||
|
||||
|
||||
|
||||
// ** Comments options **
|
||||
|
||||
# set this to 1 to require e-mail and name, or 0 to allow comments without e-mail/name
|
||||
// set this to 1 to require e-mail and name, or 0 to allow comments without e-mail/name
|
||||
$require_name_email = 0;
|
||||
|
||||
# here is a list of the tags that are allowed in the comments.
|
||||
# you can add tags to the list, just add them in the string,
|
||||
# add only the opening tag: for example, only '<a>' instead of '<a href=""></a>'
|
||||
// here is a list of the tags that are allowed in the comments.
|
||||
// you can add tags to the list, just add them in the string,
|
||||
// add only the opening tag: for example, only '<a>' instead of '<a href=""></a>'
|
||||
|
||||
$comment_allowed_tags = '<b><i><u><strong><em><code><blockquote><p><br><strike><a>';
|
||||
|
||||
# set this to 1 to let every author be notified about comments on their posts
|
||||
// set this to 1 to let every author be notified about comments on their posts
|
||||
$comments_notify = 1;
|
||||
|
||||
|
||||
|
||||
// ** Smilies options **
|
||||
|
||||
# set this to 1 to enable smiley conversion in posts
|
||||
# (note: this makes smiley conversion in ALL posts)
|
||||
// set this to 1 to enable smiley conversion in posts
|
||||
// (note: this makes smiley conversion in ALL posts)
|
||||
$use_smilies = 0;
|
||||
|
||||
# the directory where your smilies are (no trailing slash)
|
||||
// the directory where your smilies are (no trailing slash)
|
||||
$smilies_directory = 'http://example.com/b2-img/smilies';
|
||||
|
||||
# here's the conversion table, you can modify it if you know what you're doing
|
||||
// here's the conversion table, you can modify it if you know what you're doing
|
||||
$b2smiliestrans = array(
|
||||
':)' => 'icon_smile.gif',
|
||||
':D' => 'icon_biggrin.gif',
|
||||
@ -249,7 +249,7 @@ $b2smiliestrans = array(
|
||||
);
|
||||
|
||||
|
||||
# the weekdays and the months.. translate them if necessary
|
||||
// the weekdays and the months.. translate them if necessary
|
||||
|
||||
$weekday[0]='Sunday';
|
||||
$weekday[1]='Monday';
|
||||
@ -260,7 +260,7 @@ $weekday[5]='Friday';
|
||||
$weekday[6]='Saturday';
|
||||
|
||||
|
||||
# the months, translate them if necessary - note: this isn't active everywhere yet
|
||||
// the months, translate them if necessary - note: this isn't active everywhere yet
|
||||
$month['01']='January';
|
||||
$month['02']='February';
|
||||
$month['03']='March';
|
||||
@ -276,8 +276,8 @@ $month['12']='December';
|
||||
|
||||
|
||||
|
||||
# $b2inc is where the included b2 files are: that's generally the directory b2-include,
|
||||
# so you shouldn't have to change that setting
|
||||
// $b2inc is where the included b2 files are: that's generally the directory b2-include,
|
||||
// so you shouldn't have to change that setting
|
||||
$b2inc = 'b2-include';
|
||||
|
||||
|
||||
@ -292,31 +292,31 @@ $querystring_separator = '&';
|
||||
|
||||
// ** Configuration for b2mail.php ** (skip this if you don't intend to blog via email)
|
||||
|
||||
# mailserver settings
|
||||
// mailserver settings
|
||||
$mailserver_url = 'mail.example.com';
|
||||
$mailserver_login = 'login@example.com';
|
||||
$mailserver_pass = 'password';
|
||||
$mailserver_port = 110;
|
||||
|
||||
# by default posts will have this category
|
||||
// by default posts will have this category
|
||||
$default_category = 1;
|
||||
|
||||
# subject prefix
|
||||
// subject prefix
|
||||
$subjectprefix = 'blog:';
|
||||
|
||||
# body terminator string (starting from this string, everything will be ignored, including this string)
|
||||
// body terminator string (starting from this string, everything will be ignored, including this string)
|
||||
$bodyterminator = "___";
|
||||
|
||||
# set this to 1 to run in test mode
|
||||
// set this to 1 to run in test mode
|
||||
$thisisforfunonly = 0;
|
||||
|
||||
|
||||
### Special Configuration for some phone email services
|
||||
////// Special Configuration for some phone email services
|
||||
|
||||
# some mobile phone email services will send identical subject & content on the same line
|
||||
# if you use such a service, set $use_phoneemail to 1, and indicate a separator string
|
||||
# when you compose your message, you'll type your subject then the separator string
|
||||
# then you type your login:password, then the separator, then content
|
||||
// some mobile phone email services will send identical subject & content on the same line
|
||||
// if you use such a service, set $use_phoneemail to 1, and indicate a separator string
|
||||
// when you compose your message, you'll type your subject then the separator string
|
||||
// then you type your login:password, then the separator, then content
|
||||
|
||||
$use_phoneemail = 0;
|
||||
$phoneemail_separator = ':::';
|
||||
@ -339,6 +339,9 @@ $path = $pathserver;
|
||||
$base = $dbname;
|
||||
|
||||
// This is so the new admin location works
|
||||
ini_set('include_path', ".:../:../$b2inc");
|
||||
// Set this path separator appropriately for your OS: semi-colon on windows, colon on unix
|
||||
//$path_sep=';';
|
||||
$path_sep=':';
|
||||
ini_set('include_path', '.'.$path_sep.'..'.$path_sep."../$b2inc".$path_sep."./$b2inc");
|
||||
|
||||
?>
|
||||
?>
|
348
b2edit.php
348
b2edit.php
@ -1,348 +0,0 @@
|
||||
<?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($b2inc."/b2edit.form.php");
|
||||
|
||||
} else {
|
||||
?>
|
||||
|
||||
Since you're a newcomer, you'll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />You can also <a href="mailto:<?php echo $admin_email ?>?subject=b2-promotion">e-mail the admin</a> to ask for a promotion.<br />When you're promoted, just reload this page and you'll be able to blog. :)
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "editpost":
|
||||
|
||||
$standalone = 1;
|
||||
require_once("./b2header.php");
|
||||
|
||||
if ($user_level == 0)
|
||||
die ("Cheatin' uh ?");
|
||||
|
||||
if (!isset($blog_ID)) {
|
||||
$blog_ID = 1;
|
||||
}
|
||||
$post_ID = $HTTP_POST_VARS["post_ID"];
|
||||
$post_category = intval($HTTP_POST_VARS["post_category"]);
|
||||
$post_autobr = intval($HTTP_POST_VARS["post_autobr"]);
|
||||
$content = balanceTags($HTTP_POST_VARS["content"]);
|
||||
$content = format_to_post($content);
|
||||
$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($b2inc."/b2edit.form.php");
|
||||
|
||||
break;
|
||||
|
||||
case "deletecomment":
|
||||
|
||||
$standalone = 1;
|
||||
require_once("./b2header.php");
|
||||
|
||||
if ($user_level == 0)
|
||||
die ("Cheatin' uh ?");
|
||||
|
||||
$comment = $HTTP_GET_VARS['comment'];
|
||||
$p = $HTTP_GET_VARS['p'];
|
||||
$commentdata=get_commentdata($comment) or die("Oops, no comment with this ID. <a href=\"b2edit.php\">Go back</a> !");
|
||||
|
||||
$query = "DELETE FROM $tablecomments WHERE comment_ID=$comment";
|
||||
$result = mysql_query($query) or die("Oops, no comment with this ID. <a href=\"b2edit.php\">Go back</a> !");
|
||||
|
||||
header ("Location: b2edit.php?p=$p&c=1#comments"); //?a=dc");
|
||||
|
||||
break;
|
||||
|
||||
case "editedcomment":
|
||||
|
||||
$standalone = 1;
|
||||
require_once("./b2header.php");
|
||||
|
||||
if ($user_level == 0)
|
||||
die ("Cheatin' uh ?");
|
||||
|
||||
$comment_ID = $HTTP_POST_VARS['comment_ID'];
|
||||
$comment_post_ID = $HTTP_POST_VARS['comment_post_ID'];
|
||||
$newcomment_author = $HTTP_POST_VARS['newcomment_author'];
|
||||
$newcomment_author_email = $HTTP_POST_VARS['newcomment_author_email'];
|
||||
$newcomment_author_url = $HTTP_POST_VARS['newcomment_author_url'];
|
||||
$newcomment_author = addslashes($newcomment_author);
|
||||
$newcomment_author_email = addslashes($newcomment_author_email);
|
||||
$newcomment_author_url = addslashes($newcomment_author_url);
|
||||
$post_autobr = $HTTP_POST_VARS["post_autobr"];
|
||||
|
||||
if (($user_level > 4) && (!empty($HTTP_POST_VARS["edit_date"]))) {
|
||||
$aa = $HTTP_POST_VARS["aa"];
|
||||
$mm = $HTTP_POST_VARS["mm"];
|
||||
$jj = $HTTP_POST_VARS["jj"];
|
||||
$hh = $HTTP_POST_VARS["hh"];
|
||||
$mn = $HTTP_POST_VARS["mn"];
|
||||
$ss = $HTTP_POST_VARS["ss"];
|
||||
$jj = ($jj > 31) ? 31 : $jj;
|
||||
$hh = ($hh > 23) ? $hh - 24 : $hh;
|
||||
$mn = ($mn > 59) ? $mn - 60 : $mn;
|
||||
$ss = ($ss > 59) ? $ss - 60 : $ss;
|
||||
$datemodif = ", comment_date=\"$aa-$mm-$jj $hh:$mn:$ss\"";
|
||||
} else {
|
||||
$datemodif = "";
|
||||
}
|
||||
$content = balanceTags($content);
|
||||
$content = format_to_post($content);
|
||||
|
||||
$query = "UPDATE $tablecomments SET comment_content=\"$content\", comment_author=\"$newcomment_author\", comment_author_email=\"$newcomment_author_email\", comment_author_url=\"$newcomment_author_url\"".$datemodif." WHERE comment_ID=$comment_ID";
|
||||
$result = mysql_query($query) or mysql_oops($query);
|
||||
|
||||
header ("Location: b2edit.php?p=$comment_post_ID&c=1#comments"); //?a=ec");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
$standalone=0;
|
||||
require_once ("./b2header.php");
|
||||
|
||||
if ($user_level > 0) {
|
||||
if ((!$withcomments) && (!$c)) {
|
||||
|
||||
$action="post";
|
||||
include($b2inc."/b2edit.form.php");
|
||||
echo "<br /><br />";
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
echo $tabletop; ?>
|
||||
Since you're a newcomer, you'll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />You can also <a href="mailto:<?php echo $admin_email ?>?subject=b2-promotion">e-mail the admin</a> to ask for a promotion.<br />When you're promoted, just reload this page and you'll be able to blog. :)
|
||||
<?php
|
||||
echo $tablebottom;
|
||||
echo "<br /><br />";
|
||||
|
||||
}
|
||||
|
||||
include($b2inc."/b2edit.showposts.php");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* </Edit> */
|
||||
include($b2inc."/b2footer.php") ?>
|
159
b2header.php
159
b2header.php
@ -1,159 +0,0 @@
|
||||
<?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="<?php echo $b2inc; ?>/b2.css" type="text/css">
|
||||
<style type="text/css">
|
||||
<!--
|
||||
<?php
|
||||
if (!$is_NS4) {
|
||||
?>
|
||||
td.menutop {
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
border-color: #999999;
|
||||
border-top-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 0px;
|
||||
border-right-width: 0px;
|
||||
border-style: dashed;
|
||||
}
|
||||
textarea,input,select {
|
||||
background-color: #f0f0f0;
|
||||
border-width: 1px;
|
||||
border-color: #cccccc;
|
||||
border-style: solid;
|
||||
padding: 2px;
|
||||
margin: 1px;
|
||||
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($b2inc."/b2menutop.php") ?>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td valign="top">
|
||||
<div class="panelbody">
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
104
b2install.php
104
b2install.php
@ -1,104 +0,0 @@
|
||||
<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 />";
|
||||
|
||||
require_once("wp-links/links.install.php");
|
||||
?>
|
||||
|
||||
<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>
|
@ -295,7 +295,7 @@ default:
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); /* different all the time */
|
||||
header("Cache-Control: no-cache, must-revalidate"); /* to cope with HTTP/1.1 */
|
||||
header("Pragma: no-cache");
|
||||
header("Location: b2edit.php");
|
||||
header("Location: wp-admin/b2edit.php");
|
||||
exit();
|
||||
}
|
||||
?><html>
|
||||
@ -352,7 +352,7 @@ if ($error) echo "<div align=\"right\" style=\"padding:4px;\"><font color=\"#FF0
|
||||
<input type="hidden" name="popupurl" value="<?php echo $popupurl ?>" />
|
||||
<input type="hidden" name="popuptitle" value="<?php echo $popuptitle ?>" />
|
||||
<?php } ?>
|
||||
<input type="hidden" name="redirect_to" value="b2edit.php" />
|
||||
<input type="hidden" name="redirect_to" value="wp-admin/b2edit.php" />
|
||||
<input type="hidden" name="action" value="login" />
|
||||
<table width="100" style="background-color: #ffffff">
|
||||
<tr><td align="right">login</td>
|
||||
|
193
b2options.php
193
b2options.php
@ -1,193 +0,0 @@
|
||||
<?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"> </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($b2inc."/b2footer.php") ?>
|
468
b2profile.php
468
b2profile.php
@ -1,468 +0,0 @@
|
||||
<?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"> IE one-click bookmarklet</div>
|
||||
|
||||
<table width="100%" cellpadding="20">
|
||||
<tr><td>
|
||||
|
||||
<p>To have a one-click bookmarklet, just copy and paste this<br />into a new text file:</p>
|
||||
<?php
|
||||
$regedit = "REGEDIT4\r\n[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Post To &b2 : ".$blogname."]\r\n@=\"javascript:doc=external.menuArguments.document;Q=doc.selection.createRange().text;void(btw=window.open('".$pathserver."/b2bookmarklet.php?text='+escape(Q)+'".$bookmarklet_tbpb."&popupurl='+escape(doc.location.href)+'&popuptitle='+escape(doc.title),'b2bookmarklet','scrollbars=no,width=480,height=".$bookmarklet_height.",left=100,top=150,status=yes'));btw.focus();\"\r\n\"contexts\"=hex:31\"";
|
||||
?>
|
||||
<pre style="margin: 20px; background-color: #cccccc; border: 1px dashed #333333; padding: 5px; font-size: 12px;"><?php echo $regedit; ?></pre>
|
||||
<p>Save it as b2.reg, and double-click on this file in an Explorer<br />
|
||||
window. Answer Yes to the question, and restart Internet Explorer.<br /><br />
|
||||
That's it, you can now right-click in an IE window and select <br />
|
||||
'Post to b2' to make the bookmarklet appear :)</p>
|
||||
|
||||
<p align="center">
|
||||
<form>
|
||||
<input class="search" type="button" value="1" name="Close this window" />
|
||||
</form>
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
||||
<?php
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
$profile=1;
|
||||
include ("b2header.php");
|
||||
$profiledata=get_userdata($user_ID);
|
||||
|
||||
$bookmarklet_tbpb = ($use_trackback) ? '&trackback=1' : '';
|
||||
$bookmarklet_tbpb .= ($use_pingback) ? '&pingback=1' : '';
|
||||
$bookmarklet_height= ($use_trackback) ? 340 : 300;
|
||||
|
||||
?>
|
||||
|
||||
<form name="form" action="b2profile.php" method="post">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="checkuser_id" value="<?php echo $user_ID ?>" />
|
||||
<table width="100%">
|
||||
<td width="200" valign="top">
|
||||
|
||||
<table cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td align="right"><strong>login</strong></td>
|
||||
<td><?php echo $profiledata["user_login"] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><strong>first name</strong></td>
|
||||
<td><input type="text" name="newuser_firstname" value="<?php echo $profiledata["user_firstname"] ?>" class="postform" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><strong>last name</strong></td>
|
||||
<td><input type="text" name="newuser_lastname" value="<?php echo $profiledata["user_lastname"] ?>" class="postform" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><strong>nickname</strong></td>
|
||||
<td><input type="text" name="newuser_nickname" value="<?php echo $profiledata["user_nickname"] ?>" class="postform" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><strong>email</strong></td>
|
||||
<td><input type="text" name="newuser_email" value="<?php echo $profiledata["user_email"] ?>" class="postform" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><strong>URL</strong></td>
|
||||
<td><input type="text" name="newuser_url" value="<?php echo $profiledata["user_url"] ?>" class="postform" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><strong>ICQ</strong></td>
|
||||
<td><input type="text" name="newuser_icq" value="<?php if ($profiledata["user_icq"] > 0) { echo $profiledata["user_icq"]; } ?>" class="postform" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><strong>AIM</strong></td>
|
||||
<td><input type="text" name="newuser_aim" value="<?php echo $profiledata["user_aim"] ?>" class="postform" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><strong>MSN IM</strong></td>
|
||||
<td><input type="text" name="newuser_msn" value="<?php echo $profiledata["user_msn"] ?>" class="postform" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><strong>YahooIM</strong></td>
|
||||
<td><input type="text" name="newuser_yim" value="<?php echo $profiledata["user_yim"] ?>" class="postform" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</td>
|
||||
<td valign="top">
|
||||
|
||||
<table cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<strong>ID</strong> <?php echo $profiledata["ID"] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>level</strong> <?php echo $profiledata["user_level"] ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>posts</strong>
|
||||
<?php
|
||||
$posts=get_usernumposts($user_ID);
|
||||
echo $posts;
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<strong>identity</strong> on the blog:<br>
|
||||
<select name="newuser_idmode" class="postform">
|
||||
<option value="nickname"<?php
|
||||
if ($profiledata["user_idmode"]=="nickname")
|
||||
echo " selected"; ?>><?php echo $profiledata["user_nickname"] ?></option>
|
||||
<option value="login"<?php
|
||||
if ($profiledata["user_idmode"]=="login")
|
||||
echo " selected"; ?>><?php echo $profiledata["user_login"] ?></option>
|
||||
<option value="firstname"<?php
|
||||
if ($profiledata["user_idmode"]=="firstname")
|
||||
echo " selected"; ?>><?php echo $profiledata["user_firstname"] ?></option>
|
||||
<option value="lastname"<?php
|
||||
if ($profiledata["user_idmode"]=="lastname")
|
||||
echo " selected"; ?>><?php echo $profiledata["user_lastname"] ?></option>
|
||||
<option value="namefl"<?php
|
||||
if ($profiledata["user_idmode"]=="namefl")
|
||||
echo " selected"; ?>><?php echo $profiledata["user_firstname"]." ".$profiledata["user_lastname"] ?></option>
|
||||
<option value="namelf"<?php
|
||||
if ($profiledata["user_idmode"]=="namelf")
|
||||
echo " selected"; ?>><?php echo $profiledata["user_lastname"]." ".$profiledata["user_firstname"] ?></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<br />
|
||||
new <strong>password</strong> (twice)<br>
|
||||
<input type="password" name="pass1" size="16" value="" class="postform" /><br>
|
||||
<input type="password" name="pass2" size="16" value="" class="postform" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($user_level > 0) {
|
||||
?> <tr>
|
||||
<td><br /><strong>bookmarklet</strong><br />add the link to your Favorites/Bookmarks<br />
|
||||
<?php
|
||||
if ($is_NS4 || $is_gecko) {
|
||||
?>
|
||||
<a href="javascript:Q=document.selection?document.selection.createRange().text:document.getSelection();void(window.open('<?php echo $path ?>/b2bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'b2 bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));">b2 - <?php echo $blogname ?></a>
|
||||
<?php
|
||||
} else if ($is_winIE) {
|
||||
?>
|
||||
<a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(btw=window.open('<?php echo $path ?>/b2bookmarklet.php?text='+escape(Q)+'<?php echo $bookmarklet_tbpb ?>&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'b2bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();">b2 - <?php echo $blogname ?></a>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
function oneclickbookmarklet(blah) {
|
||||
window.open ("b2profile.php?action=IErightclick", "oneclickbookmarklet", "width=500, height=450, location=0, menubar=0, resizable=0, scrollbars=1, status=1, titlebar=0, toolbar=0, screenX=120, left=120, screenY=120, top=120");
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
|
||||
<br /><br />
|
||||
One-click bookmarklet:<br />
|
||||
<a href="javascript:oneclickbookmarklet(0);">click here</a>
|
||||
|
||||
<?php
|
||||
} else if ($is_opera) {
|
||||
?>
|
||||
<a href="javascript:void(window.open('<?php echo $path ?>/b2bookmarklet.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','b2bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));">b2 - <?php echo $blogname ?></a>
|
||||
<?php
|
||||
} else if ($is_macIE) {
|
||||
?>
|
||||
<a href="javascript:Q='';if(top.frames.length==0);void(btw=window.open('<?php echo $path ?>/b2bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title)+'<?php echo $bookmarklet_tbpb ?>','b2bookmarklet','scrollbars=no,width=480,height=<?php echo $bookmarklet_height ?>,left=100,top=150,status=yes'));btw.focus();">b2 - <?php echo $blogname ?></a> <?php
|
||||
}
|
||||
?>
|
||||
<?php if ($is_gecko) { ?>
|
||||
<br /><br />
|
||||
<script language="JavaScript">
|
||||
function addPanel()
|
||||
{
|
||||
if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function"))
|
||||
window.sidebar.addPanel("b2 post: <?php echo $blogname ?>","<?php echo $pathserver ?>/b2sidebar.php","");
|
||||
else
|
||||
alert('No Sidebar found! You must use Mozilla 0.9.4 or later!');
|
||||
}
|
||||
</script>
|
||||
<strong>SideBar</strong><br />
|
||||
Add the <a href="#" onClick="addPanel()">b2 Sidebar</a> !
|
||||
<?php } elseif (($is_winIE) || ($is_macIE)) { ?>
|
||||
<br /><br />
|
||||
<strong>SideBar</strong><br />
|
||||
Add this link to your favorites:<br /><a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;void(_search=open('<?php echo $pathserver ?>/b2sidebar.php?text='+escape(Q)+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title),'_search'))">b2 Sidebar</a>.
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?> </table>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center"><br /><input class="search" type="submit" value="Update" name="submit"><br />Note: closes the popup window.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* </Profile | My Profile> */
|
||||
include($b2inc."/b2footer.php") ?>
|
97
b2spell.php
97
b2spell.php
@ -1,97 +0,0 @@
|
||||
<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> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<P> </P>
|
||||
<TEXTAREA name=subject></TEXTAREA>
|
||||
<TEXTAREA name=messagebody></TEXTAREA>
|
||||
</FORM>
|
||||
</BODY>
|
||||
</HTML>
|
212
b2team.php
212
b2team.php
@ -1,212 +0,0 @@
|
||||
<?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"]." ".$user_data["user_lastname"]."</td>\n";
|
||||
echo "<td $bg2> <a href=\"mailto:$email\" title=\"e-mail: $email\"><img src=\"b2-img/email.gif\" border=\"0\" alt=\"e-mail: $email\" /></a> </td>";
|
||||
echo "<td $bg1> ";
|
||||
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> ";
|
||||
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"]." ".$user_data["user_lastname"]."</td>\n";
|
||||
echo "<td $bg1> <a href=\"mailto:".antispambot($email)."\" title=\"e-mail: ".antispambot($email)."\"><img src=\"b2-img/email.gif\" border=\"0\" alt=\"e-mail: ".antispambot($email)."\" /></a> </td>";
|
||||
echo "<td $bg2> ";
|
||||
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> ";
|
||||
echo "</td>\n";
|
||||
echo "<td $bg1>".$user_data["user_level"];
|
||||
if ($user_level >= 2)
|
||||
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=up\">+</a> ";
|
||||
if ($user_level >= 3)
|
||||
echo " <a href=\"b2team.php?action=delete&id=".$user_data["ID"]."\" style=\"color:red;font-weight:bold;\">X</a> ";
|
||||
echo "</td>\n";
|
||||
if ($user_level > 3) {
|
||||
echo "<td $bg2>".$user_data["user_login"]."</td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</table>
|
||||
</p>
|
||||
<?php echo $tablebottom ?>
|
||||
|
||||
<?php
|
||||
}
|
||||
if ($user_level >= 3) { ?>
|
||||
<br />
|
||||
<?php echo $tabletop ?>
|
||||
To delete an user, bring his/her level to zero, then click on the red cross.<br />
|
||||
<b>Warning:</b> deleting an user also deletes all posts made by this user.
|
||||
<?php echo $tablebottom ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* </Team> */
|
||||
include($b2inc."/b2footer.php") ?>
|
156
b2template.php
156
b2template.php
@ -1,156 +0,0 @@
|
||||
<?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","</textarea",$content);
|
||||
}
|
||||
|
||||
echo $blankline;
|
||||
echo $tabletop;
|
||||
?>
|
||||
<table width="100%" cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
echo "Listing <b>$file</b>".$warning;
|
||||
if ($a == "te")
|
||||
echo "<i> [ file edited ! ]</i>";
|
||||
|
||||
if (!$error) {
|
||||
?>
|
||||
<form name="template" action="b2template.php" method="post">
|
||||
<textarea cols="80" rows="20" style="width:100%" name="newcontent" tabindex="1"><?php echo $content ?></textarea>
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="file" value="<?php echo $file ?>" />
|
||||
<br />
|
||||
<?php
|
||||
if (is_writeable($file)) {
|
||||
echo "<input type=\"submit\" name=\"submit\" class=\"search\" value=\"update template !\" tabindex=\"2\" />";
|
||||
} else {
|
||||
echo "<input type=\"button\" name=\"oops\" class=\"search\" value=\"(you cannot update that file/template: must make it writable, e.g. CHMOD 766)\" tabindex=\"2\" />";
|
||||
}
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
echo "<p>oops, no such file !</p>";
|
||||
}
|
||||
echo $tablebottom;
|
||||
?>
|
||||
</td>
|
||||
</table>
|
||||
<br />
|
||||
<?php echo $tabletop; ?>
|
||||
You can also edit the <a href="b2template.php?file=b2comments.php">comments' template</a> or the <a href="b2template.php?file=b2commentspopup.php">popup comments' template</a>, or edit any other file (provided it's writable by the server, e.g. CHMOD 766).<br />
|
||||
<br />
|
||||
To edit a file, type its name here:
|
||||
<form name="file" action="b2template.php" method="get">
|
||||
<input type="text" name="file" />
|
||||
<input type="submit" name="submit" class="search" value="go" />
|
||||
</form>
|
||||
<br />
|
||||
Note: of course, you can also edit the files/templates in your text editor and upload them. This online editor is only meant to be used when you don't have access to a text editor...
|
||||
|
||||
<?php echo $tablebottom; ?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* </Template> */
|
||||
include($b2inc."/b2footer.php") ?>
|
250
b2upload.php
250
b2upload.php
@ -1,250 +0,0 @@
|
||||
<?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('"', '&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 = "<img src="$fileupload_url/$img1_name" border="0" alt="$imgdesc" />";
|
||||
} else {
|
||||
$piece_of_code = "<a href="$fileupload_url/$img1_name" title="$imgdesc" />$imgdesc</a>";
|
||||
};
|
||||
|
||||
?>
|
||||
|
||||
<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 "<img src="$fileupload_url/$img1_name" border="0" alt="" />"; ?></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>
|
@ -1,207 +0,0 @@
|
||||
<?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)
|
||||
// *****************************************************************
|
||||
|
||||
require_once('wp-links/links.config.php');
|
||||
require_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;
|
||||
require_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;
|
||||
require_once("./b2header.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":
|
||||
{
|
||||
require_once ("./b2header.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>
|
||||
<p>Back to <a href="linkcategories.php">manage link categories</a></p>
|
||||
<?php echo $tablebottom; ?>
|
||||
<?php
|
||||
break;
|
||||
} // end Edit
|
||||
case "editedcat":
|
||||
{
|
||||
$standalone = 1;
|
||||
require_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 editedcat
|
||||
default:
|
||||
{
|
||||
$standalone=0;
|
||||
require_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" /> <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($b2inc."/b2footer.php") ?>
|
567
linkmanager.php
567
linkmanager.php
@ -1,567 +0,0 @@
|
||||
<?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)
|
||||
// *****************************************************************
|
||||
|
||||
require_once('wp-links/links.config.php');
|
||||
require_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;
|
||||
require_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;
|
||||
require_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;
|
||||
require_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;
|
||||
require_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> (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 <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 <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"> <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;
|
||||
require_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;"> </td>
|
||||
<td style="border-bottom: 1px dotted #9C9A9C;"> </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> ".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 = ' ';
|
||||
}
|
||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" >$my_rel</td>\n");
|
||||
echo(" <td style=\"border-bottom: 1px dotted #9C9A9C;\" ><b>Rating:</b> ".$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="<?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> (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 <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 <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($b2inc."/b2footer.php") ?>
|
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
// This sample file provided by Loyd Goodbar http://www.blackrobes.net/
|
||||
$blog=1;
|
||||
include("./blog.header.php");
|
||||
include_once("./links.php");
|
||||
$query = "SELECT cat_id, cat_name FROM $tablelinkcategories ORDER BY cat_name";
|
||||
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Expires" content="0" />
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
<meta http-equiv="Cache-control" content="no-cache" />
|
||||
<title><?php bloginfo('name') ?> :: Links</title>
|
||||
<link rel="stylesheet" type="text/css" href="/layout2b.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="header">
|
||||
<a href="" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?> :: Links</a>
|
||||
</div>
|
||||
|
||||
<table align="center" columns="1" width="600">
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
/* motor for link categories, then show all links therein */
|
||||
$result = mysql_query($query) or die("Could not retrieve list of link categories.");
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
?>
|
||||
<h2><?php echo $row['cat_name']; ?></h2>
|
||||
<p class="storyContent"><?php get_links($row['cat_id'],'','<br />',' ',true,'name',true,false); ?></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
if (isset($HTTP_GET_VARS['popup'])) {
|
||||
echo('<a href="javascript:window.close()">Close this window</a>');
|
||||
} else {
|
||||
echo('<a href="'.$siteurl.'/'.$blogfilename.'">Return home</a>');
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,4 +0,0 @@
|
||||
Change the server name in this javascript and add to your browser toolbar. This currently only works in Mozilla.
|
||||
|
||||
javascript:void(linkmanpopup=window.open('http://test.zed1.com/b2/linkmanager.php?action=popup&linkurl='+escape(location.href)+'&name='+escape(document.title),'Link Manager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();
|
||||
|
@ -1,83 +0,0 @@
|
||||
<?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)
|
||||
// *****************************************************************
|
||||
|
||||
// Various variables to control your Links configuration
|
||||
|
||||
// table names in the database
|
||||
$tablelinks = "b2links";
|
||||
$tablelinkcategories = "b2linkcategories";
|
||||
$minadminlevel = 5;
|
||||
$use_adminlevels = true; // set this to false to have all links visible to
|
||||
// everyone in the link manager
|
||||
|
||||
// Set this to the type rating system you wish to use.
|
||||
// allowed values are: none, number, char, image
|
||||
$links_rating_type = 'image';
|
||||
|
||||
// if we are set to 'char' which char to use.
|
||||
$links_rating_char = '*';
|
||||
|
||||
// what do we do with a value of zero?
|
||||
// set this to 1 to output nothing
|
||||
// set it to 0 to output as normal (number/image)
|
||||
$links_rating_ignore_zero = 0;
|
||||
|
||||
//use the same image (time rating)?
|
||||
// uses $links_rating_image[0]
|
||||
$links_rating_single_image = 1;
|
||||
|
||||
//or use an individual image for each value?
|
||||
$links_rating_image[0]='links-images/star.gif';
|
||||
//$links_rating_image[0]='links-images/rating-0.gif';
|
||||
$links_rating_image[1]='links-images/rating-1.gif';
|
||||
$links_rating_image[2]='links-images/rating-2.gif';
|
||||
$links_rating_image[3]='links-images/rating-3.gif';
|
||||
$links_rating_image[4]='links-images/rating-4.gif';
|
||||
$links_rating_image[5]='links-images/rating-5.gif';
|
||||
$links_rating_image[6]='links-images/rating-6.gif';
|
||||
$links_rating_image[7]='links-images/rating-7.gif';
|
||||
$links_rating_image[8]='links-images/rating-8.gif';
|
||||
$links_rating_image[9]='links-images/rating-9.gif';
|
||||
|
||||
|
||||
//weblogs.com lookup values
|
||||
|
||||
// path/to/cachefile needs to be writable by web server
|
||||
$weblogs_cache_file = 'weblogs.com.changes.cache';
|
||||
|
||||
// Which file to grab. changes.xml contains about 3 hours worth of updates and
|
||||
// is at least 100kb (you don't want to grab this every 10 minutes)
|
||||
// shortChanges.xml is about 5 minutes worth and around 5kb you don't want to
|
||||
// grab this less frequently than every five minutes.
|
||||
|
||||
//$weblogs_xml_url = 'http://www.weblogs.com/changes.xml';
|
||||
$weblogs_xml_url = 'http://www.weblogs.com/shortChanges.xml';
|
||||
$weblogs_cacheminutes = 5; // cache time in minutes (if it is older than this get a new copy)
|
||||
|
||||
?>
|
255
links.html
255
links.html
@ -1,255 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Links</title>
|
||||
<link rel="stylesheet" type="text/css" href="http://zed1.com/main.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Links</h1>
|
||||
|
||||
<pre class="quote">
|
||||
// $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)
|
||||
// *****************************************************************
|
||||
</pre>
|
||||
|
||||
<h2>Links is an add-on to b2 weblogging software.</h2>
|
||||
<ul>
|
||||
<li>It plugs in to the admin screens. </li>
|
||||
<li>It adds to menu commands: Link Categories and Link Manager </li>
|
||||
<li>It allows you to define multiple categories under which to store your links. </li>
|
||||
<li>You can then define links with a url, name, optional image, href target and category. </li>
|
||||
<li>You can then list your links in your template with a simple function call. </li>
|
||||
<li>You can list them by category id or category name </li>
|
||||
<li>You can specify text or html to be output before and after each link. </li>
|
||||
<li>You can specifiy the sort order of the links displayed. </li>
|
||||
<li>You can add a 'star' rating to your links. </li>
|
||||
<li>There is special category type, auto-toggle which will allow only on link in the
|
||||
category to display at once. </li>
|
||||
<li>Each link is owned by the user who created it. You can only edit or delete links
|
||||
created by you or someone with a lower b2 administration level than you. </li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>You can download it from <a href="http://stats.zed1.net/pphlogger/dlcount.php?id=journalized&url=/links/links-1.2.zip">http://zed1.com/links/links-1.2.zip</a><br />
|
||||
or as a tar ball: <a href="http://stats.zed1.net/pphlogger/dlcount.php?id=journalized&url=/links/links-1.2.tar.gz">http://zed1.com/links/links-1.2.tar.gz</a></p>
|
||||
|
||||
<h3>Files:</h3>
|
||||
<dl>
|
||||
<dt>links.readme.txt </dt><dd>readme file </dd>
|
||||
<dt>links.sql </dt><dd>sql to create the necessary database tables </dd>
|
||||
<dt>links.update-0.5.sql</dt><dd>sql to update the pre 0.5 tables </dd>
|
||||
<dt>links.update-0.7.sql</dt><dd>sql to update the pre 0.7 tables </dd>
|
||||
<dt>links.update-1.0.sql</dt><dd>sql to update the pre 1.0 tables </dd>
|
||||
<dt>linkcategories.php </dt><dd>admin plugin to manage link categories </dd>
|
||||
<dt>linkmanager.php </dt><dd>admin plugin to manage links </dd>
|
||||
<dt>links.php </dt><dd>template functions </dd>
|
||||
<dt>links.install.php </dt><dd>alternate installation method </dd>
|
||||
<dt>links.config.php </dt><dd>configuration file </dd>
|
||||
<dt>links.bookmark.txt </dt><dd>mozilla bookmarklet </dd>
|
||||
<dt>links.all.php </dt><dd>Sample page to show all links </dd>
|
||||
<dt>links-images\rating-0.gif</dt><dd>ratings image </dd>
|
||||
<dt>links-images\rating-1.gif</dt><dd>ratings image </dd>
|
||||
<dt>links-images\rating-2.gif</dt><dd>ratings image </dd>
|
||||
<dt>links-images\rating-3.gif</dt><dd>ratings image </dd>
|
||||
<dt>links-images\rating-4.gif</dt><dd>ratings image </dd>
|
||||
<dt>links-images\rating-5.gif</dt><dd>ratings image </dd>
|
||||
<dt>links-images\rating-6.gif</dt><dd>ratings image </dd>
|
||||
<dt>links-images\rating-7.gif</dt><dd>ratings image </dd>
|
||||
<dt>links-images\rating-8.gif</dt><dd>ratings image </dd>
|
||||
<dt>links-images\rating-9.gif</dt><dd>ratings image </dd>
|
||||
<dt>links-images\star.gif </dt><dd>ratings image </dd>
|
||||
<dt>license.txt </dt><dd>GNU General Public License Version 2 </dd>
|
||||
</dl>
|
||||
|
||||
<h3>Installation:</h3>
|
||||
<ol>
|
||||
<li>Execute the SQL from the file links.sql. This will create the two tables
|
||||
and add a default category and an example link. Alternatively, upload
|
||||
the file links.install.php to your B2 installation directory and load
|
||||
it into your browser.</li>
|
||||
<li>Edit the b2-include/b2menutop.txt file to add in the two new commands.<br />
|
||||
5 linkcategories.php Link Categories<br />
|
||||
5 linkmanager.php Link Manager<br />
|
||||
Note: there should be a tab character after the 5 and after the filename.</li>
|
||||
<li>Add the files linkcategories.php, linkmanager.php, links.config.php, and links.php into your b2 install directory.</li>
|
||||
<li>Edit links.config.php to your requirements. There are comments in the file to explain each configuration variable.</li>
|
||||
<li>Login and click on the Link Categories menu command. Here you can edit link categories.<ul>
|
||||
<li><i>Name</i> is the name of the category.</li>
|
||||
<li><i>Auto-toggle</i>: if you check this box, this category will only allow one link in this category to be visible at a time.
|
||||
If you edit an existing link or create a new one with the visible flag set on; all the other links in this category will be
|
||||
turned off. You can use this feature for a current mood category or current CD.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Click on the Link Manager command to edit links:<ul>
|
||||
<li>The <i>url</i> is the href part of the link tag. This is optional; if you wanted to, for example, use it for mood icons.</li>
|
||||
<li>The <i>name</i> will either be the linked word(s) or the alt and title tag for the image. </li>
|
||||
<li>The <i>image</i> will be used as the src for an image tag. Use either an absolute address or one relative to your template.</li>
|
||||
<li>The <i>target</i> is the target of the link. _blank to open in a new browser window, and _top to open in the same window.</li>
|
||||
<li>The <i>category</i> is the category under which to store this link.</li>
|
||||
<li>The <i>description</i> is the description to be used as the title tag for the link (if it exists) and the text displayed after the link when no image is defined.</li>
|
||||
<li>The <i>visibilty</i> flag is used to turn off an individual link. Perhaps when a site goes down temporarily but you don't want to delete your link. See also auto-toggle categories above.</li>
|
||||
<li>The <i>rating</i> is used to display a number, a number of characters, an image, or a number of images after the link.</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
<li>In your template include_once("links.php")<ul>
|
||||
<li>You can then <?php echo get_linkcatname(1); ?> or any category id.
|
||||
This will output the name of the category (perhaps for a heading) </li>
|
||||
<li>Then <?php get_links(1); ?> to output all the links in category 1.
|
||||
You can also specify text to be output before and after the link, and the order
|
||||
of the links. </li>
|
||||
<li>You can also <?php get_linksbyname('General'); ?> To output all the links in the category called General. </li>
|
||||
<li>Other functions are get_linksbyname_withrating(), get_links_withrating(), and get_linkcatname().</li>
|
||||
<li>See the comments above each function for full details.
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>Bookmarklet: I have a partially working bookmarklet to add to your browser toolbar.<ul>
|
||||
<li>Clicking on this while viewing a site will cause the 'add a link' form to
|
||||
pop up in a new window with the site url and title pre-filled. </li>
|
||||
<li>This currently *only* works if you are already logged in to b2. The
|
||||
bookmarklet *only* works in Mozilla.</li>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<h3>Updating:</h3>
|
||||
<ol>
|
||||
<li>If you are updating from a pre 0.5 version, you will need to execute the sql in links.update-0.5.sql</li>
|
||||
<li>If you are updating from a pre 0.7 version, you will need to execute the sql in links.update-0.7.sql</li>
|
||||
<li>If you are updating from a pre 1.0 version, you will need to execute the sql in links.update-1.0.sql</li>
|
||||
</ol>
|
||||
|
||||
<hr />
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
<li>1.2 - Name change and minor bug fixes.</li>
|
||||
<li>1.1 - Added sample 'list all links' file.
|
||||
Added links_popup_script() function.
|
||||
Added the ability to return links in random order.
|
||||
Bug fixes: Can't create new category without auto-toggle.
|
||||
links.install.php does not compile with smartquotes turned on.
|
||||
Added missing title to linkcategories.php</li>
|
||||
<li>1.0 - Added mysql_connect() call to install script.
|
||||
Added separate configuration file.
|
||||
Added cookie to remember 'show' filter when managing links.
|
||||
Add ratings system.
|
||||
Added auto-toggle category flag.
|
||||
Added descending to sort order.</li>
|
||||
<li>0.9.1 - Added links.install.php DB installation script</li>
|
||||
<li>0.9 - URLs are optional. Delete asks for confirmation. You can now turn
|
||||
off the descriptions, even if you have no image or images turned off.</li>
|
||||
<li>0.8 - Added orderby parameter to output functions.
|
||||
In the link manager you can now sort your list of links.
|
||||
User level visibility now controlled by a variable at the top of
|
||||
linkmanager.php</li>
|
||||
<li>0.7 - Added link owners. Added truncation of long urls.</li>
|
||||
<li>0.6 - Added ability to not show images. Partially functional
|
||||
'add link' bookmarklet. Documented template functions.</li>
|
||||
<li>0.5 - Added description and visibility flag.</li>
|
||||
<li>0.4 - Add stripslashes() calls in a couple of places.</li>
|
||||
<li>0.3 - fixed bad mysql call</li>
|
||||
<li>0.2 - fixed bad sql script</li>
|
||||
<li>0.1 - initial release</li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
<h2>Screen shots</h2>
|
||||
<ul>
|
||||
<li>When you've added the lines to b2menutop.txt your menu should look like this:<br />
|
||||
<img src="menu.png" alt="picture of admin menu"/></li>
|
||||
|
||||
<li>Clicking on the 'Link Categories' menu will give you a page like this:<br />
|
||||
<img src="link-categories.png" alt="picture of editing link categories"/></li>
|
||||
|
||||
<li>Editing an existing category looks like this:<br />
|
||||
<img src="edit-category.png" alt="picture of editing a link"/></li>
|
||||
|
||||
<li>Clicking on the 'Link Manager' menu will give you a page like this:<br />
|
||||
<img src="link-manager.png" alt="picture of managing links"/></li>
|
||||
<li>You can choose display all your links or just a single category of links. You can also select the sort order.</li>
|
||||
|
||||
<li>Adding a new link is at the bottom of the link manager page:<br />
|
||||
<img src="add-a-link.png" alt="picture of editing a link"/></li>
|
||||
|
||||
<li>Editing an individual link looks like this:<br />
|
||||
<img src="edit-a-link.png" alt="picture of editing a link"/></li>
|
||||
|
||||
<li>In your template you can output the link categories as seperate lists like this:<br />
|
||||
You can see the description as title attribute for both text links and image
|
||||
links. You can also see the description output after the text links.<br />
|
||||
<img src="sidebar.jpg" alt="picture of link output"/> <img src="sidebar2.jpg" alt="picture of link output"/>
|
||||
<img src="links-with-ratings.png" alt="picture of link output"/></li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
<p>Thats about it really. This is reasonably stable software, however is has not been extensively tested. Use with caution.</p>
|
||||
|
||||
<hr />
|
||||
<a name="buttons"><h2>Buttons</h2></a>
|
||||
<p>I've now created some 'Powered by Links' buttons for those of you who wish to show your support.</p>
|
||||
<p>All you need to do is choose one of the images below, upload it to your own server, and create a link with the following HTML:
|
||||
</p>
|
||||
<pre>
|
||||
|
||||
<a href="http://zed1.com/links/" title="Links">
|
||||
<img src="/path/to/the/image.png" alt="Links" border="0" /></a>
|
||||
|
||||
</pre>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td align="center" bgcolor="#00000"><img src="links-black.png" alt="Powered by Links" /></td>
|
||||
<td align="center" bgcolor="#00000"><img src="links-black-trans.png" alt="Powered by Links" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Rendered <br />on a black background</td>
|
||||
<td>Transparent (Rendered <br />on a black background)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" bgcolor="#ffffff"><img src="links-white.png" alt="Powered by Links" /></td>
|
||||
<td align="center" bgcolor="#ffffff"><img src="links-white-trans.png" alt="Powered by Links" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Rendered <br />on a white background</td>
|
||||
<td>Transparent (rendered <br />on a white background)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr />
|
||||
<p>--<br />
|
||||
Mike Little<br />
|
||||
mike@zed1.com</p>
|
||||
<!-- PowerPhlogger Code START -->
|
||||
<script language="JavaScript" type="text/javascript" src="/pphlogger.js"></script>
|
||||
<noscript><img alt="" src="http://stats.zed1.net/pphlogger/pphlogger.php?id=journalized&st=img" /></noscript>
|
||||
<!-- PowerPhlogger Code END -->
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,133 +0,0 @@
|
||||
<?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)
|
||||
// *****************************************************************
|
||||
|
||||
// Start Connect To MYSQL
|
||||
require_once("b2config.php");
|
||||
include_once("$b2inc/b2template.functions.php");
|
||||
include_once("$b2inc/b2vars.php");
|
||||
include_once("$b2inc/b2functions.php");
|
||||
|
||||
include_once('links.config.php');
|
||||
$connexion = mysql_connect($server,$loginsql,$passsql) or die("Can't connect to the database<br>".mysql_error());
|
||||
$dbconnexion = mysql_select_db($base, $connexion);
|
||||
|
||||
$got_links = false;
|
||||
$got_cats = false;
|
||||
$got_row = false;
|
||||
?><html>
|
||||
<head>
|
||||
<title>links > Installation</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Checking for tables...</p>
|
||||
<?php
|
||||
$result = mysql_list_tables($dbname);
|
||||
if (!$result) {
|
||||
print "DB Error, could not list tables\n";
|
||||
print 'MySQL Error: ' . mysql_error();
|
||||
exit;
|
||||
}
|
||||
|
||||
while ($row = mysql_fetch_row($result)) {
|
||||
if ($row[0] == $tablelinks)
|
||||
$got_links = true;
|
||||
if ($row[0] == $tablelinkcategories)
|
||||
$got_cats = true;
|
||||
//print "Table: $row[0]<br />\n";
|
||||
}
|
||||
if (!$got_cats) {
|
||||
echo "<p>Can't find table '$tablelinkcategories', gonna create it...</p>\n";
|
||||
$sql = "CREATE TABLE $tablelinkcategories ( " .
|
||||
" cat_id int(11) NOT NULL auto_increment, " .
|
||||
" cat_name tinytext NOT NULL, ".
|
||||
" auto_toggle enum ('Y','N') NOT NULL default 'N', ".
|
||||
" PRIMARY KEY (cat_id) ".
|
||||
") ";
|
||||
$result = mysql_query($sql) or print ("Can't create the table '$tablelinkcategories' in the database.<br />" . $sql . "<br />" . mysql_error());
|
||||
if ($result != false) {
|
||||
echo "<p>Table '$tablelinkcategories' created OK</p>\n";
|
||||
$got_cats = true;
|
||||
}
|
||||
} else {
|
||||
echo "<p>Found table '$tablelinkcategories', don't need to create it...</p>\n";
|
||||
$got_cats = true;
|
||||
}
|
||||
if (!$got_links) {
|
||||
echo "<p>Can't find '$tablelinks', gonna create it...</p>\n";
|
||||
$sql = "CREATE TABLE $tablelinks ( " .
|
||||
" link_id int(11) NOT NULL auto_increment, " .
|
||||
" link_url varchar(255) NOT NULL default '', " .
|
||||
" link_name varchar(255) NOT NULL default '', " .
|
||||
" link_image varchar(255) NOT NULL default '', " .
|
||||
" link_target varchar(25) NOT NULL default '', " .
|
||||
" link_category int(11) NOT NULL default 0, " .
|
||||
" link_description varchar(255) NOT NULL default '', " .
|
||||
" link_visible enum ('Y','N') NOT NULL default 'Y', " .
|
||||
" link_owner int NOT NULL DEFAULT '1', " .
|
||||
" link_rating int NOT NULL DEFAULT '0', " .
|
||||
" link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', " .
|
||||
" link_rel varchar(255) NOT NULL default '', " .
|
||||
" PRIMARY KEY (link_id) " .
|
||||
") ";
|
||||
$result = mysql_query($sql) or print ("Can't create the table '$tablelinks' in the database.<br />" . $sql . "<br />" . mysql_error());
|
||||
if ($result != false) {
|
||||
echo "<p>Table '$tablelinks' created OK</p>\n";
|
||||
$got_links = true;
|
||||
}
|
||||
} else {
|
||||
echo "<p>Found table '$tablelinks', don't need to create it...</p>\n";
|
||||
$got_links = true;
|
||||
}
|
||||
|
||||
if ($got_links && $got_cats) {
|
||||
echo "<p>Looking for category 1...</p>\n";
|
||||
$sql = "SELECT * FROM $tablelinkcategories WHERE cat_id=1 ";
|
||||
$result = mysql_query($sql) or print ("Can't query '$tablelinkcategories'.<br />" . $sql . "<br />" . mysql_error());
|
||||
if ($result != false) {
|
||||
if ($row = mysql_fetch_object($result)) {
|
||||
echo "<p>You have at least got category 1. Good!</p>\n";
|
||||
$got_row = true;
|
||||
} else {
|
||||
echo "<p>Gonna insert category 1...</p>\n";
|
||||
$sql = "INSERT INTO $tablelinkcategories (cat_id, cat_name) VALUES (1, 'General')";
|
||||
$result = mysql_query($sql) or print ("Can't query insert category.<br />" . $sql . "<br />" . mysql_error());
|
||||
if ($result != false) {
|
||||
echo "<p>Inserted category Ok</p>\n";
|
||||
$got_row = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($got_row) {
|
||||
echo "<p>All done.</p>\n";
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
330
links.php
330
links.php
@ -1,330 +0,0 @@
|
||||
<?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('links.config.php');
|
||||
|
||||
/** function get_linksbyname()
|
||||
** Gets the links associated with category 'cat_name'.
|
||||
** Parameters:
|
||||
** cat_name (default 'noname') - The category name to use. If no
|
||||
** match is found uses all
|
||||
** before (default '') - the html to output before the link
|
||||
** after (default '<br />') - the html to output after the link
|
||||
** between (default ' ') - the html to output between the link/image
|
||||
** and it's description. Not used if no image or show_images == true
|
||||
** show_images (default true) - whether to show images (if defined).
|
||||
** orderby (default 'id') - the order to output the links. E.g. 'id', 'name',
|
||||
** 'url', 'description' or 'rating'. Or maybe owner. If you start the
|
||||
** name with an underscore the order will be reversed.
|
||||
** You can also specify 'rand' as the order which will return links in a
|
||||
** random order.
|
||||
** show_description (default true) - whether to show the description if
|
||||
** show_images=false/not defined
|
||||
** show_rating (default false) - show rating stars/chars
|
||||
** limit (default -1) - Limit to X entries. If not specified, all entries
|
||||
** are shown.
|
||||
** show_updated (default 0) - whether to show last updated timestamp
|
||||
*/
|
||||
function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
|
||||
$between = " ", $show_images = true, $orderby = 'id',
|
||||
$show_description = true, $show_rating = false,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
global $tablelinkcategories;
|
||||
$cat_id = -1;
|
||||
$sql = "SELECT cat_id FROM $tablelinkcategories WHERE cat_name='$cat_name'";
|
||||
$result = mysql_query($sql)
|
||||
or die("Oops, couldn't query the db for categories."
|
||||
. $sql . mysql_error());
|
||||
if ($row = mysql_fetch_object($result)) {
|
||||
$cat_id = $row->cat_id;
|
||||
}
|
||||
get_links($cat_id, $before, $after, $between, $show_images, $orderby,
|
||||
$show_description, $show_rating, $limit, $show_updated);
|
||||
}
|
||||
|
||||
|
||||
/** function get_links()
|
||||
** Gets the links associated with category n.
|
||||
** Parameters:
|
||||
** category (default -1) - The category to use. If no category supplied
|
||||
** uses all
|
||||
** before (default '') - the html to output before the link
|
||||
** after (default '<br />') - the html to output after the link
|
||||
** between (default ' ') - the html to output between the link/image
|
||||
** and it's description. Not used if no image or show_images == true
|
||||
** show_images (default true) - whether to show images (if defined).
|
||||
** orderby (default 'id') - the order to output the links. E.g. 'id', 'name',
|
||||
** 'url', 'description', or 'rating'. Or maybe owner. If you start the
|
||||
** name with an underscore the order will be reversed.
|
||||
** You can also specify 'rand' as the order which will return links in a
|
||||
** random order.
|
||||
** show_description (default true) - whether to show the description if
|
||||
** show_images=false/not defined .
|
||||
** show_rating (default false) - show rating stars/chars
|
||||
** limit (default -1) - Limit to X entries. If not specified, all entries
|
||||
** are shown.
|
||||
** show_updated (default 0) - whether to show last updated timestamp
|
||||
*/
|
||||
function get_links($category = -1, $before = '', $after = '<br />',
|
||||
$between = " ", $show_images = true, $orderby = 'id',
|
||||
$show_description = true, $show_rating = false,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
|
||||
global $tablelinks, $links_rating_type, $links_rating_char,
|
||||
$links_rating_image, $links_rating_ignore_zero,
|
||||
$links_rating_single_image;
|
||||
|
||||
$direction = ' ASC';
|
||||
$category_query = "";
|
||||
if ($category != -1) {
|
||||
$category_query = " AND link_category = $category ";
|
||||
}
|
||||
if ($show_updated) {
|
||||
$get_updated = ", DATE_FORMAT(link_updated, '%d/%m/%Y %h:%i') AS link_updated ";
|
||||
}
|
||||
dbconnect();
|
||||
$sql = "SELECT link_url, link_name, link_image, link_target, " .
|
||||
" link_description, link_rating, link_rel $get_updated " .
|
||||
" FROM $tablelinks " .
|
||||
" WHERE link_visible = 'Y' " .
|
||||
$category_query;
|
||||
if ($orderby == '')
|
||||
$orderby = 'id';
|
||||
if (substr($orderby,0,1) == '_') {
|
||||
$direction = ' DESC';
|
||||
$orderby = substr($orderby,1);
|
||||
}
|
||||
if (strcasecmp('rand',$orderby) == 0) {
|
||||
$orderby = 'rand()';
|
||||
} else {
|
||||
$orderby = " link_" . $orderby;
|
||||
}
|
||||
$sql .= ' ORDER BY ' . $orderby;
|
||||
$sql .= $direction;
|
||||
/* The next 2 lines implement LIMIT TO processing */
|
||||
if ($limit != -1)
|
||||
$sql .= " LIMIT $limit";
|
||||
|
||||
$result = mysql_query($sql)
|
||||
or die("Couldn't execute query. " . $sql . mysql_error());
|
||||
while ($row = mysql_fetch_object($result)) {
|
||||
echo($before);
|
||||
$the_link = '#';
|
||||
if (($row->link_url != null) || ($row->link_url != '')) {
|
||||
$the_link = $row->link_url;
|
||||
}
|
||||
$rel = stripslashes($row->link_rel);
|
||||
if ($rel != '') {
|
||||
$rel = 'rel="'.$rel.'"';
|
||||
}
|
||||
echo("<a href=\"".$the_link."\" $rel title=\"" .
|
||||
stripslashes($row->link_description) .
|
||||
"\" target=\"$row->link_target\">");
|
||||
if (($row->link_image != null) && $show_images) {
|
||||
echo("<img src=\"$row->link_image\" border=\"0\" alt=\"" .
|
||||
stripslashes($row->link_name) . "\" title=\"" .
|
||||
stripslashes($row->link_description) . "\" />");
|
||||
} else {
|
||||
echo(stripslashes($row->link_name));
|
||||
}
|
||||
if ((($row->link_image != null) && $show_images) || !$show_description) {
|
||||
echo("</a>");
|
||||
} else {
|
||||
echo("</a>$between" . stripslashes($row->link_description));
|
||||
}
|
||||
|
||||
if ($show_updated) {
|
||||
if (substr($row->link_updated,0,2) != '00') {
|
||||
echo("</a>$between " . $row->link_updated);
|
||||
}
|
||||
}
|
||||
// now do the rating
|
||||
if ($show_rating) {
|
||||
echo($between);
|
||||
if ($links_rating_type == 'number') {
|
||||
if (($row->link_rating != 0) || ($links_rating_ignore_zero != 1)) {
|
||||
echo(" $row->link_rating\n");
|
||||
}
|
||||
} else if ($links_rating_type == 'char') {
|
||||
for ($r = $row->link_rating; $r > 0; $r--) {
|
||||
echo($links_rating_char);
|
||||
}
|
||||
} else if ($links_rating_type == 'image') {
|
||||
if ($links_rating_single_image) {
|
||||
for ($r = $row->link_rating; $r > 0; $r--) {
|
||||
echo(' <img src="'.$links_rating_image[0].'" alt="' .
|
||||
$row->link_rating.'" />'."\n");
|
||||
}
|
||||
} else {
|
||||
if (($row->link_rating != 0) || ($links_rating_ignore_zero != 1)) {
|
||||
echo(' <img src="' .
|
||||
$links_rating_image[$row->link_rating].'" alt="' .
|
||||
$row->link_rating.'" />'."\n");
|
||||
}
|
||||
}
|
||||
} // end if image
|
||||
} // end if show_rating
|
||||
echo("$after\n");
|
||||
} // end while
|
||||
}
|
||||
|
||||
/** function get_linksbyname_withrating()
|
||||
** Gets the links associated with category 'cat_name' and display rating stars/chars.
|
||||
** Parameters:
|
||||
** cat_name (default 'noname') - The category name to use. If no
|
||||
** match is found uses all
|
||||
** before (default '') - the html to output before the link
|
||||
** after (default '<br />') - the html to output after the link
|
||||
** between (default ' ') - the html to output between the link/image
|
||||
** and it's description. Not used if no image or show_images == true
|
||||
** show_images (default true) - whether to show images (if defined).
|
||||
** orderby (default 'id') - the order to output the links. E.g. 'id', 'name',
|
||||
** 'url' or 'description'. Or maybe owner. If you start the
|
||||
** name with an underscore the order will be reversed.
|
||||
** You can also specify 'rand' as the order which will return links in a
|
||||
** random order.
|
||||
** show_description (default true) - whether to show the description if
|
||||
** show_images=false/not defined
|
||||
** limit (default -1) - Limit to X entries. If not specified, all entries
|
||||
** are shown.
|
||||
** show_updated (default 0) - whether to show last updated timestamp
|
||||
*/
|
||||
function get_linksbyname_withrating($cat_name = "noname", $before = '',
|
||||
$after = '<br />', $between = " ",
|
||||
$show_images = true, $orderby = 'id',
|
||||
$show_description = true, $limit = -1, $show_updated = 0) {
|
||||
|
||||
get_linksbyname($cat_name, $before, $after, $between, $show_images,
|
||||
$orderby, $show_description, true, $limit, $show_updated);
|
||||
}
|
||||
|
||||
/** function get_links_withrating()
|
||||
** Gets the links associated with category n and display rating stars/chars.
|
||||
** Parameters:
|
||||
** category (default -1) - The category to use. If no category supplied
|
||||
** uses all
|
||||
** before (default '') - the html to output before the link
|
||||
** after (default '<br />') - the html to output after the link
|
||||
** between (default ' ') - the html to output between the link/image
|
||||
** and it's description. Not used if no image or show_images == true
|
||||
** show_images (default true) - whether to show images (if defined).
|
||||
** orderby (default 'id') - the order to output the links. E.g. 'id', 'name',
|
||||
** 'url' or 'description'. Or maybe owner. If you start the
|
||||
** name with an underscore the order will be reversed.
|
||||
** You can also specify 'rand' as the order which will return links in a
|
||||
** random order.
|
||||
** show_description (default true) - whether to show the description if
|
||||
** show_images=false/not defined .
|
||||
** limit (default -1) - Limit to X entries. If not specified, all entries
|
||||
** are shown.
|
||||
** show_updated (default 0) - whether to show last updated timestamp
|
||||
*/
|
||||
function get_links_withrating($category = -1, $before = '', $after = '<br />',
|
||||
$between = " ", $show_images = true,
|
||||
$orderby = 'id', $show_description = true,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
|
||||
get_links($category, $before, $after, $between, $show_images, $orderby,
|
||||
$show_description, true, $limit, $show_updated);
|
||||
}
|
||||
|
||||
/** function get_linkcatname()
|
||||
** Gets the name of category n.
|
||||
** Parameters: id (default 0) - The category to get. If no category supplied
|
||||
** uses 0
|
||||
*/
|
||||
function get_linkcatname($id = 0) {
|
||||
global $tablelinkcategories;
|
||||
$cat_name = "noname";
|
||||
$sql = "SELECT cat_name FROM $tablelinkcategories WHERE cat_id=$id";
|
||||
$result = mysql_query($sql)
|
||||
or die("Couldn't query the db for categories:". $sql. mysql_error());
|
||||
if ($row = mysql_fetch_object($result)) {
|
||||
$cat_name = stripslashes($row->cat_name);
|
||||
}
|
||||
return $cat_name;
|
||||
}
|
||||
|
||||
/** function get_get_autotoggle()
|
||||
** Gets the auto_toggle setting of category n.
|
||||
** Parameters: id (default 0) - The category to get. If no category supplied
|
||||
** uses 0
|
||||
*/
|
||||
function get_autotoggle($id = 0) {
|
||||
global $tablelinkcategories;
|
||||
$auto_toggle = "N";
|
||||
$sql = "SELECT auto_toggle FROM $tablelinkcategories WHERE cat_id=$id";
|
||||
$result = mysql_query($sql)
|
||||
or die("Couldn't query the db for categories:". $sql.
|
||||
mysql_error());
|
||||
if ($row = mysql_fetch_object($result)) {
|
||||
$auto_toggle = $row->auto_toggle;
|
||||
}
|
||||
return $auto_toggle;
|
||||
}
|
||||
|
||||
/** function links_popup_script()
|
||||
** This function contributed by Fullo -- http://sprite.csr.unibo.it/fullo/
|
||||
** Show the link to the links popup and the number of links
|
||||
** Parameters:
|
||||
** text (default Links) - the text of the link
|
||||
** width (default 400) - the width of the popup window
|
||||
** height (default 400) - the height of the popup window
|
||||
** file (default linkspopup.php) - the page to open in the popup window
|
||||
** count (default true) - the number of links in the db
|
||||
*/
|
||||
function links_popup_script($text = 'Links', $width=400, $height=400,
|
||||
$file='links.all.php', $count = true) {
|
||||
global $tablelinks;
|
||||
if ($count == true) {
|
||||
$sql = "SELECT count(*) FROM $tablelinks";
|
||||
$result = mysql_query($sql)
|
||||
or die("Couldn't query the db for categories:". $sql .
|
||||
mysql_error());
|
||||
|
||||
if ($row = mysql_fetch_row($result)) {
|
||||
$counts = $row[0];
|
||||
}
|
||||
}
|
||||
|
||||
$javascript = "<a href=\"#\" " .
|
||||
" onclick=\"javascript:window.open('$file?popup=1', '_blank', " .
|
||||
"'width=$width,height=$height,scrollbars=yes,status=no'); " .
|
||||
" return false\">";
|
||||
$javascript .= $text;
|
||||
|
||||
if ($count == true) {
|
||||
$javascript .= " ($counts)";
|
||||
}
|
||||
|
||||
$javascript .="</a>\n\n";
|
||||
echo $javascript;
|
||||
}
|
||||
|
||||
?>
|
190
links.readme.txt
190
links.readme.txt
@ -1,190 +0,0 @@
|
||||
// $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)
|
||||
// *****************************************************************
|
||||
|
||||
Links is an add-on to b2 weblogging software.
|
||||
* It plugs in to the admin screens.
|
||||
* It adds to menu commands: Link Categories and Link Manager
|
||||
* It allows you to define multiple categories under which to store your links.
|
||||
* You can then define links with a url, name, optional image, href
|
||||
target and category.
|
||||
* You can then list your links in your template with a simple function call.
|
||||
* You can list them by category id or category name
|
||||
* You can specify text or html to be output before and after each link.
|
||||
* You can specifiy the sort order of the links displayed.
|
||||
* You can add a 'star' rating to your links.
|
||||
* There is special category type, auto-toggle which will allow only on link in
|
||||
the category to display at once.
|
||||
* Each link is owned by the user who created it. You can only edit or delete
|
||||
links created by you or someone with a lower b2 administration level than you.
|
||||
|
||||
|
||||
Files:
|
||||
links.readme.txt - this file
|
||||
links.sql - sql to create the necessary database tables
|
||||
links.update-0.5.sql - sql to update the pre 0.5 tables
|
||||
links.update-0.7.sql - sql to update the pre 0.7 tables
|
||||
links.update-1.0.sql - sql to update the pre 1.0 tables
|
||||
linkcategories.php - admin plugin to manage link categories
|
||||
linkmanager.php - admin plugin to manage links
|
||||
links.php - template functions
|
||||
links.install.php - alternate installation method
|
||||
links.config.php - configuration file
|
||||
links.bookmark.txt - mozilla bookmarklet
|
||||
links.all.php - Sample page to show all links
|
||||
links-images\rating-0.gif - ratings images
|
||||
links-images\rating-1.gif
|
||||
links-images\rating-2.gif
|
||||
links-images\rating-3.gif
|
||||
links-images\rating-4.gif
|
||||
links-images\rating-5.gif
|
||||
links-images\rating-6.gif
|
||||
links-images\rating-7.gif
|
||||
links-images\rating-8.gif
|
||||
links-images\rating-9.gif
|
||||
links-images\star.gif
|
||||
license.txt - GNU General Public License Version 2
|
||||
|
||||
You can download it from http://zed1.com/links/links-1.1.zip or http://zed1.com/links/links-1.1.tar.gz
|
||||
|
||||
There is an html version of this readme file at
|
||||
http://zed1.com/links/links.html with screenshots and more detailed info.
|
||||
|
||||
Installation:
|
||||
|
||||
1. Execute the SQL from the file links.sql. This will create the two
|
||||
tables and add a default category and an example link. Alternatively, upload
|
||||
the file links.install.php to your B2 installation directory and
|
||||
load it into your browser.
|
||||
|
||||
2. Edit the b2-include/b2menutop.txt file to add in the two new commands.
|
||||
|
||||
5 linkcategories.php Link Categories
|
||||
5 linkmanager.php Link Manager
|
||||
|
||||
Note: there should be a tab character after the 5 and after the filename.
|
||||
|
||||
3. Add the files linkcategories.php, linkmanager.php, links.config.php,
|
||||
and links.php into your b2 install directory.
|
||||
|
||||
4. Edit links.config.php to your requirements. There are comments in the file
|
||||
to explain each configuration variable.
|
||||
|
||||
5. Login and click on the Link Categories menu command. Here you can
|
||||
create or edit link categories.
|
||||
- Name is the name of the category.
|
||||
- Auto-toggle: if you check this box, this category will only allow one link
|
||||
in this category to be visible at a time. If you edit an existing link or
|
||||
create a new one with the visible flag set on; all the other links in this
|
||||
category will be turned off. You can use this feature for a current mood
|
||||
category or current CD.
|
||||
|
||||
6. Click on the Link Manager command to edit links:
|
||||
- The url is the href part of the link tag. This is optional; if you wanted
|
||||
to, for example, use it for mood icons.
|
||||
- The name will either be the linked word(s) or the alt and title tag for
|
||||
the image.
|
||||
- Image will be used as the src for an image tag. Use either an absolute
|
||||
address or one relative to your template.
|
||||
- Target is the target of the link. _blank to open in a new browser window,
|
||||
and _top to open in the same window.
|
||||
- Category is the category under which to store this link.
|
||||
- Description is the description to be used as the title tag for the link
|
||||
(if it exists) and the text displayed after the link when no image is
|
||||
defined.
|
||||
- Visible flag is used to turn off an individual link. Perhaps when a site
|
||||
goes down temporarily but you don't want to delete your link. See also
|
||||
auto-toggle categories above.
|
||||
- Rating is used to display a number, a number of characters, an image, or a
|
||||
number of images after the link.
|
||||
|
||||
7. In your template include_once("links.php")
|
||||
- You can then <?php echo get_linkcatname(1); ?> or any category id. This will
|
||||
output the name of the category (perhaps for a heading)
|
||||
- Then <?php get_links(1); ?> to output all the links in category 1. You can
|
||||
also specify text to be output before and after the link, and the order of
|
||||
the links.
|
||||
- You can also <?php get_linksbyname('General'); ?> to output all the links in
|
||||
the category called General.
|
||||
- Other functions are get_linksbyname_withrating(), get_links_withrating(),
|
||||
and get_linkcatname().
|
||||
- See the comments above each function for full details.
|
||||
|
||||
9. Bookmarklet: I have a partially working bookmarklet to add to your browser
|
||||
toolbar.
|
||||
- Clicking on this while viewing a site will cause the 'add a link' form to
|
||||
pop up in a new window with the site url and title pre-filled.
|
||||
- This currently *only* works if you are already logged in to b2. The
|
||||
bookmarklet *only* works in Mozilla.
|
||||
|
||||
Updating:
|
||||
|
||||
1. If you are updating from a pre 0.5 version, you will need to execute the sql
|
||||
in links.update-0.5.sql
|
||||
2. If you are updating from a pre 0.7 version, you will need to execute the sql
|
||||
in links.update-0.7.sql
|
||||
3. If you are updating from a pre 1.0 version, you will need to execute the sql
|
||||
in links.update-1.0.sql
|
||||
|
||||
Changes:
|
||||
|
||||
1.1 - Added sample 'list all links' file.
|
||||
Added links_popup_script() function.
|
||||
Added the ability to return links in random order.
|
||||
Bug fixes: Can't create new category without auto-toggle.
|
||||
links.install.php does not compile with smartquotes turned on.
|
||||
Added missing title to linkcategories.php
|
||||
1.0 - Added mysql_connect() call to install script.
|
||||
Added separate configuration file.
|
||||
Added cookie to remember 'show' filter when managing links.
|
||||
Add ratings system.
|
||||
Added auto-toggle category flag.
|
||||
Added descending to sort order.
|
||||
0.9.1 - Added links.install.php DB installation script
|
||||
0.9 - URLs are optional. Delete asks for confirmation. You can now turn
|
||||
off the descriptions, even if you have no image or images turned off.
|
||||
0.8 - Added orderby parameter to output functions.
|
||||
In the link manager you can now sort your list of links.
|
||||
User level visibility now controlled by a variable at the top of
|
||||
linkmanager.php
|
||||
0.7 - Added link owners. Added truncation of long urls.
|
||||
0.6 - Added ability to not show images. Partially functional
|
||||
'add link' bookmarklet. Documented template functions.
|
||||
0.5 - Added description and visibility flag.
|
||||
0.4 - Add stripslashes() calls in a couple of places.
|
||||
0.3 - fixed bad mysql call
|
||||
0.2 - fixed bad sql script
|
||||
0.1 - initial release
|
||||
|
||||
|
||||
Thats about it really. This is reasonably stable software, however is has not
|
||||
been extensively tested. Use with caution.
|
||||
|
||||
|
||||
--
|
||||
Mike Little
|
||||
mike@zed1.com
|
59
links.sql
59
links.sql
@ -1,59 +0,0 @@
|
||||
-- --------------------------------------------------------
|
||||
-- // $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)
|
||||
-- // *****************************************************************
|
||||
|
||||
-- DROP TABLE IF EXISTS b2links;
|
||||
CREATE TABLE b2links (
|
||||
link_id int(11) NOT NULL auto_increment,
|
||||
link_url varchar(255) NOT NULL default '',
|
||||
link_name varchar(255) NOT NULL default '',
|
||||
link_image varchar(255) NOT NULL default '',
|
||||
link_target varchar(25) NOT NULL default '',
|
||||
link_category int(11) NOT NULL default 0,
|
||||
link_description varchar(255) NOT NULL default '',
|
||||
link_visible enum ('Y','N') NOT NULL default 'Y',
|
||||
link_owner int NOT NULL DEFAULT '1',
|
||||
link_rating int NOT NULL DEFAULT '0',
|
||||
link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||
link_rel varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (link_id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
|
||||
-- DROP TABLE IF EXISTS linkcategories;
|
||||
CREATE TABLE linkcategories (
|
||||
cat_id int(11) NOT NULL auto_increment,
|
||||
cat_name tinytext NOT NULL,
|
||||
auto_toggle enum ('Y','N') NOT NULL default 'N',
|
||||
PRIMARY KEY (cat_id)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
INSERT INTO linkcategories (cat_id, cat_name) VALUES (1, 'General');
|
||||
|
||||
INSERT INTO b2links (link_id, link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner)
|
||||
VALUES (1, 'http://www.cafelog.com/', 'Cafelog', '', '_blank', 1, 'Cafelog', 'Y', 1);
|
@ -1,34 +0,0 @@
|
||||
-- --------------------------------------------------------
|
||||
-- // $Id$
|
||||
-- //
|
||||
-- // B2Links
|
||||
-- // 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)
|
||||
-- // *****************************************************************
|
||||
|
||||
alter table b2links modify column link_url varchar(255) NOT NULL default '';
|
||||
-- this will have silently changed all the other chars to varchars!
|
||||
alter table b2links add column link_description varchar(255) NOT NULL default '';
|
||||
alter table b2links add column link_visible enum ('Y','N') NOT NULL default 'Y';
|
||||
update b2links set link_description = link_name;
|
@ -1,32 +0,0 @@
|
||||
-- --------------------------------------------------------
|
||||
-- // $Id$
|
||||
-- //
|
||||
-- // B2Links
|
||||
-- // 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)
|
||||
-- // *****************************************************************
|
||||
|
||||
ALTER TABLE b2links ADD COLUMN link_owner INT NOT NULL DEFAULT '1';
|
||||
-- set link owner to admin (id 1)
|
||||
UPDATE b2links SET link_owner = 1;
|
@ -1,33 +0,0 @@
|
||||
-- --------------------------------------------------------
|
||||
-- // $Id$
|
||||
-- //
|
||||
-- // B2Links
|
||||
-- // 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)
|
||||
-- // *****************************************************************
|
||||
|
||||
ALTER TABLE b2links ADD COLUMN link_rating INT NOT NULL DEFAULT '0';
|
||||
|
||||
ALTER TABLE b2linkcategories ADD COLUMN auto_toggle enum ('Y','N') NOT NULL default 'N';
|
||||
|
@ -1,33 +0,0 @@
|
||||
-- --------------------------------------------------------
|
||||
-- // $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)
|
||||
-- // *****************************************************************
|
||||
|
||||
ALTER TABLE b2links ADD COLUMN link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00';
|
||||
ALTER TABLE b2links ADD COLUMN link_rel varchar(255) NOT NULL DEFAULT '';
|
||||
|
||||
|
@ -1,147 +0,0 @@
|
||||
<?
|
||||
include_once('links.config.php');
|
||||
require_once('./b2config.php');
|
||||
require_once($b2inc.'/b2functions.php');
|
||||
|
||||
// globals to hold state
|
||||
$updated_timestamp = 0;
|
||||
$all_links = array();
|
||||
|
||||
/**
|
||||
** preload_links()
|
||||
** Pre-load the visible, non-blank, links into an associative array $all_links
|
||||
** key is url, value is array of link_id and update_time
|
||||
** Note: update time is initialised to 0. That way we only have to update (in
|
||||
** the db) the ones which have been updated.
|
||||
**/
|
||||
function preload_links() {
|
||||
global $tablelinks, $all_links;
|
||||
dbconnect();
|
||||
$sql = "SELECT link_id, link_url FROM $tablelinks WHERE link_visible = 'Y' AND link_url <> ''";
|
||||
$result = mysql_query($sql)
|
||||
or die("Couldn't execute query. " . $sql . mysql_error());
|
||||
while ($row = mysql_fetch_object($result)) {
|
||||
$all_links[$row->link_url] = array($row->link_id,0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
** update_links()
|
||||
** Update in the db the links which have been updated ($all_links[url][1] != 0)
|
||||
**/
|
||||
function update_links() {
|
||||
global $tablelinks, $all_links;
|
||||
dbconnect();
|
||||
|
||||
reset($all_links);
|
||||
while (list($id, $val) = each($all_links)) {
|
||||
if ($val[1]) {
|
||||
$sql = "UPDATE $tablelinks SET link_updated = '$val[1]' WHERE link_id = $val[0] ";
|
||||
//echo("executing: $sql\n");
|
||||
if (mysql_query($sql) == false) {
|
||||
//ignore update errors! no data loss
|
||||
//echo("Couldn't execute query. " . $sql . mysql_error());
|
||||
}
|
||||
}
|
||||
} // end while
|
||||
}
|
||||
|
||||
/**
|
||||
** get_weblogs_updatedfile()
|
||||
** Retrieves and caches a copy of the weblogs.com changed blogs xml file.
|
||||
** If the file exists check it's age, get new copy if old.
|
||||
** If a new or updated file has been written return true (needs processing)
|
||||
** otherwise return false (nothing to do)
|
||||
**/
|
||||
function get_weblogs_updatedfile() {
|
||||
global $weblogs_cache_file, $weblogs_xml_url, $weblogs_cacheminutes;
|
||||
$update = false;
|
||||
|
||||
if (file_exists($weblogs_cache_file)) {
|
||||
// is it old?
|
||||
$modtime = filemtime($weblogs_cache_file);
|
||||
if ((time() - $modtime) > ($weblogs_cacheminutes * 60)) {
|
||||
$update = true;
|
||||
}
|
||||
} else { // doesn't exist
|
||||
$update = true;
|
||||
}
|
||||
|
||||
if ($update) {
|
||||
// get a new copy
|
||||
$contents = implode('', file($weblogs_xml_url)); // file_get_contents not available < 4.3
|
||||
$cachefp = fopen($weblogs_cache_file, "w");
|
||||
fwrite($cachefp, $contents);
|
||||
fclose($cachefp);
|
||||
}
|
||||
return $update;
|
||||
}
|
||||
|
||||
/**
|
||||
** startElement()
|
||||
** Callback function. Called at the start of a new xml tag.
|
||||
**/
|
||||
function startElement($parser, $tagName, $attrs) {
|
||||
global $updated_timestamp, $all_links;
|
||||
if ($tagName == 'WEBLOGUPDATES') {
|
||||
//convert 'updated' into php date variable
|
||||
$updated_timestamp = strtotime($attrs['UPDATED']);
|
||||
//echo('got timestamp of ' . gmdate('F j, Y, H:i:s', $updated_timestamp) . "\n");
|
||||
} else if ($tagName == 'WEBLOG') {
|
||||
// is this url in our links?
|
||||
if (isset($all_links[$attrs['URL']])) {
|
||||
$all_links[$attrs['URL']][1] = gmdate('YmdHis', $updated_timestamp - $attrs['WHEN']);
|
||||
//echo('set link id ' . $all_links[$attrs['URL']][0] . ' to date ' . $all_links[$attrs['URL']][1] . "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
** endElement()
|
||||
** Callback function. Called at the end of an xml tag.
|
||||
**/
|
||||
function endElement($parser, $tagName) {
|
||||
// nothing to do.
|
||||
}
|
||||
|
||||
|
||||
// get/update the cache file.
|
||||
// true return means new copy
|
||||
if (get_weblogs_updatedfile()) {
|
||||
|
||||
// pre-load the links
|
||||
preload_links();
|
||||
|
||||
// Create an XML parser
|
||||
$xml_parser = xml_parser_create();
|
||||
|
||||
// Set the functions to handle opening and closing tags
|
||||
xml_set_element_handler($xml_parser, "startElement", "endElement");
|
||||
|
||||
// Open the XML file for reading
|
||||
$fp = fopen($weblogs_cache_file, "r")
|
||||
or die("Error reading XML data.");
|
||||
|
||||
//echo('<pre>');
|
||||
// Read the XML file 4KB at a time
|
||||
while ($data = fread($fp, 4096)) {
|
||||
// Parse each 4KB chunk with the XML parser created above
|
||||
xml_parse($xml_parser, $data, feof($fp))
|
||||
// Handle errors in parsing
|
||||
or die(sprintf("XML error: %s at line %d",
|
||||
xml_error_string(xml_get_error_code($xml_parser)),
|
||||
xml_get_current_line_number($xml_parser)));
|
||||
}
|
||||
|
||||
// Close the XML file
|
||||
fclose($fp);
|
||||
|
||||
// Free up memory used by the XML parser
|
||||
xml_parser_free($xml_parser);
|
||||
|
||||
// now update the db with latest times
|
||||
update_links();
|
||||
|
||||
//echo('</pre>');
|
||||
} // end if updated cache file
|
||||
?>
|
@ -346,4 +346,4 @@ default:
|
||||
|
||||
/* </Edit> */
|
||||
include("b2footer.php");
|
||||
?>
|
||||
?>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
require_once("../b2config.php");
|
||||
require_once($b2inc."/b2template.functions.php");
|
||||
require_once($b2inc."/b2verifauth.php");
|
||||
require_once("b2verifauth.php");
|
||||
require_once($b2inc."/b2vars.php");
|
||||
require_once($b2inc."/b2functions.php");
|
||||
require_once($b2inc."/xmlrpc.inc");
|
||||
@ -156,4 +156,4 @@ if ($profile==0) {
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
if ($pagenow != "b2profile.php") {
|
||||
|
||||
$menu = file("b2menutop.txt");
|
||||
$menu = file("./b2menutop.txt");
|
||||
$i=0;
|
||||
$j=$menu[0];
|
||||
while ($j != "") {
|
||||
|
@ -43,7 +43,7 @@ switch($action) {
|
||||
|
||||
case "update":
|
||||
|
||||
require_once("$b2inc/b2verifauth.php");
|
||||
require_once("b2verifauth.php");
|
||||
|
||||
get_currentuserinfo();
|
||||
|
||||
@ -114,7 +114,7 @@ break;
|
||||
|
||||
case "viewprofile":
|
||||
|
||||
require_once("$b2inc/b2verifauth.php");
|
||||
require_once("b2verifauth.php");
|
||||
/* $profile=1;
|
||||
|
||||
get_currentuserinfo();
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$title = "Template(s) & file editing";
|
||||
$title = "Template(s) & file editing";
|
||||
/* <Template> */
|
||||
|
||||
function add_magic_quotes($array) {
|
||||
|
@ -73,7 +73,6 @@ switch ($action) {
|
||||
{
|
||||
$standalone = 1;
|
||||
include_once("./b2header.php");
|
||||
include_once("./links.php");
|
||||
|
||||
$cat_id = $HTTP_POST_VARS["cat_id"];
|
||||
$cat_name=get_linkcatname($cat_id);
|
||||
@ -97,7 +96,6 @@ switch ($action) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user