plugins/SpecialAdmin.php
changeset 133 af0f6ec48de3
parent 130 c4ce1640e1f4
child 140 40f7fa5fd061
equal deleted inserted replaced
132:0ae1b281a884 133:af0f6ec48de3
   189     
   189     
   190     setConfig('smtp_server', $_POST['smtp_host']);
   190     setConfig('smtp_server', $_POST['smtp_host']);
   191     setConfig('smtp_user', $_POST['smtp_user']);
   191     setConfig('smtp_user', $_POST['smtp_user']);
   192     if($_POST['smtp_pass'] != 'XXXXXXXXXXXX') setConfig('smtp_password', $_POST['smtp_pass']);
   192     if($_POST['smtp_pass'] != 'XXXXXXXXXXXX') setConfig('smtp_password', $_POST['smtp_pass']);
   193     
   193     
       
   194     // Password strength
       
   195     if ( isset($_POST['pw_strength_enable']) ) setConfig('pw_strength_enable', '1');
       
   196     else                                       setConfig('pw_strength_enable', '0');
       
   197     
       
   198     $strength = intval($_POST['pw_strength_minimum']);
       
   199     if ( $strength >= -10 && $strength <= 30 )
       
   200     {
       
   201       $strength = strval($strength);
       
   202       setConfig('pw_strength_minimum', $strength);
       
   203     }
       
   204     
   194     echo '<div class="info-box">Your changes to the site configuration have been saved.</div><br />';
   205     echo '<div class="info-box">Your changes to the site configuration have been saved.</div><br />';
   195     
   206     
   196   }
   207   }
   197   else if ( isset($_POST['submit']) && defined('ENANO_DEMO_MODE') )
   208   else if ( isset($_POST['submit']) && defined('ENANO_DEMO_MODE') )
   198   {
   209   {
   334           echo '<label><input'; if(getConfig('account_activation') == 'disable') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="disable" /> Disable registration</label><br />';
   345           echo '<label><input'; if(getConfig('account_activation') == 'disable') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="disable" /> Disable registration</label><br />';
   335           echo '<label><input'; if(getConfig('account_activation') != 'user' && getConfig('account_activation') != 'admin') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="none" /> None</label>';
   346           echo '<label><input'; if(getConfig('account_activation') != 'user' && getConfig('account_activation') != 'admin') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="none" /> None</label>';
   336           echo '<label><input'; if(getConfig('account_activation') == 'user') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="user" /> User</label>';
   347           echo '<label><input'; if(getConfig('account_activation') == 'user') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="user" /> User</label>';
   337           echo '<label><input'; if(getConfig('account_activation') == 'admin') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="admin" /> Admin</label>';
   348           echo '<label><input'; if(getConfig('account_activation') == 'admin') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="admin" /> Admin</label>';
   338           ?>
   349           ?>
       
   350         </td>
       
   351       </tr>
       
   352       
       
   353       <tr><th colspan="2">Password strength</th></tr>
       
   354       
       
   355       <tr>
       
   356         <td class="row2">
       
   357           <b>Enable password strength analysis</b><br />
       
   358           <small>This should be enabled in most cases. When this is enabled, a strength meter and a numerical score will be displayed wherever a password can be changed.</small>
       
   359         </td>
       
   360         <td class="row2">
       
   361           <label><input type="checkbox" name="pw_strength_enable" <?php if ( getConfig('pw_strength_enable') == '1' ) echo 'checked="checked" '; ?>/> Enabled</label>
       
   362         </td>
       
   363       </tr>
       
   364       
       
   365       <tr>
       
   366         <td class="row1">
       
   367           <b>Minimum strength score</b><br />
       
   368           <small>This is the lowest score a password will be allowed to have. -10 will allow any password. A score of under -3 is considered weak, under 1 is fair, under 4 is good, under 10 is strong, and 10 and above are very strong. The scale is open-ended. This only has an effect if the meter is enabled above.</small>
       
   369         </td>
       
   370         <td class="row1">
       
   371           <input type="text" name="pw_strength_minimum" value="<?php echo ( $x = getConfig('pw_strength_minimum') ) ? $x : '-10'; ?>" />
   339         </td>
   372         </td>
   340       </tr>
   373       </tr>
   341       
   374       
   342     <!-- E-mail options -->
   375     <!-- E-mail options -->
   343     
   376     
   944       }
   977       }
   945     }
   978     }
   946     else
   979     else
   947     {
   980     {
   948       $disabled = ( $r['user_id'] == $session->user_id ) ? ' disabled="disabled" ' : '';
   981       $disabled = ( $r['user_id'] == $session->user_id ) ? ' disabled="disabled" ' : '';
       
   982       $evt_get_score = ( getConfig('pw_strength_enable') == '1' ) ? 'onkeyup="password_score_field(this);" style="margin-right: 7px;" ' : '';
       
   983       $meter         = ( getConfig('pw_strength_enable') == '1' ) ? '<tr><td></td><td><div id="pwmeter"></div><p><small>Password complexity requirements are not enforced here.</small></p></td></tr>' : '';
   949       echo('
   984       echo('
   950       <h3>Edit User Info</h3>
   985       <h3>Edit User Info</h3>
   951       <form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post">
   986       <form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post">
   952         <table border="0" style="margin-left: 0.2in;">   
   987         <table border="0" style="margin-left: 0.2in;">   
   953           <tr><td>Username:</td><td><input type="text" name="new_username" value="'.$r['username'].'" /></td></tr>
   988           <tr><td>Username:</td><td><input type="text" name="new_username" value="'.$r['username'].'" /></td></tr>
   954           <tr><td>New Password:</td><td><input ' . $disabled . ' type="password" name="new_pass" /></td></tr>
   989           <tr><td>New Password:</td><td><input ' . $disabled . ' type="password" name="new_pass" '.$evt_get_score.'/></td></tr>
       
   990           '.$meter.'
   955           <tr><td>E-mail:</td><td><input ' . $disabled . ' type="text" name="email" value="'.$r['email'].'" /></td></tr>
   991           <tr><td>E-mail:</td><td><input ' . $disabled . ' type="text" name="email" value="'.$r['email'].'" /></td></tr>
   956           <tr><td>Real Name:</td><td><input ' . $disabled . ' type="text" name="real_name" value="'.$r['real_name'].'" /></td></tr>
   992           <tr><td>Real Name:</td><td><input ' . $disabled . ' type="text" name="real_name" value="'.$r['real_name'].'" /></td></tr>
   957           ' . ( ( !empty($disabled) ) ? '<tr><td colspan="2"><small>To change your e-mail address, password, or real name, please use the user control panel.</small></td></tr>' : '' ) . '
   993           ' . ( ( !empty($disabled) ) ? '<tr><td colspan="2"><small>To change your e-mail address, password, or real name, please use the user control panel.</small></td></tr>' : '' ) . '
   958           <tr><td>User level:</td><td><select name="level"><option '); if($r['user_level']==USER_LEVEL_CHPREF) echo('SELECTED'); echo(' value="'.USER_LEVEL_CHPREF.'">Regular User</option><option '); if($r['user_level']==USER_LEVEL_MOD) echo('SELECTED'); echo(' value="'.USER_LEVEL_MOD.'">Moderator</option><option '); if($r['user_level']==USER_LEVEL_ADMIN) echo('SELECTED'); echo(' value="'.USER_LEVEL_ADMIN.'">Administrator</option></select></td></tr>
   994           <tr><td>User level:</td><td><select name="level"><option '); if($r['user_level']==USER_LEVEL_CHPREF) echo('SELECTED'); echo(' value="'.USER_LEVEL_CHPREF.'">Regular User</option><option '); if($r['user_level']==USER_LEVEL_MOD) echo('SELECTED'); echo(' value="'.USER_LEVEL_MOD.'">Moderator</option><option '); if($r['user_level']==USER_LEVEL_ADMIN) echo('SELECTED'); echo(' value="'.USER_LEVEL_ADMIN.'">Administrator</option></select></td></tr>
   959           <tr><td></td><td><label><input type="checkbox" name="account_active"' . ( $r['account_active'] == '1' ? ' checked="checked"' : '' ) . ' /> Account is active</label><br /><small>If this is unchecked, the activation key will be reset, meaning that any activation e-mails sent will be invalidated.</small></td></tr>
   995           <tr><td></td><td><label><input type="checkbox" name="account_active"' . ( $r['account_active'] == '1' ? ' checked="checked"' : '' ) . ' /> Account is active</label><br /><small>If this is unchecked, the activation key will be reset, meaning that any activation e-mails sent will be invalidated.</small></td></tr>