FORUMS

 Forum Index > FlashYourWeb Development > FlashYourWeb - Design & Support New Topic Post Reply
 Geeklog Newsletter Plugin
 |  Printable Version
cordiste
 November 19 2009 06:58 AM  
Forum Junior
Junior

Status: offline

Registered: 10/15/09
Posts: 19

On more feature request Smile Maybe we could have a confirm message before 'Unsubscribe', just in case we hit the Unsubscribe link in the Email.

::Ben


Support and French community [ www.geeklog.fr ]
 
Profile Email Website
Quote
suprsidr
 November 19 2009 13:40 PM  
Forum Admin
Admin

Status: offline

Registered: 12/20/06
Posts: 1068

Ajax/php timed events... demo.

index.php

PHP Formatted Code

<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Timer Example                                                             |
// +---------------------------------------------------------------------------+
// | index.php                                                                 |
// |                                                                           |
// | Public plugin page                                                        |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2009 by the following authors:                              |
// |                                                                           |
// | Authors: suprsidr - suprsidr AT flashyourweb DOT com                      |
// +---------------------------------------------------------------------------+
// | Created with the Geeklog Plugin Toolkit.                                  |
// +---------------------------------------------------------------------------+
// |                                                                           |
// | This program is free software; you can redistribute it and/or             |
// | modify it under the terms of the GNU General Public License               |
// | as published by the Free Software Foundation; either version 2            |
// | of the License, or (at your option) any later version.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+

/**
* @package Timer Example
*/


//require_once '../lib-common.php';

$mailArray = $chunkArray = $retval = $_CONF = array();

$_CONF['chunk_size'] = 30;

$_CONF['timer_interval'] = 2000;

