[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.147.6.58: ~ $
<?php

class campaignslicer extends phplistPlugin {
    public $name = "Send to a subset of the total campaign";
    public $coderoot = '';
    public $version = "0.2";
    public $authors = 'Michiel Dethmers';
    public $enabled = 1;
    public $description = 'Send to a maximum of subscribers in a campaign, instead of all';

    private $actions = array(
        'suspend' => 'Suspend',
        'marksent' => 'Mark as sent',
    );
    private $yesno = array(
        'no' => 'No',
        'yes' => 'Yes',
    );

    public function sendMessageTab($messageId = 0, $messageData = array()) {

        $actionHTML = '<select name="campaignslicer_action">';
        foreach ($this->actions as $key => $val) {
            $actionHTML .= sprintf('<option value="%s" ',$key);
            if (isset($messageData['campaignslicer_action']) && $messageData['campaignslicer_action'] == $key) {
                $actionHTML .= 'selected="selected" ';
            }
            $actionHTML .= '>'.s($val).'</option>';
        }
        $actionHTML .= '</select>';
        $randomHTML = '<select name="campaignslicer_random">';
        foreach ($this->yesno as $key => $val) {
            $randomHTML .= sprintf('<option value="%s" ',$key);
            if (isset($messageData['campaignslicer_random']) && $messageData['campaignslicer_random'] == $key) {
                $randomHTML .= 'selected="selected" ';
            }
            $randomHTML .= '>'.s($val).'</option>';
        }
        $randomHTML .= '</select>';

        $html = sprintf('
            <table>
            <tr>
                <td>'.s('Maximum subscribers to send').'<br/><p class="small">'.s('Use 0 to send to all').'</p></td>
                <td><input type="text" name="%s_max" value="%d" /></td>
            </tr>
            <tr>
                <td>'.s('Action when maximum reached').'</td>

                <td>%s</td>
            </tr>
            <tr>
                <td>'.s('Randomize the subscribers').'<br/><p class="small">'.s('This will slow down the sending process').'</p></td>

                <td>%s</td>
            </tr>
            </table>','campaignslicer',isset($messageData['campaignslicer_max']) ? $messageData['campaignslicer_max']:'',$actionHTML,$randomHTML);

        return $html;
    }

    public function sendMessageTabTitle($messageid = 0)
    {
        return s('Slice');
    }

    public function viewMessage($messageid, array $messagedata) 
    {
        $key = s('Maximum slice').'<br/>'.s('Action when reached');
        $val = $messageData['campaignslicer_max'].'<br/>'.
        $messageData['campaignslicer_action'];
        return array($key,$val);
    }

    public function throttleSend($messageData, $userData)
    {
        $max = (int) $messageData['campaignslicer_max'];
        if ($max <= 0) return false;

        $totalsent = (int) $messageData['astext'] +
            $messageData['ashtml'] +
            $messageData['astextandhtml'] +
            $messageData['aspdf'] +
            $messageData['astextandpdf'] +
            $messageData['counters']['sent_users_for_message '.$messageData['id']];

        if ($totalsent >= $max) {
            switch ($messageData['campaignslicer_action']) {
                case 'marksent':
                    Sql_query(sprintf('update %s set status = "sent" where id = %d',$GLOBALS['tables']['message'], $messageData['id']));
                    logEvent(s('Campaign %d finished by campaign slicer plugin, MAX of %d reached', $messageData['id'],$messageData['campaignslicer_max']));
                    break;
                case 'suspend':
                default:
                    Sql_query(sprintf('update %s set status = "suspended" where id = %d',$GLOBALS['tables']['message'], $messageData['id']));
                    logEvent(s('Campaign %d suspended by campaign slicer plugin, MAX of %d reached', $messageData['id'],$messageData['campaignslicer_max']));
                    break;
            }

            return true;
        }
        if ($messageData['campaignslicer_random'] == 'yes') {
            $segmentSize = (int) ($messageData['counters']['total_users_for_message '.$messageData['id']] / $max);
            if (rand(1,$segmentSize) == 1) {
                return false;
            } else {
                return true;
            }
        }

        return false;
    }

    public function dependencyCheck() {
        global $plugins;
        return array(
            'phpList version 3.3.3 or later' => version_compare(VERSION, '3.3.3') > 0,
        );
    }
}

Filemanager

Name Type Size Permission Actions
CKEditorPlugin Folder 0755
CaptchaPlugin Folder 0755
Common Folder 0755
CommonPlugin Folder 0755
SegmentPlugin Folder 0755
UpdaterPlugin Folder 0755
fckphplist Folder 0755
.htaccess File 462 B 0644
CKEditorPlugin.php File 15.15 KB 0644
COPYING.txt File 34.32 KB 0644
CaptchaPlugin.php File 8.85 KB 0644
CommonPlugin.php File 6.63 KB 0644
SegmentPlugin.php File 17.99 KB 0644
UpdaterPlugin.php File 2.04 KB 0644
campaignslicer.php File 4.44 KB 0644
dateplaceholder.php File 4.77 KB 0644
disposablemailblock.php File 9.69 KB 0644
domainthrottlemap.php File 12.41 KB 0644
embedremoteimages.php File 2.49 KB 0644
fckphplist.php File 2.74 KB 0644
inviteplugin.php File 3.89 KB 0644
subjectLinePlaceholdersPlugin.php File 5.27 KB 0644
update.sh File 66 B 0644