 |
boardom b2 message board
|
View previous topic :: View next topic |
Author |
Message |
kristal
Joined: 27 Jun 2002 Posts: 17
|
Posted: Mon Aug 25, 2003 2:33 am Post subject: |
|
|
thank you Dodo! it works perfectly now :) |
|
Back to top |
|
 |
Sansnom
Joined: 31 Jan 2002 Posts: 94 Location: Paris
|
Posted: Wed Jan 28, 2004 5:09 pm Post subject: |
|
|
Please, help me. I'm not a php master. I have installed this hack and at the comment link place, I obtain :
Code: | SQL query: SELECT * FROM b2comments WHERE comment_post_ID = 1178 AND comment_content != ''
MySQL Error: Lost connection to MySQL server during query |
after a very very slow loading. I have check everything several times and I have done everything like it is explain. So I'm lost.
http://www.sansfin.com _________________ http://www.sansfin.com |
|
Back to top |
|
 |
Sansnom
Joined: 31 Jan 2002 Posts: 94 Location: Paris
|
Posted: Wed Jan 28, 2004 5:21 pm Post subject: |
|
|
Here is the fonction get_the_content in my template.functions.php
Code: | function get_the_content($more_link_text='lire la suite >>', $stripteaser=0, $more_file='') {
global $id,$postdata,$more,$c,$withcomments,$page,$pages,$multipage,$numpages;
global $HTTP_SERVER_VARS, $preview;
global $querystring_start, $querystring_equal, $querystring_separator;
global $pagenow;
$output = '';
if ($more_file != '') {
$file=$more_file;
} else {
$file=$pagenow; //$HTTP_SERVER_VARS['PHP_SELF'];
}
$content=$pages[$page-1];
/* highlight searched words
if (isset($s)&&$s!="") {
$searchwords = explode(" ", $s);
for($i = 0; $i <= count($searchwords); $i++) {
$content = getHTMLHighlight($searchwords[$i], $content, "<span class=\"searchword\">", "</span>");
}
}
fin */
$content=explode('<!--more-->', $content);
if ((preg_match('/<!--noteaser-->/', $postdata['Content']) && ((!$multipage) || ($page==1))))
$stripteaser=1;
$teaser=$content[0];
if (($more) && ($stripteaser))
$teaser='';
$output .= $teaser;
// hack lire la suite
if(count($content) == 2) {
if ($more) {
$output .= $content[1];
} else {
if(strstr($content[1], "<!--endmore-->")) {
$tail = explode("<!--endmore-->", $content[1]);
$output .= " <span id=\"varP$id\"><br /><a href=\"$file#$id\" onclick=\"showMore($id,'$file#$id');return false;\" target=\"_self\">read more »</a></span><div id=\"varXYZ$id\" style=\"display: none\">$tail[0]<a href=\"#$id\" onclick=\"showMore($id,0);return true;\" target=\"_self\">« hide more</a></div>";
$output .= $tail[1];
} else {
$output .= " <span id=\"varP$id\"><br /><a href=\"$file#$id\" onclick=\"showMore($id,'$file#$id');return false;\" target=\"_self\">read more »</a></span><div id=\"varXYZ$id\" style=\"display: none\">$content[1]<br /><a href=\"#$id\" onclick=\"showMore($id,0);return true;\" target=\"_self\">« hide more</a></div>";
}
}
}
elseif (count($content)>2) {
$k = $id;
for($i = 1; $i <= count($content); $i++) {
$k = $k + 10000000;
if(strstr($content[$i], "<!--endmore-->")) {
$tail = explode("<!--endmore-->", $content[$i]);
$output .= "<span id=\"varP$k\"><br /><a href=\"$file#$k\" onclick=\"showMore($k,'$file#$k');return false;\" target=\"_self\">read more »</a></span><div id=\"varXYZ$k\" style=\"display: none\">$tail[0]<br /><a href=\"#$id\" onclick=\"showMore($k,0);return true;\" target=\"_self\">« hide more</a></div>";
$output .= $tail[1];
} else {
$output .= $content[$i];
}
}
}
// fin
if ($preview) { // preview fix for javascript bug with foreign languages
$output = preg_replace('/\%u([0-9A-F]{4,4})/e', "''.base_convert('\\1',16,10).';'", $output);
}
return($output);
} |
And here are the other functions involved :
Code: | // original hack by [email protected]
function comments_number($zero='no comment', $one='1 comment', $more='% comments') {
global $id,$postdata,$tablecomments,$c,$querycount,$cache_commentsnumber,$use_cache;
$number = generic_ctp_number($id, 'comments');
if ($number == 0) {
$blah = $zero;
} elseif ($number == 1) {
echo ("<IMG SRC=http://www.sansfin.com/images/d_plus.gif border=0><span class=noirfin> </span>");
$blah = $one;
} elseif ($number > 1) {
$n = $number;
$more=str_replace('%', $n, $more);
echo ("<IMG SRC=http://www.sansfin.com/images/d_plus.gif border=0><span class=noirfin> </span>");
$blah = $more;
}
echo $blah;
}
function comments_link($file='') {
global $id,$pagenow;
global $querystring_start, $querystring_equal, $querystring_separator;
if ($file == '') $file = $pagenow;
if ($file == '/') $file = '';
echo $file.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1#comments';
}
function comments_popup_script($width=470, $height=660, $file='b2commentspopup.php', $trackbackfile='b2trackbackpopup.php', $pingbackfile='b2pingbackspopup.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,left=528,top=10,scrollbars=yes,status=yes');\n}\n//-->\n</script>\n";
echo $javascript;
}
function comments_popup_link($zero='no comment', $one='1 comment', $more='% comments', $CSSclass='') {
global $id, $b2commentspopupfile, $b2commentsjavascript;
global $querystring_start, $querystring_equal, $querystring_separator, $siteurl;
echo '<a href="'.$siteurl.'/';
if ($b2commentsjavascript) {
echo $b2commentspopupfile.$querystring_start.'p'.$querystring_equal.$id.$querystring_separator.'c'.$querystring_equal.'1#comments';
echo '" onclick="b2open(this.href); return false"';
} else {
// if comments_popup_script() is not in the template, display simple comment link
comments_link();
echo '"';
}
if (!empty($CSSclass)) {
echo ' class="'.$CSSclass.'"';
}
echo ' class=addition>';
comments_number($zero, $one, $more);
echo '</a>';
} |
Is anybody see something wrong ? _________________ http://www.sansfin.com |
|
Back to top |
|
 |
Sansnom
Joined: 31 Jan 2002 Posts: 94 Location: Paris
|
Posted: Wed Jan 28, 2004 6:17 pm Post subject: |
|
|
It seems the hack is in conflict with this function :
Code: | 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 AND comment_content != ''";
$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];
} |
... _________________ http://www.sansfin.com |
|
Back to top |
|
 |
Sansnom
Joined: 31 Jan 2002 Posts: 94 Location: Paris
|
Posted: Wed Jan 28, 2004 11:55 pm Post subject: |
|
|
I'm shame It works. I have put the post_content row to longtext in thedb and it makes all crash. It is still un problem because I can't post very long texts but it isn't the hack.
You have write :
Code: | i found a bug in the javascript. change "block" in there to "inline" in the javascript file. |
But I don't know what it mean. Could you light me ? I promess to go to Saturn after
Thankx
S _________________ http://www.sansfin.com |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB 2 © 2001, 2002 phpBB Group
|