Example #1
0
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
require_once 'common.inc';
startpage(RESTRICTED);
try {
    /* Step 1: Add the category */
    $name = strip_tags($_POST["categoryname"], '<b><i><u>');
    $explanatory_text = strip_tags($_POST["explanatory"], '<a><b><i><u>');
    if (is_null($_POST["dayid"]) or $_POST["dayid"] == 0) {
        $day_id = null;
    } else {
        $day_id = $_POST["dayid"];
    }
    $cat_id = Database::add_category($name, $explanatory_text, null, $day_id);
    /* Step 2.  Add the clues */
    $clue_ids = array();
    $multiplier = $_POST["point_scheme"] == "second" ? 3 : 2;
    for ($i = 1; $i <= 5; $i++) {
        $clue_text = strip_tags($_POST["clue{$i}"], '<a><b><i><u><img><br>');
        $point_value = $multiplier * $i;
        $wrong_point_value = -$i;
        $clue_ids[$i] = Database::add_clue($clue_text, $cat_id, $point_value, $wrong_point_value);
    }
    /* Step 3.  Add the responses */
    for ($i = 1; $i <= 5; $i++) {
        if (is_null($_POST["response{$i}"])) {
            continue;
        }
        $raw_response = $_POST["response{$i}"];