[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Piet - 19/09/2014
Citation :#~~~~~ DEBUT BLOC A NE PAS SUPPRIMER ~~~~~
#~ Version du CMS: 1.11.10
#~ Url du site : http://invitation-voyage.be/en/guestbook
#~ Hébergeur / Soft : OVH
#~ Informations Système :
#~ ----------------------------------------------
#~ Cms Version: 1.11.10
#~ Installed Modules:
#~ CMSMailer: 5.2.2
#~ CMSPrinting: 1.0.5
#~ FileManager: 1.4.4
#~ MenuManager: 1.8.6
#~ MicroTiny: 1.2.6
#~ ModuleManager: 1.5.5
#~ News: 2.14.2
#~ Search: 1.7.11
#~ ThemeManager: 1.1.8
#~ CGExtensions: 1.42.2
#~ MleCMS: 1.11.4
#~ FormBuilder: 0.7.3
#~ Gbook: 2.0
#~ Showtime: 3.4
#~ SEOTools2: 1.2.1
#~ SiteMapMadeSimple: 1.2.8
#~ CGSmartImage: 1.17
#~ Config Information:
#~ php_memory_limit:
#~ process_whole_template:
#~ max_upload_size: 64000000
#~ url_rewriting: mod_rewrite
#~ page_extension:
#~ query_var: page
#~ image_manipulation_prog: GD
#~ auto_alias_content: true
#~ locale: fr_FR.utf8
#~ default_encoding: utf-8
#~ admin_encoding: utf-8
#~ set_names: true
#~ Php Information:
#~ phpversion: 5.3.28
#~ md5_function: On (Vrai)
#~ gd_version: 2
#~ tempnam_function: On (Vrai)
#~ magic_quotes_runtime: Off (Faux)
#~ E_STRICT: 0
#~ E_DEPRECATED: 8192
#~ memory_limit: 128M
#~ max_execution_time: 120
#~ output_buffering: 4096
#~ safe_mode: Off (Faux)
#~ file_uploads: On (Vrai)
#~ post_max_size: 64M
#~ upload_max_filesize: 64M
#~ session_save_path: /tmp (0700)
#~ session_use_cookies: On (Vrai)
#~ xml_function: On (Vrai)
#~ xmlreader_class: On (Vrai)
#~ Server Information:
#~ Server Api: cgi-fcgi
#~ Server Db Type: MySQL (mysqli)
#~ Server Db Version: 5.1.73
#~ Server Db Grants: Impossible de trouver un privilège "GRANT ALL". Cela peut signifier que vous pourriez avoir des problèmes pour installer ou retirer des modules, ou encore l 'ajout et la suppression d'éléments, y compris les pages.
#~ Server Time Diff: Aucune différence de date du système de fichiers trouvées
#~~~~~ FIN BLOC A NE PAS SUPPRIMER ~~~~~
Bonjour,
J'ai l'erreur suivante sur le module gbook:
Warning: preg_replace() [function.preg-replace]: Unknown modifier '/' in /home/invitati/www/modules/Gbook/lib/class.Gbook_utils.php on line 563
Voir page:
http://invitation-voyage.be/en/guestbook
Comment puis-je solutionner cette erreur?
En vous remerciant pour votre aide !
Cordialement,
Pierre
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
jce76350 - 19/09/2014
>Warning: preg_replace() [function.preg-replace]: Unknown modifier '/' in /home/invitati/www/modules/Gbook/lib/class.Gbook_utils.php on line 563
>Comment puis-je solutionner cette erreur?
Poser la question à l'auteur
ou regarder sa source (Mar '11 #8)
http://www.sitepoint.com/forums/showthread.php?739688-php-bad-word-filtering
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Piet - 20/09/2014
Merci pour la réponse, mais j'ai déjà regardé la source et n’identifie pas l'erreur...
Code :
[== PHP ==]
<?php
#-------------------------------------------------------------------------
# Module: Gbook
# Author: Jos (josvd@live.nl)
#-------------------------------------------------------------------------
# CMS - CMS Made Simple is (c) 2008 by Ted Kulp (wishy@cmsmadesimple.org)
# This project's homepage is: http://www.cmsmadesimple.org
# The module's homepage is: http://dev.cmsmadesimple.org/projects/gbook/
#-------------------------------------------------------------------------
class Gbook_utils
{
protected function __construct() {}
public static function GetGbooks($gbook = '', $filter = true) {
$output = array();
$db = cmsms()->GetDB();
$query = "SELECT
g.*,
COUNT(e.entry_id) AS entries
FROM
" . cms_db_prefix() . "module_gbook g
LEFT JOIN
" . cms_db_prefix() . "module_gbook_entries e
ON
g.gbook_id = e.gbook_id
";
if ( $filter === true )
{
$query .= " AND e.active = 1
";
}
$query .= "WHERE
1 = 1
";
if ( ctype_digit($gbook) )
{
$query .= "AND g.gbook_id = ?
";
}
elseif ( !empty($gbook) )
{
$query .= "AND g.alias = ?
";
}
if ( $filter === true )
{
$query .= "AND g.active = 1
";
}
$query .= "GROUP BY
g.gbook_id";
if ( empty($gbook) )
{
$result = $db->Execute($query);
}
else
{
$result = $db->Execute($query, array($gbook));
}
if ( $result && $result->RecordCount() > 0 )
{
while ( $row=$result->FetchRow() )
{
$output[] = $row;
}
}
if ( !$result )
{
echo 'ERROR: ' . __LINE__ . ' » ' . mysql_error();
exit();
}
return $output;
}
public static function GetEntries($gbook_id, $start = 1, $number = 20, $filter = 'active') {
$start = ($start < 1) ? 0 : $start - 1;
$output = array();
$mod = cms_utils::get_module('Gbook');
$db = cmsms()->GetDB();
$query = "SELECT
e.*, g.allow_smilies
FROM
" . cms_db_prefix() . "module_gbook_entries e,
" . cms_db_prefix() . "module_gbook g
WHERE
e.gbook_id = g.gbook_id
AND e.gbook_id = ?
";
switch ( $filter )
{
case 'active':
$query .= "AND e.active = 1";
break;
case 'inactive':
$query .= "AND e.active = 0";
break;
case 'spam':
self::UpdateSpamrate($gbook_id, $mod->GetPreference('update_spamrate_' . $gbook_id));
$mod->SetPreference('update_spamrate_' . $gbook_id, 0);
$query .= "AND e.spamrate >= " . $db->Qmagic($mod->GetPreference('max_spamrate_active', 0.5) * 100);
break;
}
$query .= "
ORDER BY
create_date DESC";
$result = $db->SelectLimit($query, $number, $start, array($gbook_id)) ;
if ( $result && $result->RecordCount() > 0 )
{
while ( $row=$result->FetchRow() )
{
$onerow = new stdClass();
$onerow->entry_id = $row['entry_id'];
$onerow->gbook_id = $row['gbook_id'];
$onerow->name = cms_htmlentities($row['name']);
$onerow->email = cms_htmlentities($row['email']);
$onerow->title = cms_htmlentities($row['title']);
$onerow->message = self::nl2pnbr(cms_htmlentities($row['message']));
if ( $row['allow_smilies'] )
{
$onerow->message = self::replace_smileys($onerow->message);
}
$badwords = $mod->GetPreference('badwords', '');
if ( !empty($badwords) )
{
$onerow->name = self::filter_badwords($onerow->name);
$onerow->title = self::filter_badwords($onerow->title);
$onerow->message = self::filter_badwords($onerow->message);
}
$onerow->rawmessage = $row['message'];
$onerow->notify = $row['notify'];
$onerow->ip = $row['ip'];
$onerow->create_date = $row['create_date'];
$onerow->modified_date = $row['modified_date'];
$onerow->approved = $row['approved'];
$onerow->approved_date = $row['approved_date'];
$onerow->active = $row['active'];
$onerow->spamrate = 0;
array_push($output, $onerow);
}
}
if ( !$result )
{
echo 'ERROR: ' . __LINE__ . ' » ' . mysql_error();
exit();
}
return $output;
}
public static function GetEntry($entry_id) {
$output = array();
$db = cmsms()->GetDB();
$query = "SELECT
e.*, g.allow_smilies
FROM
" . cms_db_prefix() . "module_gbook_entries e,
" . cms_db_prefix() . "module_gbook g
WHERE
e.gbook_id = g.gbook_id
AND e.entry_id = ?";
$result = $db->Execute($query, array($entry_id));
if ( $result && $result->RecordCount() > 0 )
{
$row = $result->FetchRow();
$onerow = new stdClass();
$onerow->entry_id = $row['entry_id'];
$onerow->gbook_id = $row['gbook_id'];
$onerow->name = cms_htmlentities($row['name']);
$onerow->email = cms_htmlentities($row['email']);
$onerow->title = cms_htmlentities($row['title']);
$onerow->message = self::nl2pnbr(cms_htmlentities($row['message']));
if ( $row['allow_smilies'] )
{
$onerow->message = self::replace_smileys($onerow->message);
}
$mod = cms_utils::get_module('Gbook');
$badwords = $mod->GetPreference('badwords', '');
if ( !empty($badwords) )
{
$onerow->name = self::filter_badwords($onerow->name);
$onerow->title = self::filter_badwords($onerow->title);
$onerow->message = self::filter_badwords($onerow->message);
}
$onerow->rawmessage = $row['message'];
$onerow->notify = $row['notify'];
$onerow->ip = $row['ip'];
$onerow->create_date = $row['create_date'];
$onerow->modified_date = $row['modified_date'];
$onerow->approved = $row['approved'];
$onerow->approved_date = $row['approved_date'];
$onerow->active = $row['active'];
$onerow->spamrate = 0;
$output = $onerow;
}
if ( !$result )
{
echo 'ERROR: ' . __LINE__ . ' » ' . mysql_error();
exit();
}
return $output;
}
public static function AddEntry($gbook_id, $name, $email, $title, $message, $notify = 0) {
$mod = cms_utils::get_module('Gbook');
// get gbook props
$gbooks = self::GetGbooks($gbook_id, true);
if ( empty($gbooks) )
{
$errors[] = $gbook_id;
return array('gbook not found' => $errors);
}
$gbook = $gbooks[0];
// check for double posts
$ip = cms_utils::get_real_ip();
$lastentry = self::GetEntries($gbook_id, 1, 1, false);
if ( $message == $lastentry[0]->rawmessage )
{
$errors[] = $gbook_id;
return array('double post' => $errors);
}
// check if the last entry has the same ip-address
if ( $gbook['prevent_post_twice'] && $lastentry[0]->ip == $ip )
{
$errors[] = $gbook_id;
return array('not allowed to post twice' => $errors);
}
// check for valid input
$required_fields = explode(',', $gbook['required_fields'] . ',message');
$name = strip_tags($name);
$email = strip_tags($email);
$title = strip_tags($title);
if ( in_array('name', $required_fields) && empty($name) ) $errors[] = 'name';
if ( in_array('email', $required_fields) && !is_email($email, false) ) $errors[] = 'email';
if ( in_array('title', $required_fields) && empty($title) ) $errors[] = 'title';
if ( empty($message) ) $errors[] = 'message';
if ( !empty($errors) )
{
return array('field validation errors' => $errors);
}
else
{
$active = 1;
$spamrate = self::b8_exec('Classify', $title . ' ' . $message);
if ( $spamrate > $mod->GetPreference('max_spamrate_active', 0.6) )
{
$active = 0;
}
if ( $spamrate <= $mod->GetPreference('max_spamrate_save', 0.9) )
{
$db = cmsms()->GetDB();
$query = "INSERT INTO " . cms_db_prefix() . "module_gbook_entries
(gbook_id, name, email, title, message, notify, ip, create_date, modified_date, activation_code, active)
VALUES
(?, ?, ?, ?, ?, ?, ?, NOW(), NOW(), ?, ?)";
$result = $db->Execute($query, array(
$gbook_id,
$name,
$email,
$title,
$message,
$notify,
$ip,
'',
$active
));
if ( $result )
{
$insert_id = $db->Insert_ID();
if ( $active == 1 )
{
$params['entry_id'] = $insert_id;
$params['gbook_id'] = $gbook_id;
$params['name'] = $name;
$params['email'] = $email;
$params['title'] = $title;
$params['message'] = $message;
$params['notify'] = $notify;
$params['ip'] = $ip;
$params['active'] = $active;
$mod->SendEvent('Gbook_entry_added', $params);
//Update search index
$search = cms_utils::get_module('Search');
if ( $search != false )
{
$search->AddWords($mod->GetName(), $insert_id, 'entry', $params['title'] . ' ' . $params['message']);
}
}
return array('entry added' => array($insert_id, $spamrate));
}
else
{
$errors[] = $gbook_id;
$errors[] = 'ERROR: ' . __LINE__ . ' » ' . mysql_error();
return array('mysql error' => $errors);
}
}
else
{
$errors[] = $gbook_id;
return array('spam' => $errors);
}
}
}
public static function EditEntry($entry_id, $gbook_id, $name, $email, $title, $message, $notify, $active) {
// only admin, so no need to check for valid input, just strip tags
$name = strip_tags($name);
$email = strip_tags($email);
$title = strip_tags($title);
$db = cmsms()->GetDB();
$query = "UPDATE " . cms_db_prefix() . "module_gbook_entries SET
gbook_id = ?,
name = ?,
email = ?,
title = ?,
message = ?,
notify = ?,
modified_date = NOW(),
active = ?
WHERE
entry_id = ?";
$result = $db->Execute($query, array(
$gbook_id,
$name,
$email,
$title,
$message,
$notify,
$active,
$entry_id
));
if ( $result )
{
$mod = cms_utils::get_module('Gbook');
$params['entry_id'] = $entry_id;
$params['gbook_id'] = $gbook_id;
$params['name'] = $name;
$params['email'] = $email;
$params['title'] = $title;
$params['message'] = $message;
$params['notify'] = $notify;
$params['active'] = $active;
$mod->SendEvent('Gbook_entry_edited', $params);
//Update search index
$search = cms_utils::get_module('Search');
if ( $search != false )
{
if ( $active == 1 )
{
$search->AddWords($mod->GetName(), $entry_id, 'entry', $params['title'] . ' ' . $params['message']);
}
else
{
$search->DeleteWords($mod->GetName(), $entry_id, 'entry');
}
}
return true;
}
else
{
echo 'ERROR: ' . __LINE__ . ' » ' . mysql_error();
exit();
}
}
public static function DeleteEntry($entry_id) {
$db = cmsms()->GetDB();
$query = "DELETE FROM " . cms_db_prefix() . "module_gbook_entries WHERE entry_id = ?";
$result = $db->Execute($query, array($entry_id));
if ( $result )
{
$mod = cms_utils::get_module('Gbook');
$params['entry_id'] = $entry_id;
$params['gbook_id'] = $gbook_id;
$mod->SendEvent('Gbook_entry_deleted', $params);
//Update search index
$search = cms_utils::get_module('Search');
if ( $search != false )
{
$search->DeleteWords($mod->GetName(), $entry_id, 'entry');
}
return true;
}
else
{
echo 'ERROR: ' . __LINE__ . ' » ' . mysql_error();
exit();
}
}
public static function UpdateSpamrate($gbook_id, $updateall) {
$db = cmsms()->GetDB();
$query = "SELECT
entry_id, title, message
FROM
" . cms_db_prefix() . "module_gbook_entries
WHERE
gbook_id = ?
";
if ( $updateall == 0 )
{
$query .= "AND spamrate IS NULL";
}
$query .= "
ORDER BY
create_date DESC";
$result = $db->Execute($query, array($gbook_id)) ;
if ( $result && $result->RecordCount() > 0 )
{
while ( $row=$result->FetchRow() )
{
$spamrate = self::b8_exec('Classify', $row['title'] . ' ' . $row['message']);
$query = "UPDATE " . cms_db_prefix() . "module_gbook_entries SET spamrate = ? WHERE entry_id = ?";
$db->Execute($query, array($spamrate * 100, $row['entry_id']));
}
}
if ( !$result )
{
echo 'ERROR: ' . __LINE__ . ' » ' . mysql_error();
echo '<pre>' . $query . '</pre>';
exit();
}
return true;
}
public static function UpdateAllSpamrates() {
$mod = cms_utils::get_module('Gbook');
$db = cmsms()->GetDB();
$query = "SELECT
gbook_id
FROM
" . cms_db_prefix() . "module_gbook";
$result = $db->Execute($query);
if ( $result && $result->RecordCount() > 0 )
{
while ( $row=$result->FetchRow() )
{
$mod->SetPreference('update_spamrate_' . $row['gbook_id'], 1);
}
}
if ( !$result )
{
echo 'ERROR: ' . __LINE__ . ' » ' . mysql_error();
exit();
}
return true;
}
public static function GetSmileys($filter = true) {
$smileyscache = cms_utils::get_app_data('gbook_smileys_'.$filter);
if ( empty($smileyscache) )
{
$output = array();
$db = cmsms()->GetDB();
$query = "SELECT
*
FROM
" . cms_db_prefix() . "module_gbook_smileys
";
if ( $filter === true )
{
$query .= "WHERE
active = 1";
}
$query .= "
ORDER BY
sort ASC";
$result = $db->Execute($query);
if ( $result && $result->RecordCount() > 0 )
{
while ( $row=$result->FetchRow() )
{
$output[$row['smiley_id']] = $row;
$output[$row['smiley_id']]['smiley_path'] = 'modules/Gbook/smileys/' . $row['smiley_file'];
}
cms_utils::set_app_data('gbook_smileys_'.$filter, serialize($output));
}
if ( !$result )
{
echo 'ERROR: ' . __LINE__ . ' » ' . mysql_error();
exit();
}
}
else
{
$output = unserialize($smileyscache);
}
return $output;
}
public static function replace_smileys($text) {
$smileys = self::GetSmileys(false);
$text = ' ' . $text . ' ';
foreach ( $smileys as $smiley )
{
$text = str_replace(' '.$smiley['smiley_code'].' ', ' <img src="'.$smiley['smiley_path'].'" alt="" /> ', $text);
}
$text = trim(str_replace(' ' , ' ', $text));
return $text;
}
public static function nl2pnbr($text) {
//Taken from http://www.webmasterworld.com/forum88/164.htm
// Use \n for newline on all systems
$text = preg_replace("/(\r\n|\n|\r)/", "\n", $text);
// Only allow two newlines in a row.
$text = preg_replace("/\n\n+/", "\n\n", $text);
// Put <p>..</p> around paragraphs
$text = preg_replace('/\n?(.+?)(\n\n|\z)/s', "<p>$1</p>", $text);
// Convert newlines not preceded by </p> to a <br /> tag
$text = preg_replace('|(?<!</p>)\s*\n|', "<br />", $text);
// Convert urls to links (http://www.phpkode.com/source/p/friendica/friendica-friendica-d2bbd92/include/bbcode.php)
$text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1<a href="$2" rel="nofollow" target="_blank"">$2</a>', $text);
$text = preg_replace("/\[url\]([^\[\]]*)\[\/url\]/ism", '<a href="$1" rel="nofollow" target="_blank">$1</a>', $text);
$text = preg_replace("/\[url\=([^\[\]]*)\](.*?)\[\/url\]/ism", '<a href="$1" rel="nofollow" target="_blank">$2</a>', $text);
// Truncate long urls that can cause display problems (http://www.barattalo.it/2010/03/10/php-parse-url-mailto-and-also-twitters-usernames-and-arguments/)
$text = preg_replace("/>(([[:alnum:]]+:\/\/)|www\.)([^[:space:]]".
"{20,30})([^[:space:]]*)([^[:space:]]{10,20})([[:alnum:]#?\/&=])".
"</", ">\\3...\\5\\6<", $text);
return $text;
}
public static function filter_badwords($text) {
$mod = cms_utils::get_module('Gbook');
$badwords = str_replace(',', '|', $mod->GetPreference('badwords', ''));
if ( !empty($badwords) )
{
// from http://www.sitepoint.com/forums/showthread.php?739688-php-bad-word-filtering
$text = preg_replace( '/\b(?:' . $badwords . ')\b/i', '*****', $text );
}
return $text;
}
public static function b8_exec($action, $text) {
$db = cmsms()->GetDB();
$config = cmsms()->GetConfig();
$config_b8 = array(
'storage' => 'mysql'
);
$config_storage = array(
'database' => $config['db_name'],
'table_name' => cms_db_prefix().'module_gbook_b8_wordlist',
'host' => $config['db_hostname'] . (!empty($config['db_port']) ? ':' . $config['db_port'] : ''),
'user' => $config['db_username'],
'pass' => $config['db_password']
);
# Tell b8 to use the new-style HTML extractor
$config_lexer = array(
'old_get_html' => FALSE,
'get_html' => TRUE
);
# Tell the degenerator to use multibyte operations
# (needs PHP's mbstring module! If you don't have it, set 'multibyte' to FALSE)
$config_degenerator = array(
'multibyte' => TRUE
);
require_once cms_join_path(dirname(__FILE__), 'b8', 'b8.php');
try {
$b8 = new b8($config_b8, $config_storage, $config_lexer, $config_degenerator);
}
catch(Exception $e) {
echo "<b>example:</b> Could not initialize b8.<br />\n";
echo "<b>Error message:</b> ", $e->getMessage();
echo "\n\n</div>\n\n</body>\n\n</html>";
exit();
}
$text = stripslashes($text);
switch($action)
{
case 'Classify':
return $b8->classify($text);
break;
case 'SaveAsSpam':
$b8->learn($text, b8::SPAM);
return true;
break;
case 'SaveAsHam':
return $b8->learn($text, b8::HAM);
//return true;
break;
case 'DeleteFromSpam':
$b8->unlearn($text, b8::SPAM);
return true;
break;
case 'DeleteFromHam':
$b8->unlearn($text, b8::HAM);
return true;
break;
}
return false;
}
public static function format_rating($rating) {
$red = floor(255 * $rating);
$green = floor(255 * (1 - $rating));
return sprintf("%01.2f", $rating) . ' <span style="display:inline-block; width:10px; height:10px; border:1px solid #666; background-color:rgb('.$red.', '.$green.', 0);"><span>';
}
public static function GetUsers()
{
$users = array();
$gCms = cmsms();
$groupops = $gCms->GetGroupOperations();
$allgroups = $groupops->LoadGroups();
foreach ($allgroups as $onegroup)
{
$users[lang('group') . ': ' . $onegroup->name] = $onegroup->id * -1;
}
$userops = $gCms->GetUserOperations();
$allusers = $userops->LoadUsers();
foreach ($allusers as $oneuser)
{
$users[$oneuser->username] = $oneuser->id;
}
return $users;
}
}
?>
Je vais contacter l'auteur... Mais si quelqu'un a une idée, je prends
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Jean le Chauve - 20/09/2014
Essaye ceci :
$text = preg_replace( '/
\\b(?:' . $badwords . ')
\\b/i', '*****', $text );
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Piet - 20/09/2014
Bonjour Maitre...
erreur réparée, mais la suivante est là
Je regarde si il y a une ligne du même genre...
Warning: preg_replace() [function.preg-replace]: Unknown modifier '/' in /home/invitati/www/modules/Gbook/lib/class.Gbook_utils.php on line 1125
Cordialement,
Pierre
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Jean le Chauve - 20/09/2014
Tu as dupliqué ton code :lol:
Le fichier fait 666 lignes, donc le moteur php retrouve la faute à la ligne 563 * 2 -> 1125 (à 1 près
).
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Piet - 20/09/2014
En fait, il s'agit de la ligne modifiée...
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Piet - 20/09/2014
le reste, chez moi, c'est des retours de ligne...
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Piet - 20/09/2014
je peux tenter de désinstaler/réinstaler le module, je verrai...
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Jean le Chauve - 20/09/2014
Juste pour voir, peux-tu essayer ceci (plus propre) et me dire si c'est ok :
$text = preg_replace( "/\b(?:$badwords)\b/i", "*****", $text );
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Piet - 21/09/2014
Pas mieux
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Piet - 21/09/2014
J'ai désactivé la fonction et son appel, et ça marche... C'est donc une bizouille de code ... Aaaargh
Code :
[== Indéfini ==]
/*$badwords = $mod->GetPreference('badwords', '');
if ( !empty($badwords) )
{
$onerow->name = self::filter_badwords($onerow->name);
$onerow->title = self::filter_badwords($onerow->title);
$onerow->message = self::filter_badwords($onerow->message);
}*/
Code :
[== Indéfini ==]
/*public static function filter_badwords($text) {
$mod = cms_utils::get_module('Gbook');
$badwords = str_replace(',', '|', $mod->GetPreference('badwords', ''));
if ( !empty($badwords) )
{
// from http://www.sitepoint.com/forums/showthread.php?739688-php-bad-word-filtering
$text = preg_replace( "/\b(?:$badwords)\b/i", "*****", $text );
}
return $text;
}*/
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Piet - 21/09/2014
OK, je l'ai !
Ma faute... encore :mad:
Dans la liste des mots 'badwords', j'ai mis un ://, ça fait planter le bouzin...
Merci de t'être penché sur mon cas,
Cordialement,
Piet
:lol:
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
jce76350 - 21/09/2014
Ha ..... 1 tournée générale :lol:
[Résolu] GBOOK - Warning: preg_replace() [function.preg-replace] -
Jean le Chauve - 21/09/2014
Profites-en pour donner le bug et ma solution sur la forge
A ta santé et bonne continuation :lol: