SimpleViewerAdmin :: Upgrade

Check that the directory properties are set properly, try again, and, if it fails again, proceed with Step (2) of the upgrade instructions. '; } else { if (!is_readable($backedupGalleryConfigFile)) { $galleryUpgradeError = true; $galleryUpgradeStatus[] = ' Could not read ' . $backedupGalleryConfigFile . '.
Check that the directory properties are set properly, try again, and, if it fails again, proceed with Step (2) of the upgrade instructions. '; } else { if (!file_exists($galleryConfigFile)) { $galleryUpgradeError = true; $galleryUpgradeStatus[] = ' Could not find ' . $galleryConfigFile . '.
Check that the directory properties are set properly, try again, and, if it fails again, proceed with Step (2) of the upgrade instructions. '; } else { if (!is_readable($galleryConfigFile)) { $galleryUpgradeError = true; $galleryUpgradeStatus[] = ' Could not read ' . $galleryConfigFile . '.
Check that the directory properties are set properly, try again, and, if it fails again, proceed with Step (2) of the upgrade instructions. '; } else { // Get the attributes and its values, loop through attributes and // compare them with each other respectively. Afterwards write // contents back to file. $defaultGalleryConfig = getConfig($galleryConfigFile); $oldGalleryConfig = getConfig($backedupGalleryConfigFile); $newGalleryConfig = array(); foreach ($defaultGalleryConfig as $k => $v) { if (array_key_exists($k, $oldGalleryConfig)) { if ($oldGalleryConfig[$k] == $v || $k == 'version') { $newGalleryConfig[$k] = $v; } else { $newGalleryConfig[$k] = $oldGalleryConfig[$k]; } } else { $newGalleryConfig[$k] = $v; } } $simpleViewerConfig = "\n $v) { $simpleViewerConfig .= "\n " . $k . '="' . $v . '"'; } $simpleViewerConfig .= ">\n"; if (!$fileHandle = @fopen($galleryConfigFile, 'w')) { $galleryUpgradeError = true; $galleryUpgradeStatus[] = ' Cannot open ' . $galleryConfigFile . ' for writing.
Check that the directory properties are set properly, try again, and, if it fails again, proceed with Step (2) of the upgrade instructions. '; } else { if (@fwrite($fileHandle, $simpleViewerConfig) === false) { $galleryUpgradeError = true; $galleryUpgradeStatus[] = ' Cannot save ' . $galleryConfigFile . '.
Check that the directory properties are set properly, try again, and, if it fails again, proceed with Step (3) of the upgrade instructions. '; } else { $galleryUpgradeStatus[] = 'Gallery configuration successfully upgraded.'; } @fclose($fileHandle); } } } } } // Display status messages. if (!empty($galleryUpgradeStatus)) { echo '

Gallery Configuration Upgrade Status: ' . (($galleryUpgradeError) ? 'Error' : 'Success') . '

'; } // Upgrade the albums. $dirList = getDirList('./', '', false, 'dirs'); if ($dirList['Number'] == 0) { $albumUpgradeStatus[] = 'No albums found. Nothing to upgrade here.'; } else { foreach ($dirList['List'] as $k => $v) { if (!file_exists('./' . $v . '/imageData.xml')) { $albumUpgradeError = true; $albumUpgradeStatus[] = ' Could not find imageData.xml of in folder "' . $v . '".
Check that the directory properties are set properly, try again, and, if it fails again, proceed with Step (3) of the upgrade instructions. '; } else { if (!is_readable('./' . $v . '/imageData.xml')) { $albumUpgradeError = true; $albumUpgradeStatus[] = ' Could not read imageData.xml of in folder "' . $v . '".
Check that the directory properties are set properly, try again, and, if it fails again, proceed with Step (3) of the upgrade instructions. '; } else { $albumConfigFile = './' . $v . '/imageData.xml'; $albumConfig = getConfig($albumConfigFile); $sourceData = parseXML($albumConfigFile); $xmlData = array(); $i = 0; foreach ($sourceData as $sourceKey => $sourceValue) { if ($sourceValue['tag'] == 'NAME') { $xmlData[$i]['name'] = $sourceValue['value']; } if ($sourceValue['tag'] == 'CAPTION') { $xmlData[$i]['caption'] = (!empty($sourceValue['value']) ? $sourceValue['value'] : ''); $i++; } } $imageData = ''; foreach ($xmlData as $xmlKey => $xmlValue) { $imageData .= "\n\t\n\t\t" . $xmlValue['name'] . "\n\t\t\n\t\n"; } $simpleViewerConfig = "\n $albumValue) { if ($k == 'title') { $simpleViewerConfig .= ' ' . $albumKey . '="' . ((isPhpOfVersion(5) == -1) ? convertStr($albumValue, true, false) : convertStr($albumValue, true, false)) . '"'; } else { $simpleViewerConfig .= ' ' . $albumKey . '="' . $albumValue . '"'; } } if (!array_key_exists('isPublished', $albumConfig)) { $simpleViewerConfig .= ' isPublished="true"'; } $simpleViewerConfig .= '>' . $imageData . ""; if (!$fileHandle = @fopen($albumConfigFile, 'w')) { $albumUpgradeError = true; $albumUpgradeStatus[] = ' Cannot open "' . $albumConfigFile . '" for writing.
Check that the directory properties are set properly, try again, and, if it fails again, proceed with Step (6) of the upgrade instructions. '; } else { if (@fwrite($fileHandle, $simpleViewerConfig) === false) { $albumUpgradeError = true; $albumUpgradeStatus[] = 'Cannot save ' . $albumConfigFile . '.'; } else { $albumUpgradeStatus[] = '"' . $albumConfigFile . '" successfully upgraded and saved.'; } @fclose($fileHandle); } } } } } // Display status messages. if (!empty($albumUpgradeStatus)) { echo '

Album Configuration Upgrade Status: ' . (($albumUpgradeError) ? 'Error' : 'Success') . '

' . ((!$albumUpgradeError) ? '

Album configurations successfully upgraded.

' : ''); } if (!$galleryUpgradeError && !$albumUpgradeError) { echo '

Now proceed with Step (8) of the upgrade instructions.

'; } } ?>