function getStoryAttributes($xpath, $story) { $story_author = $xpath->query("//div[@id='profile_top']/a[1]"); $story_title = $xpath->query("//div[@id='profile_top']/b"); $story_desc = $xpath->query("//div[@id='profile_top']/div"); $story_image = $xpath->query("//div[@id='profile_top']/span/img/@src"); $story_chapters = $xpath->query("//select[@id='chap_select']/option"); // ========== GET STORY PROPERTIES ========== // foreach ($story_title as $title) { $story["title"] = stripAccents(verify($title->nodeValue)); //echo "title: " . $story["title"] . "\r\n"; } foreach ($story_author as $author) { $story["author"] = verify($author->nodeValue); //echo "author: " . $story["author"] . "\r\n"; } foreach ($story_desc as $desc) { $story["desc"] = verify($desc->nodeValue); //echo "description: " . $story["desc"] . "\r\n"; } foreach ($story_image as $image) { $story["image"] = verify($image->nodeValue); //echo "image src: " . $story["image"] . "\r\n"; } $story["numChapter"] = 1; $story["hasChapters"] = $xpath->evaluate("boolean(//select[@id='chap_select'])"); if (!isset($story["author"]) || !isset($story["title"]) || !isset($story["desc"])) { throw new WrongFormatException("Data received contained invalid format."); } $story["numChapter"] = 1; $story["chapters"] = array(); $story["chapters"]["title"] = array(); $story["chapters"]["content"] = array(); if ($story["hasChapters"]) { foreach ($story_chapters as $chapter) { $new_url = $story["story_url"] . $story["numChapter"] . "/"; $title = verify($chapter->nodeValue); if (startsWith($title, $story["numChapter"] . ".")) { $title = str_replace($story["numChapter"] . ". ", "", $title); array_push($story["chapters"]["title"], $title); array_push($story["chapters"]["content"], getChapter($new_url, $story["debug"])); } else { break; } $story["numChapter"]++; } } else { array_push($story["chapters"]["title"], $story["title"]); array_push($story["chapters"]["content"], getChapter($story["story_url"], $story["debug"])); } return $story; }
/** Removes from string all characters aren't representing words */ function cleanString($string) { $string = utf8_decode($string); // Replace the accents $string = stripAccents($string); $string = strtolower($string); // Patterns of url or numbers $patterns = array(); $patterns[0] = '#http://[a-zA-Z0-9.\\/]*#'; $patterns[1] = '#\\d#'; $string = preg_replace($patterns, " ", $string); // Pattern of symbols we don't want to process $string = preg_replace('([^A-Za-z])', ' ', $string); //Removing unnecessary blanks $string = preg_replace("#(\n|\t|\\ )+#", " ", $string); $string = trim($string); //echo $string . "<br>"; return $string; }
function ejes() { $ret = array(); $s = new Scrapper(file_get_contents('http://portal.ejes.com/tapas-del-dia/')); $tapas = array('Nacion', 'Herald', 'Pagina', 'Tiempo', 'Pais', 'Clarin', 'Cronista', 'Ambito', 'BAE', 'Perfil', 'Economista', 'Estadista'); foreach ($s->query('//ul[@class="tapitas"]//a') as $a) { foreach ($tapas as $tapa) { $diario = str_replace(" ", "", stripAccents($a->text())); if (strpos($diario, $tapa) !== false) { $t = new Scrapper(file_get_contents($a->attr('href'))); foreach ($t->query('//img') as $img) { if (!isset($ret[$diario])) { $ret[$diario] = $img->attr('src'); } } } } } return $ret; }
function getStoryAttributes($xpath, $story) { $parsedUrl = parse_url($story["story_url"]); $host = explode('.', $parsedUrl['host']); $subdomain = $host[0]; $cookies = "HasVisited=bypass page next time; path=/; domain={$subdomain}.adult-fanfiction.org"; $story_author = $xpath->query("//tr[5]/td[2]"); $story_title = $xpath->query("//html/head/title"); $story_chapters = $xpath->query("//select[@name='chapnav']/option"); // ========== GET STORY PROPERTIES ========== // foreach ($story_title as $title) { $story["title"] = str_replace("Story: ", '', stripAccents(trim($title->nodeValue))); } foreach ($story_author as $author) { $story["author"] = str_replace("Author: ", '', str_replace("\t", '', str_replace("\n", '', $author->nodeValue))); } if (!isset($story["author"]) || !isset($story["title"])) { throw new WrongFormatException("Data received contained invalid format. Author: {$story['author']}, Title: {$story['title']}"); } $story["desc"] = ""; $story["numChapter"] = 1; $story["chapters"] = array(); $story["chapters"]["title"] = array(); $story["chapters"]["content"] = array(); foreach ($story_chapters as $chapter) { $new_url = $story["story_url"] . "&chapter=" . $story["numChapter"]; $title = trim($chapter->nodeValue); if (startsWith($title, $story["numChapter"] . ".")) { $title = str_replace($story["numChapter"] . ". ", "", $title); array_push($story["chapters"]["title"], $title); array_push($story["chapters"]["content"], \ForceUTF8\Encoding::fixUTF8(getChapter($new_url, $story["debug"], $cookies, $story["uniqid"]))); } else { break; } $story["numChapter"]++; } return $story; }
* Por lo que ya hay menú */ $html->getElementById('bt-container')->addElement(new element(array('id' => 'menu_usuario', 'tag' => 'div', new element(array('tag' => 'ul', 'class' => 'nav nav-tabs'))))); $html->getElementById('bt-container')->addElement(new element(array('tag' => 'div', 'class' => 'tab-content', 'id' => 'tab-content'))); //Aqui va el contenido de los tabs foreach ($_SESSION['usuario']->getMenu() as $value) { $active = true; /* * Agregamos el contenido y el menu */ try { $html->getElementById('tab-content')->addElement(new element(array('tag' => 'div', 'id' => $value['leyenda'], 'class' => 'tab-pane fade', include_once 'view/' . stripAccents($value['leyenda']) . '.php'))); $html->getElementByTag('head')->addElement(new element(array('tag' => 'script', 'id' => false, 'src' => 'js/' . stripAccents($value['leyenda']) . '.js'))); if ($active) { $html->getElementById($value['leyenda'])->addAtributo('class', 'in active'); $active = false; // Esto es únicamente para el primer tab } // Si hemos llegado aqui el archivo existe y por lo tanto podemos agregar el menu $html->getElementById('menu_usuario')->getElementByTag('ul')->addElement(new element(array('tag' => 'li', new element(array('tag' => 'a', 'data-toggle' => 'tab', 'href' => '#' . $value['leyenda'], '_text' => $value['leyenda']))))); } catch (ErrorException $e) { error_log('No se encontró el archivo view/' . stripAccents($value['leyenda']) . '.php'); } } /* * El primer li en el primer ul en el menu */ $html->getElementById('menu_usuario')->getElementByTag('ul')->getElementByTag('li')->addAtributo('class', 'active'); } echo '<!DOCTYPE html>' . "\n"; echo $html->render();
<?php $con = mysqli_connect('104.207.236.202', 'sunshin4_cabrera', 'todovaletodovale', 'sunshin4_magento'); mysqli_set_charset($con, 'utf8'); $email = $_REQUEST['query']; $query = "SELECT account_id as id, name, email as mail FROM affiliateplus_account where email like '%{$email}%' or name like '%{$email}%' "; function stripAccents($str) { return strtr(utf8_decode($str), utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ'), 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY'); } $results = mysqli_query($con, $query); while ($user = mysqli_fetch_object($results)) { $data[] = stripAccents($user->name); } //var_dump($data); echo json_encode($data);
|-------------------------------------------------------------------------- | Application & Route Filters |-------------------------------------------------------------------------- | | Below you will find the "before" and "after" events for the application | which may be used to do any work before or after a request into your | application. Here you may also register your custom route filters. | */ App::before(function ($request) { App::singleton('organization', function () { $organization = Organization::where('name', 'Arquinova')->get()->first(); $organization->auxName = str_replace(" ", '-', $organization->name); foreach ($organization->projects as $project) { $project->auxName = str_replace(" ", '-', $project->name); $project->auxName = stripAccents($project->auxName); } return $organization; }); App::bind('foo', function ($app) { return new FooBar(); }); View::share('organization', app('organization')); }); /** * Replace accents **/ function stripAccents($str) { return strtr(utf8_decode($str), utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ'), 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY'); }
function GenerateCfonb($debit_id = null) { // Check $debit_id if (defined($debit_id) and !is_numeric($debit_id)) { die('Invalid $debit_id'); } $where = "WHERE state='todo'"; if (!empty($debit_id)) { $where = "WHERE debit_id = {$debit_id}"; } $company_rib = GetCompanyMaiRIB(); define('NUMERO_EMETTEUR', '484779'); define('RAISON_SOCIALE', 'SARL ISVTEC'); define('SIRET', '44875254300034'); define('CODE_GUICHET_SOCIETE', $company_rib->code_guichet); define('NUMERO_COMPTE_SOCIETE', $company_rib->compte); define('CODE_BANQUE', $company_rib->code_banque); define('REF_REMISE', date('dmy')); define('PRELEVEMENT_TYPE', '08'); //08 = standard, 85 = rapide define('LONGUEUR_CODE_BANQUE', '5'); define('LONGUEUR_CODE_GUICHET', '5'); define('LONGUEUR_NUMERO_COMPTE', '11'); define('LONGUEUR_ENREGISTREMENT', '160'); /** * On définit les variables */ $nombre_virements = 0; $montant_total = 0; $montant_total_centimes = 0; $chaine_totale = ""; $nb_erreurs = 0; $erreurs_details = ""; /** * Enregistrement et données de la remise d'ordres de virement * Enregistrement "Emetteur" */ $ligne = ""; $ligne .= FormatBancaire("03", 2); // Code enregistrement - Constante à "03" (2 caractères) $ligne .= FormatBancaire(PRELEVEMENT_TYPE, 2); // Code opération - Virements ordinaires (2 caractères) $ligne .= FormatBancaire("", 8); // Zone réservée (8 caractères) $ligne .= FormatBancaire(NUMERO_EMETTEUR, 6); // Numéro d'émetteur ou d'identification (6 caractères) $ligne .= FormatBancaire("", 1); // Code CCD : inutile dans notre cas (1 caractères) $ligne .= FormatBancaire("", 6); // Zone réservée (6 caractères) $ligne .= FormatBancaire(date('dm') . substr(date('y'), -1), 5); // Date (JJMMA) (5 caractères) $ligne .= FormatBancaire(stripAccents(RAISON_SOCIALE), 24); // Nom ou raison sociale du donneur d'ordre (24 caractères) $ligne .= FormatBancaire(stripAccents(REF_REMISE), 11); // Référence de la remise (7 caractères) $ligne .= FormatBancaire("", 15); // Zone réservée (17 caractères) $ligne .= FormatBancaire("E", 1); // Code monnaie - Constante à "E" (1 caractères) $ligne .= FormatBancaire("", 5); // Zone réservée (5 caractères) $ligne .= FormatBancaire(CODE_GUICHET_SOCIETE, 5); // Code guichet de la banque du conneur d'ordre (5 caractères) $ligne .= FormatBancaire(NUMERO_COMPTE_SOCIETE, 11); // Numéro de compte du donneur d'ordre (11 caractères) $ligne .= FormatBancaire("", 47); // Zone réservée (31 caractères) $ligne .= FormatBancaire(CODE_BANQUE, 5); // Code établissement de la banque du donneur d'ordre (5 caractères) // $ligne .= FormatBancaire(SIRET, 16); // Identifiant du donneur d'ordre (16 caractères) // $ligne .= FormatBancaire("", 31); // Zone réservée (31 caractères) $ligne .= FormatBancaire("", 6); // Zone réservée (6 caractères) // On vérifie l'intégrité de la chaîne if (strlen($ligne) != LONGUEUR_ENREGISTREMENT) { $nb_erreurs++; $erreurs_details .= " - La première ligne \"Emetteur\" contient " . strlen($ligne) . " caractères au lieu de " . LONGUEUR_ENREGISTREMENT . ". La remise d'ordres de virement ne peut être poursuivie.<br />"; } // On complète la chaîne totale $chaine_totale .= $ligne . "\n"; $Invoice = new Facture(); $res = mysql_query('SELECT id, invoice_id ' . 'FROM direct_debit_row ' . "{$where}") or die(mysql_error()); $total_ttc = 0; while ($invoice = mysql_fetch_assoc($res)) { $info = $Invoice->getInfos($invoice['invoice_id']); $total[$info->nom_client]['TTC'] += $info->total_ttc; // On positionne le nombre d'erreurs de cette ligne à zéro $nb_erreurs_ligne = 0; // On définit les variables de la remise de virement $ref_paiement = "F:" . $info->num_facture; // Formatage du montant $montant = round($info->total_ttc, 2); $montant_centimes = round($info->total_ttc * 100, 0); $rib = GetRibFromIban($info->iban); // On recherche les éléments pouvant bloquer la génération du paiement if (strlen($rib['banque']) != LONGUEUR_CODE_BANQUE) { $nb_erreurs++; $nb_erreurs_ligne++; $erreurs_details .= " - Le code banque de \"" . $info->nom_client . "\" permettant de générer un virement d'un montant de " . $montant . " EUR contient " . strlen($rib['banque']) . " caractères au lieu de " . LONGUEUR_CODE_BANQUE . " (valeur constatée : " . $info->rib_code_banque . "). Cette ligne est abandonnée.<br />"; } if (strlen($rib['guichet']) != LONGUEUR_CODE_GUICHET) { $nb_erreurs++; $nb_erreurs_ligne++; $erreurs_details .= " - Le code guichet de \"" . $info->nom_client . "\" permettant de générer un virement d'un montant de " . $montant . " EUR contient " . strlen($rib['guichet']) . " caractères au lieu de " . LONGUEUR_CODE_GUICHET . " (valeur constatée : " . $info->rib_code_guichet . "). Cette ligne est abandonnée.<br />"; } if (strlen($rib['compte']) != LONGUEUR_NUMERO_COMPTE) { $nb_erreurs++; $nb_erreurs_ligne++; $erreurs_details .= " - Le numéro de compte de \"" . $info->nom_client . "\" permettant de générer un virement d'un montant de " . $montant . " EUR contient " . strlen($rib['compte']) . " caractères au lieu de " . LONGUEUR_NUMERO_COMPTE . " (valeur constatée : " . $info->rib_compte . "). Cette ligne est abandonnée.<br />"; } /** * Enregistrement et données de la remise d'ordres de virement * Enregistrement "Destinataire" */ $ligne = ""; $ligne .= FormatBancaire("06", 2); // Code d'enregistrement - Constante à "06" (2 caractères) $ligne .= FormatBancaire(CODE_OPERATION, 2); // Code opération (2 caractères) $ligne .= FormatBancaire("", 8); // Zone réservée (8 caractères) $ligne .= FormatBancaire(NUMERO_EMETTEUR, 6); // Numéro d'émetteur (6 caractères) $ligne .= FormatBancaire($ref_paiement, 12); // Référence (12 caractères) $ligne .= FormatBancaire(stripAccents($info->nom_client), 24); // Nom/Raison sociale du bénéficaire (24 caractères) $ligne .= FormatBancaire(stripAccents(' '), 20); // Domicialiation : facultatif (24 caractères) $ligne .= FormatBancaire("", 12); // Déclaration à la balance des paiements : ??????? (8 caractères) $ligne .= FormatBancaire($rib['guichet'], 5); // Code guichet bénéficiaire (5 caractères) $ligne .= FormatBancaire($rib['compte'], 11); // Numéro de compte bénéficiaire (11 caractères) $ligne .= FormatBancaire($montant_centimes, 16, "0", "right"); // Montant (16 caractères) $ligne .= FormatBancaire($ref_paiement, 31); // Libellé (31 caractères) $ligne .= FormatBancaire($rib['banque'], 5); // Code établissement bénéficiaire (5 caractères) $ligne .= FormatBancaire("", 6); // Zone réservée (6 caractères) // On vérifie l'intégrité de la chaîne if (strlen($ligne) != LONGUEUR_ENREGISTREMENT) { $nb_erreurs++; $nb_erreurs_ligne++; $erreurs_details .= " - La ligne de virement de \"" . $info->nom_client . "\" d'un montant de " . $montant . " EUR contient " . strlen($ligne) . " caractères au lieu de " . LONGUEUR_ENREGISTREMENT . ". Cette ligne est abandonnée.<br />"; } if ($nb_erreurs_ligne == 0) { // Si cette ligne n'a pas générée d'erreur // On compte le nombre de virements à effectuer $nombre_virements++; // On additionne le montant total $montant_total += $montant; // On complèté la chaîne totale $chaine_totale .= $ligne . "\n"; $montant_total_centimes += $montant_centimes; } } // On calcule le montant total en centimes //$montant_total_centimes = round($total_ttc * 100, 0); /** * Enregistrement et données de la remise d'ordres de virement * Enregistrement "Total" */ $ligne = ""; $ligne .= FormatBancaire("08", 2); // Code enregistrement - constante à "08" (2 caractères) $ligne .= FormatBancaire(CODE_OPERATION, 2); // Code opération (2 caractères) $ligne .= FormatBancaire("", 8); // Zone réservée (8 caractères) $ligne .= FormatBancaire(NUMERO_EMETTEUR, 6); // Numéro d'émetteur (6 caractères) $ligne .= FormatBancaire("", 84); // Zone réservée (12 caractères) $ligne .= FormatBancaire($montant_total_centimes, 16, "0", "right"); // Montant de la remise (16 caractères) $ligne .= FormatBancaire("", 42); // Zone réservée (31 caractères) // On vérifie l'intégrité de la chaîne if (strlen($ligne) != LONGUEUR_ENREGISTREMENT) { $nb_erreurs++; $erreurs_details .= " - La dernière ligne \"Total\" contient " . strlen($ligne) . " caractères au lieu de " . LONGUEUR_ENREGISTREMENT . ". La remise d'ordres de virement ne peut être poursuivie.<br />"; } // On complète la chaîne totale $chaine_totale .= $ligne . "\n"; if ($nb_erreurs > 0) { // Des erreurs bloquantes ont été detectées ?> <div class="mess_err"> <?php echo $nb_erreurs; ?> erreur(s) bloquante(s) détectée(s) pour la génération du fichier de remise :<br /> <?php echo $erreurs_details; ?> <br /> Remise d'ordre de virement abandonnée <!-- ' --> </div> <br /><br /> <?php return false; } $myFile = sys_get_temp_dir() . "/cfonb-{$debit_id}.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $chaine_totale); fclose($fh); return $myFile; }
//post-processing if($debug) { print "Post CID retrieval processing.<br>\n<br>\n"; } //remove unauthorized character in the caller id if ($first_caller_id !='') { //$first_caller_id = _utf8_decode($first_caller_id); $first_caller_id = strip_tags($first_caller_id ); $first_caller_id = trim ($first_caller_id); if ($charsetIA5) { $first_caller_id = stripAccents($first_caller_id); } $first_caller_id = preg_replace ( "/[\";']/", "", $first_caller_id); //limit caller id to the first 60 char $first_caller_id = substr($first_caller_id,0,60); } $usage_mode = 'post processing'; foreach($src_array as $source_name) { $thenumber = $theoriginalnumber; $run_param = isset($param[substr($this_scheme,5).'_'.$source_name]) ? $param[substr($this_scheme,5).'_'.$source_name] : array(); eval('include("source-'.$source_name.'.php");'); } if($debug)
$resDir = "../data/" . $group; } else { return; } } if (!is_dir($resDir)) { mkdir($resDir, 0770); } $fp = fopen($resDir . "/ICON_" . $login . '_' . stripAccents($_t) . ".json", "w"); $json_fp = json_encode($_j); $fwrite = fwrite($fp, $json_fp); fclose($fp); $lg .= $group; } // echo json_encode($_j); exit(json_encode(array('default' => 'Enregistrement effectué ! ', 'filename' => 'ICON_' . $login . '_' . stripAccents($_t) . '.json'))); } else { $_j["wallpaper"] = htmlentities($_POST["wallpaper"]); $_j["pos_wallpaper"] = $_POST["pos_wallpaper"]; $_j["iconsize"] = $_POST["iconsize"]; $_j["iconsfield"] = $_POST["iconsfield"]; $_j["iconcolor"] = $_POST["iconcolor"]; $_j["bgcolor"] = $_POST["bgcolor"]; $_j["bgopct"] = $_POST["bgopct"]; $_j["quicklaunch"] = $_POST["quicklaunch"]; $_j["s_idart"] = $_POST["s_idart"]; $_j["winsize"] = $_POST["winsize"]; $_j["win_h"] = $_POST["win_w"]; $_j["win_w"] = $_POST["win_h"]; $_j["data"] = $_POST["data"]; $_j["s_idart"] = $_POST["s_idart"];
$code = ""; } $query = "UPDATE " . SQL_schema_app . ".utilisateur SET \n\tid_cbn=" . sql_format_num($_POST["id_cbn"]) . ",\n\tnom=" . sql_format($_POST["nom"]) . ",\n\tprenom=" . sql_format($_POST["prenom"]) . ",\n\t" . $code . "\n\ttel_bur=" . sql_format($_POST["tel_bur"]) . ",\n\ttel_port=" . sql_format($_POST["tel_port"]) . ",\n\ttel_int=" . sql_format($_POST["tel_int"]) . ",\n\temail=" . sql_format($_POST["email"]) . ",\n\tweb=" . sql_format($_POST["web"]) . ",\n\t" . $query_niveau . "\n\t" . $query_ref . "\n\tdescr=" . sql_format($_POST["descr"]) . " \n\tWHERE id_user='******';"; echo $query; $result = pg_query($db, $query) or die("Erreur pgSQL : " . pg_result_error($result)); add_log("log", 4, $id_user, getenv("REMOTE_ADDR"), "Admin. edit user", $id, "utilisateur"); } else { //------------------------------------------------------------------------------ ADD foreach ($rubrique as $key => $val) { if (empty($_POST["niveau_" . $key])) { $_POST["niveau_" . $key] = 0; } $val_niveau .= sql_format_num($_POST["niveau_" . $key]) . ","; $key_niveau .= "niveau_" . $key . ","; if (empty($_POST["ref_" . $key])) { $_POST["ref_" . $key] = 0; } $val_ref .= sql_format_bool($_POST["ref_" . $key]) . ","; $key_ref .= "ref_" . $key . ","; } $id = strtoupper(substr(stripAccents($_POST['prenom']), 0, 2) . substr(stripAccents($_POST['nom']), 0, 2)) . mt_rand(1, 9); $query = "INSERT INTO " . SQL_schema_app . ".utilisateur (id_user, id_cbn,nom,prenom,login,pw,tel_bur,tel_port,tel_int,email,web,\n\t{$key_niveau}\n\t{$key_ref}\n\tdescr)\n\tVALUES (\n\t\t'" . $id . "',\n\t\t" . sql_format_num($_POST["id_cbn"]) . ",\n\t\t" . sql_format($_POST["nom"]) . ",\n\t\t" . sql_format($_POST["prenom"]) . ",\n\t\t" . sql_format($_POST["login"]) . ",\n\t\t" . sql_format($_POST["pw"]) . ",\n\t\t" . sql_format($_POST["tel_bur"]) . ",\n\t\t" . sql_format($_POST["tel_port"]) . ",\n\t\t" . sql_format($_POST["tel_int"]) . ",\n\t\t" . sql_format($_POST["email"]) . ",\n\t\t" . sql_format($_POST["web"]) . ",\n\t\t{$val_niveau} {$val_ref}\n\t\t" . sql_format($_POST["descr"]) . ");"; echo $query; $result = pg_query($db, $query) or die("Erreur pgSQL : " . pg_result_error($result)); add_log("log", 4, $id_user, getenv("REMOTE_ADDR"), "Admin. ajout user", $id, "utilisateur"); } //------------------------------------------------------------------------------ FONCTIONS function stripAccents($string) { return strtr($string, 'àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝ', 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUY'); }
function like($expression, $chaine) { $chaine = stripAccents($chaine); $expression = stripAccents($expression); return stripos($chaine, $expression) !== false; }
function treeFormat($data) { $new_data = array(); foreach ($data as $user => $value) { $data[$user]["text"] = array("name" => stripAccents(substr($data[$user]["name"], 0, 20)), "title" => "ID:" . $data[$user]["Account_id"], "contact" => "PG:" . $data[$user]["GP"]); $data[$user]["image"] = "rsz_user_demo_images.jpg"; $new_data[$user]["text"] = $data[$user]["text"]; $new_data[$user]["image"] = $data[$user]["image"]; $new_data[$user]["Account_id"] = $data[$user]["Account_id"]; $new_data[$user]["parent_id"] = $data[$user]["parent_id"]; } $new_data = sortBy($new_data, "parent_id", SORT_ASC); return $new_data; }
{ return str_replace(array('à', 'â', 'ä', 'á', 'ã', 'å', 'î', 'ï', 'ì', 'í', 'ô', 'ö', 'ò', 'ó', 'õ', 'ø', 'ù', 'û', 'ü', 'ú', 'é', 'è', 'ê', 'ë', 'ç', 'ÿ', 'ñ', 'À', 'Â', 'Ä', 'Á', 'Ã', 'Å', 'Î', 'Ï', 'Ì', 'Í', 'Ô', 'Ö', 'Ò', 'Ó', 'Õ', 'Ø', 'Ù', 'Û', 'Ü', 'Ú', 'É', 'È', 'Ê', 'Ë', 'Ç', 'Ÿ', 'Ñ'), array('a', 'a', 'a', 'a', 'a', 'a', 'i', 'i', 'i', 'i', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'e', 'e', 'e', 'e', 'c', 'y', 'n', 'A', 'A', 'A', 'A', 'A', 'A', 'I', 'I', 'I', 'I', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'E', 'E', 'E', 'E', 'C', 'Y', 'N'), $text); } //making page to behave like xml document header('Content-Type:text/xml; charset=UTF-8'); try { $xml = "<response>\n"; //getting current time $xml .= "\t<time>" . date('H:i') . "</time>\n"; //calling mail function $feed = check_email("LOGIN_GMAIL", "PASSWORD"); //parsing infos $document = new SimpleXMLElement($feed); $xml .= "\t<unreadmails>\n"; //getting unread mails count $unread_mails_count = $document->fullcount[0]; $xml .= "\t\t<count>" . $unread_mails_count . "</count>\n"; //getting last 3 unread mails infos for ($i = 0; $i < $unread_mails_count && $i < 3; $i++) { $mail = $document->entry[$i]; //formatting infos -> author : title(...) $xml .= "\t\t<mail>" . truncate(stripAccents($mail->author[0]->name[0] . " : " . $mail->title[0]), 50) . "</mail>\n"; } $xml .= "\t</unreadmails>\n"; $xml .= "</response>\n"; } catch (Exception $e) { //setting error message $xml = "<response>\n\t<error/>\n</response>\n"; } //returning infos echo $xml;
<?php require_once './conexion.php'; function stripAccents($string) { return strtr($string, 'àáâãäçèéêëìíîïòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝ', 'aaaaaceeeeiiiiooooouuuuyyAAAAACEEEEIIIIOOOOOUUUUY'); } $tabla = $_GET["tabla"]; $clave = stripAccents(strtolower($_GET["clave"])); if ($tabla == 1) { $query_sql = "\n\tselect array_to_json(array_agg(row(row.*))) AS diagnosticos \n\tfrom (\n\tSELECT *\n\tFROM (\t\n\t\tselect gecodigo,gecodigo||' - '||genombre genombre\n\t\tfrom salud.p_sius_cie10 g\n\t)t where lower ( translate (genombre, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜñ', 'aeiouAEIOUaeiouAEIOUÑ') ) like '%{$clave}%'\n\torder by gecodigo \n\t) row;\n\t"; } elseif ($tabla == 2) { $query_sql = "\n\tselect array_to_json(array_agg(row(row.*))) AS diagnosticos \n\tfrom (\n\tSELECT *\n\tFROM (\t\n\t\tselect gecodigo,gecodigo||' - '||genombre genombre\n\t\tfrom salud.p_sius_grupocie10 g\n\t)t where lower ( translate (genombre, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜñ', 'aeiouAEIOUaeiouAEIOUÑ') ) like '%{$clave}%'\n\torder by gecodigo\n\t) row;\n\t"; } elseif ($tabla == 3) { $query_sql = "\n\tselect array_to_json(array_agg(row(row.*))) AS diagnosticos \n\tfrom (\n\t\tselect codigo gecodigo,codigo||' - '||descripcion genombre\n\t\tfrom salud.p_sius_lista667 \n\t \twhere lower ( translate (descripcion, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜñ', 'aeiouAEIOUaeiouAEIOUÑ') ) like '%{$clave}%'\n\torder by gecodigo\n\t) row;\n\t"; } elseif ($tabla == 4) { $query_sql = "\n\tselect array_to_json(array_agg(row(row.*))) AS diagnosticos \n\tfrom (\n\t\tselect codigo gecodigo,codigo||' - '||descripcion genombre\n\t\tfrom salud.p_sius_lista105 \n\t \twhere lower ( translate (descripcion, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜñ', 'aeiouAEIOUaeiouAEIOUÑ') ) like '%{$clave}%'\n\torder by gecodigo\n\t) row;\n\t"; } elseif ($tabla == 5) { $query_sql = "\n\tselect array_to_json(array_agg(row(row.*))) AS diagnosticos \n\tfrom (\n\t\tselect codigo gecodigo,codigo||' - '||descripcion genombre\n\t\tfrom salud.p_sius_taucher \n\t \twhere lower ( translate (descripcion, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜñ', 'aeiouAEIOUaeiouAEIOUÑ') ) like '%{$clave}%'\n\torder by gecodigo\n\t) row;\n\t"; } elseif ($tabla == 6) { $query_sql = "\n\tselect array_to_json(array_agg(row(row.*))) AS diagnosticos \n\tfrom (\n\t\tselect codigo gecodigo,codigo||' - '||descripcion genombre\n\t\tfrom salud.p_sius_taucher_subgrupo \n\t \twhere lower ( translate (descripcion, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜñ', 'aeiouAEIOUaeiouAEIOUÑ') ) like '%{$clave}%'\n\torder by gecodigo\n\t) row;\n\t"; } elseif ($tabla == 7) { $query_sql = "\n\tselect array_to_json(array_agg(row(row.*))) AS diagnosticos \n\tfrom (\n\t\tselect codigo gecodigo,codigo||' - '||descripcion genombre\n\t\tfrom salud.p_sius_taucher_grupo \n\t \twhere lower ( translate (descripcion, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜñ', 'aeiouAEIOUaeiouAEIOUÑ') ) like '%{$clave}%'\n\torder by gecodigo\n\t) row;\n\t"; } elseif ($tabla == 8) { $query_sql = "\n\tselect array_to_json(array_agg(row(row.*))) AS diagnosticos \n\tfrom (\n\t\tselect codigo gecodigo,codigo||' - '||descripcion genombre\n\t\tfrom salud.p_sius_lista667_grupo \n\t \twhere lower ( translate (descripcion, 'áéíóúÁÉÍÓÚäëïöüÄËÏÖÜñ', 'aeiouAEIOUaeiouAEIOUÑ') ) like '%{$clave}%'\n\torder by gecodigo\n\t) row;\n\t"; } //equipo_pruebas 'N' //echo "$query_sql<br>"; $resultado = pg_query($cx, $query_sql) or die(pg_last_error()); $total_filas = pg_num_rows($resultado); while ($fila_vertical = pg_fetch_assoc($resultado)) {
########################################################## # CREATE TRIBE ########################################################## case 'add': if ($core->auth->sessionExists() && $core->hasPermission('administration')) { $user_id = urldecode(trim($_POST['user_id'])); } else { $user_id = $core->auth->userID(); } $tribe_name = check_field('tribe_name', trim($_POST['tribe_name'])); $ordering = intval(trim($_POST['ordering'])); $error = array(); if ($tribe_name['success'] && !empty($user_id)) { $patterns = array('/ /'); $replacement = array('_'); $tribe_id = stripAccents($tribe_name['value']); $tribe_id = urldecode(strtolower($tribe_id)); $tribe_id = $user_id . '-' . preg_replace($patterns, $replacement, $tribe_id); # Get next ID $rs3 = $core->con->select('SELECT tribe_id ' . 'FROM ' . $core->prefix . "tribe WHERE tribe_id = '" . $tribe_id . "'"); if ($rs3->count() == 0) { $cur = $core->con->openCursor($core->prefix . 'tribe'); $cur->tribe_id = $tribe_id; $cur->user_id = $user_id; $cur->tribe_name = $tribe_name['value']; if (!empty($ordering) && is_int($ordering)) { $cur->ordering = $ordering; } $cur->visibility = 1; $cur->created = array(' NOW() '); $cur->modified = array(' NOW() ');
return $im; } // eof loadPNG } if (!isset($yrnoID)) { $yrnoID = $SITE['yrnoID']; } $yr_id_string = str_replace(' ', '_', trim($yrnoID)); $cache_string = str_replace('/', '_', trim($yrnoID)); if (!function_exists('stripAccents')) { function stripAccents($str) { return strtr(utf8_decode($str), utf8_decode('àáâãäçèéêëìíîïñòóôõöùúûüýÿÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝæøØÅå'), 'aaaaaceeeeiiiinooooouuuuyyAAAAACEEEEIIIINOOOOOUUUUYaoOAa'); } } $cache_string = stripAccents($cache_string); $cacheFile = $SITE['cacheDir'] . 'avansertYrno4_' . $cache_string . '.png'; $yrTotalPng = 'http://www.yr.no/place/' . $yr_id_string . '/avansert_meteogram.png'; $retCodeOK = true; $cacheAllowed = 7200; if (file_exists($cacheFile)) { $file_time = filemtime($cacheFile); $now = time(); $diff = $now - $file_time; ws_message('<!-- module yrnoavansert4.php (' . __LINE__ . '): ' . $cacheFile . "\n\tcache time = " . date('c', $file_time) . " from unix time {$file_time}\n\tcurrent time = " . date('c', $now) . " from unix time {$now} \n\tdifference = {$diff} (seconds)\n\tdiff allowed = {$cacheAllowed} (seconds) -->"); if ($diff <= $cacheAllowed) { // is it still usable $im = $cacheFile; ws_message('<!-- module yrnoavansert4.php (' . __LINE__ . '): image returned = ' . $im . ' -->'); return; }
function trim_lower_accent($item) { return mb_strtolower(stripAccents($item)); }
function send_image_to_client($image_name, $file_alloweds = false) { // $model->screen_model->get_db(); $ci =& get_instance(); $session_user = unserialize(get_logged_user()); // dump($session_user); // dump($_FILES[$image_name]); $file_name = md5(date("d_m_Y_H_m_s_u")) . "_" . str_replace(" ", "_", stripAccents($_FILES[$image_name]['name'])); // $file_name = md5(date("Ymds")); $filename = $_FILES[$image_name]['tmp_name']; $handle = fopen($filename, "r"); $data = fread($handle, filesize($filename)); $POST_DATA = array('file' => base64_encode($data), 'name' => $file_name); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $session_user->upload_path . "upload.php"); curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $POST_DATA); curl_setopt($curl, CURLOPT_HEADER, true); $response = curl_exec($curl); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($httpCode != 200) { set_message("Erro ao publicar foto: <br/>" . $response, 2); } // dump($response); return $file_name; }