1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK ---------------------------------- |
---|
3 | # This file is part of latexrender, a plugin for Dotclear. |
---|
4 | # |
---|
5 | # Copyright (c) 2009 Jean-Christophe Dubacq |
---|
6 | # jcdubacq1@free.fr |
---|
7 | # |
---|
8 | # Licensed under the LGPL version 2.1 license. |
---|
9 | # A copy of this license is available in LICENSE file or at |
---|
10 | # http://www.gnu.org/licenses/lgpl-2.1.html |
---|
11 | # -- END LICENSE BLOCK ------------------------------------ |
---|
12 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
13 | |
---|
14 | dcPage::checkSuper(); |
---|
15 | $commands=array('latex','dvips','convert','identify'); |
---|
16 | include_once(dirname(__FILE__).'/class.latexrender.php'); |
---|
17 | $core->latex=new LatexRender($core); |
---|
18 | $method_type = array( |
---|
19 | __('Safe method') => 'old', |
---|
20 | __('Colorization method') => 'new' |
---|
21 | ); |
---|
22 | |
---|
23 | try |
---|
24 | { |
---|
25 | // Create settings if they don't exist |
---|
26 | $options=LatexRender::getConfig(); |
---|
27 | if ($_POST['reset']) { |
---|
28 | $options=LatexRender::defaultConfig(); |
---|
29 | LatexRender::storeConfig($options); |
---|
30 | http::redirect($p_url); |
---|
31 | } |
---|
32 | } catch (Exception $e) { |
---|
33 | $core->error->add($e->getMessage()); |
---|
34 | } |
---|
35 | if (isset($_POST['latexrender_latexpath']) && !($_POST['reset']) |
---|
36 | && !($_POST['clean'])) { |
---|
37 | $boptions=LatexRender::defaultConfig(); |
---|
38 | foreach ($boptions as $key => $value) { |
---|
39 | if (isset($_POST['latexrender_'.$key])) { |
---|
40 | $boptions[$key]=$_POST['latexrender_'.$key]; |
---|
41 | } else { |
---|
42 | $boptions[$key]=''; |
---|
43 | } |
---|
44 | } |
---|
45 | LatexRender::storeConfig($boptions,$options); |
---|
46 | http::redirect($p_url.'&up=1'); |
---|
47 | } |
---|
48 | if (isset($_POST['clean'])) { |
---|
49 | http::redirect($p_url.'&clean='.$core->latex->searchCache(1)); |
---|
50 | } |
---|
51 | # default tab |
---|
52 | $default_tab = 'settings'; |
---|
53 | if (!empty($_REQUEST['tab'])) |
---|
54 | { |
---|
55 | switch ($_REQUEST['tab']) |
---|
56 | { |
---|
57 | case 'autotest' : |
---|
58 | $default_tab = 'autotest'; |
---|
59 | break; |
---|
60 | } |
---|
61 | } |
---|
62 | echo '<html><head><title>LaTeXrender</title>'; |
---|
63 | echo dcPage::jsPageTabs($default_tab); |
---|
64 | echo '</head><body>'; |
---|
65 | echo '<h2>'.html::escapeHTML($core->blog->name).' › LaTeXrender</h2>'; |
---|
66 | $msg=''; |
---|
67 | if (!empty($_GET['up'])) { |
---|
68 | $msg=__('Settings have been successfully updated.'); |
---|
69 | } |
---|
70 | if (!empty($_GET['clean'])) { |
---|
71 | $msg=__('Cache has been successfully cleaned.'); |
---|
72 | } |
---|
73 | if (!empty($msg)) {echo '<p class="message">'.$msg.'</p>';} |
---|
74 | echo '<div class="multi-part" id="settings" title="'. |
---|
75 | __('Settings').'">'; |
---|
76 | echo '<h3>'.__('Settings').'</h3>'; |
---|
77 | echo |
---|
78 | '<form action="'.$p_url.'" method="post">'. |
---|
79 | '<fieldset><legend>'.__('Utilities paths').'</legend>'. |
---|
80 | '<p><label class="classic">'.__('<code>latex</code> path:').' '.form::field(array('latexrender_latexpath'),20,255,html::escapeHTML($core->latex->_latex_path)).'</label></p>'. |
---|
81 | '<p><label class="classic">'.__('<code>dvips</code> path:').' '.form::field(array('latexrender_dvipspath'),20,255,html::escapeHTML($core->latex->_dvips_path)).'</label></p>'. |
---|
82 | '<p><label class="classic">'.__('<code>convert</code> path:').' '.form::field(array('latexrender_convertpath'),20,255,html::escapeHTML($core->latex->_convert_path)).'</label></p>'. |
---|
83 | '<p><label class="classic">'.__('<code>identify</code> path:').' '.form::field(array('latexrender_identifypath'),20,255,html::escapeHTML($core->latex->_identify_path)).'</label></p>'. |
---|
84 | '</fieldset><fieldset><legend>'.__('Security limits').'</legend>'. |
---|
85 | '<p><label class="classic">'.__('Max width (pixels):').' '.form::field(array('latexrender_xsizelimit'),20,255,html::escapeHTML($core->latex->_xsize_limit)).'</label></p>'. |
---|
86 | '<p><label class="classic">'.__('Max height (pixels):').' '.form::field(array('latexrender_ysizelimit'),20,255,html::escapeHTML($core->latex->_ysize_limit)).'</label></p>'. |
---|
87 | '<p><label class="classic">'.__('Max length (chars):').' '.form::field(array('latexrender_stringlengthlimit'),20,255,html::escapeHTML($core->latex->_string_length_limit)).'</label></p>'. |
---|
88 | '</fieldset><fieldset><legend>'.__('Settings').'</legend>'. |
---|
89 | '<p><label class="classic">'.__('Generation method').' '.form::combo('latexrender_method',$method_type,$core->latex->_method).'</label></p>'. |
---|
90 | '<p><label class="classic">'.__('Formula density (dpi)').' '.form::field(array('latexrender_formuladensity'),20,255,html::escapeHTML($core->latex->_formula_density)).'</label></p>'. |
---|
91 | '<p><label class="classic">'.__('LaTeX class').' '.form::field(array('latexrender_latexclass'),20,255,html::escapeHTML($core->latex->_latexclass)).'</label></p>'. |
---|
92 | '<p><label class="classic">'.__('Font size').' '.form::field(array('latexrender_fontsize'),20,255,html::escapeHTML($core->latex->_font_size)).'</label></p>'. |
---|
93 | '</fieldset><p><input type="submit" value="'.__('save').'" />'. |
---|
94 | ' <input type="submit" name="reset" value="'.__('return to default values').'" /> '. |
---|
95 | ' <input type="submit" name="clean" value="'.__('clean cache').'" /> '. |
---|
96 | $core->formNonce().'</p>'. |
---|
97 | '</form>'; |
---|
98 | echo '</div>'; |
---|
99 | echo '<div class="multi-part" id="autotest" title="'. |
---|
100 | __('Plugin auto-test').'">'; |
---|
101 | echo '<h3>'.__('Plugin auto-test').'</h3>'; |
---|
102 | $core->latex=new LatexRender($core); |
---|
103 | echo '<p>'.__('The LaTeX logo should be displayed here colored in black then red:').'<ul><li>'; |
---|
104 | echo $core->latex->getFormulaHTML('\LaTeX','000000',true); |
---|
105 | echo '</li><li>'; |
---|
106 | echo $core->latex->getFormulaHTML('\LaTeX','FF0000',true); |
---|
107 | echo '</li></ul>'; |
---|
108 | echo '<p>'.__('Files in cache:').$core->latex->searchCache(0).'</p>'; |
---|
109 | if ($core->stacker) { |
---|
110 | echo __('<p>The stacker extension is installed. Public display will take place.</p>'); |
---|
111 | } else { |
---|
112 | echo __('<p>Please install the stacker extension for public display to take place.</p>'); |
---|
113 | } |
---|
114 | echo '<p>'.__('Images go in the following directory:').' <tt>'. |
---|
115 | $core->latex->_picture_path.'</tt></p>'; |
---|
116 | echo '<p>'.__('Temp files go in the following directory:').' <tt>'. |
---|
117 | $core->latex->_tmp_dir.'</tt></p>'; |
---|
118 | echo '<p>'.__('Images have the following URL:').' <tt>'. |
---|
119 | $core->latex->_picture_path_httpd.'</tt></p>'; |
---|
120 | echo '</div>'; |
---|
121 | echo '</body>'; |
---|
122 | ?> |
---|