Revision 756
Added by thorn over 16 years ago
captcha.php | ||
---|---|---|
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
if(!function_exists('call_captcha')) { |
82 |
function call_captcha($action='all') { |
|
82 |
function call_captcha($action='all', $style='') {
|
|
83 | 83 |
global $MOD_CAPTCHA; |
84 | 84 |
$t = time(); |
85 | 85 |
$_SESSION['captcha_time'] = $t; |
... | ... | |
90 | 90 |
case 'text': // text-captcha |
91 | 91 |
?><table class="captcha_table"><tr> |
92 | 92 |
<td class="text_captcha"><?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?></td> |
93 |
<td><input type="text" name="captcha" maxlength="50" style="width:150px" /></td> |
|
93 |
<td><input type="text" name="captcha" maxlength="50" style="width:150px;" /></td>
|
|
94 | 94 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_QUEST']; ?></td> |
95 | 95 |
</tr></table><?php |
96 | 96 |
break; |
... | ... | |
98 | 98 |
case 'calc_text': // calculation as text |
99 | 99 |
?><table class="captcha_table"><tr> |
100 | 100 |
<td class="text_captcha"><?php include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); ?> = </td> |
101 |
<td><input type="text" name="captcha" maxlength="10" style="width:20px" /></td> |
|
101 |
<td><input type="text" name="captcha" maxlength="10" style="width:20px;" /></td>
|
|
102 | 102 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></td> |
103 | 103 |
</tr></table><?php |
104 | 104 |
break; |
... | ... | |
106 | 106 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
107 | 107 |
?><table class="captcha_table"><tr> |
108 | 108 |
<td class="image_captcha"><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td><td> = </td> |
109 |
<td><input type="text" name="captcha" maxlength="10" style="width:20px" /></td> |
|
109 |
<td><input type="text" name="captcha" maxlength="10" style="width:20px;" /></td>
|
|
110 | 110 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; ?></td> |
111 | 111 |
</tr></table><?php |
112 | 112 |
break; |
... | ... | |
115 | 115 |
case 'old_image': // old captcha |
116 | 116 |
?><table class="captcha_table"><tr> |
117 | 117 |
<td class="image_captcha"><img src="<?php echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t"; ?>" alt="Captcha" /></td> |
118 |
<td><input type="text" name="captcha" maxlength="10" style="width:50px" /></td> |
|
118 |
<td><input type="text" name="captcha" maxlength="10" style="width:50px;" /></td>
|
|
119 | 119 |
<td class="captcha_expl"><?php echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; ?></td> |
120 | 120 |
</tr></table><?php |
121 | 121 |
break; |
... | ... | |
124 | 124 |
switch(CAPTCHA_TYPE) { |
125 | 125 |
case 'text': // text-captcha |
126 | 126 |
case 'calc_text': // calculation as text |
127 |
echo ($style?"<span $style>":''); |
|
127 | 128 |
include(WB_PATH.'/include/captcha/captchas/'.CAPTCHA_TYPE.'.php'); |
129 |
echo ($style?'</span>':''); |
|
128 | 130 |
break; |
129 | 131 |
case 'calc_image': // calculation with image (old captcha) |
130 | 132 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
131 | 133 |
case 'ttf_image': // captcha with varying background and ttf-font |
132 | 134 |
case 'old_image': // old captcha |
133 |
echo WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t";
|
|
135 |
echo "<img $style src=\"".WB_URL.'/include/captcha/captchas/'.CAPTCHA_TYPE.".php?t=$t\" />";
|
|
134 | 136 |
break; |
135 | 137 |
} |
136 | 138 |
} elseif($action=='input') { |
137 | 139 |
switch(CAPTCHA_TYPE) { |
138 | 140 |
case 'text': // text-captcha |
139 |
?><input type="text" name="captcha" maxlength="50" style="width:150px" /><?php
|
|
141 |
echo '<input type="text" name="captcha" '.($style?$style:'style="width:150px;" maxlength="50"').' />';
|
|
140 | 142 |
break; |
141 | 143 |
case 'calc_text': // calculation as text |
142 |
?><input type="text" name="captcha" maxlength="10" style="width:20px" /><?php |
|
143 |
break; |
|
144 | 144 |
case 'calc_image': // calculation with image (old captcha) |
145 | 145 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
146 |
?><input type="text" name="captcha" maxlength="10" style="width:20px" /><?php
|
|
146 |
echo '<input type="text" name="captcha" '.($style?$style:'style="width:20px;" maxlength="10"').' />';
|
|
147 | 147 |
break; |
148 |
// normal images |
|
149 | 148 |
case 'ttf_image': // captcha with varying background and ttf-font |
150 | 149 |
case 'old_image': // old captcha |
151 |
?><input type="text" name="captcha" maxlength="10" style="width:50px" /><?php
|
|
150 |
echo '<input type="text" name="captcha" '.($style?$style:'style="width:50px;" maxlength="10"').' />';
|
|
152 | 151 |
break; |
153 | 152 |
} |
154 | 153 |
} elseif($action=='text') { |
154 |
echo ($style?"<span $style>":''); |
|
155 | 155 |
switch(CAPTCHA_TYPE) { |
156 |
// one special case |
|
157 | 156 |
case 'text': // text-captcha |
158 | 157 |
echo $MOD_CAPTCHA['VERIFICATION_INFO_QUEST']; |
159 | 158 |
break; |
160 |
// two special cases |
|
161 | 159 |
case 'calc_text': // calculation as text |
162 |
echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; |
|
163 |
break; |
|
164 | 160 |
case 'calc_image': // calculation with image (old captcha) |
165 | 161 |
case 'calc_ttf_image': // calculation with varying background and ttf-font |
166 | 162 |
echo $MOD_CAPTCHA['VERIFICATION_INFO_RES']; |
167 | 163 |
break; |
168 |
// normal images |
|
169 | 164 |
case 'ttf_image': // captcha with varying background and ttf-font |
170 | 165 |
case 'old_image': // old captcha |
171 | 166 |
echo $MOD_CAPTCHA['VERIFICATION_INFO_TEXT']; |
172 | 167 |
break; |
173 | 168 |
} |
169 |
echo ($style?'</span>':''); |
|
174 | 170 |
} |
175 | 171 |
} |
176 | 172 |
} |
Also available in: Unified diff
call_captcha: added parameter 'style', fixed some issue with parameter 'image' and text-style captchas