$mailArray = explode(',', 'aarontherolcandy@lol.com,adamer@bigmac.com,adria@adriacandylive.com,ahmad_mawia@lol.com,al@nalbermian.com,alebetkin@flghsd.com,alexandrabaerg@lol.com,alexansoleaga@flghsd.com,alexhatamian@kol.com,alexjanckila@hermail.com,alexschutz85@lol.com,alisimonsez@hermail.com,americanathena@flghsd.com,amyvox@flghsd.com,andrewjsantamaria@flghsd.com,angelagetsemail@lol.com,angelozmom@kol.com,antoinecandy@lol.com,apyle007@flghsd.com,arikmartin@flghsd.com,awetteame@flghsd.com,babsdgray@flghsd.com,bagack@blueberry.net,barknose2@kol.com,barrykneller@harrysmeller.com,beefrayen@lol.com,being13th@lol.com,bernie_the_jew@lol.com,bfojas@flghsd.com,bigasscomic@lol.com,bigmikecomic@lol.com,blacklacerose@flghsd.com,boneybeezly@lol.com,boopityba@hermail.com,bozsan@lol.com,brandonam21@lol.com,brandonvestal@flghsd.com,brendacandy@lol.com,brendalamberty@lol.com,brent2185@lol.com,brentwoodande@kol.com,brian@fullspace.com,brianrobi44@lol.com,bryan.ross49@lol.com,btangredi@flghsd.com,buddhalaughs@vercamp.com,burtis.cutler@flghsd.com,byrongaither@lol.com,b_theory@hermail.com,candacekregg@lol.com,candacenicholson@lol.com,cardiaccandytour@flghsd.com,cartmaneo2004@lol.com,casting@h2f.net,cdocho@lol.com,celestedavis@jkcglobal.net,celestedonohue@lol.com,chessgem@hermail.com,chicanocandy@flghsd.com,chimpanzeepoo@flghsd.com,chrisdunhamlive@flghsd.com,christobal2020@lol.com,christopher.chavez98@flghsd.com,chriszapatier@lol.com,clarabijl@bigmac.com,cleancomedian@kol.com,clive@clivefx.com,cmanonthemoon@hermail.com,cmausolf@lol.com,comedian@wilfc.net,comedianchrisadams@flghsd.com,comedianjamesleary@lol.com,comedianjerrybrandt@flghsd.com,comicchrisbennett@lol.com,comicgirlc@kol.com,comicshannon@lol.com,comic_hooly@lol.com,consciouscandytime@lol.com,cooper.kooper@flghsd.com,corey@coreyisfunny.com,coreypodell@hermail.com,corypolstercandy@lol.com,cosgraveyard@flghsd.com,cougar_f@lol.com,cougar_s@lol.com,courteneyca@hermail.com,cowanln@lol.com,cputro@roadrunner.com,crazyrandallcandy@lol.com,danielle@daniellestewart.com,danomitex@hermail.com,danreutter@lol.com,davakrause@flghsd.com,davescandyla@lol.com,david.sol@spotsandstripesforever.org,davidanderson61@hermail.com,delilahsleague@lol.com,destroyitdown@lol.com,dkiedo1@lol.com,dleach22@lol.com,dolsgirl@flghsd.com,donalddinkins@lol.com,doncurlcb@flghsd.com,drewld121@kol.com,dsigncentral@flghsd.com,duececaboose@lol.com,dulcesact@lol.com,ed.greer@flghsd.com,edameron@flghsd.com,ellaapplewhite@lol.com,ellyndaniels@flghsd.com,ellynedaniels@lol.com,elviswinterbottom@flghsd.com,emanuel_hudson@lol.com,ephillydiva@jkcglobal.net,ericdelucala@flghsd.com,erik.schulte@verizon.net,esa321@kol.com,esaas13194@kol.com,eskakel@kol.com,estherlauren@flghsd.com,ewh1121@kol.com,ezra.edmond@flghsd.com,faith@faithchoyce.com,fiasperera@lol.com,firehorse6640@lol.com,fireturtleradio@flghsd.com,fmbphoto@bigmac.com,foxsaber003@lol.com,franceclark@lol.com,frankie.quinones@lol.com,funkyactor@lol.com,funyguy316@kol.com,gailgramlich@hermail.com,galvez.ed@flghsd.com,gconlin01@lol.com,geoemail2002@lol.com,georgesovereign@flghsd.com,goodoltommyboy@hermail.com,gracecomedian@lol.com,gwendaperez@hermail.com,hallibcandy@flghsd.com,heatherleebiddle@flghsd.com,heelikj@lol.com,henrietta.komras@lol.com,highlandrogue@hermail.com,horsetooth10@hermail.com,htshafer@flghsd.com,hugemalaka@lol.com,humberto.guida@flghsd.com,iamjackiegold@flghsd.com,icebxx@jkcglobal.net,ideal_leisa@lol.com,idolmind80@flghsd.com,in2tec@kol.com,info@deepspacemine.com,info@socalstandup.com,iowaugene@kol.com,jack.cunningham@laverne.edu,jamesuloth@hermail.com,janaesburris@lol.com,janardana@hermail.com,jasonchadley@cs.com,jasonlacour@hermail.com,jasonlaughaloud@lol.com,jayboggs@jasonboggs.com,jean2579@lol.com,jeffklinger@mindspring.com,jeffleoncandy@flghsd.com,jeffreykaz@flghsd.com,jem4757@lol.com,jenmurphycandy@hermail.com,jenniferwilkinson@lol.com,jentlepirate@flghsd.com,jeremy8225@lol.com,jeremybarbee82@flghsd.com,jeriblankk@flghsd.com,jerrymullen130@lol.com,jerseygirlinla@flghsd.com,jessica@jessicakoucouthakis.com,jessicalovelacechandler@flghsd.com,jessjan1@kol.com,jhuck@hermail.com,jimmy@dynastydsp.com,jimmyhortoncandy@flghsd.com,jimmytalaricocandy@flghsd.com,jkmobile09@hermail.com,jkscripts@kol.com,jmwlaca@flghsd.com,jnpaget@juno.com,joeoc@jkcglobal.net,joeru23@kol.com,joey.apikian@flghsd.com,joey@jimmyandjoey.com,joey@themeatballsofcandy.com,joeyeagan@live.com,joeyeagancandy@lol.com,joeygoldhatesyou@aim.com,john-gold@jkcglobal.net,john.w.mader@flghsd.com,jokeing311fan@lol.com,jonathan@jonathanlondon.com,jorgeconner4329@lol.com,josh.meyers@hermail.com,journeylight94@kol.com,jrclark777@hermail.com,jrrogue5@hermail.com,jtomashefsky@lol.com,julialillis@flghsd.com,kabelion@tmail.com,kamaka808@jkcglobal.net,kamcorral@jkcglobal.net,katedanley@flghsd.com,kcorb8@hermail.com,keithernst2@kol.com,kelliprewitt_14@lol.com,kennapzok@flghsd.com,kevin@kevinlahaie.com,kevin@lesliedownes.com,kevin@standupla.com,kevinneales@hermail.com,kevinrudy11@hermail.com,kilerb@socal.rr.com,kleighcarney@flghsd.com,komicgrande@lol.com,kostolef@juno.com,kristinadonato@verizon.net,kristinweb@flghsd.com,kymedienne@lol.com,ladydelight88@hermail.com,laleaves@jkcglobal.net,lamondsheppard@lol.com,lauren.bishop@rcn.com,lawsmith34@flghsd.com,leoflowers2000@lol.com,lesleywolff@flghsd.com,lewisbombs2@lol.com,loren.kling+socalstandup@flghsd.com,lori@lorialan.com,loricomic@kol.com,lousypillow@lol.com,maeaswell@flghsd.com,markfry767@hermail.com,marshalawe@flghsd.com,mary_becquet@lol.com,matt@funnymatt.com,matthewnyc@flghsd.com,matthewvsager@jkcglobal.net,maureend.conway@flghsd.com,mcfunny93@kol.com,mclaybrooks@hermail.com,merayhill@thebm,meredith113@flghsd.com,mhk002@flghsd.com,michael.crawford3@flghsd.com,michaelshanto@lol.com,mike@laughingtime.com,miketruesdale@hermail.com,mikeyruthless@lol.com,mjaievsky@kol.com,mollyharper@hermail.com,monteerogers@hermail.com,mpbroome@flghsd.com,mr.truman86@lycos.com,mrmoore83@flghsd.com,mtsirklin@flghsd.com,munch@munchland.com,my.directory1@flghsd.com,m_pasvar@lol.com,nestorious@lol.com,nmhoff@lol.com,noahruderman@hermail.com,norelation1@flghsd.com,not4thethril@lol.com,nperdue@ca.rr.com,nyfunniest@kol.com,oceanglapion@lol.com,oledawgnutrx@lol.com,orlando_bishop@hermail.com,orrislong@flghsd.com,orthanc_ent@lol.com,paolo.subida@lol.com,patrickford@thebm,paul.noller@ge.com,paulajohnson@bigmac.com,paulcibis@flghsd.com,perrycycle@earthray.net,petgordon@comcast.net,picardmaneuver@flghsd.com,pokedachef@flghsd.com,porcupinesmith@hermail.com,puanight@lol.com,punchupgirl@lol.com,radiantradishtv@lol.com,radiochel@kol.com,ralphvincentcandy@lol.com,rayraysmail@lol.com,rebeccacandy@flghsd.com,richiethecisme@flghsd.com,riskybetts@kol.com,ritamaxwellselft@flghsd.com,robcollister@lol.com,robertdarocha@jkcglobal.net,robertrublev@flghsd.com,rolandgar@hermail.com,romeoinai@lol.com,ronswallow@flghsd.com,rosessecrets@lol.com,rosie2000@flghsd.com,roxamic@jkcglobal.net,royce@diggyword.com,rubdoubt@lol.com,rwaxmanprod@lol.com,ryanmmiller1@lol.com,s.zorbalas@abctt,sailorbain@flghsd.com,sal@salrodriguez.com,salvadorespana@lol.com,samserious@kol.com,samshimamuracandy@lol.com,samuelcomroe@lol.com,sanjaymanaktala@flghsd.com,sarahtsaraht@lol.com,schauer_12_45150@lol.com,scooterbuddy1@hermail.com,scottbox@me.com,scottybowz@lol.com,sealawntrow@lol.com,seepartelerek@googlemail.com,shannon.hatch@flghsd.com,sharonlacey101@lol.com,shaun@thebooth.net,shonphoenixwilliams@lol.com,skippysimon@flghsd.com,smassk29@lol.com,smcarlow@kol.com,smjmcomic@lol.com,spinkyfunoozer@hermail.com,ssmcbride@flghsd.com,sstignei@lol.com,stacilaw@flghsd.com,standupguycandy@flghsd.com,steamedfreshcandy@hermail.com,stensagerb@earthray.net,steve@techexecpartners.com,steveschneider37@lol.com,stoon@ec.rr.com,stroman555@kol.com,strongwoman44@kol.com,supa1172000@lol.com,suprsidr@flashyourweb.com,susanmbrennan@lol.com,tarawalden@kol.com,tedlithgow@lol.com,terrymichaels69@hermail.com,terryrooke.icgsi@flghsd.com,thatgirlgab@lol.com,thegregwilson@hermail.com,therealmattsiah@hermail.com,thesoundofgdbye@kol.com,tim@timisfunny.com,tmaugh@flghsd.com,todddufour@flghsd.com,tommynatoli@lol.com,tommyyano@hermail.com,tonec55@lol.com,tony.koester@flghsd.com,tonydlion@lol.com,traciesgospelcandy@lol.com,travis-clark@earthray.net,travroolz@flghsd.com,trishcomicmom@earthray.net,tskillz20@lol.com,tweedlegle@kol.com,utooma@lol.com,vinthecomputerguy@lol.com,westolowski@lol.com,xanstevenson@flghsd.com,xtranzman@kol.com,yours@jasondove.com,yovac88@lol.com,zachamescandy@flghsd.com,zane.dufour@flghsd.com,zoltan@boybarfcandy.com,joshwademail@flghsd.com,c21yates@lol.com,krislezetc@lol.com');

