function valider_form_billet($billet) { $date = decode_id($billet['bt_id']); $erreurs = array(); if (isset($_POST['supprimer']) and !(isset($_POST['token']) and check_token($_POST['token']))) { $erreurs[] = $GLOBALS['lang']['err_wrong_token']; } if (!strlen(trim($billet['bt_title']))) { $erreurs[] = $GLOBALS['lang']['err_titre']; } if (!strlen(trim($billet['bt_content']))) { $erreurs[] = $GLOBALS['lang']['err_contenu']; } if (!preg_match('/\\d{4}/', $date['annee'])) { $erreurs[] = $GLOBALS['lang']['err_annee']; } if (!preg_match('/\\d{2}/', $date['mois']) or $date['mois'] > '12') { $erreurs[] = $GLOBALS['lang']['err_mois']; } if (!preg_match('/\\d{2}/', $date['jour']) or $date['jour'] > date('t', mktime(0, 0, 0, $date['mois'], 1, $date['annee']))) { $erreurs[] = $GLOBALS['lang']['err_jour']; } if (!preg_match('/\\d{2}/', $date['heure']) or $date['heure'] > 23) { $erreurs[] = $GLOBALS['lang']['err_heure']; } if (!preg_match('/\\d{2}/', $date['minutes']) or $date['minutes'] > 59) { $erreurs[] = $GLOBALS['lang']['err_minutes']; } if (!preg_match('/\\d{2}/', $date['secondes']) or $date['secondes'] > 59) { $erreurs[] = $GLOBALS['lang']['err_secondes']; } return $erreurs; }
function creer_fich_html($nb_links) { // nom du fichier de sortie $path = $GLOBALS['BT_ROOT_PATH'] . $GLOBALS['dossier_backup'] . '/backup-links-' . date('Ymd-His') . '.html'; // récupère les liens $query = "SELECT * FROM links ORDER BY bt_id DESC " . (!empty($nb_links) ? 'LIMIT 0, ' . $nb_links : ''); $list = liste_elements($query, array(), 'links'); // génération du code HTML. $html = '<!DOCTYPE NETSCAPE-Bookmark-file-1><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">' . "\n"; $html .= '<!--This is an automatically generated file. Do Not Edit! -->' . "\n"; $html .= '<TITLE>Blogotext links export ' . date('Y-M-D') . '</TITLE><H1>Blogotext links export</H1>' . "\n"; foreach ($list as $n => $link) { $dec = decode_id($link['bt_id']); $timestamp = mktime($dec['heure'], $dec['minutes'], $dec['secondes'], $dec['mois'], $dec['jour'], $dec['annee']); // HISMDY : wtf! $html .= '<DT><A HREF="' . $link['bt_link'] . '" ADD_DATE="' . $timestamp . '" PRIVATE="' . abs(1 - $link['bt_statut']) . '" TAGS="' . $link['bt_tags'] . '" AUTHOR="' . $link['bt_author'] . '">' . $link['bt_title'] . '</A>' . "\n"; $html .= '<DD>' . strip_tags($link['bt_wiki_content']) . "\n"; } return file_put_contents($path, $html) === FALSE ? FALSE : $path; // écriture du fichier }
echo '<link rel="self" href="' . $GLOBALS['racine'] . 'atom.php' . (!empty($_SERVER['QUERY_STRING']) ? '?' . htmlspecialchars($_SERVER['QUERY_STRING']) : '') . '" />' . "\n"; // ATOM DU BLOG /* si y'a un ID en paramètre : flux sur fil commentaires de l'article "ID" */ if (isset($_GET['id']) and preg_match('#^[0-9]{14}$#', $_GET['id'])) { require_all(); $GLOBALS['db_handle'] = open_base($GLOBALS['db_location']); $article_id = htmlspecialchars($_GET['id']); $liste = liste_elements("SELECT * FROM commentaires WHERE bt_article_id=? AND bt_statut=1 ORDER BY bt_id DESC", array($article_id), 'commentaires'); if (!empty($liste)) { $query = "SELECT * FROM articles WHERE bt_id=? AND bt_date<=" . date('YmdHis') . " AND bt_statut=1"; $billet = liste_elements($query, array($article_id), 'articles'); echo '<title>Commentaires sur ' . $billet[0]['bt_title'] . ' - ' . $GLOBALS['nom_du_site'] . '</title>' . "\n"; echo '<link href="' . $billet[0]['bt_link'] . '" />' . "\n"; echo '<id>' . $billet[0]['bt_link'] . '</id>'; foreach ($liste as $comment) { $dec = decode_id($comment['bt_id']); $tag = 'tag:' . parse_url($GLOBALS['racine'], PHP_URL_HOST) . '' . $dec['annee'] . '-' . $dec['mois'] . '-' . $dec['jour'] . ':' . $comment['bt_id']; echo '<entry>' . "\n"; echo '<title>' . $comment['bt_author'] . '</title>' . "\n"; echo '<link href="' . $comment['bt_link'] . '"/>' . "\n"; echo '<id>' . $tag . '</id>' . "\n"; echo '<updated>' . date('c', mktime($dec['heure'], $dec['minutes'], $dec['secondes'], $dec['mois'], $dec['jour'], $dec['annee'])) . '</updated>' . "\n"; echo '<content type="html">' . htmlspecialchars($comment['bt_content']) . '</content>' . "\n"; echo '</entry>' . "\n"; } } else { echo '<entry>' . "\n"; echo '<title>' . $GLOBALS['lang']['note_no_comment'] . '</title>' . "\n"; echo '<id>' . $GLOBALS['racine'] . '</id>' . "\n"; echo '<link href="' . $GLOBALS['racine'] . 'index.php" />' . "\n"; echo '<updated>' . date('r') . '</updated>' . "\n";
function get_request() { $ret = true; if (!isset($_GET['manjina'])) { $_GET['manjina'] = null; } else { if (substr($_GET['manjina'], -2) != "ka") { $ret = false; } } if (!isset($_GET['oib'])) { $_GET['oib'] = null; $ret = false; } if (!isset($_GET['prezime'])) { $_GET['prezime'] = null; $ret = false; } if (!isset($_GET['captcha1'])) { $_GET['captcha1'] = null; $ret = false; } if (!isset($_GET['mbg'])) { $_GET['mbg'] = null; $ret = false; } if (!isset($_GET['boi'])) { $_GET['boi'] = null; $ret = false; } if (!isset($_GET['ime'])) { $_GET['ime'] = null; $ret = false; } if (!isset($_GET['captcha2'])) { $_GET['captcha2'] = null; $ret = false; } if (!isset($_GET['id'])) { $_GET['cookie1'] = null; $_GET['cookie2'] = null; $ret = false; } else { decode_id(); } if (!isset($_GET['page'])) { return false; } if ($ret === true && $_GET['cookie1'] != null && $_GET['cookie2'] != null && $_GET['id'] != "" && $_GET['oib'] != "" && $_GET['prezime'] != "" && $_GET['captcha1'] != "" && $_GET['mbg'] != "" && $_GET['boi'] != "" && $_GET['ime'] != "" && $_GET['captcha2'] != "") { $_GET['time'] = null; unset($_GET['time']); return true; } if ($_GET['captcha1'] != null && $_GET['captcha2'] != null && isset($_GET['time'])) { $_GET['county'] = mb_strtoupper($_GET['captcha1']); $_GET['city'] = mb_strtoupper($_GET['captcha2']); return true; } return false; }
function get_blogpath($id, $titre) { $date = decode_id($id); $path = $GLOBALS['racine'] . 'index.php?d=' . $date['annee'] . '/' . $date['mois'] . '/' . $date['jour'] . '/' . $date['heure'] . '/' . $date['minutes'] . '/' . $date['secondes'] . '-' . titre_url($titre); return $path; }
function date_formate_iso($id) { $date = decode_id($id); $ts = mktime($date['heure'], $date['minutes'], $date['secondes'], $date['mois'], $date['jour'], $date['annee']); // ts : timestamp $date_iso = date('c', $ts); return $date_iso; }
/** * @param string $code * * @return int */ public static function getIdByCode($code) { return decode_id($code, 'user'); }
function init_list_comments($comment) { $comment['auteur_lien'] = !empty($comment['bt_webpage']) ? '<a href="' . $comment['bt_webpage'] . '" class="webpage">' . $comment['bt_author'] . '</a>' : $comment['bt_author']; $comment['anchor'] = article_anchor($comment['bt_id']); $comment['bt_link'] = get_blogpath($comment['bt_article_id'], '') . '#' . $comment['anchor']; $comment = array_merge($comment, decode_id($comment['bt_id'])); return $comment; }
function heure_formate($id) { $date = decode_id($id); $ts = mktime($date['heure'], $date['minutes'], $date['secondes'], $date['mois'], $date['jour'], $date['annee']); // ts : timestamp $format = array('0' => date('H\\:i\\:s', $ts), '1' => date('H\\:i', $ts), '2' => date('h\\:i\\:s A', $ts), '3' => date('h\\:i A', $ts)); $valeur = $format[$GLOBALS['format_heure']]; return $valeur; }
afficher_msg(); echo moteur_recherche($GLOBALS['lang']['search_in_comments']); afficher_topnav(basename($_SERVER['PHP_SELF']), $GLOBALS['lang']['titre_commentaires']); echo '</div>' . "\n"; echo '<div id="axe">' . "\n"; // SUBNAV echo '<div id="subnav">' . "\n"; // Affichage formulaire filtrage commentaires if (isset($_GET['filtre'])) { afficher_form_filtre('commentaires', htmlspecialchars($_GET['filtre'])); } else { afficher_form_filtre('commentaires', ''); } echo '<div class="nombre-elem">' . "\n"; if ($param_makeup['menu_theme'] == 'for_article') { $dec_id = decode_id($article_id); $article_link = $GLOBALS['racine'] . '?d=' . $dec_id['annee'] . '/' . $dec_id['mois'] . '/' . $dec_id['jour'] . '/' . $dec_id['heure'] . '/' . $dec_id['minutes'] . '/' . $dec_id['secondes'] . '-' . titre_url($article_title); echo '<ul>' . "\n"; echo "\t" . '<li><a href="ecrire.php?post_id=' . $article_id . '">' . $GLOBALS['lang']['ecrire'] . $article_title . '</a></li>' . "\n"; echo "\t" . '<li><a href="' . $article_link . '">' . $GLOBALS['lang']['lien_article'] . '</a></li>' . "\n"; echo '</ul>' . "\n"; echo '– ' . ucfirst(nombre_objets(count($commentaires), 'commentaire')); } elseif ($param_makeup['menu_theme'] == 'for_comms') { echo ucfirst(nombre_objets(count($commentaires), 'commentaire')) . ' ' . $GLOBALS['lang']['sur'] . ' ' . $nb_total_comms; } echo '</div>' . "\n"; echo '</div>' . "\n"; //echo erreurs($erreurs_form); echo '<div id="page">' . "\n"; // COMMENTAIRES echo '<div id="liste-commentaires">' . "\n";