Skip to content

Commit

Permalink
Merge pull request #297 from bbommer/master
Browse files Browse the repository at this point in the history
 updated writeablity-checks to php5+, removed empty config.inc.php
  • Loading branch information
bbommer authored Jun 18, 2019
2 parents 5b36f2c + 1a9469b commit ddec47d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
Empty file removed config.inc.php
Empty file.
27 changes: 4 additions & 23 deletions include/utils/VtlibUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,33 +569,14 @@ function vtlib_getModuleTemplate($module, $templateName) {
* Check if give path is writeable.
*/
function vtlib_isWriteable($path) {
if(is_dir($path)) {
return vtlib_isDirWriteable($path);
} else {
return is_writable($path);
}
return is_writable($path);
}

/**
* Check if given directory is writeable.
* NOTE: The check is made by trying to create a random file in the directory.
* Check if given path is writeable (PHP5+)
*/
function vtlib_isDirWriteable($dirpath) {
if(is_dir($dirpath)) {
do {
$tmpfile = 'vtiger' . time() . '-' . rand(1,1000) . '.tmp';
// Continue the loop unless we find a name that does not exists already.
$usefilename = "$dirpath/$tmpfile";
if(!file_exists($usefilename)) break;
} while(true);
$fh = @fopen($usefilename,'a');
if($fh) {
fclose($fh);
unlink($usefilename);
return true;
}
}
return false;
function vtlib_isDirWriteable($path) {
return is_writable($path);
}

/** HTML Purifier global instance */
Expand Down
1 change: 0 additions & 1 deletion modules/Install/models/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Install_Utils_Model {
* @var <Array>
*/
public static $writableFilesAndFolders = array (
'Configuration File' => './config.inc.php',
'Tabdata File' => './tabdata.php',
'Parent Tabdata File' => './parent_tabdata.php',
'Cache Directory' => './cache/',
Expand Down

0 comments on commit ddec47d

Please sign in to comment.