Ejemplo n.º 1
0
        if (!isset($tool['module_icon'])) {
            $tool['module_icon'] = "fa fa-graduation-cap";
        }
        $path = WB_PATH . '/modules/' . $tool['directory'] . '/languages/' . LANGUAGE . '.php';
        if (file_exists($path)) {
            $data = file_get_contents($path);
            $tool_description = get_variable_content('module_description', $data, true, false);
            if ($tool_description) {
                $tool['description'] = $tool_description;
            }
            $tool_name = get_variable_content('module_title', $data, true, false);
            if ($tool_name) {
                $tool['name'] = $tool_name;
            }
        }
        // Sooner or later this needs to be added to the Database
        // For now this just works
        // Default Icon
        $tool['icon'] = "fa fa-anchor";
        $path = WB_PATH . '/modules/' . $tool['directory'] . '/info.php';
        if (file_exists($path)) {
            $data = file_get_contents($path);
            $tool_icon = get_variable_content('module_icon', $data, true, false);
            if ($tool_icon) {
                $tool['icon'] = $tool_icon;
            }
        }
        $myTools[] = $tool;
    }
}
include $this->GetTemplatePath("list.tpl.php");
// $template->debug = true;
$template->set_file('page', 'admintools.htt');
$template->set_block('page', 'main_block', 'main');
// Insert required template variables
$template->set_var('ADMIN_URL', ADMIN_URL);
$template->set_var('THEME_URL', THEME_URL);
$template->set_var('HEADING_ADMINISTRATION_TOOLS', $HEADING['ADMINISTRATION_TOOLS']);
// Insert tools into tool list
$template->set_block('main_block', 'tool_list_block', 'tool_list');
$results = $database->query("SELECT * FROM " . TABLE_PREFIX . "addons WHERE type = 'module' AND function = 'tool' order by name");
if ($results->numRows() > 0) {
    while ($tool = $results->fetchRow()) {
        $template->set_var('TOOL_NAME', $tool['name']);
        $template->set_var('TOOL_DIR', $tool['directory']);
        // check if a module description exists for the displayed backend language
        $tool_description = false;
        if (function_exists('file_get_contents') && file_exists(WB_PATH . '/modules/' . $tool['directory'] . '/languages/' . LANGUAGE . '.php')) {
            // read contents of the module language file into string
            $data = @file_get_contents(WB_PATH . '/modules/' . $tool['directory'] . '/languages/' . LANGUAGE . '.php');
            $tool_description = get_variable_content('module_description', $data, true, false);
        }
        $template->set_var('TOOL_DESCRIPTION', $tool_description === False ? $tool['description'] : $tool_description);
        $template->parse('tool_list', 'tool_list_block', true);
    }
} else {
    $template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);
}
// Parse template objects output
$template->parse('main', 'main_block', false);
$template->pparse('output', 'page');
$admin->print_footer();
Ejemplo n.º 3
0
function get_modul_version($modulname, $source = true)
{
    global $database;
    $version = null;
    if ($source != true) {
        $sql = 'SELECT `version` FROM `' . TABLE_PREFIX . 'addons` ';
        $sql .= 'WHERE `directory`=\'' . $modulname . '\'';
        $version = $database->get_one($sql);
    } else {
        $info_file = WB_PATH . '/modules/' . $modulname . '/info.php';
        if (file_exists($info_file)) {
            if ($info_file = file_get_contents($info_file)) {
                $version = get_variable_content('module_version', $info_file, false, false);
                $version = $version !== false ? $version : null;
            }
        }
    }
    return $version;
}
Ejemplo n.º 4
0
// Setup template object
$template = new Template(THEME_PATH . '/templates');
$template->set_file('page', 'templates_details.htt');
$template->set_block('page', 'main_block', 'main');
// Insert values
$result = $database->query("SELECT * FROM " . TABLE_PREFIX . "addons WHERE type = 'template' AND directory = '{$file}'");
if ($result->numRows() > 0) {
    $row = $result->fetchRow();
}
// check if a template description exists for the displayed backend language
$tool_description = false;
if (function_exists('file_get_contents') && file_exists(LEPTON_PATH . '/templates/' . $file . '/languages/' . LANGUAGE . '.php')) {
    // read contents of the template language file into string
    $data = @file_get_contents(LEPTON_PATH . '/templates/' . $file . '/languages/' . LANGUAGE . '.php');
    // use regular expressions to fetch the content of the variable from the string
    $tool_description = get_variable_content('template_description', $data, false, false);
    // replace optional placeholder {LEPTON_URL} with value stored in config.php
    if ($tool_description !== false && strlen(trim($tool_description)) != 0) {
        $tool_description = str_replace('{LEPTON_URL}', LEPTON_URL, $tool_description);
    } else {
        $tool_description = false;
    }
}
if ($tool_description !== false) {
    // Override the template-description with correct desription in users language
    $row['description'] = $tool_description;
}
$template->set_var(array('NAME' => $row['name'], 'AUTHOR' => $row['author'], 'DESCRIPTION' => $row['description'], 'VERSION' => $row['version'], 'DESIGNED_FOR' => $row['platform'], 'LICENSE' => $row['license']));
// Insert language headings
$template->set_var(array('HEADING_TEMPLATE_DETAILS' => $HEADING['TEMPLATE_DETAILS']));
// Insert language text and messages