Dotclear

source: plugins/notEvilAds/forms.php @ 459

Revision 459, 6.8 KB checked in by sacha, 15 years ago (diff)

Ajout des vérifications pour éviter l'exécution des plugins en dehors de Dotclear

Line 
1<?php
2if (!defined('DC_CONTEXT_ADMIN')) { return; }
3
4if ($fatal_error)
5     return;
6
7$nea_forms = array();
8
9$nea_forms['list_actions'] = array(
10     __('Delete')=>'delete',
11     __('Make not evil')=>'mknotevil',
12     __('Make evil')=>'mkevil',
13     __('Enable')=>'enable',
14     __('Disable')=>'disable');
15
16
17/* FORMULAIRE - Configuration
18--------------------------------------------------- */
19
20$nea_forms['config'] = '
21<form action="'.$p_url.'" method="post">
22<fieldset class="two-cols"><legend>'.__('General configuration').'</legend>
23<p class="col"><label class="required" title="'.__('Required field').'">'.__('Not evil ads identifiers:').' '.
24     form::field(array('nea_identifiers'),40,false,html::escapeHTML($nea_settings['identifiers']),'','',true).'</label></p>
25<div class="col">
26     <p><label class="classic">'.form::checkbox(array('nea_default'),1,$nea_settings['default']).
27          ' '.__('Show ads by default').'</label></p>
28     <p><label class="classic">'.form::checkbox(array('nea_nothome'),1,$nea_settings['nothome']).
29          __('Do not show ads on home page by default').'</label></p>
30     <p><label class="classic">'.form::checkbox(array('nea_notajax'),1,$nea_settings['notajax']).
31          ' '.__('Disable Ajax').'</label></p>
32</div>
33</fieldset>
34
35<fieldset><legend>'.__('Cookie configuration').'</legend>
36<p><label class="required" title="'.__('Required field').'">'.__('Cookie name').' '.
37     form::field(array('nea_cookiename'),20,128,html::escapeHTML($nea_settings['cookiename'])).'</label></p>
38<p><label class="classic">'.sprintf(__('Keep cookie %s days'),
39     form::field(array('nea_cookiedays'),3,4,html::escapeHTML($nea_settings['cookiedays']))).'</label></p>
40<p><label class="classic">'.form::checkbox(array('nea_easycookie'),1,$nea_settings['easycookie']).' '.
41     __('Do not use cookie advanced configuration (cookie domain and path parameters)').'</label></p>
42<div class="lockable two-cols">
43     <p class="col"><label>'.__('Cookie path').' '.
44          form::field(array('nea_cookiepath'),20,false,html::escapeHTML($nea_settings['cookiepath'])).'</label></p>
45     <p class="col"><label>'.__('Cookie domain').' '.
46          form::field(array('nea_cookiedome'),20,256,html::escapeHTML($nea_settings['cookiedome'])).'</label></p>
47     <br class="clear" />
48     <p class="form-note warn">'.__('Do not use path and domain parameters unless you know what you are doing').'</p>
49</div>
50
51<p><input type="submit" name="nea_action_config" value="'.__('Update configuration').'" />'.
52(is_callable(array($core,'formNonce')) ? $core->formNonce() : '').'</p>
53</form>';
54
55/* FORMULAIRE - Liste des publicités
56--------------------------------------------------- */
57
58$nea_forms['list'] = '
59<form action="'.$p_url.'" id="nea-form-list" method="post">
60<table class="maximal">
61<thead><tr>
62<th colspan="2">'.__('Identifier').'</th>
63<th>'.__('Title').'</th>
64<th colspam="2">'.__('Status').'</th>
65</tr></thead>
66<tbody>
67';
68
69foreach ($nea_ads as $ad)
70{
71     $nea_forms['list'] .=
72          '<tr class="line'.($ad['disable'] ? ' offline' : '').'" id="a'.$ad['identifier'].'">'.
73          '<td class="nowrap">'.
74               form::checkbox(array('nea_selected[]'),$ad['identifier'],
75                    (in_array($ad['identifier'],$nea_selected) ? true : false),
76                    '','',false,'title="'.__('Select this ad').'"').'</td>'.
77
78          '<td class="nowrap">'.html::escapeHTML($ad['identifier']).'</td>'.
79         
80          '<td class="maximal">'.html::escapeHTML($ad['title']).'</td>'.
81         
82          '<td class="nowrap status">'.($ad['disable']
83               ? '<img src="images/check-off.png" alt="'.__('disabled').'" />'
84               : ($ad['notevil']
85                    ? '<img src="images/check-on.png" alt="'.__('not evil').'" />'
86                    : '<img src="images/check-wrn.png" alt="'.__('evil').'" />')).
87          '</td>'.
88          '<td class="nowrap status">'.
89               '<a href="'.$p_url.'&amp;edit='.$ad['identifier'].'" title="'.__('Edit this ad').'">'.
90               '<img src="images/edit-mini.png" alt="'.__('edit').'" /></a></td>'.
91          "</tr>\n";
92}
93
94$nea_forms['list'] .= '</tbody>
95</table>
96
97<div class="two-cols">
98<p class="col checkboxes-helpers">&nbsp;</p>
99<p class="col right">'.__('Action for selected ads:').' '.
100     form::combo(array('nea_action'),$nea_forms['list_actions']).
101     (is_callable(array($core,'formNonce')) ? $core->formNonce() : '').
102     ' <input type="submit" name="nea_action_fromlist" value="'.__('ok').'" /></p>
103</div>
104<br class="clear" />
105</form>
106<p class="status"><strong>'.__('Legend:').'</strong><br/>
107<img src="images/plus.png" alt="'.__('preview').'" /> - '.__('Preview').'<br/>
108<img src="images/edit-mini.png" alt="'.__('edit').'" /> - '.__('Edit').'<br/>
109<img src="images/check-on.png" alt="'.__('not evil').'" /> - '.__('This ad is not evil').'<br/>
110<img src="images/check-wrn.png" alt="'.__('evil').'" /> - '.__('This ad is evil').'<br/>
111<img src="images/check-off.png" alt="'.__('disabled').'" /> - '.__('This ad is disabled').'</p>';
112
113
114/* FORMULAIRE - Ajout / modification d'une publicité
115--------------------------------------------------- */
116
117$nea_forms['edit'] = '
118<form action="'.$p_url.'" method="post">
119<fieldset class="two-cols"><legend>'.
120(empty($_REQUEST['edit']) ? __('Add a new ad')
121     : sprintf(__('Edit ad \'%s\''),$_REQUEST['edit'])).'</legend>
122<p class="col"><label class="required" title="'.__('Required field').'">'.__('HTML code:').'<br/>'.
123     form::textArea(array('nea_htmlcode'),35,7,html::escapeHTML($nea_newad['htmlcode'])).'</label></p>
124<div class="col">
125     <p><label class="required" title="'.__('Required field').'">'.__('Identifier:').
126          form::field(array('nea_identifier'),20,256,html::escapeHTML($nea_newad['identifier'])).'</label></p>
127     <p><label>'.__('Title:').
128          form::field(array('nea_title'),20,256,html::escapeHTML($nea_newad['title'])).'</label></p>
129     <p><label>'.__('Extra DIV attributes:').
130          form::field(array('nea_attr'),20,256,html::escapeHTML($nea_newad['attr'])).'</label></p>
131</div>
132<br class="clear" />
133
134<p><label class="classic"> '.
135     form::checkbox(array('nea_notevil'),1,$nea_newad['notevil']).
136     __('This ad is not evil').'</label></p>
137<p><label class="classic">'.
138     form::checkbox(array('nea_nothome'),1,$nea_newad['nothome']).
139     __('Do not show on home page').'</label></p>
140<p><label class="classic">'.
141     form::checkbox(array('nea_notajax'),1,$nea_newad['notajax']).
142     __('Disable Ajax for this ad').'</label></p>
143</fieldset>
144
145<p><input type="submit" name="nea_action_'.(empty($_REQUEST['edit']) ? 'add' : 'edit').
146     '" value="'.(empty($_REQUEST['edit']) ? __('Add') : __('Edit')).'" />'.
147     (empty($_REQUEST['edit']) ? ''
148          : form::hidden(array('edit'),html::escapeHTML($_REQUEST['edit']))).
149          (is_callable(array($core,'formNonce')) ? $core->formNonce() : '').'</p>
150</form>';
151
152/* FORMULAIRE - Aide
153--------------------------------------------------- */
154
155$nea_forms['help'] = '
156<p>'.sprintf(__('Unfortunately, help is not avaible in English. '.
157'To read the up-to-date help in French, please go to the <a href="%s" title="Not Evil Ads online help">support webpage</a>.'),
158"http://sacha.xn--phnix-csa.net/post/2007/08/15/%5BDotclear%5D-Plugin-Not-Evil-Ads-un-nouveau-systeme-de-publicite-pour-votre-blog").
159'</p>';
160?>
Note: See TracBrowser for help on using the repository browser.

Sites map