Beispiel #1
0
/**
* Delete logs
*/
function dt_delete_log()
{
    global $mc, $item, $log;
    $lg = new DTLog($log);
    if ($lg->isNew()) {
        redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->id() : '/?p=cpanel&action=logs&id=' . $item->id()), 1, __('Specified log is not valid!', 'dtransport'));
    }
    if (!$lg->delete()) {
        redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->id() : '/?p=cpanel&action=logs&id=' . $item->id()), 1, __('Log could not be deleted! Please try again.', 'dtransport'));
    }
    redirect_header(DT_URL . ($mc['permalinks'] ? '/cp/logs/' . $item->id() : '/?p=cpanel&action=logs&id=' . $item->id()), 1, __('Log deleted successfully!', 'dtransport'));
}
Beispiel #2
0
/**
* @desc Almacena los datos del log en la base de datos
**/
function dt_save_log($edit = 0)
{
    global $xoopsSecurity;
    $query = '';
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
        if ($k == 'XOOPS_TOKEN_REQUEST' || ($k = 'action')) {
            continue;
        }
        $query = $query == '' ? $k . '=' . urlencode($v) : "&{$k}=" . urlencode($v);
    }
    //Verificamos si el software es válido
    if ($item <= 0) {
        redirectMsg('items.php', __('Download item ID not provided!', 'dtransport'), RMMSG_WARN);
    }
    //Verificamos si existe el software
    $sw = new DTSoftware($item);
    if ($sw->isNew()) {
        redirectMsg('items.php', __('Specified download item does not exists!', 'dtransport'), RMMSG_WARN);
    }
    if (!$xoopsSecurity->check()) {
        redirectMsg('logs.php?item=' . $item, __('Session token not valid!', 'dtransport'), RMMSG_ERROR);
    }
    if ($edit) {
        $action = 'action=edit';
        // Edición del registro
        if ($id <= 0) {
            redirectMsg('logs.php?item=' . $item, __('Item log ID not provided!', 'dtransport'), 1);
        }
        $lg = new DTLog($id);
        if ($lg->isNew()) {
            redirectMsg('logs.php?item=' . $item, __('Specified log does not exists!', 'dtransport'), 1);
        }
    } else {
        $action = 'action=new';
        $lg = new DTLog();
    }
    $lg->setSoftware($item);
    $lg->setTitle($title);
    $lg->setLog($log);
    $lg->setDate(time());
    if (!$lg->save()) {
        redirectMsg('logs.php?' . $query . '&' . $action, __('Item log could not be saved!', 'dtransport') . '<br />' . $lg->error(), RMMSG_ERROR);
    } else {
        redirectMsg('logs.php?item=' . $item, __('Database updated successfully!', 'dtransport'), RMMSG_SAVED);
    }
}