Ejemplo n.º 1
0
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: save_question.php,v 1.1 2005/04/10 23:24:02 filetreefrog Exp $
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
$question = null;
if (isset($_POST['id'])) {
    $question = $db->selectObject('poll_question', 'id=' . $_POST['id']);
    if ($question) {
        $loc = unserialize($question->location_data);
    }
}
if (expPermissions::check('manage_question', $loc)) {
    $question = poll_question::update($_POST, $question);
    $question->location_data = serialize($loc);
    if ($db->countObjects('poll_question', "location_data='" . $question->location_data . "'") == 0) {
        $question->is_active = 1;
    }
    if (isset($question->id)) {
        $db->updateObject($question, 'poll_question');
    } else {
        $db->insertObject($question, 'poll_question');
    }
    expHistory::back();
} else {
    echo SITE_403_HTML;
}
Ejemplo n.º 2
0
# You should have received a copy of the GNU
# General Public License along with Exponent; if
# not, write to:
#
# Free Software Foundation, Inc.,
# 59 Temple Place,
# Suite 330,
# Boston, MA 02111-1307  USA
#
# $Id: edit_question.php,v 1.1 2005/04/10 23:24:02 filetreefrog Exp $
##################################################
if (!defined('EXPONENT')) {
    exit('');
}
$question = null;
if (isset($_GET['id'])) {
    $question = $db->selectObject('poll_question', 'id=' . $_GET['id']);
    if ($question) {
        $loc = unserialize($question->location_data);
    }
}
if (expPermissions::check('manage_question', $loc)) {
    $form = poll_question::form($question);
    $form->location($loc);
    $form->meta('action', 'save_question');
    $template = new template('simplepollmodule', '_editQuestion', $loc);
    $template->assign('form_html', $form->toHTML());
    $template->output();
} else {
    echo SITE_403_HTML;
}