Пример #1
0
        LogLangSettings();
    }
} else {
    // If no phrase was submitted, show
    //   usage information, news, etc. .
    $page = new CTemplate(GetLocalizedFname('tpl/intro.html'));
}
// If we don't have data from the form or a
//   previous phrase stored in the sessions,
//   load the example data.
if (!isset($_SESSION['data'])) {
    $_SESSION['data'] = file_get_contents(GetLocalizedFname("var/sample.phrase"));
    $_SESSION['color'] = TRUE;
    $_SESSION['antialias'] = TRUE;
    $_SESSION['autosub'] = TRUE;
    $_SESSION['triangles'] = TRUE;
    $_SESSION['fontsel'] = "vera_sans";
    $_SESSION['font'] = "Vera.ttf";
    $_SESSION['fontsize'] = 8;
}
// Render the page
$phrase = htmlentities($_SESSION['data']);
$img = sprintf("<img src=\"stgraph.png.php?%s\" alt=\"\" title=\"%s\"/>", SID, $phrase);
$graph = sprintf("<a href=\"dnlgraph.php?%s\">%s</a>", SID, $img);
$icon = "<img src=\"img/vectorgfx.png\" alt=\"SVG\" />";
$svg = sprintf("<div id=\"svg\"><a href=\"stgraph.svg.php?%s\">%s</a></div>", SID, $icon);
$fontoption = sprintf("SELECT_%s", $_SESSION['fontsel']);
$sizeoption = sprintf("SELECT_size_%d", $_SESSION['fontsize']);
$page->SetValues(array('VERSION' => VERSION, 'FORM_ACTION' => sprintf("?%s", strip_tags(SID)), 'GRAPH' => $graph, 'SVG' => $svg, 'PHRASE' => $phrase, 'DATA_VAL' => $phrase, 'COLOR_VAL' => $_SESSION['color'] ? HTML_CHECKED : HTML_UNCHECKED, 'ANTIALIAS_VAL' => $_SESSION['antialias'] ? HTML_CHECKED : HTML_UNCHECKED, 'AUTOSUB_VAL' => $_SESSION['autosub'] ? HTML_CHECKED : HTML_UNCHECKED, 'TRIANGLES_VAL' => $_SESSION['triangles'] ? HTML_CHECKED : HTML_UNCHECKED, 'COUNTER' => GetCounter(), $fontoption => HTML_SELECTED, $sizeoption => HTML_SELECTED));
$page->Render();