C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$RJRNN8D\includes\pathway.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
<?php
/**
* @version $Id: pathway.php,v 1.8 2005/02/05 11:07:24 akede 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.' );

function 
pathwayMakeLink$id$name$link$parent ) {
    
$mitem = new stdClass();
    
$mitem->id         $id;
    
$mitem->name     $mitem->name html_entity_decode$name ); 
    
$mitem->link     $link;
    
$mitem->parent     $parent;
    
$mitem->type     '';

    return 
$mitem;
}

/**
* Outputs the pathway breadcrumbs
* @param database A database connector object
* @param int The db id field value of the current menu item
*/
function showPathway$Itemid ) {
    global 
$database$option$task$mainframe$mosConfig_absolute_path$mosConfig_live_site;
    global 
$SERVER_SOFTWARE$QUERY_STRING$REQUEST_URI;

    
// get the home page
    
$database->setQuery"SELECT *"
    
"\nFROM #__menu"
    
"\nWHERE menutype='mainmenu' AND published='1'"
    
"\nORDER BY parent, ordering LIMIT 1"
    
);
    
$home_menu = new mosMenu$database );
    
$database->loadObject$home_menu );

    
// the the whole menu array and index the array by the id
    
$database->setQuery"SELECT id, name, link, parent, type"
    
"\nFROM #__menu"
    
"\nWHERE published='1'"
    
"\nORDER BY parent, ordering"
    
);
    
$mitems $database->loadObjectList'id' );

    
$isWin = (substr(PHP_OS03) == 'WIN');
    
$optionstring $isWin $QUERY_STRING $REQUEST_URI;

    
// are we at the home page or not
    
$homekeys array_keys$mitems );
    
$home = @$mitems[$home_menu->id]->name;
    
$path "";

    
// this is a patch job for the frontpage items! aje
    
if ($Itemid == $home_menu->id) {
        switch (
$option) {
            case 
'content':
            
$id intvalmosGetParam$_REQUEST'id') );
            if (
$task=='blogsection'){

                
$database->setQuery"SELECT title FROM #__sections WHERE id=$id);
            } else if ( 
$task=='blogcategory' ) {
                
$database->setQuery"SELECT title FROM #__categories WHERE id=$id);
            } else {
                
$database->setQuery"SELECT title, catid FROM #__content WHERE id=$id);
            }

            
$row null;
            
$database->loadObject$row );

            
$id maxarray_keys$mitems ) ) + 1;

            
// add the content item
            
$mitem2 pathwayMakeLink(
            
$Itemid,
            
$row->title,
            
"",
            
1
            
);
            
$mitems[$id] = $mitem2;
            
$Itemid $id;

            
$home '<a href="'sefRelToAbs('index.php') .'" class="pathway">'$home .'</a>';
            break;

        }
    }

    switch( @
$mitems[$Itemid]->type ) {
        case 
'content_section':
        
$id intvalmosGetParam$_REQUEST'id') );

        switch (
$task) {
            case 
'category':
            if (
$id) {
                
$database->setQuery"SELECT title FROM #__categories WHERE id=$id);
                
$title $database->loadResult();

                
$id maxarray_keys$mitems ) ) + 1;
                
$mitem pathwayMakeLink(
                
$id,
                
$title,
                
'index.php?option='$option .'&task='$task .'&id='$id .'&Itemid='$Itemid,
                
$Itemid
                
);
                
$mitems[$id] = $mitem;
                
$Itemid $id;
            }
            break;

            case 
'view':
            if (
$id) {
                
// load the content item name and category
                
$database->setQuery"SELECT title, catid, id FROM #__content WHERE id=$id);
                
$row null;
                
$database->loadObject$row );

                
// load and add the category
                
$database->setQuery"SELECT c.title AS title, s.id AS sectionid "
                
."FROM #__categories AS c "
                
."LEFT JOIN #__sections AS s "
                
."ON c.section=s.id "
                
."WHERE c.id=$row->catid);
                
$result $database->loadObjectList();

                
$title $result[0]->title;
                
$sectionid $result[0]->sectionid;

                
$id maxarray_keys$mitems ) ) + 1;
                
