Ejemplo n.º 1
0
        }
    } else {
        $error = 'e_upload_invalid_format';
    }
    if ($error != '') {
        AppContext::get_response()->redirect(GalleryUrlBuilder::get_link_cat_add($id_category, $error) . '#message_helper');
    } else {
        $path = $dir . $Upload->get_filename();
        $error = $Upload->check_img($config->get_max_width(), $config->get_max_height(), Upload::DELETE_ON_ERROR);
        if (!empty($error)) {
            //Erreur, on arrête ici
            AppContext::get_response()->redirect(GalleryUrlBuilder::get_link_cat_add($id_category, $error) . '#message_helper');
        } else {
            //Enregistrement de l'image dans la bdd.
            $Gallery->Resize_pics($path);
            if ($Gallery->get_error() != '') {
                AppContext::get_response()->redirect(GalleryUrlBuilder::get_link_cat_add($id_category, $Upload->get_error()) . '#message_helper');
            }
            $idpic = $Gallery->Add_pics($idcat_post, $name_post, $Upload->get_filename(), AppContext::get_current_user()->get_id());
            if ($Gallery->get_error() != '') {
                AppContext::get_response()->redirect(GalleryUrlBuilder::get_link_cat_add($id_category, $Upload->get_error()) . '#message_helper');
            }
            //Régénération du cache des photos aléatoires.
            GalleryMiniMenuCache::invalidate();
        }
    }
    AppContext::get_response()->redirect(Url::to_absolute('/gallery/gallery' . url('.php?add=1&cat=' . $idcat_post . '&id=' . $idpic, '-' . $idcat_post . '-' . $idpic . '.php?add=1', '&')));
} elseif ($g_add) {
    if (AppContext::get_current_user()->is_readonly()) {
        $controller = PHPBoostErrors::user_in_read_only();
        DispatchManager::redirect($controller);
Ejemplo n.º 2
0
require_once '../kernel/begin.php';
require_once '../gallery/gallery_begin.php';
require_once '../kernel/header_no_display.php';
$g_idpics = retrieve(GET, 'id', 0);
if (!empty($g_idpics)) {
    //Niveau d'autorisation de la catégorie
    if (!GalleryAuthorizationsService::check_authorizations($id_category)->read()) {
        $error_controller = PHPBoostErrors::user_not_authorized();
        DispatchManager::redirect($error_controller);
    }
    //Mise à jour du nombre de vues.
    PersistenceContext::get_querier()->inject("UPDATE " . GallerySetup::$gallery_table . " SET views = views + 1 WHERE idcat = :idcat AND id = :id", array('idcat' => $id_category, 'id' => $g_idpics));
    $path = PersistenceContext::get_querier()->get_column_value(GallerySetup::$gallery_table, 'path', 'WHERE idcat = :idcat AND id = :id' . (AppContext::get_current_user()->check_level(User::ADMIN_LEVEL) ? '' : ' AND aprob = 1'), array('idcat' => $id_category, 'id' => $g_idpics));
    if (empty($path)) {
        $error_controller = PHPBoostErrors::unexisting_page();
        DispatchManager::redirect($error_controller);
    }
    $Gallery = new Gallery();
    list($width_s, $height_s, $weight_s, $ext) = $Gallery->Arg_pics('pics/' . $path);
    $Gallery->Send_header($ext);
    //Header image.
    if ($Gallery->get_error() != '') {
        die($Gallery->get_error());
    }
    $Gallery->incrust_pics('pics/' . $path);
    // => logo.
} else {
    die($LANG['no_random_img']);
    //Echec paramètres images incorrects.
}
require_once '../kernel/footer_no_display.php';
Ejemplo n.º 3
0
    } else {
        $error = 'e_upload_invalid_format';
    }
    if ($error != '') {
        //Erreur, on arrête ici
        AppContext::get_response()->redirect('/gallery/admin_gallery_add.php?error=' . $error . ($idcat_post ? '&cat=' . $idcat_post : '') . '#message_helper');
    } else {
        $path = $dir . $Upload->get_filename();
        $error = $Upload->check_img($config->get_max_width(), $config->get_max_height(), Upload::DELETE_ON_ERROR);
        if (!empty($error)) {
            //Erreur, on arrête ici
            AppContext::get_response()->redirect('/gallery/admin_gallery_add.php?error=' . $error . ($idcat_post ? '&cat=' . $idcat_post : '') . '#message_helper');
        } else {
            //Enregistrement de l'image dans la bdd.
            $Gallery->Resize_pics($path);
            if ($Gallery->get_error() != '') {
                AppContext::get_response()->redirect('/gallery/admin_gallery_add.php?error=' . $Gallery->get_error() . ($idcat_post ? '&cat=' . $idcat_post : '') . '#message_helper');
            }
            $name = TextHelper::strprotect($request->get_postvalue('name', ''));
            $idpic = $Gallery->Add_pics($idcat_post, $name, $Upload->get_filename(), AppContext::get_current_user()->get_id());
            if ($Gallery->get_error() != '') {
                AppContext::get_response()->redirect('/gallery/admin_gallery_add.php?error=' . $Gallery->get_error() . ($idcat_post ? '&cat=' . $idcat_post : '') . '#message_helper');
            }
            //Régénération du cache des photos aléatoires.
            GalleryMiniMenuCache::invalidate();
        }
    }
    AppContext::get_response()->redirect('/gallery/admin_gallery_add.php?add=' . $idpic . ($idcat_post ? '&cat=' . $idcat_post : ''));
} elseif ($valid && !empty($nbr_pics_post)) {
    for ($i = 1; $i <= $nbr_pics_post; $i++) {
        $activ = trim($request->get_postvalue($i . 'activ', ''));