Esempio n. 1
0
 public function successPaymentAction(Request $request)
 {
     $gbl_email_support = $this->container->getParameter('gbl_email_support');
     $raw_post_data = file_get_contents('php://input');
     $raw_post_array = explode('&', $raw_post_data);
     $myPost = array();
     foreach ($raw_post_array as $keyval) {
         $keyval = explode('=', $keyval);
         if (count($keyval) == 2) {
             $myPost[$keyval[0]] = urldecode($keyval[1]);
         }
     }
     // read the post from PayPal system and add 'cmd'
     $req = 'cmd=_notify-validate';
     if (function_exists('get_magic_quotes_gpc')) {
         $get_magic_quotes_exists = true;
     }
     foreach ($myPost as $key => $value) {
         if ($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {
             $value = urlencode(stripslashes($value));
         } else {
             $value = urlencode($value);
         }
         $req .= "&{$key}={$value}";
     }
     // STEP 2: Post IPN data back to paypal to validate
     $ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr');
     curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
     curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));
     if (!($res = curl_exec($ch))) {
         // error_log("Got " . curl_error($ch) . " when processing IPN data");
         curl_close($ch);
         exit;
     }
     curl_close($ch);
     // STEP 3: Inspect IPN validation result and act accordingly
     if (strcmp($res, "VERIFIED") == 0) {
         $session = $this->getRequest()->getSession();
         $firstname = $session->get('firstname');
         $lastname = $session->get('lastname');
         $email = $session->get('email');
         $password = $session->get('password');
         $phone = $session->get('phone');
         $state = $session->get('state');
         $address = $session->get('address');
         $address2 = $session->get('address2');
         $city = $session->get('city');
         $fax = $session->get('fax');
         $business = $session->get('business');
         $overview = $session->get('overview');
         $twitter = $session->get('twitter');
         $google = $session->get('google');
         $linkedin = $session->get('linkedin');
         $video = $session->get('video');
         $id = $session->get('id');
         $planid = $session->get('planid');
         $logo = $session->get('logo');
         $file = $session->get('file');
         $facebook = $session->get('facebook');
         $pincode = $session->get('pincode');
         $country = 'US';
         // set country USA
         $type = 2;
         $status = 1;
         $realtor = new User();
         $realtor->setFirstName($firstname);
         $realtor->setLastName($lastname);
         $realtor->setPassword(md5($password));
         $realtor->setEmail($email);
         $realtor->setPhone($phone);
         $realtor->setState($state);
         $realtor->setAddress($address);
         $realtor->setAddress2($address2);
         $realtor->setCity($city);
         $realtor->setCountry($country);
         $realtor->setType($type);
         $realtor->setStatus($status);
         $realtor->setPinCode($pincode);
         $realtor->setFax($fax);
         $realtor->setBusinessName($business);
         $realtor->setOverview($overview);
         $realtor->setPlanId($planid);
         if (isset($logo) && $logo != "") {
             $realtor->setLogo($logo);
         } else {
             $realtor->setLogo('company.jpeg');
         }
         $realtor->setTwitter($twitter);
         $realtor->setFacebook($facebook);
         $realtor->setGoogle($google);
         $realtor->setLinkedin($linkedin);
         $realtor->setVideo($video);
         if (isset($file) && $file != "") {
             $realtor->setImage($file);
         } else {
             $realtor->setImage('default_user_image.jpeg');
         }
         $em = $this->getDoctrine()->getEntityManager();
         $em->persist($realtor);
         $em->flush();
         $reviewerId = $realtor->getId();
         $website_url = $this->container->getParameter('website_url');
         //get website url
         $confirmationLink = $website_url . "/confirmed/registration/" . $reviewerId;
         //registration link
         $message = \Swift_Message::newInstance()->setSubject('Registration')->setFrom($gbl_email_support)->setTo($email)->setBody($this->renderView('RARWebBundle:Email:registration.txt.twig', array('firstname' => $firstname, 'lastname' => $lastname, 'Password' => $password, 'email' => $email, 'confirm')));
         $this->get('mailer')->send($message);
         mail($to, $subject, $txt, $headers);
         //send mail
         $realtorId = $realtor->getId();
         $item_name = $_POST['item_name'];
         $item_number = $_POST['item_number'];
         $payment_status = $_POST['payment_status'];
         $payment_amount = $_POST['mc_gross'];
         $payment_currency = $_POST['mc_currency'];
         $txn_id = $_POST['txn_id'];
         $receiver_email = $_POST['receiver_email'];
         $payer_email = $_POST['payer_email'];
         $address = $_POST['address_street'];
         $zipcode = $_POST['address_zip'];
         $state = $_POST['address_state'];
         $city = $_POST['address_city'];
         $country = $_POST['address_country'];
         $datefields = $_POST["payment_date"];
         $time = $datefields[0];
         if ($item_name == 'Half-Yearly') {
             $recuringPeriod = 2;
         } elseif ($item_name == 'Yearly') {
             $recuringPeriod = 3;
         } elseif ($item_name == 'Monthly') {
             $recuringPeriod = 1;
         }
         $payment = new Payment();
         $payment->setAmount($payment_amount);
         $payment->setTransactionId($txn_id);
         $payment->setPlanId($planid);
         $payment->setUserId($realtorId);
         $payment->setRecuringPeriod($recuringPeriod);
         //$payment->setCreationTimeStamp($datefields);
         $em->persist($payment);
         $em->flush();
         $message = \Swift_Message::newInstance()->setSubject('Payment')->setFrom($gbl_email_support)->setTo($email)->setBody($this->renderView('RARWebBundle:Email:payment.txt.twig', array('firstname' => $firstname, 'lastname' => $lastname, 'amount' => $payment_amount, 'transactionId' => $txn_id, 'email' => $email, 'datefields' => $datefields)));
         $this->get('mailer')->send($message);
         /*$date=date("Y/m/d.");
         		$headers = "MIME-Version: 1.0" . "\r\n";
         		$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
         		$headers .= 'From: <*****@*****.**>' . "\r\n";
         		$to = $payer_email;
         		$subject = "Payment detail/reviewarealtor.com";
         		$txt='Hello '. $firstname.' '. $lastname.',<br><br>You have selected the premium plan on reviewarealtor.com on  '.$datefields.'<br><br>Your transaction Details are as under: <br>Amount: <b>'.'$'.$payment_amount.'</b><br>TransactionId: <b>'.	$txn_id.'</b>';
         		mail($to,$subject,$txt,$headers); //send mail*/
     }
     return $this->render('RARWebBundle:Page:registerus.html.twig');
 }
