Exemple #1
0
<h4>Installation</h4>
<?php 
if ($_SESSION['action'] == "step3") {
    if (!isset($_POST['continue'])) {
        ?>
        <form method="post">
            By pressing continue the setup will start installing the database.<br />
            This may take a while.<br /><br />
            <input type="submit" name="continue" value="Continue">
        </form>
        <?php 
    } else {
        if (installDB()) {
            $_SESSION['action'] = "step4";
            header("location: ?action=step4");
        }
    }
} else {
    echo error("Access denied");
}
Exemple #2
0
            die("{$pd} DataBase Error:<br>" . $e->getMessage() . '</p>');
            return "{$pd} DataBase Error:<br>" . $e->getMessage() . '</p>';
        } catch (Exception $e) {
            die("{$pd} DataBase Error:<br>" . $e->getMessage() . '</p>');
            return "{$pd} General Error: <br>" . $e->getMessage() . '</p>';
        }
        $conn = null;
        if ($installed == 1) {
            echo 'well not really a installer yet but database has been wiped and redone';
        } else {
            echo 'better get Houston on the line...';
            exit;
        }
        return $installed;
    }
    print_r(installDB($DB_DSN, $DB_USERNAME, $DB_PASSWORD));
    $domain = $_SERVER['HTTP_HOST'];
    $docRoot = realpath($_SERVER['DOCUMENT_ROOT']);
    $dirRoot = __DIR__;
    $protocol = isset($_SERVER["HTTPS"]) ? 'https://' : 'http://';
    $urlDir = str_replace('install', '', str_replace($docRoot, '', $dirRoot));
    $urlDir = str_replace('\\', '/', $urlDir);
    $rootDir = str_replace('install', '', $dirRoot);
    $site_path = $protocol . $domain . $urlDir;
    unlink('install.sql');
    unlink(__FILE__);
    rmdir(__DIR__);
    header('Location: ../');
} else {
    echo "<form name=\"Config Creation\" method=\"post\" action=\"" . $PHP_SELF . "\">";
    echo "Database Host: <input type=\"text\" name=\"dbhost\" value=\"localhost\"><br>";
 *  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 3 of the License, or
 *  (at your option) any later version.
 *
 *  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.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
require_once 'config.php';
$db = new PDO('mysql:host=' . $config['host'] . ';dbname=' . $config['dbname'] . ';charset=utf8', $config['username'], $config['password']);
installDB($db, $config);
$array = simplexml_load_file($feed_url);
$new_entries = array();
foreach ($array->channel->item as $key => $item) {
    if (addNewEntry($db, $config, $feed_url, $item->link, $item->title, $item->guid)) {
        $new_entries[] = $item;
    }
}
if (count($new_entries) > 0 && count($receivers) > 0) {
    sendMail($receivers, $new_entries);
}
function addNewEntry($db, $config, $feed_url, $link, $title, $guid)
{
    try {
        $stmt = $db->prepare("INSERT INTO `" . $config['table'] . "` (feed_url, link, title, guid, created)\n\t\t\t\tVALUES(:feed_url, :link, :title, :guid, now())");
        if (!$stmt->execute(array(':feed_url' => $feed_url, ':link' => $link, ':title' => $title, ':guid' => $guid))) {
Exemple #4
0
<?php

require_once 'config/main.conf';
require_once 'config/examples.php';
echo "<p><a href='http://" . $_SERVER['SERVER_NAME'] . "/fnx_journals/articles/'>System was installed. Go?</a></p>\n";
$dbh = installDB($hostname, $db, $root, $root_password, $username, $password);
installTables($dbh);
/**
*Add example users
**/
for ($i = 0; $i < count($exampleUsers); $i++) {
    addExampleUser($dbh, $exampleUsers[$i]);
}
/**
*Add exapmle articles
**/
for ($i = 0; $i < count($exampleArticles); $i++) {
    addExampleArticle($dbh, $exampleArticles[$i]['article'], $exampleArticles[$i]['category'], $exampleArticles[$i]['tags'], $exampleArticles[$i]['author']);
}
/**
*Install script`s db and user
**/
function installDB($hostname, $db, $root, $root_password, $username, $password)
{
    try {
        $dbh = new PDO("mysql:host={$hostname}", $root, $root_password);
        $dbh->exec("\n    \t    CREATE DATABASE IF NOT EXISTS {$db};\n    \t    CREATE USER '{$username}'@'{$hostname}' IDENTIFIED BY '{$password}';\n            GRANT ALL ON `{$db}`.* TO '{$username}'@'{$hostname}';\n            FLUSH PRIVILEGES;") or die(print_r($dbh->errorInfo(), true));
    } catch (PDOException $e) {
        die("DB ERROR: " . $e->getMessage());
    }
    /**