summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/ui.lib.php4
-rw-r--r--modules/captcha/captcha.php12
-rw-r--r--templates/show_user_registration.inc.php19
3 files changed, 19 insertions, 16 deletions
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index 2f50256b..815b995a 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -734,7 +734,9 @@ mail (conf('mail_from'), "New user registration at $title", $admin_body, $from);
*/
function show_registration_agreement() {
- $filename = conf('prefix') . '/config/registration_agreement.php';
+ $filename = Config::get('prefix') . '/config/registration_agreement.php';
+
+ if (!file_exists($filename)) { return false; }
/* Check for existance */
$fp = fopen($filename,'r');
diff --git a/modules/captcha/captcha.php b/modules/captcha/captcha.php
index 63df46c9..1b419cc6 100644
--- a/modules/captcha/captcha.php
+++ b/modules/captcha/captcha.php
@@ -43,7 +43,7 @@ class captcha {
/* yields <input> fields html string (no complete form), with captcha
image already embedded as data:-URI
*/
- function form($title="&rarr; retype that here", $more="<small><br>Enter the correct letters and numbers from the image into the text box. <br>This small test serves as access restriction against malicious bots. <br>Simply reload the page if this graphic is too hard to read.</small>") {
+ public static function form($title="&rarr; retype that here", $more="<small><br>Enter the correct letters and numbers from the image into the text box. <br>This small test serves as access restriction against malicious bots. <br>Simply reload the page if this graphic is too hard to read.</small>") {
$pw = captcha::mkpass();
$hash = captcha::hash($pw);
$maxsize = (strpos("MSIE", $_SERVER["HTTP_USER_AGENT"]) ? 1000 : 6000);
@@ -84,7 +84,7 @@ END;
/* generates alternative (non-graphic), human-understandable
representation of the passphrase
*/
- function textual_riddle($phrase) {
+ public static function textual_riddle($phrase) {
$symbols0 = '"\'-/_:';
$symbols1 = array("\n,", "\n;", ";", "\n&", "\n-", ",", ",", "\nand then", "\nfollowed by", "\nand", "\nand not a\n\"".chr(65+rand(0,26))."\",\nbut");
$s = "Guess the letters and numbers\n(passphrase riddle)\n--\n";
@@ -146,7 +146,7 @@ END;
/* returns jpeg file stream with unscannable letters encoded
in front of colorful disturbing background
*/
- function image($phrase, $width=200, $height=60, $inverse=0, $maxsize=0xFFFFF) {
+ public static function image($phrase, $width=200, $height=60, $inverse=0, $maxsize=0xFFFFF) {
#-- initialize in-memory image with gd library
srand(microtime()*21017);
@@ -252,13 +252,13 @@ if (preg_match('|MSIE ([0-9].[0-9]{1,2})|',$_SERVER["HTTP_USER_AGENT"],$matched)
/* helper code */
- function random_color($img, $a,$b) {
+ public static function random_color($img, $a,$b) {
return imagecolorallocate($img, rand($a,$b), rand($a,$b), rand($a,$b));
}
/* unreversable hash from passphrase, with time() slice encoded */
- function hash($text, $dtime=0) {
+ public static function hash($text, $dtime=0) {
$text = strtolower($text);
$pfix = (int) (time() / CAPTCHA_TIMEOUT) + $dtime;
return md5("captcha::$pfix:$text::".__FILE__.":$_SERVER[SERVER_NAME]:80");
@@ -268,7 +268,7 @@ if (preg_match('|MSIE ([0-9].[0-9]{1,2})|',$_SERVER["HTTP_USER_AGENT"],$matched)
/* makes string of random letters for embedding into image and for
encoding as hash, later verification
*/
- function mkpass() {
+ public static function mkpass() {
$s = "";
for ($n=0; $n<10; $n++) {
$s .= chr(rand(0, 255));
diff --git a/templates/show_user_registration.inc.php b/templates/show_user_registration.inc.php
index 29cf8f9f..236e436d 100644
--- a/templates/show_user_registration.inc.php
+++ b/templates/show_user_registration.inc.php
@@ -63,7 +63,7 @@ if (Config::get('user_agreement')) { ?>
<tr>
<td>
<input type='checkbox' name='accept_agreement'> <?php echo _('I Accept'); ?>
- <?php $GLOBALS['error']->print_error('user_agreement'); ?>
+ <?php Error::display('user_agreement'); ?>
</td>
</tr>
</table>
@@ -115,19 +115,20 @@ if (Config::get('user_agreement')) { ?>
<font color='red'>*</font> <input type='password' name='password_2' id='password_2' />
</td>
</tr>
-<?php if (Config::get('captcha_public_reg')) { ?>
- <tr>
- <?php echo captcha::form(); ?>
- <?php Error::display('captcha'); ?>
- </tr>
-<?php } ?>
<tr>
- <td colspan='2' align='center' height='20'>
+ <td align='center' height='20'>
<span style="color:red;">* Required fields</span>
</td>
+ <td>&nbsp;</td>
</tr>
+</table>
+<?php if (Config::get('captcha_public_reg')) { ?>
+ <?php echo captcha::form(); ?>
+ <?php Error::display('captcha'); ?>
+<?php } ?>
+<table>
<tr>
- <td colspan='2' align='center' height='50'>
+ <td align='center' height='50'>
<input type="hidden" name="action" value="add_user" />
<input type='submit' name='submit_registration' id='submit_registration' value='<?php echo _('Register User'); ?>' />
</td>