예제 #1
0
} else {
    function rel2abs($article)
    {
        // convertit les URL relatives en absolues
        $article = str_replace(' src="/', ' src="http://' . $_SERVER['HTTP_HOST'] . '/', $article);
        $article = str_replace(' href="/', ' href="http://' . $_SERVER['HTTP_HOST'] . '/', $article);
        $base = $GLOBALS['racine'];
        $article = preg_replace('#(src|href)=\\"(?!http)#i', '$1="' . $base, $article);
        return $article;
    }
    $fcache = $GLOBALS['dossier_cache'] . '/' . 'cache_rss_array.dat';
    $liste = array();
    if (!file_exists($fcache)) {
        require_all();
        $GLOBALS['db_handle'] = open_base($GLOBALS['db_location']);
        rafraichir_cache();
    }
    // this function exists in SQLI.PHP. It is replaced here, because including sqli.php and the other files takes 10x more cpu load than this
    if (file_exists($fcache)) {
        $liste = unserialize(base64_decode(substr(file_get_contents($fcache), strlen('<?php /* '), -strlen(' */'))));
        if (!is_array($liste)) {
            $liste = array();
            unlink($fcache);
        }
    }
    $liste_rss = array();
    $modes_url = '';
    if (!empty($_GET['mode'])) {
        $found = 0;
        // 1 = articles
        if (strpos($_GET['mode'], 'blog') !== FALSE) {
예제 #2
0
파일: sqli.php 프로젝트: CamTosh/blogotext
function traiter_form_commentaire($commentaire, $admin)
{
    $msg_param_to_trim = isset($_GET['msg']) ? '&msg=' . $_GET['msg'] : '';
    $query_string = str_replace($msg_param_to_trim, '', $_SERVER['QUERY_STRING']);
    // add new comment (admin + public)
    if (isset($_POST['enregistrer']) and empty($_POST['is_it_edit'])) {
        $result = bdd_commentaire($commentaire, 'enregistrer-nouveau');
        if ($result === TRUE) {
            send_emails($commentaire['bt_id']);
            // send emails new comment posted to people that are subscriben
            $redir = basename($_SERVER['PHP_SELF']) . '?' . $query_string . '&msg=confirm_comment_ajout';
        } else {
            die($result);
        }
    } elseif (isset($_POST['enregistrer']) and $admin == 'admin' and isset($_POST['is_it_edit']) and $_POST['is_it_edit'] == 'yes' and isset($commentaire['ID'])) {
        $result = bdd_commentaire($commentaire, 'editer-existant');
        $redir = basename($_SERVER['PHP_SELF']) . '?' . $query_string . '&msg=confirm_comment_edit';
    } elseif (isset($_POST['com_supprimer']) and $admin == 'admin') {
        $comm = array('ID' => htmlspecialchars($_POST['com_supprimer']), 'bt_article_id' => htmlspecialchars($_POST['com_article_id']));
        $result = bdd_commentaire($comm, 'supprimer-existant');
        // Ajax response
        if ($result === TRUE) {
            rafraichir_cache();
            //echo var_dump($comm);
            echo 'Success' . new_token();
        } else {
            echo 'Error' . new_token();
        }
        exit;
    } elseif (isset($_POST['com_activer']) and $admin == 'admin') {
        $comm = array('ID' => htmlspecialchars($_POST['com_activer']), 'bt_article_id' => htmlspecialchars($_POST['com_article_id']));
        $result = bdd_commentaire($comm, 'activer-existant');
        // Ajax response
        if ($result === TRUE) {
            rafraichir_cache();
            //echo var_dump($comm);
            echo 'Success' . new_token();
        } else {
            echo 'Error' . new_token();
        }
        exit;
    } else {
        redirection(basename($_SERVER['PHP_SELF']) . '?' . $query_string . '&msg=nothing_happend_oO');
    }
    if ($result === TRUE) {
        rafraichir_cache();
        redirection($redir);
    } else {
        die($result);
    }
}
예제 #3
0
function traiter_form_commentaire($commentaire, $admin)
{
    $msg_param_to_trim = isset($_GET['msg']) ? '&msg=' . $_GET['msg'] : '';
    $query_string = str_replace($msg_param_to_trim, '', $_SERVER['QUERY_STRING']);
    // add new comment
    if (isset($_POST['enregistrer']) and empty($_POST['is_it_edit'])) {
        $result = bdd_commentaire($commentaire, 'enregistrer-nouveau');
        if ($result === TRUE) {
            rafraichir_cache();
            send_emails($commentaire['bt_id']);
            // send emails new comment posted to people that are subscriben
            $redir = $_SERVER['PHP_SELF'] . '?' . $query_string . '&msg=confirm_comment_ajout';
            if ($admin == 'admin') {
                redirection($redir);
            }
        } else {
            die($result);
        }
    } elseif (isset($_POST['enregistrer']) and $admin == 'admin' and isset($_POST['is_it_edit']) and $_POST['is_it_edit'] == 'yes' and isset($commentaire['ID'])) {
        $result = bdd_commentaire($commentaire, 'editer-existant');
        $redir = $_SERVER['PHP_SELF'] . '?' . $query_string . '&msg=confirm_comment_edit';
    } elseif (isset($_POST['supprimer_comm']) and isset($commentaire['ID']) and $admin == 'admin') {
        $result = bdd_commentaire($commentaire, 'supprimer-existant');
        $redir = $_SERVER['PHP_SELF'] . '?' . $query_string . '&msg=confirm_comment_suppr';
    } else {
        redirection($_SERVER['PHP_SELF'] . '?' . $query_string . '&msg=nothing_happend_oO');
    }
    if ($result === TRUE) {
        rafraichir_cache();
        redirection($redir);
    } else {
        die($result);
    }
}