function _imageapi_optimize_check_path in Image Optimize (or ImageAPI Optimize) 7
Same name and namespace in other branches
- 6 imageapi_optimize.module \_imageapi_optimize_check_path()
Checks if a path exists and is executable.
Warning: it does not check if the command is harmful. You should keep an eye on users with "administer imageapi" permission.
1 call to _imageapi_optimize_check_path()
- imageapi_optimize_validate_path in services/
internal.inc - Validation callback for binary fields.
File
- services/
internal.inc, line 211 - Internal ImageAPI Optimize service.
Code
function _imageapi_optimize_check_path($path) {
$errors = array();
if (!empty($path)) {
if (!is_file($path)) {
$errors[] = t('The specified path %file does not exist.', array(
'%file' => $path,
));
}
if (!$errors && !is_executable($path)) {
$errors[] = t('The specified path %file is not executable.', array(
'%file' => $path,
));
}
$open_basedir = ini_get('open_basedir');
if ($errors && $open_basedir) {
$errors[] = t('PHP\'s <a href="!open-basedir">open_basedir</a> security restriction is set to %open-basedir, which may be interfering with attempts to locate %file.', array(
'%file' => $path,
'%open-basedir' => $open_basedir,
'!info-link' => url('http://php.net/features.safe-mode#ini.open-basedir'),
));
}
}
return $errors;
}