C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$RVSVKU0\setup\cpg1419\minibrowser.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
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2008 Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.4.19
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.4.x/minibrowser.php $
  $Revision: 4392 $
  $Author: gaugau $
  $Date: 2008-04-16 09:25:35 +0200 (Mi, 16 Apr 2008) $
**********************************************/

define('IN_COPPERMINE'true);
define('MINIBROWSER_PHP'true);
define('SEARCHNEW_PHP'true);

require(
'include/init.inc.php');

// set/define some vars
$scriptfilename 'minibrowser.php';

if (isset(
$_REQUEST['folder'])) {
    
$folder rawurldecode($_REQUEST['folder']);
} else {
    
$folder '';
}

if (isset(
$_REQUEST['startfolder'])) {
    
$startfolder rawurldecode($_REQUEST['startfolder']);
} else {
    
$startfolder '';
}

if (
$folder == '' && $startfolder != '') {
    
$folder $startfolder;
}

if (isset(
$_REQUEST['parentform'])) {
    
$parentform rawurldecode($_REQUEST['parentform']);
} else {
    
$parentform '';
}

if (isset(
$_REQUEST['formelementname'])) {
    
$formelementname rawurldecode($_REQUEST['formelementname']);
} else {
    
$formelementname '';
}

if (isset(
$_REQUEST['hidefolders'])) {
    
$hidefolders rawurldecode($_REQUEST['hidefolders']);
    
$hiddenfolders explode(','$hidefolders);
}

if (isset(
$_REQUEST['linktarget'])) {
    
$linktarget rawurldecode($_REQUEST['linktarget']);
} else {
    
$linktarget '';
}

if (isset(
$_REQUEST['searchnew_php'])) {
    
$searchnew_php rawurldecode($_REQUEST['searchnew_php']);
} else {
    
$searchnew_php '0';
}

if (isset(
$_REQUEST['radio'])) {
    
$radio rawurldecode($_REQUEST['radio']);
} else {
    
$radio '';
}

$newline "\n";

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<title><?php echo $CONFIG['gallery_name'] .': '$lang_minibrowser_php['click_to_close'];  ?></title>
<meta http-equiv="content-type" content="text/html; charset=<?php echo $CONFIG['charset'] == 'language file' $lang_charset $CONFIG['charset'?>" />
<link rel="stylesheet" href="<?php echo $THEME_DIR ?>style.css" />
<script type="text/javascript" src="scripts.js"></script>
<?php
//if ($parentform != '' && $formelementname != '') { // print the javascript bit that updates the parent element --- start
?>
<script type="text/javascript">
function updateParent() {
    opener.document.<?php print $parentform?>.<?php print $formelementname?>.value = document.childform.cf2.value;
    //window.self.close();
    return false;
}
<?php
if (!$_REQUEST['no_popup']) {
?>
adjust_popup();
<?php
}
?>
</script>
<?php
//} // print the javascript bit that updates the parent element --- end
?>
</head>
<body class="tableb" scroll="auto" marginwidth="0" marginheight="0">

<form name="childform" id="childform" method="get" action="<?php print $_SERVER['PHP_SELF']; ?>" onsubmit="return updateParent();">

<?php
//print $_SERVER["REQUEST_URI"];
starttable(-2$lang_minibrowser_php['select_directory'], 2);
if (!
GALLERY_ADMIN_MODE) { cpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__); }


$base_folder rtrim(cpg_get_webroot_path(), '/').'/';

//print $base_folder.'<br />';

$dir opendir($base_folder.$folder);
// read the folder/file structure we're currently in and put it into an array
$dirCounter 0;
while(
$file readdir($dir)){
    if(
is_dir($base_folder.$folder.$file)) {
        if (
is_array($hiddenfolders)) {
            if (
in_array($file,$hiddenfolders) == false) {
                
$foldername[] = $file;
                
$dirCounter++;
            }
        } else {
            
$foldername[] = $file;
            
$dirCounter++;
        }
    } else {
        
$filename[] = $file;
    }
}
closedir($dir);


