<commit_before><?php

/**
 * Class Dashboard
 * This is a demo controller that simply shows an area that is only visible for the logged in user
 * because of Auth::handleLogin(); in line 19.
 */
class Dashboard extends Controller
{
    /**
     * Construct this object by extending the basic Controller class
     */
    function __construct()
    {
        parent::__construct();

        // this controller should only be visible/usable by logged in users, so we put login-check here
        Auth::handleLogin();
    }

    /**
     * This method controls what happens when you move to /dashboard/index in your app.
     */
    function index()
    {
        $this->view->render('dashboard/index');
    }

    /**
     * This method controls what happens when you move to /dashboard/index in your app.
     */
    function control()
    {
        $this->view->render('dashboard/index');
    }
    function admin()
    {
        $this->view->render('dashboard/admin');
    }
    function photos()
    {
        $this->view->render('dashboard/photos',true);
    }
    function promos()
    {
        $this->view->render('dashboard/promos',true);
    }
    function push()
    {
        $this->view->render('dashboard/push',true);
    }
    function add_new_promo() {
        include_once('/home/content/59/13071759/html/config/index.php');
        $config = new Blog();
        $_POST['promo_key'] = $config->generateRandomString();
        if ($_POST['add_new_promo']==1) {
            //print_r($_POST);
            echo $config->add_info_promo('images',$_POST);
        } else {
            $this->view->render('dashboard/add_new_promo',true);
        }
    }



    function add_to_files() {
        include_once('/home/content/59/13071759/html/config/index.php');
        $config = new Blog();
        $_POST['promo_key'] = $config->generateRandomString();
        echo $config->add_info_files('files',$_POST);
    }


    function attach() {
        // include_once('/home/content/59/13071759/html/config/index.php');
        // $config = new Blog();
        // $_POST['promo_key'] = $config->generateRandomString();
        // echo $config->add_info_files('files',$_POST);
        print_r($_POST);
        if (isset($_POST['file_id'])) {
            echo 'okay updating';
        } else {
            $this->view->render('dashboard/attach',true);
        }

    }




    function delete_promo_file($id) {
        // print_r($_POST);
        include_once('/home/content/59/13071759/html/config/index.php');
        $config = new Blog();
        $promo_data = $config->get_info('images', $_POST['promo_id']);
        $attached_files = $promo_data['files_attached'];
        $new = str_replace($id.',', '', $attached_files);
        if ($config->update_promo('images','files_attached', $new , $_POST['promo_id'])) {
            echo 'it worked!';
        } else {
            echo 'it didnt worked!';
        }
        // echo '---- so now delete the '.$id;
        // echo '--- and put out the new '. $new;

    }

    <commit_msg>completed the adding of files to different already-existing promotions<commit_after><?php

/**
 * Class Dashboard
 * This is a demo controller that simply shows an area that is only visible for the logged in user
 * because of Auth::handleLogin(); in line 19.
 */
class Dashboard extends Controller
{
    /**
     * Construct this object by extending the basic Controller class
     */
    function __construct()
    {
        parent::__construct();

        // this controller should only be visible/usable by logged in users, so we put login-check here
        Auth::handleLogin();
    }

    /**
     * This method controls what happens when you move to /dashboard/index in your app.
     */
    function index()
    {
        $this->view->render('dashboard/index');
    }

    /**
     * This method controls what happens when you move to /dashboard/index in your app.
     */
    function control()
    {
        $this->view->render('dashboard/index');
    }
    function admin()
    {
        $this->view->render('dashboard/admin');
    }
    function photos()
    {
        $this->view->render('dashboard/photos',true);
    }
    function promos()
    {
        $this->view->render('dashboard/promos',true);
    }
    function push()
    {
        $this->view->render('dashboard/push',true);
    }
    function add_new_promo() {
        include_once('/home/content/59/13071759/html/config/index.php');
        $config = new Blog();
        $_POST['promo_key'] = $config->generateRandomString();
        if ($_POST['add_new_promo']==1) {
            //print_r($_POST);
            echo $config->add_info_promo('images',$_POST);
        } else {
            $this->view->render('dashboard/add_new_promo',true);
        }
    }



    function add_to_files() {
        include_once('/home/content/59/13071759/html/config/index.php');
        $config = new Blog();
        $_POST['promo_key'] = $config->generateRandomString();
        echo $config->add_info_files('files',$_POST);
    }


    function attach() {

        if (isset($_POST['file_id'])) {
            include_once('/home/content/59/13071759/html/config/index.php');
            $config = new Blog();
            echo 'okay updating';
        echo $config->attach_files($_POST['file_id'],$_POST['promo_id']);

        } else {
            $this->view->render('dashboard/attach',true);
        }

    }




    function delete_promo_file($id) {
        // print_r($_POST);
        include_once('/home/content/59/13071759/html/config/index.php');
        $config = new Blog();
        $promo_data = $config->get_info('images', $_POST['promo_id']);
        $attached_files = $promo_data['files_attached'];
        $new = str_replace($id.',', '', $attached_files);
        if ($config->update_promo('images','files_attached', $new , $_POST['promo_id'])) {
            echo 'it worked!';
        } else {
            echo 'it didnt worked!';
        }
        // echo '---- so now delete the '.$id;
        // echo '--- and put out the new '. $new;

    }

    
{'fraction_non_alphanumeric': 0.15574987625804323, 'fraction_numerical': 0.014189077709948853, 'mean_word_length': 2.2538915727321522, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 50, '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': '3860107', 'n_tokens_mistral': 1854, 'n_tokens_neox': 1791, 'n_words': 379}