C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\mamFM\modules\mod_banners.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
/**
* @version $Id: mod_banners.php 2456 2006-02-18 01:36:30Z stingrey $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined'_VALID_MOS' ) or die( 'Restricted access' );

// clientids must be an integer
$clientids $params->get'banner_cids''' );

$where     '';
$banner null;

if ( 
$clientids != '' ) {
    
$where "\n AND cid IN ( $clientids )";
}

$query "SELECT *"
"\n FROM #__banner"
"\n WHERE showBanner=1 "
$where
;
$database->setQuery$query );
$banners $database->loadObjectList();
$numrows count$banners );

$bannum 0;
if (
$numrows 1) {
    
$numrows--;
    
mt_srand( (double) microtime()*1000000 );
    
$bannum mt_rand0$numrows );
}

if (
$numrows){
    
$banner $banners[$bannum];

    
$query "UPDATE #__banner"
    
"\n SET impmade = impmade + 1"
    
"\n WHERE bid = $banner->bid"
    
;
    
$database->setQuery$query );
    if(!
$database->query()) {
        echo 
$database->stderrtrue );
        return;
    }
    
$banner->impmade++;

    if (
$numrows 0) {
        
// Check if this impression is the last one and print the banner
        
if ($banner->imptotal == $banner->impmade) {

            
$query "INSERT INTO #__bannerfinish ( cid, type, name, impressions, clicks, imageurl, datestart, dateend )"
            
"\n VALUES ( $banner->cid, '$banner->type', '$banner->name', $banner->impmade$banner->clicks, '$banner->imageurl', '$banner->date', 'now()' )"
            
;
            
$database->setQuery($query);
            if(!
$database->query()) {
                die(
$database->stderr(true));
            }

            
$query "DELETE FROM #__banner"
            
"\n WHERE bid = $banner->bid"
            
;
            
$database->setQuery($query);
            if(!
$database->query()) {
                die(
$database->stderr(true));
            }
        }

        if (
trim$banner->custombannercode )) {
            echo 
$banner->custombannercode;
        } else if (
eregi"(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$"$banner->imageurl )) {
            
$imageurl     $mosConfig_live_site .'/images/banners/'$banner->imageurl;
            
$link        sefRelToAbs'index.php?option=com_banners&amp;task=click&amp;bid='$banner->bid );
            echo 
'<a href="'$link .'" target="_blank"><img src="'$imageurl .'" border="0" alt="Advertisement" /></a>';

        } else if (
eregi("\.swf$"$banner->imageurl)) {
            
$imageurl     "$mosConfig_live_site/images/banners/".$banner->imageurl;
            echo 
"<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" border=\"5\">
                    <param name=\"movie\" value=\"
$imageurl\"><embed src=\"$imageurl\" loop=\"false\" pluginspage=\"http://www.macromedia.com/go/get/flashplayer\" type=\"application/x-shockwave-flash\"></embed></object>";
        }
    }
} else {
    echo 
"&nbsp;";
}
?>