예제 #1
0
 function callObj($agi)
 {
     global $db;
     $this->agiVars = $agi;
     $this->callerId = trim(preg_replace('/.*<(\\d+)>.*/i', '${1}', $this->agiVars["callerid"]));
     $this->extension = $this->agiVars["extension"];
     $query = "select count(*) from People " . "where Extension = '" . $this->callerId . "}'";
     $query = $db->query($query);
     check_db($query);
     if ($row = $query->fetchRow(DB_FETCHMODE_ORDERED)) {
         $this->isLocalPep = true;
     } else {
         $this->isLocalPep = false;
         // recherche du responsable
         $query = "Select Responsable_Extension " . "from Extension " . "where ((ext_end is not null and " . "extension_type_comp(extension,  '" . $this->callerId . ") <= 0 " . "and extension_type_comp(ext_end,  '" . $this->extension . "') >= 0) or " . " (ext_end is null and extension = '" . $this->extension . "')) and " . " Responsable_Extension is not null";
         $query = $db->query($query);
         check_db($query);
         if (!($row = $query->fetchRow(DB_FETCHMODE_ORDERED))) {
             // responsable non trouvé :
             $this->responsable = '';
         } else {
             $this->responsable = $row[0];
         }
     }
     $this->lastTryStatus = NULL;
 }
예제 #2
0
파일: database.php 프로젝트: rookees/icms2
function step($is_submit)
{
    if ($is_submit) {
        return check_db();
    }
    $result = array('html' => render('step_database', array()));
    return $result;
}
예제 #3
0
function people_dial(&$call)
{
    global $db;
    $extension = $call->get_extension();
    $callerId = $call->get_cid();
    $callerIdFull = $call->get_cidFull();
    $query = "select Context " . "  from AsteriskGoto " . " where Extension = {$extension} ";
    $query = $db->query($query);
    check_db($query);
    if ($row = $query->fetchRow(DB_FETCHMODE_ORDERED)) {
        // ceci boycott complètement le fonctionnement d'obelisk
        agi_goto($row[0]);
    }
    return agi_notFound($call);
}
예제 #4
0
function geo_dial(&$call)
{
    global $db;
    $extension = $call->get_extension();
    $callerId = $call->get_cid();
    $callerIdFull = $call->get_cidFull();
    $query = "select destination.People_Extension " . "from Geographical_Alias as caller, " . " \tGeographical_Alias as destination, " . "\tGeographical_Group as grp " . "where caller.People_Extension = '" . $callerId . "' " . "  and caller.Geographical_Group_ID = grp.ID " . "  and grp.ID = destination.Geographical_Group_ID " . "  and destination.Extension = '" . $extension . "' ";
    $query = $db->query($query);
    check_db($query);
    if (!($row = $query->fetchRow(DB_FETCHMODE_ORDERED))) {
        agi_log(DEBUG_ERR, "geo/dial.inc.php: extension : " . $extension . " not found");
        return agi_notFound($call);
    }
    agi_log(DEBUG_INFO, "geo/dial.inc.php: {$extension} -> " . "People : " . $row[0]);
    $call->set_extension($row[0]);
    include_once 'modules/people/dial.inc.php';
    return people_dial($call);
}
예제 #5
0
function people_dial(&$call)
{
    global $db;
    $extension = $call->get_extension();
    $callerId = $call->get_cid();
    $callerIdFull = $call->get_cidFull();
    $query = "select ChanType, username, VoIPAccount.ID " . "  from People, VoIPAccount, VoIPChannel " . " where People.Extension = {$extension} " . "   and VoIPAccount.People_Extension = {$extension} " . "   and VoIPAccount.VoIPChannel_ID = VoIPChannel.ID " . "   and VoIPAccount.Enable = true ";
    $query = $db->query($query);
    check_db($query);
    if ($row = $query->fetchRow(DB_FETCHMODE_ORDERED)) {
        $dialStr = $row[0] . "/" . $row[1] . "-" . $row[2];
        while ($row = $query->fetchRow(DB_FETCHMODE_ORDERED)) {
            $dialStr .= "&";
            $dialStr .= $row[0] . "/" . $row[1] . "-" . $row[2];
        }
        agi_log(DEBUG_DEBUG, "people_dial(): {$callerId} : " . "{$extension} -> '{$dialStr}'");
        return agi_call($call, $dialStr, "r", 0, 0);
    }
    return agi_notFound($call);
}
예제 #6
0
<?php

