<commit_before><?php
class Wub_Memory_Edit extends Wub_Memory
{
    function __construct($options = array())
    {
        $this->importance = 20;
        
        parent::__construct($options);
    }
    
    function handlePost($options = array())
    {
        //Make sure everything is filled out.
        if (!isset($_POST['subject']) || empty($_POST['subject'])) {
            throw new Exception("No subject provided");
        }
        
        if (!isset($_POST['details']) || empty($_POST['details'])) {
            throw new Exception("no details provided");
        }
        
        if (!isset($_POST['permission']) || empty($_POST['permission'])) {
            throw new Exception("no permission provided");
        }
        
        if (!isset($_POST['start_date']) || empty($_POST['start_date'])) {
            throw new Exception("no start date provided");
        }
        
        if (!isset($_POST['importance']) || empty($_POST['importance'])) {
            throw new Exception("no importance provided");
        }
        
        if ($_POST['importance'] < 1 || $_POST['importance'] > 100) {
            throw new Exception("Importance must be between 1 and 100");
        }
        
        $_POST['start_date'] = strtotime($_POST['start_date']);
        
        if (isset($_POST['end_date']) && !empty($_POST['end_date'])) {
            $_POST['end_date'] = strtotime($_POST['end_date']);
        } else {
            $this->end_date = 0;
        }
        
        $options['continueURL'] = 'view';
        
        parent::handlePost($options);
    }
}<commit_msg>make sure that the start date and end dates are logical.<commit_after><?php
class Wub_Memory_Edit extends Wub_Memory
{
    function __construct($options = array())
    {
        $this->importance = 20;
        
        parent::__construct($options);
    }
    
    function handlePost($options = array())
    {
        //Make sure everything is filled out.
        if (!isset($_POST['subject']) || empty($_POST['subject'])) {
            throw new Exception("No subject provided");
        }
        
        if (!isset($_POST['details']) || empty($_POST['details'])) {
            throw new Exception("no details provided");
        }
        
        if (!isset($_POST['permission']) || empty($_POST['permission'])) {
            throw new Exception("no permission provided");
        }
        
        if (!isset($_POST['start_date']) || empty($_POST['start_date'])) {
            throw new Exception("no start date provided");
        }
        
        if (!isset($_POST['importance']) || empty($_POST['importance'])) {
            throw new Exception("no importance provided");
        }
        
        if ($_POST['importance'] < 1 || $_POST['importance'] > 100) {
            throw new Exception("Importance must be between 1 and 100");
        }
        
        $_POST['start_date'] = strtotime($_POST['start_date']);
        
        if (isset($_POST['end_date']) && !empty($_POST['end_date'])) {
            $_POST['end_date'] = strtotime($_POST['end_date']);
        } else {
            $_POST['end_date'] =  $_POST['start_date'];
        }
        
        if ($_POST['end_date'] < $_POST['start_date']) {
            throw new Exception("That makes no sense silly.  Make sure you have the dates right.");
        }
        
        $options['continueURL'] = 'view';
        
        parent::handlePost($options);
    }
}
{'fraction_non_alphanumeric': 0.1607454863133372, 'fraction_numerical': 0.00611531741409435, 'mean_word_length': 2.128415300546448, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '3479788', 'n_tokens_mistral': 915, 'n_tokens_neox': 894, 'n_words': 203}