Example #1
0
        private string ParseSkinPackage(string strType, string strRoot, string strName, string strFolder, string strParse)
        {
            var strRootPath = Null.NullString;
            switch (strType)
            {
                case "G": //global
                    strRootPath = Request.MapPath(Globals.HostPath);
                    break;
                case "L": //local
                    strRootPath = Request.MapPath(PortalSettings.HomeDirectory);
                    break;
            }
            var objSkinFiles = new SkinFileProcessor(strRootPath, strRoot, strName);
            var arrSkinFiles = new ArrayList();

            if (Directory.Exists(strFolder))
            {
                var arrFiles = Directory.GetFiles(strFolder);
                foreach (var strFile in arrFiles)
                {
                    switch (Path.GetExtension(strFile))
                    {
                        case ".htm":
                        case ".html":
                        case ".css":
                            if (strFile.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                            {
                                arrSkinFiles.Add(strFile);
                            }
                            break;
                        case ".ascx":
                            if (File.Exists(strFile.Replace(".ascx", ".htm")) == false && File.Exists(strFile.Replace(".ascx", ".html")) == false)
                            {
                                arrSkinFiles.Add(strFile);
                            }
                            break;
                    }
                }
            }
            switch (strParse)
            {
                case "L": //localized
                    return objSkinFiles.ProcessList(arrSkinFiles, SkinParser.Localized);
                case "P": //portable
                    return objSkinFiles.ProcessList(arrSkinFiles, SkinParser.Portable);
            }
            return Null.NullString;
        }
Example #2
0
        public static string UploadLegacySkin(string rootPath, string skinRoot, string skinName, Stream inputStream)
        {
            var objZipInputStream = new ZipInputStream(inputStream);

            ZipEntry objZipEntry;
            string strExtension;
            string strFileName;
            FileStream objFileStream;
            int intSize = 2048;
            var arrData = new byte[2048];
            string strMessage = "";
            var arrSkinFiles = new ArrayList();

            //Localized Strings
            PortalSettings ResourcePortalSettings = Globals.GetPortalSettings();
            string BEGIN_MESSAGE = Localization.GetString("BeginZip", ResourcePortalSettings);
            string CREATE_DIR = Localization.GetString("CreateDir", ResourcePortalSettings);
            string WRITE_FILE = Localization.GetString("WriteFile", ResourcePortalSettings);
            string FILE_ERROR = Localization.GetString("FileError", ResourcePortalSettings);
            string END_MESSAGE = Localization.GetString("EndZip", ResourcePortalSettings);
            string FILE_RESTICTED = Localization.GetString("FileRestricted", ResourcePortalSettings);

            strMessage += FormatMessage(BEGIN_MESSAGE, skinName, -1, false);

            objZipEntry = objZipInputStream.GetNextEntry();
            while (objZipEntry != null)
            {
                if (!objZipEntry.IsDirectory)
                {
					//validate file extension
                    strExtension = objZipEntry.Name.Substring(objZipEntry.Name.LastIndexOf(".") + 1);
                    var extraExtensions = new List<string> {".ASCX", ".HTM", ".HTML", ".CSS", ".SWF", ".RESX", ".XAML", ".JS"};
                    if(Host.AllowedExtensionWhitelist.IsAllowedExtension(strExtension, extraExtensions))
                    {
                        //process embedded zip files
						if (objZipEntry.Name.ToLower() == RootSkin.ToLower() + ".zip")
                        {
                            var objMemoryStream = new MemoryStream();
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objMemoryStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objMemoryStream.Seek(0, SeekOrigin.Begin);
                            strMessage += UploadLegacySkin(rootPath, RootSkin, skinName, objMemoryStream);
                        }
                        else if (objZipEntry.Name.ToLower() == RootContainer.ToLower() + ".zip")
                        {
                            var objMemoryStream = new MemoryStream();
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objMemoryStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objMemoryStream.Seek(0, SeekOrigin.Begin);
                            strMessage += UploadLegacySkin(rootPath, RootContainer, skinName, objMemoryStream);
                        }
                        else
                        {
                            strFileName = rootPath + skinRoot + "\\" + skinName + "\\" + objZipEntry.Name;

                            //create the directory if it does not exist
                            if (!Directory.Exists(Path.GetDirectoryName(strFileName)))
                            {
                                strMessage += FormatMessage(CREATE_DIR, Path.GetDirectoryName(strFileName), 2, false);
                                Directory.CreateDirectory(Path.GetDirectoryName(strFileName));
                            }
							
							//remove the old file
                            if (File.Exists(strFileName))
                            {
                                File.SetAttributes(strFileName, FileAttributes.Normal);
                                File.Delete(strFileName);
                            }
							
							//create the new file
                            objFileStream = File.Create(strFileName);
							
							//unzip the file
                            strMessage += FormatMessage(WRITE_FILE, Path.GetFileName(strFileName), 2, false);
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objFileStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objFileStream.Close();

                            //save the skin file
                            switch (Path.GetExtension(strFileName))
                            {
                                case ".htm":
                                case ".html":
                                case ".ascx":
                                case ".css":
                                    if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                    {
                                        arrSkinFiles.Add(strFileName);
                                    }
                                    break;
                            }
                            break;
                        }
                    }
                    else
                    {
                        strMessage += string.Format(FILE_RESTICTED, objZipEntry.Name, Host.AllowedExtensionWhitelist.ToStorageString(), ",", ", *.").Replace("2", "true");
                    }
                }
                objZipEntry = objZipInputStream.GetNextEntry();
            }
            strMessage += FormatMessage(END_MESSAGE, skinName + ".zip", 1, false);
            objZipInputStream.Close();

            //process the list of skin files
            var NewSkin = new SkinFileProcessor(rootPath, skinRoot, skinName);
            strMessage += NewSkin.ProcessList(arrSkinFiles, SkinParser.Portable);
			
			//log installation event
            try
            {
                var objEventLogInfo = new LogInfo();
                objEventLogInfo.LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString();
                objEventLogInfo.LogProperties.Add(new LogDetailInfo("Install Skin:", skinName));
                Array arrMessage = strMessage.Split(new[] {"<br />"}, StringSplitOptions.None);
                foreach (string strRow in arrMessage)
                {
                    objEventLogInfo.LogProperties.Add(new LogDetailInfo("Info:", HtmlUtils.StripTags(strRow, true)));
                }
                var objEventLog = new EventLogController();
                objEventLog.AddLog(objEventLogInfo);
            }
            catch (Exception exc)
            {
                Logger.Error(exc);

            }
            return strMessage;
        }
Example #3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The Install method installs the skin component
        /// </summary>
        /// <history>
        /// 	[cnurse]	02/06/2008  created
        /// </history>
        public override void Install()
        {
            bool bAdd = Null.NullBoolean;
            try
            {
				//Attempt to get the Skin Package
                TempSkinPackage = SkinController.GetSkinPackage(SkinPackage.PortalID, SkinPackage.SkinName, SkinType);
                if (TempSkinPackage == null)
                {
                    bAdd = true;
                    SkinPackage.PackageID = Package.PackageID;
                }
                else
                {
                    SkinPackage.SkinPackageID = TempSkinPackage.SkinPackageID;
                    if (TempSkinPackage.PackageID != Package.PackageID)
                    {
                        Completed = false;
                        Log.AddFailure(Util.SKIN_Installed);
                        return;
                    }
                    else
                    {
                        SkinPackage.PackageID = TempSkinPackage.PackageID;
                    }
                }
                SkinPackage.SkinType = SkinType;
                if (bAdd)
                {
					//Add new skin package
                    SkinPackage.SkinPackageID = SkinController.AddSkinPackage(SkinPackage);
                }
                else
                {
					//Update skin package
                    SkinController.UpdateSkinPackage(SkinPackage);
                }
                Log.AddInfo(string.Format(Util.SKIN_Registered, SkinPackage.SkinName));

                //install (copy the files) by calling the base class
                base.Install();

                //process the list of skin files
                if (SkinFiles.Count > 0)
                {
                    Log.StartJob(Util.SKIN_BeginProcessing);
                    string strMessage = Null.NullString;
                    var NewSkin = new SkinFileProcessor(RootPath, SkinRoot, SkinPackage.SkinName);
                    foreach (string skinFile in SkinFiles)
                    {
                        strMessage += NewSkin.ProcessFile(skinFile, SkinParser.Portable);
                        skinFile.Replace(Globals.HostMapPath + "\\", "[G]");
                        switch (Path.GetExtension(skinFile))
                        {
                            case ".htm":
                                SkinController.AddSkin(SkinPackage.SkinPackageID, skinFile.Replace("htm", "ascx"));
                                break;
                            case ".html":
                                SkinController.AddSkin(SkinPackage.SkinPackageID, skinFile.Replace("html", "ascx"));
                                break;
                            case ".ascx":
                                SkinController.AddSkin(SkinPackage.SkinPackageID, skinFile);
                                break;
                        }
                    }
                    Array arrMessage = strMessage.Split(new[] {"<br />"}, StringSplitOptions.None);
                    foreach (string strRow in arrMessage)
                    {
                        Log.AddInfo(HtmlUtils.StripTags(strRow, true));
                    }
                    Log.EndJob(Util.SKIN_EndProcessing);
                }
                Completed = true;
            }
            catch (Exception ex)
            {
                Log.AddFailure(ex);
            }
        }
        public static string UploadSkin( string rootPath, string skinRoot, string skinName, Stream objInputStream )
        {
            ZipInputStream objZipInputStream = new ZipInputStream(objInputStream);

            ZipEntry objZipEntry;
            int intSize = 2049;
            byte[] arrData = new byte[intSize];
            string strMessage = "";
            ArrayList arrSkinFiles = new ArrayList();

            //Localized Strings
            PortalSettings ResourcePortalSettings = Globals.GetPortalSettings();
            string BEGIN_MESSAGE = Localization.GetString("BeginZip", ResourcePortalSettings);
            string CREATE_DIR = Localization.GetString("CreateDir", ResourcePortalSettings);
            string WRITE_FILE = Localization.GetString("WriteFile", ResourcePortalSettings);
            string FILE_ERROR = Localization.GetString("FileError", ResourcePortalSettings);
            string END_MESSAGE = Localization.GetString("EndZip", ResourcePortalSettings);
            string FILE_RESTICTED = Localization.GetString("FileRestricted", ResourcePortalSettings);

            strMessage += FormatMessage(BEGIN_MESSAGE, skinName, -1, false);

            objZipEntry = objZipInputStream.GetNextEntry();
            while (objZipEntry != null)
            {
                if (!objZipEntry.IsDirectory)
                {
                    // validate file extension
                    string strExtension = objZipEntry.Name.Substring(objZipEntry.Name.LastIndexOf(".") + 1);
                    if (Strings.InStr(1, ",ASCX,HTM,HTML,CSS,SWF,RESX," + Globals.HostSettings["FileExtensions"].ToString().ToUpper(), "," + strExtension.ToUpper(), 0) != 0)
                    {
                        // process embedded zip files
                        if (objZipEntry.Name.ToLower() == SkinInfo.RootSkin.ToLower() + ".zip")
                        {
                            MemoryStream objMemoryStream = new MemoryStream();
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objMemoryStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objMemoryStream.Seek(0, SeekOrigin.Begin);
                            strMessage += UploadSkin(rootPath, SkinInfo.RootSkin, skinName, objMemoryStream);
                        }
                        else if (objZipEntry.Name.ToLower() == SkinInfo.RootContainer.ToLower() + ".zip")
                        {
                            MemoryStream objMemoryStream = new MemoryStream();
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objMemoryStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objMemoryStream.Seek(0, SeekOrigin.Begin);
                            strMessage += UploadSkin(rootPath, SkinInfo.RootContainer, skinName, objMemoryStream);
                        }
                        else
                        {
                            string strFileName = rootPath + skinRoot + "\\" + skinName + "\\" + objZipEntry.Name;

                            // create the directory if it does not exist
                            if (!Directory.Exists(Path.GetDirectoryName(strFileName)))
                            {
                                strMessage += FormatMessage(CREATE_DIR, Path.GetDirectoryName(strFileName), 2, false);
                                Directory.CreateDirectory(Path.GetDirectoryName(strFileName));
                            }

                            // remove the old file
                            if (File.Exists(strFileName))
                            {
                                File.SetAttributes(strFileName, FileAttributes.Normal);
                                File.Delete(strFileName);
                            }
                            // create the new file
                            FileStream objFileStream = File.Create(strFileName);

                            // unzip the file
                            strMessage += FormatMessage(WRITE_FILE, Path.GetFileName(strFileName), 2, false);
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objFileStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objFileStream.Close();

                            // save the skin file
                            switch (Path.GetExtension(strFileName))
                            {
                                case ".htm":
                                    if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                    {
                                        arrSkinFiles.Add(strFileName);
                                    }
                                    break;

                                case ".html":
                                    if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                    {
                                        arrSkinFiles.Add(strFileName);
                                    }
                                    break;

                                case ".ascx":
                                    if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                    {
                                        arrSkinFiles.Add(strFileName);
                                    }
                                    break;

                                case ".css":

                                    if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                    {
                                        arrSkinFiles.Add(strFileName);
                                    }
                                    break;
                            }
                        }
                    }
                    else
                    {
                        strMessage += FormatMessage(FILE_ERROR, string.Format(FILE_RESTICTED, objZipEntry.Name, Strings.Replace(Globals.HostSettings["FileExtensions"].ToString(), ",", ", *.", 1, -1, 0)), 2, true);
                    }
                }
                objZipEntry = objZipInputStream.GetNextEntry();
            }
            strMessage += FormatMessage(END_MESSAGE, skinName + ".zip", 1, false);
            objZipInputStream.Close();

            // process the list of skin files
            SkinFileProcessor NewSkin = new SkinFileProcessor(rootPath, skinRoot, skinName);
            strMessage += NewSkin.ProcessList(arrSkinFiles, SkinParser.Portable);

            // log installation event
            try
            {                
                LogInfo objEventLogInfo = new LogInfo();
                objEventLogInfo.LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString();
                objEventLogInfo.LogProperties.Add(new LogDetailInfo("Install Skin:", skinName));
                Array arrMessage = strMessage.Split("<br>".ToCharArray()[0]);
                foreach (string tempLoopVar_strRow in arrMessage)
                {
                    string strRow = tempLoopVar_strRow;
                    objEventLogInfo.LogProperties.Add(new LogDetailInfo("Info:", HtmlUtils.StripTags(strRow, true)));
                }
                EventLogController objEventLog = new EventLogController();
                objEventLog.AddLog(objEventLogInfo);
            }
            catch (Exception)
            {            
                // error
            }

            return strMessage;
        }
Example #5
0
        public static string UploadLegacySkin(string rootPath, string skinRoot, string skinName, Stream inputStream)
        {
            var objZipInputStream = new ZipInputStream(inputStream);

            ZipEntry   objZipEntry;
            string     strExtension;
            string     strFileName;
            FileStream objFileStream;
            int        intSize      = 2048;
            var        arrData      = new byte[2048];
            string     strMessage   = "";
            var        arrSkinFiles = new ArrayList();

            //Localized Strings
            PortalSettings ResourcePortalSettings = Globals.GetPortalSettings();
            string         BEGIN_MESSAGE          = Localization.GetString("BeginZip", ResourcePortalSettings);
            string         CREATE_DIR             = Localization.GetString("CreateDir", ResourcePortalSettings);
            string         WRITE_FILE             = Localization.GetString("WriteFile", ResourcePortalSettings);
            string         FILE_ERROR             = Localization.GetString("FileError", ResourcePortalSettings);
            string         END_MESSAGE            = Localization.GetString("EndZip", ResourcePortalSettings);
            string         FILE_RESTICTED         = Localization.GetString("FileRestricted", ResourcePortalSettings);

            strMessage += FormatMessage(BEGIN_MESSAGE, skinName, -1, false);

            objZipEntry = objZipInputStream.GetNextEntry();
            while (objZipEntry != null)
            {
                if (!objZipEntry.IsDirectory)
                {
                    //validate file extension
                    strExtension = objZipEntry.Name.Substring(objZipEntry.Name.LastIndexOf(".") + 1);
                    var extraExtensions = new List <string> {
                        ".ASCX", ".HTM", ".HTML", ".CSS", ".SWF", ".RESX", ".XAML", ".JS"
                    };
                    if (Host.AllowedExtensionWhitelist.IsAllowedExtension(strExtension, extraExtensions))
                    {
                        //process embedded zip files
                        if (objZipEntry.Name.ToLower() == RootSkin.ToLower() + ".zip")
                        {
                            var objMemoryStream = new MemoryStream();
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objMemoryStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objMemoryStream.Seek(0, SeekOrigin.Begin);
                            strMessage += UploadLegacySkin(rootPath, RootSkin, skinName, objMemoryStream);
                        }
                        else if (objZipEntry.Name.ToLower() == RootContainer.ToLower() + ".zip")
                        {
                            var objMemoryStream = new MemoryStream();
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objMemoryStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objMemoryStream.Seek(0, SeekOrigin.Begin);
                            strMessage += UploadLegacySkin(rootPath, RootContainer, skinName, objMemoryStream);
                        }
                        else
                        {
                            strFileName = rootPath + skinRoot + "\\" + skinName + "\\" + objZipEntry.Name;

                            //create the directory if it does not exist
                            if (!Directory.Exists(Path.GetDirectoryName(strFileName)))
                            {
                                strMessage += FormatMessage(CREATE_DIR, Path.GetDirectoryName(strFileName), 2, false);
                                Directory.CreateDirectory(Path.GetDirectoryName(strFileName));
                            }

                            //remove the old file
                            if (File.Exists(strFileName))
                            {
                                File.SetAttributes(strFileName, FileAttributes.Normal);
                                File.Delete(strFileName);
                            }

                            //create the new file
                            objFileStream = File.Create(strFileName);

                            //unzip the file
                            strMessage += FormatMessage(WRITE_FILE, Path.GetFileName(strFileName), 2, false);
                            intSize     = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objFileStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objFileStream.Close();

                            //save the skin file
                            switch (Path.GetExtension(strFileName))
                            {
                            case ".htm":
                            case ".html":
                            case ".ascx":
                            case ".css":
                                if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                {
                                    arrSkinFiles.Add(strFileName);
                                }
                                break;
                            }
                            break;
                        }
                    }
                    else
                    {
                        strMessage += string.Format(FILE_RESTICTED, objZipEntry.Name, Host.AllowedExtensionWhitelist.ToStorageString(), ",", ", *.").Replace("2", "true");
                    }
                }
                objZipEntry = objZipInputStream.GetNextEntry();
            }
            strMessage += FormatMessage(END_MESSAGE, skinName + ".zip", 1, false);
            objZipInputStream.Close();

            //process the list of skin files
            var NewSkin = new SkinFileProcessor(rootPath, skinRoot, skinName);

            strMessage += NewSkin.ProcessList(arrSkinFiles, SkinParser.Portable);

            //log installation event
            try
            {
                var objEventLogInfo = new LogInfo();
                objEventLogInfo.LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString();
                objEventLogInfo.LogProperties.Add(new LogDetailInfo("Install Skin:", skinName));
                Array arrMessage = strMessage.Split(new[] { "<br />" }, StringSplitOptions.None);
                foreach (string strRow in arrMessage)
                {
                    objEventLogInfo.LogProperties.Add(new LogDetailInfo("Info:", HtmlUtils.StripTags(strRow, true)));
                }
                var objEventLog = new EventLogController();
                objEventLog.AddLog(objEventLogInfo);
            }
            catch (Exception exc)
            {
                Logger.Error(exc);
            }
            return(strMessage);
        }
Example #6
0
        public static string UploadSkin(string rootPath, string skinRoot, string skinName, Stream objInputStream)
        {
            ZipInputStream objZipInputStream = new ZipInputStream(objInputStream);

            ZipEntry objZipEntry;
            int      intSize = 2049;

            byte[]    arrData      = new byte[intSize];
            string    strMessage   = "";
            ArrayList arrSkinFiles = new ArrayList();

            //Localized Strings
            PortalSettings ResourcePortalSettings = Globals.GetPortalSettings();
            string         BEGIN_MESSAGE          = Localization.GetString("BeginZip", ResourcePortalSettings);
            string         CREATE_DIR             = Localization.GetString("CreateDir", ResourcePortalSettings);
            string         WRITE_FILE             = Localization.GetString("WriteFile", ResourcePortalSettings);
            string         FILE_ERROR             = Localization.GetString("FileError", ResourcePortalSettings);
            string         END_MESSAGE            = Localization.GetString("EndZip", ResourcePortalSettings);
            string         FILE_RESTICTED         = Localization.GetString("FileRestricted", ResourcePortalSettings);

            strMessage += FormatMessage(BEGIN_MESSAGE, skinName, -1, false);

            objZipEntry = objZipInputStream.GetNextEntry();
            while (objZipEntry != null)
            {
                if (!objZipEntry.IsDirectory)
                {
                    // validate file extension
                    string strExtension = objZipEntry.Name.Substring(objZipEntry.Name.LastIndexOf(".") + 1);
                    if (Strings.InStr(1, ",ASCX,HTM,HTML,CSS,SWF,RESX," + Globals.HostSettings["FileExtensions"].ToString().ToUpper(), "," + strExtension.ToUpper(), 0) != 0)
                    {
                        // process embedded zip files
                        if (objZipEntry.Name.ToLower() == SkinInfo.RootSkin.ToLower() + ".zip")
                        {
                            MemoryStream objMemoryStream = new MemoryStream();
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objMemoryStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objMemoryStream.Seek(0, SeekOrigin.Begin);
                            strMessage += UploadSkin(rootPath, SkinInfo.RootSkin, skinName, objMemoryStream);
                        }
                        else if (objZipEntry.Name.ToLower() == SkinInfo.RootContainer.ToLower() + ".zip")
                        {
                            MemoryStream objMemoryStream = new MemoryStream();
                            intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objMemoryStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objMemoryStream.Seek(0, SeekOrigin.Begin);
                            strMessage += UploadSkin(rootPath, SkinInfo.RootContainer, skinName, objMemoryStream);
                        }
                        else
                        {
                            string strFileName = rootPath + skinRoot + "\\" + skinName + "\\" + objZipEntry.Name;

                            // create the directory if it does not exist
                            if (!Directory.Exists(Path.GetDirectoryName(strFileName)))
                            {
                                strMessage += FormatMessage(CREATE_DIR, Path.GetDirectoryName(strFileName), 2, false);
                                Directory.CreateDirectory(Path.GetDirectoryName(strFileName));
                            }

                            // remove the old file
                            if (File.Exists(strFileName))
                            {
                                File.SetAttributes(strFileName, FileAttributes.Normal);
                                File.Delete(strFileName);
                            }
                            // create the new file
                            FileStream objFileStream = File.Create(strFileName);

                            // unzip the file
                            strMessage += FormatMessage(WRITE_FILE, Path.GetFileName(strFileName), 2, false);
                            intSize     = objZipInputStream.Read(arrData, 0, arrData.Length);
                            while (intSize > 0)
                            {
                                objFileStream.Write(arrData, 0, intSize);
                                intSize = objZipInputStream.Read(arrData, 0, arrData.Length);
                            }
                            objFileStream.Close();

                            // save the skin file
                            switch (Path.GetExtension(strFileName))
                            {
                            case ".htm":
                                if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                {
                                    arrSkinFiles.Add(strFileName);
                                }
                                break;

                            case ".html":
                                if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                {
                                    arrSkinFiles.Add(strFileName);
                                }
                                break;

                            case ".ascx":
                                if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                {
                                    arrSkinFiles.Add(strFileName);
                                }
                                break;

                            case ".css":

                                if (strFileName.ToLower().IndexOf(Globals.glbAboutPage.ToLower()) < 0)
                                {
                                    arrSkinFiles.Add(strFileName);
                                }
                                break;
                            }
                        }
                    }
                    else
                    {
                        strMessage += FormatMessage(FILE_ERROR, string.Format(FILE_RESTICTED, objZipEntry.Name, Strings.Replace(Globals.HostSettings["FileExtensions"].ToString(), ",", ", *.", 1, -1, 0)), 2, true);
                    }
                }
                objZipEntry = objZipInputStream.GetNextEntry();
            }
            strMessage += FormatMessage(END_MESSAGE, skinName + ".zip", 1, false);
            objZipInputStream.Close();

            // process the list of skin files
            SkinFileProcessor NewSkin = new SkinFileProcessor(rootPath, skinRoot, skinName);

            strMessage += NewSkin.ProcessList(arrSkinFiles, SkinParser.Portable);

            // log installation event
            try
            {
                LogInfo objEventLogInfo = new LogInfo();
                objEventLogInfo.LogTypeKey = EventLogController.EventLogType.HOST_ALERT.ToString();
                objEventLogInfo.LogProperties.Add(new LogDetailInfo("Install Skin:", skinName));
                Array arrMessage = strMessage.Split("<br>".ToCharArray()[0]);
                foreach (string tempLoopVar_strRow in arrMessage)
                {
                    string strRow = tempLoopVar_strRow;
                    objEventLogInfo.LogProperties.Add(new LogDetailInfo("Info:", HtmlUtils.StripTags(strRow, true)));
                }
                EventLogController objEventLog = new EventLogController();
                objEventLog.AddLog(objEventLogInfo);
            }
            catch (Exception)
            {
                // error
            }

            return(strMessage);
        }