示例#1
0
function update_case_history($id, $enter = 0, $txt = '')
{
    global $db, $_SESSION;
    $H = array();
    $H["hc_cu_id_k"] = $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["id"];
    $H["hc_c_id_k"] = $id;
    $H["hc_timestamp"] = date("Y-m-d H:i:s");
    $H["hc_enter"] = $enter;
    $cnt = $db->GetOne("SELECT COUNT(1) FROM wind_history_case WHERE hc_timestamp LIKE '" . date("Y-m-d H:i") . "%' AND hc_c_id_k={$id} AND hc_cu_id_k=" . $_SESSION["fh49ty58u893ytf83902g758902djr4cf302ty5798"]["id"]);
    if (!$cnt) {
        wpisz($H, "wind_history_case", array());
    }
    //wysyłanie maila do pełnomocnika
    $sprawa = $db->GetRow("SELECT ca_number_c, ca_agent_id_k, ca_debtor_id_k, ca_creditor_id_k FROM wind_case WHERE ca_id_s={$id}");
    $email = $db->GetOne("SELECT cu_email_c FROM wind_users WHERE cu_id_s=" . $sprawa['ca_agent_id_k']);
    if ($email != '') {
        if (file_exists("../include/mail.php")) {
            include "../include/mail.php";
        }
        $dluznik = $db->GetOne("SELECT c_shortname_c FROM wind_client WHERE c_id_s=" . $sprawa['ca_debtor_id_k']);
        $wierzyciel = $db->GetOne("SELECT c_shortname_c FROM wind_client WHERE c_id_s=" . $sprawa['ca_creditor_id_k']);
        $admin_letter = new eMail(2);
        $admin_letter->eMailContent('Zmiana w sprawie ' . $sprawa['ca_number_c'], '<html><head><title>Zmiana w sprawie ' . $sprawa['ca_number_c'] . '</title></head><body>W sprawie o numerze ' . $sprawa['ca_number_c'] . ' zostały zarejestrowane zmiany.' . "\n" . '<br><br>Dłużnik: ' . $dluznik . "\n" . '<br>Wierzyciel: ' . $wierzyciel . "\n" . ($txt != '' ? '<br>Szczegóły: ' . $txt : '') . '</body></html>');
        $admin_letter->eMailSend($email);
        //$admin_letter->eMailSend('*****@*****.**');
    }
    ////////////////////////////////
}
 function envoi_email_tradeProposition($id_pool, $gerant_expediteur, $gerant_destinataire, $id_proposition, $id_saison, $old_id_proposition, $duree_prop, $periode)
 {
     $data = $this->getConfigPool($id_pool, $id_saison);
     $salary_cap_enabled = $data['enable_salary_cap'];
     $trade_howto_switch_players = $data["trade_howto_switch_players"];
     $salary_cap = $data['salary_cap'];
     $salary_floor = $data['salary_floor'];
     $query = "SELECT name FROM pools WHERE id = {$id_pool}";
     $resultID = mysql_query($query, $this->handle);
     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
     mysql_free_result($resultID);
     $poolName = $data["name"];
     $poolNameUpper = strtoupper($poolName);
     $poolNameLower = strtolower($poolName);
     // information du gérant expéditeur
     $expediteurA = $this->getGerantProfil($id_pool, $gerant_expediteur, $id_saison);
     $from_name = $expediteurA["real_name"];
     $from_nickname = $expediteurA["real_name_abrege"];
     // information du gérant destinataire
     $destinataireA = $this->getGerantProfil($id_pool, $gerant_destinataire, $id_saison);
     $to_name = $destinataireA["real_name"];
     $to_nickname = $destinataireA["real_name_abrege"];
     $to_email_format = $destinataireA['email_format'];
     // on va chercher certaines info de la proposition
     $query = "select comment,date,time from trade_proposition where id = {$id_proposition}";
     $resultID = mysql_query($query, $this->handle);
     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
     mysql_free_result($resultID);
     $commentaire = $data['comment'];
     $date_prop = $data['date'];
     $time_prop = $data['time'];
     // durée de la propostion
     if ($duree_prop == 99) {
         $str_duree = "valide jusqu'à la fin de la période.";
     } else {
         $str_duree_prop = "+{$duree_prop} days";
         $_mydate = Datetime::createFromFormat('Y-m-d H:i:s', "{$date_prop} {$time_prop}", $this->timeZone);
         $_mydate->modify('$str_duree_prop');
         $jour_fin_prop = $this->date_getJour($_mydate->format('l'));
         $str_duree = "valide jusqu'à {$jour_fin_prop} {$time_prop}";
     }
     if ($old_id_proposition == "") {
         $subject = "{$poolNameUpper} - Proposition d'échange...";
     } else {
         $subject = "{$poolNameUpper} - Contre-offre d'une proposition d'échange précédente...";
     }
     if ($to_email_format == "html") {
         $body = "<p>{$from_nickname} propose l'échange suivant:</p>\n                        <br>\n                        <table border=0 cellspacing=3 cellpadding=3>\n                        <tr>";
     }
     $body_text = "{$from_nickname} propose l'échange suivant:\n\n";
     // on va chercher les joueurs impliqués dans la proposition...
     $query = "SELECT liste_joueurs_gerant1,liste_joueurs_gerant2,liste_picks_gerant1,liste_picks_gerant2\n                    FROM trade_proposition\n                    WHERE id_pool = {$id_pool} AND id = {$id_proposition}\n                    AND saison_id = {$id_saison}";
     $resultID = mysql_query($query, $this->handle);
     $data = mysql_fetch_array($resultID, MYSQL_ASSOC);
     mysql_free_result($resultID);
     $liste_joueurs_expediteur = $data["liste_joueurs_gerant1"];
     $liste_joueurs_destinataire = $data["liste_joueurs_gerant2"];
     $liste_picks_expediteur = $data["liste_picks_gerant1"];
     $liste_picks_destinataire = $data['liste_picks_gerant2'];
     $liste_joueurs_expediteurA = explode(":", $liste_joueurs_expediteur);
     $liste_joueurs_destinataireA = explode(":", $liste_joueurs_destinataire);
     $liste_joueurs_prop_expediteur = 0;
     foreach ($liste_joueurs_expediteurA as $this_id_player) {
         if ($this_id_player != "") {
             $liste_joueurs_prop_expediteur .= ",{$this_id_player}";
         }
     }
     $liste_joueurs_prop_destinataire = 0;
     foreach ($liste_joueurs_destinataireA as $this_id_player) {
         if ($this_id_player != "") {
             $liste_joueurs_prop_destinataire .= ",{$this_id_player}";
         }
     }
     $compteur = 0;
     foreach (array('TM', 'G', 'D', 'F') as $pos_en_trait) {
         $playersPropGerant1 = $this->getPlayerInfoForTrade2($id_pool, $id_saison, $gerant_expediteur, $periode, $liste_joueurs_prop_expediteur, $pos_en_trait, $trade_howto_switch_players, $salary_cap_enabled);
         foreach ($playersPropGerant1 as $item) {
             $id_player = $item['id_player'];
             $pos = $item['pos'];
             $pts = $item['pts_nhl'];
             $pj = $item['pj'];
             $first_name = $item['first_name'];
             $last_name = $item['last_name'];
             $logo = "http://www.{$poolNameLower}.lamoria.ca/" . $item['logo'];
             $id_forecaster = $item['id_forecaster'];
             $salaire_unformatted = $item['salary_frozen'];
             $birthday = $item['birthday'];
             $url_photo = $item['url_photo'];
             $abbr = $item['abbr'];
             $salaire = number_format($salaire_unformatted, 0, ".", ",");
             // get pj restantes pour le joueur si nécessaire
             if ($salary_cap_enabled == "Y") {
                 $pj_restantes = $this->getPlayerPJRestantes($id_pool, $id_saison, $id_player, $periode);
             }
             // âge du joueur
             if ($pos == "TM") {
                 $age = "";
             } elseif ($birthday != "0000-00-00") {
                 $_mydate = Datetime::createFromFormat('Y-m-d', $birthday, $this->timeZone);
                 $age = $_mydate->diff($this->todayDate)->y;
             } else {
                 $age = "???";
             }
             if ($pj == "") {
                 $pj = 0;
             }
             if ($this->isPlayerInjured($id_player, $this->today, $id_saison)) {
                 $show_injury = "<img class=\"injury_icon_topLeft\" id=\"{$id_player}\" src=\"http://www.{$poolNameLower}.lamoria.ca/images/red-cross.png\" " . "border=0 width=20 height=20 style=\"padding-top:5px;padding-left:5px;\" /><br>";
             } else {
                 $show_injury = "";
             }
             if ($pos != "TM") {
                 if ($id_forecaster < 10) {
                     $id_forecaster_photo = "000{$id_forecaster}";
                 } elseif ($id_forecaster < 100) {
                     $id_forecaster_photo = "00{$id_forecaster}";
                 } elseif ($id_forecaster < 1000) {
                     $id_forecaster_photo = "0{$id_forecaster}";
                 } else {
                     $id_forecaster_photo = $id_forecaster;
                 }
                 if ($url_photo == "") {
                     //$photo = "http://www.$poolNameLower.lamoria.ca/images/players/forecaster/${id_forecaster_photo}.jpg";
                     $photo = "http://pics.forecaster.ca/nhl-player/{$id_forecaster_photo}.jpg";
                 } else {
                     //$photo = "http://www.$poolNameLower.lamoria.ca/$url_photo";
                     $photo = $url_photo;
                 }
             } else {
                 $photo = $logo;
             }
             if ($to_email_format == "html") {
                 $body .= "<td>";
                 $body .= "<table border=0>\n";
                 $body .= "<tr>\n";
                 if ($pos != "TM") {
                     $body .= "<td align='left'><img src=\"{$photo}\" width=55 height=80 border=0></td>\n";
                     $body .= "<td style=\"padding-right:5px;vertical-align:top;\"><img src=\"{$logo}\" border=0 style=\"padding:2px 2px 2px 2px;\"/>";
                     $body .= "<br><font style=\"padding-left:10px;\">{$pos}</font>";
                     $body .= "<br>{$show_injury}\n";
                 } else {
                     $body .= "<td align='left'><img src=\"{$photo}\" height=135% border=0></td>\n";
                 }
                 $body .= "</td>\n";
                 $body .= "</tr>\n";
                 $body .= "<tr>\n";
                 if ($pos == "TM") {
                     $body .= "<TD nowrap colspan=50 style=\"padding-right:5px;font-weight:bold;\">{$last_name}";
                 } else {
                     $body .= "<TD nowrap colspan=50 style=\"padding-right:5px;font-weight:bold;\">" . "<a class=\"player\" id=\"{$id_player}\" alt=\"Profil de {$first_name} {$last_name}\">" . "{$first_name['0']}. {$last_name}</a>";
                 }
                 $body .= "</td>\n";
                 $body .= "</tr>\n";
                 if ($salary_cap_enabled == "Y") {
                     if ($pos != "TM") {
                         $body .= "<tr>\n";
                         $body .= "<TD nowrap colspan=50 style=\"padding-right:5px;{$style_color}\">âge: {$age} ans</td>";
                         $body .= "</tr>\n";
                     }
                     $body .= "<tr>\n";
                     $body .= "<TD nowrap colspan=50 style=\"padding-right:5px;\">\$: {$salaire}";
                     if ($pos != "TM") {
                         $body .= "<img src=\"/images/plus.gif\" style=\"padding-right:2px;padding-left:2px;\" class=\"img_moreSalaries\" id=\"{$id_player}\" />\n";
                     }
                     $body .= "</td></tr>\n";
                 }
                 $body .= "<tr>\n";
                 $body .= "<TD nowrap colspan=50 align=\"left\">pj: {$pj}</td>\n";
                 $body .= "</tr>\n";
                 if ($salary_cap_enabled == "Y") {
                     $body .= "<tr>\n";
                     $body .= "<TD nowrap colspan=50 style=\"{$style_color};\" align=\"left\">pj reste: {$pj_restantes}</td>\n";
                     $body .= "</tr>\n";
                 }
                 $body .= "<tr>\n";
                 $body .= "<TD nowrap colspan=50 align=\"left\">pts: {$pts}</td>\n";
                 $body .= "</tr>\n";
                 $body .= "</table>\n";
                 $body .= "</td>\n";
                 $compteur++;
             }
             if ($pos == "TM") {
                 $body_text .= "\t{$last_name} (l'équipe) - {$pts} pts\n";
             } else {
                 $body_text .= "\t{$first_name} {$last_name}, {$pos} ({$abbr}) - {$pts} pts\n";
             }
         }
     }
     // draft picks...
     $liste_picks_expediteurA = explode(":", $liste_picks_expediteur);
     foreach ($liste_picks_expediteurA as $this_id_pick) {
         if ($this_id_pick == "") {
             continue;
         }
         $q = "select a.pick_no,a.owner,a.owner_ori,b.real_name_abrege\n                     from trade_draftPicks_gerant a, accounts b\n                     where\n                         a.id = {$this_id_pick}\n                         and a.owner_ori = b.id";
         $data = DB::dbSelect($q);
         $data = $data[0];
         $this_pick_no = $data['pick_no'];
         $this_pick_owner = $data['owner'];
         $this_pick_owner_ori = $data['owner_ori'];
         $this_pick_owner_ori_name = $data['real_name_abrege'];
         switch ($this_pick_no) {
             case 1:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/1st_round.png";
                 $str_pick = "Choix de 1ère ronde";
                 break;
             case 2:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/2nd_round.png";
                 $str_pick = "Choix de 2e ronde";
                 break;
             case 3:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/3rd_round.png";
                 $str_pick = "Choix de 3e ronde";
                 break;
             case 4:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/4th_round.png";
                 $str_pick = "Choix de 4e ronde";
                 break;
             case 5:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/5th_round.png";
                 $str_pick = "Choix de 5e ronde";
                 break;
             case 6:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/6th_round.png";
                 $str_pick = "Choix de 6e ronde";
                 break;
             case 7:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/7th_round.png";
                 $str_pick = "Choix de 7e ronde";
                 break;
             default:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/img_not_found.gif";
         }
         if ($to_email_format == "html") {
             $body .= "<td align='center'>\n";
             $body .= "<table border=0>\n";
             $body .= "<tr>\n";
             $body .= "<td>\n";
             $body .= "<img src=\"{$this_img_src}\" />";
             $body .= "</td>\n";
             $body .= "</tr>\n";
             $body .= "<tr>\n";
             $body .= "<td>\n";
             if ($this_pick_owner_ori != $this_pick_owner) {
                 $body .= "(Choix de {$this_pick_owner_ori_name})";
             } else {
                 $body .= "&nbsp;";
             }
             $body .= "</td>\n";
             $body .= "</tr>\n";
             $body .= "</table>\n";
             $body .= "</td>\n";
             $compteur++;
         }
         $body_text .= "\t{$str_pick}";
         if ($this_pick_owner_ori != $this_pick_owner) {
             $body_text .= " (Choix de {$this_pick_owner_ori_name})\n";
         } else {
             $body_text .= "\n";
         }
     }
     if ($to_email_format == "html") {
         $body .= "</tr>\n";
         $body .= "<tr>\n";
         for ($i = 0; $i < $compteur; $i++) {
             $body .= "<td align='center'><img src=\"http://www.{$poolNameLower}.lamoria.ca/images/trade_swap_players.png\" border=0 class=\"trade_swap_players_rotate_90\" /></td>\n";
         }
         $body .= "</tr>\n";
         $body .= "<tr>\n";
     }
     $body_text .= "\n\tcontre\n\n";
     // Gérant 2
     foreach (array('TM', 'G', 'D', 'F') as $pos_en_trait) {
         $playersPropGerant2 = $this->getPlayerInfoForTrade2($id_pool, $id_saison, $gerant_destinataire, $periode, $liste_joueurs_prop_destinataire, $pos_en_trait, $trade_howto_switch_players, $salary_cap_enabled);
         foreach ($playersPropGerant2 as $item) {
             echo "<td align='center'>\n";
             $id_player = $item['id_player'];
             $pos = $item['pos'];
             $pts = $item['pts_nhl'];
             $pj = $item['pj'];
             $first_name = $item['first_name'];
             $last_name = $item['last_name'];
             $logo = "http://www.{$poolNameLower}.lamoria.ca" . $item['logo'];
             $id_forecaster = $item['id_forecaster'];
             $salaire_unformatted = $item['salary_frozen'];
             $birthday = $item['birthday'];
             $url_photo = $item['url_photo'];
             $abbr = $item['abbr'];
             $salaire = number_format($salaire_unformatted, 0, ".", ",");
             // get pj restantes pour le joueur si nécessaire
             if ($salary_cap_enabled == "Y") {
                 $pj_restantes = $this->getPlayerPJRestantes($id_pool, $id_saison, $id_player, $periode);
             }
             // âge du joueur
             if ($pos == "TM") {
                 $age = "";
             } elseif ($birthday != "0000-00-00") {
                 $_mydate = Datetime::createFromFormat('Y-m-d', $birthday, $this->timeZone);
                 $age = $_mydate->diff($this->todayDate)->y;
             } else {
                 $age = "???";
             }
             if ($pj == "") {
                 $pj = 0;
             }
             if ($this->isPlayerInjured($id_player, $this->today, $id_saison)) {
                 $show_injury = "<img class=\"injury_icon_bottomLeft\" id=\"{$id_player}\" src=\"/images/red-cross.png\" " . "border=0 width=20 height=20 style=\"padding-top:5px;padding-left:5px;\" /><br>";
             } else {
                 $show_injury = "";
             }
             if ($pos != "TM") {
                 if ($id_forecaster < 10) {
                     $id_forecaster_photo = "000{$id_forecaster}";
                 } elseif ($id_forecaster < 100) {
                     $id_forecaster_photo = "00{$id_forecaster}";
                 } elseif ($id_forecaster < 1000) {
                     $id_forecaster_photo = "0{$id_forecaster}";
                 } else {
                     $id_forecaster_photo = $id_forecaster;
                 }
                 if ($url_photo == "") {
                     //$photo = "http://www.$poolNameLower.lamoria.ca/images/players/forecaster/${id_forecaster_photo}.jpg";
                     $photo = "http://pics.forecaster.ca/nhl-player/{$id_forecaster_photo}.jpg";
                 } else {
                     //$photo = "http://www.$poolNameLower.lamoria.ca/$url_photo";
                     $photo = $url_photo;
                 }
             } else {
                 $photo = $logo;
             }
             if ($to_email_format == "html") {
                 $body .= "<td>";
                 $body .= "<table border=0>\n";
                 $body .= "<tr>\n";
                 if ($pos != "TM") {
                     $body .= "<td align='left'><img src=\"{$photo}\" width=55 height=80 border=0></td>\n";
                     $body .= "<td style=\"padding-right:5px;vertical-align:top;\"><img src=\"{$logo}\" border=0 style=\"padding:2px 2px 2px 2px;\"/>";
                     $body .= "<br><font style=\"padding-left:10px;\">{$pos}</font>";
                     $body .= "<br>{$show_injury}\n";
                 } else {
                     $body .= "<td align='left'><img src=\"{$photo}\" height=135% border=0></td>\n";
                 }
                 $body .= "</td>\n";
                 $body .= "</tr>\n";
                 $body .= "<tr>\n";
                 if ($pos == "TM") {
                     $body .= "<TD nowrap colspan=50 style=\"padding-right:5px;font-weight:bold;\">{$last_name}";
                 } else {
                     $body .= "<TD nowrap colspan=50 style=\"padding-right:5px;font-weight:bold;\">" . "<a class=\"player\" id=\"{$id_player}\" alt=\"Profil de {$first_name} {$last_name}\">" . "{$first_name['0']}. {$last_name}</a>";
                 }
                 $body .= "</td>\n";
                 $body .= "</tr>\n";
                 if ($salary_cap_enabled == "Y") {
                     if ($pos != "TM") {
                         $body .= "<tr>\n";
                         $body .= "<TD nowrap colspan=50 style=\"padding-right:5px;{$style_color}\">âge: {$age} ans</td>";
                         $body .= "</tr>\n";
                     }
                     $body .= "<tr>\n";
                     $body .= "<TD nowrap colspan=50 style=\"padding-right:5px;\">\$: {$salaire}";
                     if ($pos != "TM") {
                         $body .= "<img src=\"/images/plus.gif\" style=\"padding-right:2px;padding-left:2px;\" class=\"img_moreSalaries\" id=\"{$id_player}\" />\n";
                     }
                     $body .= "</td></tr>\n";
                 }
                 $body .= "<tr>\n";
                 $body .= "<TD nowrap colspan=50 align=\"left\">pj: {$pj}</td>\n";
                 $body .= "</tr>\n";
                 if ($salary_cap_enabled == "Y") {
                     $body .= "<tr>\n";
                     $body .= "<TD nowrap colspan=50 style=\"{$style_color};\" align=\"left\">pj reste: {$pj_restantes}</td>\n";
                     $body .= "</tr>\n";
                 }
                 $body .= "<tr>\n";
                 $body .= "<TD nowrap colspan=50 align=\"left\">pts: {$pts}</td>\n";
                 $body .= "</tr>\n";
                 $body .= "</table>\n";
                 $body .= "</td>\n";
                 $compteur++;
             }
             if ($pos == "TM") {
                 $body_text .= "\t{$last_name} (l'équipe) - {$pts} pts\n";
             } else {
                 $body_text .= "\t{$first_name} {$last_name}, {$pos} ({$abbr}) - {$pts} pts\n";
             }
         }
     }
     // draft picks...
     $liste_picks_destinataireA = explode(":", $liste_picks_destinataire);
     foreach ($liste_picks_destinataireA as $this_id_pick) {
         if ($this_id_pick == "") {
             continue;
         }
         $q = "select a.pick_no,a.owner,a.owner_ori,b.real_name_abrege\n                     from trade_draftPicks_gerant a, accounts b\n                     where\n                         a.id = {$this_id_pick}\n                         and a.owner_ori = b.id";
         $data = DB::dbSelect($q);
         $data = $data[0];
         $this_pick_no = $data['pick_no'];
         $this_pick_owner = $data['owner'];
         $this_pick_owner_ori = $data['owner_ori'];
         $this_pick_owner_ori_name = $data['real_name_abrege'];
         switch ($this_pick_no) {
             case 1:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/1st_round.png";
                 $str_pick = "Choix de 1ère ronde";
                 break;
             case 2:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/2nd_round.png";
                 $str_pick = "Choix de 2e ronde";
                 break;
             case 3:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/3rd_round.png";
                 $str_pick = "Choix de 3e ronde";
                 break;
             case 4:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/4th_round.png";
                 $str_pick = "Choix de 4e ronde";
                 break;
             case 5:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/5th_round.png";
                 $str_pick = "Choix de 5e ronde";
                 break;
             case 6:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/6th_round.png";
                 $str_pick = "Choix de 6e ronde";
                 break;
             case 7:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/7th_round.png";
                 $str_pick = "Choix de 7e ronde";
                 break;
             default:
                 $this_img_src = "http://www.{$poolNameLower}.lamoria.ca/images/img_not_found.gif";
         }
         if ($to_email_format == "html") {
             $body .= "<td align='center'>\n";
             $body .= "<table border=0>\n";
             $body .= "<tr>\n";
             $body .= "<td>\n";
             $body .= "<img src=\"{$this_img_src}\" />";
             $body .= "</td>\n";
             $body .= "</tr>\n";
             $body .= "<tr>\n";
             $body .= "<td>\n";
             if ($this_pick_owner_ori != $this_pick_owner) {
                 $body .= "(Choix de {$this_pick_owner_ori_name})";
             } else {
                 $body .= "&nbsp;";
             }
             $body .= "</td>\n";
             $body .= "</tr>\n";
             $body .= "</table>\n";
             $body .= "</td>\n";
             $compteur++;
         }
         $body_text .= "\t{$str_pick}";
         if ($this_pick_owner_ori != $this_pick_owner) {
             $body_text .= " (Choix de {$this_pick_owner_ori_name})\n";
         } else {
             $body_text .= "\n";
         }
     }
     if ($to_email_format == "html") {
         $body .= "</tr>";
         $body .= "</table>";
         $body .= "<br><br>\n                         <p>La propostion est {$str_duree} </p>\n                         <br>\n                         <br>\n                         <p>Commentaire:</p>\n                         <br>";
         $body .= "<textarea cols=40 rows=10 class=\"tradeProposition\" disabled>{$commentaire}</textarea>\n";
         $body .= "<br><p>Pour tous les détails, suivez le lien. http://www.{$poolNameLower}.lamoria.ca</p>";
     }
     $body_text .= "\n\nLa propostion est {$str_duree}";
     $body_text .= "\n\n\nCommentaire(s):\n\n{$commentaire}";
     $body_text .= "\n\n\nPour tous les détails, suivez le lien. http://www.{$poolNameLower}.lamoria.ca";
     require_once "class.mail.php";
     $email = new eMail($poolNameUpper, "{$poolNameLower}@lamoria.ca");
     $emails_destinatairesA = explode(";", $destinataireA['email']);
     foreach ($emails_destinatairesA as $this_email) {
         if ($this_email == "") {
             continue;
         }
         $email->to($this_email);
     }
     $email->subject($subject);
     if ($to_email_format == "html") {
         $email->html($body);
     } else {
         $email->text($body_text);
     }
     $email->send();
     // insertion dans la table emails (à cause du problème que les mails sont longs à envoyer sur le serveur)
     $query = "insert into emails (id_pool,saison_id,`from`,`to`,subject,body)\n                    values ({$id_pool},{$id_saison},{$gerant_expediteur},{$gerant_destinataire},\"{$subject}\",\"{$body_text}\")";
     mysql_query($query, $this->handle);
     if (mysql_affected_rows() > 0) {
         $this->dbLog($id_pool, $gerant_expediteur, "envoie_email", $query);
         $rtn = 1;
     } else {
         $rtn = 0;
     }
     unset($query, $resultID, $data, $expediteurA, $destinataireA, $emails_expediteur, $emails_expediteurA, $from_email, $from_name, $from_nickname, $to_name, $to_nickname, $subject, $liste_joueurs_expediteur, $liste_joueurs_destinataire, $liste_joueurs_expediteurA, $liste_joueurs_destinataireA, $body, $playerInfoA, $first_name, $last_name, $pos, $abbr, $emails_destinataire, $emails_destinataireA, $pool, $sess);
     if ($rtn == 1) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
/**
 * This function prints all mails
 *
 * @uses $CFG, $COURSE, $SESSION
 * @param int $userid User ID
 * @param string $order Order by ...
 * @param object $options Options for url
 * @param boolean $search When show mails on search
 * @param array $mailssearch Mails who has search
 * @return boolean Success/Fail
 * @todo Finish documenting this function
 **/
function email_showmails($userid, $order = '', $page = 0, $perpage = 10, $options = NULL, $search = false, $mailssearch = NULL)
{
    global $CFG, $COURSE, $SESSION;
    // CONTRIB-690
    if (!empty($_POST['perpage']) and is_numeric($_POST['perpage'])) {
        $SESSION->email_mailsperpage = $_POST['perpage'];
    } else {
        if (!isset($SESSION->email_mailsperpage) or empty($SESSION->email_mailsperpage)) {
            $SESSION->email_mailsperpage = 10;
            // Default value
        }
    }
    require_once 'tablelib.php';
    require_once 'email.class.php';
    // Get actual course
    if (!($course = get_record("course", "id", $COURSE->id))) {
        print_error('invalidcourseid', 'block_email_list');
    }
    if ($course->id == SITEID) {
        $coursecontext = get_context_instance(CONTEXT_SYSTEM);
        // SYSTEM context
    } else {
        $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
        // Course context
    }
    $url = '';
    // Build url part options
    if ($options) {
        $url = email_build_url($options);
    }
    /// Print all mails in this HTML file
    // Should use this variable so that we don't break stuff every time a variable is added or changed.
    $baseurl = $CFG->wwwroot . '/blocks/email_list/email/index.php?' . $url . '&amp;page=' . $page . '&amp;perpage=' . $perpage;
    // Print init form from send data
    echo '<form id="sendmail" action="' . $CFG->wwwroot . '/blocks/email_list/email/index.php?id=' . $course->id . '&amp;folderid=' . $options->folderid . '" method="post" target="' . $CFG->framename . '" name="sendmail">';
    if ($course->id == SITEID) {
        $tablecolumns = array('', 'icon', 'course', 'subject', 'writer', 'timecreated');
    } else {
        $tablecolumns = array('', 'icon', 'subject', 'writer', 'timecreated');
    }
    $folder = NULL;
    if (isset($options->folderid)) {
        if ($options->folderid != 0) {
            // Get folder
            $folder = email_get_folder($options->folderid);
        } else {
            // solve problem with select an x mails per page for maintein in this folder
            if (isset($options->folderoldid) && $options->folderoldid != 0) {
                $options->folderid = $options->folderoldid;
                $folder = email_get_folder($options->folderid);
            }
        }
    }
    // If actual folder is inbox type, ... change tag showing.
    if ($folder) {
        if (email_isfolder_type($folder, EMAIL_INBOX)) {
            $strto = get_string('from', 'block_email_list');
        } else {
            $strto = get_string('to', 'block_email_list');
        }
    } else {
        $strto = get_string('from', 'block_email_list');
    }
    if ($course->id == SITEID) {
        $tableheaders = array('', '', get_string('course'), get_string('subject', 'block_email_list'), $strto, get_string('date', 'block_email_list'));
    } else {
        $tableheaders = array('', '', get_string('subject', 'block_email_list'), $strto, get_string('date', 'block_email_list'));
    }
    $table = new email_flexible_table('list-mails-' . $userid);
    $table->define_columns($tablecolumns);
    $table->define_headers($tableheaders);
    $table->define_baseurl($baseurl);
    $table->set_attribute('align', 'center');
    $table->set_attribute('width', '100%');
    $table->set_attribute('class', 'emailtable');
    $table->set_control_variables(array(TABLE_VAR_SORT => 'ssort', TABLE_VAR_HIDE => 'shide', TABLE_VAR_SHOW => 'sshow', TABLE_VAR_IFIRST => 'sifirst', TABLE_VAR_ILAST => 'silast', TABLE_VAR_PAGE => 'spage'));
    $table->sortable(true, 'timecreated', SORT_DESC);
    $table->setup();
    // When no search
    if (!$search) {
        // Get mails
        $mails = email_get_mails($userid, $course->id, $table->get_sql_sort(), '', '', $options);
    } else {
        $mails = $mailssearch;
    }
    // Define long page.
    $totalcount = count($mails);
    $table->pagesize($SESSION->email_mailsperpage, $totalcount);
    $table->inputs(true);
    // Now, re-getting emails, apply pagesize (limit)
    if (!$search) {
        // Get mails
        $mails = email_get_mails($userid, $course->id, $table->get_sql_sort(), $table->get_page_start(), $table->get_page_size(), $options);
    }
    if (!$mails) {
        $mails = array();
    }
    $mailsids = email_get_ids($mails);
    // Print all rows
    foreach ($mails as $mail) {
        $attribute = array();
        $email = new eMail();
        $email->set_email($mail);
        if ($folder) {
            if (email_isfolder_type($folder, EMAIL_SENDBOX)) {
                $struser = $email->get_users_send(has_capability('moodle/site:viewfullnames', $coursecontext));
            } else {
                if (email_isfolder_type($folder, EMAIL_INBOX)) {
                    $struser = $email->get_fullname_writer(has_capability('moodle/site:viewfullnames', $coursecontext));
                    if (!$email->is_readed($userid, $mail->course)) {
                        $attribute = array('bgcolor' => $CFG->email_table_field_color);
                    }
                } else {
                    if (email_isfolder_type($folder, EMAIL_TRASH)) {
                        $struser = $email->get_fullname_writer(has_capability('moodle/site:viewfullnames', $coursecontext));
                        if (!$email->is_readed($userid, $mail->course)) {
                            $attribute = array('bgcolor' => $CFG->email_table_field_color);
                        }
                    } else {
                        if (email_isfolder_type($folder, EMAIL_DRAFT)) {
                            $struser = $email->get_users_send(has_capability('moodle/site:viewfullnames', $coursecontext));
                            if (!$email->is_readed($userid, $mail->course)) {
                                $attribute = array('bgcolor' => $CFG->email_table_field_color);
                            }
                        } else {
                            $struser = $email->get_fullname_writer(has_capability('moodle/site:viewfullnames', $coursecontext));
                            if (!$email->is_readed($userid, $mail->course)) {
                                $attribute = array('bgcolor' => $CFG->email_table_field_color);
                            }
                        }
                    }
                }
            }
        } else {
            // Format user's
            $struser = $email->get_fullname_writer(has_capability('moodle/site:viewfullnames', $coursecontext));
            if (!$email->is_readed($userid, $mail->course)) {
                $attribute = array('bgcolor' => $CFG->email_table_field_color);
            }
        }
        if (!isset($options->folderid)) {
            $options->folderid = 0;
        }
        if (email_isfolder_type($folder, EMAIL_DRAFT)) {
            $urltosent = '<a href="' . $CFG->wwwroot . '/blocks/email_list/email/sendmail.php?id=' . $mail->id . '&amp;action=' . EMAIL_EDITDRAFT . '&amp;course=' . $course->id . '">' . $mail->subject . '</a>';
        } else {
            if ($course->id == SITEID) {
                $urltosent = '<a href="' . $CFG->wwwroot . '/blocks/email_list/email/view.php?id=' . $mail->id . '&amp;action=' . EMAIL_VIEWMAIL . '&amp;course=' . $mail->course . '&amp;folderid=' . $options->folderid . '&amp;mails=' . $mailsids . '">' . $mail->subject . '</a>';
            } else {
                $urltosent = '<a href="' . $CFG->wwwroot . '/blocks/email_list/email/view.php?id=' . $mail->id . '&amp;action=' . EMAIL_VIEWMAIL . '&amp;course=' . $course->id . '&amp;folderid=' . $options->folderid . '&amp;mails=' . $mailsids . '">' . $mail->subject . '</a>';
            }
        }
        $attachment = '';
        if ($email->has_attachments()) {
            $attachment = '<img src="' . $CFG->wwwroot . '/blocks/email_list/email/images/clip.gif" alt="attachment" /> ';
        }
        // Display diferent color if mail is reply or reply all
        $extraimginfo = '';
        if ($email->is_answered($userid, $course->id)) {
            // Color td
            unset($attribute);
            $attribute = array('bgcolor' => $CFG->email_answered_color);
            // Adding info img
            $extraimginfo = '<img src="' . $CFG->wwwroot . '/blocks/email_list/email/images/answered.gif" alt="" /> ';
        }
        if (!($course_mail = get_record("course", "id", $mail->course))) {
            print_error('invalidcourseid', 'block_email_list');
        }
        if ($course->id == SITEID) {
            $table->add_data(array('<input id="mail" type="checkbox" name="mailid[]" value="' . $mail->id . '" />', $course_mail->fullname, $attachment . $extraimginfo, $urltosent, $struser, userdate($mail->timecreated)), $attribute);
        } else {
            $table->add_data(array('<input id="mail" type="checkbox" name="mailid[]" value="' . $mail->id . '" />', $attachment . $extraimginfo, $urltosent, $struser, userdate($mail->timecreated)), $attribute);
        }
        // Save previous mail
        $previousmail = $mail->id;
    }
    $table->print_html();
    // Print select action, if have mails
    if ($mails) {
        email_print_select_options($options, $SESSION->email_mailsperpage);
    }
    // End form
    echo '</form>';
    return true;
}
示例#4
0
 function definition()
 {
     global $CFG, $COURSE;
     // Get customdata
     $oldmail = $this->_customdata['oldmail'];
     $action = $this->_customdata['action'];
     $mform =& $this->_form;
     /// Print the required moodle fields first
     $mform->addElement('header', 'moodle', get_string('mail', 'block_email_list'));
     $mform->addElement('button', 'urlcc', get_string('participants', 'block_email_list') . '...', array('onclick' => "this.target='participants'; return openpopup('/blocks/email_list/email/participants.php?id={$COURSE->id}', 'participants', 'menubar=0,location=0,scrollbars=1,resizable,width=760,height=700', 0);"));
     // Mail to
     if ($CFG->email_enable_ajax) {
         $mform->addElement('html', '<div class="mform fitemtitle">' . get_string('for', 'block_email_list') . '</div>');
         // Add div html element
         $mform->addElement('html', '<div class="ajax_selected_participants">');
         // Added to allow for YUI autocomplete styling
         $mform->addElement('html', '<div class="yui-skin-sam">');
         // Change textarea to text.
         $mform->addElement('text', 'nameto', '', array('size' => '5', 'class' => 'ajax_textareacontacts'));
         // Stores the YUI autocomplete results
         $mform->addElement('static', 'qResultsTo', '', '<div id="qResultsTo"></div>');
         $mform->addElement('html', '</div>');
         // Close div html element
         $mform->addElement('html', '</div>');
     } else {
         $mform->addElement('textarea', 'nameto', get_string('for', 'block_email_list'), array('rows' => '2', 'cols' => '65', 'class' => 'textareacontacts', 'disabled' => 'true'));
     }
     // Mail cc
     if ($CFG->email_enable_ajax) {
         // Added to allow for YUI autocomplete styling
         $mform->addElement('html', '<div class="yui-skin-sam">');
         $mform->addElement('textarea', 'namecc', get_string('cc', 'block_email_list'), array('rows' => '1', 'cols' => '65', 'class' => 'textareacontacts', 'multiple' => 'multiple'));
         // Stores the YUI autocomplete results
         $mform->addElement('static', 'qResultsCC', '', '<div id="qResultsCC"></div>');
         $mform->addElement('html', '</div>');
     } else {
         $mform->addElement('textarea', 'namecc', get_string('cc', 'block_email_list'), array('rows' => '1', 'cols' => '65', 'class' => 'textareacontacts', 'disabled' => 'true'));
     }
     // Mail bcc
     if ($CFG->email_enable_ajax) {
         // Added to allow for YUI autocomplete styling
         $mform->addElement('html', '<div class="yui-skin-sam">');
         $mform->addElement('textarea', 'namebcc', get_string('bcc', 'block_email_list'), array('rows' => '1', 'cols' => '65', 'class' => 'textareacontacts', 'multiple' => 'multiple'));
         // Stores the YUI autocomplete results
         $mform->addElement('static', 'qResultsBCC', '', '<div id="qResultsBCC"></div>');
         $mform->addElement('html', '</div>');
     } else {
         $mform->addElement('textarea', 'namebcc', get_string('bcc', 'block_email_list'), array('rows' => '1', 'cols' => '65', 'class' => 'textareacontacts', 'disabled' => 'true'));
     }
     $mform->addElement('text', 'subject', get_string('subject', 'block_email_list'), 'class="emailsubject" maxlength="254" size="60"');
     $mform->setDefault('subject', '');
     $mform->addRule('subject', get_string('nosubject', 'block_email_list'), 'required', null, 'client');
     $mform->setType('nosubject', PARAM_MULTILANG);
     $this->set_upload_manager(new upload_manager('FILE', false, false, $COURSE, false, 0, true, true, false));
     // Add old attachments
     if (isset($oldmail->id)) {
         if ($oldmail->id > 0) {
             $email = new eMail();
             $email->set_email($oldmail);
             if ($email->has_attachments()) {
                 // Get mail attachments
                 $attachments = $email->get_attachments();
                 if ($attachments) {
                     $i = 0;
                     foreach ($attachments as $attachment) {
                         $mform->addElement('checkbox', 'oldattachment' . $i . 'ck', get_string('attachment', 'block_email_list'), $attachment->name);
                         $mform->setDefault('oldattachment' . $i . 'ck', true);
                         $mform->addElement('hidden', 'oldattachment' . $i, "{$attachment->path}/{$attachment->name}");
                         $i++;
                     }
                 }
             }
         }
     }
     // Upload files
     $mform->addElement('file', 'FILE_0', get_string('attachment', 'block_email_list'));
     $mform->addElement('link', 'addinput', '<img alt="' . get_string('attachment', 'block_email_list') . '" id="imgattachment" src="images/clip.gif" />', '#', get_string('anotherfile', 'block_email_list'), 'onclick="addFileInput(\'' . get_string("remove", "block_email_list") . '\');"');
     // Patch. Thanks
     /// TODO: Add all inputs files who added by user
     foreach ($_FILES as $key => $value) {
         if (substr($key, 0, strlen($key) - 1) == 'FILE_' && !$mform->elementExists($key)) {
             $mform->addElement('file', $key, '', 'value="' . $value . '"');
         }
     }
     $mform->addElement('htmleditor', 'body', get_string('body', 'block_email_list'), array('rows' => '25', 'cols' => '65'));
     $mform->setDefault('body', '');
     $mform->setType('body', PARAM_RAW);
     /// Add some extra hidden fields
     if (isset($oldmail->id)) {
         $mform->addElement('hidden', 'id', $oldmail->id);
     } else {
         $mform->addElement('hidden', 'id');
     }
     $mform->addElement('hidden', 'course', $COURSE->id);
     $mform->addElement('hidden', 'action', $action);
     $mform->addElement('hidden', 'to');
     $mform->addElement('hidden', 'cc');
     $mform->addElement('hidden', 'bcc');
     if (isset($oldmail->id)) {
         $mform->addElement('hidden', 'oldmailid', $oldmail->id);
     }
     // Add 3 buttons (Send, Draft, Cancel)
     $buttonarray = array();
     $buttonarray[] =& $mform->createElement('submit', 'send', get_string('send', 'block_email_list'));
     $buttonarray[] =& $mform->createElement('submit', 'draft', get_string('savedraft', 'block_email_list'));
     $buttonarray[] =& $mform->createElement('cancel');
     $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
     $mform->closeHeaderBefore('buttonar');
 }
示例#5
0
    }
    public abstract function loadBody();
}
class christmasEmailBody extends emailBodyDecorator
{
    public function loadBody()
    {
        echo 'This is Extra Content for Christmas<br />';
        $this->emailBody->loadBody();
    }
}
class newYearEmailBody extends emailBodyDecorator
{
    public function loadBody()
    {
        echo 'This is Extra Content for New Year.<br />';
        $this->emailBody->loadBody();
    }
}
$email = new eMail();
$email->loadBody();
$email = new eMail();
$email = new christmasEmailBody($email);
$email->loadBody();
$email = new eMail();
$email = new newYearEmailBody($email);
$email->loadBody();
$email = new eMail();
$email = new christmasEmailBody($email);
$email = new newYearEmailBody($email);
$email->loadBody();
 function cron()
 {
     global $CFG;
     echo "\n\n****** moodle_notifications :: begin ******";
     $User = new User();
     // clean deleted users data
     $User->collect_garbage();
     $Course = new Course();
     // clean deleted courses data
     $Course->collect_garbage();
     // get the list of courses that are using this block
     $courses = $Course->get_all_courses_using_moodle_notifications_block();
     // if no courses are using this block exit
     if (!is_array($courses) or count($courses) < 1) {
         echo "\n--> None course is using moodle_notifications plugin.";
         echo "\n****** moodle_notifications :: end ******\n\n";
         return;
     }
     foreach ($courses as $course) {
         // if course is not visible then skip
         if ($course->visible == 0) {
             continue;
         }
         // if the course has not been registered so far then register
         echo "\n--> Processing course: {$course->fullname}";
         if (!$Course->is_registered($course->id)) {
             $Course->register($course->id, time());
         }
         // check notification frequency for this course
         $course_registration = $Course->get_registration($course->id);
         // initialize user preferences and check for new enrolled users in this course
         $enrolled_users = $User->get_all_users_enrolled_in_the_course($course->id);
         foreach ($enrolled_users as $user) {
             // check if the user has preferences
             $user_preferences = $User->get_preferences($user->id, $course->id);
             // if the user has not preferences than set the default
             if (is_null($user_preferences)) {
                 $user_preferences = new Object();
                 $user_preferences->user_id = $user->id;
                 $user_preferences->course_id = $course->id;
                 $user_preferences->notify_by_email = $course_registration->email_notification_preset;
                 $user_preferences->notify_by_sms = $course_registration->sms_notification_preset;
                 $User->initialize_preferences($user_preferences->user_id, $user_preferences->course_id, $user_preferences->notify_by_email, $user_preferences->notify_by_sms);
             }
         }
         // if course log entry does not exist
         // or the last notification time is older than two days
         // then reinitialize course log
         if (!$Course->log_exists($course->id) or $course_registration->last_notification_time + 48 * 3600 < time()) {
             $Course->initialize_log($course);
         }
         // check notification frequency for the course and skip to next cron cycle if neccessary
         if ($course_registration->last_notification_time + $course_registration->notification_frequency > time()) {
             echo " - Skipping to next cron cycle.";
             continue;
         }
         $Course->update_log($course);
         // check if the course has something new or not
         $changelist = $Course->get_recent_activities($course->id);
         // update the last notification time
         $Course->update_last_notification_time($course->id, time());
         if (empty($changelist)) {
             continue;
         }
         // check the next course. No new items in this one.
         foreach ($enrolled_users as $user) {
             // get user preferences
             $user_preferences = $User->get_preferences($user->id, $course->id);
             // if the email notification is enabled in the course
             // and if the user has set the emailing notification in preferences
             // then send a notification by email
             if ($CFG->block_moodle_notifications_email_channel == 1 and $course_registration->notify_by_email == 1 and $user_preferences->notify_by_email == 1) {
                 $eMail = new eMail();
                 $eMail->notify($changelist, $user, $course);
             }
             // if the sms notification is enabled in the course
             // and if the user has set the sms notification in preferences
             // and if the user has set the mobile phone number
             // then send a notification by sms
             if (class_exists('SMS') and $CFG->block_moodle_notifications_sms_channel == 1 and $course_registration->notify_by_sms == 1 and $user_preferences->notify_by_sms == 1 and !empty($user->phone2)) {
                 $sms = new SMS();
                 $sms->notify($changelist, $user, $course);
             }
         }
     }
     echo "\n****** moodle_notifications :: end ******\n\n";
     return;
 }