Esempio n. 2
0
 public function importRealtorsAction(Request $request)
 {
     $session = $this->getRequest()->getSession();
     $loggedInUserId = $session->get('userId');
     $currentTimestamp = new DateTime();
     if ($request->getMethod() == 'POST') {
         //echo $_FILES['file']['type'];die();
         /*if (!($_FILES['file']['type'] == "text/comma-separated-values") && !($_FILES['file']['type'] == "application/vnd.ms-excel"))
         		{
         		$error ='Wrong file selected';
         		return $this->render('RARAdminBundle:Realtor:importRealtors.html.twig',array('error'=>$error)); 
         		}*/
         //else
         //	{
         if (is_uploaded_file($_FILES['file']['tmp_name'])) {
             //readfile($_FILES['file']['tmp_name']);
         }
         $handle = fopen($_FILES['file']['tmp_name'], "r");
         while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
             $firstName = $data[0];
             $lastName = $data[1];
             $email = $data[2];
             $password = $data[3];
             $phone = $data[4];
             $address = $data[5];
             $address2 = $data[6];
             $city = $data[7];
             $state = $data[8];
             $country = $data[9];
             $pincode = $data[10];
             $fax = $data[11];
             $business = $data[12];
             $overview = $data[13];
             $twitter = $data[14];
             $google = $data[15];
             $linkedin = $data[16];
             $video = $data[17];
             $facebook = $data[18];
             $realtor = new User();
             $realtor->setFirstName($firstName);
             $realtor->setLastName($lastName);
             $realtor->setEmail($email);
             $realtor->setPassword(md5($password));
             $realtor->setPhone($phone);
             $realtor->setAddress($address);
             $realtor->setAddress2($address2);
             $realtor->setCity($city);
             $realtor->setState($state);
             $realtor->setCountry($country);
             $realtor->setPinCode($pincode);
             $realtor->setFax($fax);
             $realtor->setBusinessName($business);
             $realtor->setOverview($overview);
             $realtor->setTwitter($twitter);
             $realtor->setGoogle($google);
             $realtor->setLinkedin($linkedin);
             $realtor->setFacebook($facebook);
             $realtor->setVideo($video);
             $realtor->setType(2);
             $realtor->setPlanId(1);
             $realtor->setStatus(1);
             $realtor->setCreatorId($loggedInUserId);
             $realtor->setModifierId($loggedInUserId);
             $realtor->setCreationTimestamp($currentTimestamp);
             $realtor->setModificationTimestamp($currentTimestamp);
             $em = $this->getDoctrine()->getEntityManager();
             $em->persist($realtor);
             $em->flush();
         }
         fclose($handle);
         //print "Import done";
         //}
     }
     return $this->render('RARAdminBundle:Realtor:importRealtors.html.twig');
 }
