Exemple #1
0
function catalog_worker($action, $catalogs = null, $options = null)
{
    if (AmpConfig::get('ajax_load')) {
        $sse_url = AmpConfig::get('web_path') . "/server/sse.server.php?worker=catalog&action=" . $action . "&catalogs=" . urlencode(serialize($catalogs));
        if ($options) {
            $sse_url .= "&options=" . urlencode(serialize($_POST));
        }
        sse_worker($sse_url);
    } else {
        Catalog::process_action($action, $catalogs, $options);
    }
}
Exemple #2
0
} else {
    $options = null;
}
if (isset($_REQUEST['catalogs'])) {
    $catalogs = scrub_in(json_decode(urldecode($_REQUEST['catalogs']), true));
} else {
    $catalogs = null;
}
// Free the session write lock
// Warning: Do not change any session variable after this call
session_write_close();
switch ($worker) {
    case 'catalog':
        if (defined('SSE_OUTPUT')) {
            echo "data: toggleVisible('ajax-loading')\n\n";
            ob_flush();
            flush();
        }
        Catalog::process_action($_REQUEST['action'], $catalogs, $options);
        if (defined('SSE_OUTPUT')) {
            echo "data: toggleVisible('ajax-loading')\n\n";
            ob_flush();
            flush();
            echo "data: stop_sse_worker()\n\n";
            ob_flush();
            flush();
        } else {
            AmpError::display('general');
        }
        break;
}