/**
* @package util
*/
/* 
* require boot.php
*/
require_once "boot.php";
$a = new App();
@(include ".htconfig.php");
$lang = get_browser_language();
load_translation_table($lang);
require_once "include/dba.php";
$db = new dba($db_host, $db_user, $db_pass, $db_data, false);
unset($db_host, $db_user, $db_pass, $db_data);
$build = get_config('system', 'build');
echo "Old DB VERSION: " . $build . "\n";
echo "New DB VERSION: " . DB_UPDATE_VERSION . "\n";
if ($build != DB_UPDATE_VERSION) {
    echo "Updating database...";
    check_db($a);
    echo "Done\n";
}
예제 #7
0
function install_check()
{
    global $lockfile;
    $dbname = $_SESSION['dbinfo']['dbname'];
    $dbinfo = $_SESSION['dbinfo'];
    $multitable = $_SESSION['multitable'];
    extract($dbinfo);
    if (!check_db($dbhost, $dbuser, $dbpw, $dbname, $multitable)) {
        show_msg('tablepre_not_exists', 0);
    } else {
        @touch($lockfile);
        session_destroy();
        echo '<div class="btnbox marginbot"><input type="button" name="submit" value="' . lang('step_install_check_desc') . '" style="height: 25" onclick="window.location.href=\'../index.php/passport/login\'"></div>';
        //echo '<script>window.location.href="/index.php";</script>';
    }
}
예제 #8
0
<head>
\t<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
\t<title>phpSQLiteAdmin</title>
\t<meta http-equiv="expires" content="0">
\t<script language="javascript" src="javascript.txt" type="text/javascript"></script>
\t<link href="phpsla.css" rel="stylesheet" type="text/css">
\t<base target="mainframe">
</head>
<body class=right>
<div id="currentdb">Database: {$_SESSION['phpSQLiteAdmin_currentdb']}</div>
EOT;
if (check_db()) {
    print "<p class=\"sqliteversion\">SQLite version: " . $sqliteversion . "</p>\n";
}
print "<h3>phpSQLiteAdmin 0.2</h3>\n";
if (!check_db()) {
    die("<p>The selected database is either read-only or does not exist</p>\n");
}
$dbinfo = $userdbh->dbInfo();
print "<table id=\"dbinfotable\">\n";
print "<tr><th colspan=2>Database file information</th></tr>\n";
print "<tr><td>Size:</td><td>" . $dbinfo['size'] / 1024 . "KB</td></tr>\n";
print "<tr><td>Last modification:</td><td>" . $dbinfo['last_mod'] . "</td></tr>\n";
if (function_exists("posix_getpwuid")) {
    $user = posix_getpwuid($dbinfo['owner']);
    $group = posix_getgrgid($user['gid']);
    print "<tr><td>Owner:</td><td>" . $user['name'] . "</td></tr>\n";
    print "<tr><td>Group:</td><td>" . $group['name'] . "</td></tr>\n";
}
print "</table><br>\n";
print "<h3>Tables:</h3>\n";
예제 #9
0
}
if (!x($_SESSION, 'sysmsg_info')) {
    $_SESSION['sysmsg_info'] = array();
}
/*
 * check_config() is responsible for running update scripts. These automatically 
 * update the DB schema whenever we push a new one out. It also checks to see if
 * any plugins have been added or removed and reacts accordingly. 
 */
if ($install) {
    $a->module = 'install';
} elseif ($maintenance) {
    $a->module = 'maintenance';
} else {
    check_url($a);
    check_db();
    check_plugins($a);
}
nav_set_selected('nothing');
$arr = array('app_menu' => $a->apps);
call_hooks('app_menu', $arr);
$a->apps = $arr['app_menu'];
/**
 *
 * We have already parsed the server path into $a->argc and $a->argv
 *
 * $a->argv[0] is our module name. We will load the file mod/{$a->argv[0]}.php
 * and use it for handling our URL request.
 * The module file contains a few functions that we call in various circumstances
 * and in the following order:
 * 
예제 #10
0
/**
 * outside_getNetworkId - return the networkId for an extension
 *
 * PRE: $call is a valid CallObj where $extension is defined
 *
 * POST: retrun a positive number which is the network Id or a negative number
 *	which means 'unknown'
 *
 * I/O: dowsnload the primary networkId and execute the phpfunction in order to
 *	get the secondary network ID.
 */
