Exemplo n.º 1
0
try {
    function exception_error_handler($errno, $errstr, $errfile, $errline)
    {
        switch ($errno) {
            case E_STRICT:
                break;
            default:
                throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
                break;
        }
    }
    set_error_handler("exception_error_handler");
    require_once "openmediavault/autoloader.inc";
    require_once "openmediavault/env.inc";
    require_once "openmediavault/config.inc";
    // Must be included here
    $session =& \OMV\Session::getInstance();
    $session->start();
    $session->validate();
    // Do not update last access time.
    //$session->updateLastAccess();
    $server = new \OMV\Rpc\Proxy\Upload();
    $server->handle();
    $server->cleanup();
} catch (\Exception $e) {
    if (isset($server)) {
        $server->cleanup();
    }
    header("Content-Type: text/html");
    print json_encode_safe(array("success" => false, "responseText" => $e->getMessage(), "errors" => null, "code" => $e->getCode(), "message" => $e->getMessage(), "trace" => $e->__toString()));
}
Exemplo n.º 2
0
function x4Data($name, $data)
{
    if (vgfGet('x6', false)) {
        return x6Data($name, $data);
    }
    $script = "\n\$a.data.{$name} = " . json_encode_safe($data) . ";";
    x4Script($script);
}
Exemplo n.º 3
0
 * OpenMediaVault 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 3 of the License, or
 * any later version.
 *
 * OpenMediaVault 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.
 */
try {
    require_once "openmediavault/env.inc";
    require_once "openmediavault/config.inc";
    // Must be included here
    require_once "openmediavault/session.inc";
    require_once "openmediavault/rpcproxy.inc";
    $session =& OMVSession::getInstance();
    $session->start();
    $server = new OMVJsonRpcProxy();
    $server->handle();
    $server->cleanup();
} catch (Exception $e) {
    if (isset($server)) {
        $server->cleanup();
    }
    header("Content-Type: application/json");
    print json_encode_safe(array("response" => null, "error" => array("code" => $e->getCode(), "message" => $e->getMessage(), "trace" => $e->__toString())));
}
Exemplo n.º 4
0
function index_hidden_x6FETCH()
{
    $returns = array();
    # This is everything that *might* go back, make a place
    # for all of it
    $GLOBALS['AG']['x4'] = array('error' => array(), 'debug' => array(), 'notice' => array(), 'html' => array(), 'script' => array());
    // First fetch the values
    $table_id = gp('x6fetch');
    $dd = ddTable($table_id);
    $column = gp('x6col');
    $colvalue = gp('x6val');
    # Look for fetch columns that pull from this column's
    # table_id_fko
    $tfko = $dd['flat'][$column]['table_id_fko'];
    $cfko = $dd['flat'][$column]['column_id_fko'];
    $cols = array();
    foreach ($dd['flat'] as $fcol => $cdetails) {
        $arr = array('FETCH', 'FETCHDEF', 'DISTRIBUTE');
        if (in_array($cdetails['automation_id'], $arr)) {
            if ($cdetails['auto_table_id'] == $tfko) {
                $cols[$fcol] = $cdetails['auto_column_id'];
            }
        }
    }
    # We now have a list of source and destination
    # columns, build the query
    $sql = "Select " . implode(',', $cols) . " FROM {$tfko} WHERE {$cfko} = " . SQLFC($colvalue);
    $row = SQL_OneRow($sql);
    foreach ($cols as $fcol => $srccol) {
        $type = $dd['flat'][$fcol]['formshort'];
        if ($type == 'date') {
            x6html("x6inp_{$table_id}_{$fcol}", date("Y-m-d", dEnsureTs($row[$srccol])));
        } else {
            x6html("x6inp_{$table_id}_{$fcol}", $row[$srccol]);
        }
    }
    echo json_encode_safe($GLOBALS['AG']['x4']);
    exit;
}