<commit_before><?php
/*
 * This file is part of FacturaSctipts
 * Copyright (C) 2012  <NAME>  <EMAIL>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

require_once 'base/fs_model.php';
require_once 'model/agente.php';
require_once 'model/fs_access.php';
require_once 'model/fs_page.php';
require_once 'model/ejercicio.php';

class fs_user extends fs_model
{
   public $nick;
   public $password;
   public $log_key;
   public $logged_on;
   public $codagente;
   public $agente;
   public $admin;
   public $last_login;
   public $last_login_time;
   public $last_ip;
   public $last_browser;
   public $fs_page;
   public $codejercicio;
   
   private $menu;
   
   public function __construct($a = FALSE)
   {
      parent::__construct('fs_users');
      if($a)
      {
         $this->nick = $a['nick'];
         $this->password = $a['password'];
         $this->log_key = $a['log_key'];
         $this->codagente = intval($a['codagente']);
         
         if($this->codagente < 1)
            $this->codagente = NULL;
         
         $this->admin = ($a['admin'] == 't');
         $this->last_login = Date('d-m-Y', strtotime($a['last_login']));
         
         if( is_null($a['last_login_time']) )
            $this->last_login_time = '00:00:00';
         else
            $this->last_login_time = $a['last_login_time'];
         
         $this->last_ip = $a['last_ip'];
         $this->last_browser = $a['last_browser'];
         $this->fs_page = $a['fs_page'];
         $this->codejercicio = $a['codejercicio'];
      }
      else
      {
         $this->nick = NULL;
         $this->password = <PASSWORD>;
         $this->log_key = NULL;
         $this->codagente = NULL;
         $this->admin = FALSE;
         $this->last_login = NULL;
         $this->last_login_time = NULL;
         $this->last_ip = NULL;
         $this->last_browser = NULL;
         $this->fs_page = NULL;
         $this->codejercicio = NULL;
      }
      $this->logged_on = FALSE;
      $this->agente = NULL;
   }
   
   protected function install()
   {
      $this->clean_cache();
      $agente = new agente();
      $page = new fs_page();
      $ejercicio = new ejercicio();
      return "INSERT INTO ".$this->table_name." (nick,password,log_key,codagente,admin)
         VALUES ('admin','".sha1('admin')."',NULL,NULL,TRUE);";
   }
   
   public function url()<commit_msg>- Posible solución al bug que impide hacer login tras añadir los nuevos campos a la tabla fs_users.<commit_after><?php
/*
 * This file is part of FacturaSctipts
 * Copyright (C) 2012  <NAME>  <EMAIL>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

require_once 'base/fs_model.php';
require_once 'model/agente.php';
require_once 'model/fs_access.php';
require_once 'model/fs_page.php';
require_once 'model/ejercicio.php';

class fs_user extends fs_model
{
   public $nick;
   public $password;
   public $log_key;
   public $logged_on;
   public $codagente;
   public $agente;
   public $admin;
   public $last_login;
   public $last_login_time;
   public $last_ip;
   public $last_browser;
   public $fs_page;
   public $codejercicio;
   
   private $menu;
   
   public function __construct($a = FALSE)
   {
      parent::__construct('fs_users');
      if($a)
      {
         $this->nick = $a['nick'];
         $this->password = $a['password'];
         $this->log_key = $a['log_key'];
         $this->codagente = intval($a['codagente']);
         
         if($this->codagente < 1)
            $this->codagente = NULL;
         
         $this->admin = ($a['admin'] == 't');
         $this->last_login = Date('d-m-Y', strtotime($a['last_login']));
         
         if( is_null($a['last_login_time']) )
            $this->last_login_time = '00:00:00';
         else
            $this->last_login_time = $a['last_login_time'];
         
         $this->last_ip = $a['last_ip'];
         $this->last_browser = $a['last_browser'];
         
         if( isset($a['fs_page']) )
         {
            $this->fs_page = $a['fs_page'];
            $this->clean_cache();
         }
         else
            $this->fs_page = NULL;
         
         if( isset($a['codejercicio']) )
         {
            $this->codejercicio = $a['codejercicio'];
            $this->clean_cache();
         }
         else
            $this->codejercicio = NULL;
      }
      else
      {
         $this->nick = NULL;
         $this->password = <PASSWORD>;
         $this->log_key = NULL;
         $this->codagente = NULL;
         $this->admin = FALSE;
         $this->last_login = NULL;
         $this->last_login_time = NULL;
         $this->last_ip = NULL;
         $this->last_browser = NULL;
         $this->fs_page = NULL;
         $this->codejercicio = NULL;
      }
      $this->logged_on = FALSE;
      $this->agente = NULL;
   }
   
   protected function install()
   {
      $this->clean_cache();
      $agente = new agente();
      $page = new fs_page();
      $ejercicio = new ejercicio();
      return "INSERT INTO ".$this->table_name." (nick,password,log_key,codagente,admin)
         VALUES ('admin','".sha1('admin')."',NULL,NULL,TRUE);";
   }
   
   public function url()
{'fraction_non_alphanumeric': 0.13615023474178403, 'fraction_numerical': 0.004068857589984351, 'mean_word_length': 2.3850635593220337, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 73, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5128731', 'n_tokens_mistral': 2045, 'n_tokens_neox': 2020, 'n_words': 518}