function outside_getNetworkId(&$call)
{
    global $db;
    $query = "select N.ID, N.SubNetwork_function " . " from  Network as N, NetworkMask as M " . " where N.ID = M.Network_ID " . "  and extension_type_comp('" . $call->get_extension() . "', M.extStart) >= 0 " . "  and extension_type_comp('" . $call->get_extension() . "', M.extEnd) <= 0 ";
    $query = $db->query($query);
    check_db($query);
    if (!($row = $query->fetchRow(DB_FETCHMODE_ORDERED))) {
        return -1;
    }
    if ($row[1] != '') {
        // fonction de sous-séledtion
        $fct = "outside_select_" . $row[1];
        return $fct();
    }
    return $row[0];
}
예제 #11
0
// currently, only JME and JME are supported
if ($editor != "jme") {
    $editor = "jme";
}
if ($editor == "jme") {
    $edtag = "applet";
    // "applet" (for JME) or "div" (for JME)
} else {
    $edtag = "div";
    // "applet" (for JME) or "div" (for JME)
    $jme_path = fix_adminpath($jme_path);
}
$link = mysql_pconnect($hostname, "{$rw_user}", "{$rw_password}") or die("Could not connect to database server!");
mysql_select_db($database) or die("Could not select database!");
mysql_query("SET NAMES {$mysql_charset}");
$db_id = check_db($db_id);
if ($db_id < 0) {
    $db_id = $default_db;
    $db_id = check_db_all($db_id);
    if ($db_id < 0) {
        $db_id = get_lowestdbid();
    }
}
$mydb = get_dbproperties($db_id);
$dbtype = $mydb['type'];
if ($dbtype == 1 && $datatype != 1) {
    $datatype = 1;
}
if ($dbtype == 2 && $datatype != 2) {
    $datatype = 2;
}
예제 #12
0
파일: check_tiki.php 프로젝트: rjsmelo/tiki
        displayError("--sircrit needs to be bigger than --sirwarn");
    }
    $iCurrentEpoch = date('U');
    $iDiffEpoch = $iCurrentEpoch - $data['SearchIndexRebuildLast'];
    if (empty($data['SearchIndexRebuildLast'])) {
        update_err_state(3, "Search Index never built");
    } elseif ($data['SearchIndexRebuildLast'] < $iCurrentEpoch - $crit) {
        update_err_state(1, "Search Index older than {$crit} sec|time=" . $iDiffEpoch . "s;;;0");
    } elseif ($data['SearchIndexRebuildLast'] < $iCurrentEpoch - $warn) {
        update_err_state(1, "Search Index older than {$warn} sec|time=" . $iDiffEpoch . "s;;;0");
    } elseif ($data['SearchIndexRebuildLast'] > $iCurrentEpoch - $warn) {
        update_err_state(0, "Search Index is fresh|time=" . $iDiffEpoch . "s;;;0");
    } else {
        update_err_state(3, "Search index state unknown");
    }
}
$options = get_opts();
if (empty($options) or isset($options['h'])) {
    help();
    exit(1);
}
$data = get_data($options);
if (isset($options['c'])) {
    $check = 'check_' . $options['c'];
    $check($data, $options);
} else {
    check_bcc($data, $options);
    check_db($data, $options);
    check_searchindex($data, $options);
}
report();
예제 #13
0
파일: index.php 프로젝트: liuguogen/weixin
                 $error_msg[$key][$k] = 1;
             }
         }
     }
 } else {
     $submit = false;
 }
 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
     if ($password != $password2) {
         $error_msg['admininfo']['password2'] = 1;
         $submit = false;
     }
     $forceinstall = isset($_POST['dbinfo']['forceinstall']) ? $_POST['dbinfo']['forceinstall'] : '';
     $dbname_not_exists = true;
     if (!empty($dbhost) && empty($forceinstall)) {
         $dbname_not_exists = check_db($dbhost, $dbuser, $dbpw, $dbname, $tablepre, $dbport);
         if (!$dbname_not_exists) {
             $form_db_init_items['dbinfo']['forceinstall'] = array('type' => 'checkbox', 'required' => 0, 'reg' => '/^.*+/');
             $error_msg['dbinfo']['forceinstall'] = 1;
             $submit = false;
             $dbname_not_exists = false;
         }
     }
 }
 if ($submit) {
     $step = $step + 1;
     if (empty($dbname)) {
         show_msg('dbname_invalid', $dbname, 0);
     } else {
         if (!@mysql_connect($dbhost . ":" . $dbport, $dbuser, $dbpw)) {
             $errno = mysql_errno();
예제 #14
0
파일: process.php 프로젝트: Artofwack/PHP
<?php

//file: process.php
session_start();
require_once '../config.php';
$email = $_POST['email'];
$pass = $_POST['pass'];
/*
echo "email:";
echo $email;
echo "<br />";
echo "password:"******"<br />";
*/
$result = check_db($email, $pass);
function check_db($email, $pass)
{
    //check db
    //need: host, user, password, database
    $link = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_DATABASE);
    if (!$link) {
        echo "Error: Unable to connect to MySQL." . PHP_EOL;
        echo "Debugging error: " . mysqli_connect_errno() . PHP_EOL;
        echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
        exit;
    }
    /*
    //connect & show connection info
    echo "Success: A proper connection to MySQL was made! The my_db database is great." . PHP_EOL;
    echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;
예제 #15
0
<?php

error_reporting(E_ALL & ~E_NOTICE);
if ($_REQUEST[action] == 'install') {
    save_db_config();
    require "../config.php";
    if ($conn = check_connection($_REQUEST[mysql_user], $_REQUEST[mysql_pass], $_REQUEST[mysql_host])) {
        if (check_db($_REQUEST[mysql_db], $conn)) {
            install_db();
        } else {
            echo "<p><font color='red'><b>Install failed: Cannot select database.  " . mysql_error() . "</b></font></p>";
        }
    } else {
        echo "<p><font color='red'><b>Install failed: Cannot connect to database. " . mysql_error() . "</b></font></p>";
    }
} else {
    require "../config.php";
}
$sql = "select * from users";
$result = @mysql_query($sql);
if ($result) {
    echo "<h3>Database successfully Installed.</h3>";
    echo "<p>";
    echo "Next Steps:<br>";
    echo "1. Delete this file (install.php) from the server<br>";
    echo "2. Note: You must go to Admin-&gt;Main Config now and set up the rest of the script.<br>";
    echo " <a href='" . BASE_HTTP_PATH . "admin/'>Go to Admin</a>. <b>(The default admin password is 'ok'. Please don't forget to change the default password.)</b><br>";
    die;
}
function check_connection($user, $pass, $host)
{
예제 #16
0
        echo "<b>{$strDeleteUserMessage} <font color=#002E80>{$delete_user}@{$delete_host}</font><br>{$strRememberReload}</b>";
    } else {
        echo "<b>{$strDeleteFailed}</b>";
    }
}
if (isset($edit) && $edit) {
    # Edit an user
    table_users($host, $user);
    edit_operations($host, $user);
} elseif (isset($grants) && $grants) {
    # Revoke/Grant Privileges
    table_grants($host, $user);
    grant_operations();
} elseif (isset($check) && $check) {
    # Check Database Privileges
    check_db($db);
    check_operations();
} else {
    # Users actions
    if (!isset($host)) {
        $host = FALSE;
    }
    if (!isset($user)) {
        $user = FALSE;
    }
    table_users($host, $user) || mysql_die($strNoUsersFound);
    normal_operations();
}
require './footer.inc.php';
?>
</html>
예제 #17
0
파일: index.php 프로젝트: Procxl/libraries
        echo "</form>\n";
        echo "</td></tr>\n";
        echo "</table>\n";
    }
    echo "</body></html>\n";
    die;
}
if ($action == 'erase-confirm') {
    if ($trusted == false) {
        echo "Your client IP is not authorized to perform the requested operation!<br />\n";
        echo "<p /><a href=\"{$myname}?db={$db_id}\">Continue</a>\n";
        echo "</body></html>\n";
        die;
    }
    $kill_db = $_POST['db'];
    $kill_db = check_db($kill_db);
    if ($kill_db < 1) {
        echo "Erase data collection failed: invalid ID#!<br />\n";
        echo "</body></html>";
        die;
    }
    echo "Going to erase data collection #{$kill_db} ....<br />\n";
    $mydb = get_dbproperties($db_id);
    $db = $mydb['db_id'];
    $access = $mydb['access'];
    $name = $mydb['name'];
    $dbtype = $mydb['type'];
    $killed = unregister_db($kill_db);
    if ($killed == 1) {
        echo "metadata for 1 collection erased<br />\n";
    } else {
예제 #18
0
파일: include.php 프로젝트: michaelprem/phc
    //clearstatcache(); // should not be necessary
    if (!is_writable($current_db)) {
        //print "db is ro";
        return false;
    } else {
        return true;
    }
}
// connect to the system database
if (!is_writable('phpsla.sqlite')) {
    die("<br>System database 'phpsla.sqlite' is not writeable by webserver account.");
}
$sysdbh =& new SPSQLite('phpsla.sqlite');
$current_db = $_SESSION['phpSQLiteAdmin_currentdb'];
$current_user = 1;
if (check_db()) {
    $userdbh =& new SPSQLite($current_db);
    // I know this is ugly... time should cure it
    $userdbh2 =& new SPSQLite($current_db);
    $sqliteversion = $userdbh->libVersion();
}
function i18n($defaultstring, $stringid)
{
    return $defaultstring;
}
function print_top_links($current_table)
{
    global $sqliteversion;
    echo <<<EOT
<div id="currentdb">Database: {$_SESSION['phpSQLiteAdmin_currentdb']}</div>
<p class="sqliteversion">SQLite version: {$sqliteversion}</p>
예제 #19
0
function loadUserConfig()
{
    // Delete previous database
    $db = \db_priv_pdo_start("root");
    try {
        $sth = $db->prepare("DROP TABLE irrigation_zone;");
        $sth->execute();
        $sth = $db->prepare("DROP TABLE irrigation_engrais;");
        $sth->execute();
        $sth = $db->prepare("DROP TABLE irrigation_lt;");
        $sth->execute();
        $sth = $db->prepare("DROP TABLE irrigation_plateforme;");
        $sth->execute();
    } catch (\PDOException $e) {
        $ret = $e->getMessage();
        print_r($ret);
    }
    $db = null;
    // Recreat them
    check_db();
    $db = \db_priv_pdo_start("root");
    // Then load user config
    foreach ($GLOBALS['PLUGIN_irrigation']['plateforme'] as $keyPlateforme => $plateforme) {
        // Add the plateform
        $sql = "INSERT INTO irrigation_plateforme (name, idPlateforme, ip, pompeName, pompePrise, active, tempsPerco, tempsMaxRemp, priseDansLT) VALUES" . "('{$plateforme['nom']}','{$keyPlateforme}','{$plateforme['ip']}','{$plateforme['pompe']['nom']}','{$plateforme['pompe']['prise']}'" . ",'{$plateforme['active']}','{$plateforme['tempsPerco']}','{$plateforme['tempsMaxRemp']}','{$plateforme['priseDansLT']}');";
        $sth = $db->prepare($sql);
        $sth->execute();
        // Add every zone
        foreach ($plateforme['zone'] as $keyZone => $zone) {
            $sql = "INSERT INTO irrigation_zone (motherPlatef, zoneId, name, prise, tempsOn, tempsOff, active, coef) VALUES" . "('{$keyPlateforme}','{$keyZone}','{$zone['nom']}','{$zone['prise']}'" . ",'{$zone['tempsOn']}','{$zone['tempsOff']}','{$zone['active']}','{$zone['coef']}');";
            $sth = $db->prepare($sql);
            $sth->execute();
        }
    }
    // Add local technique
    $lt = $GLOBALS['PLUGIN_irrigation']['localtechnique'];
    $sql = "INSERT INTO irrigation_lt (name, ip, pompeName, pompePrise, irriActive) VALUES" . "('{$lt['nom']}','{$lt['ip']}','{$lt['pompe']['nom']}','{$lt['pompe']['prise']}'" . ",'{$lt['irriActive']}');";
    $sth = $db->prepare($sql);
    $sth->execute();
    // Add engrais
    $engraisList = $GLOBALS['PLUGIN_irrigation']['localtechnique']['engrais'];
    foreach ($engraisList as $key => $engrais) {
        $sql = "INSERT INTO irrigation_engrais (name, prise, active, engraisId) VALUES" . "('{$engrais['nom']}','{$engrais['prise']}','{$engrais['active']}','{$key}');";
        $sth = $db->prepare($sql);
        $sth->execute();
    }
    $db = null;
}
예제 #20
0
function check_all($install = NULL)
{
    $db_server = get_input("db_server");
    $db_port = get_input("db_port");
    $db_username = get_input("db_username");
    $db_password = get_input("db_password");
    $db_schema = get_input("db_schema");
    $adm_username = get_secure_input("adm_username");
    $adm_email = get_secure_input("adm_email");
    $adm_realname = get_secure_input("adm_realname");
    $adm_password = get_secure_input("adm_password");
    $adm_confirmpassword = get_secure_input("adm_confirmpassword");
    $hide_index = get_secure_input("hide_index");
    $gzip_compression = get_secure_input("gzip_compression");
    // Main program
    $success = true;
    $errors = array();
    $warnings = array();
    // curl
    if (!in_array('curl', get_loaded_extensions())) {
        $warnings[] = 'CURL is not enabled. Some modules might require it';
    }
    // database
    $result = check_db($db_server, $db_port, $db_username, $db_password, $db_schema);
    if (!$result['success']) {
        $success = FALSE;
    }
    if ($result['error_message'] != '') {
        $errors[] = $result['error_message'];
    }
    if ($result['warning_message'] != '') {
        $warnings[] = $result['warning_message'];
    }
    // writable
    if (!is_writable('../assets/caches')) {
        $success = FALSE;
        $errors[] = "Asset cache directory (assets/caches) is not writable";
    }
    if (!is_writable('../application/config/database.php')) {
        $success = FALSE;
        $errors[] = "application/config/database.php is not writable";
    }
    if (!is_writable('../application/config/routes.php')) {
        $success = FALSE;
        $errors[] = "application/config/routes.php is not writable";
    }
    if (!is_writable('../application/config/config.php')) {
        $success = FALSE;
        $errors[] = "application/config/config.php is not writable";
    }
    if (!is_writable('../assets/grocery_crud/js/jquery_plugins/config/jquery.ckeditor.config.js')) {
        $success = FALSE;
        $errors[] = 'assets/grocery_crud/js/jquery_plugins/config/jquery.ckeditor.config.js is not writable';
    }
    if (!is_writable('./')) {
        $success = FALSE;
        $errors[] = 'install directory is not writable';
    }
    if ($hide_index !== "") {
        if (!is_writable('../')) {
            $success = FALSE;
            $errors[] = "No-CMS directory is not writeable, we can't make .htaccess there";
        }
        if (!is_mod_rewrite_active()) {
            $success = FALSE;
            $errors[] = "mod_rewrite is not enabled";
        }
    }
    // admin password
    if ($adm_password == "") {
        $success = FALSE;
        $errors[] = "Admin's password is empty";
    }
    if ($adm_password != $adm_confirmpassword) {
        $success = FALSE;
        $errors[] = "Admin's password confirmation doesn't match";
    }
    // if not installed, than just return the warnings, errors and success
    if (!isset($install)) {
        $data = array("success" => $success, "errors" => $errors, "warnings" => $warnings);
        return $data;
    } else {
        // installation
        if (!$success) {
            // redirect if not success
            return false;
        } else {
            // perform installation
            // connection
            $db_connection = mysql_connect($db_server . ':' . $db_port, $db_username, $db_password);
            $db_exists = mysql_select_db($db_schema, $db_connection);
            if (!$db_exists) {
                $query = 'CREATE DATABASE ' . $db_schema . ' DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;';
                exec_sql($query, $db_connection);
                mysql_select_db($db_schema, $db_connection);
            }
            // database.sql
            $sql = file_get_contents('./resources/database.sql');
            $sql = replace($sql, array('@adm_username', '@adm_email', '@adm_password', '@adm_realname'), array($adm_username, $adm_email, md5($adm_password), $adm_realname));
            $queries = explode('/*split*/', $sql);
            foreach ($queries as $query) {
                exec_sql($query, $db_connection);
            }
            // database.php
            $str = file_get_contents('./resources/database.php');
            $str = replace($str, array('@db_server', '@db_port', '@db_username', '@db_password', '@db_schema'), array($db_server, $db_port, $db_username, $db_password, $db_schema));
            file_put_contents('../application/config/database.php', $str);
            @chmod('../application/config/database.php', 0555);
            // routes.php
            $str = file_get_contents('./resources/routes.php');
            file_put_contents('../application/config/routes.php', $str);
            @chmod('../application/config/routes.php', 0555);
            // jquery.ckeditor.config.js
            $str = file_get_contents('./resources/jquery.ckeditor.config.js');
            $base_path = get_base_url();
            $str = replace($str, array('@base_path'), array($base_path));
            file_put_contents('../assets/grocery_crud/js/jquery_plugins/config/jquery.ckeditor.config.js', $str);
            @chmod('../assets/grocery_crud/js/jquery_plugins/config/jquery.ckeditor.config.js', 0555);
            // config.php
            $key_config = array();
            $replace_config = array();
            if ($gzip_compression != "") {
                $key_config[] = '@gzip';
                $replace_config[] = 'TRUE';
            } else {
                $key_config[] = '@gzip';
                $replace_config[] = 'FALSE';
            }
            if ($hide_index !== "") {
                $key_config[] = '@index_page';
                $replace_config[] = '';
            } else {
                $key_config[] = '@index_page';
                $replace_config[] = 'index.php';
            }
            $str = file_get_contents('./resources/config.php');
            $str = replace($str, $key_config, $replace_config);
            file_put_contents('../application/config/config.php', $str);
            @chmod('../application/config/config.php', 0555);
            // .htaccess
            if ($hide_index !== "") {
                $str = file_get_contents('./resources/htaccess');
                $str = replace($str, array('@base_path'), array($base_path));
                file_put_contents('../.htaccess', $str);
                @chmod('../.htaccess', 0555);
            } else {
                file_put_contents('../.htaccess', '');
                @chmod('../.htaccess', 0555);
            }
            // put htaccess in install directory
            file_put_contents('.htaccess', 'Deny from all');
            @chmod('.htaccess', 0555);
            return true;
        }
    }
}
                ?>
	<?php 
                print_dbdata_text();
                ?>
	<br />
