예제 #1
0
        if (is_numeric($_GET['topicID'])) {
            if (EventDatabaseManager::deleteTopic($_GET['topicID'])) {
                echo "TOPIC_DELETED_MESSAGE";
            } else {
                echo "TOPIC_NOT_DELETED_MESSAGE";
            }
        }
    } else {
        $topicParams = array();
        foreach ($_POST as $key => $value) {
            if (array_search($key, EventDatabaseManager::$topicParams)) {
                $topicParams[$key] = mysql_real_escape_string($value);
            }
        }
        if (isset($_GET['topicID']) && is_numeric($_GET['topicID'])) {
            if (EventDatabaseManager::updateTopic($_GET['topicID'], $topicParams)) {
                echo TOPIC_UPDATED_MESSAGE;
            }
        } else {
            if (EventDatabaseManager::addTopic($topicParams)) {
                echo TOPIC_ADDED_MESSAGE;
            } else {
                echo TOPIC_NOT_ADDED_MESSAGE;
            }
        }
    }
}
/*
 * Add, edit or delete topic
 */
if (isset($_POST['locationName'])) {