Example #1
0
/**
 * Store a template, and then show the list again.
 *
 * @see show_templates()
 */
function save_template()
{
    global $Cfg, $Paths, $Pivot_Vars;
    // check against unauthorised direct access.
    check_csrf();
    // make sure that we save it in the templates folder..
    $file = basename($Pivot_Vars['edit']);
    $template = $Pivot_Vars['template'];
    if (get_magic_quotes_gpc()) {
        $template = stripslashes($template);
    }
    // make sure we don't accepts strange filename extensions
    $ext = getextension($file);
    if ($ext != 'txt' && $ext != 'php' && $ext != 'htm' && $ext != 'html' && $ext != 'css' && $ext != 'xml') {
        $file = $file . ".txt";
    }
    $template = str_replace('<*textarea', '<textarea', $template);
    $template = str_replace('<*/textarea*>', '</textarea>', $template);
    $fh = fopen($Paths['templates_path'] . $file, 'wb+') or die("<b>{$file}: </b>" . lang('error', 'file_open'));
    $changes = stripslashes($template);
    fwrite($fh, $template);
    fclose($fh);
    show_templates();
    PageFooter();
}
Example #2
0
if (is_file($MODULE_FOLDER . "stats/" . MAIN_LANG . ".lang.php")) {
    require_once $MODULE_FOLDER . "stats/" . MAIN_LANG . ".lang.php";
} else {
    require_once $MODULE_FOLDER . "stats/en.lang.php";
}
$Delimeter = " &gt ";
$Title1 = NETCAT_MODULE_STATS;
$Title2 = "<a href=" . $ADMIN_PATH . "modules/>" . NETCAT_MODULES . "</a>";
// check permission
$perm->ExitIfNotAccess(NC_PERM_MODULE, 0, 0, 0, 1);
//LoadModuleEnv();
$MODULE_VARS = $nc_core->modules->get_module_vars();
$phase += 0;
BeginHtml($Title1, $Title2 . $Delimeter . $Title1, "http://" . $DOC_DOMAIN . "/settings/modules/stats/openstat");
// check permission
$perm->ExitIfNotAccess(NC_PERM_MODULE, 0, 0, 0, 1);
$db->get_results("SELECT * FROM `Stats_Openstat_Counters` order by `Counter_Id`");
$counters = @array_combine($db->get_col(NULL, 0), $db->get_results(NULL));
switch ($sub_view) {
    case 'templates':
        show_templates($phase);
        break;
    case 'counters':
        show_counters($phase);
        break;
    case 'reports':
    default:
        show_reports($phase);
        break;
}
EndHtml();