public function executeAddInterest($request)
 {
     $user = $this->getUser()->getSubscriber();
     $jotag = TagPeer::getFromField(TagPeer::JOTAG, $request->getParameter('jotag'));
     $this->forward404Unless($jotag && $jotag->getUser()->getId() != $this->getUser()->getSubscriberId() && !$user->hasInterest($jotag) && !$jotag->getIsPrimary());
     $this->jotag = $jotag;
     $this->form = new AddInterestForm(array('jotag' => $jotag->getJotag()));
     if ($request->isMethod('post')) {
         $this->form->bind(array('confirm_jotag' => $request->getParameter('confirm_jotag'), 'jotag' => $request->getParameter('jotag')));
         if ($this->form->isValid()) {
             $user->addJotagInterest($jotag);
             // notify owner
             Mailer::sendEmail($jotag->getUser()->getPrimaryEmail(), 'interestNotifyOwner', array('user' => $user, 'jotag' => $jotag), $jotag->getUser()->getPreferedLanguage());
             $this->setMessage('ADD_INTEREST', 'SUCCESS', $jotag->getJotag());
             if (!$this->isWebserviceCall()) {
                 $this->redirect('@account');
             }
         }
     }
 }
Exemple #2
0
 /**
  * Send gift certificate va email
  *
  * @param int $coupon_id
  * @param array $data
  * @return bool
  */
 private function _sendCoupon($coupon_id, $data)
 {
     if (!empty($coupon_id)) {
         if (($coupon = $GLOBALS['db']->select('CubeCart_coupons', false, array('coupon_id' => (int) $coupon_id, 'email_sent' => 0))) !== false) {
             $mailer = new Mailer();
             if (isset($coupon[0]['value'])) {
                 $coupon[0]['value'] = Tax::getInstance()->priceFormat($coupon[0]['value']);
             }
             $data['storeURL'] = $GLOBALS['storeURL'];
             if (($content = $mailer->loadContent('cart.gift_certificate', $this->_order_summary['lang'], array_merge($this->_order_summary, $data, $coupon[0]))) !== false) {
                 $GLOBALS['db']->update('CubeCart_coupons', array('email_sent' => 1), array('coupon_id' => (int) $coupon_id));
                 return $mailer->sendEmail($data['email'], $content);
             }
         }
     }
     return false;
 }
$f_fin = date_create($fecha_fin);
$f_f_datetime = date_format($f_fin,"Y-m-d");
*/
$d_beca['f_inicio_b'] = $params['f_inicio_b'];
//$f_i_datetime;
$d_beca['f_final_b'] = $params['f_final_b'];
//$f_f_datetime;
$res_beca = $beca->save($d_beca);
//Traigo datos alumno y beca
$n_alumno = $alumno->getAlumnoById($alumno_id);
$n_beca = $beca->getBeca($res_beca);
//$datetime = new DateTime($n_beca['timestamp']);
//if($params['mail'] == $params['mail'])//if ok - send email
$mailer = new Mailer();
$params['md5'] = $md5;
$mailer->sendEmail($params);
?>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<title></title>
<script type="text/javascript" charset="utf8" src="./js/jquery-1.11.2.js"></script>

