Example #1
0
function phorum_check_database($is_install = false)
{
    $PHORUM = $GLOBALS["PHORUM"];
    // Check if we have a database configuration available.
    if (!isset($PHORUM["DBCONFIG"])) {
        return array(PHORUM_SANITY_CRIT, "No database configuration was found in your environment.", "You probably have not copied include/db/config.php.sample\n             to include/db/config.php. Read Phorum's install.txt for\n             installation instructions.");
    }
    // Check if a connection can be made.
    $connected = @phorum_db_check_connection();
    if (!$connected) {
        return array(PHORUM_SANITY_CRIT, "Connecting to the database failed.", "Check your database settings in the file include/db/conf.php");
    }
    // Do a database layer specific check, if available.
    if (function_exists("phorum_db_sanitychecks")) {
        $res = phorum_db_sanitychecks();
        if ($res[0] != PHORUM_SANITY_OK) {
            return $res;
        }
    }
    if ($is_install && empty($PHORUM['DBCONFIG']['charset'])) {
        return array(PHORUM_SANITY_WARN, "Database configuration parameter \"charset\" empty.", "The option \"charset\" is empty in your database configuration.\n             Although you can install Phorum without setting an explicit\n             charset here, we strongly advice against this. Without a\n             specific charset here, you might run into problems with\n             special characters later on.");
    }
    // All checks are OK.
    return array(PHORUM_SANITY_OK, NULL, NULL);
}
Example #2
0
    function phorum_check_database() {
        $PHORUM = $GLOBALS["PHORUM"];

        // Check if we have a database configuration available.
        if (! isset($PHORUM["DBCONFIG"])) return array(
            PHORUM_SANITY_CRIT,
            "No database configuration was found in your environment.",
            "You probably have not copied include/db/config.php.sample
             to include/db/config.php. Read Phorum's install.txt for
             installation instructions."
        );

        // Check if a connection can be made.
        $connected = @phorum_db_check_connection();
        if (! $connected) return array(
            PHORUM_SANITY_CRIT,
            "Connecting to the database failed.",
            "Check your database settings in the file include/db/conf.php"
        );

        // Do a database layer specific check, if available.
        if (function_exists("phorum_db_sanitychecks")) {
            $res = phorum_db_sanitychecks();
            if ($res[0] != PHORUM_SANITY_OK) return $res;
        }

        // All checks are OK.
        return array(PHORUM_SANITY_OK, NULL);
    }
Example #3
0
//                                                                            //
//   This program is free software. You can redistribute it and/or modify     //
//   it under the terms of either the current Phorum License (viewable at     //
//   phorum.org) or the Phorum License that was distributed with this file    //
//                                                                            //
//   This program is distributed in the hope that it will be useful,          //
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   You should have received a copy of the Phorum License                    //
//   along with this program.                                                 //
////////////////////////////////////////////////////////////////////////////////

    if(!defined("PHORUM_ADMIN")) return;

    if(!phorum_db_check_connection()){
        echo "A database connection could not be established.  Please edit include/db/config.php.";
        return;
    }

    include_once "./include/admin/PhorumInputForm.php";

    if(empty($_POST["step"])){
        $step = 0;
    } else {
        $step = $_POST["step"];
    }

    if(count($_POST)){

        // THIS IS THE WORK STEP
Example #4
0
    // Reset the cookie that is used for the version check.
    setcookie("phorum_upgrade_available", '', time()-86400,
              $PHORUM["session_path"], $PHORUM["session_domain"]);
} ?>
    <td style="border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: Navy;" align="right">

    <div id="phorum-status">
<?php if($module!="login" && $module!="install" && $module!="upgrade"){ ?>
<form id="status-form" action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
<input type="hidden" name="module" value="status" />
Phorum Status:
<select name="status" onChange="this.form.submit();">
<option value="normal" <?php if($PHORUM["status"]=="normal") echo "selected"; ?>>Normal</option>
<option value="read-only"<?php if($PHORUM["status"]=="read-only") echo "selected"; ?>>Read Only</option>
<option value="admin-only"<?php if($PHORUM["status"]=="admin-only") echo "selected"; ?>>Admin Only</option>
<option value="disabled"<?php if($PHORUM["status"]=="disabled" || !phorum_db_check_connection()) echo "selected"; ?>>Disabled</option>
</select>
</form>
<?php } ?>
</div>
<?php if(isset($PHORUM['user'])) { ?>
<small>Logged In As <?php echo $PHORUM["user"]["username"]; ?></small>
<?php } ?>
</td>
</tr>
</table><br />
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<?php

    if($module!="login" && $module!="install" && $module!="upgrade"){
?>
Example #5
0
    ?>
>Normal</option>
<option value="read-only"<?php 
    if ($PHORUM["status"] == "read-only") {
        echo "selected";
    }
    ?>
>Read Only</option>
<option value="admin-only"<?php 
    if ($PHORUM["status"] == "admin-only") {
        echo "selected";
    }
    ?>
>Admin Only</option>
<option value="disabled"<?php 
    if ($PHORUM["status"] == "disabled" || !phorum_db_check_connection()) {
        echo "selected";
    }
    ?>
>Disabled</option>
</select>
</form>
<?php 
}
?>
</div>
<?php 
if (isset($PHORUM['user'])) {
    ?>
<small>Logged In As <?php 
    echo $PHORUM["user"]["username"];