Пример #1
0
 protected final function initialize()
 {
     Session::delete('myDbName');
     $this->my_auth = new MyAuth();
     if (!$this->my_auth->check()) {
         Flash::warning($this->my_auth->getError());
         Input::delete('password');
         View::select(null, 'login');
     }
 }
Пример #2
0
 function agregar()
 {
     View::select('form');
     if (Input::hasPost('tag')) {
         if ((new Tags())->create(Input::post('tag'))) {
             Flash::valid('Se ha creado el tag de forma exitosa');
             Input::delete('tag');
         }
     }
 }
 public function crear()
 {
     if (Input::haspost("usuario")) {
         $usuario = Load::model("usuario", Input::post("usuario"));
         if (Input::post("usuario")['usuario_password'] != Input::post("usuario")['usuario_password2']) {
             Flash::error("Error, las contraseñas no coinciden");
             return;
         }
         $usuario->crearPassword();
         if ($usuario->save()) {
             Flash::valid("Usuario Creado");
             Input::delete();
         } else {
             Flash::error("No se creó el usuario");
         }
     }
 }
Пример #4
0
 public function nuevo_usuario()
 {
     if (Input::hasPost("sesion")) {
         $u = new Sesion(Input::post("sesion"));
         $u->password = md5($u->password);
         $password = md5(Input::post("password2"));
         if ($u->password == $password) {
             if ($u->save()) {
                 Flash::valid("Usuario creado");
                 Input::delete();
             } else {
                 Flash::error("Error");
             }
         } else {
             Flash::error("Las contraseñas deben coincidir");
         }
     }
 }
 public function grupo($profesorevaluacion_id, $profesorasignatura_id)
 {
     $this->profesorevaluacion_id = $profesorevaluacion_id;
     $this->alumnoevaluacion = new Alumnoevaluacion();
     $this->profesorasignatura_id = $profesorasignatura_id;
     $incripcionalumnoasignatura = new Incripcionalumnoasignatura();
     $this->alumnos = $incripcionalumnoasignatura->find("conditions: profesorasignatura_id = '{$profesorasignatura_id}'", "join: inner join alumno on incripcionalumnoasignatura.alumno_id = alumno.id", "columns: alumno.*,incripcionalumnoasignatura.id as incripcionalumnoasignatura_id");
     $profesorevaluacion = new Profesorevaluacion();
     if (Input::haspost("alumnoevaluacion")) {
         $alumnoevaluacion = new Alumnoevaluacion(Input::post("alumnoevaluacion"));
         $registro = $alumnoevaluacion->validarRepetida();
         if ($registro->ponderacion <= 20 and $registro->ponderacion >= 0) {
             # code...
             if ($registro->save()) {
                 Flash::valid("Registro Guardado");
                 Input::delete();
             } else {
                 Flash::error("Error guardando registro");
             }
         } else {
             Flash::error("La ponderacion debe ser mayor o igual a cero o menor o igual a 20");
         }
     }
     $this->alumnos = $incripcionalumnoasignatura->find("conditions: profesorasignatura_id = '{$profesorasignatura_id}'", "join: inner join alumno on incripcionalumnoasignatura.alumno_id = alumno.id", "columns: alumno.*,incripcionalumnoasignatura.id as incripcionalumnoasignatura_id");
     foreach ($this->alumnos as $key => $value) {
         $respuesta = $this->alumnoevaluacion->getPonderacionByIncripcionalumnoasignaturaIdYprofesorevaluacionId($value->incripcionalumnoasignatura_id, $this->profesorevaluacion_id);
         if ($respuesta === null) {
             $alumnoevaluacion_para_poner_en_cero = new Alumnoevaluacion();
             $alumnoevaluacion_para_poner_en_cero->ponderacion = 0;
             $alumnoevaluacion_para_poner_en_cero->incripcionalumnoasignatura_id = $value->incripcionalumnoasignatura_id;
             $alumnoevaluacion_para_poner_en_cero->profesorevaluacion_id = $this->profesorevaluacion_id;
             $alumnoevaluacion_para_poner_en_cero->save();
         }
     }
     $this->evaluacion = $profesorevaluacion->find($profesorevaluacion_id);
     /*este mecanismo lo aplique cuando me di cuenta que cuando se inscriben los alumnos en las evaluaciones del profesor
     		tengo que poner las notas de cada uno en cero. Como aqui es donde se hace, en esta accion, entonces redirijo obligatoriamente para aca
     		para que se haga y luego vuelvo a la anterior validando que no se repita el proceso con una variable de sesion*/
     if (isset($_SESSION['KUMBIA_AUTH_IDENTITY'][Config::get('config.application.namespace_auth')]['se_actualizaran_notas_a_cero'])) {
         unset($_SESSION['KUMBIA_AUTH_IDENTITY'][Config::get('config.application.namespace_auth')]['se_actualizaran_notas_a_cero']);
         $_SESSION['KUMBIA_AUTH_IDENTITY'][Config::get('config.application.namespace_auth')]['notas_puestas_en_cero'] = 1;
         Router::redirect("perfil/programarevaluaciones/{$profesorasignatura_id}");
     }
 }