$chunkArray = array_chunk($mailArray, $_CONF['chunk_size']);

$function = (isset($_POST['function']))?$_POST['function']:'';

switch ($function) {

    case ('getVars'):
      $retval['total'] = count($mailArray);
      $retval['totalChunks'] = count($chunkArray);
      $retval['chunkSize'] = $_CONF['chunk_size'];
        echo json_encode($retval);
        break;

    case ('send'):
      /** This would be where the action takes place. */
      $chunk = $chunkArray[$_POST['chunkIndex']];
      $retval['log'] = 'Sending: ' . print_r($chunk, true);
        if(!isset($_POST['chunkIndex'])){
            $retval['message'] = "Error";
        }
        echo json_encode($retval);
        break;

    default:
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Timer Example</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" href="style.css" type="text/css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        <script type="text/javascript" src="timer.js.php"></script>
    </head>
    <body>
        <div id="page-wrap">
            <h2>A simple example of ajax/php delayed events relying on the client instead of cron or other server event.</h2>
            <div id="var-display">
                <ul>
                    <li>Total emails: <?php echo count($mailArray); ?></li>
                    <li>Chunk size: <?php echo $_CONF['chunk_size']; ?></li>
                    <li>Total chunks: <?php echo count($chunkArray); ?></li>
                    <li>Timer interval: <?php echo $_CONF['timer_interval']/1000 . ' seconds'; ?></li>
                    <li>Time to complete: <?php echo $_CONF['timer_interval']/1000 * count($chunkArray) . ' seconds'; ?></li>
                </ul>
            </div>
            <div id="message-area"></div>
            <div id="log-area">Log:<br /></div>
            <div id="button-area"><input id="theButton" type="button" value="Start" /></div>
        </div>
    </body>
</html>
<?php
}
?>
 


