Revision 8
Added by stefan about 20 years ago
| trunk/wb/admin/media/rename2.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: rename2.php,v 1.8 2005/04/07 07:43:36 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 |
// Create admin object |
|
| 27 |
require('../../config.php');
|
|
| 28 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 29 |
$admin = new admin('Media', 'media_rename', false);
|
|
| 30 |
|
|
| 31 |
// Include the WB functions file |
|
| 32 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 33 |
|
|
| 34 |
// Include the basic header file |
|
| 35 |
require(ADMIN_PATH.'/media/basic_header.html'); |
|
| 36 |
|
|
| 37 |
// Get the current dir |
|
| 38 |
$directory = $admin->get_post('dir');
|
|
| 39 |
if($directory == '/') {
|
|
| 40 |
$directory = ''; |
|
| 41 |
} |
|
| 42 |
// Check to see if it contains ../ |
|
| 43 |
if(strstr($directory, '../')) {
|
|
| 44 |
$admin->print_header(); |
|
| 45 |
$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH']); |
|
| 46 |
} |
|
| 47 |
|
|
| 48 |
// Get the temp id |
|
| 49 |
if(!is_numeric($admin->get_post('id'))) {
|
|
| 50 |
header("Location: browse.php?dir=$directory");
|
|
| 51 |
} else {
|
|
| 52 |
$file_id = $admin->get_post('id');
|
|
| 53 |
} |
|
| 54 |
|
|
| 55 |
// Get home folder not to show |
|
| 56 |
$home_folders = get_home_folders(); |
|
| 57 |
|
|
| 58 |
// Figure out what folder name the temp id is |
|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
/* |
|
| 4 |
|
|
| 5 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 6 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 7 |
|
|
| 8 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 9 |
it under the terms of the GNU General Public License as published by |
|
| 10 |
the Free Software Foundation; either version 2 of the License, or |
|
| 11 |
(at your option) any later version. |
|
| 12 |
|
|
| 13 |
Website Baker is distributed in the hope that it will be useful, |
|
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 |
GNU General Public License for more details. |
|
| 17 |
|
|
| 18 |
You should have received a copy of the GNU General Public License |
|
| 19 |
along with Website Baker; if not, write to the Free Software |
|
| 20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 21 |
|
|
| 22 |
*/ |
|
| 23 |
|
|
| 24 |
// Create admin object |
|
| 25 |
require('../../config.php');
|
|
| 26 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 27 |
$admin = new admin('Media', 'media_rename', false);
|
|
| 28 |
|
|
| 29 |
// Include the WB functions file |
|
| 30 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 31 |
|
|
| 32 |
// Include the basic header file |
|
| 33 |
require(ADMIN_PATH.'/media/basic_header.html'); |
|
| 34 |
|
|
| 35 |
// Get the current dir |
|
| 36 |
$directory = $admin->get_post('dir');
|
|
| 37 |
if($directory == '/') {
|
|
| 38 |
$directory = ''; |
|
| 39 |
} |
|
| 40 |
// Check to see if it contains ../ |
|
| 41 |
if(strstr($directory, '../')) {
|
|
| 42 |
$admin->print_header(); |
|
| 43 |
$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH']); |
|
| 44 |
} |
|
| 45 |
|
|
| 46 |
// Get the temp id |
|
| 47 |
if(!is_numeric($admin->get_post('id'))) {
|
|
| 48 |
header("Location: browse.php?dir=$directory");
|
|
| 49 |
} else {
|
|
| 50 |
$file_id = $admin->get_post('id');
|
|
| 51 |
} |
|
| 52 |
|
|
| 53 |
// Get home folder not to show |
|
| 54 |
$home_folders = get_home_folders(); |
|
| 55 |
|
|
| 56 |
// Figure out what folder name the temp id is |
|
| 59 | 57 |
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
|
| 60 |
// Loop through the files and dirs an add to list |
|
| 58 |
// Loop through the files and dirs an add to list
|
|
| 61 | 59 |
while (false !== ($file = readdir($handle))) {
|
| 62 |
if(substr($file, 0, 1) != '.' AND $file != 'CVS' AND $file != 'index.php') {
|
|
| 63 |
if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
|
|
| 60 |
if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
|
|
| 61 |
if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
|
|
| 64 | 62 |
if(!isset($home_folders[$directory.'/'.$file])) {
|
| 65 |
$DIR[] = $file; |
|
| 66 |
} |
|
| 67 |
} else {
|
|
| 68 |
$FILE[] = $file; |
|
| 69 |
} |
|
| 70 |
} |
|
| 71 |
} |
|
| 72 |
$temp_id = 0; |
|
| 73 |
if(isset($DIR)) {
|
|
| 74 |
foreach($DIR AS $name) {
|
|
| 75 |
$temp_id++; |
|
| 76 |
if($file_id == $temp_id) {
|
|
| 77 |
$rename_file = $name; |
|
| 78 |
$type = 'folder'; |
|
| 79 |
} |
|
| 80 |
} |
|
| 81 |
} |
|
| 82 |
if(isset($FILE)) {
|
|
| 83 |
foreach($FILE AS $name) {
|
|
| 84 |
$temp_id++; |
|
| 85 |
if($file_id == $temp_id) {
|
|
| 86 |
$rename_file = $name; |
|
| 87 |
$type = 'file'; |
|
| 88 |
} |
|
| 89 |
} |
|
| 90 |
} |
|
| 91 |
} |
|
| 92 |
|
|
| 93 |
if(!isset($rename_file)) {
|
|
| 94 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false); |
|
| 95 |
} |
|
| 96 |
|
|
| 97 |
// Check if they entered a new name |
|
| 98 |
if(media_filename($admin->get_post('name')) == "") {
|
|
| 99 |
$admin->print_error($MESSAGE['MEDIA']['BLANK_NAME'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 100 |
} else {
|
|
| 101 |
$old_name = $admin->get_post('old_name');
|
|
| 102 |
$new_name = media_filename($admin->get_post('name'));
|
|
| 103 |
} |
|
| 104 |
|
|
| 105 |
// Check if they entered an extension |
|
| 106 |
if($type == 'file') {
|
|
| 107 |
if(media_filename($admin->get_post('extension')) == "") {
|
|
| 108 |
$admin->print_error($MESSAGE['MEDIA']['BLANK_EXTENSION'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 109 |
} else {
|
|
| 110 |
$extension = media_filename($admin->get_post('extension'));
|
|
| 111 |
} |
|
| 112 |
} else {
|
|
| 113 |
$extension = ''; |
|
| 114 |
} |
|
| 115 |
|
|
| 116 |
// Join new name and extension |
|
| 117 |
$name = $new_name.$extension; |
|
| 118 |
|
|
| 119 |
// Check if the name contains .. |
|
| 120 |
if(strstr($name, '..')) {
|
|
| 121 |
$admin->print_error($MESSAGE['MEDIA']['NAME_DOT_DOT_SLASH'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 122 |
} |
|
| 123 |
|
|
| 124 |
// Check if the name is index.php |
|
| 125 |
if($name == 'index.php') {
|
|
| 126 |
$admin->print_error($MESSAGE['MEDIA']['NAME_INDEX_PHP'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 127 |
} |
|
| 128 |
|
|
| 129 |
// Check that the name still has a value |
|
| 130 |
if($name == '') {
|
|
| 131 |
$admin->print_error($MESSAGE['MEDIA']['BLANK_NAME'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 132 |
} |
|
| 133 |
|
|
| 134 |
// Check if we should overwrite or not |
|
| 135 |
if($admin->get_post('overwrite') != 'yes' AND file_exists(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name) == true) {
|
|
| 136 |
if($type == 'folder') {
|
|
| 137 |
$admin->print_error($MESSAGE['MEDIA']['DIR_EXISTS'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 138 |
} else {
|
|
| 139 |
$admin->print_error($MESSAGE['MEDIA']['FILE_EXISTS'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 140 |
} |
|
| 141 |
} |
|
| 142 |
|
|
| 143 |
// Try and rename the file/folder |
|
| 144 |
if(rename(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$rename_file, WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name)) {
|
|
| 145 |
$admin->print_success($MESSAGE['MEDIA']['RENAMED'], "browse.php?dir=$directory"); |
|
| 146 |
} else {
|
|
| 147 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_RENAME'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 148 |
} |
|
| 149 |
|
|
| 150 |
?> |
|
| 63 |
$DIR[] = $file; |
|
| 64 |
} |
|
| 65 |
} else {
|
|
| 66 |
$FILE[] = $file; |
|
| 67 |
} |
|
| 68 |
} |
|
| 69 |
} |
|
| 70 |
$temp_id = 0; |
|
| 71 |
if(isset($DIR)) {
|
|
| 72 |
foreach($DIR AS $name) {
|
|
| 73 |
$temp_id++; |
|
| 74 |
if($file_id == $temp_id) {
|
|
| 75 |
$rename_file = $name; |
|
| 76 |
$type = 'folder'; |
|
| 77 |
} |
|
| 78 |
} |
|
| 79 |
} |
|
| 80 |
if(isset($FILE)) {
|
|
| 81 |
foreach($FILE AS $name) {
|
|
| 82 |
$temp_id++; |
|
| 83 |
if($file_id == $temp_id) {
|
|
| 84 |
$rename_file = $name; |
|
| 85 |
$type = 'file'; |
|
| 86 |
} |
|
| 87 |
} |
|
| 88 |
} |
|
| 89 |
} |
|
| 90 |
|
|
| 91 |
if(!isset($rename_file)) {
|
|
| 92 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false); |
|
| 93 |
} |
|
| 94 |
|
|
| 95 |
// Check if they entered a new name |
|
| 96 |
if(media_filename($admin->get_post('name')) == "") {
|
|
| 97 |
$admin->print_error($MESSAGE['MEDIA']['BLANK_NAME'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 98 |
} else {
|
|
| 99 |
$old_name = $admin->get_post('old_name');
|
|
| 100 |
$new_name = media_filename($admin->get_post('name'));
|
|
| 101 |
} |
|
| 102 |
|
|
| 103 |
// Check if they entered an extension |
|
| 104 |
if($type == 'file') {
|
|
| 105 |
if(media_filename($admin->get_post('extension')) == "") {
|
|
| 106 |
$admin->print_error($MESSAGE['MEDIA']['BLANK_EXTENSION'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 107 |
} else {
|
|
| 108 |
$extension = media_filename($admin->get_post('extension'));
|
|
| 109 |
} |
|
| 110 |
} else {
|
|
| 111 |
$extension = ''; |
|
| 112 |
} |
|
| 113 |
|
|
| 114 |
// Join new name and extension |
|
| 115 |
$name = $new_name.$extension; |
|
| 116 |
|
|
| 117 |
// Check if the name contains .. |
|
| 118 |
if(strstr($name, '..')) {
|
|
| 119 |
$admin->print_error($MESSAGE['MEDIA']['NAME_DOT_DOT_SLASH'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 120 |
} |
|
| 121 |
|
|
| 122 |
// Check if the name is index.php |
|
| 123 |
if($name == 'index.php') {
|
|
| 124 |
$admin->print_error($MESSAGE['MEDIA']['NAME_INDEX_PHP'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 125 |
} |
|
| 126 |
|
|
| 127 |
// Check that the name still has a value |
|
| 128 |
if($name == '') {
|
|
| 129 |
$admin->print_error($MESSAGE['MEDIA']['BLANK_NAME'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 130 |
} |
|
| 131 |
|
|
| 132 |
// Check if we should overwrite or not |
|
| 133 |
if($admin->get_post('overwrite') != 'yes' AND file_exists(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name) == true) {
|
|
| 134 |
if($type == 'folder') {
|
|
| 135 |
$admin->print_error($MESSAGE['MEDIA']['DIR_EXISTS'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 136 |
} else {
|
|
| 137 |
$admin->print_error($MESSAGE['MEDIA']['FILE_EXISTS'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 138 |
} |
|
| 139 |
} |
|
| 140 |
|
|
| 141 |
// Try and rename the file/folder |
|
| 142 |
if(rename(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$rename_file, WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$name)) {
|
|
| 143 |
$admin->print_success($MESSAGE['MEDIA']['RENAMED'], "browse.php?dir=$directory"); |
|
| 144 |
} else {
|
|
| 145 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_RENAME'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 146 |
} |
|
| 147 |
|
|
| 148 |
?> |
|
| trunk/wb/admin/media/browse.php | ||
|---|---|---|
| 27 | 27 |
require('../../config.php');
|
| 28 | 28 |
require_once(WB_PATH.'/framework/class.admin.php'); |
| 29 | 29 |
$admin = new admin('Media', 'media', false);
|
| 30 |
|
|
| 31 |
// Include the WB functions file |
|
| 32 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 33 | 30 |
|
| 31 |
// Include the WB functions file |
|
| 32 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 33 |
|
|
| 34 | 34 |
// Setup template object |
| 35 | 35 |
$template = new Template(ADMIN_PATH.'/media'); |
| 36 | 36 |
$template->set_file('page', 'browse.html');
|
| ... | ... | |
| 70 | 70 |
'DISPLAY_UP_ARROW' => $display_up_arrow |
| 71 | 71 |
) |
| 72 | 72 |
); |
| 73 |
|
|
| 74 |
// Get home folder not to show |
|
| 75 |
$home_folders = get_home_folders(); |
|
| 76 |
|
|
| 73 |
|
|
| 74 |
// Get home folder not to show
|
|
| 75 |
$home_folders = get_home_folders();
|
|
| 76 |
|
|
| 77 | 77 |
// Generate list |
| 78 | 78 |
$template->set_block('main_block', 'list_block', 'list');
|
| 79 | 79 |
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
|
| 80 | 80 |
// Loop through the files and dirs an add to list |
| 81 | 81 |
while(false !== ($file = readdir($handle))) {
|
| 82 |
if(substr($file, 0, 1) != '.' AND $file != 'CVS' AND $file != 'index.php') {
|
|
| 83 |
if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
|
|
| 82 |
if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
|
|
| 83 |
if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
|
|
| 84 | 84 |
if(!isset($home_folders[$directory.'/'.$file])) {
|
| 85 |
$DIR[] = $file; |
|
| 85 |
$DIR[] = $file;
|
|
| 86 | 86 |
} |
| 87 | 87 |
} else {
|
| 88 | 88 |
$FILE[] = $file; |
| ... | ... | |
| 171 | 171 |
$template->parse('main', 'main_block', false);
|
| 172 | 172 |
$template->pparse('output', 'page');
|
| 173 | 173 |
|
| 174 |
?> |
|
| 174 |
?> |
|
| trunk/wb/admin/media/delete.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: delete.php,v 1.5 2005/04/04 00:56:30 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 |
// Create admin object |
|
| 27 |
require('../../config.php');
|
|
| 28 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 29 |
$admin = new admin('Media', 'media_delete', false);
|
|
| 30 |
|
|
| 31 |
// Include the WB functions file |
|
| 32 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 33 |
|
|
| 34 |
// Include the stripped-down header file |
|
| 35 |
require('basic_header.html');
|
|
| 36 |
|
|
| 37 |
// Get the current dir |
|
| 38 |
$directory = $admin->get_get('dir');
|
|
| 39 |
if($directory == '/') {
|
|
| 40 |
$directory = ''; |
|
| 41 |
} |
|
| 42 |
// Check to see if it contains ../ |
|
| 43 |
if(strstr($directory, '../')) {
|
|
| 44 |
$admin->print_header(); |
|
| 45 |
$admin->print_error($MESSAGE['MEDIA']['DOT_DOT_SLASH']); |
|
| 46 |
} |
|
| 47 |
|
|
| 48 |
// Get the temp id |
|
| 49 |
if(!is_numeric($admin->get_get('id'))) {
|
|
| 50 |
header("Location: browse.php?dir=$directory");
|
|
| 51 |
} else {
|
|
| 52 |
$file_id = $admin->get_get('id');
|
|
| 53 |
} |
|
| 54 |
|
|
| 55 |
// Get home folder not to show |
|
| 56 |
$home_folders = get_home_folders(); |
|
| 57 |
|
|
| 58 |
// Figure out what folder name the temp id is |
|
| 1 |
<?php
|
|
| 2 |
|
|
| 3 |
// $Id: delete.php,v 1.5 2005/04/04 00:56:30 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 |
// Create admin object
|
|
| 27 |
require('../../config.php');
|
|
| 28 |
require_once(WB_PATH.'/framework/class.admin.php');
|
|
| 29 |
$admin = new admin('Media', 'media_delete', false);
|
|
| 30 |
|
|
| 31 |
// Include the WB functions file
|
|
| 32 |
require_once(WB_PATH.'/framework/functions.php');
|
|
| 33 |
|
|
| 34 |
// Include the stripped-down header file
|
|
| 35 |
require('basic_header.html');
|
|
| 36 |
|
|
| 37 |
// Get the current dir
|
|
| 38 |
$directory = $admin->get_get('dir');
|
|
| 39 |
if($directory == '/') {
|
|
| 40 |
$directory = '';
|
|
| 41 |
}
|
|
| 42 |
// Check to see if it contains ../
|
|
| 43 |
if(strstr($directory, '../')) {
|
|
| 44 |
$admin->print_header();
|
|
| 45 |
$admin->print_error($MESSAGE['MEDIA']['DOT_DOT_SLASH']);
|
|
| 46 |
}
|
|
| 47 |
|
|
| 48 |
// Get the temp id
|
|
| 49 |
if(!is_numeric($admin->get_get('id'))) {
|
|
| 50 |
header("Location: browse.php?dir=$directory");
|
|
| 51 |
} else {
|
|
| 52 |
$file_id = $admin->get_get('id');
|
|
| 53 |
}
|
|
| 54 |
|
|
| 55 |
// Get home folder not to show
|
|
| 56 |
$home_folders = get_home_folders();
|
|
| 57 |
|
|
| 58 |
// Figure out what folder name the temp id is
|
|
| 59 | 59 |
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
|
| 60 |
// Loop through the files and dirs an add to list |
|
| 60 |
// Loop through the files and dirs an add to list
|
|
| 61 | 61 |
while (false !== ($file = readdir($handle))) {
|
| 62 |
if(substr($file, 0, 1) != '.' AND $file != 'CVS' AND $file != 'index.php') {
|
|
| 63 |
if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
|
|
| 62 |
if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
|
|
| 63 |
if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
|
|
| 64 | 64 |
if(!isset($home_folders[$directory.'/'.$file])) {
|
| 65 |
$DIR[] = $file; |
|
| 66 |
} |
|
| 67 |
} else {
|
|
| 68 |
$FILE[] = $file; |
|
| 69 |
} |
|
| 70 |
} |
|
| 71 |
} |
|
| 72 |
$temp_id = 0; |
|
| 73 |
if(isset($DIR)) {
|
|
| 74 |
foreach($DIR AS $name) {
|
|
| 75 |
$temp_id++; |
|
| 76 |
if(!isset($delete_file) AND $file_id == $temp_id) {
|
|
| 77 |
$delete_file = $name; |
|
| 78 |
$type = 'folder'; |
|
| 79 |
} |
|
| 80 |
} |
|
| 81 |
} |
|
| 82 |
if(isset($FILE)) {
|
|
| 83 |
foreach($FILE AS $name) {
|
|
| 84 |
$temp_id++; |
|
| 85 |
if(!isset($delete_file) AND $file_id == $temp_id) {
|
|
| 86 |
$delete_file = $name; |
|
| 87 |
$type = 'file'; |
|
| 88 |
} |
|
| 89 |
} |
|
| 90 |
} |
|
| 91 |
} |
|
| 92 |
|
|
| 93 |
// Check to see if we could find an id to match |
|
| 94 |
if(!isset($delete_file)) {
|
|
| 95 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false); |
|
| 96 |
} |
|
| 97 |
$relative_path = WB_PATH.MEDIA_DIRECTORY.'/'.$directory.'/'.$delete_file; |
|
| 98 |
// Check if the file/folder exists |
|
| 99 |
if(!file_exists($relative_path)) {
|
|
| 100 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false); |
|
| 101 |
} |
|
| 102 |
|
|
| 103 |
// Find out whether its a file or folder |
|
| 104 |
if($type == 'folder') {
|
|
| 105 |
// Try and delete the directory |
|
| 106 |
if(rm_full_dir($relative_path)) {
|
|
| 107 |
$admin->print_success($MESSAGE['MEDIA']['DELETED_DIR'], "browse.php?dir=$directory"); |
|
| 108 |
} else {
|
|
| 109 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_DIR'], "browse.php?dir=$directory", false); |
|
| 110 |
} |
|
| 111 |
} else {
|
|
| 112 |
// Try and delete the file |
|
| 113 |
if(unlink($relative_path)) {
|
|
| 114 |
$admin->print_success($MESSAGE['MEDIA']['DELETED_FILE'], "browse.php?dir=$directory"); |
|
| 115 |
} else {
|
|
| 116 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_FILE'], "browse.php?dir=$directory", false); |
|
| 117 |
} |
|
| 118 |
} |
|
| 119 |
|
|
| 120 |
?> |
|
| 65 |
$DIR[] = $file; |
|
| 66 |
} |
|
| 67 |
} else {
|
|
| 68 |
$FILE[] = $file; |
|
| 69 |
} |
|
| 70 |
} |
|
| 71 |
} |
|
| 72 |
$temp_id = 0; |
|
| 73 |
if(isset($DIR)) {
|
|
| 74 |
foreach($DIR AS $name) {
|
|
| 75 |
$temp_id++; |
|
| 76 |
if(!isset($delete_file) AND $file_id == $temp_id) {
|
|
| 77 |
$delete_file = $name; |
|
| 78 |
$type = 'folder'; |
|
| 79 |
} |
|
| 80 |
} |
|
| 81 |
} |
|
| 82 |
if(isset($FILE)) {
|
|
| 83 |
foreach($FILE AS $name) {
|
|
| 84 |
$temp_id++; |
|
| 85 |
if(!isset($delete_file) AND $file_id == $temp_id) {
|
|
| 86 |
$delete_file = $name; |
|
| 87 |
$type = 'file'; |
|
| 88 |
} |
|
| 89 |
} |
|
| 90 |
} |
|
| 91 |
} |
|
| 92 |
|
|
| 93 |
// Check to see if we could find an id to match |
|
| 94 |
if(!isset($delete_file)) {
|
|
| 95 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false); |
|
| 96 |
} |
|
| 97 |
$relative_path = WB_PATH.MEDIA_DIRECTORY.'/'.$directory.'/'.$delete_file; |
|
| 98 |
// Check if the file/folder exists |
|
| 99 |
if(!file_exists($relative_path)) {
|
|
| 100 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false); |
|
| 101 |
} |
|
| 102 |
|
|
| 103 |
// Find out whether its a file or folder |
|
| 104 |
if($type == 'folder') {
|
|
| 105 |
// Try and delete the directory |
|
| 106 |
if(rm_full_dir($relative_path)) {
|
|
| 107 |
$admin->print_success($MESSAGE['MEDIA']['DELETED_DIR'], "browse.php?dir=$directory"); |
|
| 108 |
} else {
|
|
| 109 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_DIR'], "browse.php?dir=$directory", false); |
|
| 110 |
} |
|
| 111 |
} else {
|
|
| 112 |
// Try and delete the file |
|
| 113 |
if(unlink($relative_path)) {
|
|
| 114 |
$admin->print_success($MESSAGE['MEDIA']['DELETED_FILE'], "browse.php?dir=$directory"); |
|
| 115 |
} else {
|
|
| 116 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_FILE'], "browse.php?dir=$directory", false); |
|
| 117 |
} |
|
| 118 |
} |
|
| 119 |
|
|
| 120 |
?> |
|
| trunk/wb/admin/media/rename.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: rename.php,v 1.4 2005/04/04 00:56:30 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 |
// Create admin object |
|
| 27 |
require('../../config.php');
|
|
| 28 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 29 |
$admin = new admin('Media', 'media_rename', false);
|
|
| 30 |
|
|
| 31 |
// Include the WB functions file |
|
| 32 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 33 |
|
|
| 34 |
// Include the basic header file |
|
| 35 |
require(ADMIN_PATH.'/media/basic_header.html'); |
|
| 36 |
|
|
| 37 |
// Get the current dir |
|
| 38 |
$directory = $admin->get_get('dir');
|
|
| 39 |
if($directory == '/') {
|
|
| 40 |
$directory = ''; |
|
| 41 |
} |
|
| 42 |
// Check to see if it contains ../ |
|
| 43 |
if(strstr($directory, '../')) {
|
|
| 44 |
$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH'], "rename.php?dir=$directory&id=$file_id", false); |
|
| 45 |
} |
|
| 46 |
|
|
| 47 |
// Get the temp id |
|
| 48 |
if(!is_numeric($admin->get_get('id'))) {
|
|
| 49 |
header("Location: browse.php?dir=$directory");
|
|
| 50 |
} else {
|
|
| 51 |
$file_id = $admin->get_get('id');
|
|
| 52 |
} |
|
| 53 |
|
|
| 54 |
// Get home folder not to show |
|
| 55 |
$home_folders = get_home_folders(); |
|
| 56 |
|
|
| 57 |
// Figure out what folder name the temp id is |
|
| 1 |
<?php
|
|
| 2 |
|
|
| 3 |
// $Id: rename.php,v 1.4 2005/04/04 00:56:30 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 |
// Create admin object
|
|
| 27 |
require('../../config.php');
|
|
| 28 |
require_once(WB_PATH.'/framework/class.admin.php');
|
|
| 29 |
$admin = new admin('Media', 'media_rename', false);
|
|
| 30 |
|
|
| 31 |
// Include the WB functions file
|
|
| 32 |
require_once(WB_PATH.'/framework/functions.php');
|
|
| 33 |
|
|
| 34 |
// Include the basic header file
|
|
| 35 |
require(ADMIN_PATH.'/media/basic_header.html');
|
|
| 36 |
|
|
| 37 |
// Get the current dir
|
|
| 38 |
$directory = $admin->get_get('dir');
|
|
| 39 |
if($directory == '/') {
|
|
| 40 |
$directory = '';
|
|
| 41 |
}
|
|
| 42 |
// Check to see if it contains ../
|
|
| 43 |
if(strstr($directory, '../')) {
|
|
| 44 |
$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH'], "rename.php?dir=$directory&id=$file_id", false);
|
|
| 45 |
}
|
|
| 46 |
|
|
| 47 |
// Get the temp id
|
|
| 48 |
if(!is_numeric($admin->get_get('id'))) {
|
|
| 49 |
header("Location: browse.php?dir=$directory");
|
|
| 50 |
} else {
|
|
| 51 |
$file_id = $admin->get_get('id');
|
|
| 52 |
}
|
|
| 53 |
|
|
| 54 |
// Get home folder not to show
|
|
| 55 |
$home_folders = get_home_folders();
|
|
| 56 |
|
|
| 57 |
// Figure out what folder name the temp id is
|
|
| 58 | 58 |
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
|
| 59 |
// Loop through the files and dirs an add to list |
|
| 59 |
// Loop through the files and dirs an add to list
|
|
| 60 | 60 |
while (false !== ($file = readdir($handle))) {
|
| 61 |
if(substr($file, 0, 1) != '.' AND $file != 'CVS' AND $file != 'index.php') {
|
|
| 62 |
if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
|
|
| 61 |
if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
|
|
| 62 |
if(is_dir(WB_PATH.MEDIA_DIRECTORY.$directory.'/'.$file)) {
|
|
| 63 | 63 |
if(!isset($home_folders[$directory.'/'.$file])) {
|
| 64 |
$DIR[] = $file; |
|
| 65 |
} |
|
| 66 |
} else {
|
|
| 67 |
$FILE[] = $file; |
|
| 68 |
} |
|
| 69 |
} |
|
| 70 |
} |
|
| 71 |
$temp_id = 0; |
|
| 72 |
if(isset($DIR)) {
|
|
| 73 |
foreach($DIR AS $name) {
|
|
| 74 |
$temp_id++; |
|
| 75 |
if($file_id == $temp_id) {
|
|
| 76 |
$rename_file = $name; |
|
| 77 |
$type = 'folder'; |
|
| 78 |
} |
|
| 79 |
} |
|
| 80 |
} |
|
| 81 |
if(isset($FILE)) {
|
|
| 82 |
foreach($FILE AS $name) {
|
|
| 83 |
$temp_id++; |
|
| 84 |
if($file_id == $temp_id) {
|
|
| 85 |
$rename_file = $name; |
|
| 86 |
$type = 'file'; |
|
| 87 |
} |
|
| 88 |
} |
|
| 89 |
} |
|
| 90 |
} |
|
| 91 |
|
|
| 92 |
if(!isset($rename_file)) {
|
|
| 93 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false); |
|
| 94 |
} |
|
| 95 |
|
|
| 96 |
// Setup template object |
|
| 97 |
$template = new Template(ADMIN_PATH.'/media'); |
|
| 98 |
$template->set_file('page', 'rename.html');
|
|
| 99 |
$template->set_block('page', 'main_block', 'main');
|
|
| 100 |
//echo WB_PATH.'/media/'.$directory.'/'.$rename_file; |
|
| 101 |
if($type == 'folder') {
|
|
| 102 |
$template->set_var('DISPlAY_EXTENSION', 'hide');
|
|
| 103 |
$extension = ''; |
|
| 104 |
} else {
|
|
| 105 |
$template->set_var('DISPlAY_EXTENSION', '');
|
|
| 106 |
$extension = strstr($rename_file, '.'); |
|
| 107 |
} |
|
| 108 |
|
|
| 109 |
if($type == 'folder') {
|
|
| 110 |
$type = $TEXT['FOLDER']; |
|
| 111 |
} else {
|
|
| 112 |
$type = $TEXT['FILE']; |
|
| 113 |
} |
|
| 114 |
|
|
| 115 |
$template->set_var(array( |
|
| 116 |
'FILENAME' => $rename_file, |
|
| 117 |
'DIR' => $directory, |
|
| 118 |
'FILE_ID' => $file_id, |
|
| 119 |
'TYPE' => $type, |
|
| 120 |
'EXTENSION' => $extension |
|
| 121 |
) |
|
| 122 |
); |
|
| 123 |
|
|
| 124 |
|
|
| 125 |
// Insert language text and messages |
|
| 126 |
$template->set_var(array( |
|
| 127 |
'TEXT_TO' => $TEXT['TO'], |
|
| 128 |
'TEXT_RENAME' => $TEXT['RENAME'], |
|
| 129 |
'TEXT_CANCEL' => $TEXT['CANCEL'], |
|
| 130 |
'TEXT_UP' => $TEXT['UP'], |
|
| 131 |
'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'] |
|
| 132 |
) |
|
| 133 |
); |
|
| 134 |
|
|
| 135 |
// Parse template object |
|
| 136 |
$template->parse('main', 'main_block', false);
|
|
| 137 |
$template->pparse('output', 'page');
|
|
| 138 |
|
|
| 139 |
?> |
|
| 64 |
$DIR[] = $file; |
|
| 65 |
} |
|
| 66 |
} else {
|
|
| 67 |
$FILE[] = $file; |
|
| 68 |
} |
|
| 69 |
} |
|
| 70 |
} |
|
| 71 |
$temp_id = 0; |
|
| 72 |
if(isset($DIR)) {
|
|
| 73 |
foreach($DIR AS $name) {
|
|
| 74 |
$temp_id++; |
|
| 75 |
if($file_id == $temp_id) {
|
|
| 76 |
$rename_file = $name; |
|
| 77 |
$type = 'folder'; |
|
| 78 |
} |
|
| 79 |
} |
|
| 80 |
} |
|
| 81 |
if(isset($FILE)) {
|
|
| 82 |
foreach($FILE AS $name) {
|
|
| 83 |
$temp_id++; |
|
| 84 |
if($file_id == $temp_id) {
|
|
| 85 |
$rename_file = $name; |
|
| 86 |
$type = 'file'; |
|
| 87 |
} |
|
| 88 |
} |
|
| 89 |
} |
|
| 90 |
} |
|
| 91 |
|
|
| 92 |
if(!isset($rename_file)) {
|
|
| 93 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false); |
|
| 94 |
} |
|
| 95 |
|
|
| 96 |
// Setup template object |
|
| 97 |
$template = new Template(ADMIN_PATH.'/media'); |
|
| 98 |
$template->set_file('page', 'rename.html');
|
|
| 99 |
$template->set_block('page', 'main_block', 'main');
|
|
| 100 |
//echo WB_PATH.'/media/'.$directory.'/'.$rename_file; |
|
| 101 |
if($type == 'folder') {
|
|
| 102 |
$template->set_var('DISPlAY_EXTENSION', 'hide');
|
|
| 103 |
$extension = ''; |
|
| 104 |
} else {
|
|
| 105 |
$template->set_var('DISPlAY_EXTENSION', '');
|
|
| 106 |
$extension = strstr($rename_file, '.'); |
|
| 107 |
} |
|
| 108 |
|
|
| 109 |
if($type == 'folder') {
|
|
| 110 |
$type = $TEXT['FOLDER']; |
|
| 111 |
} else {
|
|
| 112 |
$type = $TEXT['FILE']; |
|
| 113 |
} |
|
| 114 |
|
|
| 115 |
$template->set_var(array( |
|
| 116 |
'FILENAME' => $rename_file, |
|
| 117 |
'DIR' => $directory, |
|
| 118 |
'FILE_ID' => $file_id, |
|
| 119 |
'TYPE' => $type, |
|
| 120 |
'EXTENSION' => $extension |
|
| 121 |
) |
|
| 122 |
); |
|
| 123 |
|
|
| 124 |
|
|
| 125 |
// Insert language text and messages |
|
| 126 |
$template->set_var(array( |
|
| 127 |
'TEXT_TO' => $TEXT['TO'], |
|
| 128 |
'TEXT_RENAME' => $TEXT['RENAME'], |
|
| 129 |
'TEXT_CANCEL' => $TEXT['CANCEL'], |
|
| 130 |
'TEXT_UP' => $TEXT['UP'], |
|
| 131 |
'TEXT_OVERWRITE_EXISTING' => $TEXT['OVERWRITE_EXISTING'] |
|
| 132 |
) |
|
| 133 |
); |
|
| 134 |
|
|
| 135 |
// Parse template object |
|
| 136 |
$template->parse('main', 'main_block', false);
|
|
| 137 |
$template->pparse('output', 'page');
|
|
| 138 |
|
|
| 139 |
?> |
|
| trunk/wb/admin/templates/install.php | ||
|---|---|---|
| 102 | 102 |
$dir = dir($template_dir); |
| 103 | 103 |
while (false !== $entry = $dir->read()) {
|
| 104 | 104 |
// Skip pointers |
| 105 |
if(substr($entry, 0, 1) != '.' AND $entry != 'CVS' AND !is_dir($template_dir.'/'.$entry)) {
|
|
| 105 |
if(substr($entry, 0, 1) != '.' AND $entry != '.svn' AND !is_dir($template_dir.'/'.$entry)) {
|
|
| 106 | 106 |
// Chmod file |
| 107 | 107 |
change_mode($template_dir.'/'.$entry); |
| 108 | 108 |
} |
| ... | ... | |
| 114 | 114 |
// Print admin footer |
| 115 | 115 |
$admin->print_footer(); |
| 116 | 116 |
|
| 117 |
?> |
|
| 117 |
?> |
|
| trunk/wb/admin/templates/index.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: index.php,v 1.2 2005/04/02 06:25:53 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 |
// Print admin header |
|
| 27 |
require('../../config.php');
|
|
| 28 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 29 |
$admin = new admin('Addons', 'templates');
|
|
| 30 |
|
|
| 31 |
// Setup template object |
|
| 32 |
$template = new Template(ADMIN_PATH.'/templates'); |
|
| 33 |
$template->set_file('page', 'template.html');
|
|
| 34 |
$template->set_block('page', 'main_block', 'main');
|
|
| 35 |
|
|
| 36 |
// Insert values into template list |
|
| 37 |
$template->set_block('main_block', 'template_list_block', 'template_list');
|
|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
/* |
|
| 4 |
|
|
| 5 |
Website Baker Project <http://www.websitebaker.org/> |
|
| 6 |
Copyright (C) 2004-2005, Ryan Djurovich |
|
| 7 |
|
|
| 8 |
Website Baker is free software; you can redistribute it and/or modify |
|
| 9 |
it under the terms of the GNU General Public License as published by |
|
| 10 |
the Free Software Foundation; either version 2 of the License, or |
|
| 11 |
(at your option) any later version. |
|
| 12 |
|
|
| 13 |
Website Baker is distributed in the hope that it will be useful, |
|
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 |
GNU General Public License for more details. |
|
| 17 |
|
|
| 18 |
You should have received a copy of the GNU General Public License |
|
| 19 |
along with Website Baker; if not, write to the Free Software |
|
| 20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 21 |
|
|
| 22 |
*/ |
|
| 23 |
|
|
| 24 |
// Print admin header |
|
| 25 |
require('../../config.php');
|
|
| 26 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 27 |
$admin = new admin('Addons', 'templates');
|
|
| 28 |
|
|
| 29 |
// Setup template object |
|
| 30 |
$template = new Template(ADMIN_PATH.'/templates'); |
|
| 31 |
$template->set_file('page', 'template.html');
|
|
| 32 |
$template->set_block('page', 'main_block', 'main');
|
|
| 33 |
|
|
| 34 |
// Insert values into template list |
|
| 35 |
$template->set_block('main_block', 'template_list_block', 'template_list');
|
|
| 38 | 36 |
if($handle = opendir(WB_PATH.'/templates/')) {
|
| 39 | 37 |
while (false !== ($file = readdir($handle))) {
|
| 40 |
if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
|
|
| 41 |
// Include the templates info file |
|
| 42 |
require(WB_PATH.'/templates/'.$file.'/info.php'); |
|
| 43 |
$template->set_var('VALUE', $file);
|
|
| 44 |
$template->set_var('NAME', $template_name);
|
|
| 45 |
$template->parse('template_list', 'template_list_block', true);
|
|
| 46 |
} |
|
| 47 |
} |
|
| 48 |
} |
|
| 49 |
|
|
| 50 |
// Insert permissions values |
|
| 51 |
if($admin->get_permission('templates_install') != true) {
|
|
| 52 |
$template->set_var('DISPLAY_INSTALL', 'hide');
|
|
| 53 |
} |
|
| 54 |
if($admin->get_permission('templates_uninstall') != true) {
|
|
| 55 |
$template->set_var('DISPLAY_UNINSTALL', 'hide');
|
|
| 56 |
} |
|
| 57 |
if($admin->get_permission('templates_view') != true) {
|
|
| 58 |
$template->set_var('DISPLAY_LIST', 'hide');
|
|
| 59 |
} |
|
| 60 |
|
|
| 61 |
// Insert language headings |
|
| 62 |
$template->set_var(array( |
|
| 63 |
'HEADING_INSTALL_TEMPLATE' => $HEADING['INSTALL_TEMPLATE'], |
|
| 64 |
'HEADING_UNINSTALL_TEMPLATE' => $HEADING['UNINSTALL_TEMPLATE'], |
|
| 65 |
'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS'] |
|
| 66 |
) |
|
| 67 |
); |
|
| 68 |
// Insert language text and messages |
|
| 69 |
$template->set_var(array( |
|
| 70 |
'TEXT_INSTALL' => $TEXT['INSTALL'], |
|
| 71 |
'TEXT_UNINSTALL' => $TEXT['UNINSTALL'], |
|
| 72 |
'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'], |
|
| 73 |
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'], |
|
| 74 |
'CHANGE_TEMPLATE_NOTICE' => $MESSAGE['TEMPLATES']['CHANGE_TEMPLATE_NOTICE'] |
|
| 75 |
) |
|
| 76 |
); |
|
| 77 |
|
|
| 78 |
// Parse template object |
|
| 79 |
$template->parse('main', 'main_block', false);
|
|
| 80 |
$template->pparse('output', 'page');
|
|
| 81 |
|
|
| 82 |
// Print admin footer |
|
| 83 |
$admin->print_footer(); |
|
| 84 |
|
|
| 85 |
?> |
|
| 38 |
if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
|
|
| 39 |
// Include the templates info file |
|
| 40 |
require(WB_PATH.'/templates/'.$file.'/info.php'); |
|
| 41 |
$template->set_var('VALUE', $file);
|
|
| 42 |
$template->set_var('NAME', $template_name);
|
|
| 43 |
$template->parse('template_list', 'template_list_block', true);
|
|
| 44 |
} |
|
| 45 |
} |
|
| 46 |
} |
|
| 47 |
|
|
| 48 |
// Insert permissions values |
|
| 49 |
if($admin->get_permission('templates_install') != true) {
|
|
| 50 |
$template->set_var('DISPLAY_INSTALL', 'hide');
|
|
| 51 |
} |
|
| 52 |
if($admin->get_permission('templates_uninstall') != true) {
|
|
| 53 |
$template->set_var('DISPLAY_UNINSTALL', 'hide');
|
|
| 54 |
} |
|
| 55 |
if($admin->get_permission('templates_view') != true) {
|
|
| 56 |
$template->set_var('DISPLAY_LIST', 'hide');
|
|
| 57 |
} |
|
| 58 |
|
|
| 59 |
// Insert language headings |
|
| 60 |
$template->set_var(array( |
|
| 61 |
'HEADING_INSTALL_TEMPLATE' => $HEADING['INSTALL_TEMPLATE'], |
|
| 62 |
'HEADING_UNINSTALL_TEMPLATE' => $HEADING['UNINSTALL_TEMPLATE'], |
|
| 63 |
'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS'] |
|
| 64 |
) |
|
| 65 |
); |
|
| 66 |
// Insert language text and messages |
|
| 67 |
$template->set_var(array( |
|
| 68 |
'TEXT_INSTALL' => $TEXT['INSTALL'], |
|
| 69 |
'TEXT_UNINSTALL' => $TEXT['UNINSTALL'], |
|
| 70 |
'TEXT_VIEW_DETAILS' => $TEXT['VIEW_DETAILS'], |
|
| 71 |
'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'], |
|
| 72 |
'CHANGE_TEMPLATE_NOTICE' => $MESSAGE['TEMPLATES']['CHANGE_TEMPLATE_NOTICE'] |
|
| 73 |
) |
|
| 74 |
); |
|
| 75 |
|
|
| 76 |
// Parse template object |
|
| 77 |
$template->parse('main', 'main_block', false);
|
|
| 78 |
$template->pparse('output', 'page');
|
|
| 79 |
|
|
| 80 |
// Print admin footer |
|
| 81 |
$admin->print_footer(); |
|
| 82 |
|
|
| 83 |
?> |
|
| trunk/wb/admin/pages/settings.php | ||
|---|---|---|
| 1 | 1 |
<?php |
| 2 | 2 |
|
| 3 |
// $Id: settings.php,v 1.9 2005/04/08 07:36:58 rdjurovich Exp $ |
|
| 4 |
|
|
| 5 | 3 |
/* |
| 6 | 4 |
|
| 7 | 5 |
Website Baker Project <http://www.websitebaker.org/> |
| ... | ... | |
| 294 | 292 |
$template->set_block('main_block', 'template_list_block', 'template_list');
|
| 295 | 293 |
if($handle = opendir(WB_PATH.'/templates/')) {
|
| 296 | 294 |
while(false !== ($file = readdir($handle))) {
|
| 297 |
if($file != "." AND $file != ".." AND $file != "CVS" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH.'/templates/'.$file.'/info.php')) {
|
|
| 295 |
if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH.'/templates/'.$file.'/info.php')) {
|
|
| 298 | 296 |
// Include the templates info file |
| 299 | 297 |
require(WB_PATH.'/templates/'.$file.'/info.php'); |
| 300 | 298 |
// Check if the user has perms to use this template |
| ... | ... | |
| 349 | 347 |
if($handle = opendir(WB_PATH.'/languages/')) {
|
| 350 | 348 |
$template->set_block('main_block', 'language_list_block', 'language_list');
|
| 351 | 349 |
while (false !== ($file = readdir($handle))) {
|
| 352 |
if($file != '.' AND $file != '..' AND $file != 'CVS' AND $file != 'index.php') {
|
|
| 350 |
if($file != '.' AND $file != '..' AND $file != '.svn' AND $file != 'index.php') {
|
|
| 353 | 351 |
// Include the languages info file |
| 354 | 352 |
require(WB_PATH.'/languages/'.$file); |
| 355 | 353 |
// Work-out if this language is selected |
| trunk/wb/admin/pages/index.php | ||
|---|---|---|
| 1 |
<?php |
|
| 2 |
|
|
| 3 |
// $Id: index.php,v 1.9 2005/04/08 07:36:58 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 |
require('../../config.php');
|
|
| 27 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 28 |
$admin = new admin('Pages', 'pages');
|
|
| 29 |
|
|
| 30 |
// Include the WB functions file |
|
| 31 |
require_once(WB_PATH.'/framework/functions.php'); |
|
| 32 |
|
|
| 33 |
?> |
|
| 34 |
<script type="text/javascript" language="javascript"> |
|
| 35 |
function toggle_viewers() {
|
|
| 36 |
if(document.add.visibility.value == 'private') {
|
|
| 37 |
document.getElementById('private_viewers').style.display = 'block';
|
|
| 38 |
document.getElementById('registered_viewers').style.display = 'none';
|
|
| 39 |
} else if(document.add.visibility.value == 'registered') {
|
|
| 40 |
document.getElementById('private_viewers').style.display = 'none';
|
|
| 41 |
document.getElementById('registered_viewers').style.display = 'block';
|
|
| 42 |
} else {
|
|
| 43 |
document.getElementById('private_viewers').style.display = 'none';
|
|
| 44 |
document.getElementById('registered_viewers').style.display = 'none';
|
|
| 45 |
} |
|
| 46 |
} |
|
| 47 |
function toggle_visibility(id){
|
|
| 48 |
if(document.getElementById(id).style.display == "block") {
|
|
| 49 |
document.getElementById(id).style.display = "none"; |
|
| 50 |
} else {
|
|
| 51 |
document.getElementById(id).style.display = "block"; |
|
| 52 |
} |
|
| 53 |
} |
|
| 54 |
var plus = new Image; |
|
| 55 |
plus.src = "<?php echo ADMIN_URL; ?>/images/plus_16.png"; |
|
| 56 |
var minus = new Image; |
|
| 57 |
minus.src = "<?php echo ADMIN_URL; ?>/images/minus_16.png"; |
|
| 58 |
function toggle_plus_minus(id) {
|
|
| 59 |
var img_src = document.images['plus_minus_' + id].src; |
|
| 60 |
if(img_src == plus.src) {
|
|
| 61 |
document.images['plus_minus_' + id].src = minus.src; |
|
| 62 |
} else {
|
|
| 63 |
document.images['plus_minus_' + id].src = plus.src; |
|
| 64 |
} |
|
| 65 |
} |
|
| 66 |
</script> |
|
| 67 |
|
|
| 68 |
<style type="text/css"> |
|
| 69 |
.pages_list img {
|
|
| 70 |
display: block; |
|
| 71 |
} |
|
| 72 |
ul, li {
|
|
| 73 |
list-style: none; |
|
| 74 |
margin: 0; |
|
| 75 |
padding: 0; |
|
| 76 |
} |
|
| 77 |
.page_list {
|
|
| 78 |
display: none; |
|
| 79 |
} |
|
| 80 |
</style> |
|
| 81 |
|
|
| 82 |
<noscript> |
|
| 83 |
<style type="text/css"> |
|
| 84 |
.page_list {
|
|
| 85 |
display: block; |
|
| 86 |
} |
|
| 87 |
</style> |
|
| 88 |
</noscript> |
|
| 89 |
<?php |
|
| 90 |
|
|
| 91 |
function make_list($parent, $editable_pages) {
|
|
| 92 |
// Get objects and vars from outside this function |
|
| 93 |
global $admin, $template, $database, $TEXT, $MESSAGE; |
|
| 94 |
?> |
|
| 95 |
<ul id="p<?php echo $parent; ?>" <?php if($parent != 0) { echo 'class="page_list"'; } ?>>
|
|
| 96 |
<?php |
|
| 97 |
// Get page list from database |
|
| 98 |
$database = new database(); |
|
| 99 |
if(PAGE_TRASH != 'inline') {
|
|
| 100 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND visibility != 'deleted' ORDER BY position ASC"; |
|
| 101 |
} else {
|
|
| 102 |
$query = "SELECT * FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' ORDER BY position ASC"; |
|
| 103 |
} |
|
| 104 |
$get_pages = $database->query($query); |
|
| 105 |
|
|
| 106 |
// Insert values into main page list |
|
| 107 |
if($get_pages->numRows() > 0) {
|
|
| 108 |
while($page = $get_pages->fetchRow()) {
|
|
| 109 |
// Get user perms |
|
| 110 |
$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
|
|
| 111 |
$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
|
|
| 112 |
if(is_numeric(array_search($admin->get_group_id(), $admin_groups)) OR is_numeric(array_search($admin->get_user_id(), $admin_users))) {
|
|
| 113 |
if($page['visibility'] == 'deleted') {
|
|
| 114 |
if(PAGE_TRASH == 'inline') {
|
|
| 115 |
$can_modify = true; |
|
| 116 |
$editable_pages = $editable_pages+1; |
|
| 117 |
} else {
|
|
| 118 |
$can_modify = false; |
|
| 119 |
} |
|
| 120 |
} elseif($page['visibility'] != 'deleted') {
|
|
| 121 |
$can_modify = true; |
|
| 122 |
$editable_pages = $editable_pages+1; |
|
| 123 |
} |
|
| 124 |
} else {
|
|
| 125 |
$can_modify = false; |
|
| 126 |
} |
|
| 127 |
|
|
| 128 |
// Work out if we should show a plus or not |
|
| 129 |
$get_page_subs = $database->query("SELECT page_id,admin_groups,admin_users FROM ".TABLE_PREFIX."pages WHERE parent = '".$page['page_id']."'");
|
|
| 130 |
if($get_page_subs->numRows() > 0) {
|
|
| 131 |
$display_plus = true; |
|
| 132 |
} else {
|
|
| 133 |
$display_plus = false; |
|
| 134 |
} |
|
| 135 |
|
|
| 136 |
// Work out how many pages there are for this parent |
|
| 137 |
$num_pages = $get_pages->numRows(); |
|
| 138 |
?> |
|
| 139 |
|
|
| 140 |
<li id="p<?php echo $page['parent']; ?>" style="padding: 2px 0px 2px 0px;"> |
|
| 141 |
<table width="720" cellpadding="1" cellspacing="0" border="0" style="background-color: #F0F0F0;"> |
|
| 142 |
<tr> |
|
| 143 |
<td width="20" style="padding-left: <?php echo $page['level']*20; ?>px;"> |
|
| 144 |
<?php |
|
| 145 |
if($display_plus == true) {
|
|
| 146 |
?> |
|
| 147 |
<a href="javascript: toggle_visibility('p<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['EXPAND'].'/'.$TEXT['COLLAPSE']; ?>">
|
|
| 148 |
<img src="<?php echo ADMIN_URL; ?>/images/plus_16.png" onclick="toggle_plus_minus('<?php echo $page['page_id']; ?>');" name="plus_minus_<?php echo $page['page_id']; ?>" border="0" alt="+" />
|
|
| 149 |
</a> |
|
| 150 |
<?php |
|
| 151 |
} |
|
| 152 |
?> |
|
| 153 |
</td> |
|
| 154 |
<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true) { ?>
|
|
| 155 |
<td> |
|
| 156 |
<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"><?php echo stripslashes($page['page_title']); ?></a> |
|
| 157 |
</td> |
|
| 158 |
<?php } else { ?>
|
|
| 159 |
<td> |
|
| 160 |
<?php echo stripslashes($page['page_title']); ?> |
|
| 161 |
</td> |
|
| 162 |
<?php } ?> |
|
| 163 |
<td align="left" width="232"> |
|
| 164 |
<font color="#999999"><?php echo $page['menu_title']; ?></font> |
|
| 165 |
</td> |
|
| 166 |
<td align="center" valign="middle" width="90"> |
|
| 167 |
<?php if($page['visibility'] == 'public') { ?>
|
|
| 168 |
<img src="<?php echo ADMIN_URL; ?>/images/visible_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PUBLIC']; ?>" border="0" /> |
|
| 169 |
<?php } elseif($page['visibility'] == 'private') { ?>
|
|
| 170 |
<img src="<?php echo ADMIN_URL; ?>/images/private_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['PRIVATE']; ?>" border="0" /> |
|
| 171 |
<?php } elseif($page['visibility'] == 'registered') { ?>
|
|
| 172 |
<img src="<?php echo ADMIN_URL; ?>/images/keys_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['REGISTERED']; ?>" border="0" /> |
|
| 173 |
<?php } elseif($page['visibility'] == 'hidden') { ?>
|
|
| 174 |
<img src="<?php echo ADMIN_URL; ?>/images/hidden_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['HIDDEN']; ?>" border="0" /> |
|
| 175 |
<?php } elseif($page['visibility'] == 'none') { ?>
|
|
| 176 |
<img src="<?php echo ADMIN_URL; ?>/images/none_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['NONE']; ?>" border="0" /> |
|
| 177 |
<?php } elseif($page['visibility'] == 'deleted') { ?>
|
|
| 178 |
<img src="<?php echo ADMIN_URL; ?>/images/deleted_16.png" alt="<?php echo $TEXT['VISIBILITY']; ?>: <?php echo $TEXT['DELETED']; ?>" border="0" /> |
|
| 179 |
<?php } ?> |
|
| 180 |
</td> |
|
| 181 |
<td width="20"> |
|
| 182 |
<?php if($page['visibility'] != 'deleted') { ?>
|
|
| 183 |
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
|
| 184 |
<a href="<?php echo ADMIN_URL; ?>/pages/settings.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['SETTINGS']; ?>"> |
|
| 185 |
<img src="<?php echo ADMIN_URL; ?>/images/modify_16.png" border="0" alt="<?php echo $TEXT['SETTINGS']; ?>" /> |
|
| 186 |
</a> |
|
| 187 |
<?php } ?> |
|
| 188 |
<?php } else { ?>
|
|
| 189 |
<a href="<?php echo ADMIN_URL; ?>/pages/restore.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['RESTORE']; ?>"> |
|
| 190 |
<img src="<?php echo ADMIN_URL; ?>/images/restore_16.png" border="0" alt="<?php echo $TEXT['RESTORE']; ?>" /> |
|
| 191 |
</a> |
|
| 192 |
<?php } ?> |
|
| 193 |
</td> |
|
| 194 |
<td width="20"> |
|
| 195 |
<?php if($page['position'] != 1) { ?>
|
|
| 196 |
<?php if($page['visibility'] != 'deleted') { ?>
|
|
| 197 |
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
|
| 198 |
<a href="<?php echo ADMIN_URL; ?>/pages/move_up.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_UP']; ?>"> |
|
| 199 |
<img src="<?php echo ADMIN_URL; ?>/images/up_16.png" border="0" alt="^" /> |
|
| 200 |
</a> |
|
| 201 |
<?php } ?> |
|
| 202 |
<?php } ?> |
|
| 203 |
<?php } ?> |
|
| 204 |
</td> |
|
| 205 |
<td width="20"> |
|
| 206 |
<?php if($page['position'] != $num_pages) { ?>
|
|
| 207 |
<?php if($page['visibility'] != 'deleted') { ?>
|
|
| 208 |
<?php if($admin->get_permission('pages_settings') == true AND $can_modify == true) { ?>
|
|
| 209 |
<a href="<?php echo ADMIN_URL; ?>/pages/move_down.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MOVE_DOWN']; ?>"> |
|
| 210 |
<img src="<?php echo ADMIN_URL; ?>/images/down_16.png" border="0" alt="v" /> |
|
| 211 |
</a> |
|
| 212 |
<?php } ?> |
|
| 213 |
<?php } ?> |
|
| 214 |
<?php } ?> |
|
| 215 |
</td> |
|
| 216 |
<td width="20"> |
|
| 217 |
<?php if($admin->get_permission('pages_delete') == true AND $can_modify == true) { ?>
|
|
| 218 |
<a href="javascript: confirm_link('<?php echo $MESSAGE['PAGES']['DELETE_CONFIRM']; ?>?', '<?php echo ADMIN_URL; ?>/pages/delete.php?page_id=<?php echo $page['page_id']; ?>');" title="<?php echo $TEXT['DELETE']; ?>">
|
|
| 219 |
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" border="0" alt="X" /> |
|
| 220 |
</a> |
|
| 221 |
<?php } ?> |
|
| 222 |
</td> |
|
| 223 |
<td width="20"> |
|
| 224 |
<?php if($page['visibility'] != 'deleted' AND $page['visibility'] != 'none') { ?>
|
|
| 225 |
<a href="<?php echo page_link($page['link']); ?>" target="_blank"> |
|
| 226 |
<img src="<?php echo ADMIN_URL; ?>/images/view_16.png" border="0" alt="<?php echo $TEXT['VIEW']; ?>" /> |
|
| 227 |
</a> |
|
| 228 |
<?php } ?> |
|
| 229 |
</td> |
|
| 230 |
</tr> |
|
| 231 |
</table> |
|
| 232 |
</li> |
|
| 233 |
|
|
| 234 |
<?php |
|
| 235 |
// Get subs |
|
| 236 |
make_list($page['page_id'], $editable_pages); |
|
| 237 |
} |
|
| 238 |
|
|
| 239 |
} |
|
| 240 |
?> |
|
| 241 |
</ul> |
|
| 242 |
<?php |
|
| 243 |
return $editable_pages; |
|
| 244 |
} |
|
| 245 |
|
|
| 246 |
// Generate pages list |
|
| 247 |
if($admin->get_permission('pages_view') == true) {
|
|
| 248 |
?> |
|
| 249 |
<table cellpadding="0" cellspacing="0" width="100%" border="0"> |
|
| 250 |
<tr> |
|
| 251 |
<td> |
|
| 252 |
<h2><?php echo $HEADING['MODIFY_DELETE_PAGE']; ?></h2> |
|
| 253 |
</td> |
|
| 254 |
<td align="right"> |
|
| 255 |
<?php |
|
| 256 |
// Check if there are any pages that are in trash, and if we should show a link to the trash page |
|
| 257 |
if(PAGE_TRASH == 'separate') {
|
|
| 258 |
$query_trash = $database->query("SELECT page_id FROM ".TABLE_PREFIX."pages WHERE visibility = 'deleted'");
|
|
| 259 |
if($query_trash->numRows() > 0) {
|
|
| 260 |
?> |
|
| 261 |
<a href="<?php echo ADMIN_URL; ?>/pages/trash.php"> |
|
| 262 |
<img src="<?php echo ADMIN_URL; ?>/images/delete_16.png" alt="<?php echo $TEXT['PAGE_TRASH']; ?>" border="0" /> |
|
| 263 |
<?php echo $TEXT['VIEW_DELETED_PAGES']; ?></a> |
|
| 264 |
<?php |
|
| 265 |
} |
|
| 266 |
} |
|
| 267 |
?> |
|
| 268 |
</td> |
|
| 269 |
</tr> |
|
| 270 |
</table> |
|
| 271 |
<div class="pages_list"> |
|
| 272 |
<table cellpadding="1" cellspacing="0" width="720" border="0"> |
|
| 273 |
<tr> |
|
| 274 |
<td width="20"> |
|
| 275 |
|
|
| 276 |
</td> |
|
| 277 |
<td> |
|
| 278 |
<?php echo $TEXT['PAGE_TITLE']; ?>: |
|
| 279 |
</td> |
|
| 280 |
<td width="175" align="left"> |
|
| 281 |
<?php echo $TEXT['MENU_TITLE']; ?>: |
|
| 282 |
</td> |
|
| 283 |
<td width="130" align="right"> |
|
| 284 |
<?php echo $TEXT['VISIBILITY']; ?>: |
|
| 285 |
</td> |
|
| 286 |
<td width="125" align="center"> |
|
| 287 |
<?php echo $TEXT['ACTIONS']; ?>: |
|
| 288 |
</td> |
|
| 289 |
</tr> |
|
| 290 |
</table> |
|
| 291 |
<?php |
|
| 292 |
$editable_pages = make_list(0, 0); |
|
| 293 |
?> |
|
| 294 |
</div> |
|
| 295 |
<div class="empty_list"> |
|
| 296 |
<?php echo $TEXT['NONE_FOUND']; ?> |
|
| 297 |
</div> |
|
| 298 |
<?php |
|
| 299 |
} else {
|
|
| 300 |
$editable_pages = 0; |
|
| 301 |
} |
|
| 302 |
|
|
| 303 |
// Setup template object |
|
| 304 |
$template = new Template(ADMIN_PATH.'/pages'); |
|
| 305 |
$template->set_file('page', 'template.html');
|
|
| 306 |
$template->set_block('page', 'main_block', 'main');
|
|
| 307 |
|
|
| 308 |
// Figure out if the no pages found message should be shown or not |
|
| 309 |
if($editable_pages == 0) {
|
|
| 310 |
?> |
|
| 311 |
<style type="text/css"> |
|
| 312 |
.pages_list {
|
|
| 313 |
display: none; |
|
| 314 |
} |
|
| 315 |
</style> |
|
| 316 |
<?php |
|
| 317 |
} else {
|
|
| 318 |
?> |
|
| 319 |
<style type="text/css"> |
|
| 320 |
.empty_list {
|
|
| 321 |
display: none; |
|
| 322 |
} |
|
| 323 |
</style> |
|
| 324 |
<?php |
|
| 325 |
} |
|
| 326 |
|
|
| 327 |
// Insert values into the add page form |
|
| 328 |
|
|
| 329 |
// Group list 1 |
|
| 330 |
if($admin->get_group_id() == 1) {
|
|
| 331 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
| 332 |
} else {
|
|
| 333 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'"; |
|
| 334 |
} |
|
| 335 |
$get_groups = $database->query($query); |
|
| 336 |
$template->set_block('main_block', 'group_list_block', 'group_list');
|
|
| 337 |
// Insert admin group and current group first |
|
| 338 |
$admin_group_name = $get_groups->fetchRow(); |
|
| 339 |
$template->set_var(array( |
|
| 340 |
'ID' => 1, |
|
| 341 |
'TOGGLE' => '', |
|
| 342 |
'DISABLED' => ' disabled', |
|
| 343 |
'LINK_COLOR' => '000000', |
|
| 344 |
'CURSOR' => 'default', |
|
| 345 |
'NAME' => $admin_group_name['name'], |
|
| 346 |
'CHECKED' => ' checked' |
|
| 347 |
) |
|
| 348 |
); |
|
| 349 |
$template->parse('group_list', 'group_list_block', true);
|
|
| 350 |
if($admin->get_group_id() != 1) {
|
|
| 351 |
$template->set_var(array( |
|
| 352 |
'ID' => $admin->get_group_id(), |
|
| 353 |
'TOGGLE' => '', |
|
| 354 |
'DISABLED' => ' disabled', |
|
| 355 |
'LINK_COLOR' => '000000', |
|
| 356 |
'CURSOR' => 'default', |
|
| 357 |
'NAME' => $admin->get_group_name(), |
|
| 358 |
'CHECKED' => ' checked' |
|
| 359 |
) |
|
| 360 |
); |
|
| 361 |
$template->parse('group_list', 'group_list_block', true);
|
|
| 362 |
} |
|
| 363 |
while($group = $get_groups->fetchRow()) {
|
|
| 364 |
// Check if the group is allowed to edit pages |
|
| 365 |
$system_permissions = explode(',', $group['system_permissions']);
|
|
| 366 |
if(is_numeric(array_search('pages_modify', $system_permissions))) {
|
|
| 367 |
$template->set_var(array( |
|
| 368 |
'ID' => $group['group_id'], |
|
| 369 |
'TOGGLE' => $group['group_id'], |
|
| 370 |
'CHECKED' => '', |
|
| 371 |
'DISABLED' => '', |
|
| 372 |
'LINK_COLOR' => '', |
|
| 373 |
'CURSOR' => 'pointer', |
|
| 374 |
'NAME' => $group['name'], |
|
| 375 |
'CHECKED' => '' |
|
| 376 |
) |
|
| 377 |
); |
|
| 378 |
$template->parse('group_list', 'group_list_block', true);
|
|
| 379 |
} |
|
| 380 |
} |
|
| 381 |
// Group list 2 |
|
| 382 |
if($admin->get_group_id() == 1) {
|
|
| 383 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups"; |
|
| 384 |
} else {
|
|
| 385 |
$query = "SELECT * FROM ".TABLE_PREFIX."groups WHERE group_id != '".$admin->get_group_id()."'"; |
|
| 386 |
} |
|
| 387 |
$get_groups = $database->query($query); |
|
| 388 |
$template->set_block('main_block', 'group_list_block2', 'group_list2');
|
|
| 389 |
// Insert admin group and current group first |
|
| 390 |
$admin_group_name = $get_groups->fetchRow(); |
|
| 391 |
$template->set_var(array( |
|
| 392 |
'ID' => 1, |
|
| 393 |
'TOGGLE' => '', |
|
| 394 |
'DISABLED' => ' disabled', |
|
| 395 |
'LINK_COLOR' => '000000', |
|
| 396 |
'CURSOR' => 'default', |
|
| 397 |
'NAME' => $admin_group_name['name'], |
|
Also available in: Unified diff
All occurrences of "CVS" in the code are replace by ".svn"