Hola, estoy intentando integrar CometChat (versión vieja) con Laravel 5.8, pero no estoy pudiendo, solo encuentro información con versiones viejas de Laravel.
Pero han cambiado bastante.
Alguien lo ha logrado?
De momento logre esto:
Código PHP:
$base_path = dirname(dirname(dirname(_FILE_)));
include_once($base_path.'\vendor\autoload.php');
$laravel_db_config_file = $base_path . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'database.php';
if (!file_exists($laravel_db_config_file))
{
echo "Please make sure you have the Cometchat folder in the public folder of your laravel site";
}
$app = include_once($base_path.'\bootstrap\app.php');
$config = include_once($laravel_db_config_file);
$dbl = $config['connections']['mysql'];
Esto en el integrate.php
Lo que no entiendo es como hacer esta parte de aca:
Código PHP:
function getUserID() {
$userid = 0;
if (!empty($_SESSION['basedata']) && $_SESSION['basedata'] != 'null') {
$_REQUEST['basedata'] = $_SESSION['basedata'];
}
if (!empty($_REQUEST['basedata'])) {
if (function_exists('mcrypt_encrypt') && defined('ENCRYPT_USERID') && ENCRYPT_USERID == '1') {
$key = "";
if( defined('KEY_A') && defined('KEY_B') && defined('KEY_C') ){
$key = KEY_A.KEY_B.KEY_C;
}
$uid = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode(rawurldecode($_REQUEST['basedata'])), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
if (intval($uid) > 0) {
$userid = $uid;
}
} else {
$userid = $_REQUEST['basedata'];
}
}
if (!empty($_COOKIE['laravel_session'])) {
$app = app();
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
$response = $kernel->handle(
$request = IlluminateHttpRequest::capture()
);
$id = $app['encrypter']->decrypt($_COOKIE[$app['config']['session.cookie']]);
$app['session']->driver()->setId($id);
$app['session']->driver()->start();
if($app['auth']->user()!= NULL || !empty($app['auth']->user())){
$user_details = $app['auth']->user();
$userid = $user_details['user_id'];
}
}
$userid = intval($userid);
// start custom wdp
if (!empty($_SESSION['userid'])) {
$userid = $_SESSION['userid'];
}
// end custom wdp
return $userid;
}
Teniendo el Guest activo del cometchat.. funciona (en guest) al registrarse... aparece el nuevo miembro en el chat con el email y todo pero se desconecta a los segundos y sigues con el guest.