diff options
author | xgizzmo <xgizzmo@ampache> | 2006-07-24 22:14:54 +0000 |
---|---|---|
committer | xgizzmo <xgizzmo@ampache> | 2006-07-24 22:14:54 +0000 |
commit | 5204485094d0f9dd7cbb5156cf402c86fcbb7ceb (patch) | |
tree | d5e1df30f7f32892b466298b2e80fc63625d5a13 | |
parent | 5ca15d0423b736b37d9f772b54042dee66fe9a85 (diff) | |
download | ampache-5204485094d0f9dd7cbb5156cf402c86fcbb7ceb.tar.gz ampache-5204485094d0f9dd7cbb5156cf402c86fcbb7ceb.tar.bz2 ampache-5204485094d0f9dd7cbb5156cf402c86fcbb7ceb.zip |
Fix for bug 397 and 498 thanks pb1dft
-rw-r--r-- | config/ampache.cfg.php.dist | 10 | ||||
-rw-r--r-- | lib/debug.php | 12 | ||||
-rw-r--r-- | lib/ui.lib.php | 20 | ||||
-rw-r--r-- | modules/captcha/captcha.php | 30 | ||||
-rw-r--r-- | register.php | 2 | ||||
-rw-r--r-- | templates/show_test.inc | 6 |
6 files changed, 53 insertions, 27 deletions
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist index bb0adc7a..f91d3be8 100644 --- a/config/ampache.cfg.php.dist +++ b/config/ampache.cfg.php.dist @@ -296,14 +296,20 @@ refresh_limit = "60" #mail_domain = "domain.tld" # This setting will be used as mail from address. +# It will also be used to notify if a registration occured. # You need to change this when you activate public_registration. #mail_from = "info@domain.tld" +# This setting turns on/off admin notify off registration. +# DEFAULT: false +#admin_notify_reg = "false" + # This setting will allow all registrants to be auto-approved # as a user. By default, they will be added as a guest and # must be "promoted" by the admin. -# DEFAULT: false -#auto_user = "false" +# POSSIBLE VALUES: guest, user, admin +# DEFAULT: guest +#auto_user = "guest" # This will display the user agreement when registering # For agreement text, edit templates/user_agreement.php diff --git a/lib/debug.php b/lib/debug.php index b6564d8e..637ca178 100644 --- a/lib/debug.php +++ b/lib/debug.php @@ -34,6 +34,8 @@ file is readable, overkill I know.. @param level 0 is readable, 1 detailed info */ + + function read_config_file($file,$level=0) { $fp = @fopen($file, 'r'); @@ -186,7 +188,7 @@ function check_php_pcre() { least set the needed variables */ function check_config_values($conf) { - + $error = new Error(); if (!$conf['local_host']) { return false; } @@ -211,7 +213,13 @@ function check_config_values($conf) { if (!isset($conf['sess_cookiesecure'])) { return false; } - + if (isset($conf['debug'])) { + if (!isset($conf['log_path'])) { + $error->add_error('log_path',_("You defined the option \"debug = on\" but didn't define a log path for the log to be stored")); + return false; + } + } + return true; } // check_config_values diff --git a/lib/ui.lib.php b/lib/ui.lib.php index 7ccd43b6..3b7d7150 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -1106,6 +1106,26 @@ Thank you for registering."; mail($email, "Welcome to $title" , $body, $from); +if (conf('admin_notify_reg')){ + +$admin_body = "A new user has registered at $title + +The following values where entered; + +Username: $username +Fullname: $fullname +E-Mail: $email + +Click here to view user: +" + . conf('web_path') . "/admin/users.php?action=edit&user=$username"; + + + +mail (conf('mail_from'), "New user registration at $title", $admin_body, $from); +} + + } //send_confirmation /** diff --git a/modules/captcha/captcha.php b/modules/captcha/captcha.php index 039d1907..9f6c0a06 100644 --- a/modules/captcha/captcha.php +++ b/modules/captcha/captcha.php @@ -46,8 +46,7 @@ class captcha { function form($title="→ 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); - $maxsize = 100; + $maxsize = (strpos("MSIE", $_SERVER["HTTP_USER_AGENT"]) ? 1000 : 6000); @header("Vary: User-Agent"); $img = "data:image/jpeg;base64," . base64_encode(captcha::image($pw, 200, 60, CAPTCHA_INVERSE, $maxsize)); @@ -61,20 +60,10 @@ class captcha { . '</td><td>'.$more.'</td>' . '</tr></table>'; -// '<table border="0" summary="captcha input"><tr>' -// '<img name="captcha_image" id="captcha_image" src="'.$img. '" height="60" width="200" alt="'.$alt. '" /></td>' -// . '<td><img name="captcha_image" id="captcha_image" src="'.$img.'" height="60" width="200" alt="'.$alt. '" /></td>' -// . '<td>'.$title. '<br/><input name="captcha_hash" type="hidden" value="'.$hash. '" />' -// ''.$title. '<br/><input name="captcha_hash" type="hidden" value="'.$hash. '" />' -// . '<input name="captcha_input" type="text" size="7" maxlength="16" style="height:23px; font-size:16px; font-weight:450;" />' -// . '<td width="80%">'.$more.'</td>' -// . '</tr></table>'; - #-- js/html fix if ("MSIE") { - $base = "http://$_SERVER[SERVER_NAME]:$_SERVER[SERVER_PORT]/ampache/captcha.php"; -// $base = "http://10.60.60.16/ampache/captcha.php"; -// . substr(realpath(__FILE__), strlen($_SERVER["DOCUMENT_ROOT"])); +// $base = "http://$_SERVER[SERVER_NAME]:$_SERVER[SERVER_PORT]".$conf('web_path')."/modules/captcha/captcha.php"; + $base = $_SERVER['PHP_SELF']; $html .= <<<END <script language="Javascript"><!-- if (/Microsoft/.test(navigator.appName)) { @@ -90,12 +79,6 @@ END; $html = "<div class=\"captcha\">$html</div>"; return($html); } -/*<script language="Javascript"><!-- -if (/Microsoft/.test(navigator.appName)) { - var img = document.captcha_image; - img.src = "$base?_ddu=" + img.src.substr(23); - } ---></script>/* /* generates alternative (non-graphic), human-understandable @@ -245,8 +228,13 @@ if (/Microsoft/.test(navigator.appName)) { } #-- let JFIF stream be generated -// $quality = 67; +/* Drop down quality if browser is MSIE */ +if (preg_match('|MSIE ([0-9].[0-9]{1,2})|',$_SERVER["HTTP_USER_AGENT"],$matched)){ $quality = 8; + } else { + $quality = 100; + } + $s = array(); do { ob_start(); ob_implicit_flush(0); diff --git a/register.php b/register.php index 8461f458..df3fa5cf 100644 --- a/register.php +++ b/register.php @@ -143,7 +143,7 @@ switch ($action) { /* Attempt to create the new user */ $access = 'disabled'; - if (conf('auto_user')) { $access = '5'; } + if (conf('auto_user')) { $access = conf('auto_user'); } $new_user = $GLOBALS['user']->create($username,$fullname,$email,$pass1,$access); if (!$new_user) { diff --git a/templates/show_test.inc b/templates/show_test.inc index 237f48cc..54157c65 100644 --- a/templates/show_test.inc +++ b/templates/show_test.inc @@ -174,7 +174,11 @@ $row_classes = array('even','odd'); </td> <td> <?php echo _("This test makes sure that you have set all of the required configuration variables and that we are able to - completely parse your config file"); ?> + completely parse your config file"); + echo " <font color=\"red\">"; + $error->print_error('log_path'); + echo " </font> "; + ?> </td> </tr> <tr> |