<commit_before><?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/**
 * ResourceRegistry3
 * 
 * @package     RR3
 * @author      Middleware Team HEAnet 
 * @copyright   Copyright (c) 2012, HEAnet Limited (http://www.heanet.ie)
 * @license     MIT http://www.opensource.org/licenses/mit-license.php
 *  
 */

/**
 * Translator Class
 * 
 * @package     RR3
 * @author      <NAME> <<EMAIL>>
 */

class Translator extends MY_Controller
{

    function __construct()
    {
        parent::__construct();
        $loggedin = $this->j_auth->logged_in();
        $this->current_site = current_url();
        if (!$loggedin) {
            $this->session->set_flashdata('target', $this->current_site);
            redirect('auth/login', 'location');
        }
        $this->tmp_providers = new models\Providers;
        $this->load->helper('form');
        $this->load->library('table');
        $this->load->library('zacl');
        $this->load->library('form_validation');
    }
    
    private function _submit_validate()
    {
         $this->form_validation->set_rules('lang[]','lang','trim|xss_clean');
         return $this->form_validation->run();

    }
    public function tolanguage($l)
    {
       $this->lang->load('rr', 'english');
       $original = $this->lang->language;
       if($l === 'pt' or $l === 'pl' or $l === 'it' or $l === 'es')
       {
          $langto = $l;
       }
       else
       {
         show_error('wrong',404);
       }
       $username = $this->j_auth->current_user();
       $translator = $this->config->item('translator_access');
       if(empty($translator))
       {
           show_error('no perm 1',403);
       }
       if(empty($translator[$langto]))
       {
          show_error('no perm',403);
       }
       else
       {
          $config_username = $translator[$langto];
          if(strcasecmp($config_username, $username) != 0)
          {
              show_error('no perm',403);
          }
       }
       $this->lang->load('rr', $langto);
       $translatedto  = $this->lang->language;
       $merger = array();
       foreach($original as $key=>$value)
       {
         $merger[$key]['english'] = $value;
       }
       foreach($translatedto as $key=>$value)
       {
         $merger[$key]['to'] = $value;
       }
       $data['merger'] = $merger;
       
       $data['content_view'] = 'manage/translator_view';<commit_msg>increase debug in translator<commit_after><?php
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
/**
 * ResourceRegistry3
 * 
 * @package     RR3
 * @author      Middleware Team HEAnet 
 * @copyright   Copyright (c) 2012, HEAnet Limited (http://www.heanet.ie)
 * @license     MIT http://www.opensource.org/licenses/mit-license.php
 *  
 */

/**
 * Translator Class
 * 
 * @package     RR3
 * @author      <NAME> <<EMAIL>>
 */

class Translator extends MY_Controller
{

    function __construct()
    {
        parent::__construct();
        $loggedin = $this->j_auth->logged_in();
        $this->current_site = current_url();
        if (!$loggedin) {
            $this->session->set_flashdata('target', $this->current_site);
            redirect('auth/login', 'location');
        }
        $this->tmp_providers = new models\Providers;
        $this->load->helper('form');
        $this->load->library('table');
        $this->load->library('zacl');
        $this->load->library('form_validation');
    }
    
    private function _submit_validate()
    {
         $this->form_validation->set_rules('lang[]','lang','trim|xss_clean');
         return $this->form_validation->run();

    }
    public function tolanguage($l)
    {
       $this->lang->load('rr', 'english');
       $original = $this->lang->language;
       if($l === 'pt' or $l === 'pl' or $l === 'it' or $l === 'es')
       {
          $langto = $l;
       }
       else
       {
         show_error('wrong',404);
       }
       $username = $this->j_auth->current_user();
       $translator = $this->config->item('translator_access');
       if(empty($translator))
       {
           log_message('debug','translator_access not found in config');
           show_error('no perm 1',403);
       }
       if(empty($translator[$langto]))
       {
          log_message('debug','language code '.$langto.' not found in as key for translator_access');
          show_error('no perm',403);
       }
       else
       {
          $config_username = $translator[$langto];
          if(strcasecmp($config_username, $username) != 0)
          {
             log_message('debug','translation not permited for '.  $username);
              show_error('no perm',403);
          }
       }
       $this->lang->load('rr', $langto);
       $translatedto  = $this->lang->language;
       $merger = array();
       foreach($original as $key=>$value)
       {
         $merger[$key]['english'] = $value;
       }
       foreach($translatedto as $key=>$value)
       {
         $merger[$key]['to'] = $value;
       }
       $data['merger'] = $merger;
       
       $data['content_view'] = 'manage/translator_view';
{'fraction_non_alphanumeric': 0.17356344381251226, 'fraction_numerical': 0.008236909197881937, 'mean_word_length': 2.1815346225826575, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5991658', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1564, 'n_words': 268}