Esempio n. 3
0
 public function addrealtorAction(Request $request)
 {
     $plans = $this->getPlanAction();
     // get all states
     $states = $this->getStatesAction();
     if ($request->getMethod() == 'POST') {
         $file = $_FILES['file']['name'];
         $file1 = $_FILES['file']['tmp_name'];
         move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]);
         $logo = $_FILES['logo']['tmp_name'];
         move_uploaded_file($_FILES["logo"]["tmp_name"], "logo/" . $_FILES["logo"]["name"]);
         $firstname = $this->get('request')->request->get('firstname');
         $lastname = $this->get('request')->request->get('lastname');
         $password = $this->get('request')->request->get('password');
         $email = $this->get('request')->request->get('email');
         $phone = $this->get('request')->request->get('phone');
         $state = $this->get('request')->request->get('state');
         $address = $this->get('request')->request->get('address');
         $address2 = $this->get('request')->request->get('address2');
         $city = $this->get('request')->request->get('city');
         $id = $this->get('request')->request->get('id');
         $plan = $this->get('request')->request->get('plan');
         $planName = $this->get('request')->request->get('planName');
         $business = $this->get('request')->request->get('business');
         $overview = $this->get('request')->request->get('overview');
         $fax = $this->get('request')->request->get('fax');
         $twitter = $this->get('request')->request->get('twitter');
         $facebook = $this->get('request')->request->get('facebook');
         $google = $this->get('request')->request->get('google');
         $linkedin = $this->get('request')->request->get('linkedin');
         $video = $this->get('request')->request->get('video');
         //echo "<pre>";print_r($plan);die();
         $country = 'US';
         // set country USA
         $type = 2;
         $status = 1;
         $pincode = $this->get('request')->request->get('pincode');
         $realtor = new User();
         $realtor->setFirstName($firstname);
         $realtor->setLastName($lastname);
         $realtor->setPassword(md5($password));
         $realtor->setEmail($email);
         $realtor->setPhone($phone);
         $realtor->setState($state);
         $realtor->setAddress($address);
         $realtor->setAddress2($address2);
         $realtor->setCity($city);
         $realtor->setCountry($country);
         $realtor->setType($type);
         $realtor->setStatus($status);
         $realtor->setPinCode($pincode);
         $realtor->setImage($file);
         $realtor->setLogo($logo);
         $realtor->setOverview($overview);
         $realtor->setFax($fax);
         $realtor->setTwitter($twitter);
         $realtor->setFacebook($facebook);
         $realtor->setGoogle($google);
         $realtor->setLinkedin($linkedin);
         $realtor->setVideo($video);
         $realtor->setBusinessName($business);
         if ($plan == 1) {
             $realtor->setSubscriptionTypeId('NULL');
         } else {
             $realtor->setSubscriptionTypeId($plan);
         }
         $realtor->setPlanId($planName);
         $em = $this->getDoctrine()->getEntityManager();
         $em->persist($realtor);
         $em->flush();
         $date = date("Y/m/d.");
         $headers = "MIME-Version: 1.0" . "\r\n";
         $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
         $headers .= 'From: <*****@*****.**>' . "\r\n";
         $to = $email;
         $subject = "New Account Information";
         $txt = 'Hello ' . $firstname . ' ' . $lastname . ',<br><br>Your account has been created with review-a-realtor.com on ' . $date . '<br><br>Your Account Details are as under: <br>Email Id: <b>' . $email . '</b><br>Password: <b>' . $password . '</b>';
         mail($to, $subject, $txt, $headers);
         //send mail
         return $this->redirect($this->generateUrl('RARAdminBundle_realtor', array('states' => $states, 'plans' => $plans)));
     }
     return $this->render('RARAdminBundle:Realtor:addRealtor.html.twig', array('states' => $states, 'plans' => $plans));
 }