Пример #1
0
function MysqlCheck()
{
    $db_file = "/usr/share/ocsinventory-reports/ocsreports/files/ocsbase.sql";
    if (!is_file($db_file)) {
        die;
    }
    if (CheckTables()) {
        die;
    }
    if ($dbf_handle = @fopen($db_file, "r")) {
        $sql_query = fread($dbf_handle, filesize($db_file));
        fclose($dbf_handle);
    }
    $q = new mysql();
    if (!$q->DATABASE_EXISTS("ocsweb")) {
        $q->CREATE_DATABASE("ocsweb");
    }
    $array_commands = explode(";", "{$sql_query}");
    while (list($num, $sql) = each($array_commands)) {
        if (trim($sql) == null) {
            continue;
        }
        $q->QUERY_SQL($sql, "ocsweb");
    }
}
Пример #2
0
function MysqlCheck(){
$db_file = "/usr/share/ocsinventory-reports/ocsreports/files/ocsbase.sql";
if(!is_file($db_file)){
	echo "Starting......: OCS web Engine unable to stat $db_file\n";
	return;
}

$q=new mysql();
if(!$q->DATABASE_EXISTS("ocsweb")){
	echo "Starting......: OCS web Engine creating ocsweb\n";
	$q->CREATE_DATABASE("ocsweb");
	if(!$q->DATABASE_EXISTS("ocsweb")){
		echo "Starting......: OCS web Engine unable to create ocsweb mysql database\n";
		return;
	}
}



if(CheckTables()){
	$sock=new sockets();
	$users=new usersMenus();
	$q=new mysql();
	$ocswebservername=$sock->GET_INFO("ocswebservername");
	$OCSWebPort=$sock->GET_INFO("OCSWebPort");	
	if($OCSWebPort==null){$OCSWebPort=9080;}
	if($OCSWebPortSSL==null){$OCSWebPortSSL=$OCSWebPort+50;}	
	if($ocswebservername==null){$ocswebservername=$users->hostname;}
	$sql="UPDATE config SET IVALUE=1 WHERE NAME='DOWNLOAD'";
	$q->QUERY_SQL($sql,"ocsweb");
	$sql="UPDATE config SET IVALUE=1 WHERE NAME='REGISTRY'";
	$q->QUERY_SQL($sql,"ocsweb");
	$sql="UPDATE config SET IVALUE='http://$ocswebservername:$OCSWebPort' WHERE NAME='LOCAL_SERVER'";
	$q->QUERY_SQL($sql,"ocsweb");	
	return;
}




if($dbf_handle = @fopen($db_file, "r")) {
	$sql_query = fread($dbf_handle, filesize($db_file));
	fclose($dbf_handle);
	
}



$array_commands=explode(";", "$sql_query");
while (list ($num, $sql) = each ($array_commands) ){
	if(trim($sql)==null){continue;}
	
	$q->QUERY_SQL($sql,"ocsweb");
	if(!$q->ok){
	echo "Starting......: OCS web Engine $q->mysql_error $sql\n";	
	}
}

}
Пример #3
0
    exit;
}
if (isset($_GET["postfix-status"])) {
    POSTFIX_STATUS();
    exit;
}
if (isset($_GET["AdminDeleteAllSqlEvents"])) {
    warnings_delete_all();
    exit;
}
if (isset($_GET["ShowFileLogs"])) {
    ShowFileLogs();
    exit;
}
if (isset($_GET["buildtables"])) {
    CheckTables();
    exit;
}
if (isset($_GET["CheckDaemon"])) {
    CheckDaemon();
    exit;
}
if (isset($_GET["EmergencyStart"])) {
    EmergencyStart();
    exit;
}
if (isset($_GET["memcomputer"])) {
    status_computer();
    exit;
}
if (isset($_GET["mem-dump-js"])) {
Пример #4
0
function import($filename)
{
    if (!CheckTables()) {
        echo "Failed\n";
    }
    $f = unserialize(@file_get_contents($filename));
    if (!is_array($f)) {
        echo "Not an array\n";
        return;
    }
    $q = new mysql();
    $q->QUERY_SQL("TRUNCATE TABLE adgroups", "artica_backup");
    $usrs = $f["USERS"];
    while (list($gpid, $groupname) = each($f["GROUPS"])) {
        $groupname = utf8_encode($groupname);
        $groupname = addslashes($groupname);
        $t[] = "('{$gpid}','{$groupname}')";
    }
    $sql = "INSERT IGNORE INTO adgroups (gpid,groupname) VALUES " . @implode(",", $t);
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "{$q->mysql_error}\n";
        return;
    }
    $t = array();
    $q->QUERY_SQL("TRUNCATE TABLE adusers", "artica_backup");
    echo count($usrs) . " users\n";
    while (list($index, $array) = each($usrs)) {
        //echo "{$array["gpid"]}:{$array["uid"]}\n";
        $array["uid"] = utf8_encode($array["uid"]);
        $array["uid"] = addslashes($array["uid"]);
        $t[] = "('{$array["gpid"]}','{$array["uid"]}')";
    }
    $sql = "INSERT IGNORE INTO adusers(`gpid`,`uid`) VALUES " . @implode(",", $t);
    $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "{$q->mysql_error}\n";
        return;
    }
    echo "Importing {$filename} done\n";
}
Пример #5
0
if(isset($_GET["StartStopService-js"])){StartStopService_js();exit;}
if(isset($_GET["StartStopService-popup"])){StartStopService_popup();exit;}
if(isset($_GET["StartStopService-perform"])){StartStopService_perform();exit;}
if(isset($_GET["postfix-status-right"])){echo status_postfix();exit;}

if(isset($_GET["graph"])){graph();exit;}
if(isset($_GET["start-all-services"])){START_ALL_SERVICES();exit;}
if($_GET["status"]=="left"){status_left();exit;}
if($_GET["status"]=="right"){status_right();exit;}



if(isset($_GET["postfix-status"])){POSTFIX_STATUS();exit;}
if(isset($_GET["AdminDeleteAllSqlEvents"])){warnings_delete_all();exit;}
if(isset($_GET["ShowFileLogs"])){ShowFileLogs();exit;}
if(isset($_GET["buildtables"])){CheckTables();exit;}
if(isset($_GET["CheckDaemon"])){CheckDaemon();exit;}
if(isset($_GET["EmergencyStart"])){EmergencyStart();exit;}
if(isset($_GET["memcomputer"])){status_computer();exit;}
if(isset($_GET["mem-dump"])){status_memdump();exit;}
if(isset($_GET["memory-status"])){status_memdump_js();exit;}
if(isset($_GET["artica-meta"])){artica_meta();exit;}

page($users);

function warnings_js(){
	$page=CurrentPageName();
	$tpl=new templates();
	$title=$tpl->_ENGINE_parse_body("{$_GET["count"]} {warnings}");
	echo "YahooWinS('330','$page?warnings-popup=yes','$title');";