Project

General

Profile

« Previous | Next » 

Revision 1651

Added by darkviper over 12 years ago

fixed a little problem with chmod()

View differences:

CopyThemeHtt.php
16 16

  
17 17
	private static $_sSkelPath  = ''; 
18 18
	private static $_sThemePath = '';
19
	private static $_sOs        = '';
19
	private static $_IsLinux    = '';
20 20
	private static $_sFileMode  = '';
21 21
	private static $_aLang      = '';
22
	private static $_bDebug     = false;
22 23
/**
23 24
 * import all needed global constants and variables
24 25
 */
......
27 28
//		self::$_sSkelPath  = ADMIN_PATH.'/themes/templates/';
28 29
		self::$_sSkelPath  = ADMIN_PATH.'/skel/themes/htt/';
29 30
		self::$_sThemePath = THEME_PATH.'/templates/';
30
		self::$_sOs        = OPERATING_SYSTEM;
31
		self::$_sFileMode  = STRING_FILE_MODE;
31
		self::$_IsLinux    = ((substr(__FILE__, 0, 1)) == '/');
32
		self::$_sFileMode  = octdec(STRING_FILE_MODE);
33
		self::$_bDebug      = (defined('DEBUG') && DEBUG === true);
34

  
32 35
		self::$_aLang      = $GLOBALS['MESSAGE'];
33 36
	}
34 37
/**
......
59 62
			if(sizeof($aFileList) > 0 ) {
60 63
				foreach($aFileList as $sFile) {
61 64
					$sFile = basename($sFile);
62
					if(copy(self::$_sSkelPath.$sFile, self::$_sThemePath.$sFile)) {
63
						if(self::$_sOs == 'linux') {
64
							chmod(self::$_sThemePath.$sFile, self::$_sFileMode);
65
					if(is_writable(self::$_sThemePath) &&
66
					   copy(self::$_sSkelPath.$sFile, self::$_sThemePath.$sFile))
67
					{
68
						if(self::$_IsLinux) {
69
							if(!chmod(self::$_sThemePath.$sFile, self::$_sFileMode)) {
70
								$msg = self::$_aLang['UPLOAD_ERR_CANT_WRITE'].' ['.$sFile.']';
71
								if(self::$_bDebug) {
72
									$msg .= __CLASS__.'::'.__METHOD__.'::'
73
									     . 'chmod(\'self::'.$_sThemePath.$sFile.'\', '
74
									     . decoct(self::$_sFileMode).')';
75
								}
76
								$aErrors[] = $msg;
77
							}
65 78
						}
66 79
					}else {
67
						$aErrors[] = self::$_aLang['UPLOAD_ERR_CANT_WRITE'].' ['.$sFile.']';
80
						$msg = self::$_aLang['UPLOAD_ERR_CANT_WRITE'].' ['.$sFile.']';
81
						if(self::$_bDebug) {
82
							$msg .= __CLASS__.'::'.__METHOD__.'::'
83
							     . 'copy(\''.self::$_sSkelPath.$sFile.'\', '
84
							     . '\''.self::$_sThemePath.$sFile.'\')';
85
						}
86
						$aErrors[] = $msg;
68 87
					}
69 88
				}
70 89
			}

Also available in: Unified diff