コード例 #1
0
ファイル: reports.php プロジェクト: petitours/bxpress
/**
* @desc Elimina Reportes
**/
function deleteReports()
{
    global $xoopsModule, $xoopsUser, $xoopsSecurity;
    $ids = rmc_server_var($_POST, 'ids', array());
    $show = rmc_server_var($_POST, 'show', array());
    //Verificamos si los reportes son válidos
    if (empty($ids)) {
        redirectMsg('reports.php?show=' . $show, __('Select at least one report!', 'bxpress'), 1);
        die;
    }
    if (!$xoopsSecurity->check()) {
        redirectMsg('reports.php?show=' . $show, __('Session token expired!', 'bxpress'), 1);
        die;
    }
    $errors = '';
    foreach ($ids as $id) {
        //Verificamos si el reporte es válido
        if ($id <= 0) {
            $errors .= sprintf(__('ID %s is not valid!', 'bxpress'), $id);
            continue;
        }
        $report = new bXReport($id);
        //Comprobamos si el reporte existe
        if ($report->isNew()) {
            $errors .= sprintf(__('Report with ID %s does not exists!', 'bxpress'), $id);
            continue;
        }
        if (!$report->delete()) {
            $errors .= sprintf(__('Report %s could dot be deleted!', 'bxpress'), $id);
        }
    }
    if ($errors != '') {
        redirectMsg('reports.php?show=' . $show, __('Errors ocurred while trying to delete selected reports.', 'bxpress') . "<br />" . $errors, 1);
    } else {
        redirectMsg('./reports.php?show=' . $show, __('Reports deleted successfully!', 'bxpress'), 0);
    }
}
コード例 #2
0
ファイル: report.php プロジェクト: laiello/bitcero-modules
} elseif ($op == 'savereport') {
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    //Verificamos que el mensaje sea válido
    if ($pid <= 0) {
        redirect_header('./topic.php?id=' . $id, 1, __('Sepecified post is not valid!', 'bxpress'));
        die;
    }
    //Comprobamos que el mensaje exista
    $post = new bXPost($pid);
    if ($post->isNew()) {
        redirect_header('./topic.php?id=' . $id, 1, __('Specified post does not exists!', 'bxpress'));
        die;
    }
    if (!$xoopsSecurity->check()) {
        redirect_header('./topic.php?pid=' . $pid . '#p' . $pid, 2, __('Session token expired!', 'bxpress'));
        die;
    }
    $rep = new bXReport();
    $rep->setPost($pid);
    $rep->setUser($xoopsUser->uid());
    $rep->setIp($_SERVER['REMOTE_ADDR']);
    $rep->setTime(time());
    $rep->setReport($report);
    if ($rep->save()) {
        redirect_header('./topic.php?id=' . $id, 1, __('Thanks for reporting! Moderators will be notified.', 'bxpress'));
    } else {
        redirect_header('./topic.php?id=' . $id, 1, __('Report could not be sent! Please try again later.', 'bxpress'));
    }
}