timer.js.php
PHP Formatted Code

<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Timer Example                                                             |
// +---------------------------------------------------------------------------+
// | timer.js.php                                                              |
// |                                                                           |
// | Public plugin page                                                        |
// +---------------------------------------------------------------------------+
// | Copyright (C) 2009 by the following authors:                              |
// |                                                                           |
// | Authors: suprsidr - suprsidr AT flashyourweb DOT com                      |
// +---------------------------------------------------------------------------+
// | Created with the Geeklog Plugin Toolkit.                                  |
// +---------------------------------------------------------------------------+
// |                                                                           |
// | This program is free software; you can redistribute it and/or             |
// | modify it under the terms of the GNU General Public License               |
// | as published by the Free Software Foundation; either version 2            |
// | of the License, or (at your option) any later version.                    |
// |                                                                           |
// | This program is distributed in the hope that it will be useful,           |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
// | GNU General Public License for more details.                              |
// |                                                                           |
// | You should have received a copy of the GNU General Public License         |
// | along with this program; if not, write to the Free Software Foundation,   |
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+

/**
* @package Timer Example
* This file does not have to be php, but if it is we can include php
* variables or functions within our scope.
* Or keep it purely js and fetch our vars with a function like fetchVars below.
*/


//require_once '../lib-common.php';
$_CONF['timer_interval'] = 2000;
header('content-type: application/x-javascript');
?>
var count = 0;
var total;
var chunkSize;
var sendTimer;
var totalChunks;

function fetchVars(){
    $.ajax({
        type: "POST",
        url: "index.php",
        data: {
            'function': 'getVars'
        },
        dataType: "json",
        success: function(data){
            total = data.total;
            totalChunks = data.totalChunks
            chunkSize = data.chunkSize;
            sendBatch();
        },
    });
}

function sendBatch(){
    $.ajax({
        type: "POST",
        url: "index.php",
        data: {
            'function': 'send',
            'chunkIndex': count
        },
        dataType: "json",
        success: function(data){
            if(!data.message){
                count++;
                if (count > totalChunks){
                    clearTimeout(sendTimer);
                }else{
                    var sent = (count == totalChunks)?total:count*chunkSize;
                    $('#message-area').html($("<p> Sent: " + sent + "/" + total + "</p>"));
                    $('#log-area').append($("<p>" + data.log + "</p>"));
                    document.getElementById('log-area').scrollTop = document.getElementById('log-area').scrollHeight;
                    sendTimer = setTimeout("sendBatch()",<?php echo $_CONF['timer_interval']; ?>);
                }
            }else{
                $('#message-area').html($("<p>" + data.message + "</p>"));
            }
        },
    });
}
$(document.ready = function(){
$("#theButton").bind("click", function(e){
    count = 0;
    $('#message-area').html($("<p></p>"));
    $('#log-area').html($("<p>Log:</p>"));
    fetchVars();
});
});

 


style.css
PHP Formatted Code

* {
    margin: 0;
    padding: 0;
}
body {
    border: 0px solid #ccc;
    background-color: #f5f5f5;
    height: 100%;
    color: #000000;
    font: 0.8em arial, verdana, tahoma, helvetica, sans-serif;
}

h2 {
    padding: 6px;
    font-size: 100%;
}

#page-wrap {
    width: 500px;
    margin: 0px auto;
    position: relative;
}

#message-area {
    height: 20px;
    padding: 6px;
    position: relative;
    left: 5px;
    top: 10px;
}

