/**
 * Returns user's permissions on the database
 */
function db_permissions()
{
    global $_zp_conf_vars;
    $dbversion = db_software();
    $dbversion = $dbversion['version'];
    if (versioncheck('4.2.1', '4.2.1', $dbversion)) {
        $sql = "SHOW GRANTS FOR CURRENT_USER;";
    } else {
        $sql = "SHOW GRANTS FOR " . $_zp_conf_vars['mysql_user'] . ";";
    }
    $result = query($sql, false);
    if (!$result) {
        $result = query("SHOW GRANTS;", false);
    }
    if ($result) {
        $db_results = array();
        while ($onerow = db_fetch_row($result)) {
            $db_results[] = $onerow[0];
        }
        return $db_results;
    } else {
        return false;
    }
}
Пример #2
0
	</tr>
</table>
</form>
</div>

<?php 
        } else {
            $good = checkMark(!$adminstuff, ' ' . gettext("MySQL setup in <em>zp-config.php</em>"), '', gettext("You have not set your <strong>MySQL</strong> <code>user</code>, <code>password</code>, etc. in your <code>zp-config.php</code> file and <strong>setup</strong> is not able to write to the file.")) && $good;
        }
    }
    $good = checkMark($connection, ' ' . gettext("connect to MySQL"), '', gettext("Could not connect to the <strong>MySQL</strong> server. Check the <code>user</code>, <code>password</code>, and <code>database host</code> in your <code>zp-config.php</code> file and try again.") . ' ') && $good;
    if ($connection) {
        $good = checkMark($sqlv, ' ' . gettext("MySQL version") . ' ' . $mysqlv, "", sprintf(gettext('Version %1$s or greater is required.<br />Version %2$s or greater is prefered.'), $required, $desired)) && $good;
        $good = checkMark($db, ' ' . sprintf(gettext("connect to the database <code> %s </code>"), $_zp_conf_vars['mysql_database']), '', sprintf(gettext("Could not access the <strong>MySQL</strong> database (<code>%s</code>)."), $_zp_conf_vars['mysql_database']) . ' ' . gettext("Check the <code>user</code>, <code>password</code>, and <code>database name</code> and try again.") . ' ' . gettext("Make sure the database has been created, and the <code>user</code> has access to it.") . ' ' . gettext("Also check the <code>MySQL host</code>.")) && $good;
        $dbn = "`" . $_zp_conf_vars['mysql_database'] . "`.*";
        if (versioncheck('4.2.1', '4.2.1', $mysqlv)) {
            $sql = "SHOW GRANTS FOR CURRENT_USER;";
        } else {
            $sql = "SHOW GRANTS FOR " . $_zp_conf_vars['mysql_user'] . ";";
        }
        $result = @mysql_query($sql, $mysql_connection);
        if (!$result) {
            $result = @mysql_query("SHOW GRANTS;", $mysql_connection);
        }
        $MySQL_results = array();
        while ($onerow = @mysql_fetch_row($result)) {
            $MySQL_results[] = $onerow[0];
        }
        $access = -1;
        $rightsfound = 'unknown';
        $rightsneeded = array(gettext('Select') => 'SELECT', gettext('Create') => 'CREATE', gettext('Drop') => 'DROP', gettext('Insert') => 'INSERT', gettext('Update') => 'UPDATE', gettext('Alter') => 'ALTER', gettext('Delete') => 'DELETE', gettext('Index') => 'INDEX');
Пример #3
0
}
if (versioncheck($version, '4.11', 'update_410-411.php', $response)) {
    $version = '4.11';
}
if (versioncheck($version, '4.20', 'update_411-420.php', $response)) {
    $version = '4.20';
}
if (versioncheck($version, '4.30', 'update_420-430.php', $response)) {
    $version = '4.30';
}
if (versioncheck($version, '4.40', 'update_430-440.php', $response)) {
    $version = '4.40';
}
if (versioncheck($version, '5.00', 'update_440-500.php', $response)) {
    $version = '5.00';
}
if (versioncheck($version, '5.10', 'update_500-510.php', $response)) {
    $version = '5.10';
}
$response->add('Repairing tables if needed.');
$tables->correctExistingTables();
foreach ($tables->getExecutedSql() as $change) {
    $response->add($change);
}
include EASYWIDIR . '/stuff/methods/tables_entries_repair.php';
# Ende
if (!isset($updateinclude) or $updateinclude == false) {
    $response->add("<br />Database successfully updated!<br /> <b> Please remove the \"install/\" folder and all of it´s content.</b>");
    echo $response->printresponse();
    $sql = null;
}
Пример #4
0
}
if (versioncheck($version, '4.00', 'update_370-400.php', $response)) {
    $version = '4.00';
}
if (versioncheck($version, '4.10', 'update_400-410.php', $response)) {
    $version = '4.10';
}
if (versioncheck($version, '4.11', 'update_410-411.php', $response)) {
    $version = '4.11';
}
if (versioncheck($version, '4.20', 'update_411-420.php', $response)) {
    $version = '4.20';
}
if (versioncheck($version, '4.30', 'update_420-430.php', $response)) {
    $version = '4.30';
}
if (versioncheck($version, '4.40', 'update_430-440.php', $response)) {
    $version = '4.40';
}
if (versioncheck($version, '5.00', 'update_440-500.php', $response)) {
    $version = '5.00';
}
$response->add('Repairing tables if needed.');
include EASYWIDIR . '/stuff/methods/tables_repair.php';
include EASYWIDIR . '/stuff/methods/tables_entries_repair.php';
# Ende
if (!isset($updateinclude) or $updateinclude == false) {
    $response->add("<br />Database successfully updated!<br /> <b> Please remove the \"install/\" folder and all of it´s content.</b>");
    echo $response->printresponse();
    $sql = null;
}