public static function existe_usuario(oob_user $user) { global $ari; $string = $ari->db->qMagic($user->id()); if (count($result = static::getList(false, false, false, false, false, false, false, "AND id_usuario = {$string}")) == 1) { return $result; } else { return false; } }
} if (!isset($_POST['data'])) { $_POST['data'] = ""; } if (!isset($_POST['query'])) { $_POST['query'] = ""; } $start = $_POST["start"]; $count = $_POST["limit"]; //Para eliminar Usuarios if (isset($_POST['DeleteUserData'])) { //se decodifica el json en un array y hacemos each para recorrer los roles que desea eliminar el usuario $change_status = json_decode($_POST['DeleteUserData'], true); $ari->db->StartTrans(); foreach ($change_status as $id_user) { $user = new oob_user($id_user['id']); $user->delete(); } if ($ari->db->CompleteTrans()) { $ari->clearCache(); } } //Para cambiar el estado de los usuarios if (isset($_POST['UpdateStateData'])) { //se decodifica el json en un array y se le pasa al metodo para cambiar el estado a los usuarios $change_status = json_decode($_POST['UpdateStateData'], true); oob_user::updateStatusFor($change_status['items'], $change_status['status']); } //end if //FILTRO POR COLUMNAS $where = "";
header("Location: " . $ari->get("adminaddress") . '/'); exit; } // no button get, standard action if (!isset($_POST['login'])) { header("HTTP/1.1 401 Unauthorized"); $ari->t->assign("error", false); $ari->t->assign('SENT_DUPLICATE_DATA', false); } else { // login! //verificar datos enviados duplicados if (!$sp->Validar()) { $ari->t->assign('error', true); $ari->t->assign('SENT_DUPLICATE_DATA', true); } else { if (oob_user::login($_POST['uname'], $_POST['pass'])) { if (isset($_SESSION['redirecting'])) { $dirijidme = $_SESSION['redirecting']; unset($_SESSION['redirecting']); header("Location: " . $ari->get("adminaddress") . $dirijidme); } else { header("Location: " . $ari->get("adminaddress") . '/'); } exit; } else { $ari->t->assign("error", true); } } } $ari->t->assign("formElement", $sp->FormElement()); $ari->t->display($ari->module->admintpldir() . "/login.tpl");
} //see if a user can register from user-interface $allowregister = false; $ar_config = $ari->get("config")->get('can-self-register', 'user'); if ($ar_config === "true" || $ar_config === "yes") { $allowregister = true; } // no butto get, standard action if (!isset($_POST['register'])) { $ari->t->assign("register", $allowregister); $ari->t->assign("error", false); $ari->t->display($ari->module->usertpldir() . "/login.tpl"); } //nuevo if (isset($_POST['register'])) { $usuario = new oob_user(); $usuario->set('uname', $_POST['uname']); $usuario->set('password', $_POST['pass']); $usuario->set('email', $_POST['email']); $validation = $usuario->get('new_validation'); if ($validation == "no") { $usuario->set('status', "1"); } else { $usuario->set('status', "0"); } if (!isset($_POST['condiciones']) || $_POST['condiciones'] != 'checkbox') { $usuario->error()->addError("INVALID_condiciones"); } if (isset($_POST['pass']) && isset($_POST['passtwo']) && $_POST['pass'] === $_POST['passtwo']) { if ($usuario->store()) { $usuario->linkStandardGroup();
global $ari; $handle = $ari->url->getVars(); $ari->t->caching = 0; $ari->popup = true; // valida pos $pos = 0; if (isset($_GET['pos']) && OOB_validatetext::isNumeric($_GET['pos']) && $_GET['pos'] > 0) { $pos = $_GET['pos']; } //levanta el limit $modulo = new oob_module("personnel"); $limit = $modulo->config()->get('limit', 'employee'); $ari->t->assign('limit', $limit); $ari->t->assign('total', oob_user::userCountNoAsigned()); $users = array(); if ($return = oob_user::listNoAssigned('uname', $pos, $limit)) { // show time $i = 0; foreach ($return as $u) { $users[$i]['id'] = $u->get('user'); $users[$i]['uname'] = $u->name(); $users[$i]['unameClean'] = OOB_validatetext::cleanToScript($u->name()); $users[$i]['email'] = $u->get('email'); $users[$i]['status'] = oob_user::getStatus($u->get('status')); ++$i; } } //end if $ari->t->assign("users", $users); // display $ari->t->display($ari->module->admintpldir() . "/user_selectforemployee.tpl");
$perfil->set('fecha_nacimiento', new Date($_POST['fecha_nacimiento_Year'] . '-' . oob_validatetext::addZero($_POST['fecha_nacimiento_Month']) . '-' . oob_validatetext::addZero($_POST['fecha_nacimiento_Day']) . ' 00:00:00')); $perfil->set('telefono', $_POST['telefono']); $perfil->set('bio', $_POST['bio']); $perfil->set('url', $_POST['url']); if ($usuario->store()) { if ($new_user) { $usuario->linkStandardGroup(); } $perfil->set('usuario', $usuario); if ($perfil->store()) { if ($new_user) { // mandar mail de nuevo usuario $perfil->enviar_mail_perfil_nuevo(); // si el usuario puede loguearse if ($validation == "no") { oob_user::login($_POST['usuario'], $_POST['pass']); } else { $_SESSION['redirecting'] = '/seguridad/pending'; } if (isset($_SESSION['redirecting'])) { $default_login = $_SESSION['redirecting']; unset($_SESSION['redirecting']); } } header("Location: " . $ari->get('webaddress') . $default_login); exit; } } $ari->t->assign("error", true); $errores = array(); // errores del usuario
<?php #OOB/N1 Framework [2008 - Nutus] - PM // Codigo por JPC // Script que procesa los datos del FORM MI CUENTA global $ari; $ari->popup = 1; $resultado = array(); $resultado["errors"] = array(); $resultado["success"] = false; //id if (isset($_POST['id'])) { if (OOB_validatetext::isNumeric($_POST['id'])) { $usuario = new oob_user($_POST['id']); } else { throw new OOB_exception("INVALID_ID_VALUE", "501", "INVALID_ID_VALUE", false); } } else { throw new OOB_Exception_400("La variable [id] no esta definida"); } /* Asignamos los valores al objeto directamente del formulario */ // password if (isset($_POST['txt_pass'])) { if ($_POST['txt_pass'] != "") { $usuario->set('password', $_POST['txt_pass']); } } else { throw new OOB_Exception_400("La variable [txt_pass] no esta definida"); } // email if (isset($_POST['txt_email'])) {
global $ari; $ari->popup = 1; // no mostrar el main_frame $page_size = PAGE_SIZE; //STORE PARA TRAER EL LISTADO DE USUARIOS $store = new PhpExt_Data_JsonStore(); $store->setUrl("/seguridad/user/get_users")->setRoot("topics")->setId("id")->setTotalProperty("totalCount"); //AGREGO LOS CAMPOS AL STORE $store->addField(new PhpExt_Data_FieldConfigObject("id")); $store->addField(new PhpExt_Data_FieldConfigObject("uname")); $store->addField(new PhpExt_Data_FieldConfigObject("email")); $store->addField(new PhpExt_Data_FieldConfigObject("status")); $check_select = new PhpExt_Grid_CheckboxSelectionModel(); //Paso los estado a json $estados = array(); foreach (oob_user::getStatus() as $id => $descripcion) { $estados[] = array($id, $descripcion); } $filter_plugin = new PhpExtUx_Grid_GridFilters(); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("numeric", "id")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("string", "uname")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("string", "email")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("list", "status", PhpExt_Javascript::variable(json_encode($estados)), PhpExt_Javascript::variable("1"), true)); $col_model = new PhpExt_Grid_ColumnModel(); $col_model->addColumn($check_select)->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Id", "id", null, 40))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Usuario", "uname", null, 140))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Email", "email", null, 170))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Estado", "status")); $paging = new PhpExt_Toolbar_PagingToolbar(); $paging->setStore($store)->setPageSize($page_size)->setDisplayInfo(true)->setEmptyMessage("No se encontraron usuarios"); $paging->getPlugins()->add($filter_plugin); //GRILLA $grid = new PhpExt_Grid_GridPanel(); $grid->setStore($store)->setSelectionModel($check_select)->setColumnModel($col_model)->setLoadMask(true)->setenableColLock(false);
$operador_fin = ")"; break; } $where .= " AND {$filtro['field']} {$operador_inicio}{$filtro['value']}{$operador_fin} "; } } //FIN DE FILTROS //FILTRO DE BUSQUEDA POR 3 COLUMNAS if ($_POST['SearchData'] != "") { $value = $_POST['SearchData']; $where = " AND (uname LIKE '%{$value}%' OR email LIKE '%{$value}%' OR id='{$value}') "; } $return = array(); if ($usuarios = oob_user::search("all", 'uname', $where, $start, $count)) { $i = 0; foreach ($usuarios as $u) { $return[$i]['id'] = $u->get('user'); $return[$i]['uname'] = $u->name(); $return[$i]['email'] = $u->get('email'); $return[$i]['status'] = oob_user::getStatus($u->get('status')); $i++; } } $result = array(); $result["totalCount"] = oob_user::searchCount("all", $where); $result["topics"] = $return; $fp = fopen("hola.txt", "w+"); fwrite($fp, json_encode($result)); fclose($fp); //RESULTADO echo json_encode($result);
$error[]='INVALID_CODE'; if (!isset($_POST['email']) || $_POST['email'] == null) $error[]='INVALID_EMAIL'; if (!isset($_POST['pass']) || !isset($_POST['passtwo']) || $_POST['pass'] == null || $_POST['passtwo'] == null) {$error[]='INVALID_PASSWORD';} else { if ($_POST['pass'] !== $_POST['passtwo']) $error[]='INVALID_PASSWORD_MATCH'; } if (count($error) == 0) { if (oob_user::validateLost($_POST['code'],$_POST['email'],$_POST['pass'])) { header( "Location: " . $ari->get('webaddress') . '/seguridad/restored'); exit; } else { $ari->t->assign('error', true); $ari->t->assign('INVALID_CODE', true); $ari->t->assign ('email', htmlentities($_POST['email'],0,'UTF-8')); } } else { $ari->t->assign('error', true); foreach ($error as $mal) { $ari->t->assign($mal, true); }
* Created on 26/02/2005 * @author Pablo Micolini */ /////----------- require_once "../engine.php"; require_once "../oob_user.php"; $GLOBALS['ari'] = new OOB_ari(); //$u= new oob_user(1); // //if ($u->get("uname")) // print $u->get("uname"); //else // print "fail"; //print $u->get("status"); //print "<hr>"; $auuu = oob_user::login("a", "pablo"); if (!$auuu) { print "no user<hr>"; print md5("juan"); } // $auuu->set ('email',"*****@*****.**"); //$auuu->logout(); //$auuu = oob_user::islogued(); //print "returns:". $auuu; // //print "<hr>"; if (is_a($auuu, 'OOB_user')) { // print $auuu->get("email"); $auuu->set('email', '*****@*****.**'); $auuu->set('status', 'a');
<?php global $ari; $ari->popup = 1; $resultado = array(); $resultado["errors"] = array(); $resultado["success"] = false; if (!isset($_POST['username'])) { throw new OOB_Exception_400("La variable [username] no esta definida"); } if (!isset($_POST['password'])) { throw new OOB_Exception_400("La variable [password] no esta definida"); } if (oob_user::login($_POST['username'], $_POST['password'])) { $resultado["success"] = true; } else { $resultado["success"] = false; } //RESULTADO $obj_comunication = new OOB_ext_comunication(); $obj_comunication->set_data($resultado); $obj_comunication->send(true, true);
/** parses content and outputs */ public function generateOutput() { $this->internalChrono('start_generate'); // shows debug output from DB if ($this->debug) { $this->db->debug= true; $this->db->LogSQL(); } // check user login $this->user= oob_user :: islogued(); $this->internalChrono('user_validate'); // url handler $this->url= new OOB_urlhandler(false, $this->mode); $newurl= $this->config->get('homeelement', 'main'); if ($this->mode == 'user') { if ($this->url->redirectURL() != false) $this->url= new OOB_urlhandler($this->url->redirectURL()); if ($this->url->getModule() == "") $this->url= new OOB_urlhandler($newurl, $this->mode); } if ($this->mode == 'admin' && $this->url->getModule() == "") $this->url= new OOB_urlhandler('/about', $this->mode); $this->perspective = $this->url->getPerspective(); //end url handler $this->internalChrono('url_handler'); $this->t = $this->newTemplate(); $this->internalChrono('template_clone'); if ($this->mode == 'user') $this->t->assign("webdir", $this->webaddress . $this->perspective->safeName()); //security check if admin is logued if ($this->mode == 'admin' && $this->user == false && !in_array($this->url->realURI(),array('/','/favicon.ico','/seguridad/login_ajax'))) { if (!isset ($_SESSION['redirecting']) && $this->url->realURI() !== '/admin/newtab' ) // no queremos que se rediriga al new_tab, xq no es una pantalla { $_SESSION['redirecting']= $this->url->realURI(); } $this->filename= 'login.tpl'; $this->url= new OOB_urlhandler("/seguridad/login", 'admin'); } $this->internalChrono('user_check'); //$this->internalChrono('start_ob'); // //clean output buffer // @ob_clean(); // // //start buffering // ob_start(); // // // ask the module for the real action // $this->loadModule(); //$this->internalChrono('load_module'); // //send module output buffer to a var // $this->mod_content= ob_get_clean(); //$this->internalChrono('get_content'); // //clean output buffer again // //$this->internalChrono('end_ob'); // as it seems that eval is faster than normal code, i'll just eval this part $this->mod_content = eval ("@ob_clean();ob_start();\$this->loadModule(); return ob_get_clean();"); $this->internalChrono('eval_loadmodule'); if ($this->popup == false) { eval ("ob_start();return \$this->perspective->generateOutput();ob_end_flush();"); } else { eval ("ob_start();print \$this->mod_content;ob_end_flush();"); } $this->internalChrono('perspective_generate'); if ($this->debug) { $this->db->debug= false; $this->ExecutionMonitor(); print "</br></br><hr><h2>Performance Monitor</h2></br></br>"; $perf= NewPerfMonitor($this->db); $perf->UI(5); } $this->internalChrono('end_generate'); $this->db->StartTrans(); session_write_close(); $this->db->CompleteTrans(); }