4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: universal on April 21, 2005, 03:27:35 PM

Title: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
Post by: universal on April 21, 2005, 03:27:35 PM
Quote
<tr>
    <td width="35%" align="right"><b>{lang_icq}</b></td>
    <td>{if user_icq}<a href="http://wwp.icq.com/scripts/search.dll?to={user_icq}">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
</tr>

Why I never saw (<b>{user_icq_status}</b>) thing working? And how to fix it? I`m talking about member_profile.html

You can try to look at this here: http://www.pramoga.net/member.php?action=showprofile&user_id=1
Title: Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
Post by: martrix on April 21, 2005, 03:40:23 PM
That's a VERY good question :)

I was also curious, but did not see it as a big problem (as my users do not fill their ICQ out very often)...
Title: Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
Post by: V@no on April 22, 2005, 03:20:32 AM
The ICQ url format has been changed, that's why it doesnt work anymore...
in includes/functions.php find:
Code: [Select]
function get_icq_status($uin) {
  // From: http://www.koehntopp.de/php/snippets.html#code-icq
  if (!is_numeric($uin)) return FALSE;

  $fp = @fsockopen('wwp.icq.com', 80, $errno, $errstr, 8);
  if (!$fp) return FALSE;

  $request = "HEAD /scripts/online.dll?icq=$uin&img=5 HTTP/1.0\r\n"
            ."Host: wwp.icq.com\r\n"
            ."Connection: close\r\n\r\n";
  fputs($fp, $request);

  do {
     $response = fgets($fp, 1024);
  }
  while (!feof($fp) && !stristr($response, 'Location'));

  fclose($fp);

  if (strstr($response, '4367')) return 'online';
  if (strstr($response, '4349')) return 'offline';
  if (strstr($response, '4386')) return 'disabled';
  return FALSE;
}
Replace it with:
Code: [Select]
function get_icq_status($uin) {
  // From: http://www.koehntopp.de/php/snippets.html#code-icq
  if (!is_numeric($uin)) return FALSE;

  $fp = @fsockopen('status.icq.com', 80, $errno, $errstr, 8);
  if (!$fp) return FALSE;

  $request = "HEAD /online.gif?icq=$uin&img=3 HTTP/1.0\r\n"
            ."Host: status.icq.com\r\n"
            ."Connection: close\r\n\r\n";
  fputs($fp, $request);

  do {
     $response = fgets($fp, 1024);
  }
  while (!feof($fp) && !stristr($response, 'Location'));

  fclose($fp);
  if (strstr($response, 'online1')) return 'online';
  if (strstr($response, 'online0')) return 'offline';
  if (strstr($response, 'online2')) return 'disabled';
  return FALSE;
}
Title: Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
Post by: universal on April 22, 2005, 07:55:46 AM
thanks ;)
Title: Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
Post by: martrix on April 24, 2005, 09:37:26 PM
Nice, I just tried that out... and changed only a little bit:

this
Code: [Select]
  if (strstr($response, 'online1')) return 'online';
  if (strstr($response, 'online0')) return 'offline';
  if (strstr($response, 'online2')) return 'disabled';

to this
Code: [Select]
  if (strstr($response, 'online1')) return '<img src="templates/default/images/online.gif" width="14" height="14" border="0" alt="online" title="online">';
  if (strstr($response, 'online0')) return '<img src="templates/default/images/offline.gif" width="14" height="14" border="0" alt="offline" title="offline">';
  if (strstr($response, 'online2')) return '<img src="templates/default/images/disabled.gif" width="14" height="14" border="0" alt="disable" title="disabled">';

and I did use these images:

online: (http://photo.overlord.cz/templates/default/images/online.gif)
offline: (http://photo.overlord.cz/templates/default/images/offline.gif)
disabled: (http://photo.overlord.cz/templates/default/images/disabled.gif)

 :)

Thank you V@no
Title: Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
Post by: V@no on April 24, 2005, 09:52:50 PM
you are right...that's the only three lines could be changed...for some reason it didnt work when I tested it..:?
I'd suggest u dont use it that way, leave them as
Code: [Select]
  if (strstr($response, 'online1')) return 'online';
  if (strstr($response, 'online0')) return 'offline';
  if (strstr($response, 'online2')) return 'disabled';
and then in the template use:
Code: [Select]
<img src="templates/default/images/{user_icq_status}.gif" width="14" height="14" border="0" alt="{user_icq_status}" title="{user_icq_status}">I belive this is more practical ;)
Title: Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
Post by: martrix on April 24, 2005, 10:16:59 PM
right  :D that's a very elegant way, how to do it... one will never learn out...  :lol:
Title: Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
Post by: martrix on June 05, 2006, 06:09:26 PM
Just found out, that ICQ must have changed the internet pages, so the detail-link shows you an error page instead of the user's ICQ-detail...

Change

Code: [Select]
http://wwp.icq.com/scripts/search.dll?to=
into

Code: [Select]
http://www.icq.com/people/about_me.php?uin=
everywhere you find it in the code and templates and it will work again.

Have fun
Title: Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
Post by: mawenzi on June 28, 2006, 05:52:23 PM
... everywhere ...

Do you have a complete file list ? I would not like to look for so much ...  :wink:

- details.php
- member.php
- ... ?
Title: Re: Why I`ve never saw (<b>{user_icq_status}</b>) thing working?
Post by: martrix on June 28, 2006, 10:30:55 PM
No, I do not. Sorry.
I just use a file search like:

search for: *.php *.htm *.html

find text: wwp.icq

(in Norton Commander, Total Commander, Windows Commander, Salamander etc.)