Revision 1711
Added by Luisehahne about 13 years ago
| index.php | ||
|---|---|---|
| 4 | 4 |
* @category admin |
| 5 | 5 |
* @package admintools |
| 6 | 6 |
* @author WB-Project, Werner v.d. Decken |
| 7 |
* @copyright 2011, Website Baker Org. e.V.
|
|
| 7 |
* @copyright 2012, WebsiteBaker Org. e.V.
|
|
| 8 | 8 |
* @link http://www.websitebaker2.org/ |
| 9 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
| 10 | 10 |
* @platform WebsiteBaker 2.8.x |
| ... | ... | |
| 24 | 24 |
|
| 25 | 25 |
// Setup template object, parse vars to it, then parse it |
| 26 | 26 |
// Create new template object |
| 27 |
$template = new Template(dirname($admin->correct_theme_source('admintools.htt')));
|
|
| 27 |
$template = new Template(dirname($admin->correct_theme_source('admintools.htt')),'keep');
|
|
| 28 | 28 |
// $template->debug = true; |
| 29 | 29 |
$template->set_file('page', 'admintools.htt');
|
| 30 | 30 |
$template->set_block('page', 'main_block', 'main');
|
| ... | ... | |
| 36 | 36 |
|
| 37 | 37 |
// Insert tools into tool list |
| 38 | 38 |
$template->set_block('main_block', 'tool_list_block', 'tool_list');
|
| 39 |
$template->set_var('TOOL_NAME', '');
|
|
| 40 |
$template->set_var('TOOL_DIR', '');
|
|
| 41 |
$template->set_var('TOOL_DESCRIPTION', '');
|
|
| 42 |
$template->set_var('NO_CONTENT', '');
|
|
| 43 |
|
|
| 39 | 44 |
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' order by name");
|
| 40 | 45 |
if($results->numRows() > 0) {
|
| 41 |
while($tool = $results->fetchRow()) {
|
|
| 42 |
$template->set_var('TOOL_NAME', $tool['name']);
|
|
| 43 |
$template->set_var('TOOL_DIR', $tool['directory']);
|
|
| 46 |
while( $tool = $results->fetchRow() ) {
|
|
| 47 |
|
|
| 48 |
if( $admin->get_permission($tool['directory'],'module' ) ) |
|
| 49 |
{
|
|
| 50 |
$template->set_var('TOOL_NAME', $tool['name']);
|
|
| 51 |
$template->set_var('TOOL_DIR', $tool['directory']);
|
|
| 44 | 52 |
// /icons/admintools.png |
| 45 | 53 |
// check if a module description exists for the displayed backend language |
| 46 |
$tool_description = false; |
|
| 47 |
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$tool['directory'].'/languages/'.LANGUAGE .'.php')) {
|
|
| 48 |
// read contents of the module language file into string |
|
| 49 |
$data = @file_get_contents(WB_PATH .'/modules/' .$tool['directory'] .'/languages/' .LANGUAGE .'.php'); |
|
| 50 |
$tool_description = get_variable_content('module_description', $data, true, false);
|
|
| 51 |
} |
|
| 52 |
if(file_exists(WB_PATH .'/modules/' .$tool['directory'].'/tool_icon.png')) |
|
| 53 |
{
|
|
| 54 |
$template->set_var('TOOL_ICON', WB_URL.'/modules/' .$tool['directory'].'/tool_icon.png');
|
|
| 55 |
} else {
|
|
| 56 |
$template->set_var('TOOL_ICON', THEME_URL.'/icons/admintools.png');
|
|
| 54 |
$tool_description = false; |
|
| 55 |
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$tool['directory'].'/languages/'.LANGUAGE .'.php')) {
|
|
| 56 |
// read contents of the module language file into string |
|
| 57 |
$data = @file_get_contents(WB_PATH .'/modules/' .$tool['directory'] .'/languages/' .LANGUAGE .'.php'); |
|
| 58 |
$tool_description = get_variable_content('module_description', $data, true, false);
|
|
| 59 |
} |
|
| 60 |
if(file_exists(WB_PATH .'/modules/' .$tool['directory'].'/tool_icon.png')) |
|
| 61 |
{
|
|
| 62 |
$template->set_var('TOOL_ICON', WB_URL.'/modules/' .$tool['directory'].'/tool_icon.png');
|
|
| 63 |
} else {
|
|
| 64 |
$template->set_var('TOOL_ICON', THEME_URL.'/icons/admintools.png');
|
|
| 65 |
} |
|
| 66 |
$template->set_var('TOOL_DESCRIPTION', ($tool_description === False)? $tool['description'] :$tool_description);
|
|
| 67 |
$template->parse('tool_list', 'tool_list_block', true);
|
|
| 57 | 68 |
} |
| 58 |
$template->set_var('TOOL_DESCRIPTION', ($tool_description === False)? $tool['description'] :$tool_description);
|
|
| 59 |
$template->parse('tool_list', 'tool_list_block', true);
|
|
| 60 | 69 |
} |
| 70 |
|
|
| 61 | 71 |
} else {
|
| 62 |
$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);
|
|
| 72 |
$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);
|
|
| 63 | 73 |
} |
| 64 | 74 |
|
| 75 |
$template->set_var('TOOL_LIST', '<li> </li>');
|
|
| 65 | 76 |
// Parse template objects output |
| 66 | 77 |
$template->parse('main', 'main_block', false);
|
| 67 | 78 |
$template->pparse('output', 'page');
|
Also available in: Unified diff
! update folder admin/start, admin/admintools, admin/skel/htt