Example #1
0
function convertDirectory($path, $io_in, $io_out)
{
    if (is_dir($path)) {
        $gallery = $io_in->getGallery($path);
        echo "<ul><li>Checking {$path}<br />\n";
        if ($gallery) {
            if ($gallery->summary != "" && empty($_REQUEST["convertOverwrite"])) {
                echo "Did NOT overwrite non-empty summary in {$path}<br />\n";
            } else {
                if ($_REQUEST["convertType"] != 'none') {
                    $gallery->summary = $gallery->desc;
                }
                if ($_REQUEST["convertType"] == 'move') {
                    $gallery->desc = "";
                }
            }
            $gallery = setPerms($gallery);
            for ($i = 0; $i < count($gallery->images); $i++) {
                $gallery->images[$i] = setPerms($gallery->images[$i]);
            }
            if ($io_out->putGallery($gallery)) {
                echo "Successfully converted {$path}<br />\n";
            } else {
                echo "Problem saving data file for {$path}<br />\n";
            }
        } else {
            echo "Skipping {$path}<br />\n";
        }
        $d = dir($path);
        while (($file = $d->read()) !== false) {
            if ($file == '.' || $file == '..') {
                continue;
            }
            $path = $d->path . "/" . $file;
            if (is_dir($path)) {
                convertDirectory($path);
            }
        }
        echo "</li></ul>\n";
    }
}
Example #2
0
                setupError("Unrecognised io_handler");
        }
        echo '<br /><a href="uninstall.php?step=reset">&lt;&lt; Previous: Reset permissions</a>';
        echo ' | <a href="index.html">Finish</a>';
        break;
}
if (isset($_REQUEST["convertType"])) {
    require_once $basePath . "includes/config.class.php";
    require_once $basePath . "includes/gallery.class.php";
    require_once $basePath . "includes/image.class.php";
    require_once $basePath . "includes/io.class.php";
    require_once $basePath . "includes/io_sql.class.php";
    $config = new sgConfig($basePath . "singapore.ini");
    $config->base_path = $basePath;
    //echo "<ul>\n";
    convertDirectory($config->base_path . $config->pathto_galleries);
    //echo "</ul>\n";
    echo "<p>All operations complete.</p>\n";
} else {
    ?>
<p>This will convert all your metadata files from singapore 0.9.6, 0.9.7, 0.9.8 or 0.9.9 to 0.9.10.</p>

<form method="post" action="<?php 
    echo $_SERVER["PHP_SELF"];
    ?>
">
<h3>summary field</h3>
<p>There is a new gallery summary field that is displayed instead of the 
description in the parent gallery. You can choose to either copy or move the 
old description field to the summary field or leave both untouched:</p>