Example #1
0
    imagecolorallocate($im, 255, 255, 255);
    imagejpeg($im, "{$DFLT['alb_d']}/{$DFLT['upl_d']}/gd1.jpg");
    header("Content-type: image/gif");
    fpassthru(fopen('images/spacer.gif'));
} elseif ($_GET['test_gd2']) {
    // GD2 test
    $im = imagecreatetruecolor(1, 1);
    imagejpeg($im, "{$DFLT['alb_d']}/{$DFLT['upl_d']}/gd2.jpg");
    header("Content-type: image/gif");
    fpassthru(fopen('images/spacer.gif'));
} elseif ($_GET['phpinfo'] && !file_exists($DFLT['cfg_f'])) {
    phpinfo();
} else {
    // The installer
    html_header();
    html_logo();
    if (file_exists($DFLT['cfg_f'])) {
        html_installer_locked();
    } elseif (count($_POST)) {
        test_fs();
        test_sql_connection();
        test_admin_login();
        write_config_file();
        if ($errors == '') {
            create_tables();
        }
        if ($errors != '') {
            html_input_config($errors);
        } else {
            //lock_install();
            html_install_success($notes);
Example #2
0
function start_update()
{
    // The updater
    html_header("Coppermine - Upgrade");
    html_logo();
    test_fs();
    if ($errors != '') {
        html_prereq_errors($errors);
    } else {
        test_sql_connection();
        if ($errors == '') {
            update_tables();
            update_system_thumbs();
        } else {
            html_error($errors);
        }
        if ($errors == '') {
            html_install_success($notes);
            session_destroy();
        } else {
            html_error($errors);
        }
    }
    html_footer();
}
Example #3
0
function register_changes()
{
    global $CONFIG;
    if (count($_POST) > 0) {
        if (isset($_POST['check'])) {
            $doconvert = 0;
        } else {
            if (isset($_POST['convert'])) {
                $doconvert = 1;
            }
        }
        if (isset($doconvert)) {
            $charsetin = $_POST['charset_in'];
            $charsetout = $_POST['charset_out'];
            // elements of the database that need converting
            // the first element in the array is the id name of the table
            $affected_elements = array($CONFIG['TABLE_ALBUMS'] => array('aid', 'title', 'description', 'keyword'), $CONFIG['TABLE_PICTURES'] => array('pid', 'title', 'caption', 'keywords'), $CONFIG['TABLE_COMMENTS'] => array('msg_id', 'msg_author', 'msg_body'), $CONFIG['TABLE_CATEGORIES'] => array('cid', 'name', 'description'), $CONFIG['TABLE_USERGROUPS'] => array('group_id', 'group_name'), $CONFIG['TABLE_USERS'] => array('user_id', 'user_name', 'user_password', 'user_profile1', 'user_profile2', 'user_profile3', 'user_profile4', 'user_profile5', 'user_profile6'));
            header("Content-Type: text/html; charset={$charsetout}");
            //echo $charsetin . " " .$charsetout;
            if (!$doconvert) {
                $windowtitle = "Charset Manager - 2/3 - Check";
                $title = "2/3 - Checking conversion from <b>{$charsetin}</b> to <b>{$charsetout}</b>";
            } else {
                if ($doconvert) {
                    $windowtitle = "Charset Manager - 3/3 - Conversion";
                    $title = "3/3 - Converting from <b>{$charsetin}</b> to <b>{$charsetout}</b>";
                }
            }
            html_header($windowtitle, $charsetout);
            html_logo();
            echo "<h1>{$title}</h1>";
            echo '<table border="1" class="charsetchecktable" cellpadding="3" cellspacing="0"  style="margin:auto;">';
            if (!$doconvert) {
                echo '<p class="warning">You <b>must check</b> that all the cells in <span class="check">blue</span> are displayed properly.</p>';
            }
            echo "<tr><th>String</th><th>Table</th><th>Column</th><th>Id</th><th>" . ($doconvert ? "Result" : "Query") . "</th></tr>";
            foreach ($affected_elements as $table => $columns) {
                for ($i = 1; $i < count($columns); ++$i) {
                    charset_convert($table, $columns[$i], $columns[0], $charsetin, $charsetout, $doconvert);
                }
            }
            echo '</table>';
            if (!$doconvert) {
                echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="cpgform" id="cpgform">';
                echo '<input type="hidden" name="charset_in" value="' . $charsetin . "\" />\n";
                echo '<input type="hidden" name="charset_out" value="' . $charsetout . "\" />\n";
                echo <<<EOT
    <div class="warning">
    <p>Before converting you <b>must</b>:</p>
    <ol>
    <li>Make a backup of your database. <span class="bigwarning">A malfunction of this script will result in the partial or complete loss or corruption of your comments and other string data containing non-ascii characters.</span></li>
    <li>Check that all the strings above in <span class="check">blue</span> are displayed correctly.
    </ol>
    </div>
EOT;
                echo '<div class="input"><input type="submit" class="button" name="convert" value="Convert" /></div>';
                echo '</form>';
            }
            if ($doconvert) {
                // the script has succeeded (hopefully): we change the charset accordingly in the database
                set_config('charset', $charsetout);
                echo <<<EOT
                    <div class="warning">
                    <p>The conversion has been carried out.<br/>
                If you did not get any errors, for security reasons, you may now <b>remove the file charsetmgr.php</b>, or make it unaccessible, since you will not need this file anymore.<br/>
                    You may now <a href="index.php">proceed to the main page.</a>
                    </p>
                    </div>
EOT;
            }
            html_footer();
            exit;
        }
    }
}