コード例 #1
0
ファイル: ajax.php プロジェクト: richstokoe/BeehiveForum
            header_status(500, 'Internal Server Error');
            exit;
        }
        if (!($content = poll_get_question_html($_GET['question_number']))) {
            header_status(500, 'Internal Server Error');
            exit;
        }
        break;
    case 'poll_add_option':
        if (!session::logged_in()) {
            break;
        }
        cache_disable();
        if (!isset($_GET['question_number']) || !is_numeric($_GET['question_number'])) {
            header_status(500, 'Internal Server Error');
            exit;
        }
        if (!isset($_GET['option_number']) || !is_numeric($_GET['option_number'])) {
            header_status(500, 'Internal Server Error');
            exit;
        }
        if (!($content = poll_get_option_html($_GET['question_number'], $_GET['option_number']))) {
            header_status(500, 'Internal Server Error');
            exit;
        }
        break;
    default:
        header_status(500, 'Internal Server Error');
        exit;
}
echo $content;
コード例 #2
0
    echo "                                <div class=\"poll_question_input\">\n";
    echo "                                  ", form_input_text("poll_questions[{$question_id}][question]", htmlentities_array($question['QUESTION']), 40, 255), "&nbsp;", form_button_html("delete_question[{$question_id}]", 'submit', 'button_image delete_question', sprintf("<img src=\"%s\" alt=\"\" />", html_style_image('delete.png')), sprintf('title="%s"', gettext("Delete question"))), "\n";
    echo "                                </div>\n";
    echo "                                <div class=\"poll_question_checkbox\">\n";
    echo "                                  ", form_checkbox("poll_questions[{$question_id}][allow_multi]", "Y", gettext("Allow multiple options to be selected"), isset($question['ALLOW_MULTI']) && $question['ALLOW_MULTI'] == 'Y'), "\n";
    echo "                                </div>\n";
    echo "                                <div class=\"poll_options_list\">\n";
    echo "                                  <ol>\n";
    if (isset($question['OPTIONS_ARRAY']) && is_array($question['OPTIONS_ARRAY'])) {
        foreach ($question['OPTIONS_ARRAY'] as $option_id => $option) {
            echo "                                    <li>", form_input_text("poll_questions[{$question_id}][options][{$option_id}]", htmlentities_array($option['OPTION_NAME']), 45, 255), "&nbsp;", form_button_html("delete_option[{$question_id}][{$option_id}]", 'submit', 'button_image delete_option', sprintf("<img src=\"%s\" alt=\"\"/>", html_style_image('delete.png')), sprintf('title="%s"', gettext("Delete option"))), "</li>\n";
        }
    } else {
        echo "                                    <li>", form_input_text("poll_questions[{$question_id}][options][0]", '', 45, 255), "&nbsp;", form_button_html("delete_option[{$question_id}][0]", 'submit', 'button_image delete_option', sprintf("<img src=\"%s\" alt=\"\"/>", html_style_image('delete.png')), sprintf('title="%s"', gettext("Delete option"))), "</li>\n";
        if (isset($_POST['add_option'][$question_id])) {
            echo poll_get_option_html($question_id, 1);
        }
    }
    echo "                                  </ol>\n";
    echo "                                </div>\n";
    echo "                              </div>\n";
    echo "                            ", form_button_html("add_option[{$question_id}]", 'submit', 'button_image add_option', sprintf("<img src=\"%s\" alt=\"\" />&nbsp;%s", html_style_image('add.png'), gettext("Add new option"))), "\n";
    echo "                            </fieldset>\n";
}
echo "                          </div>\n";
echo "                          <table width=\"100%\">\n";
echo "                            <tr>\n";
echo "                              <td>", form_button_html('add_question', 'submit', 'button_image add_question', sprintf("<img src=\"%s\" alt=\"\" />&nbsp;%s", html_style_image('add.png'), gettext("Add new question"))), "</td>\n";
echo "                            </tr>\n";
echo "                            <tr>\n";
echo "                              <td align=\"left\">&nbsp;</td>\n";
コード例 #3
0
ファイル: poll.inc.php プロジェクト: richstokoe/BeehiveForum
function poll_get_question_html($question_number)
{
    if (!is_numeric($question_number)) {
        return false;
    }
    $html = "<fieldset class=\"poll_question\">\n";
    $html .= "  <div>\n";
    $html .= "    <h2>" . gettext("Poll Question") . "</h2>\n";
    $html .= "    <div class=\"poll_question_input\">\n";
    $html .= "      " . form_input_text("poll_questions[{$question_number}][question]", '', 40, 255) . "&nbsp;" . form_button_html("delete_question[{$question_number}]", 'submit', 'button_image delete_question', sprintf("<img src=\"%s\" alt=\"\" />", html_style_image('delete.png')), sprintf('title="%s"', gettext("Delete question"))) . "<br />\n";
    $html .= "    </div>\n";
    $html .= "    <div class=\"poll_question_checkbox\">\n";
    $html .= "      " . form_checkbox("poll_questions[{$question_number}][allow_multi]", "Y", gettext("Allow multiple options to be selected"), false) . "\n";
    $html .= "    </div>\n";
    $html .= "    <div class=\"poll_options_list\">\n";
    $html .= "      <ol>\n";
    $html .= "        " . poll_get_option_html($question_number, 1) . "\n";
    $html .= "      </ol>\n";
    $html .= "    </div>\n";
    $html .= "  </div>\n";
    $html .= "  " . form_button_html("add_option[{$question_number}]", 'submit', 'button_image add_option', sprintf("<img src=\"%s\" alt=\"\" />&nbsp;%s", html_style_image('add.png'), gettext("Add new option"))) . "\n";
    $html .= "</fieldset>\n";
    return $html;
}