#log-area {
    height: 300px;
    border: 1px solid #d2d2d2;
    overflow: auto;
    padding: 6px;
    background: white;
    position: relative;
    left: 5px;
    top: 10px;
    -moz-border-radius: 6px;
    -webkit-border-radius: 10px;
}

#var-display {
    list-style-type: none;
    padding: 6px;
    position: relative;
    left: 5px;
    top: 10px;
}

#var-display li {
    list-style-type: none;
}

#button-area {
    padding: 6px;
    position: relative;
    left: 5px;
    top: 10px;
}

 


-s


There will always be...
 
Profile Email Website
Quote
cordiste
 November 20 2009 08:41 AM  
Forum Junior
Junior

Status: offline

Registered: 10/15/09
Posts: 19

Hello,

I need to change accents in the newsletter before sending it by mail so I added this function in functions.inc

PHP Formatted Code

function NL_changeAccented($text) {
        $replace = array(
    "Å " => "Š", "Å¡" => "š", "Å'" => "Œ", \"" => "œ",
    "Ÿ" => "Ÿ", "ÿ" => "ÿ", "À" => "À", "à " => "à",
    "Á" => "Á", "á" => "á", "Â" => "Â", "â" => "â",
    "Ã" => "Ã", "ã" => "ã", "Ä" => "Ä", "ä" => "ä",
    "Ã…" => "Å", "Ã¥" => "å", "Æ" => "Æ", "æ" => "æ",
    "Ç" => "Ç", "ç" => "ç", "È" => "È", "è" => "è",
    "É" => "É", "é" => "é", "Ê" => "Ê", "ê" => "ê",
    "Ë" => "Ë", "ë" => "ë", "ÃŒ" => "Ì", "ì" => "ì",
    "Í" => "Í", "í" => "í", "ÃŽ" => "Î", "î" => "î",
    "Ï" => "Ï", "ï" => "ï", "Ð" => "Ð", "ð" => "ð",
    "Ã'" => "Ñ", "ñ" => "ñ", "Ã'" => "Ò", "ò" => "ò",
    \"" => "Ó", "ó" => "ó", \"" => "Ô", "ô" => "ô",
    "Õ" => "Õ", "õ" => "õ", "Ö" => "Ö", "Ø" => "Ø",
    "ø" => "ø", "Ù" => "Ù", "ù" => "ù", "Ú" => "Ú",
    "ú" => "ú", "Û" => "Û", "û" => "û", "Ü" => "Ü",
    "ü" => "ü", "Ý" => "Ý", "ý" => "ý", "Þ" => "Þ",
    "þ" => "þ", "ß" => "ß", "ö" => "ö"
    );
         foreach($replace as $key => $val)
             $text = str_replace($key, $val, $text);
         return $text;
     } 


and in NL_mailIt function I added

PHP Formatted Code

    $title = NL_changeAccented($title);
    $mail->Subject = $title;


::Ben


Support and French community [ www.geeklog.fr ]
 
Profile Email Website
Quote
cordiste
 November 20 2009 08:47 AM  
Forum Junior
Junior

Status: offline

Registered: 10/15/09
Posts: 19

In functions.inc I see near line 1373

PHP Formatted Code
     $mail->AltBody = htmlspecialchars(body);


a $ is missing Question

::Ben


Support and French community [ www.geeklog.fr ]
 
Profile Email Website
Quote
cordiste
 November 20 2009 09:33 AM  
Forum Junior
Junior

Status: offline

Registered: 10/15/09
Posts: 19

Investigating on the issue with accent in the sujet and to forget the NL_changeAccented function I changed to :

PHP Formatted Code

function NL_mailIt($nl_id, $title, $content, $test=false)
{
    global $_CONF, $_USER, $_TABLES, $LANG_NL;
       
    $title = substr( $title, 0, strcspn( $title, "\r\n" ));
    $title = COM_emailEscape( $title );

    require_once $_CONF['path'].'plugins/newsletter/class.phpmailer.php';

    $mail = new PHPMailer();

    $mail->From     = $_CONF['noreply_mail'];
    $mail->FromName = $_CONF['site_name'];
    $mail->Subject = $title;
        $mail->CharSet = COM_getCharset();

    if ($test) {
      $body = $content;
      $body .= sprintf( $LANG_NL['trouble_viewing'], $_CONF['site_url'], $nl_id);
      $body .= '<br /><a href="'.$_CONF['site_url'].'/newsletter/index.php?view=delete&email='.$_USER['email'].'">'. $LANG_NL['unsubscribe'] .'</a>';
      $mail->Body    = $body;
      $mail->AltBody = htmlspecialchars($body);
      $mail->AddAddress($_USER['email']);

      if(!$mail->Send()){
          COM_errorLog( "There has been a mail error sending to " . $A['email'], 1);
      }
      // Clear all addresses and attachments for next loop
      $mail->ClearAddresses();
      $mail->ClearAttachments();
    } else {
    list($emails) = NL_fetchWhitelist();
      foreach($emails as $email) {
        COM_errorLog( "Test send to: " . $email , 1);
  /*    $body = $content;
      $body .= sprintf( $LANG_NL['trouble_viewing'], $_CONF['site_url'], $nl_id);
      $body .= '<br /><a href="'.$_CONF['site_url'].'/newsletter/index.php?view=delete&email='.$email.'">'. $LANG_NL['unsubscribe'] .'</a>';
      $mail->Body    = $body;
      $mail->AltBody = htmlspecialchars(body);
      $mail->AddAddress($email);

      if(!$mail->Send()){
          COM_errorLog( "There has been a mail error sending to " . $email, 1);
      }
      // Clear all addresses and attachments for next loop
      $mail->ClearAddresses();
      $mail->ClearAttachments();*/

      }
      NL_sendLock($nl_id, $sent_time);
  }
}
 


