Ejemplo n.º 1
0
        $question = $db->selectObject('poll_question', 'id=' . $answer->question_id);
        if ($question) {
            $loc = unserialize($answer->location_data);
        }
    }
} else {
    if (isset($_POST['question_id'])) {
        $question = $db->selectObject('poll_question', 'id=' . $_POST['question_id']);
        if ($question) {
            $loc = unserialize($answer->location_data);
        }
    }
}
if ($question) {
    if (expPermissions::check('manage_answer', $loc)) {
        $answer = poll_answer::update($_POST, $answer);
        if (isset($answer->id)) {
            $db->updateObject($answer, 'poll_answer');
        } else {
            $answer->question_id = $question->id;
            $answer->rank = $db->max('poll_answer', 'rank', 'question_id', 'question_id=' . $question->id);
            if ($answer->rank == null) {
                $answer->rank = 0;
            } else {
                $answer->rank++;
            }
            $db->insertObject($answer, 'poll_answer');
        }
        expHistory::back();
    } else {
        echo SITE_403_HTML;
Ejemplo n.º 2
0
}
$question = null;
$answer = null;
if (isset($_GET['id'])) {
    $answer = $db->selectObject('poll_answer', 'id=' . $_GET['id']);
    if ($answer) {
        $question = $db->selectObject('poll_question', 'id=' . $answer->question_id);
    }
} else {
    if (isset($_GET['question_id'])) {
        $question = $db->selectObject('poll_question', 'id=' . $_GET['question_id']);
    }
}
if ($question) {
    $loc = unserialize($question->location_data);
    if (expPermissions::check('manage_answer', $loc)) {
        $form = poll_answer::form($answer);
        $form->location($loc);
        $form->meta('action', 'save_answer');
        if ($answer == null && isset($_GET['question_id'])) {
            $form->meta('question_id', $_GET['question_id']);
        }
        $template = new template('simplepollmodule', '_editAnswer', $loc);
        $template->assign('form_html', $form->toHTML());
        $template->output();
    } else {
        echo SITE_403_HTML;
    }
} else {
    echo SITE_404_HTML;
}