<?
class module extends controller {

    var $params = array("act");


    function run() {
        switch($this->act) {
            case "send_to_friend":
                if (!isset($_REQUEST["email"])) {
                    $result["status"] = "empty_email";
                    return $result;
                }
                if (!isset($_REQUEST["femail"])) {
                    $result["status"] = "empty_friend_email";
                    return $result;
                }

                $email  = getSafeStr($_REQUEST["email"]);
                $femail = getSafeStr($_REQUEST["femail"]);
                if (isset($_REQUEST["name"])) $name = getSafeStr($_REQUEST["name"]);
                if (isset($_REQUEST["msg"]))  $msg = getSafeStr($_REQUEST["msg"]);

		        $subject = "Reccomendation";

                $result = array();

                if(mail($femail, $subject, $msg, "From: \"".$name."\" <".$email.">")) {
                    $result["status"] = "ok";
                } else {
                    $result["status"] = "failed";
                }

                return $result;
                break;

        }
    }
}
?>