added PHPDoc comments
This commit is contained in:
parent
1c1afe71be
commit
9c71e24ac1
|
@ -34,8 +34,10 @@ $Id$
|
||||||
include_once("createntlm.inc");
|
include_once("createntlm.inc");
|
||||||
|
|
||||||
|
|
||||||
/* Return a list of all shells listed in ../config/shells
|
/**
|
||||||
* Normally ../config/shells is a symbolic link to /etc/shells
|
* Returns a list of shells listed in config/shells.
|
||||||
|
*
|
||||||
|
* @return array list of shell names
|
||||||
*/
|
*/
|
||||||
function getshells() {
|
function getshells() {
|
||||||
// Load shells from file
|
// Load shells from file
|
||||||
|
@ -58,12 +60,12 @@ function getshells() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This function will replace umlates with ascci-chars
|
/**
|
||||||
* fixme ***
|
* This function will return all values from $array without values of $values.
|
||||||
* In order to map all non-ascii characters this function should be changed
|
*
|
||||||
*/
|
* @param array $values list of values which should be removed
|
||||||
/* This function will return all values from $array without values of $values
|
* @param array $array list of original values
|
||||||
* $values, $array and $return are arrays
|
* @return array list of remaining values
|
||||||
*/
|
*/
|
||||||
function array_delete($values, $array) {
|
function array_delete($values, $array) {
|
||||||
// Loop for every entry and check if it should be removed
|
// Loop for every entry and check if it should be removed
|
||||||
|
@ -75,10 +77,14 @@ function array_delete($values, $array) {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
else return array();
|
else return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This function will return a password with max. 8 characters
|
/**
|
||||||
|
* This function will return a password with max. 8 characters.
|
||||||
|
*
|
||||||
|
* @return string password
|
||||||
|
*/
|
||||||
function genpasswd() {
|
function genpasswd() {
|
||||||
// Allowed Characters to generate passwords
|
// Allowed Characters to generate passwords
|
||||||
// I'Ve removed characters like l and 1 because they are too similar
|
// I'Ve removed characters like l and 1 because they are too similar
|
||||||
|
@ -107,11 +113,15 @@ function genpasswd() {
|
||||||
// COMBINE THE CHARACTERS AND DISPLAY TH // E NEW PASSWORD
|
// COMBINE THE CHARACTERS AND DISPLAY TH // E NEW PASSWORD
|
||||||
$PW = $L1 . $U2 . $I1 . $L2 . $I2 . $U1 . $U3 . $L3;
|
$PW = $L1 . $U2 . $I1 . $L2 . $I2 . $U1 . $U3 . $L3;
|
||||||
return $PW;
|
return $PW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* THIS FUNCTION GENERATES A RANDOM NUMBER THAT WILL BE USED TO
|
/**
|
||||||
* RANDOMLY SELECT CHARACTERS FROM THE STRINGS ABOVE
|
* THIS FUNCTION GENERATES A RANDOM NUMBER THAT WILL BE USED TO
|
||||||
|
* RANDOMLY SELECT CHARACTERS.
|
||||||
|
*
|
||||||
|
* @param string $Format "letter" or "number"
|
||||||
|
* @return integer random number
|
||||||
*/
|
*/
|
||||||
function RndInt($Format){
|
function RndInt($Format){
|
||||||
switch ($Format){
|
switch ($Format){
|
||||||
|
@ -129,19 +139,24 @@ function RndInt($Format){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $Rnd;
|
return $Rnd;
|
||||||
} // END RndInt() FUNCTION
|
}
|
||||||
|
|
||||||
// This function will return the days from 1.1.1970 until now
|
/**
|
||||||
|
* This function will return the days from 1.1.1970 until now.
|
||||||
|
*
|
||||||
|
* @return number of days
|
||||||
|
*/
|
||||||
function getdays() {
|
function getdays() {
|
||||||
$days = time() / 86400;
|
$days = time() / 86400;
|
||||||
settype($days, 'integer');
|
settype($days, 'integer');
|
||||||
return $days;
|
return $days;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function creates all attributes stored in attrFlags. It's the same
|
/**
|
||||||
* syntax used in smbpasswd
|
* Takes a list of Samba flags and creates the corresponding flag string.
|
||||||
* $values is an array of samba flags as defined in account object
|
*
|
||||||
* Return value is a string
|
* @param array $input is an array of Samba flags (e.g. X or D)
|
||||||
|
* @return string Samba flag string
|
||||||
*/
|
*/
|
||||||
function smbflag($input) {
|
function smbflag($input) {
|
||||||
// Start character
|
// Start character
|
||||||
|
@ -158,7 +173,7 @@ function smbflag($input) {
|
||||||
// End character
|
// End character
|
||||||
$flag = $flag. "]";
|
$flag = $flag. "]";
|
||||||
return $flag;
|
return $flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the LM hash of a password.
|
* Generates the LM hash of a password.
|
||||||
|
@ -417,10 +432,13 @@ class samba3domain {
|
||||||
var $RIDbase = 1000;
|
var $RIDbase = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This functions contains a collection of regular expressions
|
/**
|
||||||
* It's much easier to handle them here than in every module
|
* Checks if a given value matches the selected regular expression.
|
||||||
* because many of them are used several times.
|
*
|
||||||
**/
|
* @param string $argument value to check
|
||||||
|
* @param string $regexp pattern name
|
||||||
|
* @return boolean true if matches, otherwise false
|
||||||
|
*/
|
||||||
function get_preg($argument, $regexp) {
|
function get_preg($argument, $regexp) {
|
||||||
/* Bug in php preg_match doesn't work correct with utf8
|
/* Bug in php preg_match doesn't work correct with utf8
|
||||||
*/
|
*/
|
||||||
|
@ -430,7 +448,7 @@ function get_preg($argument, $regexp) {
|
||||||
// First we check "positive" cases
|
// First we check "positive" cases
|
||||||
$pregexpr = '';
|
$pregexpr = '';
|
||||||
switch ($regexp) {
|
switch ($regexp) {
|
||||||
case 'password': // fixme where do i get an exact regexp?
|
case 'password':
|
||||||
$pregexpr = '/^([[:alnum:]\\ \\|\\#\\*\\,\\.\\;\\:\\_\\+\\!\\%\\&\\/\\?\\{\\(\\)\\}-])*$/u';
|
$pregexpr = '/^([[:alnum:]\\ \\|\\#\\*\\,\\.\\;\\:\\_\\+\\!\\%\\&\\/\\?\\{\\(\\)\\}-])*$/u';
|
||||||
break;
|
break;
|
||||||
case 'cn': // first character must be a letter. All letters, numbers, space and @._- are allowed characters
|
case 'cn': // first character must be a letter. All letters, numbers, space and @._- are allowed characters
|
||||||
|
|
Loading…
Reference in New Issue