function RetrieveConfigurationPropertiesFromXml($Path) { $FauxContext = "0"; if ($this->ConfigFile == "") { $this->ErrorManager->AddError($FauxContext, $this->Name, "RetrieveConfigurationPropertiesFromXml", "You must supply a path to the configuration file"); } // Retrieve config file contents $File = new File(); $File->Name = $this->ConfigFile; $File->Path = $Path; $FileManager = new FileManager(); $FileManager->ErrorManager =& $this->ErrorManager; $File = $FileManager->Get($File); // If there were errors retrieving the config file and we're in the CWD, report an error if ($this->ErrorManager->ErrorCount > 0 && $Path == $this->CurrentWorkingDirectory) { $this->ErrorManager->Clear(); $this->ErrorManager->AddError($FauxContext, $this->Name, "RetrieveConfigurationPropertiesFromXml", "The root configuration file could not be found/read (_config.xml)."); // If failed to retrieve the file from a non-root directory, // just accept the root file } elseif ($this->ErrorManager->ErrorCount > 0) { $this->ErrorManager->Clear(); // If no errors occurred, continue to retrieve new configuration settings } else { // Create an XML Parser to retrieve configuration settings $XMan = new XmlManager(); $XMan->ErrorManager =& $this->ErrorManager; $MyConfig = $XMan->ParseNode($File->Body); if ($MyConfig && $this->ErrorManager->ErrorCount == 0) { $this->StyleUrl = $XMan->GetNodeValueByName($MyConfig, "StyleUrl"); $this->PageTitle = $XMan->GetNodeValueByName($MyConfig, "PageTitle"); $this->PageIntroduction = $XMan->GetNodeValueByName($MyConfig, "PageIntroduction"); $this->PageIntroduction = str_replace("[", "<", $this->PageIntroduction); $this->PageIntroduction = str_replace("]", ">", $this->PageIntroduction); $this->PageIntroduction = str_replace("\n", "<br />", $this->PageIntroduction); $this->DisplayHiddenFiles = $XMan->GetNodeValueByName($MyConfig, "DisplayHiddenFiles"); $this->BrowseSubFolders = $XMan->GetNodeValueByName($MyConfig, "BrowseSubFolders"); $this->SortBy = $XMan->GetNodeValueByName($MyConfig, "SortBy"); $this->SortDirection = $XMan->GetNodeValueByName($MyConfig, "SortDirection"); $this->DateFormat = $XMan->GetNodeValueByName($MyConfig, "DateFormat"); $this->UsePageIntroductionInSubFolders = ForceBool($XMan->GetNodeValueByName($MyConfig, "UsePageIntroductionInSubFolders"), false); $this->PluginHeight = ForceInt($XMan->GetNodeValueByName($MyConfig, "PluginHeight"), $this->PluginHeight); $this->PluginWidth = ForceInt($XMan->GetNodeValueByName($MyConfig, "PluginWidth"), $this->PluginWidth); $this->FilesPerPage = ForceIncomingInt("fpp", ForceInt($XMan->GetNodeValueByName($MyConfig, "FilesPerPage"), $this->FilesPerPage)); $this->MaxFilesPerPage = ForceInt($XMan->GetNodeValueByName($MyConfig, "MaxFilesPerPage"), $this->MaxFilesPerPage); $this->FitImagesToPage = ForceBool($XMan->GetNodeValueByName($MyConfig, "FitImagesToPage"), $this->FitImagesToPage); $this->UseThumbnails = ForceBool($XMan->GetNodeValueByName($MyConfig, "UseThumbnails"), $this->UseThumbnails); $this->HideFiles = explode(",", $XMan->GetNodeValueByName($MyConfig, "HideFiles")); for ($i = 0; $i < count($this->HideFiles); $i++) { $this->FullyQualifiedHideFiles[] = $this->CurrentBrowsingDirectory . "/" . $this->HideFiles[$i]; } } } return $this->ErrorManager->Iif(); }
if ($Config->CurrentWorkingDirectory != $Config->CurrentBrowsingDirectory) { $Config->RetrieveConfigurationPropertiesFromXml($Config->CurrentBrowsingDirectory); } // ----------------------------------- // 2. RETRIEVE FILE EXTENSION SETTINGS // ----------------------------------- $File = new File(); $File->Name = $Config->FileTypesFile; $File->Path = $Config->CurrentWorkingDirectory; $FileManager = new FileManager(); $FileManager->ErrorManager =& $Config->ErrorManager; $File = $FileManager->Get($File); // Create an XML Parser to retrieve configuration settings $XmlManager = new XmlManager(); $XmlManager->ErrorManager =& $ErrorManager; $FileTypes = $XmlManager->ParseNode($File->Body); // Create an array of all defined file types $FileCollections = array(); $FolderCollection = array(); $ExtensionLibrary = array(); for ($i = 0; $i < count($FileTypes->Child); $i++) { if ($FileTypes->Child[$i]->Name == "FileGroup") { $FileCollections[$i] = new FileCollection($FileTypes->Child[$i]->Attributes["Name"]); for ($j = 0; $j < count($FileTypes->Child[$i]->Child); $j++) { $Node = $FileTypes->Child[$i]->Child[$j]; if ($Node->Name == "Extensions") { // Ignore all items with a handler method of none if (@$Node->Attributes["HandlerMethod"] != "None") { $CurrentExtensionArray = explode(",", $Node->Value); for ($k = 0; $k < count($CurrentExtensionArray); $k++) { $ExtensionLibrary[strtolower($CurrentExtensionArray[$k])] = array($i, $Node->Attributes["HandlerMethod"]);