xoops forums

El_Jordo

Just popping in
Posted on: 2003/4/27 20:03
El_Jordo
El_Jordo (Show more)
Just popping in
Posts: 64
Since: 2003/4/23
#1

IP Addresses in Forums

Is there a way for administrators to track IP addresses in the standard XOOPS forum module? It must be there, since IPs appear in Comments. But I've looked and can't find it in the forums. Thanks!

Jack404

Just popping in
Posted on: 2003/7/4 22:09
Jack404
Jack404 (Show more)
Just popping in
Posts: 56
Since: 2003/5/16
#2

Re: IP Addresses in Forums

BUMP!

I saw the IP.gif file in the images directory, but how would we go about implementing this in XOOPS2? I really liked that feature in XOOPS 1.3.8, and I'm a bit disappointed it was taken out.

Could someone please help us find the code we need?

Thanks in advance!

kain

Just popping in
Posted on: 2003/7/4 23:18
kain
kain (Show more)
Just popping in
Posts: 56
Since: 2002/1/9 9
#3

Re: IP Addresses in Forums

i'm speaking for XOOPS 1.3.8
i don't like the ip.gif so i replaced with a piece of code

in /modules/newbb/class/class.forumposts.php
find
$ip_image

and take this:
Quote:

if ( $adminview ) {
?>
<script>
function whois(url) {
test=window.open(url,'nome','SCROLLBARS=1,STATUS=NO,TOOLBAR=NO,RESIZABLE=YES,LOCATION=NO,MENU=NO,WIDTH=600,HEIGHT=400,LEFT=0,TOP=0');
}
</script>
<?php

$ip_image = "IP: <b><font color='#FF0000'>".$this->posterip()."</font> - <a href=\"javascript:whois('http://stats.kuht.it/inc/whois.php?IP=".$this->posterip()."');\">WHOIS</a></b><br />";

} else {

$ip_image = "IP: <b><font color='#FF0000'>nascosto</font></b><br />";



please don't consider whois.php, is a php page that can whois a certain ip, remove it.

for the lazy:

Quote:

if ( $adminview ) {
$ip_image = "IP: <b><font color='#FF0000'>".$this->posterip()."</font> </b><br />";

} else {

$ip_image = "IP: <b><font color='#FF0000'>nascosto</font></b><br />";

}

i've made also an algorithm to crypt the ip for non admin user, but i think that is better leaving "nascosto" (hidden or protected)

Jack404

Just popping in
Posted on: 2003/7/4 23:52
Jack404
Jack404 (Show more)
Just popping in
Posts: 56
Since: 2003/5/16
#4

Re: IP Addresses in Forums

I found this text in XOOPS 2 in modules/newbb/class/class.forumposts.php on lines 383 to 385:

Quote:

function posterip(){
return $this->poster_ip;
}


How would I go about using this function in association with the IP.gif file?

Jack404

Just popping in
Posted on: 2003/7/4 23:53
Jack404
Jack404 (Show more)
Just popping in
Posts: 56
Since: 2003/5/16
#5

Re: IP Addresses in Forums

I also found this, starting on line 221:

Quote:

function getPost($id) {
$sql = 'SELECT p.*, t.post_text, tp.topic_status FROM '.$this->db->prefix('bb_posts').' p LEFT JOIN '.$this->db->prefix('bb_posts_text').' t ON p.post_id=t.post_id LEFT JOIN '.$this->db->prefix('bb_topics').' tp ON tp.topic_id=p.topic_id WHERE p.post_id='.$id;
$array = $this->db->fetchArray($this->db->query($sql));
$this->post_id = $array['post_id'];
$this->pid = $array['pid'];
$this->topic_id = $array['topic_id'];
$this->forum_id = $array['forum_id'];
$this->post_time = $array['post_time'];
$this->uid = $array['uid'];
$this->poster_ip = $array['poster_ip'];
$this->subject = $array['subject'];
$this->nohtml = $array['nohtml'];
$this->nosmiley = $array['nosmiley'];
$this->icon = $array['icon'];
$this->attachsig = $array['attachsig'];
$this->post_text = $array['post_text'];
if ($array['pid'] == 0) {
$this->istopic = true;
}
if ($array['topic_status'] == 1) {
$this->islocked = true;
}
}

kain

Just popping in
Posted on: 2003/7/5 0:30
kain
kain (Show more)
Just popping in
Posts: 56
Since: 2002/1/9 9
#6

Re: IP Addresses in Forums

not sure of this, since i don't know much about x2's code, but maybe you have to modify templates.. the way your forums looks like.

Jack404

Just popping in
Posted on: 2003/7/5 0:34
Jack404
Jack404 (Show more)
Just popping in
Posts: 56
Since: 2003/5/16
#7

Re: IP Addresses in Forums

I've gotten as far as having the IP.gif show up in the forums, but I'm not sure what to put in alt="" for the img tags. I've tried <{$poster_ip}>, and this doesn't work. Where does XOOPS assign things like <{$topic_post.poster_from}> that are used in the templates? If someone can point that to me, I'd be able to figure out the rest

YourHelp

Friend of XOOPS
Posted on: 2003/7/5 1:34
YourHelp
YourHelp (Show more)
Friend of XOOPS
Posts: 479
Since: 2003/6/9 6
#8

Re: IP Addresses in Forums

this is another reason why i enjoyed 1.3 XOOPS better also the avatars on registration where another thing that i wished was not taken out of xoops2 oh well

Jack404

Just popping in
Posted on: 2003/7/5 2:22
Jack404
Jack404 (Show more)
Just popping in
Posts: 56
Since: 2003/5/16
#9

Re: IP Addresses in Forums

Ack, I guess I'd better hope a Dev reads this and can point me in the right direction...

I've looked EVERYWHERE for where the template <{$variables}> are defined, but no luck yet. Does anyone have an idea?

Jack404

Just popping in
Posted on: 2003/7/5 4:46
Jack404
Jack404 (Show more)
Just popping in
Posts: 56
Since: 2003/5/16
#10

Re: IP Addresses in Forums

Hehe, just figured it out. XOOPS actually already defines a template variable for it. Just put <{$topic_post.post_poster_ip}> where you'd like the IP address to show up. For example, this is my template for newbb_thread.html:

Quote:

<!-- start comment post -->
<tr>
<td class="head"><a id="forumpost<{$topic_post.post_id}>"></a> <{$topic_post.poster_uname}></td>
<td class="head"><div class="comDate"><span class="comDateCaption"><{$lang_postedon}></span> <{$topic_post.post_date}></div></td>
</tr>
<tr>

<{if $topic_post.poster_uid != 0}>

<td class="odd"><div class="comUserRank"><div class="comUserRankText"><{$topic_post.poster_rank_title}></div><{$topic_post.poster_rank_image}></div><img class="comUserImg" src="<{$xoops_url}>/uploads/<{$topic_post.poster_avatar}>" alt="" /><div class="comUserStat"><span class="comUserStatCaption"><{$lang_joined}>:</span> <{$topic_post.poster_regdate}></div><div class="comUserStat"><span class="comUserStatCaption"><{$lang_from}>:</span> <{$topic_post.poster_from}></div><div class="comUserStat"><span class="comUserStatCaption"><{$lang_posts}>:</span> <{$topic_post.poster_postnum}></div><div class="comUserStatus"><{$topic_post.poster_status}></div></td>

<{else}>

<td class="odd"> </td>

<{/if}>

<td class="odd">
<div class="comTitle"><{$topic_post.post_title}></div><div class="comText"><{$topic_post.post_text}></div>
</td>
</tr>
<tr>
<td class="even"></td>

<{if $xoops_isadmin || $xoops_ismoderator == true}>

<td class="even" align="right">
<img src="<{$xoops_url}>/images/icons/ip.gif" alt="<{$topic_post.post_poster_ip}>" /><a href="edit.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>"><img src="<{$xoops_url}>/images/icons/edit.gif" alt="<{$lang_edit}>" /></a><a href='delete.php?forum=<{$forum_id}>&topic_id=<{$topic_id}>&post_id=<{$topic_post.post_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>'><img src="<{$xoops_url}>/images/icons/delete.gif" alt="<{$lang_delete}>" /></a><a href='reply.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>'><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a>
</td>

<{elseif $xoops_isuser == true && $xoops_userid == $topic_post.poster_uid}>

<td class="even" align="right">
<img src="<{$xoops_url}>/images/icons/ip.gif" alt="" /><a href="edit.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>"><img src="<{$xoops_url}>/images/icons/edit.gif" alt="<{$lang_edit}>" /></a><a href='reply.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>'><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a>
</td>

<{elseif $viewer_can_post == true}>

<td class="even" align="right">
<img src="<{$xoops_url}>/images/icons/ip.gif" alt="" /><a href='reply.php?forum=<{$forum_id}>&post_id=<{$topic_post.post_id}>&topic_id=<{$topic_id}>&viewmode=<{$topic_viewmode}>&order=<{$order_current}>'><img src="<{$xoops_url}>/images/icons/reply.gif" alt="<{$lang_reply}>" /></a>
</td>

<{else}>

<td class="even"> </td>

<{/if}>

</tr>
<!-- end comment post -->