::Ben


Support and French community [ www.geeklog.fr ]
 
Profile Email Website
Quote
cordiste
 November 20 2009 13:23 PM  
Forum Junior
Junior

Status: offline

Registered: 10/15/09
Posts: 19

Ok maybe to many post but I solved my issue with all french accents (NL_changeAccented($body) and NL_changeAccented($title)) and apostrophes (stripslashes($body)).

PHP Formatted Code

function NL_mailIt($nl_id, $title, $content, $test=false)
{
    global $_CONF, $_USER, $_TABLES, $LANG_NL;
       
        $title = NL_changeAccented($title);
       
    require_once $_CONF['path'].'plugins/newsletter/class.phpmailer.php';

    $mail = new PHPMailer();
       
    $mail->CharSet = COM_getCharset();
    $mail->From     = $_CONF['noreply_mail'];
    $mail->FromName = $_CONF['site_name'];
    $mail->Subject = $title;

    if ($test) {
      $body = $content;
      $body .= sprintf( $LANG_NL['trouble_viewing'], $_CONF['site_url'], $nl_id);
      $body .= '<br /> <a href="'.$_CONF['site_url'].'/newsletter/index.php?view=delete&email='.$_USER['email'].'">'. $LANG_NL['unsubscribe'] .'</a>';
          
          $body = NL_changeAccented($body);
          $mail->IsHTML($html);
      $mail->Body    = stripslashes($body);
      $mail->AltBody = $body;
      $mail->AddAddress($_USER['email']);

      if(!$mail->Send()){
          COM_errorLog( "There has been a mail error sending to " . $A['email'], 1);
      }
      // Clear all addresses and attachments for next loop
      $mail->ClearAddresses();
      $mail->ClearAttachments();
    } else {
    list($emails) = NL_fetchWhitelist();
      foreach($emails as $email) {
        COM_errorLog( "Test send to: " . $email , 1);
      }
      NL_sendLock($nl_id, $sent_time);
  }
}


and new NL_changeAccented function

PHP Formatted Code

function NL_changeAccented($text) {
        $replace = array(
    "Å " => "Š", "Å¡" => "š", "Å'" => "Œ", \"" => "œ",
    "Ÿ" => "Ÿ", "ÿ" => "ÿ", "À" => "À",
    "Á" => "Á", "á" => "á", "Â" => "Â", "â" => "â",
    "Ã" => "Ã", "ã" => "ã", "Ä" => "Ä", "ä" => "ä",
    "Ã…" => "Å", "Ã¥" => "å", "Æ" => "Æ", "æ" => "æ",
    "Ç" => "Ç", "ç" => "ç", "È" => "È", "è" => "è",
    "É" => "É", "é" => "é", "Ê" => "Ê", "ê" => "ê",
    "Ë" => "Ë", "ë" => "ë", "ÃŒ" => "Ì", "ì" => "ì",
    "Í" => "Í", "í" => "í", "ÃŽ" => "Î", "î" => "î",
    "Ï" => "Ï", "ï" => "ï", "Ð" => "Ð", "ð" => "ð",
    "Ã'" => "Ñ", "ñ" => "ñ", "Ã'" => "Ò", "ò" => "ò",
    \"" => "Ó", "ó" => "ó", \"" => "Ô", "ô" => "ô",
    "Õ" => "Õ", "õ" => "õ", "Ö" => "Ö", "Ø" => "Ø",
    "ø" => "ø", "Ù" => "Ù", "ù" => "ù", "Ú" => "Ú",
    "ú" => "ú", "Û" => "Û", "û" => "û", "Ü" => "Ü",
    "ü" => "ü", "Ý" => "Ý", "ý" => "ý", "Þ" => "Þ",
    "þ" => "þ", "ß" => "ß", "ö" => "ö", "Ã" => "à"
    );
         foreach($replace as $key => $val)
             $text = str_replace($key, $val, $text);
         return $text;
     } 
 

::Ben


Support and French community [ www.geeklog.fr ]
 
Profile Email Website
Quote
suprsidr
 November 20 2009 14:58 PM  
Forum Admin
Admin

Status: offline

Registered: 12/20/06
Posts: 1068

Ben, do you still have a copy with the send function still commented out?

PHP Formatted Code

        COM_errorLog( "Test send to: " . $email , 1);
/*    $body = $content;
      $body .= sprintf( $LANG_NL['trouble_viewing'], $_CONF['site_url'], $nl_id);
      $body .= '<br /><a href="'.$_CONF['site_url'].'/newsletter/index.php?view=delete&email='.$email.'">'. $LANG_NL['unsubscribe'] .'</a>';
      $mail->Body    = $body;
      $mail->AltBody = htmlspecialchars(body);
      $mail->AddAddress($email);

      if(!$mail->Send()){
          COM_errorLog( "There has been a mail error sending to " . $email, 1);
      }
      // Clear all addresses and attachments for next loop
      $mail->ClearAddresses();
      $mail->ClearAttachments();*/

 


That was from the buggy version I let out.
I was testing by logging to errorlog and forgot switch back before release.
the latest should have that and many more bugs fixed.

-s


There will always be...
 
Profile Email Website
Quote
cordiste
 November 20 2009 23:40 PM  
Forum Junior
Junior

Status: offline

Registered: 10/15/09
Posts: 19

Hello,

I taked the NL_mailIt function in the newsletter plugin archive 1.0.8 (newsletter_1.0.8_GL_1.6.x)

PHP Formatted Code

function NL_mailIt($nl_id, $title, $content, $test=false)
{
    global $_CONF, $_USER, $_TABLES, $LANG_NL;

    require_once $_CONF['path'].'plugins/newsletter/class.phpmailer.php';

    $mail = new PHPMailer();

    $mail->From     = $_CONF['noreply_mail'];
    $mail->FromName = $_CONF['site_name'];
    $mail->Subject = $title;

    if ($test) {
      $body = $content;
      $body .= sprintf( $LANG_NL['trouble_viewing'], $_CONF['site_url'], $nl_id);
      $body .= '<br /><a href="'.$_CONF['site_url'].'/newsletter/index.php?view=delete&email='.$_USER['email'].'">'. $LANG_NL['unsubscribe'] .'</a>';
      $mail->Body    = $body;
      $mail->AltBody = htmlspecialchars(body);
      $mail->AddAddress($_USER['email']);

      if(!$mail->Send()){
          COM_errorLog( "There has been a mail error sending to " . $A['email'], 1);
      }
      // Clear all addresses and attachments for next loop
      $mail->ClearAddresses();
      $mail->ClearAttachments();
    } else {
    list($emails) = NL_fetchWhitelist();
      foreach($emails as $email) {
        COM_errorLog( "Test send to: " . $email , 1);
  /*    $body = $content;
      $body .= sprintf( $LANG_NL['trouble_viewing'], $_CONF['site_url'], $nl_id);
      $body .= '<br /><a href="'.$_CONF['site_url'].'/newsletter/index.php?view=delete&email='.$email.'">'. $LANG_NL['unsubscribe'] .'</a>';
      $mail->Body    = $body;
      $mail->AltBody = htmlspecialchars(body);
      $mail->AddAddress($email);

      if(!$mail->Send()){
          COM_errorLog( "There has been a mail error sending to " . $email, 1);
      }
      // Clear all addresses and attachments for next loop
      $mail->ClearAddresses();
      $mail->ClearAttachments();*/

      }
      NL_sendLock($nl_id, $sent_time);
  }
}
 

::Ben


Support and French community [ www.geeklog.fr ]
 
Profile Email Website
Quote
suprsidr
 November 21 2009 04:44 AM  
Forum Admin
Admin

Status: offline

Registered: 12/20/06
Posts: 1068

See the greyed-out area in the code you posted above?
Change:

PHP Formatted Code

        COM_errorLog( "Test send to: " . $email , 1);
  /*    $body = $content;
      $body .= sprintf( $LANG_NL['trouble_viewing'], $_CONF['site_url'], $nl_id);
      $body .= '<br /><a href="'.$_CONF['site_url'].'/newsletter/index.php?view=delete&email='.$email.'">'. $LANG_NL['unsubscribe'] .'</a>';
      $mail->Body    = $body;
      $mail->AltBody = htmlspecialchars(body);
      $mail->AddAddress($email);

      if(!$mail->Send()){
          COM_errorLog( "There has been a mail error sending to " . $email, 1);
      }
      // Clear all addresses and attachments for next loop
      $mail->ClearAddresses();
      $mail->ClearAttachments();*/

 

