Revision 1289
Added by kweitzel almost 15 years ago
details.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
require_once(WB_PATH .'/framework/functions.php'); |
|
29 |
|
|
30 |
// Get template name |
|
31 |
if(!isset($_POST['file']) OR $_POST['file'] == "") { |
|
32 |
header("Location: index.php"); |
|
33 |
exit(0); |
|
34 |
} else { |
|
35 |
$file = $_POST['file']; |
|
36 |
} |
|
37 |
|
|
38 |
// Check if the template exists |
|
39 |
if(!file_exists(WB_PATH.'/templates/'.$file)) { |
|
40 |
header("Location: index.php"); |
|
41 |
exit(0); |
|
42 |
} |
|
43 |
|
|
44 |
// Print admin header |
|
45 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
46 |
$admin = new admin('Addons', 'templates_view'); |
|
47 |
|
|
48 |
// Setup template object |
|
49 |
$template = new Template(THEME_PATH.'/templates'); |
|
50 |
$template->set_file('page', 'templates_details.htt'); |
|
51 |
$template->set_block('page', 'main_block', 'main'); |
|
52 |
|
|
53 |
// Insert values |
|
54 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '$file'"); |
|
55 |
if($result->numRows() > 0) { |
|
56 |
$row = $result->fetchRow(); |
|
57 |
} |
|
58 |
|
|
59 |
// check if a template description exists for the displayed backend language |
|
60 |
$tool_description = false; |
|
61 |
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/templates/'.$file.'/languages/'.LANGUAGE .'.php')) { |
|
62 |
// read contents of the template language file into string |
|
63 |
$data = @file_get_contents(WB_PATH .'/templates/' .$file .'/languages/' .LANGUAGE .'.php'); |
|
64 |
// use regular expressions to fetch the content of the variable from the string |
|
65 |
$tool_description = get_variable_content('template_description', $data, false, false); |
|
66 |
// replace optional placeholder {WB_URL} with value stored in config.php |
|
67 |
if($tool_description !== false && strlen(trim($tool_description)) != 0) { |
|
68 |
$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description); |
|
69 |
} else { |
|
70 |
$tool_description = false; |
|
71 |
} |
|
72 |
} |
|
73 |
if($tool_description !== false) { |
|
74 |
// Override the template-description with correct desription in users language |
|
75 |
$row['description'] = $tool_description; |
|
76 |
} |
|
77 |
|
|
78 |
$template->set_var(array( |
|
79 |
'NAME' => $row['name'], |
|
80 |
'AUTHOR' => $row['author'], |
|
81 |
'DESCRIPTION' => $row['description'], |
|
82 |
'VERSION' => $row['version'], |
|
83 |
'DESIGNED_FOR' => $row['platform'] |
|
84 |
) |
|
85 |
); |
|
86 |
|
|
87 |
// Insert language headings |
|
88 |
$template->set_var(array( |
|
89 |
'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS'] |
|
90 |
) |
|
91 |
); |
|
92 |
// Insert language text and messages |
|
93 |
$template->set_var(array( |
|
94 |
'TEXT_NAME' => $TEXT['NAME'], |
|
95 |
'TEXT_AUTHOR' => $TEXT['AUTHOR'], |
|
96 |
'TEXT_VERSION' => $TEXT['VERSION'], |
|
97 |
'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'], |
|
98 |
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'], |
|
99 |
'TEXT_BACK' => $TEXT['BACK'] |
|
100 |
) |
|
101 |
); |
|
102 |
|
|
103 |
// Parse template object |
|
104 |
$template->parse('main', 'main_block', false); |
|
105 |
$template->pparse('output', 'page'); |
|
106 |
|
|
107 |
// Print admin footer |
|
108 |
$admin->print_footer(); |
|
109 |
|
|
1 |
<?php |
|
2 |
|
|
3 |
// $Id$ |
|
4 |
|
|
5 |
/* |
|
6 |
|
|
7 |
Website Baker Project <http://www.websitebaker.org/> |
|
8 |
Copyright (C) 2004-2009, 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 |
require_once(WB_PATH .'/framework/functions.php'); |
|
29 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
30 |
$admin = new admin('Addons', 'templates_view',false); |
|
31 |
|
|
32 |
// Get template name |
|
33 |
if(!isset($_POST['file']) OR $_POST['file'] == "") { |
|
34 |
header("Location: index.php"); |
|
35 |
exit(0); |
|
36 |
} else { |
|
37 |
$file = $admin->add_slashes($_POST['file']); |
|
38 |
} |
|
39 |
|
|
40 |
// Check if the template exists |
|
41 |
if(!file_exists(WB_PATH.'/templates/'.$file)) { |
|
42 |
header("Location: index.php"); |
|
43 |
exit(0); |
|
44 |
} |
|
45 |
|
|
46 |
// Print admin header |
|
47 |
$admin = new admin('Addons', 'templates_view'); |
|
48 |
|
|
49 |
// Setup template object |
|
50 |
$template = new Template(THEME_PATH.'/templates'); |
|
51 |
$template->set_file('page', 'templates_details.htt'); |
|
52 |
$template->set_block('page', 'main_block', 'main'); |
|
53 |
|
|
54 |
// Insert values |
|
55 |
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' AND directory = '$file'"); |
|
56 |
if($result->numRows() > 0) { |
|
57 |
$row = $result->fetchRow(); |
|
58 |
} |
|
59 |
|
|
60 |
// check if a template description exists for the displayed backend language |
|
61 |
$tool_description = false; |
|
62 |
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/templates/'.$file.'/languages/'.LANGUAGE .'.php')) { |
|
63 |
// read contents of the template language file into string |
|
64 |
$data = @file_get_contents(WB_PATH .'/templates/' .$file .'/languages/' .LANGUAGE .'.php'); |
|
65 |
// use regular expressions to fetch the content of the variable from the string |
|
66 |
$tool_description = get_variable_content('template_description', $data, false, false); |
|
67 |
// replace optional placeholder {WB_URL} with value stored in config.php |
|
68 |
if($tool_description !== false && strlen(trim($tool_description)) != 0) { |
|
69 |
$tool_description = str_replace('{WB_URL}', WB_URL, $tool_description); |
|
70 |
} else { |
|
71 |
$tool_description = false; |
|
72 |
} |
|
73 |
} |
|
74 |
if($tool_description !== false) { |
|
75 |
// Override the template-description with correct desription in users language |
|
76 |
$row['description'] = $tool_description; |
|
77 |
} |
|
78 |
|
|
79 |
$template->set_var(array( |
|
80 |
'NAME' => $row['name'], |
|
81 |
'AUTHOR' => $row['author'], |
|
82 |
'DESCRIPTION' => $row['description'], |
|
83 |
'VERSION' => $row['version'], |
|
84 |
'DESIGNED_FOR' => $row['platform'] |
|
85 |
) |
|
86 |
); |
|
87 |
|
|
88 |
// Insert language headings |
|
89 |
$template->set_var(array( |
|
90 |
'HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS'] |
|
91 |
) |
|
92 |
); |
|
93 |
// Insert language text and messages |
|
94 |
$template->set_var(array( |
|
95 |
'TEXT_NAME' => $TEXT['NAME'], |
|
96 |
'TEXT_AUTHOR' => $TEXT['AUTHOR'], |
|
97 |
'TEXT_VERSION' => $TEXT['VERSION'], |
|
98 |
'TEXT_DESIGNED_FOR' => $TEXT['DESIGNED_FOR'], |
|
99 |
'TEXT_DESCRIPTION' => $TEXT['DESCRIPTION'], |
|
100 |
'TEXT_BACK' => $TEXT['BACK'] |
|
101 |
) |
|
102 |
); |
|
103 |
|
|
104 |
// Parse template object |
|
105 |
$template->parse('main', 'main_block', false); |
|
106 |
$template->pparse('output', 'page'); |
|
107 |
|
|
108 |
// Print admin footer |
|
109 |
$admin->print_footer(); |
|
110 |
|
|
110 | 111 |
?> |
Also available in: Unified diff
Branch 2.8.1 merged back into Trunk