示例#7
0
// Next and previous mails
$selectedusers = optional_param('selectedusers', '', PARAM_ALPHANUM);
// User who send mail
// If defined course to view
if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
    print_error('invalidcourseid', 'block_email_list');
}
if ($course->id == SITEID) {
    $coursecontext = get_context_instance(CONTEXT_SYSTEM);
    // SYSTEM context
} else {
    $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
    // Course context
}
// eMail
$email = new eMail();
$email->set_email($mailid);
require_login($course->id, false);
// No autologin guest
if (!email_is_enabled_email_list($course->id)) {
    print_error('blocknotavailable', 'block_email_list');
}
// Add log for one course
add_to_log($course->id, 'email_list', 'view mail', 'view.php?id=' . $mailid, 'View mail ' . $email->subject, 0, $USER->id);
/// Print the page header
$preferencesbutton = email_get_preferences_button($courseid);
$stremail = get_string('name', 'block_email_list');
// Add subject on information page
$stremail .= ' :: ' . $email->subject;
$PAGE->requires->js('/blocks/email_list/email/treemenu.js');
$PAGE->requires->js('/blocks/email_list/email/email.js');
示例#8
0
function sentmail($mailid, $msg, $sub)
{
    //mail('*****@*****.**', 'sendtestipn', 'sendtestipn');
    $html = true;
    $mail = new eMail("clubpedia@localhost", "*****@*****.**");
    $mail->subject($sub);
    $mail->to($mailid);
    // CC-Entf\E4nger angeben
    $mail->cc("*****@*****.**");
    // BCC-Entf\E4nger angeben
    $mail->bcc("*****@*****.**");
    $mail->html($msg);
    $mail->send();
}
示例#9
0
if (!$course->visible and has_capability('moodle/legacy:student', $context, $USER->id, false)) {
    print_error('courseavailablenot', 'moodle');
}
$options = new stdClass();
$options->course = $course->id;
$options->folderid = 0;
$baseurl = email_build_url($options);
$PAGE->requires->css('/blocks/email_list/email/email.css');
$PAGE->set_cacheable(true);
$PAGE->set_focuscontrol('');
$PAGE->set_heading('');
// Required
$PAGE->set_title(get_string('printpreview', 'block_email_list'));
echo $OUTPUT->header($navigation);
foreach ($mailids as $mailid) {
    $email = new eMail();
    $email->set_email((int) $mailid);
    $email->display($course->id, 0, false, false, $baseurl, $USER, false);
}
echo '<script type="text/javascript">
	<!--

	var da = (document.all) ? 1 : 0;
	var pr = (window.print) ? 1 : 0;
	var mac = (navigator.userAgent.indexOf("Mac") != -1);

	if (window.addEventListener) {
	    window.addEventListener(\'load\', printWin, false);
	} else if (window.attachEvent) {
	    window.attachEvent(\'onload\', printWin);
	} else if (window.onload != null) {
示例#10
0
                        <?php 
if (isset($_SESSION['userId']) && $_SESSION['userId'] >= 0) {
    echo '<strong>' . $_SESSION['username'] . '</strong>, sunteti deja autentificat. Nu aveti nevoie de recuperarea parolei.<br />';
} else {
    if ($submitOK) {
        // insert into db
        // user confirmation needed
        $sendToMail = $checkEmail[0]['email'];
        $sendToName = $checkEmail[0]['prenume'] . ' ' . $checkEmail[0]['nume'];
        if (!validate_email($sendToMail)) {
            $sendToMail = $checkEmail[0]['user_mct'];
        }
        $loginEmail = $checkEmail[0]['email'];
        $loginPass = $checkEmail[0]['parola'];
        // send confirmation email
        $mail = new eMail("Free Ex Admin", $configArray['notifyEmail']);
        // subiect = titlu
        $mail->subject("Free Ex Admin - Recuperare Parola");
        // to ...
        $mail->to($sendToName, $sendToMail);
        // HTML ...
        $doc = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">";
        $articolHTML_font = $doc . "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><title></title></head> ";
        $articolHTML_font .= "<body><br /> ";
        $articolHTML_font .= "<p>Recuperare Parola</p>\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<p>Ati primit acest email pentru ca dvs (sau cineva in numele dvs) ati completat formularul de recuperare parola de pe http://freeex.activewatch.ro/admin/.</p>\n\t\t\t\t\t\t\t\t\t\t\t\t<p>In cazul in care nu dvs ati cerut parola, va rugam sa ignorati acest mail.</p>\n\t\t\t\t\t\t\t\t\t\t\t\t\tDatele dvs de autentificare pe http://freeex.activewatch.ro/admin/ sunt:<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t---------------------------------------------------\n\t\t\t\t\t\t\t\t\t\t\t\t\t<p><table>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<tr><td width='30%'>Email: </td><td><strong>" . $loginEmail . "</strong></td></tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<tr><td width='30%'>Parola: </td><td><strong>" . $loginPass . "</strong></td></tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<tr><td width='30%'>URL: </td><td><a href=\"http://freeex.activewatch.ro/admin/\">http://freeex.activewatch.ro/admin/</td></tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</table></p>\n\t\t\t\t\t\t\t\t\t\t\t\t\t---------------------------------------------------\n\t\t\t\t\t\t\t\t\t\t\t\t\t<p>Va puteti autentifica acum folosind datele de mai sus.</p>\n\t\t\t\t\t\t\t\t\t\t\t\t<p>Va multumim!</p>\n\t\t\t\t\t\t\t\t\t\t\t\t---------------------------------------------------\n\t\t\t\t\t\t\t\t\t\t\t\t<p>Echipa Free Ex</p>";
        $articolHTML_font .= "</body></html>";
        $mail->html($articolHTML_font);
        $mail->send();
        echo '<p>Un email cu datele de acces a fost trimis la adresa completata de dvs. <br />
													 Verificati contul de email <strong>' . $sendToMail . '</strong> pentru datele de acces.<br /><br />Va multumim!</p>';
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
示例#11
0
     $afficheNotification_type = array(0 => "error");
     $afficheNotification_msg = array(0 => "L'échange que vous venez de faire a été cancellée, car la proposition était échue...");
     $afficheNotification_sticky = array(0 => "true");
 }
 if ($rtn == "cancel_ballotage") {
     $afficheNotification_type = array(0 => "error");
     $afficheNotification_msg = array(0 => "L'échange que vous venez d'accepter ne peut pas être complétée, car un des joueurs impliqué dans l'échange est donné en retour d'un ballotage.");
     $afficheNotification_sticky = array(0 => "true");
 }
 if ($rtn == "approbation") {
     $afficheNotification_type = array(0 => "warning");
     $afficheNotification_msg = array(0 => "Tous les échanges sont sous approbation du commissaire. Ce dernier y donnera suite dans les prochaines heures.");
     $afficheNotification_sticky = array(0 => "true");
     // envoie d'un email aux admin du pool (et TOUJOURS moi...)
     require_once "class.mail.php";
     $email = new eMail($poolName, "{$poolName}@lamoria.ca");
     $email->subject("{$poolName} - Transaction en attente d'approbation");
     $email->html("Aller sur le site en Admin pour approuver/supprimer la transaction. http://www.{$poolName}.lamoria.ca");
     $email->to("*****@*****.**");
     $q = "select email from accounts\n                     where\n                         id_pool = {$id_pool}\n                         and saison_id = {$id_saison}\n                         and admin = 'Y'";
     $resultID = mysql_query($q, $pool->handle);
     while ($data = mysql_fetch_array($resultID, MYSQL_ASSOC)) {
         $emails = $data['email'];
         $emailA = explode(";", $emails);
         foreach ($emailA as $this_email) {
             if ($this_email == "") {
                 continue;
             }
             $email->to($this_email);
         }
     }
示例#12
0
//$in7days = mktime(0, 0, 0, date("m"), date("d")+7, date("Y"));
//$in14days = mktime(0, 0, 0, date("m"), date("d")+14, date("Y"));
$cases = $db->GetAll("SELECT `ca_number_c`, `ca_court_fee_date_d`, UNIX_TIMESTAMP(`ca_court_fee_date_d`) as termin, `ca_agent_id_k`, `ca_debtor_id_k`, `ca_creditor_id_k` FROM `wind_case` WHERE DATE_ADD(`ca_court_fee_date_d`, INTERVAL 7 DAY) <= '" . date("Y-m-d") . "' AND DATE_ADD(`ca_court_fee_date_d`, INTERVAL 14 DAY) >= '" . date("Y-m-d") . "' AND `ca_court_fee_paid_i`=0 AND ca_stage_e <> 'ep' AND ca_close_i=0");
if (count($cases) > 0) {
    foreach ($cases as $_id => $C) {
        $email = $db->GetOne("SELECT cu_email_c FROM wind_users WHERE cu_id_s=" . $C['ca_agent_id_k']);
        if ($email) {
            $dluznik = $db->GetOne("SELECT c_shortname_c FROM wind_client WHERE c_id_s=" . $C['ca_debtor_id_k']);
            $wierzyciel = $db->GetOne("SELECT c_shortname_c FROM wind_client WHERE c_id_s=" . $C['ca_creditor_id_k']);
            $tin14days = mktime(0, 0, 0, date("m", $C['termin']), date("d", $C['termin']) + 14, date("Y", $C['termin']));
            $admin_letter = new eMail(2);
            $admin_letter->eMailContent(iconv('ISO-8859-2', 'UTF-8', 'Opłata sądowa sprawy ' . $C['ca_number_c']), '<html><head><title>Opłata sądowa sprawy ' . $C['ca_number_c'] . '</title></head><body>Termin zapłacenia opłaty sądowej w sprawie o numerze ' . $C['ca_number_c'] . ' mija ' . date("d.m.Y", $tin14days) . "\n" . '<br><br>Dłużnik: ' . $dluznik . "\n" . '<br>Wierzyciel: ' . $wierzyciel . "\n" . '</body></html>');
            $admin_letter->eMailSend($email);
        }
    }
}
//przeholowane
$cases = $db->GetAll("SELECT `ca_number_c`, `ca_court_fee_date_d`, UNIX_TIMESTAMP(`ca_court_fee_date_d`) as termin, `ca_agent_id_k`, `ca_debtor_id_k`, `ca_creditor_id_k` FROM `wind_case` WHERE DATE_ADD(`ca_court_fee_date_d`, INTERVAL 14 DAY) < '" . date("Y-m-d") . "' AND `ca_court_fee_paid_i`=0 AND ca_stage_e <> 'ep' AND ca_close_i=0");
if (count($cases) > 0) {
    foreach ($cases as $_id => $C) {
        $email = $db->GetOne("SELECT cu_email_c FROM wind_users WHERE cu_id_s=" . $C['ca_agent_id_k']);
        if ($email) {
            $tin14days = mktime(0, 0, 0, date("m", $C['termin']), date("d", $C['termin']) + 14, date("Y", $C['termin']));
            $dluznik = $db->GetOne("SELECT c_shortname_c FROM wind_client WHERE c_id_s=" . $C['ca_debtor_id_k']);
            $wierzyciel = $db->GetOne("SELECT c_shortname_c FROM wind_client WHERE c_id_s=" . $C['ca_creditor_id_k']);
            $admin_letter = new eMail(2);
            $admin_letter->eMailContent(iconv('ISO-8859-2', 'UTF-8', 'Opłata sądowa sprawy ' . $C['ca_number_c']), '<html><head><title>Opłata sądowa sprawy ' . $C['ca_number_c'] . '</title></head><body>Termin zapłacenia opłaty sądowej w sprawie o numerze ' . $C['ca_number_c'] . ' minął ' . date("d.m.Y", $tin14days) . "\n" . '<br><br>Dłużnik: ' . $dluznik . "\n" . '<br>Wierzyciel: ' . $wierzyciel . "\n" . '</body></html>');
            $admin_letter->eMailSend($email);
        }
    }
}
示例#13
0
文件: send.php 项目: bogorya/kancbfl
<?php

if ($_GET['xyz'] == 789) {
    require "./include/mail.php";
    $admin_letter = new eMail(2);
    $admin_letter->eMailContent('Testowy email', 'Nagłówek' . "\n" . 'Content' . "\n" . 'Stopka');
    $admin_letter->eMailSend('*****@*****.**');
}
     $success = true;
     foreach ($mailids as $mail) {
         $email = new eMail();
         $email->set_email($mail);
         $success &= $email->mark2read($USER->id, $courseid, true);
     }
     if ($success) {
         notify(get_string('toreadok', 'block_email_list'), 'notifysuccess');
     } else {
         notify(get_string('failmarkreaded', 'block_email_list'));
     }
     break;
 case 'tounread':
     $success = true;
     foreach ($mailids as $mail) {
         $email = new eMail();
         $email->set_email($mail);
         $success &= $email->mark2unread($USER->id, $courseid, true);
     }
     if ($success) {
         notify(get_string('tounreadok', 'block_email_list'), 'notifysuccess');
     } else {
         notify(get_string('failmarkunreaded', 'block_email_list'));
     }
     break;
 case 'move2folder':
     // In variable folderid
     $success = true;
     // Move mails -- This variable is an array of ID's
     if (is_array($mailid)) {
         foreach ($mailid as $mail) {
}
/// first create the form
$mailform = new mail_edit_form('sendmail.php', array('oldmail' => get_record('email_mail', 'id', $mailid), 'action' => $action), 'post', '', array('name' => 'sendmail'));
if ($mailform->is_cancelled()) {
    // Only redirect
    redirect($CFG->wwwroot . '/blocks/email_list/email/index.php?id=' . $courseid, '', '0');
} else {
    if ($form = $mailform->get_data()) {
        if (empty($form->to) and empty($form->cc) and empty($form->bcc)) {
            notify(get_string('nosenders', 'block_email_list'));
            $mailform->set_data($form);
            $mailform->display();
        } else {
            if (!empty($form->send) or !empty($form->draft)) {
                // Create new eMail
                $email = new eMail($USER->id, $courseid);
                // User send mail
                $email->set_writer($USER->id);
                $email->set_course($courseid);
                // Generic URL for send mails errors
                $baseurl = $CFG->wwwroot . '/blocks/email_list/email/index.php?id=' . $courseid . '&amp;mailid=' . $form->id . '&amp;subject=\'' . $form->subject . '\'&amp;body=\'' . $form->body . '\'';
                // Add subject
                $email->set_subject($form->subject);
                // Get upload file's
                $email->set_attachments(isset($_FILES) ? $_FILES : NULL);
                // If forward or draft mail, can do old attachments
                $i = 0;
                $oldattach = 'oldattachment' . $i;
                if (isset($form->{$oldattach})) {
                    $attachments = array();
                    while (true) {
            }
        }
    }
}
// security: teachers can view all assignments, students only their own
if (count($args) >= 3 and strtolower($args[1]) == 'moddata' and strtolower($args[2]) == 'assignment') {
    $lifetime = 0;
    // do not cache assignments, students may reupload them
    if (!has_capability('mod/assignment:grade', get_context_instance(CONTEXT_COURSE, $course->id)) and $args[4] != $USER->id) {
        print_error('Access not allowed');
    }
}
// Antoni Mas: eMail Security
if (strtolower($args[3]) == 'email') {
    // Get mail
    $email = new eMail();
    $email->set_email($args[5]);
    if (!$email->can_readmail($USER)) {
        print_error('Access not allowed');
    }
}
// security: force download of all attachments submitted by students
if (count($args) >= 3 and strtolower($args[1]) == 'moddata' and (strtolower($args[2]) == 'forum' or strtolower($args[2]) == 'assignment' or strtolower($args[2]) == 'data' or strtolower($args[2]) == 'glossary' or strtolower($args[2]) == 'wiki' or strtolower($args[2]) == 'exercise' or strtolower($args[2]) == 'workshop')) {
    $forcedownload = 1;
    // force download of all attachments
}
if ($args[0] == 'blog') {
    $forcedownload = 1;
    // force download of all attachments
}
// security: some protection of hidden resource files
示例#17
0
    foreach ($data2 as $item2A) {
        $id_gerant = $item2A['id'];
        $emails = $item2A['email'];
        $morning_email = $item2A['morning_email'];
        $realName = $item2A['real_name'];
        //if ($id_gerant != 13) continue;
        // 1ere adresse email seulement...
        $ar = split(";", $emails);
        $email = $ar[0];
        if ($morning_email == "Y") {
            $url = "http://www.lamoria.ca/interPool/src/morning_email.php?id_pool={$id_pool}&id_saison={$id_saison}&gerant={$id_gerant}&periode={$periode}&poolName={$poolName}";
            $lines = file($url);
            $body = "";
            foreach ($lines as $line) {
                $body .= "{$line}\n";
            }
            $url = "http://www.lamoria.ca/interPool/src/morning_email3.php?id_pool={$id_pool}&id_saison={$id_saison}&gerant={$id_gerant}&periode={$periode}&poolName={$poolName}";
            $lines = file($url);
            foreach ($lines as $line) {
                $body .= "{$line}\n";
            }
            $_email = new eMail(strtoupper($poolName), strtolower($poolName) . "@lamoria.ca");
            $_email->to($email);
            $_email->subject($subject);
            $_email->html($body);
            $_email->send();
        }
    }
    DB::dbClose();
}
unlink($SUCCESSFILE);