added isWritable check
This commit is contained in:
parent
6376cae6e3
commit
c57efe1a4c
|
@ -213,6 +213,21 @@ function saveSelfServiceProfile($name, $scope, $profile) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a service profile is writable.
|
||||||
|
*
|
||||||
|
* @param string $name profile name
|
||||||
|
* @param string $scope account type
|
||||||
|
* @return boolean true if file is writable
|
||||||
|
*/
|
||||||
|
function isSelfServiceProfileWritable($name, $scope) {
|
||||||
|
// check profile name
|
||||||
|
if (!preg_match("/^[0-9a-z _-]+$/i", $scope)) return false;
|
||||||
|
if (!preg_match("/^[0-9a-z _-]+$/i", $name)) return false;
|
||||||
|
$path = substr(__FILE__, 0, strlen(__FILE__) - 20) . "/config/selfService/" . $name . "." . $scope;
|
||||||
|
return is_writable($path);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a hash array (module name => elements) of all module options for the configuration page.
|
* Returns a hash array (module name => elements) of all module options for the configuration page.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue