コード例 #1
0
ファイル: admin_user.php プロジェクト: arielopez/temporal
 public function private_core()
 {
     $this->share_extensions();
     /// ¿El usuario tiene permiso para eliminar en esta página?
     $this->allow_delete = $this->user->allow_delete_on(__CLASS__);
     $this->agente = new agente();
     $this->suser = FALSE;
     if (isset($_GET['snick'])) {
         $this->suser = $this->user->get($_GET['snick']);
     }
     if ($this->suser) {
         $this->page->title = $this->suser->nick;
         if (isset($_POST['nnombre'])) {
             $age0 = new agente();
             $age0->codagente = $age0->get_new_codigo();
             $age0->nombre = $_POST['nnombre'];
             $age0->apellidos = $_POST['napellidos'];
             $age0->dnicif = $_POST['ndnicif'];
             $age0->telefono = $_POST['ntelefono'];
             $age0->email = $_POST['nemail'];
             if ($age0->save()) {
                 $this->new_message("Empleado " . $age0->codagente . " guardado correctamente.");
                 $this->suser->codagente = $age0->codagente;
                 if ($this->suser->save()) {
                     $this->new_message("Empleado " . $age0->codagente . " asignado correctamente.");
                 } else {
                     $this->new_error_msg("¡Imposible asignar el agente!");
                 }
             } else {
                 $this->new_error_msg("¡Imposible guardar el agente!");
             }
         } else {
             if (isset($_POST['spassword']) or isset($_POST['scodagente']) or isset($_POST['sadmin'])) {
                 $this->modificar_user();
             }
         }
         /// ¿Estamos modificando nuestro usuario?
         if ($this->suser->nick == $this->user->nick) {
             $this->user = $this->suser;
         }
         /// si el usuario no tiene acceso a ninguna página, entonces hay que informar del problema.
         if (!$this->suser->admin) {
             $sin_paginas = TRUE;
             foreach ($this->all_pages() as $p) {
                 if ($p->enabled) {
                     $sin_paginas = FALSE;
                     break;
                 }
             }
             if ($sin_paginas) {
                 $this->new_advice('No has autorizado a este usuario a acceder a ninguna' . ' página y por tanto no podrá hacer nada. Puedes darle acceso a alguna página' . ' desde la pestaña autorizar.');
             }
         }
         $fslog = new fs_log();
         $this->user_log = $fslog->all_from($this->suser->nick);
     } else {
         $this->new_error_msg("Usuario no encontrado.");
     }
 }
