static string makePassword(
[int
$times = 2]
)
|
|
Generates a random password which isn't to bad to remember.
Parameters:
|
int |
$times: |
Number of syllables (password length will be $times * 3) |
API Tags:
| Return: | Generated password |
| Deprecated: | The object-function generatePassword should be used instead of this static function. |
atkPasswordAttribute atkPasswordAttribute(
string
$name, bool
$generate, [integer
$flags = 0], [mixed
$size = 0], [array
$restrictions = ""]
)
|
|
Constructor
Parameters:
|
string |
$name: |
Name of the attribute |
|
bool |
$generate: |
Generate password (boolean) |
|
integer |
$flags: |
Flags for this attribute |
|
mixed |
$size: |
The size(s) of the attribute. See the $size parameter of the setAttribSize() method for more information on the possible values of this parameter. |
|
array |
$restrictions: |
|
array db2value(
array
$rec
)
|
|
Removes slashes from the string and save to array
Parameters:
|
array |
$rec: |
array with values |
API Tags:
| Return: | with hash field without slashes |
Redefinition of:
- atkAttribute::db2value()
- Converts a database value to an internal value.
string display(
array
$rec
)
|
|
We don't display the password
Parameters:
|
array |
$rec: |
the record with display data |
API Tags:
| Return: | with value to display |
Redefinition of:
- atkAttribute::display()
- Returns a displayable string for this value, to be used in HTML pages.
piece edit(
[array
$record = ""], [string
$fieldprefix = ""], [string
$mode = ""]
)
|
|
Returns a piece of html code that can be used in a form to edit this attribute's value.
Parameters:
|
array |
$record: |
array with fields |
|
string |
$fieldprefix: |
the field's prefix |
|
string |
$mode: |
the mode (add, edit etc.) |
API Tags:
| Return: | of html code with a textarea |
Redefinition of:
- atkAttribute::edit()
- Returns a piece of html code that can be used in a form to edit this attribute's value.
string encode(
string
$value
)
|
|
Encodes the given value only if the AF_PASSWORD_NO_ENCODE flag is not set.
Parameters:
void fetchValue(
array
$rec
)
|
|
Overwriting the fetchValue to ensure all passwords are hashed
Parameters:
|
array |
$rec: |
The array with html posted values ($_POST, for example) that holds this attribute's value. |
Redefinition of:
- atkAttribute::fetchValue()
- Convert values from an HTML form posting to an internal value for this attribute.
string generatePassword(
[int
$length = 8], [boolean
$easytoremember = false]
)
|
|
Generates a random password which meets the restrictions
Parameters:
|
int |
$length: |
Length of the password (could be overridden by higher restrictions) |
|
boolean |
$easytoremember: |
If true, generated passwords are more easy to remember, but also easier to crack. Defaults to false. |
API Tags:
| Return: | Generated password |
Generated getRandomChars(
string|array
$chars, int
$count
)
|
|
Generates a random string using the given character set
Parameters:
|
string|array |
$chars: |
String or array of strings containing the available characters to use |
|
int |
$count: |
Length of the resulting string |
API Tags:
Returns the password restrictions that apply to this password
API Tags:
| Return: | Restrictions that should apply to this attribute |
string getRestrictionsText(
)
|
|
Composes a string describing the restrictions
API Tags:
| Return: | Description of restrictions |
Returns the salt we're currently using for encoding passwords.
API Tags:
| Return: | the salt we're using |
| Access: | public |
Piece hide(
[array
$record = ""], [String
$fieldprefix = ""]
)
|
|
Returns a piece of html code that can be used in a form to display hidden values for this attribute.
Parameters:
|
array |
$record: |
Array with values |
|
String |
$fieldprefix: |
The fieldprefix to put in front of the name of any html form element for this attribute. |
API Tags:
Redefinition of:
- atkAttribute::hide()
- Returns a piece of html code for hiding this attribute in an HTML form, while still posting its value. (<input type="hidden">)
true isEmpty(
array
$record
)
|
|
Check if the attribute is empty
Parameters:
|
array |
$record: |
The record that holds this attribute's value. |
API Tags:
Redefinition of:
- atkAttribute::isEmpty()
- Check if a record has an empty value for this attribute.
void needsUpdate(
array
$record
)
|
|
Due to the new storeType functions password field is not allways saved from within the password attrib
Added a "dynamic" needsUpdate to cancel updates if no password fields where used to alter the password. This overcomes the overwriting with an empty password.
Parameters:
|
array |
$record: |
The record that contains this attribute's value |
Redefinition of:
- atkAttribute::needsUpdate()
- This function is called by the framework to determine if the attribute needs to be saved to the database in an updateDb call.
search search(
[array
$record = ""]
)
|
|
We don't support searching for passwords!
Parameters:
|
array |
$record: |
array with fields |
API Tags:
Redefinition of:
- atkAttribute::search()
- Returns a piece of html code that can be used to get search terms input from the user.
void setRestrictions(
Array
$restrictions
)
|
|
Sets the restrictions on passwords
Parameters:
|
Array |
$restrictions: |
Restrictions that should apply to this attribute |
void setSalt(
string
$salt
)
|
|
Set the salt we're using for encoding passwords. Passwords will be prefixed with this salt.
Parameters:
|
string |
$salt: |
the salt we should use |
API Tags:
void validate(
&$record, string
$mode, array
$record
)
|
|
Validates the supplied passwords
Parameters:
|
array |
$record: |
Record that contains value to be validated. Errors are saved in this record |
|
string |
$mode: |
can be either "add" or "update" |
|
|
&$record: |
|
Redefinition of:
- atkAttribute::validate()
- Checks if a value is valid.
boolean validateRestrictions(
string
$password
)
|
|
Validates the password to the restrictions
Parameters:
API Tags:
| Return: | True if password succesfully validates to the restrictions |
String value2db(
array
$rec
)
|
|
Add's slashes to the string for the database
Parameters:
|
array |
$rec: |
Array with values |
API Tags:
Redefinition of:
- atkAttribute::value2db()
- Converts the internal attribute value to one that is understood by the database.
int _countCharMatches(
string
$password, string
$chars
)
|
|
Counts the number characters in the password that are contained within the chars array
Parameters:
|
string |
$password: |
Password in which we should look for chars |
|
string |
$chars: |
Characters that should be looked for in password |
API Tags:
| Return: | Number of characters in password that match |