Advertisement:

Author Topic: SA Chat  (Read 537520 times)

Online Diego Andrés

  • Customizer
  • SMF Hero
  • *
  • Posts: 3,771
  • Gender: Male
    • DiegoAndresCortes on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: SA Chat
« Reply #1820 on: February 11, 2020, 05:54:26 PM »
So don't really know what I'm doing but to my understanding I couldn't find another instance or usage of $password in the index.php so I did the following

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

Code: (sachat/Sources/Subs.php) [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);
}
}
Code: (replace) [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;
}
}

And seems to be working on SMF 2.0.17

If anyone else with more knowledge about this can give the mod a look would be great and appreciated.  :laugh:



Also

Code: (sachat/Sources/User.php) [Select]
$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : null);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : null);
}
Code: (replace) [Select]
$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : []);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : []);
}
« Last Edit: February 11, 2020, 06:05:39 PM by Diego Andrés »

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,631
  • Gender: Male
  • the "mods and tweaks" junkie
    • aegersz on GitHub
    • dopetalk (drugs and users)
Re: SA Chat
« Reply #1821 on: February 11, 2020, 06:55:45 PM »
will give it a try later, thanks !
The configuration of my Linux VPS (SMF 2.0 with 150 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,631
  • Gender: Male
  • the "mods and tweaks" junkie
    • aegersz on GitHub
    • dopetalk (drugs and users)
Re: SA Chat
« Reply #1822 on: February 11, 2020, 07:06:31 PM »
There is no sachat/Sources directory so i am totally lost.


So don't really know what I'm doing but to my understanding I couldn't find another instance or usage of $password in the index.php so I did the following

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

Code: (sachat/Sources/Subs.php) [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);
}
}
Code: (replace) [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;
}
}

And seems to be working on SMF 2.0.17

If anyone else with more knowledge about this can give the mod a look would be great and appreciated.  :laugh:



Also

Code: (sachat/Sources/User.php) [Select]
$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : null);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : null);
}
Code: (replace) [Select]
$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : []);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : []);
}
The configuration of my Linux VPS (SMF 2.0 with 150 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Online Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 60,107
  • Gender: Male
    • Kindred-999 on GitHub
Re: SA Chat
« Reply #1823 on: February 11, 2020, 07:13:34 PM »
Sources/SAchat...
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,631
  • Gender: Male
  • the "mods and tweaks" junkie
    • aegersz on GitHub
    • dopetalk (drugs and users)
Re: SA Chat
« Reply #1824 on: February 11, 2020, 07:35:26 PM »
Sources/SAchat...

Nope, doesn't exist
The configuration of my Linux VPS (SMF 2.0 with 150 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Online Diego Andrés

  • Customizer
  • SMF Hero
  • *
  • Posts: 3,771
  • Gender: Male
    • DiegoAndresCortes on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: SA Chat
« Reply #1825 on: February 11, 2020, 07:38:16 PM »
It's in the root directory of the forum  :o

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,631
  • Gender: Male
  • the "mods and tweaks" junkie
    • aegersz on GitHub
    • dopetalk (drugs and users)
Re: SA Chat
« Reply #1826 on: February 11, 2020, 07:44:02 PM »
It's in the root directory of the forum  :o

Not on mine. I have no idea where that is other than the SMF Subs.php in Sources and User.php doesn't exist anywhere !
« Last Edit: February 11, 2020, 07:56:46 PM by aegersz »
The configuration of my Linux VPS (SMF 2.0 with 150 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline Antechinus

  • SMF Friend
  • SMF Master
  • *
  • Posts: 25,651
  • Master of BBC Abuse
Re: SA Chat
« Reply #1827 on: February 11, 2020, 08:55:43 PM »
Umm, this might be your problem. :)

Online Diego Andrés

  • Customizer
  • SMF Hero
  • *
  • Posts: 3,771
  • Gender: Male
    • DiegoAndresCortes on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: SA Chat
« Reply #1828 on: February 11, 2020, 09:27:05 PM »
I think you might not have the 1.0a1 version installed which seems to be the latest one according to the mod page  ;D
The cookie changes can be done in the functions.php file for that version that you are using, but I'd recommend using the latest one? Who knows how old the 0.1.5 version is  :o

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,631
  • Gender: Male
  • the "mods and tweaks" junkie
    • aegersz on GitHub
    • dopetalk (drugs and users)
Re: SA Chat
« Reply #1829 on: February 13, 2020, 07:59:50 PM »
I have version 0.1.5 Rev110  installed.

I installed the newest version and your changes but no luck. Looks like I'm doomed top sit on 0.15 for the interim.
« Last Edit: February 13, 2020, 08:19:40 PM by aegersz »
The configuration of my Linux VPS (SMF 2.0 with 150 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline Rock Lee

  • Native Language Support Specialist
  • SMF Hero
  • *
  • Posts: 3,873
  • Gender: Male
  • Learning more every day!
    • BomberCode.Oficial on Facebook
    • RockLee-BC on GitHub
    • @Bomber_Code on Twitter
    • Bomber Code ~ La nueva era del conocimiento
Re: SA Chat
« Reply #1830 on: February 13, 2020, 09:18:12 PM »
I have version 0.1.5 Rev110  installed.

I installed the newest version and your changes but no luck. Looks like I'm doomed top sit on 0.15 for the interim.

I downloaded the latest version of the modification to apply the changes to the installer and then install, it worked without problems with the suggested changes. That is, download version 1.0a1 Rev120 unzipped it to find the files to be edited, compressed it again to proceed to install and it worked in my test version that I am running 2.0.17.


Regards!
¡Regresando como cual Fenix! ~ Bomber Code © 2020
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,631
  • Gender: Male
  • the "mods and tweaks" junkie
    • aegersz on GitHub
    • dopetalk (drugs and users)
Re: SA Chat
« Reply #1831 on: February 13, 2020, 09:19:35 PM »
I have version 0.1.5 Rev110  installed.

Interestingly, the new version of SA Chat failed even before any 2.0.16 changes were applied.

I installed the newest version and your changes but no luck. Looks like I'm doomed top sit on 0.15 for the interim.
The configuration of my Linux VPS (SMF 2.0 with 150 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,631
  • Gender: Male
  • the "mods and tweaks" junkie
    • aegersz on GitHub
    • dopetalk (drugs and users)
Re: SA Chat
« Reply #1832 on: February 13, 2020, 09:43:32 PM »
I have other issues by the looks of it - the other version (Rev120) doesn't work on my 2.0.15 either.

Anyhow, thanks for your help.

EDIT: After all the changes, I had to remove the Live Clock mod and then it started working ! Thanks for your help.
« Last Edit: February 13, 2020, 10:08:41 PM by aegersz »
The configuration of my Linux VPS (SMF 2.0 with 150 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline kesulin

  • Semi-Newbie
  • *
  • Posts: 50
Re: SA Chat
« Reply #1833 on: February 14, 2020, 02:51:38 AM »
So don't really know what I'm doing but to my understanding I couldn't find another instance or usage of $password in the index.php so I did the following

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

Code: (sachat/Sources/Subs.php) [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);
}
}
Code: (replace) [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;
}
}

And seems to be working on SMF 2.0.17

If anyone else with more knowledge about this can give the mod a look would be great and appreciated.  :laugh:



Also

Code: (sachat/Sources/User.php) [Select]
$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : null);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : null);
}
Code: (replace) [Select]
$context['online_count'] = count(isset($context['friends']) ? $context['friends'] : []);
}
if ($type == 'list') {
$data = buddy_list_template();
return $data;
}
if ($type == 'count') {
return count(isset($context['friends']) ? $context['friends'] : []);
}
¡works great!¡fantastic work!

