<commit_before><?php
/*
 * File: Download.php
 * Holds: Downloading one or a collection of elements
 * Created: 02.10.13
 * Project: Youkok2
 * 
*/

namespace Youkok2\Views;
/*
 * Define what classes to use
 */

use \Youkok2\Models\Element as Element;

/*
 * The Download class, extending Youkok2 base class
 */

class Download extends Base {

    /*
     * Constructor
     */

    public function __construct() {
        // Calling Base' constructor
        parent::__construct();
        
        // Displaying 404 or not
        $should_display_404 = false;
        
        // Create new object
        $element = new Element();
        $element->createByUrl($this->queryGetClean());
        
        // Check if was found or invalid url
        if ($element->controller->wasFound()) {
            // Check if visible
            if ($element->isVisible()) {
                $file_location = $element->controller->getPhysicalLocation();
                
                // Check if zip download or not
                if (!$element->isDirectory()) {
                    if (file_exists($file_location)) {
                        // Check if we should log download
                        if (!isset($_GET['donotlogthisdownload'])) {
                            // Log download
                            //$item->addDownload();
                        }
    
                        // Check if we should return fake http response to facebook crawler
                        if (isset($_SERVER['HTTP_USER_AGENT']) and strpos($_SERVER['HTTP_USER_AGENT'], 'facebook') !== false) {
                            // TODO
                            /*
                            // Facebook crawler
                            $this->template->assign('DOWNLOAD_FILE', $element->getName());
                            $this->template->assign('DOWNLOAD_SIZE', $element->getSizePretty());
                            $this->template->assign('DOWNLOAD_URL', $_SERVER['REQUEST_URI']);
    
                            // Get item parent information
                            $download_parent = '';
                            $root_parent = $element->getRootParent();
                            if ($element->getParent() != $root_parent->getId()) {
                                $local_dir_element = $this->collection->get($element->getParent());
                                $download_parent = $local_dir_element->getName() . ', ';
                            }
                            if ($root_parent != null) {<commit_msg>Logging downloads again, FUCK<commit_after><?php
/*
 * File: Download.php
 * Holds: Downloading one or a collection of elements
 * Created: 02.10.13
 * Project: Youkok2
 * 
*/

namespace Youkok2\Views;
/*
 * Define what classes to use
 */

use \Youkok2\Models\Element as Element;

/*
 * The Download class, extending Youkok2 base class
 */

class Download extends Base {

    /*
     * Constructor
     */

    public function __construct() {
        // Calling Base' constructor
        parent::__construct();
        
        // Displaying 404 or not
        $should_display_404 = false;
        
        // Create new object
        $element = new Element();
        $element->createByUrl($this->queryGetClean());
        
        // Check if was found or invalid url
        if ($element->controller->wasFound()) {
            // Check if visible
            if ($element->isVisible()) {
                $file_location = $element->controller->getPhysicalLocation();
                
                // Check if zip download or not
                if (!$element->isDirectory()) {
                    if (file_exists($file_location)) {
                        // Check if we should log download
                        if (!isset($_GET['donotlogthisdownload'])) {
                            // Log download
                            $element->controller->addDownload();
                        }
    
                        // Check if we should return fake http response to facebook crawler
                        if (isset($_SERVER['HTTP_USER_AGENT']) and strpos($_SERVER['HTTP_USER_AGENT'], 'facebook') !== false) {
                            // TODO
                            /*
                            // Facebook crawler
                            $this->template->assign('DOWNLOAD_FILE', $element->getName());
                            $this->template->assign('DOWNLOAD_SIZE', $element->getSizePretty());
                            $this->template->assign('DOWNLOAD_URL', $_SERVER['REQUEST_URI']);
    
                            // Get item parent information
                            $download_parent = '';
                            $root_parent = $element->getRootParent();
                            if ($element->getParent() != $root_parent->getId()) {
                                $local_dir_element = $this->collection->get($element->getParent());
                                $download_parent = $local_dir_element->getName() . ', ';
                            }
                            if ($root_parent != null) {
{'fraction_non_alphanumeric': 0.11551284565601098, 'fraction_numerical': 0.006275740341243381, 'mean_word_length': 1.3426734037666515, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 29, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7184054', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1159, 'n_words': 279}