コード例 #2
0
ファイル: admin_users.php プロジェクト: arielopez/temporal
 protected function private_core()
 {
     $this->agente = new agente();
     $fslog = new fs_log();
     $this->historial = $fslog->all_by('login');
     if (isset($_POST['nnick'])) {
         $nu = $this->user->get($_POST['nnick']);
         if ($nu) {
             $this->new_error_msg('El usuario <a href="' . $nu->url() . '">ya existe</a>.');
         } else {
             if (isset($_POST['nadmin']) and !$this->user->admin) {
                 $this->new_error_msg('Solamente un administrador puede crear otro administrador.');
             } else {
                 $nu = new fs_user();
                 $nu->nick = $_POST['nnick'];
                 if ($nu->set_password($_POST['npassword'])) {
                     $nu->admin = isset($_POST['nadmin']);
                     if (isset($_POST['ncodagente'])) {
                         if ($_POST['ncodagente'] != '') {
                             $nu->codagente = $_POST['ncodagente'];
                         }
                     }
                     if ($nu->save()) {
                         Header('location: index.php?page=admin_user&snick=' . $nu->nick);
                     } else {
                         $this->new_error_msg("¡Imposible guardar el usuario!");
                     }
                 }
             }
         }
     } else {
         if (isset($_GET['delete'])) {
             $nu = $this->user->get($_GET['delete']);
             if ($nu) {
                 if (FS_DEMO) {
                     $this->new_error_msg('En el modo <b>demo</b> no se pueden eliminar usuarios.
               Esto es así para evitar malas prácticas entre usuarios que prueban la demo.');
                 } else {
                     if ($nu->admin and !$this->user->admin) {
                         $this->new_error_msg("No tienes permiso para eliminar a un administrador.");
                     } else {
                         if (!$this->user->allow_delete_on(__CLASS__)) {
                             $this->new_error_msg("No tienes permiso para eliminar usuarios.");
                         } else {
                             if ($nu->delete()) {
                                 $this->new_message("Usuario " . $nu->nick . " eliminado correctamente.");
                             } else {
                                 $this->new_error_msg("¡Imposible eliminar al usuario!");
                             }
                         }
                     }
                 }
             } else {
                 $this->new_error_msg("¡Usuario no encontrado!");
             }
         }
     }
 }
コード例 #3
0
 protected function private_core()
 {
     /// ¿El usuario tiene permiso para eliminar en esta página?
     $this->allow_delete = $this->user->admin;
     /**
      * Cargamos las variables del cron
      */
     $fsvar = new fs_var();
     $cron_vars = $fsvar->array_get(array('cron_exists' => FALSE, 'cron_lock' => FALSE, 'cron_error' => FALSE));
     if (isset($_GET['fix'])) {
         $cron_vars['cron_error'] = FALSE;
         $cron_vars['cron_lock'] = FALSE;
         $fsvar->array_save($cron_vars);
     } else {
         if (isset($_GET['clean_cache'])) {
             /// borramos los archivos php del directorio tmp
             foreach (scandir(getcwd() . '/tmp') as $f) {
                 if (substr($f, -4) == '.php') {
                     unlink('tmp/' . $f);
                 }
             }
             if ($this->cache->clean()) {
                 $this->new_message("Cache limpiada correctamente.");
             }
         } else {
             if (!$cron_vars['cron_exists']) {
                 $this->new_advice('Nunca se ha ejecutado el <a href="http://www.facturascripts.com/comm3/index.php?page=community_item&tag=cron" target="_blank">cron</a>,' . ' te perderás algunas características interesantes de FacturaScripts.');
             } else {
                 if ($cron_vars['cron_error']) {
                     $this->new_error_msg('Parece que ha habido un error con el cron. Haz clic <a href="' . $this->url() . '&fix=TRUE">aquí</a> para corregirlo.');
                 } else {
                     if ($cron_vars['cron_lock']) {
                         $this->new_advice('Se está ejecutando el cron.');
                     }
                 }
             }
         }
     }
     if (isset($_REQUEST['json'])) {
         /// desactivamos el motor de plantillas
         $this->template = FALSE;
         $fslog = new fs_log();
         echo json_encode($fslog->all(0, 10000));
     } else {
         $this->share_extensions();
     }
 }
コード例 #4
0
 protected function process()
 {
     $this->show_fs_toolbar = FALSE;
     $this->agente = new agente();
     $fslog = new fs_log();
     $this->historial = $fslog->all_by('login');
     if (isset($_POST['nnick'])) {
         $nu = $this->user->get($_POST['nnick']);
         if ($nu) {
             Header('location: ' . $nu->url());
         } else {
             $nu = new fs_user();
             $nu->nick = $_POST['nnick'];
             if ($nu->set_password($_POST['npassword'])) {
                 $nu->admin = isset($_POST['nadmin']);
                 if (isset($_POST['ncodagente'])) {
                     if ($_POST['ncodagente'] != '') {
                         $nu->codagente = $_POST['ncodagente'];
                     }
                 }
                 if ($nu->save()) {
                     Header('location: index.php?page=admin_user&snick=' . $nu->nick);
                 } else {
                     $this->new_error_msg("¡Imposible guardar el usuario!");
                 }
             }
         }
     } else {
         if (isset($_GET['delete'])) {
             $nu = $this->user->get($_GET['delete']);
             if ($nu) {
                 if (FS_DEMO) {
                     $this->new_error_msg('En el modo <b>demo</b> no se pueden eliminar usuarios.
               Esto es así para evitar malas prácticas entre usuarios que prueban la demo.');
                 } else {
                     if ($nu->delete()) {
                         $this->new_message("Usuario " . $nu->nick . " eliminado correctamente.");
                     } else {
                         $this->new_error_msg("¡Imposible eliminar al usuario!");
                     }
                 }
             } else {
                 $this->new_error_msg("¡Usuario no encontrado!");
             }
         }
     }
 }
コード例 #5
0
ファイル: inme_stats.php プロジェクト: NeoRazorX/informame
 protected function public_core()
 {
     $this->template = 'inme_public/stats';
     $this->page_title = $this->empresa->nombrecorto;
     $this->page_description = 'Portal de noticias colaborativo, para los que huyen de la mafia de menéame.' . ' Exploramos la web para mostrarte los temas de actualidad.';
     $this->buscar = '';
     $fsvar = new fs_var();
     $this->analytics = $fsvar->simple_get('inme_analytics');
     $this->modrewrite = $fsvar->simple_get('inme_modrewrite');
     if (isset($_GET['ok_cookies'])) {
         setcookie('ok_cookies', 'TRUE', time() + FS_COOKIES_EXPIRE, '/');
         $fslog = new fs_log();
         $fslog->tipo = 'cookies';
         $fslog->detalle = 'Se han aceptado las cookies';
         $fslog->ip = $_SERVER['REMOTE_ADDR'];
         $fslog->save();
     }
 }
コード例 #6
0
ファイル: caja_general.php プロジェクト: jcanda/caja_general
 private function new_log_msg($msg = FALSE, $tipo = 'caja', $alerta = FALSE)
 {
     if ($msg) {
         $fslog = new fs_log();
         $fslog->tipo = $tipo;
         $fslog->detalle = $msg;
         $fslog->ip = $_SERVER['REMOTE_ADDR'];
         $fslog->alerta = $alerta;
         if ($this->user) {
             $fslog->usuario = $this->user->nick;
         }
         $fslog->save();
     }
 }
コード例 #7
0
 private function modificar_serie()
 {
     $serie = $this->serie->get($_POST['codserie']);
     if (!$serie) {
         $serie = new serie();
         $serie->codserie = $_POST['codserie'];
     }
     $serie->descripcion = $_POST['descripcion'];
     $serie->siniva = isset($_POST['siniva']);
     $serie->irpf = floatval($_POST['irpf']);
     if ($this->num_personalizada) {
         if ($_POST['codejercicio'] != $serie->codejercicio or $_POST['numfactura'] != $serie->numfactura) {
             if ($this->user->admin) {
                 if ($this->hay_facturas_venta($serie->codserie)) {
                     $this->new_error_msg('Ya hay facturas con esta serie, no puedes cambiar la numeración inicial.');
                 } else {
                     $serie->codejercicio = NULL;
                     $serie->numfactura = 1;
                     if ($_POST['codejercicio'] != '') {
                         $serie->codejercicio = $_POST['codejercicio'];
                         $serie->numfactura = intval($_POST['numfactura']);
                         /// anotamos el cambio en el log
                         $fslog = new fs_log();
                         $fslog->alerta = TRUE;
                         $fslog->detalle = 'Se ha cambiado la numeración inicial de la serie ' . $serie->codserie . ' para el ejercicio ' . $serie->codejercicio . '. Nuevo número inicial: ' . $serie->numfactura;
                         $fslog->ip = $this->user->last_ip;
                         $fslog->usuario = $this->user->nick;
                         $fslog->tipo = 'serie';
                         $fslog->save();
                     }
                 }
             } else {
                 $this->new_error_msg("La numeración de facturas es una cosa delicada," . " solamente un administrador puede hacer cambios.", 'serie', TRUE);
             }
         }
     }
     if ($serie->save()) {
         $this->new_message('Datos guardados correctamente.');
     } else {
         $this->new_error_msg("¡Imposible guardar " . FS_SERIE . "!");
     }
 }
コード例 #8
0
ファイル: fs_controller.php プロジェクト: ramikat/ERPSISFS
 /**
  * Gestiona el cierre de sesión
  */
 private function log_out()
 {
     setcookie('logkey', '', time() - FS_COOKIES_EXPIRE);
     $fslog = new fs_log();
     if (isset($_COOKIE['user'])) {
         $fslog->usuario = $_COOKIE['user'];
     }
     $fslog->tipo = 'login';
     $fslog->detalle = 'El usuario ha cerrado la sesión.';
     $fslog->ip = $_SERVER['REMOTE_ADDR'];
     $fslog->save();
 }
コード例 #9
0
 protected function public_core()
 {
     $this->template = 'inme_public/editar_noticia';
     $this->page_description = 'Detalle de la noticia.';
     $this->buscar = '';
     $fsvar = new fs_var();
     $this->analytics = $fsvar->simple_get('inme_analytics');
     $this->modrewrite = $fsvar->simple_get('inme_modrewrite');
     if (isset($_GET['ok_cookies'])) {
         setcookie('ok_cookies', 'TRUE', time() + FS_COOKIES_EXPIRE, '/');
         $fslog = new fs_log();
         $fslog->tipo = 'cookies';
         $fslog->detalle = 'Se han aceptado las cookies';
         $fslog->ip = $_SERVER['REMOTE_ADDR'];
         $fslog->save();
     }
     $this->noticia = FALSE;
     $this->relacionada = FALSE;
     $this->temas = array();
     $noti0 = new inme_noticia_fuente();
     if (isset($_REQUEST['id'])) {
         $this->noticia = $noti0->get($_REQUEST['id']);
     } else {
         if (isset($_REQUEST['permalink'])) {
             $this->noticia = $noti0->get_by_permalink($_REQUEST['permalink']);
         }
     }
     if ($this->noticia) {
         $this->page_title = $this->noticia->titulo;
         $this->page_description = $this->true_text_break($this->noticia->resumen, 140);
         if (!is_null($this->noticia->id_relacionada)) {
             $this->relacionada = $noti0->get($this->noticia->id_relacionada);
         }
         $tema0 = new inme_tema();
         foreach ($this->noticia->keywords() as $key) {
             $tema = $tema0->get($key);
             if ($tema) {
                 if ($tema->activo) {
                     $this->temas[] = $tema;
                     /// si no hay una preview, usamos la de un tema
                     if ($tema->imagen and !$this->noticia->preview) {
                         $this->noticia->preview = $tema->imagen;
                         $this->noticia->save();
                     }
                 }
             } else {
                 $this->new_error_msg('Tema ' . $key . ' no encontrado.');
             }
         }
     } else {
         $this->new_error_msg('Noticia no encontrada.');
     }
 }
コード例 #10
0
 public function process()
 {
     $this->show_fs_toolbar = FALSE;
     $this->ppage = $this->page->get('admin_users');
     $this->agente = new agente();
     $this->ejercicio = new ejercicio();
     $user_no_more_admin = FALSE;
     $this->suser = FALSE;
     if (isset($_GET['snick'])) {
         $this->suser = $this->user->get($_GET['snick']);
     }
     if ($this->suser) {
         $this->page->title = $this->suser->nick;
         if (isset($_POST['ncodagente'])) {
             $age0 = new agente();
             $age0->codagente = $_POST['ncodagente'];
             $age0->nombre = $_POST['nnombre'];
             $age0->apellidos = $_POST['napellidos'];
             $age0->dnicif = $_POST['ndnicif'];
             $age0->telefono = $_POST['ntelefono'];
             $age0->email = $_POST['nemail'];
             if ($age0->save()) {
                 $this->new_message("Empleado " . $age0->codagente . " guardado correctamente.");
                 $this->suser->codagente = $_POST['ncodagente'];
                 if ($this->suser->save()) {
                     $this->new_message("Empleado " . $age0->codagente . " asignado correctamente.");
                 } else {
                     $this->new_error_msg("¡Imposible asignar el agente!");
                 }
             } else {
                 $this->new_error_msg("¡Imposible guardar el agente!");
             }
         } else {
             if (isset($_POST['spassword']) or isset($_POST['scodagente']) or isset($_POST['sadmin'])) {
                 if ($_POST['spassword'] != '') {
                     $this->suser->set_password($_POST['spassword']);
                 }
                 if ($_POST['template'] != '') {
                     $this->suser->template = $_POST['template'];
                 }
                 if (isset($_POST['scodagente'])) {
                     if ($_POST['scodagente'] == '') {
                         $this->suser->codagente = NULL;
                     } else {
                         $this->suser->codagente = $_POST['scodagente'];
                     }
                 }
                 /*
                  * El propio usuario no puede decidir dejar de ser administrador.
                  */
                 if ($this->user->nick != $this->suser->nick) {
                     /*
                      * Si un usuario es administrador y deja de serlo, hay que darle acceso
                      * a algunas páginas, en caso contrario no podrá continuar
                      */
                     if ($this->suser->admin and !isset($_POST['sadmin'])) {
                         $user_no_more_admin = TRUE;
                     }
                     $this->suser->admin = isset($_POST['sadmin']);
                 }
                 $this->suser->fs_page = NULL;
                 if (isset($_POST['udpage'])) {
                     $this->suser->fs_page = $_POST['udpage'];
                 }
                 $this->suser->codejercicio = NULL;
                 if (isset($_POST['ejercicio'])) {
                     $this->suser->codejercicio = $_POST['ejercicio'];
                 }
                 if (FS_DEMO and $this->user->nick != $this->suser->nick) {
                     $this->new_error_msg('En el modo <b>demo</b> sólo puedes modificar los datos de TU usuario.
               Esto es así para evitar malas prácticas entre usuarios que prueban la demo.');
                     $this->suser = $this->user->get($_GET['snick']);
                 } else {
                     if ($this->suser->save()) {
                         if (!$this->suser->admin) {
                             foreach ($this->all_pages() as $p) {
                                 $a = new fs_access(array('fs_user' => $this->suser->nick, 'fs_page' => $p->name));
                                 if ($user_no_more_admin) {
                                     $a->save();
                                 } else {
                                     if (!isset($_POST['enabled'])) {
                                         $a->delete();
                                     } else {
                                         if (!$p->enabled and in_array($p->name, $_POST['enabled'])) {
                                             $a->save();
                                         } else {
                                             if ($p->enabled and !in_array($p->name, $_POST['enabled'])) {
                                                 $a->delete();
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         $this->new_message("Datos modificados correctamente.");
                     } else {
                         $this->new_error_msg("¡Imposible modificar los datos!");
                     }
                 }
             }
         }
         /// si el usuario no tiene acceso a ninguna página, entonces hay que informar del problema.
         if (!$this->suser->admin) {
             $sin_paginas = TRUE;
             foreach ($this->all_pages() as $p) {
                 if ($p->enabled) {
                     $sin_paginas = FALSE;
                     break;
                 }
             }
             if ($sin_paginas) {
                 $this->new_advice('No has autorizado a este usuario a acceder a ninguna' . ' página y por tanto no podrá hacer nada. Puedes darle acceso a alguna página' . ' desde el panel de más abajo.');
             }
         }
         $fslog = new fs_log();
         $this->user_log = $fslog->all_from($this->suser->nick);
     } else {
         $this->new_error_msg("Usuario no encontrado.");
     }
 }
コード例 #11
0
ファイル: admin_info.php プロジェクト: ramikat/ERPSISFS
 public function get_fs_log()
 {
     $fslog = new fs_log();
     return $fslog->all();
 }
コード例 #12
0
 /**
  * Gestiona el cierre de sesión
  */
 private function log_out($rmuser = FALSE)
 {
     $path = '/';
     if (isset($_SERVER['REQUEST_URI'])) {
         $aux = parse_url(str_replace('/index.php', '', $_SERVER['REQUEST_URI']));
         if (isset($aux['path'])) {
             $path = $aux['path'];
             if (substr($path, -1) != '/') {
                 $path .= '/';
             }
         }
     }
     /// borramos las cookies
     if (isset($_COOKIE['logkey'])) {
         setcookie('logkey', '', time() - FS_COOKIES_EXPIRE);
         setcookie('logkey', '', time() - FS_COOKIES_EXPIRE, $path);
         if ($path != '/') {
             setcookie('logkey', '', time() - FS_COOKIES_EXPIRE, '/');
         }
     }
     /// ¿Eliminamos la cookie del usuario?
     if ($rmuser and isset($_COOKIE['user'])) {
         setcookie('user', '', time() - FS_COOKIES_EXPIRE);
         setcookie('user', '', time() - FS_COOKIES_EXPIRE, $path);
     }
     /// guardamos el evento en el log
     $fslog = new fs_log();
     $fslog->tipo = 'login';
     $fslog->detalle = 'El usuario ha cerrado la sesión.';
     $fslog->ip = $_SERVER['REMOTE_ADDR'];
     if (isset($_COOKIE['user'])) {
         $fslog->usuario = $_COOKIE['user'];
     }
     $fslog->save();
 }
コード例 #13
0
ファイル: inme_picar.php プロジェクト: NeoRazorX/informame
 private function picar()
 {
     $publicar = FALSE;
     /**
      * Si la última noticia publicada tiene menos de una hora,
      * no hace falta comprobar si hay que publicar algo.
      */
     foreach ($this->noticia->all(0, 'publicada DESC') as $noti) {
         if (strtotime($noti->publicada) > time() - 3600) {
             $publicar = FALSE;
             break;
         } else {
             $publicar = TRUE;
         }
     }
     if ($publicar) {
         /// marcamos noticias como publicadas
         $this->log[] = 'Seleccionando noticias para portada...';
         $seleccionadas = FALSE;
         foreach ($this->noticia->all(0, 'popularidad DESC') as $noti) {
             if (is_null($noti->publicada) and $noti->popularidad() > 1) {
                 $noti->publicada = date('d-m-Y H:i:s');
                 $this->preview_noticia($noti);
                 if ($noti->save()) {
                     $seleccionadas = TRUE;
                     $this->log[] = 'Se ha publicado la noticia: <a href="' . $noti->edit_url() . '" target="_blank">' . $noti->titulo . '</a> <span class="badge">' . $noti->popularidad() . '</span>';
                 } else {
                     $this->log[] = 'Error al publicar la noticia: ' . $noti->titulo;
                 }
             } else {
                 $noti->save();
             }
         }
         if (!$seleccionadas) {
             $this->log[] = 'Ninguna noticia seleccionada.';
             $publicar = FALSE;
         }
     }
     if (!$publicar) {
         /// buscamos noticias en las fuentes
         $fuente0 = new inme_fuente();
         $fuentes = $fuente0->all('fcomprobada ASC');
         if ($fuentes) {
             /// no leeremos fuentes que ya hayamos leido hace menos de media hora
             if (strtotime($fuentes[0]->fcomprobada) < time() - 1800) {
                 $this->leer_fuente($fuentes[0]);
             } else {
                 /// si no hay fuentes que leer, hacemos otras cosas
                 $this->log[] = 'Procesamos noticias...';
                 /// escogemos un punto aleatorio en la lista de noticias
                 $total = min(array(500, $this->total_noticias()));
                 $offset = mt_rand(0, max(array(0, $total)));
                 foreach ($this->noticia->all($offset) as $noti) {
                     $popularidad = $noti->popularidad();
                     switch (mt_rand(0, 3)) {
                         case 0:
                             $noti->tweets = max(array($noti->tweets, $this->tweet_count($noti->url)));
                             break;
                         case 1:
                             $noti->likes = max(array($noti->likes, $this->facebook_count($noti->url)));
                             break;
                         case 2:
                             $noti->meneos = max(array($noti->meneos, $this->meneame_count($noti->url)));
                             break;
                         default:
                             $this->preview_noticia($noti);
                             break;
                     }
                     if ($noti->save()) {
                         if ($noti->popularidad() > $popularidad) {
                             $this->log[] = '<a href="' . $noti->edit_url() . '" target="_blank">' . $noti->titulo . '</a> <b>+' . abs($noti->popularidad() - $popularidad) . '</b> popularidad.';
                         } else {
                             if ($noti->popularidad() < $popularidad) {
                                 $this->log[] = '<a href="' . $noti->edit_url() . '" target="_blank">' . $noti->titulo . '</a> <mark>-' . abs($noti->popularidad() - $popularidad) . '</mark> popularidad.';
                             }
                         }
                     } else {
                         $this->log[] = 'Error al actualizada la popularidad de la noticia: ' . $noti->titulo;
                     }
                 }
             }
         } else {
             $this->new_error_msg('No hay ninguna fuente que picar. <a href="index.php?page=inme_fuentes">Añade alguna</a>.');
         }
     }
     /// guardamos el log
     foreach ($this->log as $l) {
         $fslog = new fs_log();
         $fslog->tipo = 'picar';
         $fslog->detalle = $l;
         $fslog->ip = $_SERVER['REMOTE_ADDR'];
         if ($this->user) {
             $fslog->usuario = $this->user->nick;
         }
         $fslog->save();
     }
 }
コード例 #14
0
ファイル: cron.php プロジェクト: pcrednet/facturascripts_2015
        $fs_default_items->set_codejercicio($empresa->codejercicio);
        $fs_default_items->set_codpago($empresa->codpago);
        $fs_default_items->set_codpais($empresa->codpais);
        $fs_default_items->set_codserie($empresa->codserie);
        /*
         * Ahora ejecutamos el cron de cada plugin que tenga cron y esté activado
         */
        foreach ($GLOBALS['plugins'] as $plugin) {
            if (file_exists('plugins/' . $plugin . '/cron.php')) {
                echo "\n***********************\nEjecutamos el cron.php del plugin " . $plugin . "\n";
                include 'plugins/' . $plugin . '/cron.php';
                echo "\n***********************";
            }
        }
        /// indicamos el fin en el log
        $fslog = new fs_log();
        $fslog->tipo = 'cron';
        $fslog->detalle = 'Terminada la ejecución del cron.';
        $fslog->save();
        /// Eliminamos la variable cron_lock puesto que ya hemos terminado
        $cron_vars['cron_lock'] = FALSE;
    }
    /// guardamos las variables
    $fsvar->array_save($cron_vars);
    foreach ($db->get_errors() as $err) {
        echo "\nERROR: " . $err . "\n";
    }
    $db->close();
} else {
    echo "¡Imposible conectar a la base de datos!\n";
    foreach ($db->get_errors() as $err) {