Exemple #1
0
function show_config_table($fresh = true)
{
    $main_path = getmainpath();
    $data = '<form name="form1" method="post" action="?step=1">';
    $data .= '<table cellspacing="1" border="1" style="border-collapse:collapse;" cellpadding="6">';
    $data .= '<tr>';
    $data .= '	<td width="140">URL</td>';
    $data .= '	<td width="108">';
    $data .= '	  <input type="text" name="URL" id="textfield" value="' . getdomainpath() . '">';
    $data .= '	</td>';
    $data .= '	<td rowspan="2">';
    $data .= '	  The url &amp; location of the webid installation on your server. It\'s usually best to leave these as they are.<br>';
    $data .= '	  Also if your running on windows at the end of the <b>Doument Root</b> there should be a \\\\ (double backslash)';
    $data .= '	</td>';
    $data .= '  </tr>';
    $data .= '  <tr>';
    $data .= '	<td>Doument Root</td>';
    $data .= '	<td>';
    $data .= '	  <input type="text" name="mainpath" id="textfield" value="' . $main_path . '">';
    $data .= '	</td>';
    $data .= '</tr>';
    if ($fresh) {
        $data .= '<tr>';
        $data .= '	<td>Email Address</td>';
        $data .= '	<td>';
        $data .= '	  <input type="text" name="EMail" id="textfield">';
        $data .= '	</td>';
        $data .= '	<td>The admin email address</td>';
        $data .= '</tr>';
    }
    $data .= '<tr>';
    $data .= '	<td>Database Host</td>';
    $data .= '	<td>';
    $data .= '	  <input type="text" name="DBHost" id="textfield" value="localhost">';
    $data .= '	</td>';
    $data .= '	<td>The location of your MySQL database in most cases its just localhost</td>';
    $data .= '  </tr>';
    $data .= '  <tr>';
    $data .= '	<td>Database Username</td>';
    $data .= '	<td>';
    $data .= '	  <input type="text" name="DBUser" id="textfield">';
    $data .= '	</td>';
    $data .= '	<td rowspan="3">The username, password and database name of the database your installing webid on</td>';
    $data .= '  </tr>';
    $data .= '  <tr>';
    $data .= '	<td>Database Password</td>';
    $data .= '	<td>';
    $data .= '	  <input type="text" name="DBPass" id="textfield">';
    $data .= '	</td>';
    $data .= '  </tr>';
    $data .= '  <tr>';
    $data .= '	<td>Database Name</td>';
    $data .= '	<td>';
    $data .= '	  <input type="text" name="DBName" id="textfield">';
    $data .= '	</td>';
    $data .= '  </tr>';
    $data .= '  <tr>';
    $data .= '	<td>Database Prefix</td>';
    $data .= '	<td>';
    $data .= '	  <input type="text" name="DBPrefix" id="textfield" value="webid_">';
    $data .= '	</td>';
    $data .= '	<td>the prefix of the webid tables in the database, used so you can install multiple scripts in the same database without issues.</td>';
    $data .= '</tr>';
    if ($fresh) {
        $data .= '<tr>';
        $data .= '	<td>Import Default Categories</td>';
        $data .= '	<td>';
        $data .= '	  <input type="checkbox" name="importcats" id="checkbox" checked="checked">';
        $data .= '	</td>';
        $data .= '	<td>Leaving this checked is recommened. But you make want to uncheck it if your auction site is a specalist niche and will need custom catergories.</td>';
        $data .= '</tr>';
    }
    $data .= '</table>';
    if ($fresh) {
        $data .= '<br>';
        $data .= '<table cellspacing="1" border="1" style="border-collapse:collapse;" cellpadding="6" width="400px">';
        $data .= '<tr>';
        $data .= '	<td colspan="2"><b>File Checks:</b></td>';
        $data .= '</tr>';
        $directories = array('cache/', 'uploaded/', 'uploaded/banners/', 'uploaded/cache/');
        umask(0);
        $passed = true;
        foreach ($directories as $dir) {
            $exists = $write = false;
            // Try to create the directory if it does not exist
            if (!file_exists($main_path . $dir)) {
                @mkdir($main_path . $dir, 0777);
                @chmod($main_path . $dir, 0777);
            }
            // Now really check
            if (file_exists($main_path . $dir) && is_dir($main_path . $dir)) {
                $exists = true;
            }
            // Now check if it is writable by storing a simple file
            $fp = @fopen($main_path . $dir . 'test_lock', 'wb');
            if ($fp !== false) {
                $write = true;
            }
            @fclose($fp);
            @unlink($main_path . $dir . 'test_lock');
            if (!$exists || !$write) {
                $passed = false;
            }
            $data .= '<tr><td>' . $dir . ':</td><td>';
            $data .= $exists ? '<strong style="color:green">Found</strong>' : '<strong style="color:red">Not Found</strong>';
            $data .= $write ? ', <strong style="color:green">Writable</strong>' : ($exists ? ', <strong style="color:red">Unwritable</strong>' : '');
            $data .= '</tr>';
        }
        //check config file exists and is writable
        $write = $exists = true;
        if (file_exists($main_path . 'includes/config.inc.php')) {
            if (!@is_writable($main_path . 'includes/config.inc.php')) {
                $write = false;
            }
        } elseif (file_exists($main_path . 'includes/config.inc.php.new')) {
            if (!@is_writable($main_path . 'includes/config.inc.php.new')) {
                $write = false;
            }
        } else {
            $write = $exists = false;
        }
        if (!$exists || !$write) {
            $passed = false;
        }
        $data .= '<tr><td>includes/config.inc.php.new:</td><td>';
        $data .= $exists ? '<strong style="color:green">Found</strong>' : '<strong style="color:red">Not Found</strong>';
        $data .= $write ? ', <strong style="color:green">Writable</strong>' : ($exists ? ', <strong style="color:red">Unwritable</strong>' : '');
        $data .= '</tr>';
        $directories = array('includes/membertypes.inc.php', 'language/EN/countries.inc.php', 'language/EN/categories.inc.php', 'language/EN/categories_select_box.inc.php');
        foreach ($directories as $dir) {
            $write = $exists = true;
            if (file_exists($main_path . $dir)) {
                if (!@is_writable($main_path . $dir)) {
                    $write = false;
                }
            } else {
                $write = $exists = false;
            }
            if (!$exists || !$write) {
                $passed = false;
            }
            $data .= '<tr><td>' . $dir . ':</td><td>';
            $data .= $exists ? '<strong style="color:green">Found</strong>' : '<strong style="color:red">Not Found</strong>';
            $data .= $write ? ', <strong style="color:green">Writable</strong>' : ($exists ? ', <strong style="color:red">Unwritable</strong>' : '');
            $data .= '</tr>';
        }
        $data .= '<tr><td>GD Support:</td><td>';
        $data .= extension_loaded('gd') && function_exists('gd_info') ? '<strong style="color:green">Found</strong>' : '<strong style="color:red">Not Found</strong>';
        $data .= '</tr>';
        $data .= '<tr><td>BC Math Support:</td><td>';
        $data .= extension_loaded('bcmath') ? '<strong style="color:green">Found</strong>' : '<strong style="color:red">Not Found</strong>';
        $data .= '</tr>';
        $data .= '<tr><td>PHP Data Objects Support:</td><td colspan="2">';
        $data .= extension_loaded('pdo') ? '<strong style="color:green">Found</strong>' : '<strong style="color:red">Not Found</strong>';
        $data .= '</tr>';
        $data .= '</table>';
    }
    $data .= '<br>';
    if ($fresh && $passed || !$fresh) {
        $data .= '<input type="submit" value="install">';
    }
    $data .= '</form>';
    return $data;
}
Exemple #2
0
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version. Although none of the code may be
 *   sold. If you have been sold this script, get a refund.
 ***************************************************************************/
