Esempio n. 1
0
function oldReadConfig($configname)
{
    if (strstr($configname, ',')) {
        $configlist = explode(',', $configname);
        foreach ($configlist as $key => $configname) {
            ReadConfig(trim($configname));
        }
    } else {
        $configname = basename($configname);
        $path = './config/' . $configname;
        if (!file_exists($path)) {
            die("Error! File <b>" . htmlspecialchars($configname) . "</b> doesn't exist!</font><br /><font color=blue>Before the setup starts, please ensure that you have properly configured file and directory access permissions. Please see below.</font><br /><br />chmod 777 config/<br />chmod 777 config/" . $configname);
        }
        $fp = fopen($path, 'r');
        $content = '';
        while (!feof($fp)) {
            $content .= fread($fp, 102400);
        }
        fclose($fp);
        if (empty($content)) {
            return array();
        }
        $tmp = @unserialize($content);
        if (empty($tmp)) {
            die("Error! <font color=red>Cannot read configuration file <b>" . htmlspecialchars($configname) . "</b></font><br /><font color=blue>Before the setup starts, please ensure that you have properly configured file and directory access permissions. For *nix system, please see below.</font><br />chmod 777 config <br />chmod 777 config/" . $configname . "<br /><br /> If access permission is alright, perhaps there's some misconfiguration or the configuration file is corrupted. Please check config/" . $configname);
        }
        $GLOBALS[$configname] = $tmp;
        return $tmp;
    }
}
Esempio n. 2
0
File: auth.php Progetto: milkae/Php
function Auth($u, $p)
{
    if (is_string($conf = ReadConfig($u))) {
        return $conf;
    }
    if (sha1($conf['passwd']) == $p) {
        /* Version 3.2.0 updates */
        if (isset($conf['limitRows'])) {
            $conf['queryPageSize'] = $conf['limitRows'];
            unset($conf['limitRows']);
        }
        if (isset($conf['limitCell'])) {
            $conf['queryMaxCellSize'] = $conf['limitCell'];
            unset($conf['limitCell']);
        }
        /* * * * * * * * * * * */
        foreach (array('hosts' => array(), 'encrypt' => TRUE, 'reqTimeout' => 60, 'hideSysDBs' => FALSE, 'showQueryRowNums' => TRUE, 'queryMaxDataSize' => 20, 'queryMaxRows' => 100000, 'queryPageSize' => 100, 'queryMaxCellSize' => 1024) as $k => $v) {
            if (!isset($conf[$k])) {
                $conf[$k] = $v;
            }
        }
        foreach ($conf['hosts'] as &$i) {
            if (!isset($i['cid'])) {
                $i['cid'] = uniqid();
            }
        }
        $_SESSION['uname'] = $u;
        $_SESSION['key1'] = $conf['passwd'];
        $_SESSION['config'] = $conf;
        Cleanup();
        return FALSE;
    } else {
        return AUTH_MESS;
    }
}
Esempio n. 3
0
function ReadConfig($configname)
{
    if (strstr($configname, ',')) {
        $configlist = explode(',', $configname);
        foreach ($configlist as $key => $configname) {
            ReadConfig(trim($configname));
        }
    } else {
        $configname = basename($configname);
        $path = ROOT_PATH . 'include/config.php' . $configname;
        if (!file_exists($path)) {
            die("<font color=red>File [<b>" . htmlspecialchars($configname) . "</b>] doesn't exist!.</font><br /><font color=blue>Before the setup starts, please ensure that you have properly configured file and directory access permissions. Please see below.</font><br /><br />chmod 777 CONFIG (config directory).<br />chmod 777 CONFIG/main (the file which save the main settings).");
        }
        $fp = fopen($path, 'r');
        $content = '';
        while (!feof($fp)) {
            $content .= fread($fp, 102400);
        }
        fclose($fp);
        if (empty($content)) {
            if ($configname == 'JBOY') {
                Header("Location: index.php");
                die;
            }
            return array();
        }
        $tmp = @unserialize($content);
        if (empty($tmp)) {
            if ($configname == 'JBOY') {
                Header("Location: index.php");
                die;
            }
            die("<font color=red>Cannot read file [<b>" . htmlspecialchars($configname) . "</b>]!.</font><br /><font color=blue>Before the setup starts, please ensure that you have properly configured file and directory access permissions. Please see below.</font><br /><br />chmod 777 CONFIG (config directory).<br />chmod 777 CONFIG/main (the file which save the main settings).");
        }
        $GLOBALS[$configname] = $tmp;
        return true;
    }
}
Esempio n. 4
0
{
    global $test, $path;
    $types = array_keys($arr);
    foreach ($types as $type) {
        include "objects/{$type}.php";
        $fulltypename = "orm\\objects\\{$type}";
        $path->dig($type);
        $objects = $arr[$type];
        foreach ($objects as $settings) {
            list($name, $object) = PopFirstObject($settings);
            $path->update($name);
            if ($name == null) {
                break;
            }
            $bond = new $fulltypename($test);
            $bond->Init($name, $object, $path);
            if (CanRecursive($bond, $object)) {
                RecursiveRead($object);
            }
        }
        $path->pop();
    }
    die('OK');
}
function ReadConfig($file)
{
    $yaml = \spyc_load_file($file);
    RecursiveRead($yaml);
}
ReadConfig('sql.yaml');
Esempio n. 5
0
<!DOCTYPE html>
<html>
<head>
<title>DbNinja for MySQL</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/styles-online.css" />
</head>
<body>
<?php 
$req = array('user' => 'admin', 'task' => $_GET['task']);
require __INC__ . '/auth.php';
$conf = ReadConfig($req['user']);
if (is_string($conf)) {
    exit($conf);
}
if (!($tasks = (include AUTH_PATH . "/{$req['user']}/tasks.php"))) {
    exit('No tasks are defind for this user');
}
$task = NULL;
foreach ($tasks as $t) {
    if ($t['tid'] == $req['task']) {
        $task = $t;
        break;
    }
}
if (!$task) {
    exit("Task #{$req['task']} was not found");
}
$host = NULL;
foreach ($conf['hosts'] as $h) {
    if ($h['cid'] == $task['cid']) {
Esempio n. 6
0
require "../config/lang.ini.php";
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$action = $request->action;
$key = $request->key;
$value = $request->value;
$reply;
$sql1 = "";
if ($action == 'edit') {
    if ($value == true) {
        $value = 1;
    } else {
        $value = 0;
    }
    if ($key == 'alert') {
        if (SetConfig('alert', $value) && SetConfig('ring', $value) && SetConfig('sms', $value) && SetConfig('email', $value)) {
            $reply = array("result" => "Thiết lập thành công");
        } else {
            $reply = array("result" => "Thiết lập thất bại");
        }
    } else {
        if (SetConfig($key, $value)) {
            $reply = array("result" => "Thiết lập thành công");
        } else {
            $reply = array("result" => "Thiết lập thất bại");
        }
    }
} elseif ($action == 'read') {
    $reply = ReadConfig();
}
echo json_encode($reply);