C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\netspot\modules\mod_mostread.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
/**
* @version $Id: mod_mostread.php,v 1.8 2005/01/23 17:19:53 levis Exp $
* @package Mambo
* @copyright (C) 2000 - 2005 Miro International Pty Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Mambo is Free Software
*/

/** ensure this file is being included by a parent file */
defined'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

global 
$mosConfig_offset$mosConfig_live_site;

$type         intval$params->get'type') );
$count         intval$params->get'count') );
$catid         trim$params->get'catid' ) );
$secid         trim$params->get'secid' ) );
$show_front    $params->get'show_front');
$class_sfx     $params->get'moduleclass_sfx' );

$now         date'Y-m-d H:i:s'time()+$mosConfig_offset*60*60 );

$access = !$mainframe->getCfg'shownoauth' );

// select between Content Items, Static Content or both
switch ( $type ) {
    case 
2:
        
$query "SELECT a.id, a.title"
        
"\n FROM #__content AS a"
        
"\n WHERE ( a.state = '1' AND a.checked_out = '0' AND a.sectionid = '0' )"
        
"\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '"$now ."' )"
        
"\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '"$now ."' )"
        
. ( $access "\n AND a.access <= '"$my->gid ."'" '' )
        . 
"\n ORDER BY a.hits DESC LIMIT $count"
        
;
        
$database->setQuery$query );
        
$rows $database->loadObjectList();    
        break;

    case 
3:
        
$query "SELECT a.id, a.title, a.sectionid"
        
"\n FROM #__content AS a"
        
"\n WHERE ( a.state = '1' AND a.checked_out = '0' )"
        
"\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '"$now ."' )"
        
"\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '"$now ."' )"
        
. ( $access "\n AND a.access <= '"$my->gid ."'" '' )
        . 
"\n ORDER BY a.hits DESC LIMIT $count"
        
;
        
$database->setQuery$query );
        
$rows $database->loadObjectList();    
        break;
        
    case 
1:
    default:
        
$query "SELECT a.id, a.title, a.sectionid, a.catid"
        
"\n FROM #__content AS a"
        
"\n LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id"
        
"\n WHERE ( a.state = '1' AND a.checked_out = '0' AND a.sectionid > '0' )"
        
"\n AND ( a.publish_up = '0000-00-00 00:00:00' OR a.publish_up <= '"$now ."' )"
        
"\n AND ( a.publish_down = '0000-00-00 00:00:00' OR a.publish_down >= '"$now ."' )"
        
. ( $access "\n AND a.access <= '"$my->gid ."'" '' )
        . ( 
$catid "\n AND ( a.catid IN ("$catid .") )" '' )
        . ( 
$secid "\n AND ( a.sectionid IN ("$secid .") )" '' )
        . ( 
$show_front == "0" "\n AND f.content_id IS NULL" '' )
        . 
"\n ORDER BY a.hits DESC LIMIT $count"
        
;
        
$database->setQuery$query );
        
$rows $database->loadObjectList();
        
        break;        
}

// needed to reduce queries used by getItemid for Content Items
if ( ( $type == ) || ( $type == ) ) {
    
$bs     $mainframe->getBlogSectionCount();
    
$bc     $mainframe->getBlogCategoryCount();
    
$gbs     $mainframe->getGlobalBlogSectionCount();
}

// Output
?>
<ul class="mostread<?php echo $class_sfx?>">
<?php
foreach ($rows as $row) {
    
// get Itemid
    
switch ( $type ) {
        case 
2:
            
$query "SELECT id"
            
"\n FROM #__menu"
            
"\n WHERE type = 'content_typed'"
            
"\n AND componentid = $row->id"
            
;
            
$database->setQuery$query );    
            
$Itemid $database->loadResult();
            break;
            
        case 
3:
            if ( 
$row->sectionid ) {
                
$Itemid $mainframe->getItemid$row->id00$bs$bc$gbs );
            } else {
                
$query "SELECT id"
                
"\n FROM #__menu"
                
"\n WHERE type = 'content_typed'"
                
"\n AND componentid = $row->id"
                
;
                
$database->setQuery$query );    
                
$Itemid $database->loadResult();                
            }
            break;

        case 
1:
        default:
            
$Itemid $mainframe->getItemid$row->id00$bs$bc$gbs );
            break;
    }
    
    
// Blank itemid checker for SEF
    
if ($Itemid == NULL) {
        
$Itemid '';
    } else {
        
$Itemid '&amp;Itemid='.$Itemid;
    }
    
     
$link sefRelToAbs'index.php?option=com_content&amp;task=view&amp;id='$row->id $Itemid );
     
?>
     <li class="latestnews<?php echo $class_sfx?>">
     <a href="<?php echo $link?>" class="mostread<?php echo $class_sfx?>">
     <?php echo $row->title?>
     </a>
     </li>
     <?php
}
?>
</ul>