Пример #1
0
        $tpl->assign_block_vars('image_up', array('NAME' => stripslashes($imageup['name']), 'IMG' => '<a href="gallery.php?cat=' . $imageup['idcat'] . '&amp;id=' . $g_idpics . '#pics_max"><img src="pics/' . $imageup['path'] . '" alt="' . $imageup['name'] . '" /></a>', 'L_SUCCESS_UPLOAD' => $LANG['success_upload_img'], 'U_CAT' => '<a href="gallery.php?cat=' . $imageup['idcat'] . '">' . $categories[$imageup['idcat']]->get_name() . '</a>'));
    }
    //Affichage du quota d'image uploadée.
    $category_authorizations = GalleryService::get_categories_manager()->get_heritated_authorizations($id_category, Category::WRITE_AUTHORIZATIONS, Authorizations::AUTH_PARENT_PRIORITY);
    $quota = isset($category_authorizations['r-1']) ? $category_authorizations['r-1'] != '3' : true;
    if ($quota) {
        switch (AppContext::get_current_user()->get_level()) {
            case 2:
                $l_pics_quota = $LANG['illimited'];
                break;
            case 1:
                $l_pics_quota = $config->get_moderator_max_pics_number();
                break;
            default:
                $l_pics_quota = $config->get_member_max_pics_number();
        }
        $nbr_upload_pics = $Gallery->get_nbr_upload_pics(AppContext::get_current_user()->get_id());
        $tpl->assign_block_vars('image_quota', array('L_IMAGE_QUOTA' => sprintf($LANG['image_quota'], $nbr_upload_pics, $l_pics_quota)));
    }
    $search_category_children_options = new SearchCategoryChildrensOptions();
    $search_category_children_options->add_authorizations_bits(Category::READ_AUTHORIZATIONS);
    $search_category_children_options->add_authorizations_bits(Category::WRITE_AUTHORIZATIONS);
    $tpl->put_all(array('CAT_ID' => $id_category, 'GALLERY' => !empty($id_category) ? $categories[$id_category]->get_name() : $LANG['gallery'], 'CATEGORIES_TREE' => GalleryService::get_categories_manager()->get_select_categories_form_field('cat', LangLoader::get_message('form.category', 'common'), $id_category, $search_category_children_options)->display()->render(), 'WIDTH_MAX' => $config->get_max_width(), 'HEIGHT_MAX' => $config->get_max_height(), 'WEIGHT_MAX' => $config->get_max_weight(), 'IMG_FORMAT' => 'JPG, PNG, GIF', 'L_IMG_FORMAT' => $LANG['img_format'], 'L_WIDTH_MAX' => $LANG['width_max'], 'L_HEIGHT_MAX' => $LANG['height_max'], 'L_WEIGHT_MAX' => $LANG['weight_max'], 'L_ADD_IMG' => $LANG['add_pic'], 'L_GALLERY' => $LANG['gallery'], 'L_GALLERY_INDEX' => $LANG['gallery_index'], 'L_CATEGORIES' => $LANG['categories'], 'L_NAME' => $LANG['name'], 'L_UNIT_PX' => LangLoader::get_message('unit.pixels', 'common'), 'L_UNIT_KO' => LangLoader::get_message('unit.kilobytes', 'common'), 'L_UPLOAD' => $LANG['upload_img'], 'U_GALLERY_CAT_LINKS' => $cat_links, 'U_GALLERY_ACTION_ADD' => GalleryUrlBuilder::get_link_cat_add($id_category, null, AppContext::get_session()->get_token()), 'U_INDEX' => url('.php')));
    $tpl->display();
} else {
    $module = AppContext::get_extension_provider_service()->get_provider('gallery');
    if ($module->has_extension_point(HomePageExtensionPoint::EXTENSION_POINT)) {
        echo $module->get_extension_point(HomePageExtensionPoint::EXTENSION_POINT)->get_home_page()->get_view()->display();
    }
}
require_once '../kernel/footer.php';