Esempio n. 1
0
function getSays($model_id = -1)
{
    if ($model_id == -1) {
        $resultarray = getconf('crawler_contents', ' where history_id = ' . getId() . ' and rc_id = 3');
    } else {
        $resultarray = getconf('crawler_contents', ' where history_id = ' . getId() . ' and rc_id = 3 and mc_id = ' . $model_id);
    }
    //$namearray=split(',',$resultarray[0][1]);
    //print_r($resultarray);
    return $resultarray;
}
Esempio n. 2
0
 example ampbackup.php "My_Nightly_Backup" yes yes no no yes


 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 2
 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.
*/
//get options
$amp_conf = getconf(isset($_ENV['FREEPBXCONFIG']) && strlen($_ENV['FREEPBXCONFIG']) ? $_ENV['FREEPBXCONFIG'] : '/etc/amportal.conf');
$ast_conf = getconf(isset($_ENV['ASTERISKCONFIG']) && strlen($_ENV['ASTERISKCONFIG']) ? $_ENV['ASTERISKCONFIG'] : '/etc/asterisk/asterisk.conf');
//connect to database
include_once 'DB.php';
if (!isset($db)) {
    $db = DB::connect('mysql://' . $amp_conf['AMPDBUSER'] . ':' . $amp_conf['AMPDBPASS'] . '@' . $amp_conf['AMPDBHOST'] . '/' . $amp_conf['AMPDBNAME']);
}
// attempt connection
switch (true) {
    case $argc == 1:
        //no args recieved - show help text
        showopts();
        break;
    case $argv[1] == 'cli':
        //args passed on cli
        for ($i = 2; $i < $argc; $i++) {
            if (substr($argv[$i], 0, 2) == '--') {
Esempio n. 3
0
// Astdb trees that should be deleted before the restore
//
$deltree = array('AMPUSER', 'DEVICE', 'CF', 'CFB', 'CFU', 'CW', 'DND', 'DAYNIGHT');
function getconf($filename)
{
    $file = file($filename);
    foreach ($file as $line) {
        if (preg_match("/^\\s*([\\w]+)\\s*=\\s*\"?([\\w\\/\\:\\.\\%-]*)\"?\\s*([;#].*)?/", $line, $matches)) {
            $conf[$matches[1]] = $matches[2];
        }
    }
    return $conf;
}
# Get configuration
$amportalconf = isset($_ENV["FREEPBXCONFIG"]) && strlen($_ENV["FREEPBXCONFIG"]) ? $_ENV["FREEPBXCONFIG"] : "/etc/amportal.conf";
$amp_conf = getconf($amportalconf);
if (!isset($amp_conf["ASTMANAGERHOST"])) {
    $amp_conf["ASTMANAGERHOST"] = '127.0.0.1';
}
if (!isset($amp_conf["ASTMANAGERPORT"])) {
    $amp_conf["ASTMANAGERPORT"] = '5038';
}
require_once $amp_conf['AMPWEBROOT'] . "/admin/functions.inc.php";
require_once $amp_conf['AMPWEBROOT'] . "/admin/common/php-asmanager.php";
$astman = new AGI_AsteriskManager();
if (!($res = $astman->connect($amp_conf["ASTMANAGERHOST"] . ":" . $amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"]))) {
    unset($astman);
    exit(10);
}
if (!$argv[1] || strstr($argv[1], "/") || strstr($argv[1], "..")) {
    // You must supply a single filename, which will be written to /tmp
Esempio n. 4
0
        $modelArray[$i]["model_name"] = iconv("GBK", "UTF-8", $modelArray[$i]["model_name"]);
    }
    //print_r($modelArray);
    $modelJson = json_encode($modelArray);
    //print_r($modelArray);
    echo $modelJson;
}
if (!empty($_GET["isf"])) {
    if ($_GET["isf"] == 1) {
        //echo "hnjkjkb".$_GET[key].$_GET[username].$_GET[pwd].$_GET[model_class];
        if (!empty($_GET[key])) {
            mysql_query("INSERT INTO crawler_history (`history_id`,`history_key`,`category_id`,`isdown`) VALUES (NULL,'" . $_GET[key] . "','" . $_GET[cid] . "','0')");
            $insertid = mysql_insert_id();
            system('cmd /c java com.nupt.main.CrawlerMain ' . $_GET[model_class] . ' ' . $insertid . ' ' . $_GET[key]);
            //µ÷ÓÃÅÀ³æ
            echo "<&&>" . $insertid;
        } else {
            mysql_query("INSERT INTO crawler_history (`history_id`,`history_key`,`category_id`,`isdown`) VALUES (NULL,'" . $_GET[username] . "','" . $_GET[cid] . "','0')");
            $insertid = mysql_insert_id();
            system('cmd /c java com.nupt.main.CrawlerMain ' . $_GET[model_class] . ' ' . $insertid . ' ' . $_GET[username] . ' ' . $_GET[pwd]);
            //µ÷ÓÃÅÀ³æ
            echo "<&&>" . $insertid;
        }
    } else {
        if ($_GET["isf"] == 2) {
            //$isdownarray=getconf("crawler_history"," where history_id in (select max(history_id) from crawler_history)");
            $isdownarray = getconf("crawler_history", " where history_id = " . $_GET['insid']);
            echo $isdownarray[0][isdown];
        }
    }
}