$mitem1 pathwayMakeLink(
                
$Itemid,
                
$title,
                
'index.php?option='$option .'&task=category&sectionid='$sectionid .'&id='$row->catid,
                
$Itemid
                
);
                
$mitems[$id] = $mitem1;

                
// add the final content item
                
$id++;
                
$mitem2 pathwayMakeLink(
                
$Itemid,
                
$row->title,
                
"",
                
$id-1
                
);
                
$mitems[$id] = $mitem2;
                
$Itemid $id;

            }
            break;
        }
        break;

        case 
'content_category':
        
$id intvalmosGetParam$_REQUEST'id') );

        switch (
$task) {

            case 
'view':
            if (
$id) {
                
// load the content item name and category
                
$database->setQuery"SELECT title, catid FROM #__content WHERE id=$id);
                
$row null;
                
$database->loadObject$row );

                
$id maxarray_keys$mitems ) ) + 1;
                
// add the final content item
                
$mitem2 pathwayMakeLink(
                
$Itemid,
                
$row->title,
                
"",
                
$Itemid
                
);
                
$mitems[$id] = $mitem2;
                
$Itemid $id;

            }
            break;
        }
        break;

        case 
'content_blog_category':
        case 
'content_blog_section':
        switch (
$task) {
            case 
'view':
            
$id intvalmosGetParam$_REQUEST'id') );

            if (
$id) {
                
// load the content item name and category
                
$database->setQuery"SELECT title, catid FROM #__content WHERE id=$id);
                
$row null;
                
$database->loadObject$row );

                
$id maxarray_keys$mitems ) ) + 1;
                
$mitem2 pathwayMakeLink(
                
$Itemid,
                
$row->title,
                
"",
                
$Itemid
                
);
                
$mitems[$id] = $mitem2;
                
$Itemid $id;

            }
            break;
        }
        break;
    }

    
$i count$mitems );
    
$mid $Itemid;

    
$imgPath =  'templates/' $mainframe->getTemplate() . '/images/arrow.png';
    if (
file_exists"$mosConfig_absolute_path/$imgPath)){
        
$img '<img src="' $mosConfig_live_site '/' $imgPath '" border="0" alt="arrow" />';
    } else { 
        
$imgPath '/images/M_images/arrow.png';
        if (
file_exists$mosConfig_absolute_path $imgPath )){
            
$img '<img src="' $mosConfig_live_site '/images/M_images/arrow.png" alt="arrow" />';
        } else {
            
$img '&gt;';
        }
    }

    while (
$i--) {
        if (!
$mid || empty( $mitems[$mid] ) || $mid == || !eregi("option"$optionstring)) {
            break;
        }
        
$item =& $mitems[$mid];

        
// converts & to &amp; for xtml compliance
        
$itemname ampReplace$item->name );
        
        
// if it is the current page, then display a non hyperlink
        
if ($item->id == $Itemid || empty( $mid ) || empty($item->link)) {
            
$newlink "  $itemname";
        } else if (isset(
$item->type) && $item->type == 'url') {
            
$correctLink eregi'http://'$item->link);
            if (
$correctLink==1) {
                
$newlink '<a href="'$item->link .'" target="_window" class="pathway">'$itemname .'</a>';
            } else {
                
$newlink $itemname;
            }
        } else {
            
$newlink '<a href="'sefRelToAbs$item->link .'&Itemid='$item->id ) .'" class="pathway">'$itemname .'</a>';
        }

        
$newlink ampReplace$newlink );
        
        if (
trim($newlink)!="") {
            
$path $img .' '$newlink .' '$path;
        } else {
            
$path '';
        }

        
$mid $item->parent;
    }
    
    if ( 
eregi'option'$optionstring ) && trim$path  ) ) {
        
$home '<a href="'sefRelToAbs'index.php' ) .'" class="pathway">'$home .'</a>';
    }

    if (
$mainframe->getCustomPathWay()){
        
$path .= $img ' ';
        
$path .= implode ("$img " ,$mainframe->getCustomPathWay());
    }
  
    echo ( 
"<span class=\"pathway\">"$home ." "$path ."</span>\n" );
}

// code placed in a function to prevent messing up global variables
showPathway$Itemid );
?>