<commit_before><?php
/**
 * EmailerController
 *
 * @uses AppController
 * @package   CTLT.iPeer
 * @author    <NAME> <<EMAIL>>
 * @copyright 2012 All rights reserved.
 * @license   MIT {@link http://www.opensource.org/licenses/MIT}
 */
class EmailerController extends AppController
{
    public $name = 'Emailer';
    public $uses = array('GroupsMembers', 'UserEnrol', 'User', 'EmailTemplate', 'EmailMerge',
        'EmailSchedule', 'Personalize', 'SysParameter', 'SysFunction', 'Group', 'Course');
    public $components = array('AjaxList', 'Session', 'RequestHandler', 'Email');
    public $helpers = array('Html', 'Ajax', 'Javascript', 'Time', 'Js' => array('Prototype'));
    public $show;
    public $sortBy;
    public $direction;
    public $page;
    public $order;
    public $Sanitize;

    /**
     * __construct
     *
     * @access protected
     * @return void
     */
    function __construct()
    {
        $this->Sanitize = new Sanitize;
        $this->show = empty($_GET['show'])? 'null':$this->Sanitize->paranoid($_GET['show']);
        if ($this->show == 'all') {
            $this->show = 99999999;
        }
        $this->sortBy = empty($_GET['sort'])? 'EmailSchedule.date': $_GET['sort'];
        $this->direction = empty($_GET['direction'])? 'desc': $this->Sanitize->paranoid($_GET['direction']);
        $this->page = empty($_GET['page'])? '1': $this->Sanitize->paranoid($_GET['page']);
        $this->order = $this->sortBy . ' ' . strtoupper($this->direction);
        $this->pageTitle = 'Email';
        $this->mergeStart = '{{{';
        $this->mergeEnd = '}}}';
        parent::__construct();
    }

    /**
     * setUpAjaxList
     *<commit_msg>Allow unauthed access to emailer/send.<commit_after><?php
/**
 * EmailerController
 *
 * @uses AppController
 * @package   CTLT.iPeer
 * @author    <NAME> <<EMAIL>>
 * @copyright 2012 All rights reserved.
 * @license   MIT {@link http://www.opensource.org/licenses/MIT}
 */
class EmailerController extends AppController
{
    public $name = 'Emailer';
    public $uses = array('GroupsMembers', 'UserEnrol', 'User', 'EmailTemplate', 'EmailMerge',
        'EmailSchedule', 'Personalize', 'SysParameter', 'SysFunction', 'Group', 'Course');
    public $components = array('AjaxList', 'Session', 'RequestHandler', 'Email');
    public $helpers = array('Html', 'Ajax', 'Javascript', 'Time', 'Js' => array('Prototype'));
    public $show;
    public $sortBy;
    public $direction;
    public $page;
    public $order;
    public $Sanitize;

    /**
     * __construct
     *
     * @access protected
     * @return void
     */
    function __construct()
    {
        $this->Sanitize = new Sanitize;
        $this->show = empty($_GET['show'])? 'null':$this->Sanitize->paranoid($_GET['show']);
        if ($this->show == 'all') {
            $this->show = 99999999;
        }
        $this->sortBy = empty($_GET['sort'])? 'EmailSchedule.date': $_GET['sort'];
        $this->direction = empty($_GET['direction'])? 'desc': $this->Sanitize->paranoid($_GET['direction']);
        $this->page = empty($_GET['page'])? '1': $this->Sanitize->paranoid($_GET['page']);
        $this->order = $this->sortBy . ' ' . strtoupper($this->direction);
        $this->pageTitle = 'Email';
        $this->mergeStart = '{{{';
        $this->mergeEnd = '}}}';
        parent::__construct();
    }

    function beforeFilter() {
        parent::beforeFilter();
        // Need to be able to cron job send, so should allow unauthed access
        $this->Auth->allow('send');
    }

    /**
     * setUpAjaxList
     *
{'fraction_non_alphanumeric': 0.19287917017101205, 'fraction_numerical': 0.007289038407625455, 'mean_word_length': 3.0361990950226243, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1771792', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1100, 'n_words': 227}