Esempio n. 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';
Esempio n. 2
0
        $imageup = $Sql->query_array(PREFIX . "gallery", "idcat", "name", "path", "WHERE id = '" . $g_idpics . "'", __LINE__, __FILE__);
        $Template->assign_block_vars('image_up', array('NAME' => $imageup['name'], 'IMG' => '<a href="gallery.php?cat=' . $imageup['idcat'] . '&amp;id=' . $g_idpics . '#pics_max"><img src="pics/' . $imageup['path'] . '" alt="" /></a>', 'L_SUCCESS_UPLOAD' => $LANG['success_upload_img'], 'U_CAT' => '<a href="gallery.php?cat=' . $imageup['idcat'] . '">' . $CAT_GALLERY[$imageup['idcat']]['name'] . '</a>'));
    }
    $quota = isset($CAT_GALLERY[$g_idcat]['auth']['r-1']) ? $CAT_GALLERY[$g_idcat]['auth']['r-1'] != '3' : true;
    if ($quota) {
        switch ($User->get_attribute('level')) {
            case 2:
                $l_pics_quota = $LANG['illimited'];
                break;
            case 1:
                $l_pics_quota = $CONFIG_GALLERY['limit_modo'];
                break;
            default:
                $l_pics_quota = $CONFIG_GALLERY['limit_member'];
        }
        $nbr_upload_pics = $Gallery->get_nbr_upload_pics($User->get_attribute('user_id'));
        $Template->assign_block_vars('image_quota', array('L_IMAGE_QUOTA' => sprintf($LANG['image_quota'], $nbr_upload_pics, $l_pics_quota)));
    }
    $Template->assign_vars(array('SID' => SID, 'THEME' => get_utheme(), 'LANG' => get_ulang(), 'CAT_ID' => $g_idcat, 'GALLERY' => !empty($g_idcat) ? $CAT_GALLERY[$g_idcat]['name'] : $LANG['gallery'], 'CATEGORIES' => $auth_cats, 'WIDTH_MAX' => $CONFIG_GALLERY['width_max'], 'HEIGHT_MAX' => $CONFIG_GALLERY['height_max'], 'WEIGHT_MAX' => $CONFIG_GALLERY['weight_max'], 'ADD_PICS' => $User->check_auth($CAT_GALLERY[$g_idcat]['auth'], WRITE_CAT_GALLERY) ? '<a href="gallery' . url('.php?add=1&amp;cat=' . $g_idcat) . '"><img src="../templates/' . get_utheme() . '/images/' . get_ulang() . '/add.png" alt="" class="valign_middle" /></a>' : '', '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' => $LANG['unit_pixels'], 'L_UNIT_KO' => $LANG['unit_kilobytes'], 'L_UPLOAD' => $LANG['upload_img'], 'U_GALLERY_CAT_LINKS' => $cat_links, 'U_GALLERY_ACTION_ADD' => url('.php?add=1&amp;cat=' . $g_idcat . '&amp;token=' . $Session->get_token()), 'U_INDEX' => url('.php')));
    $Template->pparse('gallery_add');
} else {
    $Template->set_filenames(array('gallery' => 'gallery/gallery.tpl'));
    if (!empty($g_idcat)) {
        if (!isset($CAT_GALLERY[$g_idcat]) || $CAT_GALLERY[$g_idcat]['aprob'] == 0) {
            redirect(HOST . DIR . '/gallery/gallery' . url('.php?error=unexist_cat', '', '&'));
        }
        $cat_links = '';
        foreach ($CAT_GALLERY as $id => $array_info_cat) {
            if ($id > 0) {
                if ($CAT_GALLERY[$g_idcat]['id_left'] >= $array_info_cat['id_left'] && $CAT_GALLERY[$g_idcat]['id_right'] <= $array_info_cat['id_right'] && $array_info_cat['level'] <= $CAT_GALLERY[$g_idcat]['level']) {
                    $cat_links .= ' <a href="gallery' . url('.php?cat=' . $id, '-' . $id . '.php') . '">' . $array_info_cat['name'] . '</a> &raquo;';