/** * @return bool */ public function valid() { $size = self::$db->size($this->name()); if ($this->position < $this->buffer_position || $this->position >= $this->buffer_position + $size) { $this->buffer_position = intval($this->position / $size) * $size; $this->buffer = self::$db->getIndexes($this->name(), $this->buffer_position, $size); } return isset($this->buffer[$this->position - $this->buffer_position]); }
require_once NOALYSS_INCLUDE . '/class_database.php'; /* * Check if user exists, if yes save a recover request */ $login_input = HtmlInput::default_value_request("login", ""); $email_input = HtmlInput::default_value_request("email", ""); $cn = new Database(0); $valid = false; if (trim($login_input) != "") { $array = $cn->get_array("select use_id,use_email,use_login from ac_users where lower(use_login)=lower(\$1) ", array($login_input)); } elseif (trim($email_input) != "") { $array = $cn->get_array("select use_id,use_email,use_login from ac_users where " . " lower(use_email)=lower(\$1) ", array($email_input)); } else { return; } if ($cn->size() != 0) { list($user_id, $user_email, $user_login) = array_values($array[0]); if (trim($user_email) != " ") { $valid = true; } } if ($valid == true) { $request_id = generate_random(SIZE_REQUEST); $user_password = generate_random(10); /* * save the request into */ $cn->exec_sql("insert into recover_pass(use_id,request,password,created_on,created_host) " . " values (\$1,\$2,\$3,now(),\$4)", array($user_id, $request_id, $user_password, $_SERVER['REMOTE_ADDR'])); /* * send an email */
/** * \brief return an array with all the active users who can access * $p_dossier including the global admin. * The user must be activated * * \param $p_dossier dossier * \return an array of user's object * array indices * - use_id (id ) * - use_login (login of the user) * - use_name * - use_first_name * * \exception throw an exception if nobody can access */ static function get_list($p_dossier) { $sql = "select distinct use_id,use_login,use_first_name,use_name from ac_users\n left outer join jnt_use_dos using (use_id)\n where\n (dos_id=\$1 and use_active=1) or (use_active=1 and use_admin=1)\n order by use_login,use_name"; $repo = new Database(); $array = $repo->get_array($sql, array($p_dossier)); if ($repo->size() == 0) { throw new Exception('Error inaccessible folder'); } return $array; }
if ($db->get_value(' select val from repo_version') <= $i) { $db->execute_script('sql/patch/ac-upgrade' . $i . '.sql'); } } ?> <p style="text-align: center"> <A style="" class="button" HREF="../index.php">Connectez-vous à NOALYSS</A> </p> <?php exit; } /* * If multi folders */ $Resdossier = $cn->exec_sql("select dos_id, dos_name from ac_dossier"); $MaxDossier = $cn->size($Resdossier); //---------------------------------------------------------------------- // Upgrade the folders //---------------------------------------------------------------------- for ($e = 0; $e < $MaxDossier; $e++) { $db_row = Database::fetch_array($Resdossier, $e); echo "<h3>Patching " . $db_row['dos_name'] . '</h3>'; $name = $cn->format_name($db_row['dos_id'], 'dos'); if ($cn->exist_database($name) > 0) { $db = new Database($db_row['dos_id'], 'dos'); $db->apply_patch($db_row['dos_name']); Dossier::synchro_admin($db_row['dos_id']); } else { echo_warning(_("Dossier inexistant") . " {$name}"); } }