', $texte); $texte = str_replace('[/b]', '', $texte); $texte = str_replace('[i]', '', $texte); $texte = str_replace('[/i]', '', $texte); $texte = str_replace('[u]', '', $texte); $texte = str_replace('[/u]', '', $texte); $texte = eregi_replace("\\[url]http://([^\\[]*)\\[/url\\]", "\\1", $texte); $texte = eregi_replace("\\[url]([^\\[]*)\\[/url\\]","\\1",$texte); $texte = eregi_replace("\\[color=([^\\[]*)\\]([^\\[]*)\\[/color\\]","\\2",$texte); $texte = eregi_replace("\\[url=http://([^\\[]*)\\]([^\\[]*)\\[/url\\]","\\2",$texte); $texte = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]", "\\2", $texte); $texte = eregi_replace("\\[email=([^\\[]*)\\]([^\\[]*)\\[/email\\]","\\2",$texte); $texte = eregi_replace("\\[email]([^\\[]*)\\[/email\\]","\\1",$texte); $texte = eregi_replace("\\[img]([^\\[]*)\\[/img\\]","",$texte); $texte = str_replace('{:D}', '', $texte); $texte = str_replace('{8)}', '', $texte); $texte = str_replace('{:(}', '', $texte); $texte = str_replace('{X(}', '', $texte); $texte = str_replace('{mdr}', '', $texte); $texte = str_replace('{:J}', '', $texte); $texte = str_replace('{;)}', '', $texte); $texte = str_replace('{:p}', '', $texte); $texte = str_replace('{:o}', '', $texte); $texte = str_replace('{:)}', '', $texte); $texte = preg_replace("/\[align=(left|right|center|justify)\]/si", "
", $texte); $texte = str_replace("[/align]", '
', $texte); $texte = preg_replace("/\[area=(.{1,6})\]/si", "", $texte); $texte = str_replace("[/area]", '', $texte); $texte = preg_replace("/\[objet=(.{1,6})\]/si", "", $texte); $texte = str_replace("[/objet]", '', $texte); $texte = preg_replace("/\[actor=([a-zA-Z0-9]{1,50})\]/si", "", $texte); $texte = str_replace("[/actor]", '', $texte); $texte = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+)\]/si", '', $texte); $texte = str_replace("[/color]", '', $texte); $texte = preg_replace("/\[size=([1-2]?[0-9])\]/si", '', $texte); $texte = str_replace("[/size]", '', $texte); $texte = preg_replace("/\[font=([a-zA-Z0-9, ]+)\]/si", '', $texte); $texte = str_replace("[/font]", '', $texte); return $texte; } function supp_bbcode($texte) { global $jeu; // minuscules $texte = str_replace('', '[b]', $texte); $texte = str_replace('', '[/b]', $texte); // majuscules $texte = str_replace('', '[B]', $texte); $texte = str_replace('', '[/B]', $texte); // minuscules $texte = str_replace('', '[i]', $texte); $texte = str_replace('', '[/i]', $texte); // majuscules $texte = str_replace('', '[I]', $texte); $texte = str_replace('', '[/I]', $texte); // minuscules $texte = str_replace('', '[u]', $texte); $texte = str_replace('', '[/u]', $texte); $texte = preg_replace("//", "\\1", $texte); $texte = preg_replace('/(.*)<\/font>/', "[color=\\1]\\2[/color]", $texte); $texte = eregi_replace("\\[url]http://([^\\[]*)\\[/url\\]", "\\1", $texte); $texte = eregi_replace("\\[url]([^\\[]*)\\[/url\\]","\\1",$texte); $texte = eregi_replace("\\[color=([^\\[]*)\\]([^\\[]*)\\[/color\\]","\\2",$texte); $texte = eregi_replace("\\[url=http://([^\\[]*)\\]([^\\[]*)\\[/url\\]","\\2",$texte); $texte = eregi_replace("\\[url=([^\\[]*)\\]([^\\[]*)\\[/url\\]", "\\2", $texte); $texte = eregi_replace("\\[email=([^\\[]*)\\]([^\\[]*)\\[/email\\]","\\2",$texte); $texte = eregi_replace("\\[email]([^\\[]*)\\[/email\\]","\\1",$texte); $texte = eregi_replace("\\[img]([^\\[]*)\\[/img\\]","",$texte); $texte = preg_replace("/\[align=(left|right|center|justify)\]/si", "", $texte); $texte = str_replace("[/align]", '', $texte); $texte = preg_replace("/\[objet=(.{1,6})\]/si", "", $texte); $texte = str_replace("[/objet]", '', $texte); $texte = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+)\]/si", '', $texte); $texte = str_replace("[/color]", '', $texte); $texte = preg_replace("/\[size=([1-2]?[0-9])\]/si", '', $texte); $texte = str_replace("[/size]", '', $texte); $texte = preg_replace("/\[font=([a-zA-Z0-9, ]+)\]/si", '', $texte); $texte = str_replace("[/font]", '', $texte); return $texte; } function url($url) { print ''; } function info($msg, $url, $lien) { global $djeu, $base_img, $base_act, $base_url; $template = new tpl(ROOT_PATH . 'baldur/templates/' . $djeu); $template->set_filenames( array('body' => "info_index.tpl")); $template->assign_vars( array( "MSG" => $msg , "URL" => $url , "LIEN" => $lien , 'BASE_URL' => $base_url , 'BASE_ACT' => $base_act , 'BASE_IMG' => $base_img , )); $template->pparse('body'); } function confirm($msg, $non, $oui, $simple=0) { global $jeu, $skin, $confirm, $oui, $non, $deriv; $dossier_tpl = ( $simple == 1 ) ? 'soa/templates/admin/' : 'soa/templates/' . $skin; $template = new tpl($jeu . $dossier_tpl); $template->set_filenames( array('body' => 'confirm_body.tpl')); $template->assign_vars( array( "MSG" => $msg, "R_NON" => $non, "R_OUI" => $oui, )); $fichier_bas = ( $simple == 1 ) ? 'soa/simple_bas.php' : 'soa/admin/admin_bas.php'; if ( $confirm == 'Oui' ) { url($oui . $deriv); } elseif ( $confirm == 'Non' ) { url($non); } $template->pparse('body'); include($jeu['root_path'] . $fichier_bas); } function gdate($time) { $fdate = getdate($time); $fdate['mday'] = ( $fdate['mday'] < 10 ) ? '0' . $fdate['mday'] : $fdate['mday']; $fdate['mon'] = ( $fdate['mon'] < 10 ) ? '0' . $fdate['mon'] : $fdate['mon']; $fdate['hours'] = ( $fdate['hours'] < 10 ) ? '0' . $fdate['hours'] : $fdate['hours']; $fdate['minutes'] = ( $fdate['minutes'] < 10 ) ? '0' . $fdate['minutes'] : $fdate['minutes']; $fdate = $fdate['mday'] . "/" . $fdate['mon'] . "/" . $fdate['year'] . " à " . $fdate['hours'] . ":" . $fdate['minutes']; return $fdate; } function verrouille($name) { global $INFO, $base; if( $INFO[$name] == '1' || $INFO['verrouille_formulaires'] == '1' ) { url($base['act'] . "&p=info&mess=$name"); exit; } } function user($nom, $mail) { $pseudo = ( $mail != '' ) ? '' . $nom . '' : $nom; return $pseudo; } /*///////////// FONCTION PAGINATION. Les éléments obligatoires: if ( !$deb ) { $deb='0'; } LIMIT " . $deb . ',' . $config['...'] $template->assign_vars( array( 'PAGINATION' => pagination(TABLE_DL, $config['...'], $deb, '&m=view&cat=' . $cat) )); /////////////// */ function pagination($table, $nbr_page, $deb, $action) { // Début de la pagination $table_entier = sql_query("SELECT * from " . $table) or die('Impossible d\'effectuer la pagination: Erreur à la connection sql !'); $pagination = mysql_num_rows($table_entier); $compteuradd = $deb + $nbr_page; $compteursou = $deb - $nbr_page; $compteurdiv = ceil($pagination / $nbr_page); $replacediv = $deb / $nbr_page; // Page Précédente if ( $deb - $nbr_page >= 0 ) // Première page { $affiche .= "<< |"; } else { $affiche .= "<< |"; } // Numéros for($i=0; $i<$compteurdiv; $i++) { $compteurmult = $i * $nbr_page; $visu = $i+1; $affiche .= " $visu |"; } $affiche = str_replace("" . $replacediv . "", $deb / $nbr_page, $affiche); // Page Suivante if ( $deb=="0" && $pagination > $nbr_page ) // Première page { $affiche .= " >>"; } elseif ( ($deb + $nbr_page) >= $pagination ) { $affiche .= " >>"; } elseif ( ($deb + $pagination) > $nbr_page ) { $affiche .= " >>"; } // FIN PAGINATION return $affiche; } function flood($dern_date) { global $INFO; $dern_date += $INFO['flood']; if( time() <= $dern_date ) { return TRUE; } else { return FALSE; } // Retourne TRUE si flood il y a, sinon FALSE } function comment_supp($attrib_id, $attrib_name) { sql_query("DELETE FROM " . TABLE_COMMENT . " WHERE comment_attrib_id='" . $attrib_id . "' AND comment_attrib_name='" . $attrib_name . "'") or die(mysql_error()); } function compteur_add($attrib_id, $attrib_name, $nb=FALSE) { $sql_c = sql_query("SELECT c_id, c_nb FROM " . TABLE_COMPT . " WHERE c_attrib_id='" . $attrib_id . "' AND c_attrib_name='" . $attrib_name . "'") or die ('impossible1'); if ( mysql_num_rows($sql_c) != 0 ) { $result_c = mysql_fetch_array($sql_c); $nb_c = ( $nb == FALSE ) ? $result_c['c_nb']+1 : $nb; sql_query("Update " . TABLE_COMPT . " Set c_nb='" . $nb_c . "' WHERE c_id='" . $result_c['c_id'] . "'") or die ('impossible2'); } else { $nb = ( $nb == FALSE ) ? 1 : $nb; sql_query("INSERT INTO " . TABLE_COMPT . " VALUES('','" . $attrib_id . "','" . $attrib_name . "','" . $nb . "')") or die ('impossible3'); } } function compteur_supp($attrib_id, $attrib_name) { sql_query("DELETE FROM " . TABLE_COMPT . " WHERE c_attrib_id='" . $attrib_id . "' AND c_attrib_name='" . $attrib_name . "'") or die(mysql_error()); } function comment($attrib_id, $attrib_name, $redirect) { global $template, $INFO, $base, $_COOKIE; $template->set_filenames( array('comment' => 'comment_form.tpl')); $req_comment = sql_query("SELECT * FROM " . TABLE_COMMENT . " WHERE comment_attrib_name='" . $attrib_name . "' AND comment_attrib_id='" . $attrib_id . "' ORDER BY comment_id DESC") or die(mysql_error()); $nb_comment = mysql_num_rows($req_comment); if ( $nb_comment == 0 ) { $no_comment = "Il n'y a aucuns commentaires.
"; } else { while ( $comment = mysql_fetch_array($req_comment) ) { $mail = ( $comment['comment_user_mail'] == '' ) ? '' : ''; $template->assign_block_vars('comment', array( 'ID' => $comment['id'], 'AUTEUR' => $comment['comment_user_pseudo'], 'TEXTE' => $comment['comment_texte'], 'DATE' => gdate($comment['comment_date']), 'MAIL' => $mail, )); } } if ( $INFO['comment_verrouille'] != '1' && $INFO['verrouille_formulaires'] != '1' ) { $template->assign_block_vars('form', array()); $template->assign_vars( array( 'BASE_URL' => $base['url'] , 'BASE_ACT' => $base['act'] , 'BASE_IMG' => $base['img'] , 'NOCOMMENT' => $no_comment , 'NBCOMMENT' => $nb_comment , 'ATTRIB_NAME' => $attrib_name , 'REDIRECT' => $redirect , 'ATTRIB_ID' => $attrib_id , 'NAME' => $_COOKIE['baldur_pseudo'] , 'MAIL' => $_COOKIE['baldur_mail'] , )); } $template->assign_var_from_handle('COMMENT_FORM', 'comment'); } function sql_query($sql) { global $requetes; $requetes++; return mysql_query($sql); } function nav($titre, $nav='') { global $template, $INFO, $base; if( $nav != '' ) { $navigation = ''; foreach( $nav as $val ) { $navigation .= ( $val[0] == '' ) ? " > {$val[1]}" : " > {$val[1]}"; } } $template->set_filenames( array('nav' => 'nav.tpl')); $template->assign_vars( array( 'BASE_URL' => $base['url'] , 'BASE_ACT' => $base['act'] , 'BASE_IMG' => $base['img'] , 'TITRE' => $titre , 'NAV' => $navigation , )); $template->assign_var_from_handle('NAV', 'nav'); $template->assign_vars( array( 'BASE_URL' => $base['url'] , 'BASE_ACT' => $base['act'] , 'BASE_IMG' => $base['img'] , )); } function explorer($chemin, $recursif=0) { $repertoire = opendir($chemin); $hauteur = 0 ; $largeur = 200 ; while( $fichier = readdir($repertoire) ) { if( $fichier != '.' && $fichier != '..' && ( ereg("\.jpg$", $fichier) || is_dir($chemin."/".$fichier) ) ) { if( is_dir($chemin."/".$fichier) ) { $return['repertoire'][] = $fichier; if( $recursif == 1 ) { $add = explorer($chemin."/".$fichier, 1); $return['mini'] = array_merge($return['mini'], $add['mini']); $return['txt'] = array_merge($return['txt'], $add['txt']); $return['fichier'] = array_merge($return['fichier'], $add['fichier']); } } elseif( ereg("_mini\.jpg$", $fichier) ) { $return['mini'][] = ( $recursif == 1 ) ? $chemin."/".$fichier : $fichier; } else { $return['fichier'][] = $fichier; } if( !ereg("_mini\.jpg$", $fichier) && !is_dir($chemin."/".$fichier) ) { $mini = preg_replace("/(.+?)\.jpg/", "\\1_mini.jpg", $fichier); if( !file_exists($chemin."/".$mini) ) { $size = getimagesize($chemin.'/'.$fichier); $src_w = $size[0]; $src_h = $size[1]; if( $hauteur != 0 ) { $dst_h = $hauteur; $dst_w = round($hauteur * $src_w / $src_h); } else { $dst_w = $largeur; $dst_h = round($largeur * $src_h / $src_w); } if( ($src_h > $hauteur && $hauteur != 0) || ($src_w > $largeur && $largeur != 0) ) { // Crée une image vierge aux bonnes dimensions $dst_im = imagecreatetruecolor($dst_w, $dst_h); // Copie dedans l'image initiale redimensionnée $src_im = imagecreatefromjpeg($chemin.'/'.$fichier); imagecopyresampled($dst_im, $src_im, 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h); // Sauve la nouvelle image imagejpeg($dst_im, $chemin.'/'.$mini); // Détruis les tampons imagedestroy($dst_im); imagedestroy($src_im); $return['mini'][] = ( $recursif == 1 ) ? $chemin."/".$mini : $mini; } else { $return['mini'][] = ( $recursif == 1 ) ? $chemin."/".$fichier : $fichier; } } } $txt = preg_replace("/(.+?)\.jpg/", "\\1.txt", $fichier); if( file_exists($chemin."/".$txt) && !is_dir($chemin."/".$fichier) ) { $fp = fopen($chemin.'/'.$txt, 'r'); $taille = filesize($chemin.'/'.$txt); $return['txt'][$fichier] = fread($fp, $taille); } } } closedir($repertoire); return $return; } function pourcentage($value) { if( $value == '0' ) { $result = "$value%"; } elseif( $value >= '100' ) { $result = "$value%"; } else { $result = "$value%"; } return $result; } ?>
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'www-data'@'localhost' (using password: NO) in /home/rpgfr/public_html/_ancien/d20/index.php on line 76
erreur de connexion