Blame Scripts/Php/Webenv/admin/p_users.php

878a2b
878a2b
/***
878a2b
 * Useradmin page.
878a2b
 *
878a2b
 * This page sumarize the actions needed to administer users into LDAP
878a2b
 * directory server's database.
878a2b
 *
878a2b
 * --
878a2b
 * 2009 (c) Alain Reguera Delgado <al@ciget.cienfuegos.cu>
878a2b
 * Released under GPL lisence (http://www.fsf.org/licensing/licenses/gpl.txt)
878a2b
 */
878a2b
878a2b
878a2b
//-------------/* Show error if this page is called directly.
878a2b
878a2b
    if ( basename($_SERVER['PHP_SELF']) <> 'index.php')
878a2b
    {
878a2b
        echo '

Sorry, this page can\'t be served directly. ';

878a2b
        echo 'Try this instead.';
878a2b
        exit;
878a2b
    }
878a2b
878a2b
//------------|* Define filter.
878a2b
878a2b
    $filter = $ldap->build_filter_string(); 
878a2b
878a2b
/*------------|* Initialize entry values. */
878a2b
878a2b
    $entries = $ldap->get_entries( $filter );
878a2b
878a2b
/*------------|* Do Action if POST 
878a2b
               *
878a2b
               * Description : Actions take place entry by entry. Just one
878a2b
               * entry at the same time. Actually two actions are supported
878a2b
               * (update,delete). */
878a2b
878a2b
    if ( isset( $_POST['useradmin'] ) )
878a2b
    {
878a2b
        // Define useradmin attributes.
878a2b
        $fields = array('cn', 'userpassword', 'displayname', 'preferredlanguage', 'employeetype');
878a2b
878a2b
        // Recover action to do.
878a2b
        $action = $_POST['action'];
878a2b
878a2b
        // Reinitialize entries values based on input and do action if present
878a2b
        $message = $ldap->init_useradmin_values( $entries, $fields, $action );
878a2b
878a2b
878a2b
        // Reload entry value to reflect changes immediately
878a2b
        $entries = $ldap->get_entries( $filter );
878a2b
    }
878a2b
878a2b
//------------/* Display useradmin action results
878a2b
878a2b
    if ( isset( $message ) )
878a2b
    {
878a2b
        echo $message;
878a2b
    }
878a2b
878a2b
//------------/* Display useradmin title 
878a2b
878a2b
    echo '

' . ucfirst(translate(strtolower('admin'))) . ' ' . translate(strtolower('users')) . '

';
878a2b
878a2b
//------------/* Display useradmin form
878a2b
878a2b
?>
878a2b
878a2b
<form name="ldapusers" action="" method="post">
878a2b
878a2b
    

show_useradmin_info( $entries ) ?>

878a2b
878a2b
    
878a2b
878a2b
    
878a2b
878a2b
        
878a2b
878a2b
        <input type="submit" name="useradmin" value="<?php echo ucfirst(translate('accept'))?>" />
878a2b
878a2b
    
878a2b
878a2b
    
878a2b
878a2b
    
878a2b
878a2b
         
878a2b
878a2b
        
878a2b
878a2b
        
878a2b
878a2b
        
878a2b
878a2b
        
878a2b
878a2b
        
878a2b
878a2b
        
878a2b
878a2b
878a2b
    
878a2b
878a2b
878a2b
    
878a2b
        <input type="checkbox" name="uid[<?php echo $i ?>]" value="<?php echo $entries[$i]['uid'][0]; ?>" />
878a2b
        
878a2b
878a2b
878a2b
        <input type="password" name="userpassword[<?php echo $i ?>]" value="<?php echo $entries[$i]['userpassword'][0]; ?>" size="20" />
878a2b
878a2b
        <input type="text" name="cn[<?php echo $i ?>]" value="<?php echo $entries[$i]['cn'][0]; ?>" size="20" />
878a2b
878a2b
        <input type="text" name="displayname[<?php echo $i ?>]" value="<?php echo $entries[$i]['displayname'][0]; ?>" size="10" />
878a2b
878a2b
        
878a2b
        
878a2b
        
878a2b
878a2b
        
878a2b
        
878a2b
        
878a2b
878a2b
    
878a2b
    
878a2b
878a2b
    
878a2b
878a2b
    
878a2b
878a2b
        <input type="submit" name="useradmin" value="<?php echo ucfirst(translate('accept'))?>" />
878a2b
878a2b
    
878a2b
    
878a2b
</form>