<?php 
                /*** end: show db connect data ***/
                ######################
                # connect to database
                if ($FDAT["mysql_root"] == 1) {
                    // connect to database as root
                    $conn = 0;
                    dbconnect(1, $FDAT["dbrootname"], $FDAT["dbrootpass"], '');
                } else {
                    // search for database
                    $db_found = check_db();
                }
                ######################
                # if connect error
                if ($conn->error) {
                    ?>
		<font color=red>Error: <?php 
                    echo $conn->error;
                    ?>
</font>
		<INPUT type="button" value="Back" onclick="javascript:document.getElementById('op').value='Step2';document.form.submit();" class="redbutton">
		<INPUT type="hidden" name="mysql_root" value="<?php 
                    echo $FDAT["mysql_root"];
                    ?>
">
		<br />
function current_version()
{
    global $conn, $CONF;
    $db_found = check_db();
    if ($db_found) {
        $sql = "SELECT version_nr FROM version ORDER BY release_date DESC LIMIT 1";
        $sth = new SQL($sql);
        $cms_version = $sth->fetchsingle();
        return $cms_version;
    } else {
        return 0;
    }
}
#!/usr/bin/php

<?php 
include 'conf_util.inc.php';
// téléchargement dans la base de données des comptes SIP + reconstitution
// du fichier de config
conf_log(DEBUG_DEBUG, "Iax.conf...");
$query = "Select VoIPAccount_ID, Name, FirstName, username, pwd, " . "VoIPAccount_People_Extension, notransfer, host, port " . "from People, Iax " . "where extension = VoIPAccount_People_extension and enable = true";
$query = $db->query($query);
check_db($query);
while ($row = $query->fetchRow(DB_FETCHMODE_ORDERRED)) {
    conf_log(DEBUG_DEBUG, '[' . $row[3] . '-' . $row[0] . ']');
    echo '[' . $row[3] . '-' . $row[0] . "]\n";
    echo "context=obelisk-iax-pep\ntype=friend\n";
    echo 'username='******'-' . $row[0] . "\n";
    if (is_null($row[7])) {
        echo "host=dynamic\n";
    } else {
        echo "host=" . $row[7] . "\n";
        if (!is_null($row[8])) {
            echo "port=" . $row[8] . "\n";
        }
    }
    echo 'callerid=' . $row[2] . ' ' . $row[1] . ' <' . $row[5] . "> \n";
    echo 'notransfer=' . ($row[6] == "t" ? "yes\n" : "no\n");
    echo 'secret=' . $row[4] . "\n\n";
}
conf_log(DEBUG_INFO, "DONE");
예제 #24
0
        show_msg('missing_parameter', '', 0);
    } else {
        show_form($form_db_init_items, $error_msg);
    }
} elseif ($method == 'ext_info') {
    @touch($lockfile);
    if (VIEW_OFF) {
        show_msg('ext_info_succ');
    } else {
        show_header();
        echo '</div><div class="main" style="margin-top: -123px;"><ul style="line-height: 200%; margin-left: 30px;">';
        echo '<li><a href="../">' . lang('install_succeed') . '</a><br>';
        echo '<script>setTimeout(function(){window.location=\'../\'}, 2000);</script>' . lang('auto_redirect') . '</li>';
        echo '</ul></div>';
        show_footer();
    }
} elseif ($method == 'install_check') {
    if (file_exists($lockfile)) {
        show_msg('installstate_succ');
    } else {
        show_msg('lock_file_not_touch', $lockfile, 0);
    }
} elseif ($method == 'tablepre_check') {
    $dbinfo = getgpc('dbinfo');
    extract($dbinfo);
    if (check_db($dbhost, $dbuser, $dbpw, $dbname, $tablepre)) {
        show_msg('tablepre_not_exists', 0);
    } else {
        show_msg('tablepre_exists', $tablepre, 0);
    }
}
예제 #25
0
// get module menu
$historyMenu = $page->getMenu();
if ($gCurrentUser->isWebmaster()) {
    // Datenbank erstellen fall sie nicht existiert
    if (check_db() != true) {
        $sql = 'CREATE TABLE ' . TBL_USER_HISTORY . '
         (hist_id int(10) unsigned NOT NULL AUTO_INCREMENT,
          hist_description text CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
          PRIMARY KEY (hist_id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;';
        $result = $gDb->query($sql);
    }
    // show link to edit history
    $historyMenu->addItem('menu_item_edit_history', $g_root_path . '/adm_plugins/history_plugin/history_edit.php?hist_id=' . $getId . '&amp;?headline=' . $getHeadline, '<i class="fa fa-pencil" alt="' . $gL10n->get('SYS_EDIT_VAR', $getHeadline) . '" title="' . $gL10n->get('SYS_EDIT_VAR', $getHeadline) . '"></i><div class="iconDescription">Text bearbeiten</div>', '');
}
// Output Database Entry if available
if (check_db() == true) {
    // get all recordsets
    $historysArray = $historys->getDataSet();
    $history = new TableAnnouncement($gDb);
    if ($historysArray['numResults'] != 0) {
        /// show all history
        foreach ($historysArray['recordset'] as $row) {
            $history->clear();
            $history->setArray($row);
            $page->addHtml('
            <div class="panel panel-primary" id="hist_' . $history->getValue('hist_id') . '">
                <div class="panel-body">' . $history->getValue('hist_description') . '</div>
            </div>');
        }
        // Ende foreach
    } else {
예제 #26
0
파일: main.php 프로젝트: vinothtimes/phpdoc
function check_connection($user, $pass, $host)
{
    if (!($connection = @mysql_connect("{$host}", "{$user}", "{$pass}"))) {
        return false;
    }
    return $connection;
}
function check_db($db_name, $connection)
{
    if (!($db = @mysql_select_db($db_name, $connection))) {
        return false;
    }
    return true;
}
if ($conn = check_connection(JB_MYSQL_USER, JB_MYSQL_PASS, JB_MYSQL_HOST)) {
    if (check_db(JB_MYSQL_DB, $conn)) {
        if ($DB_ERROR) {
            $JBMarkup->error_msg("<b>Database is not installed. [" . mysql_error() . "]<br>Please go to the installation page: <a href='install.php'>install.php</a></b>");
            die;
        }
    } else {
        $JBMarkup->error_msg("<b>Cannot select database.  " . mysql_error() . "<br>Please go to the installation page: <a href='install.php'>install.php</a></b>");
        die;
    }
} else {
    $JBMarkup->error_msg("<b>Cannot connect to database. " . mysql_error() . "<br>Please go to the installation page: <a href='install.php'>install.php</a></b>");
    die;
}
require 'upgrade.php';
if ($DB_ERROR == '') {
    $bold1 = '';
            $response->setStatusCode(503, "Internal Server Error");
            $response->setJsonContent(array("message" => $e->getMessage()));
        }
    } else {
        $response->setStatusCode(400, "Bad Request");
        $response->setJsonContent(array("message" => $respond));
    }
    return $response;
});
$app->get("/status/db/{id}", function ($id) {
    # Start building the response.
    $response = new Response();
    # Fill the response with the return value of the function that checks
    # the status of the component.
    $response->setStatusCode(200, "OK");
    $response->setJsonContent(array("ready" => check_db($id)));
    return $response;
});
$app->get("/status/memcached/{id}", function ($id) {
    # Start building the response.
    $response = new Response();
    # Fill the response with the return value of the function that checks
    # the status of the component.
    $response->setStatusCode(200, "OK");
    $response->setJsonContent(array("ready" => check_memcached($id)));
    return $response;
});
$app->get("/status/zebra/{id}", function ($id) {
    # Start building the response.
    $response = new Response();
    # Fill the response with the return value of the function that checks