- You are here:
- Main › Forum › Bug Tracker
[cBB Blockgets 1.0.3] Bug with title="" inside Recent topics
16 posts
• Page 2 of 2 • 1, 2
- Mathieu M.
- Posts: 45
- Joined: Mon Oct 15, 2012 11:55 am
Tue Nov 27, 2012 2:10 pm • via Web
Oh, it seems that my bug is not caused by cBB Blockgets but by Smixmods Feed News Center... And I think the problem is something here :
Could you please help me to apply a str_replace() function in order to convert " to " ?
Thanks
- Code: Select all
$subject = truncate_string($this->items[$i]['title'], 250);
generate_text_for_storage($subject, $uid, $bitfield, $options, false, false, false);
// TODO remake this ... check if this post/topic is in db ... post if not
// check if this topic is not already posted
$sql = 'SELECT topic_title
FROM ' . TOPICS_TABLE . '
WHERE topic_title = "' . $db->sql_escape($subject) . '"
AND topic_poster = ' . (int) $this->poster_id;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
// Do we have a new item to post ?
if (strnatcasecmp($row['topic_title'], $subject))
{
// templates RSS / ATOM has different indexes for messages
$temp = ( ($this->feed_type == 'rss') || ($this->feed_type == 'rdf') )? 'description' : 'content';
$message = $this->items[$i][$temp]."\n\n".$this->items[$i]['link'];
// post time - not used in version > 0.3.2 (caused bugs with post sorting in topic and quoting)
$post_time = 0;
// ATOM entry->updated
// RSS item->pubDate
// RDF item->dc:date ???
// prepare post data
generate_text_for_storage($message, $uid, $bitfield, $options, true, true, true);
$data = array(
// General Posting Settings
'forum_id' => $this->poster_forum_destination_id,
'topic_id' => 0,//$this->poster_topic_destination_id, // temporarily absolutely disabled
'icon_id' => false,
// Defining Post Options
'enable_bbcode' => true,
'enable_smilies' => true,
'enable_urls' => true,
'enable_sig' => true,
// Message Body
'message' => $message,
'message_md5' => md5($message),
'bbcode_bitfield' => $bitfield,
'bbcode_uid' => $uid,
// Other Options
'post_edit_locked' => 0,
'topic_title' => $subject,
'topic_description' => '',
// Email Notification Settings
'notify_set' => false,
'notify' => false,
'post_time' => 0,
'forum_name' => '',
// Indexing
'enable_indexing' => true, // Allow indexing the post? (bool)
// 3.0.6+
'force_approved_state' => true, // Allow the post to be submitted without going into unapproved queue
);
// submit and approve the post!
submit_post('post', $subject, $user->data['username'], POST_NORMAL, $poll, $data, true, true);
// for development reasons, comment the previous line
}
// change $i to the next (ehm previous :D ) item
$i--;
$j++;
}
Could you please help me to apply a str_replace() function in order to convert " to " ?
Thanks
- IvanPF
- Administrator
- Posts: 2010
- Joined: Fri Jun 17, 2011 12:15 am
- Location: España (Spain)
Tue Nov 27, 2012 9:51 pm • via Web
The following code have not tried it, but I think you will serve.
Simply apply the same thing applies to all values that phpBB retrieved using the "request_var" function.
In the code, find:
Add after:
Find:
Replace with:
Try it and tell me if this resolve the problem
Simply apply the same thing applies to all values that phpBB retrieved using the "request_var" function.
In the code, find:
- Code: Select all
$subject = truncate_string($this->items[$i]['title'], 250);
Add after:
- Code: Select all
set_var($subject, $subject, 'string', true);
Find:
- Code: Select all
$message = $this->items[$i][$temp]."\n\n".$this->items[$i]['link'];
Replace with:
- Code: Select all
set_var($message, $message, 'string', true);
Try it and tell me if this resolve the problem
- Mathieu M.
- Posts: 45
- Joined: Mon Oct 15, 2012 11:55 am
Wed Nov 28, 2012 3:13 pm • via Web
With your code, the title seems to be OK, but the Mod doesn't import content ($message ?) for now... I think it's a problem with :
Isn't it ?
Thanks
Admin wrote:Find:
- Code: Select all
$message = $this->items[$i][$temp]."\n\n".$this->items[$i]['link'];
Replace with:
- Code: Select all
set_var($message, $message, 'string', true);
Isn't it ?
Thanks
- IvanPF
- Administrator
- Posts: 2010
- Joined: Fri Jun 17, 2011 12:15 am
- Location: España (Spain)
Wed Nov 28, 2012 3:18 pm • via Android
Opps my fault.
Isn't "replace with", is "add after"
Isn't "replace with", is "add after"
- Mathieu M.
- Posts: 45
- Joined: Mon Oct 15, 2012 11:55 am
Wed Nov 28, 2012 7:08 pm • via Web
Now, it imports correctly the content but it doesn't convert HTML tags to BBcodes (it did the job before).
Before in smixmods_feed_news_center.class.php, we have this code (if it can help you) :
Before in smixmods_feed_news_center.class.php, we have this code (if it can help you) :
- Code: Select all
/**
* HTML to BBCode replacement
*
* @param string $string
* @return string
*/
private function html_to_bbcode($string)
{
$htmltags = array(
"/\<b\>(.*?)\<\/b\>/is",
"/\<i\>(.*?)\<\/i\>/is",
"/\<u\>(.*?)\<\/u\>/is",
"/\<ul\>(.*?)\<\/ul\>/is",
"/\<li\>(.*?)\<\/li\>/is",
"/\<img(.*?) src=\"(.*?)\" (.*?)\>/is",
"/\<div\>(.*?)\<\/div\>/is",
"/\<br(.*?)\>/is",
"/\<strong\>(.*?)\<\/strong\>/is",
"/\<a href=\"(.*?)\"(.*?)\>(.*?)\<\/a\>/is",
);
// Replace with
$bbtags = array(
"[b]$1[/b]",
"[i]$1[/i]",
"[u]$1[/u]",
"[list]$1[/list]",
"[*]$1",
"[img]$2[/img]",
"$1",
"\n",
"[b]$1[/b]",
"[url=$1]$3[/url]",
);
// Replace $htmltags in $text with $bbtags
$string = preg_replace($htmltags, $bbtags, $string);
// Strip all other HTML tags
$string = strip_tags($string);
return $string;
}
- Mathieu M.
- Posts: 45
- Joined: Mon Oct 15, 2012 11:55 am
Thu Dec 06, 2012 5:31 pm • via Web
A small up
With the last modification, news are imported correctly but every HTML tags is showed, for example :
The <p> tag isn't convert and " must be " no ?
With the last modification, news are imported correctly but every HTML tags is showed, for example :
A topic that was imported wrote:<p>Rafael Nadal, attendu fin décembre à Abu Dhabi pour participer à un tournoi exhibition qui marquera son grand retour après six mois passés loin du circuit, a donné de ses nouvelles mardi soir sur les ondes de la radio espagnole ABC. Le Majorquin a notamment fait savoir qu'il ne pensait pas pouvoir accomplir des miracles en début d'année prochaine. "Je ne m'attends pas à revenir et à gagner l'Open d'Australie, je dois être réaliste, a déclaré le septuple vainqueur de Roland-Garros. Je dois tenir compte de ma forme. Cela ne me dérange pas si je glisse à la 15e place mondiale aussi longtemps que je sais que je peux continuer à jouer." Objectif de l'Espagnol : "Être à 100% pour Monte-Carlo (du 15 au 21 avril) et l'approche de Roland-Garros."</p>
The <p> tag isn't convert and " must be " no ?
16 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 0 guests
- External Links
- phpBB Official
- phpBB Official (Spanish)
- Raul Arroyo Monzo
- PasionReef
- About CaniDev
- Terms of use
- Privacy Policy
- About Us
- Contact
- © 2011-2024 CaniDev