Esempio n. 1
0
        default:
            $sql_a_p = "bt_id <= " . date('YmdHis') . " AND bt_statut=1 ";
            break;
    }
    // paramètre de page "p"
    if (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p'] >= 1) {
        $sql_p = 'LIMIT ' . $GLOBALS['max_bill_acceuil'] * $_GET['p'] . ', ' . $GLOBALS['max_bill_acceuil'];
    } elseif (!isset($_GET['d'])) {
        $sql_p = 'LIMIT ' . $GLOBALS['max_bill_acceuil'];
    } else {
        $sql_p = '';
    }
    // Concaténation de tout ça.
    $glue = 'AND ';
    if (!empty($sql_date)) {
        $query .= $glue . $sql_date;
    }
    if (!empty($sql_q)) {
        $query .= $glue . $sql_q;
    }
    if (!empty($sql_tag)) {
        $query .= $glue . $sql_tag;
    }
    $query .= $glue . $sql_a_p . $sql_order . $sql_p;
    //die ($query);
    $tableau = liste_elements($query, $array, $where);
    $GLOBALS['param_pagination'] = array('nb' => count($tableau), 'nb_par_page' => $GLOBALS['max_bill_acceuil']);
    afficher_index($tableau, 'list');
}
$end = microtime(TRUE);
//echo ' Rendered in '.round(($end - $begin),6).' seconds ';
Esempio n. 2
0
afficher_top($GLOBALS['lang']['mesabonnements']);
echo '<div id="top">' . "\n";
afficher_msg($GLOBALS['lang']['mesabonnements']);
//echo moteur_recherche($GLOBALS['lang']['search_in_links']);
afficher_menu(pathinfo($_SERVER['PHP_SELF'], PATHINFO_BASENAME));
echo '</div>' . "\n";
echo '<div id="axe">' . "\n";
echo '<div id="page">' . "\n";
if (isset($_GET['config'])) {
    echo afficher_form_rssconf($erreurs);
    echo "\n" . '<script type="text/javascript">' . "\n";
    echo js_rsscnf_marktoremove(0);
    echo "\n" . '</script>' . "\n";
} else {
    // get list of posts from DB
    $all_flux = liste_elements('SELECT * FROM rss WHERE bt_statut=1 ORDER BY bt_date DESC', array(), 'rss');
    // send to browser
    $out_html = send_rss_json($all_flux);
    $out_html .= '<div id="rss-list">' . "\n";
    $out_html .= "\t\t" . '<div id="posts-menu">' . "\n";
    $out_html .= "\t\t\t" . '<span id="count-posts"><button type="button" onclick="showUnRead();"></button></span>' . "\n";
    $out_html .= "\t\t\t" . '<ul>' . "\n";
    $out_html .= "\t\t\t\t" . '<li><button type="button" onclick="refresh_all_feeds(this);" title="' . $GLOBALS['lang']['rss_label_refresh'] . '"></button></li>' . "\n";
    $out_html .= "\t\t\t\t" . '<li><button type="button" onclick="markAsRead(\'all\', \'\');" id="markasread" title="' . $GLOBALS['lang']['rss_label_markasread'] . '"></button></li>' . "\n";
    $out_html .= "\t\t\t\t" . '<li><button type="button" onclick="openAllItems(this);" title="' . $GLOBALS['lang']['rss_label_unfoldall'] . '"></button></li>' . "\n";
    $out_html .= "\t\t\t\t" . '<li><button type="button" onclick="addNewFeed();" title="' . $GLOBALS['lang']['rss_label_addfeed'] . '"></button></li>' . "\n";
    $out_html .= "\t\t\t\t" . '<li><button type="button" onclick="window.location= \'?config\';" title="' . $GLOBALS['lang']['rss_label_config'] . '"></button></li>' . "\n";
    $out_html .= "\t\t\t\t" . '<li><button type="button" onclick="window.location.href=\'maintenance.php#form_import\'" title="Import/export"></button></li>' . "\n";
    $out_html .= "\t\t\t\t" . '<li><button type="button" onclick="return cleanList();" title="' . $GLOBALS['lang']['rss_label_clean'] . '"></button></li>' . "\n";
    $out_html .= "\t\t\t" . '</ul>' . "\n";
    $out_html .= "\t\t\t" . '<span id="message-return"></span>' . "\n";
Esempio n. 3
0
            $commentaires = liste_elements($query, array(), 'commentaires');
        } elseif ($type == 'auteur' and $search != '') {
            $query = "SELECT c.*, a.bt_title FROM commentaires c LEFT JOIN articles a ON a.bt_id=c.bt_article_id WHERE c.bt_author=? ORDER BY c.bt_id DESC";
            $commentaires = liste_elements($query, array($search), 'commentaires');
        } else {
            $query = "SELECT c.*, a.bt_title FROM commentaires c LEFT JOIN articles a ON a.bt_id=c.bt_article_id ORDER BY c.bt_id DESC LIMIT " . $GLOBALS['max_comm_admin'];
            $commentaires = liste_elements($query, array(), 'commentaires');
        }
    } elseif (!empty($_GET['q'])) {
        $query = "SELECT c.*, a.bt_title FROM commentaires c LEFT JOIN articles a ON a.bt_id=c.bt_article_id WHERE c.bt_content LIKE ? ORDER BY c.bt_id DESC";
        $commentaires = liste_elements($query, array('%' . htmlspecialchars($_GET['q']) . '%'), 'commentaires');
    } else {
        // no filter, so list'em all
        $query = "SELECT c.*, a.bt_title FROM commentaires c LEFT JOIN articles a ON a.bt_id=c.bt_article_id ORDER BY c.bt_id DESC LIMIT " . $GLOBALS['max_comm_admin'];
        //			die($query);
        $commentaires = liste_elements($query, array(), 'commentaires');
    }
    $nb_total_comms = liste_elements_count("SELECT count(*) AS nbr FROM commentaires", array());
    $param_makeup['show_links'] = '1';
}
function afficher_commentaire($comment, $with_link)
{
    afficher_form_commentaire($comment['bt_article_id'], 'admin', '', $comment);
    echo '<div class="commentbloc' . (!$comment['bt_statut'] ? ' privatebloc' : '') . '" id="' . article_anchor($comment['bt_id']) . '">' . "\n";
    if ($comment['bt_statut'] == '0') {
        echo '<img class="img_inv_flag" src="style/deny.png" title="' . $GLOBALS['lang']['comment_is_invisible'] . '" alt="icon"/>';
    }
    echo '<span onclick="reply(\'[b]@[' . str_replace('\'', '\\\'', $comment['bt_author']) . '|#' . article_anchor($comment['bt_id']) . '] :[/b] \'); ">@</span> ';
    echo '<h3 class="titre-commentaire">' . $comment['auteur_lien'] . '</h3>' . "\n";
    echo '<p class="email"><a href="mailto:' . $comment['bt_email'] . '">' . $comment['bt_email'] . '</a></p>' . "\n";
    echo $comment['bt_content'];
Esempio n. 4
0
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
}
Esempio n. 5
0
    require_once 'inc/veri.php';
    require_once 'inc/sqli.php';
}
echo '<feed xmlns="http://www.w3.org/2005/Atom">' . "\n";
echo '<author><name>' . $GLOBALS['auteur'] . '</name></author>' . "\n";
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 {
Esempio n. 6
0
function rafraichir_cache()
{
    creer_dossier($GLOBALS['BT_ROOT_PATH'] . $GLOBALS['dossier_cache'], 1);
    $arr_a = liste_elements("SELECT * FROM articles WHERE bt_statut = 1 ORDER BY bt_date DESC LIMIT 0, 20", array(), 'articles');
    $arr_c = liste_elements("SELECT * FROM commentaires WHERE bt_statut = 1 ORDER BY bt_id DESC LIMIT 0, 20", array(), 'commentaires');
    $arr_l = liste_elements("SELECT * FROM links WHERE bt_statut = 1 ORDER BY bt_id DESC LIMIT 0, 20", array(), 'links');
    $file = $GLOBALS['BT_ROOT_PATH'] . $GLOBALS['dossier_cache'] . '/' . 'cache_rss_array.dat';
    return file_put_contents($file, '<?php /* ' . chunk_split(base64_encode(serialize(array('c' => $arr_c, 'a' => $arr_a, 'l' => $arr_l)))) . ' */');
}
Esempio n. 7
0
function encart_commentaires()
{
    mb_internal_encoding('UTF-8');
    $query = "SELECT c.bt_author, c.bt_id, c.bt_article_id, c.bt_content, a.bt_title FROM commentaires c LEFT JOIN articles a ON a.bt_id=c.bt_article_id WHERE c.bt_statut=1 AND a.bt_statut=1 ORDER BY c.bt_id DESC LIMIT 5";
    $tableau = liste_elements($query, array(), 'commentaires');
    if (isset($tableau)) {
        $listeLastComments = '<ul class="encart_lastcom">' . "\n";
        foreach ($tableau as $i => $comment) {
            $comment['contenu_abbr'] = strip_tags($comment['bt_content']);
            // limits length of comment abbreviation and name
            if (strlen($comment['contenu_abbr']) >= 60) {
                $comment['contenu_abbr'] = mb_substr($comment['contenu_abbr'], 0, 59) . '…';
            }
            if (strlen($comment['bt_author']) >= 30) {
                $comment['bt_author'] = mb_substr($comment['bt_author'], 0, 29) . '…';
            }
            $listeLastComments .= '<li title="' . date_formate($comment['bt_id']) . '"><b>' . $comment['bt_author'] . '</b> ' . $GLOBALS['lang']['sur'] . ' <b>' . $comment['bt_title'] . '</b><br/><a href="' . $comment['bt_link'] . '">' . $comment['contenu_abbr'] . '</a>' . '</li>' . "\n";
        }
        $listeLastComments .= '</ul>' . "\n";
        return $listeLastComments;
    } else {
        return $GLOBALS['lang']['no_comments'];
    }
}
Esempio n. 8
0
    if (preg_match('#^\\d{6}(\\d{1,8})?$#', $_GET['filtre'])) {
        $query = "SELECT * FROM articles WHERE bt_date LIKE ? ORDER BY bt_date DESC";
        $tableau = liste_elements($query, array($_GET['filtre'] . '%'), 'articles');
    } elseif ($_GET['filtre'] == 'draft' or $_GET['filtre'] == 'pub') {
        $query = "SELECT * FROM articles WHERE bt_statut=? ORDER BY bt_date DESC";
        $tableau = liste_elements($query, array($_GET['filtre'] == 'draft' ? 0 : 1), 'articles');
    } elseif ($type == 'tag' and $search != '') {
        $query = "SELECT * FROM articles WHERE bt_categories LIKE ? OR bt_categories LIKE ? OR bt_categories LIKE ? OR bt_categories LIKE ? ORDER BY bt_date DESC";
        $tableau = liste_elements($query, array($search, $search . ',%', '%, ' . $search, '%, ' . $search . ', %'), 'articles');
    } else {
        $query = "SELECT * FROM articles ORDER BY bt_date DESC LIMIT 0, " . $GLOBALS['max_bill_admin'];
        $tableau = liste_elements($query, array(), 'articles');
    }
} else {
    $query = "SELECT * FROM articles ORDER BY bt_date DESC LIMIT 0, " . $GLOBALS['max_bill_admin'];
    $tableau = liste_elements($query, array(), 'articles');
}
afficher_top($GLOBALS['lang']['mesarticles']);
echo '<div id="top">' . "\n";
afficher_msg($GLOBALS['lang']['mesarticles']);
echo moteur_recherche($GLOBALS['lang']['search_in_articles']);
afficher_menu(pathinfo($_SERVER['PHP_SELF'], PATHINFO_BASENAME));
echo '</div>' . "\n";
echo '<div id="axe">' . "\n";
// SUBNAV
echo '<div id="subnav">' . "\n";
if (isset($_GET['filtre'])) {
    afficher_form_filtre('articles', htmlspecialchars($_GET['filtre']));
} else {
    afficher_form_filtre('articles', '');
}
Esempio n. 9
0
function afficher_index($tableau, $type)
{
    $HTML = '';
    if (!($theme_page = file_get_contents($GLOBALS['theme_liste']))) {
        die($GLOBALS['lang']['err_theme_introuvable']);
    }
    if (!($theme_post = file_get_contents($GLOBALS['theme_post_post']))) {
        die($GLOBALS['lang']['err_theme_introuvable']);
    }
    if ($type == 'list') {
        $HTML_elmts = '';
        $data = array();
        if (!empty($tableau)) {
            if (count($tableau) == 1 and !empty($tableau[0]['bt_title']) and $tableau[0]['bt_type'] == 'article') {
                redirection($tableau[0]['bt_link']);
                exit;
            } else {
                if (count($tableau) == 1 and ($tableau[0]['bt_type'] == 'link' or $tableau[0]['bt_type'] == 'note')) {
                    $data = $tableau[0];
                }
                $HTML_article = conversions_theme($theme_page, $data, 'post');
                if ($tableau[0]['bt_type'] == 'article') {
                    if (!($theme_article = file_get_contents($GLOBALS['theme_post_artc']))) {
                        die($GLOBALS['lang']['err_theme_introuvable']);
                    }
                    $conversion_theme_fonction = 'conversions_theme_article';
                }
                if ($tableau[0]['bt_type'] == 'comment') {
                    if (!($theme_article = file_get_contents($GLOBALS['theme_post_comm']))) {
                        die($GLOBALS['lang']['err_theme_introuvable']);
                    }
                    $conversion_theme_fonction = 'conversions_theme_commentaire';
                }
                if ($tableau[0]['bt_type'] == 'link' or $tableau[0]['bt_type'] == 'note') {
                    if (!($theme_article = file_get_contents($GLOBALS['theme_post_link']))) {
                        die($GLOBALS['lang']['err_theme_introuvable']);
                    }
                    $conversion_theme_fonction = 'conversions_theme_lien';
                }
                foreach ($tableau as $element) {
                    $HTML_elmts .= $conversion_theme_fonction($theme_article, $element);
                }
                $HTML = str_replace(extract_boucles($theme_page, $GLOBALS['boucles']['posts'], 'incl'), $HTML_elmts, $HTML_article);
            }
        } else {
            $HTML_article = conversions_theme($theme_page, $data, 'list');
            $HTML = str_replace(extract_boucles($theme_page, $GLOBALS['boucles']['posts'], 'incl'), $GLOBALS['lang']['note_no_article'], $HTML_article);
        }
    } elseif ($type == 'post') {
        $billet = $tableau;
        $HTML_comms = '';
        // get list comments
        if ($billet['bt_nb_comments'] != 0) {
            $query = "SELECT * FROM commentaires WHERE bt_article_id=? AND bt_statut=1 ORDER BY bt_id LIMIT ? ";
            $commentaires = liste_elements($query, array($billet['bt_id'], $billet['bt_nb_comments']), 'commentaires');
            // parse & apply template comments
            $template_comments = extract_boucles($theme_post, $GLOBALS['boucles']['commentaires'], 'excl');
            foreach ($commentaires as $element) {
                $HTML_comms .= conversions_theme_commentaire($template_comments, $element);
            }
        }
        // replace {boucle commentaires} in $theme_post
        $v = extract_boucles($theme_post, $GLOBALS['boucles']['commentaires'], 'incl');
        $HTML_article = conversions_theme_article($theme_post, $billet);
        $HTML = str_replace($v, $HTML_comms, $HTML_article);
        // replace article+comment data in page
        $HTML = str_replace(extract_boucles($theme_page, $GLOBALS['boucles']['posts'], 'incl'), $HTML, $theme_page);
        // replace tags.
        $HTML = conversions_theme($HTML, $billet, 'post');
    }
    echo $HTML;
}
Esempio n. 10
0
        }
    } elseif (!empty($_GET['q'])) {
        // mot clé
        $arr = parse_search($_GET['q']);
        $sql_where = implode(array_fill(0, count($arr), '( bt_content || bt_title || bt_link ) LIKE ? '), 'AND ');
        // AND operator between words
        $query = "SELECT * FROM links WHERE " . $sql_where . "ORDER BY bt_id DESC";
        $tableau = liste_elements($query, $arr, 'links');
    } elseif (!empty($_GET['id']) and is_numeric($_GET['id'])) {
        // édition d’un lien spécifique
        $query = "SELECT * FROM links WHERE bt_id=?";
        $tableau = liste_elements($query, array($_GET['id']), 'links');
    } else {
        // aucun filtre : affiche TOUT
        $query = "SELECT * FROM links ORDER BY bt_id DESC LIMIT 0, " . $GLOBALS['max_linx_admin'];
        $tableau = liste_elements($query, array(), 'links');
    }
}
// count total nb of links
$nb_links_displayed = count($tableau);
afficher_top($GLOBALS['lang']['mesliens']);
echo '<div id="top">' . "\n";
afficher_msg($GLOBALS['lang']['mesliens']);
echo moteur_recherche($GLOBALS['lang']['search_in_links']);
afficher_menu(pathinfo($_SERVER['PHP_SELF'], PATHINFO_BASENAME));
echo '</div>' . "\n";
echo '<div id="axe">' . "\n";
// SUBNAV
echo '<div id="subnav">' . "\n";
// Affichage formulaire filtrage liens
if (isset($_GET['filtre'])) {
Esempio n. 11
0
$erreurs_form = array();
//
if (isset($_POST['_verif_envoi'])) {
    $billet = init_post_article();
    $erreurs_form = valider_form_billet($billet);
    if (empty($erreurs_form)) {
        traiter_form_billet($billet);
    }
}
// RECUP INFOS ARTICLE SI DONNÉE
$post = '';
$article_id = '';
if (isset($_GET['post_id'])) {
    $article_id = htmlspecialchars($_GET['post_id']);
    $query = "SELECT * FROM articles WHERE bt_id LIKE ?";
    $posts = liste_elements($query, array($article_id), 'articles');
    if (isset($posts[0])) {
        $post = $posts[0];
    }
}
// TITRE PAGE
if (!empty($post)) {
    $titre_ecrire_court = $GLOBALS['lang']['titre_maj'];
    $titre_ecrire = $titre_ecrire_court . ' : ' . $post['bt_title'];
} else {
    $post = '';
    $titre_ecrire_court = $GLOBALS['lang']['titre_ecrire'];
    $titre_ecrire = $titre_ecrire_court;
}
// DEBUT PAGE
afficher_top($titre_ecrire);