thanks very much  :-*

Offline Sir Osis of Liver

  • SMF Super Hero
  • *******
  • Posts: 10,827
  • We were all equal in the end.
Re: SA Chat
« Reply #1834 on: February 16, 2020, 12:28:05 AM »
I've had this working on a forum in 2.0.15, but it disappears in .16/.17.  Can it be fixed?
“The best laid schemes o' mice an' men / Gang aft a-gley.” - Robert Burns

Offline Rock Lee

  • Native Language Support Specialist
  • SMF Hero
  • *
  • Posts: 3,873
  • Gender: Male
  • Learning more every day!
    • BomberCode.Oficial on Facebook
    • RockLee-BC on GitHub
    • @Bomber_Code on Twitter
    • Bomber Code ~ La nueva era del conocimiento
Re: SA Chat
« Reply #1835 on: February 16, 2020, 10:31:39 AM »
I've had this working on a forum in 2.0.15, but it disappears in .16/.17.  Can it be fixed?

Did you try the solution I leave @Diego Andrés? I tried it and it worked!


Regards!
¡Regresando como cual Fenix! ~ Bomber Code © 2020
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Offline Sir Osis of Liver

  • SMF Super Hero
  • *******
  • Posts: 10,827
  • We were all equal in the end.
Re: SA Chat
« Reply #1836 on: February 20, 2020, 04:41:40 PM »
Finally got around to this.  Modded SA Chat code as per -

https://www.simplemachines.org/community/index.php?topic=391961.msg4046455#msg4046455

Works in 2.0.17.  Thanks.
“The best laid schemes o' mice an' men / Gang aft a-gley.” - Robert Burns

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,631
  • Gender: Male
  • the "mods and tweaks" junkie
    • aegersz on GitHub
    • dopetalk (drugs and users)
Re: SA Chat
« Reply #1837 on: February 20, 2020, 05:51:54 PM »
The new version (even prior to any 2.0.16/17) does not show the correct number of online users.

Does anyone else have this problem ?

if i can get REV120 working correctly then I can't upgrade.

Can anybody help ?
The configuration of my Linux VPS (SMF 2.0 with 150 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline Sir Osis of Liver

  • SMF Super Hero
  • *******
  • Posts: 10,827
  • We were all equal in the end.
Re: SA Chat
« Reply #1838 on: February 20, 2020, 05:57:32 PM »
Did the code edits posted above to 1.0a Rev120, upgraded 2.0.15 -> 2.0.17, and it seems to be working correctly.  Not a very busy forum, only myself and one other member active, but it's showing the one member.
“The best laid schemes o' mice an' men / Gang aft a-gley.” - Robert Burns

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,631
  • Gender: Male
  • the "mods and tweaks" junkie
    • aegersz on GitHub
    • dopetalk (drugs and users)
Re: SA Chat
« Reply #1839 on: February 20, 2020, 06:28:09 PM »
in my dev system, i have 3 active online members and only one member shows the other 2.

Can you please try a third test user or something to see how if behaves ?
The configuration of my Linux VPS (SMF 2.0 with 150 mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here