ezSQL mods.
git-svn-id: http://svn.automattic.com/wordpress/trunk@114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
54d1965caf
commit
d37d5204a9
|
@ -432,7 +432,7 @@ function get_lastpostdate() {
|
|||
}
|
||||
$sql = "SELECT * FROM $tableposts WHERE $showcatzero post_date <= '$now' ORDER BY post_date DESC LIMIT 1";
|
||||
$result = mysql_query($sql) or die("Your SQL query: <br />$sql<br /><br />MySQL said:<br />".mysql_error());
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
$myrow = mysql_fetch_object($result);
|
||||
$lastpostdate = $myrow->post_date;
|
||||
$cache_lastpostdate = $lastpostdate;
|
||||
|
@ -459,7 +459,7 @@ function get_userdata($userid) {
|
|||
$sql = "SELECT * FROM $tableusers WHERE ID = '$userid'";
|
||||
$result = mysql_query($sql) or die("Your SQL query: <br />$sql<br /><br />MySQL said:<br />".mysql_error());
|
||||
$myrow = mysql_fetch_array($result);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
$cache_userdata[$userid] = $myrow;
|
||||
} else {
|
||||
$myrow = $cache_userdata[$userid];
|
||||
|
@ -468,15 +468,15 @@ function get_userdata($userid) {
|
|||
}
|
||||
|
||||
function get_userdata2($userid) { // for team-listing
|
||||
global $tableusers,$row;
|
||||
global $tableusers,$post;
|
||||
$user_data['ID'] = $userid;
|
||||
$user_data['user_login'] = $row->user_login;
|
||||
$user_data['user_firstname'] = $row->user_firstname;
|
||||
$user_data['user_lastname'] = $row->user_lastname;
|
||||
$user_data['user_nickname'] = $row->user_nickname;
|
||||
$user_data['user_level'] = $row->user_level;
|
||||
$user_data['user_email'] = $row->user_email;
|
||||
$user_data['user_url'] = $row->user_url;
|
||||
$user_data['user_login'] = $post->user_login;
|
||||
$user_data['user_firstname'] = $post->user_firstname;
|
||||
$user_data['user_lastname'] = $post->user_lastname;
|
||||
$user_data['user_nickname'] = $post->user_nickname;
|
||||
$user_data['user_level'] = $post->user_level;
|
||||
$user_data['user_email'] = $post->user_email;
|
||||
$user_data['user_url'] = $post->user_url;
|
||||
return($user_data);
|
||||
}
|
||||
|
||||
|
@ -487,7 +487,7 @@ function get_userdatabylogin($user_login) {
|
|||
$result = mysql_query($sql) or die("Your SQL query: <br />$sql<br /><br />MySQL said:<br />".mysql_error());
|
||||
if (!$result) die($sql."<br /><br />".mysql_error());
|
||||
$myrow = mysql_fetch_array($result);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
$cache_userdata["$user_login"] = $myrow;
|
||||
} else {
|
||||
$myrow = $cache_userdata["$user_login"];
|
||||
|
@ -501,7 +501,7 @@ function get_userid($user_login) {
|
|||
$sql = "SELECT ID FROM $tableusers WHERE user_login = '$user_login'";
|
||||
$result = mysql_query($sql) or die("No user with the login <i>$user_login</i>");
|
||||
$myrow = mysql_fetch_array($result);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
$cache_userdata["$user_login"] = $myrow;
|
||||
} else {
|
||||
$myrow = $cache_userdata["$user_login"];
|
||||
|
@ -513,80 +513,73 @@ function get_usernumposts($userid) {
|
|||
global $tableusers,$tablesettings,$tablecategories,$tableposts,$tablecomments,$querycount;
|
||||
$sql = "SELECT * FROM $tableposts WHERE post_author = $userid";
|
||||
$result = mysql_query($sql) or die("Your SQL query: <br />$sql<br /><br />MySQL said:<br />".mysql_error());
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
return mysql_num_rows($result);
|
||||
}
|
||||
|
||||
function get_settings($setting) {
|
||||
global $tablesettings,$querycount,$cache_settings,$use_cache;
|
||||
global $tablesettings, $wpdb, $cache_settings, $use_cache, $querycount;
|
||||
if ((empty($cache_settings)) OR (!$use_cache)) {
|
||||
$sql = "SELECT * FROM $tablesettings";
|
||||
$result = mysql_query($sql) or die("Your SQL query: <br />$sql<br /><br />MySQL said:<br />".mysql_error());
|
||||
$querycount++;
|
||||
$myrow = mysql_fetch_object($result);
|
||||
$cache_settings = $myrow;
|
||||
$settings = $wpdb->get_row("SELECT * FROM $tablesettings");
|
||||
++$querycount;
|
||||
$cache_settings = $settings;
|
||||
} else {
|
||||
$myrow = $cache_settings;
|
||||
$settings = $cache_settings;
|
||||
}
|
||||
return($myrow->$setting);
|
||||
return($settings->$setting);
|
||||
}
|
||||
|
||||
function get_postdata($postid) {
|
||||
global $tableusers,$tablesettings,$tablecategories,$tableposts,$tablecomments,$querycount;
|
||||
$sql = "SELECT * FROM $tableposts WHERE ID = $postid";
|
||||
$result = mysql_query($sql) or die("Your SQL query: <br />$sql<br /><br />MySQL said:<br />".mysql_error());
|
||||
$querycount++;
|
||||
if (mysql_num_rows($result)) {
|
||||
$myrow = mysql_fetch_object($result);
|
||||
$postdata = array (
|
||||
'ID' => $myrow->ID,
|
||||
'Author_ID' => $myrow->post_author,
|
||||
'Date' => $myrow->post_date,
|
||||
'Content' => $myrow->post_content,
|
||||
'Excerpt' => $myrow->post_excerpt,
|
||||
'Title' => $myrow->post_title,
|
||||
'Category' => $myrow->post_category,
|
||||
);
|
||||
return($postdata);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
global $tableusers, $tablesettings, $tablecategories, $tableposts, $tablecomments, $querycount, $wpdb;
|
||||
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = $postid");
|
||||
++$querycount;
|
||||
|
||||
$postdata = array (
|
||||
'ID' => $post->ID,
|
||||
'Author_ID' => $post->post_author,
|
||||
'Date' => $post->post_date,
|
||||
'Content' => $post->post_content,
|
||||
'Excerpt' => $post->post_excerpt,
|
||||
'Title' => $post->post_title,
|
||||
'Category' => $post->post_category,
|
||||
);
|
||||
return($postdata);
|
||||
}
|
||||
|
||||
function get_postdata2($postid=0) { // less flexible, but saves mysql queries
|
||||
global $row;
|
||||
global $post;
|
||||
$postdata = array (
|
||||
'ID' => $row->ID,
|
||||
'Author_ID' => $row->post_author,
|
||||
'Date' => $row->post_date,
|
||||
'Content' => $row->post_content,
|
||||
'Excerpt' => $row->post_excerpt,
|
||||
'Title' => $row->post_title,
|
||||
'Category' => $row->post_category,
|
||||
# 'Notify' => $row->post_notifycomments,
|
||||
# 'Clickable' => $row->post_make_clickable,
|
||||
'Karma' => $row->post_karma // this isn't used yet
|
||||
'ID' => $post->ID,
|
||||
'Author_ID' => $post->post_author,
|
||||
'Date' => $post->post_date,
|
||||
'Content' => $post->post_content,
|
||||
'Excerpt' => $post->post_excerpt,
|
||||
'Title' => $post->post_title,
|
||||
'Category' => $post->post_category,
|
||||
# 'Notify' => $post->post_notifycomments,
|
||||
# 'Clickable' => $post->post_make_clickable,
|
||||
'Karma' => $post->post_karma // this isn't used yet
|
||||
);
|
||||
return($postdata);
|
||||
}
|
||||
|
||||
function get_commentdata($comment_ID,$no_cache=0) { // less flexible, but saves mysql queries
|
||||
global $rowc,$id,$commentdata,$tablecomments,$querycount;
|
||||
global $postc,$id,$commentdata,$tablecomments,$querycount;
|
||||
if ($no_cache) {
|
||||
$query="SELECT * FROM $tablecomments WHERE comment_ID = $comment_ID";
|
||||
$result=mysql_query($query);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
$myrow = mysql_fetch_array($result);
|
||||
} else {
|
||||
$myrow['comment_ID']=$rowc->comment_ID;
|
||||
$myrow['comment_post_ID']=$rowc->comment_post_ID;
|
||||
$myrow['comment_author']=$rowc->comment_author;
|
||||
$myrow['comment_author_email']=$rowc->comment_author_email;
|
||||
$myrow['comment_author_url']=$rowc->comment_author_url;
|
||||
$myrow['comment_author_IP']=$rowc->comment_author_IP;
|
||||
$myrow['comment_date']=$rowc->comment_date;
|
||||
$myrow['comment_content']=$rowc->comment_content;
|
||||
$myrow['comment_karma']=$rowc->comment_karma;
|
||||
$myrow['comment_ID']=$postc->comment_ID;
|
||||
$myrow['comment_post_ID']=$postc->comment_post_ID;
|
||||
$myrow['comment_author']=$postc->comment_author;
|
||||
$myrow['comment_author_email']=$postc->comment_author_email;
|
||||
$myrow['comment_author_url']=$postc->comment_author_url;
|
||||
$myrow['comment_author_IP']=$postc->comment_author_IP;
|
||||
$myrow['comment_date']=$postc->comment_date;
|
||||
$myrow['comment_content']=$postc->comment_content;
|
||||
$myrow['comment_karma']=$postc->comment_karma;
|
||||
if (strstr($myrow['comment_content'], '<trackback />')) {
|
||||
$myrow['comment_type'] = 'trackback';
|
||||
} elseif (strstr($myrow['comment_content'], '<pingback />')) {
|
||||
|
@ -604,8 +597,8 @@ function get_catname($cat_ID) {
|
|||
$sql = "SELECT * FROM $tablecategories";
|
||||
$result = mysql_query($sql) or die('Oops, couldn\'t query the db for categories.');
|
||||
$querycount;
|
||||
while ($row = mysql_fetch_object($result)) {
|
||||
$cache_catnames[$row->cat_ID] = $row->cat_name;
|
||||
while ($post = mysql_fetch_object($result)) {
|
||||
$cache_catnames[$post->cat_ID] = $post->cat_name;
|
||||
}
|
||||
}
|
||||
$cat_name = $cache_catnames[$cat_ID];
|
||||
|
@ -621,14 +614,14 @@ function dropdown_categories($blog_ID=1) {
|
|||
global $postdata,$tablecategories,$mode,$querycount;
|
||||
$query="SELECT * FROM $tablecategories";
|
||||
$result=mysql_query($query);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
$width = ($mode=="sidebar") ? "100%" : "170px";
|
||||
echo '<select name="post_category" style="width:'.$width.';" tabindex="2" id="category">';
|
||||
while($row = mysql_fetch_object($result)) {
|
||||
echo "<option value=\"".$row->cat_ID."\"";
|
||||
if ($row->cat_ID == $postdata["Category"])
|
||||
while($post = mysql_fetch_object($result)) {
|
||||
echo "<option value=\"".$post->cat_ID."\"";
|
||||
if ($post->cat_ID == $postdata["Category"])
|
||||
echo " selected";
|
||||
echo ">".$row->cat_name."</option>";
|
||||
echo ">".$post->cat_name."</option>";
|
||||
}
|
||||
echo "</select>";
|
||||
}
|
||||
|
@ -893,81 +886,6 @@ function trackback_response($error = 0, $error_message = '') {
|
|||
die();
|
||||
}
|
||||
|
||||
// updates the RSS feed !
|
||||
function rss_update($blog_ID, $num_posts="", $file="./b2rss.xml") {
|
||||
|
||||
global $use_rss, $b2_version, $querystring_start, $querystring_equal, $querystring_separator;
|
||||
global $admin_email,$blogname,$siteurl,$blogfilename,$blogdescription,$posts_per_rss,$rss_language;
|
||||
global $tableposts,$postdata,$row;
|
||||
|
||||
if ($rss_language == '') {
|
||||
$rss_language = 'en';
|
||||
}
|
||||
|
||||
if ($use_rss) {
|
||||
|
||||
$num_posts = ($num_posts=="") ? $posts_per_rss : 5;
|
||||
|
||||
$date_now = gmdate("D, d M Y H:i:s")." GMT";
|
||||
|
||||
# let's build the rss file
|
||||
$rss = '';
|
||||
|
||||
$rss .= '<?xml version="1.0"?'.">\n";
|
||||
$rss .= "<!-- generator=\"b2/$b2_version\" -->\n";
|
||||
$rss .= "<rss version=\"0.92\">\n";
|
||||
$rss .= "\t<channel>\n";
|
||||
$rss .= "\t\t<title>".convert_chars(strip_tags(get_bloginfo("name")),"unicode")."</title>\n";
|
||||
$rss .= "\t\t<link>".convert_chars(strip_tags(get_bloginfo("url")),"unicode")."</link>\n";
|
||||
$rss .= "\t\t<description>".convert_chars(strip_tags(get_bloginfo("description")),"unicode")."</description>\n";
|
||||
$rss .= "\t\t<lastBuildDate>$date_now</lastBuildDate>\n";
|
||||
$rss .= "\t\t<docs>http://backend.userland.com/rss092</docs>\n";
|
||||
$rss .= "\t\t<managingEditor>$admin_email</managingEditor>\n";
|
||||
$rss .= "\t\t<webMaster>$admin_email</webMaster>\n";
|
||||
$rss .= "\t\t<language>$rss_language</language>\n";
|
||||
|
||||
$now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600)));
|
||||
$sql = "SELECT * FROM $tableposts WHERE post_date <= '$now' AND post_category > 0 ORDER BY post_date DESC LIMIT $num_posts";
|
||||
$result = mysql_query($sql) or die("Your SQL query: <br />$sql<br /><br />MySQL said:<br />".mysql_error());
|
||||
|
||||
while($row = mysql_fetch_object($result)) {
|
||||
|
||||
$id = $row->ID;
|
||||
$postdata=get_postdata2($id);
|
||||
|
||||
$rss .= "\t\t<item>\n";
|
||||
$rss .= "\t\t\t<title>".convert_chars(strip_tags(get_the_title()),"unicode")."</title>\n";
|
||||
|
||||
// we could add some specific RSS here, but not yet. uncomment if you wish, it's functionnal
|
||||
// $rss .= "\t\t\t<category>".convert_chars(strip_tags(get_the_category()),"unicode")."</category>\n";
|
||||
|
||||
$content = stripslashes($row->post_content);
|
||||
$content = explode("<!--more-->",$content);
|
||||
$content = $content[0];
|
||||
$rss .= "\t\t\t<description>".convert_chars(make_url_footnote($content),"unicode")."</description>\n";
|
||||
|
||||
$rss .= "\t\t\t<link>".htmlentities("$siteurl/$blogfilename".$querystring_start.'p'.$querystring_equal.$row->ID.$querystring_separator.'c'.$querystring_equal.'1')."</link>\n";
|
||||
$rss .= "\t\t</item>\n";
|
||||
|
||||
}
|
||||
|
||||
$rss .= "\t</channel>\n";
|
||||
$rss .= "</rss>";
|
||||
|
||||
$f=@fopen("$file","w+");
|
||||
if ($f) {
|
||||
@fwrite($f,$rss);
|
||||
@fclose($f);
|
||||
|
||||
return(true);
|
||||
} else {
|
||||
return(false);
|
||||
}
|
||||
} else {
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
function make_url_footnote($content) {
|
||||
global $siteurl;
|
||||
preg_match_all('/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches);
|
||||
|
|
|
@ -71,7 +71,7 @@ function get_bloginfo($show='') {
|
|||
return($output);
|
||||
}
|
||||
|
||||
function single_post_title($prefix = '', $display = 1) {
|
||||
function single_post_title($prefix = '', $display = true) {
|
||||
global $p;
|
||||
if (intval($p)) {
|
||||
$post_data = get_postdata($p);
|
||||
|
@ -85,7 +85,7 @@ function single_post_title($prefix = '', $display = 1) {
|
|||
}
|
||||
}
|
||||
|
||||
function single_cat_title($prefix = '', $display = 1 ) {
|
||||
function single_cat_title($prefix = '', $display = true ) {
|
||||
global $cat;
|
||||
if(!empty($cat) && !(strtoupper($cat) == 'ALL')) {
|
||||
$my_cat_name = get_the_category_by_ID($cat);
|
||||
|
@ -98,7 +98,7 @@ function single_cat_title($prefix = '', $display = 1 ) {
|
|||
}
|
||||
}
|
||||
|
||||
function single_month_title($prefix = '', $display = 1 ) {
|
||||
function single_month_title($prefix = '', $display = true ) {
|
||||
global $m, $month;
|
||||
if(!empty($m)) {
|
||||
$my_year = substr($m,0,4);
|
||||
|
@ -111,9 +111,8 @@ function single_month_title($prefix = '', $display = 1 ) {
|
|||
}
|
||||
|
||||
function get_archives($type, $limit='') {
|
||||
global $tableposts, $dateformat, $time_difference, $siteurl, $blogfilename, $querystring_start, $querystring_equal, $month;
|
||||
global $tableposts, $dateformat, $time_difference, $siteurl, $blogfilename, $querystring_start, $querystring_equal, $month, $wpdb;
|
||||
// weekly and daily are *broken*
|
||||
dbconnect();
|
||||
if ('' != $limit) {
|
||||
$limit = (int) $limit;
|
||||
$limit= " LIMIT $limit";
|
||||
|
@ -130,63 +129,52 @@ function get_archives($type, $limit='') {
|
|||
|
||||
$now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600)));
|
||||
|
||||
if ($type == 'monthly') {
|
||||
$arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date) FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit;
|
||||
$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 "<li><a href=\"$archive_link_m$arc_year".zeroise($arc_month,2).'">';
|
||||
echo $month[zeroise($arc_month,2)].' '.$arc_year;
|
||||
if ('monthly' == $type) {
|
||||
++$querycount;
|
||||
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month` FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit);
|
||||
foreach ($arcresults as $arcresult) {
|
||||
echo "<li><a href=\"$archive_link_m$arcresult->year".zeroise($arcresult->month, 2).'">';
|
||||
echo $month[zeroise($arcresult->month, 2)].' '.$arcresult->year;
|
||||
echo "</a></li>\n";
|
||||
}
|
||||
} elseif ($type == 'daily') {
|
||||
$arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit;
|
||||
$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 "<li><a href=\"$archive_link_m$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');
|
||||
} elseif ('daily' == $type) {
|
||||
++$querycount;
|
||||
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit);
|
||||
foreach ($arcresults as $arcresult) {
|
||||
echo "<li><a href=\"$archive_link_m$arcresult->year".zeroise($arcresult->month, 2).zeroise($arcresult->dayofmonth, 2).'">';
|
||||
echo mysql2date($archive_day_date_format, $arcresult->year.'-'.zeroise($arcresult->month,2).'-'.zeroise($arcresult->dayofmonth,2).' 00:00:00');
|
||||
echo "</a></li>\n";
|
||||
}
|
||||
} elseif ($type == 'weekly') {
|
||||
} elseif ('weekly' == $type) {
|
||||
if (!isset($start_of_week)) {
|
||||
$start_of_week = 1;
|
||||
}
|
||||
$arc_sql = "SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date), WEEK(post_date) FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit;
|
||||
$querycount++;
|
||||
$arc_result=mysql_query($arc_sql) or die($arc_sql.'<br />'.mysql_error());
|
||||
++$querycount;
|
||||
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, WEEK(post_date) AS `week` FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit);
|
||||
$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);
|
||||
foreach ($arcresults as $arcresult) {
|
||||
if ($arcresult->week != $arc_w_last) {
|
||||
$arc_w_last = $arcresult->week;
|
||||
$arc_ymd = $arcresult->year.'-'.zeroise($arcresult->month, 2).'-' .zeroise($arcresult->dayofmonth, 2);
|
||||
$arc_week = get_weekstartend($arc_ymd, $start_of_week);
|
||||
$arc_week_start = date_i18n($archive_week_start_date_format, $arc_week['start']);
|
||||
$arc_week_end = date_i18n($archive_week_end_date_format, $arc_week['end']);
|
||||
echo "<li><a href=\"$siteurl/".$blogfilename."?m=$arc_year&w=$arc_w\">";
|
||||
echo "<li><a href='$siteurl/".$blogfilename."?m=$arc_year&w=$arc_w'>";
|
||||
echo $arc_week_start.$archive_week_separator.$arc_week_end;
|
||||
echo "</a></li>\n";
|
||||
}
|
||||
}
|
||||
} elseif ($type == 'postbypost') {
|
||||
$requestarc = " SELECT ID,post_date,post_title FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit;
|
||||
$querycount++;
|
||||
$resultarc = mysql_query($requestarc);
|
||||
while($row=mysql_fetch_object($resultarc)) {
|
||||
if ($row->post_date != '0000-00-00 00:00:00') {
|
||||
echo "<li><a href=\"$archive_link_p".$row->ID.'">';
|
||||
$arc_title = stripslashes($row->post_title);
|
||||
} elseif ('postbypost' == $type) {
|
||||
++$querycount;
|
||||
$arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $tableposts WHERE post_date < '$now' AND post_category > 0 ORDER BY post_date DESC" . $limit);
|
||||
foreach ($arcresults as $arcresult) {
|
||||
if ($arcresult->post_date != '0000-00-00 00:00:00') {
|
||||
echo "<li><a href=\"$archive_link_p".$arcresult->ID.'">';
|
||||
$arc_title = stripslashes($arcresult->post_title);
|
||||
if ($arc_title) {
|
||||
echo strip_tags($arc_title);
|
||||
} else {
|
||||
echo $row->ID;
|
||||
echo $arcresult->ID;
|
||||
}
|
||||
echo "</a></li>\n";
|
||||
}
|
||||
|
@ -200,8 +188,8 @@ function get_archives($type, $limit='') {
|
|||
|
||||
/***** Date/Time tags *****/
|
||||
|
||||
function the_date($d='', $before='', $after='', $echo = 1) {
|
||||
global $id, $postdata, $day, $previousday,$dateformat,$newday;
|
||||
function the_date($d='', $before='', $after='', $echo = true) {
|
||||
global $id, $postdata, $day, $previousday, $dateformat, $newday;
|
||||
$the_date = '';
|
||||
if ($day != $previousday) {
|
||||
$the_date .= $before;
|
||||
|
@ -221,7 +209,7 @@ function the_date($d='', $before='', $after='', $echo = 1) {
|
|||
}
|
||||
}
|
||||
|
||||
function the_time($d='', $echo = 1) {
|
||||
function the_time($d='', $echo = true) {
|
||||
global $id,$postdata,$timeformat;
|
||||
if ($d=='') {
|
||||
$the_time = mysql2date($timeformat, $postdata['Date']);
|
||||
|
@ -364,7 +352,7 @@ function the_title_unicode($before='',$after='') {
|
|||
}
|
||||
}
|
||||
function get_the_title() {
|
||||
global $id,$postdata;
|
||||
global $id, $postdata;
|
||||
$output = stripslashes($postdata['Title']);
|
||||
$output = apply_filters('the_title', $output);
|
||||
return($output);
|
||||
|
@ -612,7 +600,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
|
|||
$sql = "SELECT ID,post_title FROM $tableposts WHERE post_date < '$current_post_date' AND post_category > 0 $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT $limitprev,1";
|
||||
|
||||
$query = @mysql_query($sql);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
if (($query) && (mysql_num_rows($query))) {
|
||||
$p_info = mysql_fetch_object($query);
|
||||
$p_title = $p_info->post_title;
|
||||
|
@ -657,7 +645,7 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
|
|||
$sql = "SELECT ID,post_title FROM $tableposts WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_category > 0 $sqlcat $sql_exclude_cats ORDER BY post_date ASC LIMIT $limitnext,1";
|
||||
|
||||
$query = @mysql_query($sql);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
if (($query) && (mysql_num_rows($query))) {
|
||||
$p_info = mysql_fetch_object($query);
|
||||
$p_title = $p_info->post_title;
|
||||
|
@ -805,7 +793,7 @@ function get_the_category() {
|
|||
if ((empty($cache_categories[$cat_ID])) OR (!$use_cache)) {
|
||||
$query="SELECT cat_name FROM $tablecategories WHERE cat_ID = '$cat_ID'";
|
||||
$result=mysql_query($query);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
$myrow = mysql_fetch_array($result);
|
||||
$cat_name = $myrow[0];
|
||||
$cache_categories[$cat_ID] = $cat_name;
|
||||
|
@ -820,7 +808,7 @@ function get_the_category_by_ID($cat_ID) {
|
|||
if ((!$cache_categories[$cat_ID]) OR (!$use_cache)) {
|
||||
$query="SELECT cat_name FROM $tablecategories WHERE cat_ID = '$cat_ID'";
|
||||
$result=mysql_query($query);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
$myrow = mysql_fetch_array($result);
|
||||
$cat_name = $myrow[0];
|
||||
$cache_categories[$cat_ID] = $cat_name;
|
||||
|
@ -850,7 +838,7 @@ function dropdown_cats($optionall = 1, $all = 'All') {
|
|||
global $cat, $tablecategories, $querycount;
|
||||
$query="SELECT * FROM $tablecategories";
|
||||
$result=mysql_query($query);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
echo "<select name=\"cat\" class=\"postform\">\n";
|
||||
if (intval($optionall) == 1) {
|
||||
echo "\t<option value=\"all\">$all</option>\n";
|
||||
|
@ -873,7 +861,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
|||
$sort_column = 'cat_'.$sort_column;
|
||||
$query="SELECT * FROM $tablecategories WHERE cat_ID > 0 ORDER BY $sort_column $sort_order";
|
||||
$result=mysql_query($query);
|
||||
$querycount++;
|
||||
++$querycount;
|
||||
if (intval($optionall) == 1) {
|
||||
$all = apply_filters('list_cats', $all);
|
||||
if ($list) echo "\n\t<li><a href=\"".$file.$querystring_start.'cat'.$querystring_equal.'all">'.$all."</a></li>";
|
||||
|
@ -909,52 +897,22 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
|||
/***** Comment tags *****/
|
||||
|
||||
// generic comments/trackbacks/pingbacks numbering
|
||||
function generic_ctp_number($post_id, $mode = 'comments') {
|
||||
global $postdata, $tablecomments, $querycount, $cache_ctp_number, $use_cache;
|
||||
if (!isset($cache_ctp_number[$post_id]) || (!$use_cache)) {
|
||||
$post_id = intval($post_id);
|
||||
$query = "SELECT * FROM $tablecomments WHERE comment_post_ID = $post_id";
|
||||
$result = mysql_query($query) or die('SQL query: '.$query.'<br />MySQL Error: '.mysql_error());
|
||||
$querycount++;
|
||||
$ctp_number = array();
|
||||
while($row = mysql_fetch_object($result)) {
|
||||
if (substr($row->comment_content, 0, 13) == '<trackback />') {
|
||||
$ctp_number['trackbacks']++;
|
||||
} elseif (substr($row->comment_content, 0, 12) == '<pingback />') {
|
||||
$ctp_number['pingbacks']++;
|
||||
} else {
|
||||
$ctp_number['comments']++;
|
||||
}
|
||||
$ctp_number['ctp']++;
|
||||
}
|
||||
$cache_ctp_number[$post_id] = $ctp_number;
|
||||
} else {
|
||||
$ctp_number = $cache_ctp_number[$post_id];
|
||||
}
|
||||
if (($mode != 'comments') && ($mode != 'trackbacks') && ($mode != 'pingbacks') && ($mode != 'ctp')) {
|
||||
$mode = 'ctp';
|
||||
}
|
||||
return $ctp_number[$mode];
|
||||
}
|
||||
|
||||
function comments_number($zero='no comment', $one='1 comment', $more='% comments') {
|
||||
// original hack by dodo@regretless.com
|
||||
global $id,$postdata,$tablecomments,$c,$querycount,$cache_commentsnumber,$use_cache;
|
||||
$number = generic_ctp_number($id, 'comments');
|
||||
function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments') {
|
||||
global $id, $comment, $tablecomments, $querycount, $wpdb;
|
||||
$number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id");
|
||||
if ($number == 0) {
|
||||
$blah = $zero;
|
||||
} elseif ($number == 1) {
|
||||
$blah = $one;
|
||||
} elseif ($number > 1) {
|
||||
$n = $number;
|
||||
$more=str_replace('%', $n, $more);
|
||||
$blah = $more;
|
||||
$blah = str_replace('%', $number, $more);
|
||||
}
|
||||
echo $blah;
|
||||
}
|
||||
|
||||
function comments_link($file='',$echo=true) {
|
||||
global $id,$pagenow;
|
||||
function comments_link($file='', $echo=true) {
|
||||
global $id, $pagenow;
|
||||
global $querystring_start, $querystring_equal, $querystring_separator;
|
||||
if ($file == '') $file = $pagenow;
|
||||
if ($file == '/') $file = '';
|
||||
|
@ -962,23 +920,21 @@ function comments_link($file='',$echo=true) {
|
|||
else echo $file.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1#comments';
|
||||
}
|
||||
|
||||
function comments_popup_script($width=400, $height=400, $file='b2commentspopup.php', $trackbackfile='b2trackbackpopup.php', $pingbackfile='b2pingbackspopup.php') {
|
||||
function comments_popup_script($width=400, $height=400, $file='b2commentspopup.php') {
|
||||
global $b2commentspopupfile, $b2trackbackpopupfile, $b2pingbackpopupfile, $b2commentsjavascript;
|
||||
$b2commentspopupfile = $file;
|
||||
$b2trackbackpopupfile = $trackbackfile;
|
||||
$b2pingbackpopupfile = $pingbackfile;
|
||||
$b2commentsjavascript = 1;
|
||||
$javascript = "<script language=\"javascript\" type=\"text/javascript\">\n<!--\nfunction b2open (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n//-->\n</script>\n";
|
||||
$javascript = "<script language='javascript' type='text/javascript'>\n<!--\nfunction b2open (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n//-->\n</script>\n";
|
||||
echo $javascript;
|
||||
}
|
||||
|
||||
function comments_popup_link($zero='no comment', $one='1 comment', $more='% comments', $CSSclass='') {
|
||||
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='') {
|
||||
global $id, $b2commentspopupfile, $b2commentsjavascript;
|
||||
global $querystring_start, $querystring_equal, $querystring_separator, $siteurl;
|
||||
echo '<a href="'.$siteurl.'/';
|
||||
echo "<a href=\"$siteurl/";
|
||||
if ($b2commentsjavascript) {
|
||||
echo $b2commentspopupfile.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1';
|
||||
echo '" onclick="b2open(this.href); return false"';
|
||||
echo '\' onclick="b2open(this.href); return false"';
|
||||
} else {
|
||||
// if comments_popup_script() is not in the template, display simple comment link
|
||||
comments_link();
|
||||
|
@ -993,31 +949,62 @@ function comments_popup_link($zero='no comment', $one='1 comment', $more='% comm
|
|||
}
|
||||
|
||||
function comment_ID() {
|
||||
global $commentdata; echo $commentdata['comment_ID'];
|
||||
global $comment;
|
||||
echo $comment->comment_ID;
|
||||
}
|
||||
|
||||
function comment_author() {
|
||||
global $commentdata; echo stripslashes($commentdata['comment_author']);
|
||||
global $comment;
|
||||
echo stripslashes($comment->comment_author);
|
||||
}
|
||||
|
||||
function comment_author_email() {
|
||||
global $commentdata; echo antispambot(stripslashes($commentdata['comment_author_email']));
|
||||
global $comment;
|
||||
echo antispambot(stripslashes($comment->comment_author_email));
|
||||
}
|
||||
|
||||
function comment_author_link() {
|
||||
global $comment;
|
||||
$url = trim(stripslashes(&$comment->comment_author_url));
|
||||
$email = &$comment->comment_author_email;
|
||||
$author = stripslashes(&$comment->comment_author);
|
||||
|
||||
$url = str_replace('http://url', '', $url);
|
||||
|
||||
if (empty($url) && empty($email)) return $author;
|
||||
echo '<a href="';
|
||||
if ($url) {
|
||||
$url = str_replace(';//', '://', $url);
|
||||
$url = (!strstr($url, '://')) ? 'http://'.$url : $url;
|
||||
$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
|
||||
echo $url;
|
||||
} else {
|
||||
echo antispambot($email);
|
||||
}
|
||||
echo '" rel="external">' . $author . '</a>';
|
||||
}
|
||||
|
||||
function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') {
|
||||
global $comment;
|
||||
if (preg_match('|<trackback />|', $comment->comment_content)) echo $trackbacktxt;
|
||||
elseif (preg_match('|<pingback />|', $comment->comment_content)) echo $pingbacktxt;
|
||||
else echo $commenttxt;
|
||||
}
|
||||
function comment_author_url() {
|
||||
global $commentdata;
|
||||
$url = trim(stripslashes($commentdata['comment_author_url']));
|
||||
$url = (!stristr($url, '://')) ? 'http://'.$url : $url;
|
||||
global $comment;
|
||||
$url = trim(stripslashes($comment->comment_author_url));
|
||||
$url = str_replace(';//', '://', $url);
|
||||
$url = (!strstr($url, '://')) ? 'http://'.$url : $url;
|
||||
// convert & into &
|
||||
$url = preg_replace('#&([^amp\;])#is', '&$1', $url);
|
||||
$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
|
||||
if ($url != 'http://url') {
|
||||
echo $url;
|
||||
}
|
||||
}
|
||||
|
||||
function comment_author_email_link($linktext='', $before='', $after='') {
|
||||
global $commentdata;
|
||||
$email=$commentdata['comment_author_email'];
|
||||
global $comment;
|
||||
$email = $comment->comment_author_email;
|
||||
if ((!empty($email)) && ($email != '@')) {
|
||||
$display = ($linktext != '') ? $linktext : antispambot(stripslashes($email));
|
||||
echo $before;
|
||||
|
@ -1027,9 +1014,9 @@ function comment_author_email_link($linktext='', $before='', $after='') {
|
|||
}
|
||||
|
||||
function comment_author_url_link($linktext='', $before='', $after='') {
|
||||
global $commentdata;
|
||||
$url = trim(stripslashes($commentdata['comment_author_url']));
|
||||
$url = preg_replace('#&([^amp\;])#is', '&$1', $url);
|
||||
global $comment;
|
||||
$url = trim(stripslashes($comment->comment_author_url));
|
||||
$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
|
||||
$url = (!stristr($url, '://')) ? 'http://'.$url : $url;
|
||||
if ((!empty($url)) && ($url != 'http://') && ($url != 'http://url')) {
|
||||
$display = ($linktext != '') ? $linktext : stripslashes($url);
|
||||
|
@ -1040,39 +1027,40 @@ function comment_author_url_link($linktext='', $before='', $after='') {
|
|||
}
|
||||
|
||||
function comment_author_IP() {
|
||||
global $commentdata; echo stripslashes($commentdata['comment_author_IP']);
|
||||
global $comment;
|
||||
echo stripslashes($comment->comment_author_IP);
|
||||
}
|
||||
|
||||
function comment_text() {
|
||||
global $commentdata;
|
||||
$comment = stripslashes($commentdata['comment_content']);
|
||||
$comment = str_replace('<trackback />', '', $comment);
|
||||
$comment = str_replace('<pingback />', '', $comment);
|
||||
$comment = convert_chars($comment);
|
||||
$comment = convert_bbcode($comment);
|
||||
$comment = convert_gmcode($comment);
|
||||
$comment = convert_smilies($comment);
|
||||
$comment = make_clickable($comment);
|
||||
$comment = balanceTags($comment);
|
||||
$comment = apply_filters('comment_text', $comment);
|
||||
echo $comment;
|
||||
global $comment;
|
||||
$comment_text = stripslashes($comment->comment_content);
|
||||
$comment_text = str_replace('<trackback />', '', $comment_text);
|
||||
$comment_text = str_replace('<pingback />', '', $comment_text);
|
||||
$comment_text = convert_chars($comment_text);
|
||||
$comment_text = convert_bbcode($comment_text);
|
||||
$comment_text = convert_gmcode($comment_text);
|
||||
$comment_text = convert_smilies($comment_text);
|
||||
$comment_text = make_clickable($comment_text);
|
||||
$comment_text = balanceTags($comment_text);
|
||||
$comment_text = apply_filters('comment_text', $comment_text);
|
||||
echo $comment_text;
|
||||
}
|
||||
|
||||
function comment_date($d='') {
|
||||
global $commentdata,$dateformat;
|
||||
global $comment, $dateformat;
|
||||
if ($d == '') {
|
||||
echo mysql2date($dateformat, $commentdata['comment_date']);
|
||||
echo mysql2date($dateformat, $comment->comment_date);
|
||||
} else {
|
||||
echo mysql2date($d, $commentdata['comment_date']);
|
||||
echo mysql2date($d, $comment->comment_date);
|
||||
}
|
||||
}
|
||||
|
||||
function comment_time($d='') {
|
||||
global $commentdata,$timeformat;
|
||||
global $comment, $timeformat;
|
||||
if ($d == '') {
|
||||
echo mysql2date($timeformat, $commentdata['comment_date']);
|
||||
echo mysql2date($timeformat, $comment->comment_date);
|
||||
} else {
|
||||
echo mysql2date($d, $commentdata['comment_date']);
|
||||
echo mysql2date($d, $comment->comment_date);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1082,7 +1070,7 @@ function comment_time($d='') {
|
|||
|
||||
/***** TrackBack tags *****/
|
||||
|
||||
function trackback_url($display = 1) {
|
||||
function trackback_url($display = true) {
|
||||
global $siteurl, $id;
|
||||
$tb_url = $siteurl.'/b2trackback.php/'.$id;
|
||||
if ($display) {
|
||||
|
@ -1284,12 +1272,12 @@ function permalink_single_rss($file='b2rss.xml') {
|
|||
// @@@ These aren't template tags, do not edit them
|
||||
|
||||
function start_b2() {
|
||||
global $row, $id, $postdata, $authordata, $day, $preview, $page, $pages, $multipage, $more, $numpages;
|
||||
global $post, $id, $postdata, $authordata, $day, $preview, $page, $pages, $multipage, $more, $numpages;
|
||||
global $preview_userid,$preview_date,$preview_content,$preview_title,$preview_category,$preview_notify,$preview_make_clickable,$preview_autobr;
|
||||
global $pagenow;
|
||||
global $HTTP_GET_VARS;
|
||||
if (!$preview) {
|
||||
$id = $row->ID;
|
||||
$id = $post->ID;
|
||||
$postdata=get_postdata2($id);
|
||||
} else {
|
||||
$id = 0;
|
||||
|
|
|
@ -8,11 +8,6 @@
|
|||
// We highly recommend it.
|
||||
// We have modified the HTML it returns slightly.
|
||||
|
||||
define('EZSQL_DB_USER', ""); // <-- mysql db user
|
||||
define('EZSQL_DB_PASSWORD', ""); // <-- mysql db password
|
||||
define('EZSQL_DB_NAME', "mysql"); // <-- mysql db pname
|
||||
define('EZSQL_DB_HOST', 'localhost'); // <-- mysql server host
|
||||
|
||||
define('EZSQL_VERSION', '1.21');
|
||||
define('OBJECT', 'OBJECT', true);
|
||||
define('ARRAY_A', 'ARRAY_A', true);
|
||||
|
@ -399,6 +394,6 @@
|
|||
|
||||
}
|
||||
|
||||
$wpdb = new wpdb(EZSQL_DB_USER, EZSQL_DB_PASSWORD, EZSQL_DB_NAME, EZSQL_DB_HOST);
|
||||
$wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
|
||||
|
||||
?>
|
|
@ -8,7 +8,6 @@ require($abspath.$b2inc.'/b2template.functions.php');
|
|||
include($abspath.$b2inc.'/b2vars.php');
|
||||
include($abspath.$b2inc.'/b2functions.php');
|
||||
|
||||
dbconnect();
|
||||
|
||||
function add_magic_quotes($array) {
|
||||
foreach ($array as $k => $v) {
|
||||
|
@ -73,15 +72,11 @@ $email = addslashes($email);
|
|||
$url = addslashes($url);
|
||||
|
||||
/* flood-protection */
|
||||
$query = "SELECT * FROM $tablecomments WHERE comment_author_IP='$user_ip' ORDER BY comment_date DESC LIMIT 1";
|
||||
$result = mysql_query($query);
|
||||
$lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1");
|
||||
$ok=1;
|
||||
if (!empty($result)) {
|
||||
while($row = mysql_fetch_object($result)) {
|
||||
$then=$row->comment_date;
|
||||
}
|
||||
$time_lastcomment=mysql2date("U","$then");
|
||||
$time_newcomment=mysql2date("U","$now");
|
||||
if (!empty($lasttime)) {
|
||||
$time_lastcomment= mysql2date('U', $lasttime);
|
||||
$time_newcomment= mysql2date('U', "$now");
|
||||
if (($time_newcomment - $time_lastcomment) < 30)
|
||||
$ok=0;
|
||||
}
|
||||
|
@ -89,10 +84,7 @@ if (!empty($result)) {
|
|||
|
||||
if ($ok) {
|
||||
|
||||
$query = "INSERT INTO $tablecomments VALUES ('0','$comment_post_ID','$author','$email','$url','$user_ip','$now','$comment','0')";
|
||||
$result = mysql_query($query);
|
||||
if (!$result)
|
||||
die ("There is an error with the database, it can’t store your comment...<br />Contact the <a href=\"mailto:$admin_email\">webmaster</a>.");
|
||||
$wpdb->query("INSERT INTO $tablecomments VALUES ('0','$comment_post_ID','$author','$email','$url','$user_ip','$now','$comment','0')");
|
||||
|
||||
if ($comments_notify) {
|
||||
|
||||
|
@ -110,7 +102,7 @@ if ($ok) {
|
|||
$recipient = $authordata['user_email'];
|
||||
$subject = "[$blogname] Comment: \"".stripslashes($postdata['Title']).'"';
|
||||
|
||||
@mail($recipient, $subject, $notify_message, "From: \"$comment_author\" <$comment_author_email>\r\n"."X-Mailer: wordpress $b2_version with PHP/".phpversion());
|
||||
@mail($recipient, $subject, $notify_message, "From: \"$comment_author\" <$comment_author_email>\r\n"."X-Mailer: WordPress $b2_version with PHP/".phpversion());
|
||||
|
||||
}
|
||||
|
||||
|
@ -120,12 +112,12 @@ if ($ok) {
|
|||
if ($url == '') {
|
||||
$url = ' '; // this to make sure a cookie is set for 'no url'
|
||||
}
|
||||
setcookie("comment_author", $author, time()+30000000);
|
||||
setcookie("comment_author_email", $email, time()+30000000);
|
||||
setcookie("comment_author_url", $url, time()+30000000);
|
||||
setcookie('comment_author', $author, time()+30000000);
|
||||
setcookie('comment_author_email', $email, time()+30000000);
|
||||
setcookie('comment_author_url', $url, time()+30000000);
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate("D, d M Y H:i:s") . ' GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-cache, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
$location = (!empty($HTTP_POST_VARS['redirect_to'])) ? $HTTP_POST_VARS['redirect_to'] : $HTTP_SERVER_VARS["HTTP_REFERER"];
|
||||
|
|
|
@ -21,10 +21,10 @@ $admin_email = 'you@example.com';
|
|||
|
||||
// ** MySQL settings **
|
||||
|
||||
$dbname = 'b2'; // The name of the database
|
||||
$dbusername = 'user'; // Your MySQL username
|
||||
$dbpassword = 'pass'; // ...and password
|
||||
$dbhost = 'localhost'; // 99% chance you won't need to change this value
|
||||
define('DB_NAME', 'b2'); // The name of the database
|
||||
define('DB_USER', 'user'); // Your MySQL username
|
||||
define('DB_PASSWORD', 'pass'); // ...and password
|
||||
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
|
||||
|
||||
|
||||
// If you've finished up to here you should be able to install now.
|
||||
|
|
|
@ -30,8 +30,6 @@ $b2varstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search
|
|||
}
|
||||
}
|
||||
|
||||
/* Connecting to the db */
|
||||
dbconnect();
|
||||
|
||||
/* Sending HTTP headers */
|
||||
@header ("X-Pingback: $siteurl/xmlrpc.php");
|
||||
|
@ -267,5 +265,5 @@ if ($preview) {
|
|||
}
|
||||
|
||||
//echo $request;
|
||||
$result = mysql_query($request);
|
||||
$posts = $wpdb->get_results($request);
|
||||
?>
|
|
@ -29,7 +29,7 @@ require($abspath.'wp-links/links.weblogs.com.php');
|
|||
<div id="content">
|
||||
|
||||
<!-- // b2 loop start -->
|
||||
<?php while($row = mysql_fetch_object($result)) { start_b2(); ?>
|
||||
<?php foreach ($posts as $post) { start_b2(); ?>
|
||||
|
||||
|
||||
<?php the_date('','<h2>','</h2>'); ?>
|
||||
|
@ -47,8 +47,6 @@ require($abspath.'wp-links/links.weblogs.com.php');
|
|||
<div class="feedback">
|
||||
<?php link_pages('<br />Pages: ', '<br />', 'number'); ?>
|
||||
<?php comments_popup_link('Comments (0)', 'Comments (1)', 'Comments (%)'); ?>
|
||||
<?php trackback_popup_link('TrackBack (0)', 'TrackBack (1)', 'TrackBack (%)'); ?>
|
||||
<?php pingback_popup_link('PingBack (0)', 'PingBack (1)', 'PingBack (%)'); ?>
|
||||
</div>
|
||||
|
||||
<?php trackback_rdf(); ?>
|
||||
|
@ -56,11 +54,6 @@ require($abspath.'wp-links/links.weblogs.com.php');
|
|||
<!-- this includes the comments and a form to add a new comment -->
|
||||
<?php include('b2comments.php'); ?>
|
||||
|
||||
<!-- this includes the trackbacks -->
|
||||
<?php include('b2trackback.php'); ?>
|
||||
|
||||
<!-- this includes the pingbacks -->
|
||||
<?php include('b2pingbacks.php'); ?>
|
||||
|
||||
<!-- // this is just the end of the motor - don't touch that line either :) -->
|
||||
<?php } ?>
|
||||
|
|
Loading…
Reference in New Issue