コード例 #1
0
ファイル: _dragndrop.ajax.php プロジェクト: CamTosh/blogotext
$GLOBALS['liste_fichiers'] = open_serialzd_file($GLOBALS['fichier_liste_fichiers']);
foreach ($GLOBALS['liste_fichiers'] as $key => $file) {
    $liste_fileid[] = $file['bt_id'];
}
if (isset($_FILES['fichier'])) {
    $time = time();
    $fichier = init_post_fichier();
    // avoid ID collisions
    while (in_array($fichier['bt_id'], $liste_fileid)) {
        $time--;
        $fichier['bt_id'] = date('YmdHis', $time);
    }
    $erreurs = valider_form_fichier($fichier);
    // on success
    if (empty($erreurs)) {
        $new_fichier = bdd_fichier($fichier, 'ajout-nouveau', 'upload', $_FILES['fichier']);
        $fichier = is_null($new_fichier) ? $fichier : $new_fichier;
        echo '{';
        echo '"url": "fichiers.php?file_id=' . $fichier['bt_id'] . '&edit",';
        echo '"status": "success",';
        echo '"token": "' . new_token() . '"';
        echo '}';
        exit;
    } else {
        echo '{';
        echo '"url": "0",';
        echo '"status": "failure",';
        echo '"token": "0"';
        echo '}';
        exit;
    }
コード例 #2
0
ファイル: links.php プロジェクト: wazari972/blogotext
    $step = 'edit';
}
if (isset($_POST['_verif_envoi'])) {
    $link = init_post_link2();
    $erreurs_form = valider_form_link($link);
    $step = 'edit';
    if (empty($erreurs_form)) {
        // URL est un fichier !html !js !css !php ![vide] && téléchargement de fichiers activé :
        if (!isset($_POST['is_it_edit']) and $GLOBALS['dl_link_to_files'] >= 1) {
            // dl_link_to_files : 0 = never ; 1 = always ; 2 = ask with checkbox
            if (isset($_POST['add_to_files'])) {
                $_POST['fichier'] = $link['bt_link'];
                $fichier = init_post_fichier();
                $erreurs = valider_form_fichier($fichier);
                $GLOBALS['liste_fichiers'] = open_serialzd_file($GLOBALS['fichier_liste_fichiers']);
                bdd_fichier($fichier, 'ajout-nouveau', 'download', $link['bt_link']);
            }
        }
        traiter_form_link($link);
    }
}
// create link list.
$tableau = array();
// si on veut ajouter un lien : on n’affiche pas les anciens liens
if (!isset($_GET['url']) and !isset($_GET['ajout'])) {
    if (!empty($_GET['filtre'])) {
        // for "tags" & "author" the requests is "tag.$search" : here we split the type of search and what we search.
        $type = substr($_GET['filtre'], 0, -strlen(strstr($_GET['filtre'], '.')));
        $search = htmlspecialchars(ltrim(strstr($_GET['filtre'], '.'), '.'));
        if (preg_match('#^\\d{6}(\\d{1,8})?$#', $_GET['filtre'])) {
            // date
コード例 #3
0
ファイル: _rmfichier.ajax.php プロジェクト: CamTosh/blogotext
# 2010-2015 Timo Van Neerden <*****@*****.**>
#
# BlogoText is free software.
# You can redistribute it under the terms of the MIT / X11 Licence.
#
# *** LICENSE ***
/*
	This file is called by the files. It is an underground working script,
	It is not intended to be called directly in your browser.
*/
$GLOBALS['BT_ROOT_PATH'] = '../';
require_once '../inc/inc.php';
error_reporting($GLOBALS['show_errors']);
operate_session();
$begin = microtime(TRUE);
$GLOBALS['liste_fichiers'] = open_serialzd_file($GLOBALS['fichier_liste_fichiers']);
if (isset($_POST['file_id']) and preg_match('#\\d{14}#', $_POST['file_id']) and isset($_POST['supprimer'])) {
    foreach ($GLOBALS['liste_fichiers'] as $fich) {
        if ($fich['bt_id'] == $_POST['file_id']) {
            $fichier = $fich;
            break;
        }
    }
    if (!empty($fichier)) {
        $retour = bdd_fichier($fichier, 'supprimer-existant', '', $fichier['bt_id']);
        echo $retour;
        exit;
    }
}
echo 'failure';
exit;
コード例 #4
0
ファイル: imgs.php プロジェクト: CamTosh/blogotext
function traiter_form_fichier($fichier)
{
    // ajout de fichier
    if (isset($_POST['upload'])) {
        // par $_FILES
        if (isset($_FILES['fichier'])) {
            $new_fichier = bdd_fichier($fichier, 'ajout-nouveau', 'upload', $_FILES['fichier']);
        }
        // par $_POST d’une url
        if (isset($_POST['fichier'])) {
            $new_fichier = bdd_fichier($fichier, 'ajout-nouveau', 'download', $_POST['fichier']);
        }
        $fichier = is_null($new_fichier) ? $fichier : $new_fichier;
        redirection(basename($_SERVER['PHP_SELF']) . '?file_id=' . $fichier['bt_id'] . '&msg=confirm_fichier_ajout');
    } elseif (isset($_POST['editer']) and !isset($_GET['suppr'])) {
        $old_file_name = $_POST['filename'];
        // Name can be edited too. This is old name, the new one is in $fichier[].
        bdd_fichier($fichier, 'editer-existant', '', $old_file_name);
    } elseif (isset($_POST['supprimer']) and preg_match('#^\\d{14}$#', $_POST['file_id'])) {
        $response = bdd_fichier($fichier, 'supprimer-existant', '', $_POST['file_id']);
        if ($response == 'error_suppr_file_suppr_error') {
            redirection(basename($_SERVER['PHP_SELF']) . '?errmsg=error_fichier_suppr&what=file_suppr_error');
        } elseif ($response == 'no_such_file_on_disk') {
            redirection(basename($_SERVER['PHP_SELF']) . '?msg=error_fichier_suppr&what=but_no_such_file_on_disk2');
        } elseif ($response == 'success') {
            redirection(basename($_SERVER['PHP_SELF']) . '?msg=confirm_fichier_suppr');
        }
    }
}