cBB Chat v1.0.1 + phpbb 3.0.14 + php7 = preg_replace


no_avatar
werdsa
 
Posts: 4
Joined: Sun Jul 21, 2019 6:25 pm
 Sun Jul 21, 2019 6:33 pm • via Web
Please help to fix:
cBB Chat v1.0.1
phpbb 3.0.14
php7

/includes/acp/acp_chat.php
row 884
preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
no_avatar
werdsa
 
Posts: 4
Joined: Sun Jul 21, 2019 6:25 pm
 Sun Jul 21, 2019 6:43 pm • via Web
and the "Delete" buttons in the control panel do not work. (not work and on test forum and on real). Please help
http://demo.canidev.com/phpbb/adm/index.php?lang=en
(Manage rooms and Manage texts and rules)
User avatar
IvanPF
Administrator
 
Posts: 2010
Joined: Fri Jun 17, 2011 12:15 am
Location: España (Spain)
 Sun Jul 21, 2019 9:36 pm • via Web
Hi,

I can tell you how to solve the error of preg_replace but, that same error is also giving you by phpBB (although do not show it to you with the naked eye). The reason is that phpBB 3.0.14 is not compatible with php 7. With a forum phpBB 3.0.x you should use php 5.6 if your hosting allows you to change it.

For the problem with "delete" buttons, do this change:
1. Open /chat/includes/functions_chat.php
2. Find:
Code: Select all
if($this->enabled && isset($_POST['icajx']))

3. Replace with:
Code: Select all
if(!defined('ADMIN_START') && !empty($_POST['icajx']))
no_avatar
werdsa
 
Posts: 4
Joined: Sun Jul 21, 2019 6:25 pm
 Mon Jul 22, 2019 6:24 pm • via Web
Thanks so much. The problem with the "Delete" button is solved.
If it is not difficult for you, help to resolve an issue with preg_replace.
I have made a lot of changes in phpbb 3.0 to work with php 7 on the instructions: https://forum.dion-designs.com/t9154/ma ... th-php-70/
If the problem with cb chat is solved, it will be very good. Thank you in advance.
User avatar
IvanPF
Administrator
 
Posts: 2010
Joined: Fri Jun 17, 2011 12:15 am
Location: España (Spain)
 Mon Jul 22, 2019 11:13 pm • via Web
Ok, for compatibility with php 7 try with this changes:
1. Open /chat/includes/functions_chat.php
2. Find (line 469):
Code: Select all
$text = preg_replace('#\{L_([A-Z0-9_\-]+)\}#e', "isset(\$user->lang['\$1']) ? \$user->lang['\$1'] : '\$1'", $text);

3. Replace with:
Code: Select all
               $text = preg_replace_callback(
                  '#\{L_([A-Z0-9_\-]+)\}#',
                  function($matches) use ($user) {
                     $key = $matches[1];
                     return isset($user->lang[$key]) ? $user->lang[$key] : $key;
                  },
                  $text
               );


4. Open /includes/acp/acp_chat.php
5. Find (line 884):
Code: Select all
$row['text_content'] = preg_replace('#\{L_([A-Z0-9_\-]+)\}#e', "isset(\$user->lang['\$1']) ? \$user->lang['\$1'] : '\$1'", $row['text_content']);

6. Replace with:
Code: Select all
               $row['text_content'] = preg_replace_callback(
                  '#\{L_([A-Z0-9_\-]+)\}#',
                  function($matches) use ($user) {
                     $key = $matches[1];
                     return isset($user->lang[$key]) ? $user->lang[$key] : $key;
                  },
                  $row['text_content']
               );
no_avatar
werdsa
 
Posts: 4
Joined: Sun Jul 21, 2019 6:25 pm
 Thu Jul 25, 2019 6:51 pm • via Web
Thank you for your work.
Last question) is it Possible to disable the default room?
User avatar
IvanPF
Administrator
 
Posts: 2010
Joined: Fri Jun 17, 2011 12:15 am
Location: España (Spain)
 Thu Jul 25, 2019 7:53 pm • via Web
No, That room cannot be removed or disabled.

Who is online

Users browsing this forum: No registered users and 0 guests