1
|
<?php
|
2
|
|
3
|
// $Id: insert_image.php,v 1.3 2005/04/02 06:25:54 rdjurovich Exp $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2005, Ryan Djurovich
|
9
|
|
10
|
Website Baker is free software; you can redistribute it and/or modify
|
11
|
it under the terms of the GNU General Public License as published by
|
12
|
the Free Software Foundation; either version 2 of the License, or
|
13
|
(at your option) any later version.
|
14
|
|
15
|
Website Baker is distributed in the hope that it will be useful,
|
16
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
GNU General Public License for more details.
|
19
|
|
20
|
You should have received a copy of the GNU General Public License
|
21
|
along with Website Baker; if not, write to the Free Software
|
22
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
|
24
|
*/
|
25
|
|
26
|
// Include the config file
|
27
|
require('../../../../config.php');
|
28
|
|
29
|
// Create new admin object
|
30
|
require(WB_PATH.'/framework/class.admin.php');
|
31
|
$admin = new admin('Pages', 'pages_modify', false);
|
32
|
|
33
|
// Setup the template
|
34
|
$template = new Template(WB_PATH.'/modules/htmlarea/htmlarea/popups');
|
35
|
$template->set_file('page', 'insert_image.html');
|
36
|
$template->set_block('page', 'main_block', 'main');
|
37
|
|
38
|
// Get the directory to browse
|
39
|
$directory = $admin->get_post('folder');
|
40
|
if($directory == '') {
|
41
|
$directory = MEDIA_DIRECTORY;
|
42
|
}
|
43
|
// If the directory contains ../ then set it to /media
|
44
|
if(strstr($directory, '../')) {
|
45
|
$directory = MEDIA_DIRECTORY;
|
46
|
}
|
47
|
|
48
|
// Include the WB functions file
|
49
|
require_once(WB_PATH.'/framework/functions.php');
|
50
|
|
51
|
// Insert values into template
|
52
|
$template->set_var('WB_URL', WB_URL);
|
53
|
$template->set_var('POPUP', 'image');
|
54
|
$template->set_var('DIRECTORY', str_replace(WB_URL, '', $directory));
|
55
|
|
56
|
// Get home folder not to show
|
57
|
$home_folders = get_home_folders();
|
58
|
|
59
|
// Insert dirs into the dir list
|
60
|
$template->set_block('main_block', 'dir_list_block', 'dir_list');
|
61
|
foreach(directory_list(WB_PATH.MEDIA_DIRECTORY) AS $name) {
|
62
|
$template->set_var('NAME', str_replace(WB_PATH, '', $name));
|
63
|
if(!isset($home_folders[str_replace(WB_PATH.MEDIA_DIRECTORY, '', $name)])) {
|
64
|
if($directory == str_replace(WB_PATH, '', $name)) {
|
65
|
$template->set_var('SELECTED', ' selected');
|
66
|
} else {
|
67
|
$template->set_var('SELECTED', '');
|
68
|
}
|
69
|
$template->parse('dir_list', 'dir_list_block', true);
|
70
|
}
|
71
|
}
|
72
|
|
73
|
// Parse the template object
|
74
|
$template->parse('main', 'main_block', false);
|
75
|
$template->pparse('output', 'page');
|
76
|
|
77
|
?>
|