function request_restore_password(){

	require_once('conf/location.php');

	global $LANG;
	global $CONF;

	$db = clone $GLOBALS['maindb'];

	if (!isset($_GET['user_request_restore_password']))
		return array("ok"=>false, error=>"no email");

	$user = new RegUser();
	$user->setEmail($_GET['user_request_restore_password']); $user->load();
	$user_id=$user->getId();
	if (empty($user_id))
		return array("ok"=>false, "error"=>"no email");

	$check=hash('sha512',$user->getEmail().$user->getEncPassword()."Θ");

	eval($LANG['requestrestoreemail_body']);
	//	system("echo \"".$body."\" > email.html");

		/*$headers  = "MIME-Version: 1.0\r\n";
		$headers .= "Content-type: text/html; charset=UTF-8\r\n";

		$headers .= "From: {$CONF['email_from']}\r\n";
		$headers .= "To: {$user->getNickname()} <{$user->getEmail()}>\r\n";
		*/
		
	//print_r($body);
	require_once('class/Mail.php');
	$a=new Mail();
	$a->setEmailTo($user->getEmail());
	$a->setNicknameTo($user->getNickname());
	$a->setSubject("Pedido de recuperação de senha");
	$a->setSubjectMsg("");
	$a->setMsg($body);
 	if ($a->send())
		return array("ok"=>true,"error"=>"");
	else
		return array("ok"=>false,"error"=>"could not send email");

}
Esempio n. 2
0
	public function sendEmail(){
		global $CONF;
		global $LANG;
		$check=substr(hash('sha512',"`\Θℑ ♣  check".$this->getId()),0,8);

		$body='';
		eval($LANG['useremail_body']);
		//system("echo \"".$body."\" > email.html");

		require_once('class/Mail.php');
		$a=new Mail();
		$a->setEmailTo($this->email);
		$a->setNicknameTo($this->nickname);
		$a->setSubject("Confirmação de e-mail");
		$a->setSubjectMsg("");
		$a->setMsg($body);
		return $a->send();
 		//return mail($this->email, "Rapidcoffee", $body, $headers);
	}
Esempio n. 3
0
	function send(){

		require_once('class/Mail.php');
		$a=new Mail();

		//SOMENTE TESTE!!! DEPOIS TROCAR A LINHA DE BAIXO PELO COMENTARIO ABAIXO!!!
		//$a->setEmailTo("*****@*****.**");
		$a->setEmailTo($this->to_email);
		$a->setNicknameTo($this->to_nickname);
		$tmpsubject="Notificação de tópicos";
		if (!empty($this->addsubject)) $tmpsubject.=" - ".$this->addsubject;
		$a->setSubject($tmpsubject);
		$a->setSubjectMsg("Existem atualiza&ccedil;&otilde;es de t&oacute;picos para voc&ecirc;.");
		$a->setMsg($this->body);
		$a->send();

		/*echo $this->topic_ids;
		echo "Para: {$this->to_nickname} {$this->to_email}<br/>";
		echo $this->body;
		echo "*********************";*/

	}
Esempio n. 4
0
		eval($LANG['restoreemail_body']);
		//system("echo \"".$body."\" > email.html");

		/*$headers  = "MIME-Version: 1.0\r\n";
		$headers .= "Content-type: text/html; charset=UTF-8\r\n";

		$headers .= "From: {$CONF['email_from']}\r\n";
		$headers .= "To: {$user->getNickname()} <{$user->getEmail()}>\r\n";
		*/
		
		require_once('class/Mail.php');
		$a=new Mail();
		$a->setEmailTo($user->getEmail());
		$a->setNicknameTo($user->getNickname());
		$a->setSubject("Nova senha");
		$a->setSubjectMsg("");
		$a->setMsg($body);
	 	if ($a->send()){
			$user->save();
			$msg=$LANG['restoreemail_message_ok'];
			$msgclass="info";
		} else {
			$msg=$LANG['error'];
			$msgclass="error";
		}
	} else {
		$msg=$LANG['error_intrusion'];
		$msgclass="error";
	}
	$header='Location: '.$CONF['url_path'].'home.php?msg='.urlencode($msg).'&msgclass='.urlencode($msgclass);
	header( $header ) ;
Esempio n. 5
0
	public function save(){		//Salva o objeto no BD (se ja foi salvo faz update)
		$this->_new=false;
		$db = clone $GLOBALS['maindb'];

		if (empty($this->subject))
			return 'error null subject';
		
		if (empty($this->msg))
			return 'error null message';

		$isanon=$this->getUserTo()->isAnon();
		if ($isanon)
			return 'error you cannot send messages to an anonymous user';

		if (empty($this->user_from) || $this->user_from==null){
			$_from_userid='null';
			$_from_anon='null';
		} else {
			$_from_userid=$this->user_from->getId();
			$_from_anon= ($this->user_from->isAnon())?'true':'false';
		}

		if (!isset($this->id) || ($this->id==null)){	//Insert
			$db->query("SELECT nextval('message_id_seq') as id;");
			$_gotid_req = $db->fetch();
			$_gotid = $_gotid_req['id'];

			$db->query("INSERT INTO message(id,subject,msg,user_to_id,user_from_id, user_from_anon) VALUES('{$_gotid}','{$this->getSubject()}','{$this->getMsg()}', '{$this->getUserTo()->getId()}', {$_from_userid}, {$_from_anon});");
			$row = $db->fetch();
			$this->id = $_gotid;
		} else {					//Update
			$db->query("UPDATE message set msg='{$this->getMsg()}', user_to_id='{$this->getUserTo()->getId()}',user_from_id={$_from_userid}, user_from_anon={$_from_anon}  WHERE id='{$this->id}';");
			$row = $db->fetch();
		}

		
		$this->setId($this->getId()); $this->load();

		require_once('class/Mail.php');
		$a=new Mail();
		$a->setEmailTo($this->getUserTo()->getEmail());
		$a->setNicknameTo($this->getUserTo()->getNickname());
		$a->setSubject($this->getSubject());
		$a->setSubjectMsg("");
		$a->setMsg($this->getMsg());
		$a->send();

		//mail($this->getUserTo()->getEmail(), '[RapidCoffee] '.$this->getSubject(), $this->getMsg(), $headers);

		$this->_flush=true;
		return "ok";
	}