<script>
	$(document).ready(function() {
		
		$('#show').click(function(){
			$('#b_print_container').toggle();
			
		});
Exemple #4
0
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
// initialize instance
sfContext::createInstance($configuration);
// set default TIMEZONE
$tz = OptionPeer::retrieveOption('TIMEZONE');
if ($tz) {
    date_default_timezone_set($tz);
}
// load URL helper
sfLoader::loadHelpers('Url');
sfConfig::set('sf_relative_url_root', sfConfig::get('app_general_base_url'));
$c = new Criteria();
$expiration_age = OptionPeer::retrieveOption('BUY_DELETE_AFTER') * 24 * 3600;
$c->add(TagPeer::VALID_UNTIL, time() - $expiration_age, Criteria::LESS_EQUAL);
$c->add(TagPeer::STATUS, TagPeer::ST_EXPIRED);
$c->add(TagPeer::IS_PRIMARY, false);
$tags = TagPeer::doSelect($c);
if ($tags) {
    foreach ($tags as $tag) {
        $interesteds = $tag->getInteresteds();
        $jotag = $tag->getJotag();
        $tag->deleteFromUser();
        Mailer::sendEmail($tag->getUser()->getPrimaryEmail(), 'deletedJotag', array('jotag' => $tag, 'jotag_name' => $jotag), $tag->getUser()->getPreferedLanguage());
        if ($interesteds) {
            foreach ($interesteds as $interested) {
                // notify interested users that this jotag is available again
                Mailer::sendEmail($interested->getUser()->getPrimaryEmail(), 'interestNotifyInterested', array('user' => $interested->getUser(), 'jotag' => $interested->getJotag()), $interested->getUser()->getPreferedLanguage());
            }
        }
    }
}
Exemple #5
0
 /**
  * Products
  */
 private function _product()
 {
     if (($product = $GLOBALS['catalogue']->getProductData($_GET['product_id'])) === false) {
         return;
     }
     if ($GLOBALS['config']->get('config', 'enable_reviews') && isset($_POST['review']) && is_array($_POST['review'])) {
         $error = false;
         foreach ($GLOBALS['hooks']->load('class.cubecart.review') as $hook) {
             include $hook;
         }
         $record = array_map('htmlspecialchars', $_POST['review']);
         if ($GLOBALS['user']->is()) {
             $record['name'] = $GLOBALS['user']->get('first_name') . ' ' . $GLOBALS['user']->get('last_name');
             $record['email'] = $GLOBALS['user']->get('email');
             $record['customer_id'] = $GLOBALS['user']->get('customer_id');
             $record['anon'] = isset($record['anon']) ? 1 : 0;
         } else {
             $record['customer_id'] = 0;
             $record['email'] = $_POST['review']['email'];
             $record['anon'] = 0;
             if ($GLOBALS['config']->get('config', 'recaptcha') && !$GLOBALS['session']->isEmpty('error', 'recaptcha')) {
                 $GLOBALS['gui']->setError($GLOBALS['session']->get('error', 'recaptcha'));
                 $error = true;
             }
         }
         $record['rating'] = isset($_POST['rating']) ? $_POST['rating'] : 0;
         $record['product_id'] = (int) $_GET['product_id'];
         $record['ip_address'] = get_ip_address();
         $record['time'] = time();
         // Validate array
         $required = array('email', 'name', 'review', 'title');
         foreach ($required as $req) {
             if (!isset($record[$req]) || empty($record[$req])) {
                 $GLOBALS['gui']->setError($GLOBALS['language']->common['error_fields_required']);
                 $error = true;
                 break;
             }
         }
         if ($record['rating'] == 0) {
             $GLOBALS['gui']->setError($GLOBALS['language']->catalogue['error_rating_required']);
             $error = true;
         }
         if (!filter_var($record['email'], FILTER_VALIDATE_EMAIL)) {
             $GLOBALS['gui']->setError($GLOBALS['language']->common['error_email_invalid']);
             $error = true;
         }
         if (!$error) {
             if ($GLOBALS['db']->insert('CubeCart_reviews', $record) !== false) {
                 foreach ($GLOBALS['hooks']->load('class.cubecart.review.insert') as $hook) {
                     include $hook;
                 }
                 $GLOBALS['gui']->setNotify($GLOBALS['language']->catalogue['notify_review_submit']);
                 $mail = new Mailer();
                 $record['link'] = $GLOBALS['storeURL'] . '/' . $GLOBALS['config']->get('config', 'adminFile') . '?_g=products&node=reviews&edit=' . $GLOBALS['db']->insertid();
                 $record['product_name'] = $product['name'];
                 $content = $mail->loadContent('admin.review_added', $GLOBALS['language']->current(), $record);
                 if (!empty($content)) {
                     $mail->sendEmail($GLOBALS['config']->get('config', 'email_address'), $content);
                 }
             } else {
                 $GLOBALS['gui']->setError($GLOBALS['language']->catalogue['error_review_submit']);
             }
             httpredir(currentPage(null));
         } else {
             foreach ($_POST['review'] as $key => $value) {
                 $_POST['review'][$key] = htmlspecialchars($value);
             }
             $GLOBALS['smarty']->assign('WRITE', $_POST['review']);
         }
     }
     $this->_recaptcha();
     /* Social Bookmarks */
     $GLOBALS['smarty']->assign('SHARE', $this->_getSocial('product', 'getButtonHTML'));
     /* Social Comments */
     $GLOBALS['smarty']->assign('COMMENTS', $this->_getSocial('product', 'getCommunityHTML'));
     $GLOBALS['catalogue']->displayProduct((int) $_GET['product_id'], true);
 }
    $stmt = $con->prepareStatement($query);
    $stmt->setString(1, strftime("%Y-%m-%d 00:00:00"));
    $stmt->executeQuery();
    $con->commit();
} catch (Exception $e) {
    $con->rollback();
    throw $e;
}
$alert_days = explode(",", OptionPeer::retrieveOption('BUY_EXPIRE_ALERTS'));
$today = getdate();
foreach ($alert_days as $day) {
    // build range
    $start = strftime('%Y-%m-%d %H:%M:%S', mktime(0, 0, 0, $today['mon'], $today['mday'] + $day, $today['year']));
    $end = strftime('%Y-%m-%d %H:%M:%S', mktime(0, 0, 0, $today['mon'], $today['mday'] + $day + 1, $today['year']));
    // fetch jotags
    $c = new Criteria();
    $c->add(TagPeer::IS_PRIMARY, false);
    if ($day > 0) {
        $c->add(TagPeer::STATUS, TagPeer::ST_ACTIVE);
    } else {
        $c->add(TagPeer::STATUS, TagPeer::ST_EXPIRED);
    }
    $c->add(TagPeer::VALID_UNTIL, $start, Criteria::GREATER_EQUAL);
    $c->addAnd(TagPeer::VALID_UNTIL, $end, Criteria::LESS_THAN);
    $tags = TagPeer::doSelect($c);
    if ($tags) {
        foreach ($tags as $tag) {
            Mailer::sendEmail($tag->getUser()->getPrimaryEmail(), 'expireReminder', array('jotag' => $tag, 'days' => $day), $tag->getUser()->getPreferedLanguage());
        }
    }
}
Exemple #7
0
 /**
  * Request password
  *
  * @param string $email
  * @return bool
  */
 public function passwordRequest($email)
 {
     if (!empty($email) && filter_var($email, FILTER_VALIDATE_EMAIL)) {
         if (($check = $GLOBALS['db']->select('CubeCart_customer', false, array('email' => $email, 'type' => 1))) !== false) {
             // Generate validation key
             $validation = Password::getInstance()->createSalt();
             if ($GLOBALS['db']->update('CubeCart_customer', array('verify' => $validation), array('customer_id' => (int) $check[0]['customer_id'])) !== false) {
                 // Send email
                 if (($user = $GLOBALS['db']->select('CubeCart_customer', false, array('customer_id' => (int) $check[0]['customer_id']))) !== false) {
                     $mailer = new Mailer();
                     $link['reset_link'] = CC_STORE_URL . '/index.php?_a=recovery&validate=' . $validation;
                     $data = array_merge($user[0], $link);
                     $content = $mailer->loadContent('account.password_recovery', $GLOBALS['language']->current(), $data);
                     $mailer->sendEmail($user[0]['email'], $content);
                     return true;
                 }
             }
         }
     }
     return false;
 }
 /**
  * Handles reject request action
  *
  * @param sfWebRequest $request Web request object
  */
 public function executeRejectRequest($request)
 {
     $jotag = TagPeer::getFromField(TagPeer::JOTAG, $request->getParameter('jotag'));
     $this->jotag = $jotag;
     $this->forward404Unless($this->jotag && TagPeer::isValid($this->jotag) && $this->jotag->getUser()->getId() == $this->getUser()->getSubscriberId());
     // get user
     $user = UserPeer::retrieveByPK($request->getParameter('user'));
     $this->forward404Unless($user);
     // verify user
     $tauth = $jotag->getRequestByUser($user);
     $this->forward404Unless($tauth->getStatus() != TagAuthPeer::STATUS_NONE);
     if ($jotag->rejectRequestFromUser($user)) {
         // email user
         Mailer::sendEmail($user->getPrimaryEmail(), 'requestRejected', array('user' => $user, 'jotag' => $jotag));
     }
     $this->setMessage("AUTH_REJECTED", "SUCCESS");
     $this->redirect("@manage_auth_request?jotag=" . $this->jotag->getJotag());
 }
Exemple #9
0
 /**
  * Request password
  *
  * @param string $username
  * @param string $email
  * @return bool
  */
 public function passwordRequest($username, $email)
 {
     if (!empty($username) && !empty($email) && filter_var($email, FILTER_VALIDATE_EMAIL)) {
         if (($check = $GLOBALS['db']->select('CubeCart_admin_users', array('admin_id', 'email', 'language', 'name'), array('username' => $username, 'email' => $email, 'status' => '1'))) !== false) {
             // Generate validation key
             $validation = randomString($this->_validate_key_len);
             if ($GLOBALS['db']->update('CubeCart_admin_users', array('verify' => $validation), array('admin_id' => (int) $check[0]['admin_id']))) {
                 // Send email
                 $mailer = new Mailer();
                 $data['link'] = $GLOBALS['storeURL'] . '/' . $GLOBALS['config']->get('config', 'adminFile') . '?_g=recovery&email=' . $check[0]['email'] . '&validate=' . $validation;
                 $data['name'] = $check[0]['name'];
                 $content = $mailer->loadContent('admin.password_recovery', $check[0]['language'], $data);
                 if ($content) {
                     $GLOBALS['smarty']->assign('DATA', $data);
                     $GLOBALS['session']->set('recover_login', true);
                     return $mailer->sendEmail($check[0]['email'], $content);
                 }
             }
         }
     }
     return false;
 }
 public function executeIPN($request)
 {
     // rebuild post parameters to send back to paypal
     $req = "";
     foreach ($_POST as $var => $value) {
         $req .= "&{$var}=" . urlencode(stripslashes($value));
     }
     // get transaction info
     $paymentStatus = $request->getParameter('payment_status');
     $transNum = $request->getParameter('txn_id');
     $type = $request->getParameter('custom');
     $paymentId = $request->getParameter('invoice');
     $totalAmount = $request->getParameter('mc_gross');
     $test_ipn = $request->getParameter('test_ipn');
     if ($test_ipn && OptionPeer::retrieveOption('PAYPAL_MODE') == 'L') {
         die('fail');
     }
     // we are NOT in sandbox
     // send back to paypal
     $ch = @curl_init();
     @curl_setopt($ch, CURLOPT_POST, 1);
     @curl_setopt($ch, CURLOPT_URL, OptionPeer::retrieveOption('PAYPAL_MODE') != 'L' ? "https://www.sandbox.paypal.com/cgi-bin/webscr" : "https://www.paypal.com/cgi-bin/webscr");
     @curl_setopt($ch, CURLOPT_POSTFIELDS, "cmd=_notify-validate" . $req);
     @curl_setopt($ch, CURLOPT_TIMEOUT, 20);
     @curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     $result = @curl_exec($ch);
     @curl_close($ch);
     if ($result != "VERIFIED") {
         //can't verify the POST information, most likely fraudulent so exit.
         die('fail');
     }
     // locate payment
     $payment = PaymentPeer::getFromField(PaymentPeer::ID, $paymentId);
     if (!$payment || !in_array($payment->getStatus(), array(PaymentPeer::ST_NEW, PaymentPeer::ST_PENDING))) {
         // tried to process an already paid order, or a cancelled one.. if not paid, alert
         // staff
         if ($payment && $payment->getStatus() != PaymentPeer::ST_PAID) {
             Mailer::sendEmail(OptionPeer::retrieveOption('ADMIN_EMAIL'), 'paymentError', array('payment' => $payment, 'reason' => 'CANCELLED'));
         }
         die('fail');
     }
     // check if transNum is UNIQUE
     $c = new Criteria();
     $c->add(PaymentPeer::REFERENCE, $transNum);
     $c->add(PaymentPeer::METHOD, PaymentPeer::PT_PAYPAL);
     $p = PaymentPeer::doSelectOne($c);
     if ($p && $p->getId() != $payment->getId()) {
         die('fail');
     }
     // duplicated transaction
     $payment->setMethod(PaymentPeer::PT_PAYPAL);
     $payment->setReference($transNum);
     //    if($type == "RENEW") $payment->setType(PaymentPeer::PT_RENEW);
     //    else $payment->setType(PaymentPeer::PT_NEW);
     switch ($paymentStatus) {
         case "Completed":
             // check if value matches
             if ((double) $payment->getAmount() != (double) $totalAmount) {
                 $payment->setStatus(PaymentPeer::ST_ERROR_NOTIFY);
                 $payment->save();
             } else {
                 if (!$payment->getTag()) {
                     $jotag = new Tag();
                     $jotag->setJotag($payment->getJotag());
                     $jotag->setStatus(TagPeer::ST_NEW);
                     $jotag->setUser($payment->getUser());
                     $jotag->setIsPrimary(false);
                 } else {
                     $jotag = $payment->getTag();
                 }
                 // calculate new expiration date
                 $jotag->setValidUntil($jotag->calcNewDate($payment->getDuration()));
                 // try to save new jotag
                 try {
                     $jotag->setStatus(TagPeer::ST_ACTIVE);
                     $jotag->save();
                 } catch (PropelException $e) {
                     // failed to save  jotag, probably due to duplicated jotag (race condition)
                     // we must mark it as ERROR and contact user
                     $payment->setStatus(PaymentPeer::ST_ERROR_NOTIFY);
                     $jotag = null;
                 }
                 if ($jotag) {
                     // everything OK
                     $payment->setTag($jotag);
                     $payment->setJotag('');
                     $payment->setStatus(PaymentPeer::ST_PAID);
                     // remove from interest list
                     $payment->getUser()->delInterest($jotag->getJotag());
                 }
                 $payment->save();
             }
             // send emails
             if ($payment->getStatus() == PaymentPeer::ST_PAID) {
                 // payment processed, notify customer
                 Mailer::sendEmail($payment->getUser()->getPrimaryEmail(), 'paymentConfirmation', array('payment' => $payment), $payment->getUser()->getPreferedLanguage());
             } else {
                 // payment processed, but there was an error creating/updating JoTAG, notify merchant
                 $reason = (double) $payment->getAmount() != (double) $totalAmount ? 'AMMOUNT' : 'DBERROR';
                 Mailer::sendEmail(OptionPeer::retrieveOption('ADMIN_EMAIL'), 'paymentError', array('payment' => $payment, 'reason' => $reason));
             }
             break;
         case "Pending":
             $payment->setStatus(PaymentPeer::ST_PENDING);
             $payment->save();
             break;
         case "Failed":
             $payment->setStatus(PaymentPeer::ST_FAILED);
             $payment->save();
             break;
     }
     return sfView::HEADER_ONLY;
 }
    $c->addAnd(BookmarkPeer::USER_ID, null, Criteria::ISNOTNULL);
    if ($class == "Email") {
        $c->add(EmailPeer::IS_CONFIRMED, true);
    }
    $c->addJoin(eval("return {$class}Peer::ID;"), eval("return Tag{$class}Peer::" . strtoupper($class) . "_ID;"), Criteria::LEFT_JOIN);
    $c->addJoin(eval("return Tag{$class}Peer::TAG_ID;"), TagPeer::ID, Criteria::LEFT_JOIN);
    $c->addJoin(TagPeer::ID, BookmarkPeer::TAG_ID, Criteria::LEFT_JOIN);
    // add select columns
    $c->addSelectColumn(TagPeer::ID);
    $c->addSelectColumn(BookmarkPeer::USER_ID);
    $c->addSelectColumn(eval("return {$class}Peer::ID;"));
    // find changed objects
    $changed_objects[$class] = call_user_func(array("{$class}Peer", "doSelectRS"), $c);
}
// build a list of jotag->user->contact that will be notified
$changed_jotags = array();
foreach ($changed_objects as $class => $rs) {
    while ($rs->next()) {
        $changed_jotags[$rs->getInt(1)][$rs->getInt(2)][$class][] = call_user_func(array("{$class}Peer", "retrieveByPK"), $rs->getInt(3));
    }
}
//print_r($changed_jotags);exit;
// nofity each user
foreach ($changed_jotags as $jotagID => $data) {
    $jotag = TagPeer::retrieveByPK($jotagID);
    $vcard = new Swift_Message_Attachment($jotag->getVCard()->fetch(), $jotag->getTagProfile()->__toString() . '.vcf', "text/plain");
    foreach ($data as $userID => $contacts) {
        $user = UserPeer::retrieveByPK($userID);
        Mailer::sendEmail($user->getPrimaryEmail(), 'changedJotag', array('jotag' => $jotag, 'user' => $user, 'contacts' => $contacts), $user->getPreferedLanguage(), $vcard);
    }
}