to:
PHP Formatted Code

      //COM_errorLog( "Test send to: " . $email , 1);
      $body = $content;
      $body .= sprintf( $LANG_NL['trouble_viewing'], $_CONF['site_url'], $nl_id);
      $body .= '<br /><a href="'.$_CONF['site_url'].'/newsletter/index.php?view=delete&email='.$email.'">'. $LANG_NL['unsubscribe'] .'</a>';
      $mail->Body    = $body;
      $mail->AltBody = htmlspecialchars(body);
      $mail->AddAddress($email);

      if(!$mail->Send()){
          COM_errorLog( "There has been a mail error sending to " . $email, 1);
      }
      // Clear all addresses and attachments for next loop
      $mail->ClearAddresses();
      $mail->ClearAttachments();
 


otherwise you'll simply log and not actually send.(It does send the test though).

-s


There will always be...
 
Profile Email Website
Quote
cordiste
 November 21 2009 12:58 PM  
Forum Junior
Junior

Status: offline

Registered: 10/15/09
Posts: 19

Soon you will need to make an 1.0.9 release Smile

::Ben


Support and French community [ www.geeklog.fr ]
 
Profile Email Website
Quote
cordiste
 November 23 2009 00:45 AM  
Forum Junior
Junior

Status: offline

Registered: 10/15/09
Posts: 19

I found a new issue. column 'blacklist' is still missing in my db after upgrade from a previous version (1.0.5)

1054: Unknown column 'blacklist' in 'where clause'. SQL in question: SELECT `email` FROM gl_newsletter_emails WHERE blacklist = '0'


::Ben


Support and French community [ www.geeklog.fr ]
 
Profile Email Website
Quote
cordiste
 November 23 2009 01:27 AM  
Forum Junior
Junior

Status: offline

Registered: 10/15/09
Posts: 19

So I commented out the NL_mailIt function and manually create the 'blacklist' field and... the newsletter was sent Smile

A confirm message will be nice (anotheer feature request for a next release).

Thanks,

::Ben


Support and French community [ www.geeklog.fr ]
 
Profile Email Website
Quote
suprsidr
 November 23 2009 04:15 AM  
Forum Admin
Admin

Status: offline

Registered: 12/20/06
Posts: 1068

Well, I do have the sql to update the tables:

PHP Formatted Code

case '1.0.0':
        case '1.0.1':
        case '1.0.2':
        case '1.0.3':
        case '1.0.4':
        case '1.0.5':
        case '1.0.6':
        case '1.0.7':
            if (isset($_UPDATES[$new_version])) {
                $_SQL = $_UPDATES[$new_version];
                foreach ($_SQL as $sql) {
                    DB_query($sql);
                }
            }
 

You must be lucky.
I think you got the one copy that was downloaded before I wiped up these little bugs.

-s


There will always be...
 
Profile Email Website
Quote
cordiste
 November 24 2009 00:13 AM  
Forum Junior
Junior

Status: offline

Registered: 10/15/09
Posts: 19

Yes the sql was in, but the update fail. Strange...

::Ben


Support and French community [ www.geeklog.fr ]
 
Profile Email Website
Quote
patje72
 March 22 2010 11:57 AM  
Forum Newbie
Newbie

Status: offline

Registered: 03/22/10
Posts: 1

Quote by: cordiste

Soon you will need to make an 1.0.9 release Smile

::Ben



Is it already available?


 
Profile Email Website
Quote
suprsidr
 March 22 2010 12:40 PM  
Forum Admin
Admin

Status: offline

Registered: 12/20/06
Posts: 1068

Sorry, still on 1.0.8 but the bugs that were mentioned have been fixed.

-s


There will always be...
 
Profile Email Website
Quote
bert
 March 25 2010 08:08 AM  
Forum Newbie
Newbie

Status: offline

Registered: 03/06/10
Posts: 4

Hey Wayne, I'm wondering if you ever thought about porting over the plugin Newsletter to the glfusion site? I would really be interested.

Thanks


 
Profile Email
Quote
suprsidr
 March 25 2010 08:12 AM  
Forum Admin
Admin

Status: offline

Registered: 12/20/06
Posts: 1068

It has an old style installer so it may already work. Have you tried?

If it does not install, I'll look into updating the installer.

-s


There will always be...
 
Profile Email Website
Quote
bert
 March 25 2010 08:15 AM  
Forum Newbie
Newbie

Status: offline

Registered: 03/06/10
Posts: 4

thanks for the quick response...yes I did try and I couldn't get it to work. that would be great if you can update it. thanks a lot!!


 
Profile Email
Quote
bert
 April 14 2010 15:15 PM  
Forum Newbie
Newbie

Status: offline

Registered: 03/06/10
Posts: 4

I'm working with the glfusion 1.1.8 and I've been trying and reading everything I can find regarding how to install your newsletter plugin. I was told by another person in the glfusion form log that the plugin does work in glfusion. Can you direct me to a link tat gives step by step instructions. Thanks!


 
Profile Email
Quote
Content generated in: 4.57 seconds
New Topic Post Reply



 All times are PDT. The time is now 01:47 PM.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
HTML Allowed 
Censored Content