<?
class module extends controller {

    var $params = array("act");


    function run() {
        switch($this->act) {
            case "feedback":
                if(isset($_REQUEST["text"])) {
                    $text = getSafeStr($_REQUEST["text"]);
                    $email = getSafeStr($_REQUEST["email"]);
		            $result = array();

                    //insert data in DB
                    $sql = "
                        INSERT INTO 
                            "._DB_TABLE_PREFIX."feedback 
                            (addtime, email, message) 
                        VALUES 
                            (".time().", '".addslashes($email)."', '".addslashes(urldecode($text))."')";

        	        $this->db->query($sql);
                    $result["status"] = "feedback_saved";

                } else {
                    $result["status"] = "empty_text";
                }
                return $result;
                break;

        }
    }

}
?>