Exemplo n.º 1
0
 public function __construct($controller = '', $action = '')
 {
     global $config, $application_data, $query_string, $response_type;
     $application_data = array();
     //Get query string in case they need to be read in controller
     $this->query_string = $query_string;
     //Set the type of response
     $this->response_type = getResponseType();
     $response_type = $this->response_type;
     //Set content type header for non-HTML responses
     if ($this->response_type == 'json') {
         header('Content-Type: application/json');
     } elseif ($this->response_type == 'xml') {
         header('Content-Type: text/xml');
     }
     //Get config options in case they need to be read in controller
     $this->config = $config;
     //Set what controller and action this is
     $this->controller = $controller;
     $this->action = $action;
     //validate job key
     if ($controller == 'jobs') {
         validateJobKey();
     }
     //Create DB connection
     $db = new MysqliDb($this->config['db_host'], $this->config['db_username'], $this->config['db_password'], $this->config['db_database']);
     $this->db = $db;
     $this->values = array();
     $this->layout = 'application';
 }
Exemplo n.º 2
0
function query_slave($action, $m_hostname, $passwd, $s_ip)
{
    $req = query_url_post("https://" . $s_ip . _URL_OVD_ADMIN_HA . "/registration.php", "action=" . $action . "&hostname=" . $m_hostname . "&passwd=" . $passwd, false);
    if (getResponseType($req)) {
        Logger::warning('ha', "Activation request from " . $m_hostname . " to " . $s_ip . " has been send!");
    } else {
        Logger::error('ha', "An error occured when trying to send an HTTP request (registration.php)  from " . $m_hostname . " to " . $s_ip);
        return false;
    }
    return true;
}