This is out of one of my ad mods
PHP Code:
if ($this->registry->options['google_ads_onoff'] && ($this->registry->options['advert_postbit_ad'] || $this->registry->options['advert_postbit_ad_rand']))
{
$this_script_off = explode('|',$this->registry->options['advert_this_script_off']);
if (!$this->registry->options['advert_this_script_off'] || !in_array(THIS_SCRIPT, $this_script_off))
{
$post[posts] = str_replace('|', '', $post[posts]);
if (!$this->registry->options['advert_maxuserpostcount'] || $post[posts] < $this->registry->options['advert_maxuserpostcount'])
{
$adtitle = $this->registry->options['advert_adtitle'];
if ($this->registry->options['advert_removeadstext'] && $this->registry->options['advert_removeadslink'])
{
$removeadstext = $this->registry->options['advert_removeadstext'];
$removeadslink = $this->registry->options['advert_removeadslink'];
$removeads = '<span style="float:' . $stylevar[right] . ';font-weight:normal;"><a href="' . $removeadslink . '">' . $removeadstext . '</a></span>';
}
if ($this->registry->options['advert_postbit_ad'])
{
$postbit_ad = $this->registry->options['advert_postbit_ad'];
}
else if ($this->registry->options['advert_postbit_ad_rand'])
{
$postbit_ad = explode('|',$this->registry->options['advert_postbit_ad_rand']);
$postbit_rand = array_rand($postbit_ad);
$postbit_ad = $postbit_ad[$postbit_rand];
}
if ($this->registry->options['advert_avatar'])
{
$advert_avatar = '<img src="' . $this->registry->options['advert_avatar'] . '" border="0" class="inlineimg" alt="" />';
}
if ($this->registry->options['legacypostbit'])
{
$advert_postbit_template = ad_postbit_legacy_end;
if ($this->registry->options['advert_postbitasuser'])
{
$postbit_advert_asuser = '<td class="alt2" width="175px"><div><a class="bigusername" href="javascript:;" rel="nofollow">' . $this->registry->options['bbtitle'] . '</a></div><div class="smallfont">Advertisement</div><div> <br />' . $advert_avatar . '</div></td>';
}
}
else
{
$advert_postbit_template = ad_postbit_below;
if ($this->registry->options['advert_postbitasuser'])
{
$postbit_advert_asuser = '<tr><td class="alt2" style="padding:0;"><table cellpadding="' . $stylevar[cellpadding] . '" cellspacing="' . $stylevar[cellpadding] . '" border="0" width="100%"><tr><td style="padding:0;">' . $advert_avatar . '</td><td nowrap="nowrap" width="100%" style="padding:0;"><div><a class="bigusername" href="javascript:;" rel="nofollow">' . $this->registry->options['bbtitle'] . '</a></div><div class="smallfont">Advertisement</div></td></tr></table></td></tr>';
}
}
$adusergroupinfo_on = explode('|',$this->registry->options['advert_Postbit_usergroups_on']);
$adusergroupinfo_off = explode('|',$this->registry->options['advert_Postbit_usergroups_off']);
if ((!$this->registry->options['advert_Postbit_usergroups_on'] || is_member_of($this->registry->userinfo, $adusergroupinfo_on)) && !is_member_of($this->registry->userinfo, $adusergroupinfo_off))
{
$aduserinfo_on = explode('|',$this->registry->options['advert_userids_on']);
$aduserinfo_off = explode('|',$this->registry->options['advert_userids_off']);
if ((!$this->registry->options['advert_userids_on'] || !in_array($userinfo[userid], $aduserinfo_on)) && in_array($userinfo[userid], $aduserinfo_off))
{
if ($this->registry->options['advert_pms_onoff'] && THIS_SCRIPT == 'private')
{
eval('$ad_postbit_below = "' . fetch_template('' . $advert_postbit_template . '') . '";');
}
else if ($this->registry->options['advert_announcements_onoff'] && THIS_SCRIPT == 'announcement')
{
$adforuminfo_on = explode('|',$this->registry->options['advert_forumids_on']);
$adforuminfo_off = explode('|',$this->registry->options['advert_forumids_off']);
if ((!$this->registry->options['advert_forumids_on'] || !in_array($foruminfo[forumid], $adforuminfo_on)) && in_array($foruminfo[forumid], $adforuminfo_off))
{
$adannouncementinfo_on = explode('|',$this->registry->options['advert_announcementids_on']);
$adannouncementinfo_off = explode('|',$this->registry->options['advert_announcementids_off']);
if ((!$this->registry->options['advert_announcementids_on'] || in_array($post[postid], $adannouncementinfo_on)) && !in_array($post[postid], $adannouncementinfo_off))
{
eval('$ad_postbit_below = "' . fetch_template('' . $advert_postbit_template . '') . '";');
}
}
}
else if ($this->registry->options['advert_posts_onoff'] && (THIS_SCRIPT == 'showthread' || THIS_SCRIPT == 'showpost'))
{
$adforuminfo_on = explode('|',$this->registry->options['advert_forumids_on']);
$adforuminfo_off = explode('|',$this->registry->options['advert_forumids_off']);
if ((!$this->registry->options['advert_forumids_on'] || in_array($thread[forumid], $adforuminfo_on)) && !in_array($thread[forumid], $adforuminfo_off))
{
$adthreadinfo_on = explode('|',$this->registry->options['advert_threadids_on']);
$adthreadinfo_off = explode('|',$this->registry->options['advert_threadids_off']);
if ((!$this->registry->options['advert_threadids_on'] || in_array($thread[threadid], $adthreadinfo_on)) && !in_array($thread[threadid], $adthreadinfo_off))
{
$post[posts] = str_replace('|', '', $post[posts]);
if ((!$this->registry->options['advert_minpostcount'] || $GLOBALS[threadinfo][replycount] >= ($this->registry->options['advert_minpostcount'] - 1)) && (!$this->registry->options['advert_maxuserpostcount'] || $post[posts] < $this->registry->options['advert_maxuserpostcount']))
{
$adxpostonly = explode('|',$this->registry->options['advert_xpostonly']);
if (($this->registry->options['advert_firstpost'] && $post[postcount] % $this->registry->options[maxposts] == 1) || ($this->registry->options['advert_lastpost'] && $post['islastshown']) || ($this->registry->options['advert_postcountrepeat'] && $post[postcount] % $this->registry->options['advert_postcountrepeat'] == 0) || ($this->registry->options['advert_xpostonly'] && $post[postcount] == in_array($post[postcount], $adxpostonly)))
{
eval('$ad_postbit_below = "' . fetch_template('' . $advert_postbit_template . '') . '";');
}
}
}
}
}
}
}
}
}
}
It may help you figure stuff out