');
}
else
{
$kelloggs = strip_tags ($kelloggs);
}
$input[$cereal] = $kelloggs;
}
}
// Otherwise, we don't need to add slashes
else
{
foreach($input as $cereal => $kelloggs)
{
if (!is_array ($cereal))
{
if ($cereal == 'comment')
{
$kelloggs = strip_tags ($kelloggs, '');
}
else
{
$kelloggs = strip_tags ($kelloggs);
}
$input[$cereal] = $kelloggs;
}
}
}
return $input;
}
//Prepare the post
//Kudos to Sani for help formatting
function format_post ($string, $me_replace, $multi_line = TRUE)
{
if ($multi_line)
{
//Convert newlines to
tags and double
s to paragraphs
$string = nl2br_skip_html($string);
$string = preg_replace("/
([\s]*)
/i", "\n", $string);
$string = '
' . $string . '
';
}
//Replace emoticon codes with images
$string = replace_emotes($string);
// The array of entities that we shall be replacing
$chars = array ();
$chars[] = array ('<', '<'); // Less than (<)
$chars[] = array ('>', '>'); // Greater than (>)
$chars[] = array (' ', ' '); // Non-breaking space
$chars[] = array ('©', '©'); // Copyright sign
$chars[] = array ('(c)', '©'); //
$chars[] = array ('«', '«'); // Left French quotation mark
$chars[] = array ('»', '»'); // Right French quotation mark
$chars[] = array ('', ''); // Soft hyphen
$chars[] = array ('®', '®'); // Registered trademark
$chars[] = array ('(r)', '®'); //
$chars[] = array ('°', '°'); // Degree sign
$chars[] = array ('--', '—'); // Em dash
$chars[] = array ('—', '—'); //
$chars[] = array ('', '—'); //
$chars[] = array ("'", '’'); // Single quotation mark
$chars[] = array ('...', '…'); // Ellipses
$chars[] = array ('. . .', '…'); //
$chars[] = array ('™', '™'); // Trademark sign
$chars[] = array ('', '™'); //
$chars[] = array ('(tm)', '™'); //
//List of block-level HTML elements that should not go inside
//Separate with |
$html_match = "blockquote|dl|div|form|ol|table|ul";
$string = stripslashes ($string); //Stripslashes
//Bye-bye ampersands
$string = preg_replace("/&/i", "&$1", $string);
//Encode XML entities
$string = preg_replace("/&#([\d]+);/i", "$1;", $string);
//Encode double quotation marks
$string = preg_replace ("/=\"([^\"]+)\"/i", "={{dq}}$1{{dq}}", $string);
$string = preg_replace ("/\"([^\"]+)\"/i", "“$1”", $string);
//Make sure URIs aren't affected
$string = preg_replace ("/=“([^”]|[^=]+)”/i", "=\"$1\"", $string);
$string = str_replace ('{{dq}}', '"', $string);
for ($i = 0; $i < count ($chars); $i++)
{
$string = str_replace ($chars[$i][0], $chars[$i][1], $string);
}
//Get rid of paragraphs around block-level elements
$string = preg_replace("/
([\s]*)<(" . $html_match . ")([\s\S]*)<\/(" . $html_match . ")>/i", "
\n<$2$3$4>\n", $string);
$string = preg_replace("/
([\s]*)<(" . $html_match . ")([\s\S]*)<\/(" . $html_match . ")>/i", "
\n<$2$3$4>\n", $string);
$string = preg_replace("/
([\s]*)<(" . $html_match . ")([\s\S]*)<\/(" . $html_match . ")>([\s]*)<(\/p|br)(\s\/)?>/i", "<$2$3$4>$5
", $string);
//Make sure HTML comments aren't affected
$string = str_replace ('', '-->', $string);
//Replace "/me" with the replacement string (author)
$string = str_replace("/me ", "" . $me_replace . "", $string);
return $string;
}
//Display the comments page of the VSNS Lemon Admin CP
function comment_display()
{
global $path;
//Get some stats
$total_comments = mysql_num_rows(mysql_query("SELECT ID FROM vsns_comments"));
$num_queued = mysql_num_rows(mysql_query("SELECT ID FROM vsns_comments WHERE queue = '1'"));
?>
Stats at a Glance
- Total number of comments:
- queued
Welcome to the VSNS Lemon Admin Control Panel. From here, you can perform tasks to manage your blog as well as add new entries. VSNS Lemon is designed to be simple and efficient at what it does.
Statistics
- Total number of articles:
- queued
- pinned
- regular
- Total number of categories:
$category (" . $hatsquery . ")
\n";
}
?>
Resources
Do you need help using VSNS Lemon? There are a variety of ways to contact me. I recommend that you fully read the README first, since it includes a lot of helpful information.
If you still need help, try my message boards. You can look there to see if others have had the same problem, if it is caused by a bug, or just post for help and I’ll do my best to help you.
You can also contact me by email, ben AT tachyondecay.net. Please leave a detailled description of your problem and I will try and help you out.
$emoticon['icon'], 0 => $emoticon['shortcut']);
}
mysql_free_result ($emotes_query);
}
// Convert newlines to br's unless there's HTML
// Thanks to thunberg at gmail dot com:
// http://ca3.php.net/manual/en/function.nl2br.php#56737
function nl2br_skip_html($string)
{
// remove any carriage returns (mysql)
$string = str_replace("\r", '', $string);
// replace any newlines that aren't preceded by a > with a
$string = preg_replace('/(?)\n/', "
\n", $string);
return $string;
}
// Create the RSS feed file
function write_rss ()
{
extract ($_SESSION['config']);
$year = date ("Y");
//Get most recent 10 articles
$query = mysql_query("SELECT ID,heading,content,author,month,day,year,pubDate FROM vsns_news ORDER BY ID DESC LIMIT 10") or die(mysql_error());
if (mysql_num_rows($query) > 0);
{
while ($row = mysql_fetch_array($query))
{
//Start building the proper information
//Title, description, link, and date
$heading = stripslashes ($row['heading']);
$heading = strip_tags ($heading);
$heading = htmlentities ($heading, ENT_QUOTES);
$description = stripslashes ($row['content']);
//$description = strip_tags ($description);
//$description = htmlspecialchars ($description, ENT_QUOTES);
$description = format_post ($description, $_row['author']);
//$description = substr ($description, 0, 300);
//Kudos to Stefan for this
//$description = preg_replace('/\s+\S*$/', '', $description)."...";
// Check if friendly URIs through .htaccess are enabled
if (1 == $friendly)
{
$link = $path."archives/".$row["year"]."/".$row["month"]."/".$row["day"]."/".$row["ID"]."/";
}
else
{
$link = $path . "?towel=archives&type=id&id=" . $row["ID"];
}
if ($row["pubDate"] == 0)
{
$timestamp = mktime("00", "00", "00", $row["month"], $row["day"], $row["year"], -1);
$pubDate = date("D, d M Y H:i:s T", $timestamp);
}
else
{
$pubDate = strftime("%a, %d %b %Y %T %Z", $row["pubDate"]);
}
$item .= <<
$heading
$link
$pubDate
$link
WOOT;
}
mysql_free_result($query);
}
$file = "";
$file .= <<
$sitename
$desc
$website
Copyright $year $cright. All rights reserved.
$item
BASEBALL;
//Write these settings to the file
$handle = fopen($serverpath . 'rss.xml', 'wb');
fwrite($handle, $file);
fclose($handle);
}
?>