Exemple #1
0
 public function leadersSentEmail($post)
 {
     $le = q_custom("SELECT * FROM groupleaders " . "INNER JOIN users ON lea_user_id=id " . "JOIN tours ON lea_tour_id=tou_id " . "AND lea_id=" . $post['glid']);
     if ($post['emailto'] === 'all') {
         $pa = q_custom("SELECT * FROM enroll_full " . "INNER JOIN users ON enf_user_id=id " . "AND enf_status='C' AND enf_tour_id=" . $le[0]['lea_tour_id']);
         foreach ($pa as $p) {
             $message = '<strong>' . $le[0]['firstname'] . ' ' . $le[0]['lastname'] . ', group leader of ' . $le[0]['tou_title'] . ' sent you the message:</strong>';
             $message .= '<article><em>' . $post['text'] . '</em></article>';
             mailing($p['email'], $post['emailfrom'], 'Message from groupleader', $message);
         }
     } else {
         $message = '<strong>' . $le[0]['firstname'] . ' ' . $le[0]['lastname'] . ', group leader of ' . $le[0]['tou_title'] . ' sent you the message:</strong>';
         $message .= '<article><em>' . $post['text'] . '</em></article>';
         mailing($post['emailto'], $post['emailfrom'], 'Message from groupleader', $message);
     }
 }
                $mailbody = nl2br($mailbody);
                @mailing($to, $name, $from, $subj, $mailbody);
            }
        }
        if ($_REQUEST['recipients']) {
            $emails = explode(",", $_REQUEST['recipients']);
            for ($i = 0; $i < count($emails); $i++) {
                $to = $emails[$i];
                $name = $_SESSION[USERNAME];
                $from = $_SESSION[EMAIL];
                STemplate::assign('message', $_REQUEST[message]);
                $mailbody = STemplate::fetch($email_path);
                $mailbody = nl2br($mailbody);
                $subj = str_replace('$sender_name', $sender_name, $subj);
                $subj = str_replace('$gname', $gname, $subj);
                @mailing($to, $name, $from, $subj, $mailbody);
            }
        }
        header("Location: invite_members.php?urlkey={$_REQUEST['urlkey']}&gid={$_REQUEST['gid']}&msg=Your invite sent successfully");
    }
}
$sql = "select fname from signup where UID='{$_SESSION['UID']}'";
$rs = $conn->execute($sql);
$first_name = $rs->fields['fname'];
STemplate::assign('first_name', $first_name);
$sql = "select friends_name, FID from friends where UID={$_SESSION['UID']} and friends_status='Confirmed'";
$rs = $conn->execute($sql);
while (!$rs->EOF) {
    $my_friends[] = $rs->fields['friends_name'];
    $fname .= "<option value=" . $rs->fields['friends_name'] . ">" . $rs->fields['friends_name'] . "</option>\n";
    $rs->movenext();
 /**
  * Contact form
  *
  * @Route("/{id}/contact", name="post_contact")
  * @Template()
  */
 public function contactAction($id)
 {
     $em = $this->getDoctrine()->getEntityManager();
     $entity = $em->getRepository('ApplicationAnunciosBundle:Post')->find($id);
     if (!$entity) {
         throw $this->createNotFoundException('Unable to find User entity.');
     }
     $form = $this->createForm(new ContactType());
     $result = 'no';
     $request = $this->getRequest();
     if ($request->getMethod() == 'POST') {
         $form->bindRequest($request);
         if ($form->isValid()) {
             $values = $form->getData();
             $toEmail = $entity->getEmail();
             extract($values);
             if (filter_var($email, FILTER_VALIDATE_EMAIL) && !strstr($body, '<a href=')) {
                 $user_id = $this->getRequest()->getSession()->get('id');
                 $url = $this->generateUrl('post_replies', array('id' => $entity->getId()), true);
                 $subject = 'Nuevo candidato oferta en betabeers';
                 $mensaje = $name . ' se ha interesado por la oferta <a href="' . $url . '">Ver mensaje</a>';
                 require __DIR__ . '/../../../../app/config/mailjet.php';
                 $result = mailing($toEmail, $subject, $mensaje);
                 // contabilizar contacto
                 $entity->setInterested($entity->getInterested() + 1);
                 $em->persist($entity);
                 // add reply
                 $reply = new PostReply();
                 $reply->setPostId($id);
                 $reply->setUserId($user_id);
                 $reply->setBody($body);
                 $reply->setName($name);
                 $reply->setEmail($email);
                 $reply->setDate(new \DateTime("now"));
                 $reply->setLinkedin($linkedin);
                 $em->persist($reply);
                 $em->flush();
             } else {
                 return new Response("SPAM!");
             }
         }
     }
     return array('form' => $form->createView(), 'entity' => $entity, 'result' => $result);
 }
    } else {
        $email = $_REQUEST['email'];
        $sql = "select UID, username, pwd, fname, lname from signup where email='{$email}'";
        $rs = $conn->execute($sql);
        if ($rs->fields['UID'] == "") {
            $err = "Sorry, we have no record for this email address.";
        } else {
            STemplate::assign('receiver_name', $rs->fields['username']);
            STemplate::assign('receiver_fname', $rs->fields['fname']);
            STemplate::assign('receiver_lname', $rs->fields['lname']);
            STemplate::assign('password', $rs->fields['pwd']);
            $rs = $conn->execute("select * from emailinfo where email_id='recover_password'");
            $subj = $rs->fields['email_subject'];
            $email_path = $rs->fields['email_path'];
            $body = STemplate::fetch($email_path);
            @mailing($_REQUEST['email'], $config['site_name'], $config['admin_email'], $subj, $body);
            $msg = "An email is sent to your email address. Plese check it now.";
            header("Location: recoverpass.php?msg={$msg}");
        }
    }
}
if ($_REQUEST[msg] != "") {
    $msg = $_REQUEST[msg];
}
STemplate::assign('err', $err);
STemplate::assign('msg', $msg);
STemplate::assign('head_bottom', "homelinks.tpl");
STemplate::display('head1.tpl');
STemplate::display('err_msg.tpl');
STemplate::display('recoverpass.tpl');
STemplate::display('footer.tpl');
$cid = mosGetParam($_REQUEST, 'cid', array());
if (!is_array($cid)) {
    $cid = array(0);
}
if (!function_exists('sefRelToAbs')) {
    @(include_once $GLOBALS['mosConfig_absolute_path'] . '/includes/sef.php');
}
switch ($action) {
    case 'list':
        lists($action, $task, $listId, $listType);
        break;
    case 'subscribers':
        subscribers($action, $task, $userid, $listId, $cid);
        break;
    case 'mailing':
        mailing($action, $task, $listId, $listType, $mailingId, $message);
        break;
    case 'statistics':
        statistics($listId, $listType, $mailingId, $message, $task, $action);
        break;
    case 'configuration':
        if ($GLOBALS[ACA . 'integration'] == '0' or $GLOBALS[ACA . 'cb_integration'] == '0') {
            $xf = new xonfig();
            if (acajoom::checkCB()) {
                $xf->loadConfig();
            }
        }
        configuration($action, $task);
        break;
    case 'update':
        update($action, $task);
 /**
  * Event emails list
  *
  * @Route("/emails", name="event_emails")
  * @Template("ApplicationEventBundle:Event:emails.html.twig")
  */
 public function emailsAction()
 {
     $session = $this->getRequest()->getSession();
     $can_edit = ($session->get('admin') or $session->get('moderator'));
     if (!$can_edit) {
         return $this->redirect('/');
     }
     $request = $this->getRequest();
     $request = $this->getRequest();
     if ($request->getMethod() != 'POST') {
         $search = $request->query->get('q');
         $entities = false;
         if ($search) {
             $em = $this->getDoctrine()->getEntityManager();
             $qb = $em->createQueryBuilder();
             $qb->add('select', 'DISTINCT u.email')->add('from', 'ApplicationEventBundle:Event e, ApplicationEventBundle:EventUser eu, ApplicationUserBundle:User u')->andWhere('e.id = eu.event_id')->andWhere('u.id = eu.user_id')->add('orderBy', 'eu.date ASC');
             // es un id?
             if (strstr($search, ',')) {
                 $qb->andWhere('e.id IN (' . $search . ')');
             } else {
                 if (is_numeric($search)) {
                     $qb->andWhere('e.id = :id')->setParameter('id', $search);
                     // es un hashtag?
                 } else {
                     $qb->andWhere('e.hashtag = :hashtag')->setParameter('hashtag', str_replace('#', '', $search));
                 }
             }
             $entities = $qb->getQuery()->getResult();
         }
         return array('search' => $search, 'entities' => $entities);
     } else {
         $subject = $request->request->get('subject');
         $mensaje = $request->request->get('template');
         $toEmail = explode("\n", trim($request->request->get('emails')));
         if ($subject && $mensaje && $toEmail) {
             require __DIR__ . '/../../../../app/config/mailjet.php';
             $result = mailing($toEmail, $subject, $mensaje);
             return array('sent' => true);
         } else {
             return $this->redirect($this->generateUrl('event_emails'));
         }
     }
 }
        $conn->execute($sql);
        if (mysql_affected_rows() == 1) {
            if ($_REQUEST[prevemail] != "{$_REQUEST['email']}") {
                $ran = time() . rand(1, 99999999);
                $sql = "update verify as v, signup as s set\n                        v.vcode='{$ran}',\n                        s.emailverified='no' WHERE v.UID=s.UID and v.UID={$_SESSION['UID']}";
                $conn->execute($sql);
                STemplate::assign('vcode', $ran);
                $to = $_REQUEST[email];
                $_SESSION[EMAIL] = $_REQUEST[email];
                $name = $config['site_name'];
                $from = $config['admin_email'];
                $rs = $conn->execute("select * from emailinfo where email_id='verify_email'");
                $subj = $rs->fields['email_subject'];
                $email_path = $rs->fields['email_path'];
                $mailbody = STemplate::fetch($email_path);
                mailing($to, $name, $from, $subj, $mailbody, $bcc = "");
                session_to_db();
            }
        }
    }
}
$sql = "select * from signup WHERE UID={$_SESSION['UID']}";
$rs = $conn->execute($sql);
$date = explode("-", $rs->fields[bdate]);
STemplate::assign('err', $err);
STemplate::assign('msg', $msg);
STemplate::assign('days', days($date[2]));
STemplate::assign('months', months($date[1]));
STemplate::assign('years', years($date[0]));
STemplate::assign('country', country_box($_REQUEST[country]));
STemplate::assign('answers', $rs->getarray());
        STemplate::assign('message', $_REQUEST[message]);
        STemplate::assign('freqkey', base64_encode($_SESSION[UID]));
        for ($i = 0; $i < count($emails); $i++) {
            $sql = "insert into friends set UID={$_SESSION['UID']}, friends_name='" . $emails[$i] . "', friends_type='All|" . $rtype[$i] . "', invite_date='" . date("Y-m-d") . "'";
            $conn->execute($sql);
            if (mysql_affected_rows() == 1) {
                $id = mysql_insert_id();
            } else {
                $sql = "select id from friends WHERE UID={$_SESSION['UID']} and friends_name='" . $emails[$i] . "'";
                $rs = $conn->execute($sql);
                $id = $rs->fields['id'];
            }
            STemplate::assign('id', base64_encode($id));
            STemplate::assign('receiver_name', $fnames[$i]);
            $mailbody = STemplate::fetch('emails/invite_email.tpl');
            $mailbody = nl2br($mailbody);
            mailing($emails[$i], $name, $from, $subj, $mailbody);
        }
    }
    $msg = "Invitation sent successfully";
}
$sql = "select fname from signup where UID='{$_SESSION['UID']}'";
$rs = $conn->execute($sql);
$first_name = $rs->fields['fname'];
STemplate::assign('first_name', $first_name);
STemplate::assign(err, $err);
STemplate::assign('msg', $msg);
STemplate::display('head1.tpl');
STemplate::display('err_msg.tpl');
STemplate::display('invite_signup.tpl');
STemplate::display('footer.tpl');
Exemple #9
0
    } else {
        // если файл не загрузили, выбирается стандартный
        $imagePath = 'uploads/default.jpg';
    }
    $confirmCode = generateRandomString(40);
    // генерация кода активации, посылается на почту
    $passwordHashed = password_hash($fields['password'], PASSWORD_DEFAULT);
    // хэширование пароля
    $confirmed = 0;
    // переменная, говорящая, что только что зарегистрарованная учетная запись не подтверждена
    if (!$mysqli) {
        printf("Невозможно подключиться к базе данных. Код ошибки: %s\n", mysqli_connect_error());
        exit;
    }
    $mysqli->query("SET CHARSET 'utf8'");
    $sql = "insert into users() values(null, '{$fields['firstName']}', '{$fields['lastName']}', '{$fields['email']}', '{$passwordHashed}', '{$fields['birthYear']}', '{$fields['livingArea']}', '{$fields['phoneNumber']}', '{$fields['about']}', '{$imagePath}', '{$fields['sex']}', '{$confirmCode}', {$confirmed})";
    $res = $mysqli->query($sql);
    var_dump($res);
    // Performs the $sql query on the server to create the database
    if ($res === TRUE) {
        $mailed = mailing($confirmCode, $fields["email"], $messages["mail"], $mgClient);
        // отправка кода активации на почту
        if ($mailed == true) {
            $_SESSION["success"] = "<p class=successMsg>" . $messages["signUp"]["successSignUp"][$_SESSION["locale"]] . "</p>";
            echo header('Location: http://' . $_SERVER['SERVER_NAME'], true, 301);
        }
    } else {
        echo '<br>Error: ' . $mysqli->error;
    }
    mysqli_close($mysqli);
}
Exemple #10
0
        case "savefooter":
            savefooter($xfoot1, $xfoot2, $xfoot3);
            break;
        case "backend":
            backend();
            break;
        case "savebackend":
            savebackend($xbackend_title, $xbackend_language, $xsite_logo, $xultramode);
            break;
        case "referers":
            referers();
            break;
        case "savereferers":
            savereferers($xhttpref, $xhttprefmax, $xhttprefmode);
            break;
        case "mailing":
            mailing();
            break;
        case "savemailing":
            savemailing($xadminmail, $xnotify, $xnotify_email, $xnotify_subject, $xnotify_message, $xnotify_from);
            break;
        case "other":
            other();
            break;
        case "saveother":
            saveother($xtop, $xstoryhome, $xoldnum);
            break;
    }
} else {
    echo "Access Denied";
}
            }
            $msg = "Email is successfully sent to all user of the group <b>{$gname}</b>";
            header("Location: muser.php?a=group&msg={$msg}");
        }
    } else {
        if ($_REQUEST[email] == "") {
            $err = "Please provide reciever email address";
        } elseif (!check_email($_REQUEST[email])) {
            $err = "Email address is not valid";
        } elseif ($_REQUEST['subj'] == "") {
            $err = "Please enter subject of your mail";
        } elseif ($_REQUEST['htmlCode'] == "") {
            $err = "Please write your email details";
        }
        if ($err == "") {
            mailing($_REQUEST[email], $config['site_name'], $config['admin_email'], $_REQUEST[subj], $_REQUEST['htmlCode']);
            $msg = "Mail is send to {$uname} successfully";
            header("Location: muser.php?email={$email}&uname={$uname}&msg={$msg}");
        }
    }
}
if ($_REQUEST['a'] == 'user') {
    $sql = "select UID, username from signup where account_status='Active' order by username";
    $rs = $conn->execute($sql);
    $user_ops = "<option value='0'>-- Select a user --</option>";
    while (!$rs->EOF) {
        if ($_REQUEST['UID'] == $rs->fields['UID']) {
            $sel = "selected";
        } else {
            $sel = "";
        }