dopetalk

Technology => SMF Forum Code Modifications => Topic started by: Chip on August 17, 2015, 05:34:17 PM

Title: SA Chat
Post by: Chip on August 17, 2015, 05:34:17 PM
http://custom.simplemachines.org/mods/index.php?mod=2534

Please note that I am using the earlier version as I find it more reliable - there is a later version (REV120)  if you wish to try it but it requires changes to accomodate 2.0.16 and above.

EDIT: copy the sachat/cache directory to any backup system for it to work correctly or start afresh with an empty cache file.

NOTE: PrettyURLs (not desired or installed here) messes up .htaccess and stops SA Chat from working.
Title: Re: SA Chat
Post by: Chip on October 30, 2019, 03:36:31 AM
Now available to all.

Chat logs are retained for a period of time and then purged.

You will be audited randomly so be smart and cautious.

Clearing/closing of persistent chat windows is by clearing cache/cookies (which will log you out of most sites)
Title: Re: SA Chat
Post by: Chip on February 11, 2020, 08:56:30 PM
Not compatible with SMF 2.0.16 and 2.0.17.

Maybe we can patch it accordingly as per these observations (https://www.simplemachines.org/community/index.php?topic=391961.msg4045817#msg4045817)
Title: Re: SA Chat
Post by: Chip on February 21, 2020, 10:24:45 AM
Since the new version (REV120) is not as reliable as the old version for me so this is how to upgrade the old revision (SAChatBar-0.1.5 Rev110) to 2.0.16 -> 17 partially borrowed from SMF's Diego AndrĂ©s here (https://www.simplemachines.org/community/index.php?topic=391961.msg4046455#msg4046455)   

Locate: ./sachat/index.php
Code: [Select]
//SMF Cookie autentication!!!
list ($member_id, $password) = initCookies();

Replace:
Code: [Select]
//SMF Cookie autentication!!!
$member_id = initCookies();

Locate:
Code: [Select]
        // Lets validate the password, anyone can put a number in a cookie, lets see if the password checks out.
        if (isset($user_settings['passwd']) && strlen($password) != 40 || isset($user_settings['passwd']) && sha1($user_settings['passwd'] . $user_settings['password_salt']) != $password) {
                $context['JSON']['STATUS'] = 'AUTH FAILED';
                doOutput();
        } else {
                $context['JSON']['STATUS'] = 'ACTIVE';
        }

Replace:
Code: [Select]
        // No need to validate the password since 2.0.16
        $context['JSON']['STATUS'] = 'ACTIVE';

Locate: ./sachat/functions.php
Code: [Select]
function initCookies() {
global $cookiename;

if (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;(i:\d{1,6}|s:[1-8]:"\d{1,8}");i:1;s:(0|40):"([a-fA-F0-9]{40})?";i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~i', $_COOKIE[$cookiename]) == 1) {
list ($member_id, $password) = @unserialize($_COOKIE[$cookiename]);
$member_id = !empty($member_id) && strlen($password) > 0 ? (int) $member_id : 0;

return array($member_id, $password);
} elseif (isset($_COOKIE[$cookiename])) {
list ($member_id, $password) = @unserialize(stripslashes($_COOKIE[$cookiename]));
$member_id = !empty($member_id) && strlen($password) > 0 ? (int) $member_id : 0;

return array($member_id, $password);
}
}

Replace:
Code: [Select]
function initCookies() {
global $cookiename;

if (isset($_COOKIE[$cookiename]) && preg_match('~^a:[34]:\{i:0;(i:\d{1,6}|s:[1-8]:"\d{1,8}");i:1;s:(0|40):"([a-fA-F0-9]{40})?";i:2;[id]:\d{1,14};(i:3;i:\d;)?\}$~i', $_COOKIE[$cookiename]) == 1) {
list ($id_member, $password) = @unserialize($_COOKIE[$cookiename]);
$id_member = !empty($id_member) && strlen($password) > 0 ? (int) $id_member : 0;

return $id_member;
} elseif (isset($_COOKIE[$cookiename])) {
list ($id_member, $password, $login_span) = @unserialize($_SESSION['login_' . $cookiename]);
$id_member = !empty($id_member) && strlen($password) > 0 ? (int) $id_member : 0;

return $id_member;
}
}



Note: the first attachment contains the changes above
SimplePortal 2.3.6 © 2008-2014, SimplePortal