function cupid_email_cron()
{
    $iMinCupLevel = (int) getParam('match_percent');
    $sLastCupidCheckDate = getParam('cupid_last_cron');
    if (!strlen($sLastCupidCheckDate)) {
        return;
    }
    $sLastCupidCheckDateParam = "(`DateReg`>='{$sLastCupidCheckDate}' OR `DateLastEdit`>='{$sLastCupidCheckDate}') AND";
    $sSelectedSQL = "SELECT DISTINCT `Profiles`.`ID` FROM `Profiles` WHERE {$sLastCupidCheckDateParam} `Status`='Active'";
    $vSelCupProf = db_res($sSelectedSQL);
    $aSelCupids = array();
    while ($aSelCup = mysql_fetch_array($vSelCupProf)) {
        $aSelCupids[] = $aSelCup['ID'];
    }
    $sAllProfSQL = "SELECT DISTINCT `Profiles`.* FROM `Profiles` WHERE `Status`='Active' AND (`Couple`='0' OR `Couple`>`ID`)";
    $vAllProf = db_res($sAllProfSQL);
    while ($aAnyProf = mysql_fetch_array($vAllProf)) {
        foreach ($aSelCupids as $iSelCupID) {
            $iCurMatch = getProfilesMatch($aAnyProf['ID'], $iSelCupID);
            if ($iCurMatch >= $iMinCupLevel) {
                // If the profile matches less then predefined percent then go to next iteration (i.e. next profile)
                send_cupid_email($aAnyProf, $iSelCupID, $iCurMatch);
            }
        }
    }
    $sUpdateCronValSQL = "UPDATE `GlParams` SET `VALUE`=NOW() WHERE `Name`='cupid_last_cron' LIMIT 1";
    db_res($sUpdateCronValSQL);
}
Esempio n. 2
0
 function getProfileMatch($memberID, $profileID)
 {
     $match_n = getProfilesMatch($memberID, $profileID);
     // impl
     return DesignProgressPos(_t("_XX match", $match_n), $GLOBALS['oTemplConfig']->iProfileViewProgressBar, 100, $match_n);
 }
function getProfileMatch($memberID, $profileID)
{
    global $oTemplConfig;
    $match_n = getProfilesMatch($memberID, $profileID);
    // impl
    $ret = '';
    $ret .= DesignProgressPos(_t("_XX match", $match_n), $oTemplConfig->iProfileViewProgressBar, 100, $match_n);
    return $ret;
}