function reg_string($string) { $result = preg_replace('([{}\\(\\)\\^$&._%#!@=<>:;,~`\\�"\'\\*\\?\\/\\+\\|\\[\\\\]|\\]|\\-)', '', $string); $result = removeAccents($result); $result = strtolower($result); return str_replace(" ", "_", $result); }
/** * @method - Realizar cadastro de usuário */ public function register() { if ($_SERVER['REQUEST_METHOD'] == "POST") { /** @var $table_name - Definir tabela que será utilizada neste método */ $table_name = 'usuario'; // Armazenar nome passado por POST $name_in_post = @$_POST['nome']; // Tratrar nomes com acentos para validação do "Form_validate" @($_POST['nome'] = removeAccents(utf8_decode($name_in_post))); $this->form_validation->set_rules('nome', 'Nome', 'required|alpha_numeric_spaces|min_length[3]|max_length[20]'); $this->form_validation->set_rules('senha', 'Senha', 'required|alpha_numeric|min_length[8]|max_length[15]'); $this->form_validation->set_rules('confirme_senha', 'Confirmação de Senha', 'required|matches[senha]|min_length[8]|max_length[15]'); $this->form_validation->set_rules('email', 'e-mail', 'required|valid_email|is_unique[' . $table_name . '.email]|min_length[8]|max_length[45]'); $this->form_validation->set_message('is_unique', 'O e-mail ' . (!empty($_POST['email']) ? '" <b>' . @$_POST['email'] . '</b> "' : "") . ' já está cadastrado no sistema, tente outro! :)'); if ($this->form_validation->run() == FALSE) { /** Tratar nova captcha */ $data['filename'] = $this->_generateCaptcha()['filename']; $data['alert'] = 'alert-danger'; $data['message'] = validation_errors(' ', '<br/>'); form_view($this, 'register', $this->session->logged_in, $data); } elseif ($this->session->captcha_value == strtoupper(@$_POST['codigo_captcha'])) { // Armazena dados recebidos do formulário de cadastro $data_register['nome'] = trim($name_in_post); /* Recupera nome inicial passado por POST */ $data_register['email'] = trim($_POST['email']); $data_register['senha'] = md5($_POST['senha']); if ($this->sys_mod->userRegister($this, $table_name, $data_register)) { /** Tratar nova captcha */ $data['filename'] = $this->_generateCaptcha()['filename']; $data['alert'] = 'alert-success'; $data['message'] = 'Seu cadastro foi realizado com sucesso, verifique seu e-mail para ativar sua conta.'; form_view($this, 'register', $this->session->logged_in, $data); unset($table_name, $name_in_post, $data, $data_register, $_POST); } else { /** Tratar nova captcha */ $data['filename'] = $this->_generateCaptcha()['filename']; $data['alert'] = 'alert-danger'; $data['message'] = ':( Desculpe! Ocorreu um erro inesperado durante seu cadastro. Por favor, tente novamente.'; form_view($this, 'register', $this->session->logged_in, $data); } } else { /** Tratar nova captcha */ $data['filename'] = $this->_generateCaptcha()['filename']; $data['alert'] = 'alert-warning'; $data['message'] = ':| O código de verificação digitado não corresponde ao da imagem. Por favor, tente novamente.'; form_view($this, 'register', $this->session->logged_in, $data); } unset($table_name, $name_in_post, $data, $data_register, $_POST); } else { /** Tratar nova captcha */ $data['filename'] = $this->_generateCaptcha()['filename']; form_view($this, 'register', $this->session->logged_in, $data); unset($data, $_POST); } }
function OptimiseUrl($chaine) { $chaine = removeAccents($chaine); $chaine = strtolower($chaine); $accents = array("/é/", "/è/", "/ê/", "/ë/", "/ç/", "/à/", "/â/", "/á/", "/ä/", "/ã/", "/å/", "/î/", "/ï/", "/í/", "/ì/", "/ù/", "/ô/", "/ò/", "/ó/", "/ö/"); $sans = array("e", "e", "e", "e", "c", "a", "a", "a", "a", "a", "a", "i", "i", "i", "i", "u", "o", "o", "o", "o"); $chaine = preg_replace($accents, $sans, $chaine); $chaine = preg_replace('#[^A-Za-z0-9]#', '-', $chaine); // Remplace les tirets multiples par un tiret unique $chaine = preg_replace('#-+#', '-', $chaine); // Supprime le dernier caractère si c'est un tiret $chaine = rtrim($chaine, '-'); while (strpos($chaine, '--') !== false) { $chaine = str_replace('--', '-', $chaine); } return $chaine; }
public function __construct($input, $cidr = null, $rir = null, $useRaw = false) { $this->esClient = new ClientBuilder(); $this->ipUtils = new IpUtils(); $this->whoisUrl = config('app.whois_query_url'); // Check if we supply direct raw whois details if ($useRaw === true && is_null($rir) !== true) { $this->rir = $rir; $this->rawData = $input; $this->rawLines = explode("\n", $input); return; } $this->input = $this->ipUtils->normalizeInput(trim($input), $showAS = true); $allocation = $this->ipUtils->getAllocationEntry($this->input, $cidr); if (is_null($allocation) === true || empty($allocation) === true) { $assignment = $this->ipUtils->getIanaAssignmentEntry($this->input); if (is_null($assignment) === true || empty($assignment) === true) { $this->rawData = null; $this->rawLines = []; return; } else { $this->rir = Rir::where('whois_server', $assignment->whois_server)->first(); } } else { $this->rir = Rir::find($allocation->rir_id); } if (empty($this->rir) || is_null($this->rir) === true) { $this->rawData = null; $this->rawLines = []; return; } $this->allocationData = $allocation; // Lets fetch the raw whois data if (is_null($cidr) !== true) { $this->input .= '/' . $cidr; } $this->rawData = removeAccents($this->getRawWhois()); $this->rawLines = explode("\n", $this->rawData); }
function sanitize($str) { $str = removeAccents($str); $str = mb_strtolower($str); $str = str_replace(['biblioteca', 'publica', 'municipal'], '', $str); return trim($str); }
$conditions = array(); $tabPhotos = array(); $status = "ok"; if (isset($_GET["collection"]) && strlen($_GET["collection"]) > 0) { $refineRequest .= " join picone.collections on photos.url = collections.url "; $conditions[] = "login = :collection"; } if (isset($_GET["category"]) && strlen($_GET["category"]) > 0) { $conditions[] = "categories like :category"; } if (isset($_GET["author"]) && strlen($_GET["author"]) > 0) { $conditions[] = "author = :author"; } if (isset($_GET["keywords"]) && strlen($_GET["keywords"]) > 0) { $goodKeywords = strtolower($_GET["keywords"]); $goodKeywords = removeAccents($goodKeywords); $tabKeywords = explode(" ", $goodKeywords); foreach ($tabKeywords as $key => $keyword) { $conditions[] = "(keywords like :keyword{$key} or keywords like :subKeyword{$key})"; } } if (count($conditions) != 0) { $refineRequest .= " where " . implode(" and ", $conditions) . " "; } if (isset($_GET["from"]) && strlen($_GET["from"]) > 0) { $nbImages .= " offset " . $_GET["from"] . " "; } if (isset($_GET["limit"]) && strlen($_GET["limit"]) > 0) { $nbImages .= " limit " . $_GET["limit"] . " "; } $stmt = $connexion->prepare("select\n\t\t\tphotos.url,\n\t\t\tphotos.size,\n\t\t\tphotos.mime_type,\n\t\t\tphotos.licence,\n\t\t\tphotos.thumbnail,\n\t\t\tphotos.author,\n\t\t\tphotos.url_author,\n\t\t\tphotos.title,\n\t\t\tphotos.categories,\n\t\t\tphotos.keywords\n\t\tfrom picone.photos\n\t\t" . $refineRequest . "\n\t\torder by adding_date desc\n\t\t" . $nbImages);
function setUrlAmigable($url) { return removeAccents(str_replace(array(" ", "¦", "ñ"), array("_", "", "n"), $url)); }
function sanitizeFieldName($field) { $field = removeAccents($field); $field = strtolower($field); $field = preg_replace('/&.+?;/', '', $field); // kill entities $field = preg_replace('/[^a-z0-9 _-]/', '', $field); $field = preg_replace('/\\s+/', ' ', $field); $field = str_replace(' ', '-', $field); $field = preg_replace('|-+|', '-', $field); $field = trim($field, '-'); return $field; }
} } } #--[ FINALIZE AND CLOSE ]-------------------------------------------------- // Set to output image by default $make_image = 1; // Save mode Web request over-ride if (isset($sig_saveonly)) { $configData['save_only_mode'] = $sig_saveonly; $configData['save_images'] = $sig_saveonly; } // Save the image to the server? if ($configData['save_images'] && $configData['default_message'] != $sig_name) { $save_dir = $configData['save_images_dir']; $saved_name = $sig_name . '@' . $sig_region_name . '-' . $sig_server_name; $saved_name = $configData['save_char_convert'] ? removeAccents($saved_name) : $saved_name; $saved_image = $save_dir . $configData['save_prefix'] . $saved_name . $configData['save_suffix'] . '.' . $configData['save_images_format']; if (file_exists($save_dir)) { if (is_writable($save_dir)) { switch ($configData['save_images_format']) { case 'gif': makeImageGif($im, $configData['main_image_size_w'], $configData['main_image_size_h'], $configData['gif_dither'], $saved_image); break; case 'jpg': @imageJpeg($im, $saved_image, $configData['image_quality']) or debugMode(__LINE__, $php_errormsg); break; case 'png': @imagePng($im, $saved_image) or debugMode(__LINE__, $php_errormsg); break; } if ($configData['save_only_mode']) {
function setUrlAmigable($titulo) { return stringToLower(removeAccents(str_replace(array(" ", "º", "°", "ñ", "Ñ"), array("-", "", "", "n", "N"), $titulo))).".html"; }
/** * @param string $title the title we want to clean up * @param mixed $max_lengthth the max length of the resulting string; if FALSE * is passed then length is unlimited. * * @return string the cleaned up title; removes all spaces and characters that doesn't * looks, for example, in a web url. * @author Giovanni Derks <virtualdarkness[AT]gmail-com> */ function getCleanTitle($title, $max_length = FALSE) { $to_underscore = array(" ", "/", "\\", "-", ".", "'", ":"); $to_null = array("<", ">", ",", ";"); for ($i = 33; $i < 48; $i++) { $chr = chr($i); if (!in_array($chr, $to_underscore)) { $to_null[] = $chr; } } for ($i = 123; $i < 256; $i++) { $chr = chr($i); if (!in_array($chr, $to_underscore)) { $to_null[] = $chr; } } $res = trim($title); $res = removeAccents($res); $res = preg_replace("/&#(.);/", "_", $res); $res = preg_replace("/&(.)grave/", "\$1", $res); $res = preg_replace("/&(.)acute/", "\$1", $res); $res = str_replace($to_underscore, "_", $res); $res = str_replace($to_null, "", $res); $res = preg_replace("/_+/", "_", $res); $res = rawurlencode($res); if ($max_length !== FALSE && strlen($res) > $max_length) { $res = substr($res, 0, $max_length); } $res = trim($res, "_%-"); return $res; }
$_response['signup']['validate']['failed']['email'] = 'Email inválido.'; } if ($email !== $emailConfirm) { $_response['signup']['validate']['failed']['email'] = 'Emails não conferem.'; } if (!isset($_response['signup']['validate']['failed'])) { $maxId = 0; foreach ($db->users as $user) { $maxId = $user->id > $maxId ? $user->id : $maxId; } $dataset = array('id' => ++$maxId, 'riot_id' => $summoner->{$username}->id, 'riot_level' => $summoner->{$username}->summonerLevel, 'name' => $summoner->{$username}->name, 'username' => removeAccents($username), 'password' => $password, 'server' => $server, 'serverFullname' => 'Brasil', 'email' => $email, 'sex' => (int) $sex, "champions" => [], "champions_skins" => []); $getDb = json_decode(file_get_contents("db.json")); array_push($getDb->users, $dataset); file_put_contents('db.json', json_encode($getDb)); $_SESSION['user']['authenticated']['id'] = $dataset['id']; $_response['signup']['validate']['success'] = removeAccents($username); } break; //switch($_GET['subject']) } break; //signup //signup case 'own-all-champions': $user = new User($user_id); foreach ($champions as $champion) { $user->addChampion($champion->id); } break; case 'not-own-all-champions': $user = new User($user_id);
function cmp_nom_arborescence($a, $b) { if (removeAccents(strtolower($a['nom'])) == removeAccents(strtolower($b['nom']))) { return 0; } if (removeAccents(strtolower($a['nom'])) < removeAccents(strtolower($b['nom']))) { return -1; } return 1; }
} } if ($resposta_correta4 != '-1') { if (temAcento($resposta4)) { $resposta4 = removeAccents($resposta4); } if (temAcento($resposta_correta4)) { $resposta_correta4 = removeAccents($resposta_correta4); } } if ($resposta_correta5 != '-1') { if (temAcento($resposta5)) { $resposta5 = removeAccents($resposta5); } if (temAcento($resposta_correta5)) { $resposta_correta5 = removeAccents($resposta_correta5); } } } // ------------------------------ debug ------------------------------------- // echo ' <meta charset="utf-8"> '; //echo ' <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> '; //echo '--------------depois --------</br>'; //echo '<br>'.(trim(strtoupper($resposta1))).'<br>'; //echo (trim(strtoupper($resposta_correta))) ; // se resposta feita igual resposta esperada , acertou /* echo (trim(strtoupper($resposta1)) .'=='. trim(strtoupper($resposta_correta1))) .'<br>'. (trim(strtoupper($resposta2)) .'=='. trim(strtoupper($resposta_correta2))).'<br>'. (trim(strtoupper($resposta3)) .'=='. trim(strtoupper($resposta_correta))).'<br>'. (trim(strtoupper($resposta4)) .'=='. trim(strtoupper($resposta_correta1))).'<br>'. (trim(strtoupper($resposta5)) .'=='. trim(strtoupper($resposta_correta1)));
$sql.= " OR useu.se_buscanombre LIKE :nombre1_".$i; } // Este for quita el caracter en el que se está loopeando.. for ($i=0; $i<strlen($_REQUEST["nombre"]); $i++) { $texto = substr($_REQUEST["nombre"], 0, $i).substr($_REQUEST["nombre"], $i + 1); $params[":nombre2_".$i] = "%".removeAccents(strtoupper(str_replace("ñ", "Ñ", $texto)))."%"; $sql.= " OR useu.se_buscanombre LIKE :nombre2_".$i; } // Este for agrega un comodin antes de cada caracter.. for ($i=0; $i<strlen($_REQUEST["nombre"]); $i++) { $texto = substr($_REQUEST["nombre"], 0, $i)."_".substr($_REQUEST["nombre"], $i); $params[":nombre3_".$i] = "%".removeAccents(strtoupper(str_replace("ñ", "Ñ", $texto)))."%"; $sql.= " OR useu.se_buscanombre LIKE :nombre3_".$i; } $sql.= ")"; $grilla->setParams($params); $grilla->setExtraConditions(array($sql)); $msg = "<div id=\"divGridSinDatos\">No se encontraron datos con las caracteristicas buscadas, quizás quiso buscar a:</div>"; $grilla->setShowMessageNoResults(true); $grilla->Draw(); if ($grilla->recordCount() == 0) $msg = ""; } ?> <script type="text/javascript">
if (mb_detect_encoding($country, 'UTF-8,ISO-8859-1') == "UTF-8") { $country = utf8_encode($country); } if (mb_detect_encoding($state, 'UTF-8,ISO-8859-1') == "UTF-8") { $state = utf8_encode($state); } if (mb_detect_encoding($county, 'UTF-8,ISO-8859-1') == "UTF-8") { $county = utf8_encode($county); } if (mb_detect_encoding($locality, 'UTF-8,ISO-8859-1') == "UTF-8") { $locality = utf8_encode($locality); } } $country = removeAccents($country); $state = removeAccents($state); $county = removeAccents($county); $urlVariables = 'country=' . urlencode($country) . '&state=' . urlencode($state) . '&county=' . urlencode($county) . '&locality=' . urlencode($locality); if (isset($PORTAL_GUID) && $PORTAL_GUID) { $urlVariables .= '&gc=' . $PORTAL_GUID; } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?> "> <title>GEOLocate Tool</title> <link href="<?php echo $clientRoot; ?>
/** * Get Url to search Allocine for a movie * * @author Douglas Mayle <*****@*****.**> * @author Andreas Goetz <*****@*****.**> * @param string The search string * @return string The search URL (GET) */ function allocineSearchUrl($title) { global $allocineServer; // The removeAccents function is added here return $allocineServer . '/recherche/?q=' . urlencode(removeAccents($title)); }
} } $row = 0; $index = 0; $found = false; foreach ($entries as $revision) { // Assume a good match $match = true; $thisrev = $revision->rev; // Check the log for the search words, if searching if ($dosearch) { if (empty($fromRev) || $fromRev > $thisrev) { // Turn all the HTML entities into real characters. // Make sure that each word in the search in also in the log foreach ($words as $word) { if (strpos(strtolower(removeAccents($revision->msg)), $word) === false && strpos(strtolower(removeAccents($revision->author)), $word) === false) { $match = false; break; } } if ($match) { $numSearchResults--; $found = true; } } else { $match = false; } } $thisRevString = createRevAndPegString($thisrev, $peg ? $peg : $thisrev); if ($match) { // Add the trailing slash if we need to (svnlook history doesn't return trailing slashes!)