1 | {combine_css path=$CRYPTO_PATH|cat:'template/style.css'} |
---|
2 | |
---|
3 | {combine_css path=$CRYPTO_PATH|cat:'template/colorpicker/colorpicker.css'} |
---|
4 | {combine_script id='jquery.colorpicker' load='footer' path=$CRYPTO_PATH|cat:'template/colorpicker/colorpicker.js'} |
---|
5 | |
---|
6 | {combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.{$themeconf.colorscheme}.css"} |
---|
7 | {combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} |
---|
8 | |
---|
9 | |
---|
10 | {footer_script} |
---|
11 | var time = 0; |
---|
12 | |
---|
13 | // colorpicker |
---|
14 | $('.colorpicker-input') |
---|
15 | .ColorPicker({ |
---|
16 | onSubmit: function(hsb, hex, rgb, el) { |
---|
17 | $(el).val(hex); |
---|
18 | $(el).ColorPickerHide(); |
---|
19 | }, |
---|
20 | onChange: function(hsb, hex, rgb, el) { |
---|
21 | $(el).val(hex).trigger('change'); |
---|
22 | changeColor(el, hex); |
---|
23 | }, |
---|
24 | onBeforeShow: function () { |
---|
25 | $(this).ColorPickerSetColor(this.value); |
---|
26 | } |
---|
27 | }) |
---|
28 | .bind('keyup', function() { |
---|
29 | $(this).ColorPickerSetColor(this.value); |
---|
30 | changeColor(this, $(this).val()); |
---|
31 | }) |
---|
32 | .each(function() { |
---|
33 | changeColor(this, $(this).val()); |
---|
34 | }); |
---|
35 | |
---|
36 | |
---|
37 | $('.button').click(function() { |
---|
38 | $(this).siblings('.button').removeClass('selected'); |
---|
39 | $(this).addClass('selected'); |
---|
40 | $('input[name='+ $(this).data('input') +']').val($(this).data('val')).trigger('change'); |
---|
41 | }); |
---|
42 | |
---|
43 | // change button |
---|
44 | $('input[name=button_color]').change(function() { |
---|
45 | $('#reload').attr('src', '{$CRYPTO_PATH}template/refresh_'+ $(this).val() +'.png'); |
---|
46 | }); |
---|
47 | |
---|
48 | // apply a preset |
---|
49 | $('input[name=theme]').change(function() { |
---|
50 | var id = $(this).val(); |
---|
51 | |
---|
52 | for (key in presets[id]) { |
---|
53 | if ($('input[name="'+ key +'"]').attr('type') == 'radio') { |
---|
54 | $('input[name="'+ key +'"][value="'+ presets[id][key] +'"]').prop('checked', true).trigger('change', false); |
---|
55 | } |
---|
56 | else { |
---|
57 | $('input[name="'+ key +'"]').val(presets[id][key]).trigger('change', false); |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|
61 | $('.colorpicker-input').each(function() { |
---|
62 | changeColor(this, $(this).val()); |
---|
63 | }); |
---|
64 | |
---|
65 | changePreview(); |
---|
66 | }); |
---|
67 | |
---|
68 | // toggle background type |
---|
69 | $('input[name=background]').change(function() { |
---|
70 | $('li[id^=background]').hide().filter('#background-'+$(this).val()).show(); |
---|
71 | }); |
---|
72 | |
---|
73 | // display customization panel |
---|
74 | $('.customize').click(function() { |
---|
75 | $('#theming').toggle(); |
---|
76 | }); |
---|
77 | |
---|
78 | // change theme to 'custom' if a parameter is changed |
---|
79 | $('input.istheme').change(function(e, p) { |
---|
80 | if (p!==false) setThemeCustom(); |
---|
81 | }); |
---|
82 | |
---|
83 | // update the preview |
---|
84 | $('input.preview').change(function(e, p) { |
---|
85 | if (p!==false) changePreview(); |
---|
86 | }); |
---|
87 | $('#reload').click(function() { |
---|
88 | changePreview(); |
---|
89 | }); |
---|
90 | |
---|
91 | // links for random color |
---|
92 | $('a.random').click(function() { |
---|
93 | $(this).prev('label').children('input').val('random').trigger('change'); |
---|
94 | changeColor($(this).prev('label').children('input'), 'random'); |
---|
95 | }); |
---|
96 | |
---|
97 | // multiselect |
---|
98 | $('[name="activate_on[]"]').selectize({ |
---|
99 | plugins: ['remove_button'] |
---|
100 | }); |
---|
101 | |
---|
102 | function setThemeCustom() { |
---|
103 | $('.button[data-input=theme]').removeClass('selected'); |
---|
104 | $('input[name=theme]').val('custom'); |
---|
105 | } |
---|
106 | |
---|
107 | function changePreview() { |
---|
108 | var now = (new Date()).getTime(); |
---|
109 | |
---|
110 | if (now-time < 1000) { |
---|
111 | return; |
---|
112 | } |
---|
113 | time = now; |
---|
114 | |
---|
115 | options = new Array(); |
---|
116 | str = ''; |
---|
117 | |
---|
118 | $('input.preview:not([type=radio]), input[type=radio].preview:checked').each(function() { |
---|
119 | options[$(this).attr('name')] = $(this).val(); |
---|
120 | }); |
---|
121 | |
---|
122 | for (x in options) { |
---|
123 | str+= '&' + x + '=' + options[x]; |
---|
124 | } |
---|
125 | $('#captcha').attr('src', '{$CRYPTO_PATH}securimage/securimage_preview.php?' + new Date().getTime() + str); |
---|
126 | } |
---|
127 | |
---|
128 | function changeColor(target, color) { |
---|
129 | if (color == 'random') { |
---|
130 | color = '808080'; |
---|
131 | } |
---|
132 | if (parseInt(color, 16) > 16777215/2) { |
---|
133 | $(target).css('color', '#222'); |
---|
134 | } |
---|
135 | else { |
---|
136 | $(target).css('color', '#ddd'); |
---|
137 | } |
---|
138 | $(target).css('background', '#'+color) |
---|
139 | } |
---|
140 | |
---|
141 | var presets = { |
---|
142 | {foreach from=$PRESETS key=name item=params} |
---|
143 | "{$name}" : { |
---|
144 | {foreach from=$params key=key item=value} |
---|
145 | "{$key}" : "{$value}", |
---|
146 | {/foreach} |
---|
147 | }, |
---|
148 | {/foreach} |
---|
149 | }; |
---|
150 | {/footer_script} |
---|
151 | |
---|
152 | |
---|
153 | {html_style} |
---|
154 | {foreach from=$fonts item=path key=font} |
---|
155 | @font-face { |
---|
156 | font-family: '{$font}'; |
---|
157 | src: url({$path}) format("truetype"); |
---|
158 | } |
---|
159 | {/foreach} |
---|
160 | {/html_style} |
---|
161 | |
---|
162 | |
---|
163 | <div class="titrePage"> |
---|
164 | <h2>Crypto Captcha</h2> |
---|
165 | </div> |
---|
166 | |
---|
167 | <form method="post" class="properties"> |
---|
168 | <fieldset> |
---|
169 | <legend>{'Configuration'|translate}</legend> |
---|
170 | |
---|
171 | <ul> |
---|
172 | <li> |
---|
173 | <b><label for="guest_only">{'Only for unauthenticated users'|translate}</label></b> |
---|
174 | <input type="checkbox" name="guest_only" id="guest_only" {if $crypto.guest_only}checked{/if}> |
---|
175 | </li> |
---|
176 | <li> |
---|
177 | <b>{'Activate on'|translate}</b> |
---|
178 | <select name="activate_on[]" multiple placeholder="{'Nowhere'|translate}"> |
---|
179 | <option value="picture" {if $crypto.activate_on.picture}selected{/if}>{'Picture comments'|translate}</option> |
---|
180 | {if $loaded.category}<option value="category" {if $crypto.activate_on.category}selected{/if}>{'Album comments'|translate}</option>{/if} |
---|
181 | <option value="register" {if $crypto.activate_on.register}selected{/if}>{'Register form'|translate}</option> |
---|
182 | {if $loaded.contactform}<option value="contactform" {if $crypto.activate_on.contactform}selected{/if}>{'Contact form'|translate}</option>{/if} |
---|
183 | {if $loaded.guestbook}<option value="guestbook" {if $crypto.activate_on.guestbook}selected{/if}>{'Guestbook'|translate}</option>{/if} |
---|
184 | </select> |
---|
185 | </li> |
---|
186 | <li> |
---|
187 | <b>{'Comments action'|translate}</b> |
---|
188 | <label><input type="radio" name="comments_action" value="reject" {if $crypto.comments_action == 'reject'}checked="checked"{/if}> {'Reject'|translate}</label> |
---|
189 | <label><input type="radio" name="comments_action" value="moderate" {if $crypto.comments_action == 'moderate'}checked="checked"{/if}> {'Moderate'|translate}</label> |
---|
190 | </li> |
---|
191 | <li> |
---|
192 | <b>{'Captcha type'|translate}</b> |
---|
193 | <label><input type="radio" name="captcha_type" class="preview" value="string" {if $crypto.captcha_type == 'string'}checked="checked"{/if}> {'Random string'|translate}</label> |
---|
194 | <label><input type="radio" name="captcha_type" class="preview" value="math" {if $crypto.captcha_type == 'math'}checked="checked"{/if}> {'Simple equation'|translate}</label> |
---|
195 | </li> |
---|
196 | <!--<li> |
---|
197 | <b>{'Case sensitive'|translate}</b> |
---|
198 | <label><input type="radio" name="case_sensitive" value="false" {if $crypto.case_sensitive == 'false'}checked="checked"{/if}> {'No'|translate}</label> |
---|
199 | <label><input type="radio" name="case_sensitive" value="true" {if $crypto.case_sensitive == 'true'}checked="checked"{/if}> {'Yes'|translate}</label> |
---|
200 | </li>--> |
---|
201 | <li> |
---|
202 | <b>{'Code lenght'|translate}</b> |
---|
203 | <label><input type="text" name="code_length" class="preview" value="{$crypto.code_length}" size="6" maxlength="2"></label> |
---|
204 | </li> |
---|
205 | <li> |
---|
206 | <b>{'Width'|translate}</b> |
---|
207 | <label><input type="text" name="width" class="preview" value="{$crypto.width}" size="6" maxlength="3"> {'good value:'|translate} lenght×30</label> |
---|
208 | </li> |
---|
209 | <li> |
---|
210 | <b>{'Height'|translate}</b> |
---|
211 | <label><input type="text" name="height" class="preview" value="{$crypto.height}" size="6" maxlength="3"> {'good value:'|translate} lenght×12</label> |
---|
212 | </li> |
---|
213 | <li> |
---|
214 | <b>{'Button color'|translate}</b> |
---|
215 | <a class="button {if $crypto.button_color == 'dark'}selected{/if}" data-val="dark" data-input="button_color"><img src="{$CRYPTO_PATH}template/refresh_dark.png" alt="dark"></a> |
---|
216 | <a class="button {if $crypto.button_color == 'light'}selected{/if}" data-val="light" data-input="button_color"><img src="{$CRYPTO_PATH}template/refresh_light.png" alt="light"></a> |
---|
217 | <input type="hidden" name="button_color" value="{$crypto.button_color}"> |
---|
218 | </li> |
---|
219 | <li> |
---|
220 | <b>{'Captcha theme'|translate}</b> |
---|
221 | {foreach from=$PRESETS key=preset item=params} |
---|
222 | <a class="button {if $crypto.theme == $preset}selected{/if}" data-val="{$preset}" data-input="theme"><img src="{$CRYPTO_PATH}template/presets/{$preset}.png" alt="{$preset}"></a> |
---|
223 | {/foreach} |
---|
224 | <input type="hidden" name="theme" value="{$crypto.theme}"> |
---|
225 | <a class="customize">{'Customize'|translate}</a> |
---|
226 | </li> |
---|
227 | </ul> |
---|
228 | |
---|
229 | <fieldset {if $crypto.theme != 'custom'}style="display:none;"{/if} id="theming"> |
---|
230 | <legend>{'Customize'|translate}</legend> |
---|
231 | |
---|
232 | <ul> |
---|
233 | <li> |
---|
234 | <b>{'Perturbation'|translate}</b> |
---|
235 | <label><input type="text" name="perturbation" value="{$crypto.perturbation}" class="istheme preview" size="6" maxlength="4"> {'range:'|translate} 0 - 1</label> |
---|
236 | </li> |
---|
237 | <li> |
---|
238 | <b>{'Background'|translate}</b> |
---|
239 | <label><input type="radio" name="background" class="istheme preview" value="color" {if $crypto.background == 'color'}checked="checked"{/if}> {'Color'|translate}</label> |
---|
240 | <label><input type="radio" name="background" class="istheme preview" value="image" {if $crypto.background == 'image'}checked="checked"{/if}> {'Image'|translate}</label> |
---|
241 | </li> |
---|
242 | <li id="background-color" {if $crypto.background != 'color'}style="display:none;"{/if}> |
---|
243 | <b>{'Background color'|translate}</b> |
---|
244 | <label><input type="text" name="bg_color" value="{$crypto.bg_color}" class="colorpicker-input istheme preview" size="6" maxlength="6"></label> |
---|
245 | <a class="random" title="{'random'|translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a> |
---|
246 | </li> |
---|
247 | <li id="background-image" {if $crypto.background != 'image'}style="display:none;"{/if}> |
---|
248 | <b>{'Background image'|translate}</b> |
---|
249 | {foreach from=$backgrounds item=path key=background} |
---|
250 | <a class="button {if $crypto.bg_image == $background}selected{/if}" data-val="{$background}" data-input="bg_image"><img src="{$path}" alt="{$background}" style="width:120px;height:40px;"></a> |
---|
251 | {/foreach} |
---|
252 | <!-- <a class="button {if $crypto.bg_image == 'random'}selected{/if}" title="{'random'|translate}" data-val="random" data-input="bg_image"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a> --> |
---|
253 | <input type="hidden" name="bg_image" value="{$crypto.bg_image}" class="istheme preview"> |
---|
254 | </li> |
---|
255 | <li> |
---|
256 | <b>{'Text color'|translate}</b> |
---|
257 | <label><input type="text" name="text_color" value="{$crypto.text_color}" class="colorpicker-input istheme preview" size="6" maxlength="6"></label> |
---|
258 | <a class="random" title="{'random'|translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a> |
---|
259 | </li> |
---|
260 | <li> |
---|
261 | <b>{'Lines density'|translate}</b> |
---|
262 | <label><input type="text" name="num_lines" value="{$crypto.num_lines}" class="istheme preview" size="6" maxlength="4"> {'range:'|translate} 0 - 10</label> |
---|
263 | </li> |
---|
264 | <li> |
---|
265 | <b>{'Lines color'|translate}</b> |
---|
266 | <label><input type="text" name="line_color" value="{$crypto.line_color}" class="colorpicker-input istheme preview" size="6" maxlength="6"></label> |
---|
267 | <a class="random" title="{'random'|translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a> |
---|
268 | </li> |
---|
269 | <li> |
---|
270 | <b>{'Noise level'|translate}</b> |
---|
271 | <label><input type="text" name="noise_level" value="{$crypto.noise_level}" class="istheme preview" size="6" maxlength="4"> {'range:'|translate} 0 - 10</label> |
---|
272 | </li> |
---|
273 | <li> |
---|
274 | <b>{'Noise color'|translate}</b> |
---|
275 | <label><input type="text" name="noise_color" value="{$crypto.noise_color}" class="colorpicker-input istheme preview" size="6" maxlength="6"></label> |
---|
276 | <a class="random" title="{'random'|translate}"><img src="{$CRYPTO_PATH}/template/arrow_switch.png"></a> |
---|
277 | </li> |
---|
278 | <li> |
---|
279 | <b>{'Font'|translate}</b> |
---|
280 | {foreach from=$fonts item=path key=font} |
---|
281 | <label style="font-family:{$font};" title="{$font}"><input type="radio" name="ttf_file" value="{$font}" {if $crypto.ttf_file == $font}checked="checked"{/if} class="istheme preview"> {$font}</label> |
---|
282 | {/foreach} |
---|
283 | </li> |
---|
284 | </ul> |
---|
285 | |
---|
286 | {'Tip: type "random" on a color field to have a random color'|translate} |
---|
287 | </fieldset> |
---|
288 | |
---|
289 | <ul style="margin-top:30px;"> |
---|
290 | <li> |
---|
291 | <b>{'Preview'|translate}</b> |
---|
292 | <img id="captcha" src="{$CRYPTO_PATH}securimage/securimage_show.php" alt="CAPTCHA Image"> |
---|
293 | <a href="#" onClick="return false;"><img id="reload" src="{$CRYPTO_PATH}template/refresh_{$crypto.button_color}.png"></a> |
---|
294 | </li> |
---|
295 | </ul> |
---|
296 | |
---|
297 | </fieldset> |
---|
298 | |
---|
299 | <p class="formButtons"><input class="submit" type="submit" value="{'Submit'|translate}" name="submit"></p> |
---|
300 | </form> |
---|
301 | |
---|
302 | <div style="text-align:right;"> |
---|
303 | All free fonts from <a href="http://www.dafont.com" target="_blank">dafont.com</a> | |
---|
304 | Powered by : <a href="http://www.phpcaptcha.org/" target="_blank"><img src="{$CRYPTO_PATH}template/logo.png" alt="Secureimage"></a> |
---|
305 | </div> |
---|