$step = isset($_GET['step']) ? $_GET['step'] : 0;
if ($step != 3) {
    session_start();
}
define('InWeBid', 1);
include 'functions.php';
include '../includes/class_db_handle.php';
define('InInstaller', 1);
$db = new db_handle();
$main_path = getmainpath();
/*
how new updater will work
in package config.inc.php will be named config.inc.php.new so it cannot be overwritten
1. check for config.inc.php
2. if config file missing ask for details
3. with database details check theres actually an installation of webid if not show link to make fresh install
	- if there is but no config write config file
4. collect query needed to run for version in use
5. update language files
*/
if ($step == 0) {
    if (!file_exists($main_path . 'includes/config.inc.php')) {
        $thisversion = this_version();
        $myversion = check_version();
        echo print_header(true);
Exemple #3
0
 ***************************************************************************/
/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version. Although none of the code may be
 *   sold. If you have been sold this script, get a refund.
 ***************************************************************************/
session_start();
define('InWeBid', 1);
include 'functions.php';
include '../includes/database/Database.php';
include '../includes/database/DatabasePDO.php';
define('InInstaller', 1);
$db = new DatabasePDO();
define('MAIN_PATH', getmainpath());
$package_version = package_version();
$settings_version = 'Unknown';
$silent = isset($_GET['silent']) && $_GET['silent'] == 1 ? true : false;
if (!$silent) {
    echo print_header(false);
}
$step = isset($_GET['step']) ? $_GET['step'] : 0;
switch ($step) {
    case 2:
        $siteURL = urldecode($_GET['URL']);
        $siteEmail = $_GET['EMail'];
        include '../includes/config.inc.php';
        include 'sql/dump.inc.php';
        $queries = count($query);
        $db->connect($DbHost, $DbUser, $DbPassword, $DbDatabase, $DBPrefix);