Project

General

Profile

« Previous | Next » 

Revision 1653

Added by darkviper over 12 years ago

fixed change_mode() against a very old problem with invalid calling arguments

View differences:

functions.php
416 416

  
417 417
/**
418 418
 * Function to chmod files and/or directories
419
 * the function also prevents the owner to loose rw-rights
419 420
 * @param string $sName
420 421
 * @param int rights in dec-value. 0= use wb-defaults
421
 * @return bool
422
 * @return bool 
422 423
 */
423 424
function change_mode($sName, $iMode = 0)
424 425
{
425 426
	$bRetval = true;
427
	$iMode = intval($iMode) & 0777; // sanitize value
426 428
	if((substr(__FILE__, 0, 1)) == '/')
427 429
	{ // Only chmod if os is not windows
428 430
		$bRetval = false;
429 431
		if(!$iMode) {
430 432
			$iMode = (is_file($sName) ? octdec(STRING_FILE_MODE) : octdec(STRING_DIR_MODE));
431 433
		}
434
		$iMode |= 0600; // set o+rw
432 435
		if(is_writable($sName)) {
433 436
			$bRetval = chmod($sName, $iMode);
434 437
		}

Also available in: Unified diff