Пример #6
0
 /**
  * Método para listar
  */
 public function listar($order = 'order.modulo.asc')
 {
     if (Input::hasPost('privilegios') or Input::hasPost('old_privilegios')) {
         if (RecursoPerfil::setRecursoPerfil(Input::post('privilegios'), Input::post('old_privilegios'))) {
             Flash::valid('Los privilegios se han registrado correctamente!');
             Input::delete('privilegios');
             //Para que no queden persistentes
             Input::delete('old_privilegios');
         }
     }
     $recurso = new Recurso();
     $this->recursos = $recurso->getListadoRecursoPorModulo(Recurso::ACTIVO);
     $perfil = new Perfil();
     $this->perfiles = $perfil->getListadoPerfil(Perfil::ACTIVO);
     $privilegio = new RecursoPerfil();
     $this->privilegios = $privilegio->getPrivilegiosToArray();
     $this->order = $order;
     $this->page_title = 'Permisos y privilegios de usuarios';
 }
Пример #7
0
 /**
  * This is a test page to test basic curl requests and responses.
  * @return mixed
  */
 public function action_index()
 {
     try {
         //init data response
         $data = array();
         //get url
         $data['url'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
         //get method
         $data['method'] = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : '';
         //get params
         $data['params']['get'] = \Input::get();
         $data['params']['post'] = \Input::post();
         $data['params']['put'] = \Input::put();
         $data['params']['delete'] = \Input::delete();
         //return response
         $this->response(array('data' => $data));
     } catch (\Exception $e) {
         //return caught exceptions to json response
         $this->response(array('exception' => $e->getMessage()));
     }
 }
 /**
  * Método para cambiar clave
  */
 public function cambiar_clave()
 {
     $this->page_title = 'Cambiar clave del usuario';
     $config = new Configuracion();
     $this->configs = $config->getInformacionConfiguracion();
     //DwMessage::warning('variable $config1: '.var_dump($config->getInformacionConfiguracion()).'');
     //$diasadicional = UsuarioClave::diasadicionales();
     //DwMessage::warning('variable $diasadicional: '.$this->config->dias_caducidad_clave.'');
     //return false;
     $usuval = UsuarioClave::clave_valida(Session::get('id'));
     //$id=Session::get('id');
     //$data = Input::post('usuario_clave');
     //Load::model('sistema/usuario_clave')->cambiar_clave($id, $data['password'], $data['repassword']);
     //DwMessage::warning('variable $data: '.var_dump($data).'');
     if ($usuval != 1) {
         if (Input::hasPost('usuario_clave')) {
             try {
                 $data = Input::post('usuario_clave');
                 $id = Session::get('id');
                 if (Load::model('sistema/usuario_clave')->cambiar_clave($id, $data['password'], $data['repassword'])) {
                     Flash::success('Cambio de clave realizado exitosamente.');
                     DwAuth::logout();
                     return Router::redirect('/sistema/login/entrar');
                 } else {
                     Input::delete();
                 }
             } catch (KumbiaException $kex) {
                 Input::delete();
                 Flash::warning("Lo sentimos ha ocurrido un error:");
                 Flash::error($kex->getMessage());
             }
         } else {
             DwMessage::info('clave aun es valida');
         }
     }
     //    DwMessage::warning('Clave aun es valida');
 }
 public function index()
 {
     $this->exito = NULL;
     if (Input::hasPost('nombre') && Input::hasPost('nombre') != "") {
         $name = Input::post('nombre');
         $email_address = Input::post('email');
         $phone = Input::post('phone');
         $message = Input::post('message');
         $to = '*****@*****.**';
         // Add your email address inbetween the '' replacing yourname@yourdomain.com - This is where the form will send a message to.
         $email_subject = "Mensaje de:  {$name}";
         $email_body = "Nombre: {$name}\n\nEmail: {$email_address}\n\nTelefono: {$phone}\n\nMensaje:\n{$message}";
         $headers = "From: noreply@lucastoneatto.com\n";
         // This is the email address the generated message will be from. We recommend using something like noreply@yourdomain.com.
         $headers .= "Reply-To: {$email_address}";
         if (mail($to, $email_subject, $email_body, $headers)) {
             Input::delete();
             Input::delete();
             Flash::success('Email enviado con éxito');
         } else {
             Flash::error('Error al enviar email');
         }
     }
 }
function input_controller()
{
    //return array('content'=>"ok");
    global $mysqli, $redis, $user, $session, $route, $max_node_id_limit, $feed_settings;
    // There are no actions in the input module that can be performed with less than write privileges
    if (!$session['write']) {
        return array('content' => false);
    }
    global $feed, $timestore_adminkey;
    $result = false;
    include "Modules/feed/feed_model.php";
    $feed = new Feed($mysqli, $redis, $feed_settings);
    require "Modules/input/input_model.php";
    // 295
    $input = new Input($mysqli, $redis, $feed);
    require "Modules/input/process_model.php";
    // 886
    $process = new Process($mysqli, $input, $feed);
    $process->set_timezone_offset($user->get_timezone($session['userid']));
    if ($route->format == 'html') {
        if ($route->action == 'api') {
            $result = view("Modules/input/Views/input_api.php", array());
        }
        if ($route->action == 'view') {
            $result = view("Modules/input/Views/input_view.php", array());
        }
    }
    if ($route->format == 'json') {
        /*
        
        input/bulk.json?data=[[0,16,1137],[2,17,1437,3164],[4,19,1412,3077]]
        
        The first number of each node is the time offset (see below).
        
        The second number is the node id, this is the unique identifer for the wireless node.
        
        All the numbers after the first two are data values. The first node here (node 16) has only one data value: 1137.
        
        Optional offset and time parameters allow the sender to set the time
        reference for the packets.
        If none is specified, it is assumed that the last packet just arrived.
        The time for the other packets is then calculated accordingly.
        
        offset=-10 means the time of each packet is relative to [now -10 s].
        time=1387730127 means the time of each packet is relative to 1387730127
        (number of seconds since 1970-01-01 00:00:00 UTC)
        
        Examples:
        
        // legacy mode: 4 is 0, 2 is -2 and 0 is -4 seconds to now.
          input/bulk.json?data=[[0,16,1137],[2,17,1437,3164],[4,19,1412,3077]]
        // offset mode: -6 is -16 seconds to now.
          input/bulk.json?data=[[-10,16,1137],[-8,17,1437,3164],[-6,19,1412,3077]]&offset=-10
        // time mode: -6 is 1387730121
          input/bulk.json?data=[[-10,16,1137],[-8,17,1437,3164],[-6,19,1412,3077]]&time=1387730127
        // sentat (sent at) mode:
          input/bulk.json?data=[[520,16,1137],[530,17,1437,3164],[535,19,1412,3077]]&offset=543
        
        See pull request for full discussion:
        https://github.com/emoncms/emoncms/pull/118
        */
        if ($route->action == 'bulk') {
            $valid = true;
            if (!isset($_GET['data']) && isset($_POST['data'])) {
                $data = json_decode(post('data'));
            } else {
                $data = json_decode(get('data'));
            }
            $userid = $session['userid'];
            $dbinputs = $input->get_inputs($userid);
            $len = count($data);
            if ($len > 0) {
                if (isset($data[$len - 1][0])) {
                    // Sent at mode: input/bulk.json?data=[[45,16,1137],[50,17,1437,3164],[55,19,1412,3077]]&sentat=60
                    if (isset($_GET['sentat'])) {
                        $time_ref = time() - (int) $_GET['sentat'];
                    } elseif (isset($_POST['sentat'])) {
                        $time_ref = time() - (int) $_POST['sentat'];
                    } elseif (isset($_GET['offset'])) {
                        $time_ref = time() - (int) $_GET['offset'];
                    } elseif (isset($_POST['offset'])) {
                        $time_ref = time() - (int) $_POST['offset'];
                    } elseif (isset($_GET['time'])) {
                        $time_ref = (int) $_GET['time'];
                    } elseif (isset($_POST['time'])) {
                        $time_ref = (int) $_POST['time'];
                    } else {
                        $time_ref = time() - (int) $data[$len - 1][0];
                    }
                    foreach ($data as $item) {
                        if (count($item) > 2) {
                            // check for correct time format
                            $itemtime = (int) $item[0];
                            $time = $time_ref + (int) $itemtime;
                            $nodeid = $item[1];
                            $inputs = array();
                            $name = 1;
                            for ($i = 2; $i < count($item); $i++) {
                                $value = (double) $item[$i];
                                $inputs[$name] = $value;
                                $name++;
                            }
                            $tmp = array();
                            foreach ($inputs as $name => $value) {
                                if ($input->check_node_id_valid($nodeid)) {
                                    if (!isset($dbinputs[$nodeid][$name])) {
                                        $inputid = $input->create_input($userid, $nodeid, $name);
                                        $dbinputs[$nodeid][$name] = true;
                                        $dbinputs[$nodeid][$name] = array('id' => $inputid, 'processList' => '');
                                        $input->set_timevalue($dbinputs[$nodeid][$name]['id'], $time, $value);
                                    } else {
                                        $inputid = $dbinputs[$nodeid][$name]['id'];
                                        $input->set_timevalue($dbinputs[$nodeid][$name]['id'], $time, $value);
                                        if ($dbinputs[$nodeid][$name]['processList']) {
                                            $tmp[] = array('value' => $value, 'processList' => $dbinputs[$nodeid][$name]['processList']);
                                        }
                                    }
                                } else {
                                    $valid = false;
                                    $error = "NodeID must be a positive integer between 0 and " . $max_node_id_limit . ", nodeid given was out of range";
                                }
                            }
                            foreach ($tmp as $i) {
                                $process->input($time, $i['value'], $i['processList']);
                            }
                        } else {
                            $valid = false;
                            $error = "Format error, bulk item needs at least 3 values";
                        }
                    }
                } else {
                    $valid = false;
                    $error = "Format error, last item in bulk data does not contain any data";
                }
            } else {
                $valid = false;
                $error = "Format error, json string supplied is not valid";
            }
            if ($valid) {
                $result = 'ok';
            } else {
                $result = "Error: {$error}\n";
            }
        }
        // input/post.json?node=10&json={power1:100,power2:200,power3:300}
        // input/post.json?node=10&csv=100,200,300
        if ($route->action == 'post') {
            $valid = true;
            $error = "";
            $nodeid = (int) get('node');
            $error = " old" . $max_node_id_limit;
            if (!isset($max_node_id_limit)) {
                $max_node_id_limit = 32;
            }
            $error .= " new" . $max_node_id_limit;
            if (!$input->check_node_id_valid($nodeid)) {
                $valid = false;
                $error = "NodeID must be a positive integer between 0 and " . $max_node_id_limit . ", nodeid given was out of range";
            }
            if (!$valid) {
                return array('content' => "{$error}");
            }
            $nodeid = (int) $nodeid;
            if (isset($_GET['time'])) {
                $time = (int) $_GET['time'];
            } else {
                $time = time();
            }
            $data = array();
            $datain = false;
            // code below processes input regardless of json or csv type
            if (isset($_GET['json'])) {
                $datain = get('json');
            }
            if (isset($_GET['csv'])) {
                $datain = get('csv');
            }
            if (isset($_GET['data'])) {
                $datain = get('data');
            }
            if (isset($_POST['data'])) {
                $datain = post('data');
            }
            if ($datain != "") {
                $json = preg_replace('/[^\\w\\s-.:,]/', '', $datain);
                $datapairs = explode(',', $json);
                $csvi = 0;
                for ($i = 0; $i < count($datapairs); $i++) {
                    $keyvalue = explode(':', $datapairs[$i]);
                    if (isset($keyvalue[1])) {
                        if ($keyvalue[0] == '') {
                            $valid = false;
                            $error = "Format error, json key missing or invalid character";
                        }
                        if (!is_numeric($keyvalue[1])) {
                            $valid = false;
                            $error = "Format error, json value is not numeric";
                        }
                        $data[$keyvalue[0]] = (double) $keyvalue[1];
                    } else {
                        if (!is_numeric($keyvalue[0])) {
                            $valid = false;
                            $error = "Format error: csv value is not numeric";
                        }
                        $data[$csvi + 1] = (double) $keyvalue[0];
                        $csvi++;
                    }
                }
                $userid = $session['userid'];
                $dbinputs = $input->get_inputs($userid);
                $tmp = array();
                foreach ($data as $name => $value) {
                    if (!isset($dbinputs[$nodeid][$name])) {
                        $inputid = $input->create_input($userid, $nodeid, $name);
                        $dbinputs[$nodeid][$name] = true;
                        $dbinputs[$nodeid][$name] = array('id' => $inputid);
                        $input->set_timevalue($dbinputs[$nodeid][$name]['id'], $time, $value);
                    } else {
                        $inputid = $dbinputs[$nodeid][$name]['id'];
                        $input->set_timevalue($dbinputs[$nodeid][$name]['id'], $time, $value);
                        if ($dbinputs[$nodeid][$name]['processList']) {
                            $tmp[] = array('value' => $value, 'processList' => $dbinputs[$nodeid][$name]['processList']);
                        }
                    }
                }
                foreach ($tmp as $i) {
                    $process->input($time, $i['value'], $i['processList']);
                }
            } else {
                $valid = false;
                $error = "Request contains no data via csv, json or data tag";
            }
            if ($valid) {
                $result = 'ok';
            } else {
                $result = "Error: {$error}\n";
            }
        }
        if ($route->action == "clean") {
            $result = $input->clean($session['userid']);
        }
        if ($route->action == "list") {
            $result = $input->getlist($session['userid']);
        }
        if ($route->action == "getinputs") {
            $result = $input->get_inputs($session['userid']);
        }
        if ($route->action == "getallprocesses") {
            $result = $process->get_process_list();
        }
        if (isset($_GET['inputid']) && $input->belongs_to_user($session['userid'], get("inputid"))) {
            if ($route->action == "delete") {
                $result = $input->delete($session['userid'], get("inputid"));
            }
            if ($route->action == 'set') {
                $result = $input->set_fields(get('inputid'), get('fields'));
            }
            if ($route->action == "process") {
                if ($route->subaction == "add") {
                    $result = $input->add_process($process, $session['userid'], get('inputid'), get('processid'), get('arg'), get('newfeedname'), get('newfeedinterval'), get('engine'));
                }
                if ($route->subaction == "list") {
                    $result = $input->get_processlist(get("inputid"));
                }
                if ($route->subaction == "delete") {
                    $result = $input->delete_process(get("inputid"), get('processid'));
                }
                if ($route->subaction == "move") {
                    $result = $input->move_process(get("inputid"), get('processid'), get('moveby'));
                }
                if ($route->subaction == "reset") {
                    $result = $input->reset_process(get("inputid"));
                }
            }
        }
    }
    return array('content' => $result);
}
 public function cambiarpass($id_profesor)
 {
     $this->titulo = "Cambiar contraseña";
     $this->profesor = new Profesor();
     $this->profesor->id = $id_profesor;
     if (Input::post("profesor") and Input::post("pass1")) {
         $inputs = Input::post("profesor");
         if ($inputs['password'] != $inputs['password2']) {
             Input::delete();
             Flash::info("Las nuevas contraseñas no coinciden");
             Router::redirect("perfil/cambiarpass/{$id_profesor}");
             die;
         }
         $prof = new Profesor();
         $prof_pass = $prof->find($id_profesor);
         if ($prof->encriptar(Input::post("pass1")) != $prof_pass->password) {
             Input::delete();
             Flash::info("La contraseña anterior no coincide");
             Router::redirect("perfil/cambiarpass/{$id_profesor}");
             die;
         }
         $prof_pass->password = $prof->encriptar($inputs['password']);
         if ($prof_pass->update()) {
             Flash::valid("La contraseña ha sido cambiada con éxito");
         } else {
             Flash::error("No se pudo cambiar la contraseña");
         }
         Input::delete();
     }
 }
Пример #12
0
 public function login()
 {
     $this->title = 'Iniciar sesión';
     Load::lib('SdAuth');
     if (!SdAuth::isLogged()) {
         if (Input::hasPost('txt_login')) {
             Flash::warning(SdAuth::getError());
         }
         Input::delete('txt_password');
         return FALSE;
     } else {
         return Router::redirect('/');
     }
 }
 /**
  * Método para editar el databases
  */
 public function databases()
 {
     if (Input::hasPost('development') && Input::hasPost('production')) {
         try {
             Sistema::setDatabases(Input::post('development'), 'development');
             Sistema::setDatabases(Input::post('production'), 'production');
             DwMessage::valid('El archivo de conexión se ha actualizado correctamente!');
         } catch (KumbiaException $e) {
             DwMessage::error('Oops!. Se ha realizado algo mal internamente. <br />Intentalo de nuevo!.');
         }
         Input::delete('databases');
     }
     $this->databases = DwConfig::read('databases', '', true);
     $this->page_module = 'Configuración de conexión';
 }
 public function crear()
 {
     View::template('formularioregistro');
     $this->titulo = "Crear Usuario";
     // titulo a mostrar
     /**
      * Se verifica si el usuario envio el form (submit) y si ademas
      * dentro del array POST existe uno llamado "menus"
      * el cual aplica la autocarga de objeto para guardar los
      * datos enviado por POST utilizando autocarga de objeto
      */
     if (Input::hasPost('Usuario')) {
         /**
          * se le pasa al modelo por constructor los datos del form y ActiveRecord recoge esos datos
          * y los asocia al campo correspondiente siempre y cuando se utilice la convención
          * model.campo
          */
         //print_r($_POST);
         //En caso que falle la operación de guardar
         if ($_POST['Usuario']['contrasena'] == $_POST['CONFIRMAR_CONTRASENA']) {
             if (preg_match("/^.*(?=.{8,})(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).*\$/", $_POST['Usuario']['contrasena'])) {
                 $con = md5($_POST['Usuario']['contrasena']);
                 $com = md5($_POST['CONFIRMAR_CONTRASENA']);
                 $_POST['CONFIRMAR_CONTRASENA'] = $com;
                 $_POST['Usuario']['contrasena'] = $con;
                 $correo = $_POST['Usuario']['email'];
                 $nombre = $_POST['Usuario']['nombre'] + $_POST['Usuario']['apellido'];
                 $Usuario = new Usuario(Input::post('Usuario'));
                 $Usuario->initialize();
                 //acá verificar correo
                 if (!$Usuario->save()) {
                     Flash::error('Falló Operación');
                 } else {
                     $mail = new PHPMailer();
                     $mail->isSMTP();
                     //$mail­>SMTPDebug = 2;
                     $mail->SMTPAuth = true;
                     $mail->SMTPSecure = "ssl";
                     $mail->Host = "smtp.gmail.com";
                     $mail->Port = 465;
                     $mail->Username = "******";
                     $mail->Password = "******";
                     $mail->setFrom('*****@*****.**', 'Gesti&oacute;n Documental');
                     //$mail­>AddReplyTo("*****@*****.**", "Steven Ruiz");
                     $mail->Subject = "Resgistro en Sistema Gesti&oacute;n Documental PIS";
                     $mail->msgHTML("https://localhost/trunk/usuario/ingresar");
                     //$address = "*****@*****.**";
                     $mail->addAddress($correo, $nombre);
                     if (!$mail->send()) {
                         echo "Error al enviar: " . $mail->ErrorInfo;
                     }
                     //Eliminamos el POST, si no queremos que se vean en el form
                     Input::delete();
                     return Router::redirect("registro/registroexitoso");
                 }
             } else {
                 Flash::error('La contraseña debe contener mínimo 8 caracteres, debe incluir una mayúscula');
             }
         } else {
             Flash::error('Las contraseñas no coinciden');
         }
     }
 }
Пример #15
0
 /**
  * Cambia la clave de un usuario.
  * @param long $id
  * @return View
  */
 public function cambiar_clave($id = null)
 {
     if ($id) {
         if (Input::hasPost('usuario')) {
             try {
                 $data = Input::post('usuario');
                 if (Load::model('usuario')->cambiar_clave($id, $data['clave'], $data['clave2'])) {
                     Flash::success('Cambio de clave realizado exitosamente.');
                     return Router::route_to('action: index');
                 } else {
                     Input::delete();
                 }
             } catch (KumbiaException $kex) {
                 Input::delete();
                 Flash::warning("Lo sentimos ha ocurrido un error:");
                 Flash::error($kex->getMessage());
             }
         }
     } else {
         Flash::warning('No es un usuario válido.');
         return Router::redirect();
     }
 }
 public function restaurarcuenta()
 {
     View::template('sbadmin');
     if (Input::hasPost('correo')) {
         $Usuario = new Usuario();
         $direccion = $_POST['correo']['email'];
         if ("SELECT count(*) FROM usuario WHERE email = '{$direccion}'" == 1) {
             $mail = new PHPMailer();
             $mail->isSMTP();
             //$mail­>SMTPDebug = 2;
             $mail->SMTPAuth = true;
             $mail->SMTPSecure = "ssl";
             $mail->Host = "smtp.gmail.com";
             $mail->Port = 465;
             $mail->Username = "******";
             $mail->Password = "******";
             $mail->setFrom('*****@*****.**', 'Gestión Documental');
             //$mail­>AddReplyTo("*****@*****.**", "Steven Ruiz");
             $mail->Subject = "asunto";
             $mail->msgHTML("mensaje");
             //$address = "*****@*****.**";
             $mail->addAddress($_POST['correo']['email'], "...");
             if (!$mail->send()) {
                 echo "Error al enviar: " . $mail->ErrorInfo;
             }
             Input::delete();
         } else {
             print_r("No hay cuenta asociada al correo digitado");
         }
     }
 }