<commit_before><?php
class page_download_box extends Page {
    function init(){
        parent::init();

        $file='agiletoolkit-4.1.3.zip';

        $cc=$this->add('Columns');
        $l=$cc->addColumn(6);
        $r=$cc->addColumn(6);

        $l->add('P')->set('Agile Toolkit <a href="'.
                $this->api->getDestinationURL('about/license')
                .'">promotes Open Source</a> by granting freedom to access open-source to you and users of your software.');

        $l->add('Can')->set('Your software users must have access to software sources.');
        $l->add('Can')->set('Any use (personal, commercial or educational) is permitted.');
        $l->add('Can')->set('You <u>may</u> charge for or sell software based on Agile Toolkit.');
        $l->add('Can')->set('Use with unlimited CPUs, Domains, Users and Developers.');
        $l->add('Cant')->set('You may not Encrypt, Obfuscate or Hide your source code.');
        $l->add('Cant')->set('You may not re-release Agile Toolkit under different license.');

        $p=$l->add('P');
        $p->add('Text')->set('Alternatively: ');
        $p->add('HtmlElement')->set('explore closed-source licensing options.')->setElement('a')->setAttr('href',$this->api->getDestinationURL('commercial/store'));

        $form=$l->add('Form');
        if($this->api->auth->isLoggedIn()){
            $email=$form->addField('line','email','Valid email');
            $email->js(true)->attr('disabled',true);
            $email->set($this->api->auth->get('email'));
            $email->add('HtmlElement',null,'after_field')
                ->setElement('a')
                ->setStyle('padding-left','5px')
                ->setAttr('href',$this->api->getDestinationURL('logout'))
                ->set('Logout');
        }else{
            $email=$form->addField('line','email','Valid email');
            $email->validateNotNULL('Valid Email is required to continue with download')->validateField(function($field){
                    // TODO: var_filter

                    // TODO: check domain's MX and rcpt-to

            });
        }
        $email->setFieldHint('for critical update notifications and log-in on agiletoolkit.org only');
        $form->setFormClass('vertical');
        $form->add('P')->set('By downloading you agree with terms of AGPL license.');
        $form->addSubmit('Download');


        if($form->isSubmitted()){

            $this->api->dbConnectATK();
            if($this->api->auth->isLoggedIn()){
                $id=$this->api->auth->get('id');
            }else{
                $id=$form->add('Model_ATK_User_Pending')->softRegister($form->get('email'));
            }
            $this->add('Model_ATK_Download')->set(array(
                        'file'=>$file,
                        'atk_user_id'=>$id
                        ))->update();

            $form->js()->closest('.atk4_loader')->load($this->api->getDestinationURL('download/success',
                        array('file'=>$file,'cut_page'=>1)))->execute();<commit_msg>bugfix<commit_after><?php
class page_download_box extends Page {
    function init(){
        parent::init();

        $file='agiletoolkit-4.1.3.zip';

        $cc=$this->add('Columns');
        $l=$cc->addColumn(6);
        $r=$cc->addColumn(6);

        $l->add('P')->set('Agile Toolkit <a href="'.
                $this->api->getDestinationURL('about/license')
                .'">promotes Open Source</a> by granting freedom to access open-source to you and users of your software.');

        $l->add('Can')->set('Your software users must have access to software sources.');
        $l->add('Can')->set('Any use (personal, commercial or educational) is permitted.');
        $l->add('Can')->set('You <u>may</u> charge for or sell software based on Agile Toolkit.');
        $l->add('Can')->set('Use with unlimited CPUs, Domains, Users and Developers.');
        $l->add('Cant')->set('You may not Encrypt, Obfuscate or Hide your source code.');
        $l->add('Cant')->set('You may not re-release Agile Toolkit under different license.');

        $p=$l->add('P');
        $p->add('Text')->set('Alternatively: ');
        $p->add('HtmlElement')->set('explore closed-source licensing options.')->setElement('a')->setAttr('href',$this->api->getDestinationURL('commercial/store'));

        $form=$l->add('Form');
        if($this->api->auth->isLoggedIn()){
            $email=$form->addField('line','email','Valid email');
            $email->js(true)->attr('disabled',true);
            $email->set($this->api->auth->get('email'));
            $email->add('HtmlElement',null,'after_field')
                ->setElement('a')
                ->setStyle('padding-left','5px')
                ->setAttr('href',$this->api->getDestinationURL('logout'))
                ->set('Logout');
        }else{
            $email=$form->addField('line','email','Valid email');
            $email->validateNotNULL('Valid Email is required to continue with download')->validateField(function($field){
                    // TODO: var_filter

                    // TODO: check domain's MX and rcpt-to

            });
        }
        $email->setFieldHint('for critical update notifications and log-in on agiletoolkit.org only');
        $form->setFormClass('vertical');
        $form->add('P')->set('By downloading you agree with terms of AGPL license.');
        $form->addSubmit('Download');


        if($form->isSubmitted()){

            $this->api->dbConnectATK();
            if($this->api->auth->isLoggedIn()){
                $id=$this->api->auth->get('id');
            }else{
                $id=$form->add('Model_ATK_User_Pending')->softRegister($form->get('email'));
            }
            $this->add('Model_ATK_Download')->set(array(
                        'file'=>$file,
                        'atk_user_id'=>$id
                        ))->update();

            $form->js()->closest('.atk4_loader')->load($this->api->getDestinationURL('download/success',
                        array('t_register'=>false,'file'=>$file,'cut_page'=>1)))->execute();
{'fraction_non_alphanumeric': 0.1958695295853139, 'fraction_numerical': 0.0026225208982134074, 'mean_word_length': 2.399442896935933, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 170, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6679736', 'n_tokens_mistral': 1754, 'n_tokens_neox': 1703, 'n_words': 311}