コード例 #1
0
/**
 *  debug only, stripped version of Foretag.saveAndEndForetagsTavling()
 *  only printout
 */
function saveAndEndForetagsTavling_krillo_debug()
{
    $emailName = "Tavling avslutad - tisdag";
    global $db;
    $sql = 'SELECT a.id FROM mm_medlem a, mm_foretagsnycklar b, mm_foretag c
    WHERE a.id = b.medlem_id
    AND b.foretag_id = c.id
    AND a.epostBekraftad = 1
    AND UNIX_TIMESTAMP(c.startDatum) >= ' . (time() - (Foretag::TAVLINGSPERIOD_DAGAR + 3) * 86400) . ' AND UNIX_TIMESTAMP(c.startDatum) < ' . (time() - Foretag::TAVLINGSPERIOD_DAGAR * 86400);
    $unixtimestamp_first = time() - (Foretag::TAVLINGSPERIOD_DAGAR + 3) * 86400;
    $unixtimestamp_second = time() - Foretag::TAVLINGSPERIOD_DAGAR * 86400;
    echo "unixtimestamp_first : " . $unixtimestamp_first . " |   " . date("Y-m-d", $unixtimestamp_first) . "<br/>";
    echo "unixtimestamp_second : " . $unixtimestamp_second . " |   " . date("Y-m-d", $unixtimestamp_second) . "<br/><br/>";
    $slutDatum = date("Y-m-d", time());
    $slutDatum = Misc::dateToTimestamp($slutDatum);
    $tavling = new Tavling('0000-00-00');
    $save = array();
    foreach ($db->valuesAsArray($sql) as $user) {
        $medlem = Medlem::loadById($user);
        if (isset($medlem)) {
            $slutVecka = strftime("%V", $slutDatum);
            $foretagsSlutVecka = strftime("%V", Misc::dateToTimestamp($medlem->getForetag()->getSlutdatum()));
            echo "{$slutVecka}: " . $slutVecka . " | " . "{$foretagsSlutVecka}: " . $foretagsSlutVecka . "<br>";
            if (Misc::isEmail($medlem->getEpost(), false) && $medlem->getForetag() && $medlem->getLag()) {
                //self::logEmailSend(false, $emailName, "try", $medlem);
                echo " " . $medlem->getForetag()->getNamn() . " " . $medlem->getForetag()->getNamn() . " | epost: " . $medlem->getEpost() . "<br/>";
            }
        }
    }
}
コード例 #2
0
ファイル: Validator.class.php プロジェクト: alachaum/timetrex
 function isEmailAdvanced($label, $value, $msg = NULL, $error_level = TRUE)
 {
     //Debug::text('Raw Email: '. $value, __FILE__, __LINE__, __METHOD__, $this->verbosity);
     if (Misc::isEmail($value, TRUE, $error_level) === TRUE) {
         return TRUE;
     }
     $this->Error($label, $msg, $value);
     return FALSE;
 }
コード例 #3
0
ファイル: Medlem.php プロジェクト: krillo/motiomera
 public function setEpost($epost)
 {
     if ($this->getId()) {
         Security::demand(USER, $this);
     }
     global $db;
     if (!Misc::isEmail($epost)) {
         throw new MedlemException("Ogiltig e-postadress", -3);
     }
     if ($this->getId()) {
         $sql = "SELECT epost FROM " . $this->getTable() . " WHERE epost = '" . Security::secure_data($epost) . "' ";
         if ($this->getId()) {
             $sql .= "AND id <> " . $this->getId();
         }
         if ($db->value($sql) != "") {
             throw new MedlemException("E-postadressen är upptagen", -6);
         }
     }
     $this->epost = $epost;
     // TODO: Bekräfta epost
 }
コード例 #4
0
ファイル: sendinvitemail.php プロジェクト: krillo/motiomera
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/php/init.php";
if (isset($_POST['email'])) {
    $sendMails = array();
    $faultyMails = array();
    $mailExistsAsMember = array();
    $mailExistsAsTip = array();
    $maxBatchSize = 5;
    $currentBatchCount = 0;
    foreach ($_POST['email'] as $email) {
        $count = 0;
        if (!empty($email) && Misc::isEmail($email)) {
            $count = $db->allValuesAsArray('select id, anamn as username from mm_medlem where epost = "' . mysql_real_escape_string(trim($email)) . '" limit 1;');
            if (empty($count)) {
                $count = $db->nonquery('select * from mm_inbjudningar where epost = "' . mysql_real_escape_string($email) . '" limit 1;');
                if ($count == 0) {
                    $sendMails[] = $email;
                } else {
                    $mailExistsAsTip[] = $email;
                }
            } else {
                foreach ($count as $key => $value) {
                    $mailExistsAsMember[] = $arrayName = array('email' => $email, 'id' => $count[$key]['id'], 'username' => $count[$key]['username']);
                }
            }
        } else {
            if (!empty($email)) {
                $faultyMails[] = $email;
            }
        }