// print the folder we're in
print '<tr>'.$newline;
print 
'<td class="tableh2">'.$newline;
if (
$radio != 0) {
    print 
'<input type="radio" name="cf1" value="'.$folder.rtrim($key'/').'/" class="radio"  checked="checked" />'.$newline;
}
print 
'</td>'.$newline;
print 
'<td class="tableh2">'.$newline;
print 
'<input type="text" name="cf2" size="50" value="/'.ltrim($folder'/').'" disabled="disabled" class="tableh2_compact" />&nbsp;'.$newline;
if (
$linktarget != '') {
    
// determine if we should display a submit button start
    // get the allowed extensions
    
$filetypes = array();
    
$result cpg_db_query("SELECT extension FROM {$CONFIG['TABLE_FILETYPES']}");
    
//print mysql_num_rows($result);
    
while($row mysql_fetch_row($result)) {
        
$filetypes[] = $row[0];
    }
    
mysql_free_result($result);
    
$filetypes array_unique($filetypes);
    
// loop through the $filename array, get the extensions and check if at least one allowed ending is there
    
$allowed_file_counter 0;
    if (
is_array($filename)) {
        foreach (
$filename as $value) {
          if(
in_array(ltrim(strrchr(strtolower($value),'.'),'.'), $filetypes)) {
              
$allowed_file_counter++;
          } 
// end if in_array
        
// end foreach
    
// end is_array
    
if ($allowed_file_counter!=0) {
        print 
'<a href="'.$linktarget.'?startdir='.rtrim(str_replace($_REQUEST['limitfolder'], '',$folder), '/').'" class="admin_menu" target="_parent">'.$lang_minibrowser_php['submit'].'</a>'.$newline;
    } 
// determine if we should display a submit button end
} else {
    print 
'<input type="submit" name="submit" value="'.$lang_minibrowser_php['submit'].'" class="button" />'.$newline;
}
print 
'</td>'.$newline;
print 
'</tr>'.$newline;


// display the "up" link if we're not already in the root folder
if ((!empty($_REQUEST['folder']) || !empty($_REQUEST['startfolder'])) && ($folder != '' && $folder!= '/')) {
    
$uplink rtrim($folder'/');
    
$remove strrchr ($uplink,'/');
    
//print 'uplink:'.$uplink.'<br />';
    //print 'remove:'.$remove.'<br />';
    
if ($remove != '') {
        
$uplink str_replace($remove''$uplink).'/';
    } else {
        
$uplink '';
    }
    
//print 'uplink:'.$uplink.'<br />';
    
if ($_REQUEST['limitfolder'] != $folder) {
        print 
'<tr>'.$newline;
        print 
'<td class="tableb">'.$newline;
        print 
'&nbsp;';
        print 
'</td>'.$newline;
        print 
'<td class="tableb">'.$newline;
        print 
'<img src="images/spacer.gif" width="16" height="16" border="0" alt="" align="left" />'.$newline;
        print 
'<a href="'.$_SERVER['PHP_SELF'].'?folder='.rawurlencode($uplink).'&amp;parentform='.rawurlencode($parentform).'&amp;formelementname='.rawurlencode($formelementname).'&amp;no_popup='.$_REQUEST['no_popup'].'&amp;limitfolder='.$_REQUEST['limitfolder'].'&amp;hidefolders='.$_REQUEST['hidefolders'].'&amp;linktarget='.$_REQUEST['linktarget'].'">'.$newline;
        print 
'.. '.$lang_minibrowser_php['up'];
        print 
'</a>'.$newline;
        print 
'</td>'.$newline;
        print 
'</tr>'.$newline;
    }
}


if (
is_array($foldername)) {
    
natcasesort ($foldername);
    foreach(
$foldername as $key) {
        if (
$key != '.' && $key != '..') {
            print 
'<tr>'.$newline;
            print 
'<td class="tableb">'.$newline;
            if (
$radio != 0) {
                print 
'<input type="radio" name="cf1" value="'.$folder.rtrim($key'/').'/" class="radio" onclick="document.childform.cf2.value=\''.$folder.$key.'\'" />'.$newline;
            }
            print 
'</td>'.$newline;
            print 
'<td class="tableb">'.$newline;
            print 
'<a href="'.$_SERVER['PHP_SELF'].'?folder='.rawurlencode('/'.ltrim($folder'/').$key.'/').'&amp;parentform='.rawurlencode($parentform).'&amp;formelementname='.rawurlencode($formelementname).'&amp;no_popup='.$_REQUEST['no_popup'].'&amp;limitfolder='.$_REQUEST['limitfolder'].'&amp;hidefolders='.$_REQUEST['hidefolders'].'&amp;linktarget='.$_REQUEST['linktarget'].'">'.$newline;
            print 
'<img src="images/folder.gif" width="16" height="16" border="0" alt="" title="folder" />'.$newline;
            print 
$key.$newline;
            print 
'</a>'.$newline;
            print 
'</td>'.$newline;
            print 
'</tr>'.$newline;
        }
    }
}

if (
is_array($filename)) {
    
natcasesort ($filename);
    foreach(
$filename as $key) {
        print 
'<tr>'.$newline;
        print 
'<td class="tableb">'.$newline;
        print 
'&nbsp;';
        print 
'</td>'.$newline;
        print 
'<td class="tableb">'.$newline;
        print 
'<img src="images/spacer.gif" width="10" height="15" border="0" alt="" align="left" />'.$newline;
        print 
$key.$newline;
        print 
'</td>'.$newline;
        print 
'</tr>'.$newline;
    }
}
print 
'                        <input type="hidden" name="parentform" value="'.$parentform.'" />'."\n";
print 
'                        <input type="hidden" name="formelementname" value="'.$formelementname.'" />'."\n";
if (
$searchnew_php == && $dirCounter == 0) {
print 
'<tr>'.$newline;
print 
'<td class="tablef" colspan="2">'.$newline;
print 
$lang_search_new_php['no_folders'].$newline;
print 
'</td>'.$newline;
print 
'</tr>'.$newline;
}
endtable();
// print '<div align="center"><a href="#" class="admin_menu" onclick="window.close();">'.$lang_minibrowser_php['close'].'</a></div>';
?>
</form>
</body>
</html>
<?php


?>