Exemplo n.º 1
0
 function main($id, $mode)
 {
     global $db, $template, $user;
     phpbb_gallery::init();
     $user->add_lang(array('mods/gallery_acp', 'mods/gallery'));
     $this->tpl_name = 'gallery_main';
     add_form_key('acp_gallery');
     $submode = request_var('submode', '');
     switch ($mode) {
         case 'overview':
             $title = 'ACP_GALLERY_OVERVIEW';
             $this->page_title = $user->lang[$title];
             $this->overview();
             break;
         case 'import_images':
             $title = 'ACP_IMPORT_ALBUMS';
             $this->page_title = $user->lang[$title];
             $this->import();
             break;
         case 'cleanup':
             $title = 'ACP_GALLERY_CLEANUP';
             $this->page_title = $user->lang[$title];
             $this->cleanup();
             break;
         default:
             trigger_error('NO_MODE', E_USER_ERROR);
             break;
     }
 }
 function main($id, $mode)
 {
     global $db, $template, $user, $permissions;
     phpbb_gallery::init();
     $user->add_lang(array('mods/gallery_acp', 'mods/gallery'));
     $this->tpl_name = 'gallery_permissions';
     $this->page_title = $user->lang['ALBUM_AUTH_TITLE'];
     add_form_key('acp_gallery');
     $submit = isset($_POST['submit_edit_options']) ? true : (isset($_POST['submit_add_options']) ? true : false);
     $action = request_var('action', '');
     /**
      * All our beautiful permissions
      */
     $permissions->cats['full'] = array('i' => array('i_view', 'i_watermark', 'i_upload', 'i_approve', 'i_edit', 'i_delete', 'i_report', 'i_rate'), 'c' => array('c_read', 'c_post', 'c_edit', 'c_delete'), 'm' => array('m_comments', 'm_delete', 'm_edit', 'm_move', 'm_report', 'm_status'), 'misc' => array('a_list', 'i_count', 'i_unlimited', 'album_count', 'album_unlimited'));
     $permissions->p_masks['full'] = array_merge($permissions->cats['full']['i'], $permissions->cats['full']['c'], $permissions->cats['full']['m'], $permissions->cats['full']['misc']);
     // Permissions for the normal albums
     $permissions->cats[phpbb_gallery_auth::PUBLIC_ALBUM] = array('i' => array('i_view', 'i_watermark', 'i_upload', 'i_approve', 'i_edit', 'i_delete', 'i_report', 'i_rate'), 'c' => array('c_read', 'c_post', 'c_edit', 'c_delete'), 'm' => array('m_comments', 'm_delete', 'm_edit', 'm_move', 'm_report', 'm_status'), 'misc' => array('a_list', 'i_count', 'i_unlimited'));
     $permissions->p_masks[phpbb_gallery_auth::PUBLIC_ALBUM] = array_merge($permissions->cats[phpbb_gallery_auth::PUBLIC_ALBUM]['i'], $permissions->cats[phpbb_gallery_auth::PUBLIC_ALBUM]['c'], $permissions->cats[phpbb_gallery_auth::PUBLIC_ALBUM]['m'], $permissions->cats[phpbb_gallery_auth::PUBLIC_ALBUM]['misc']);
     $permissions->p_masks_anti[phpbb_gallery_auth::PUBLIC_ALBUM] = array('album_count', 'album_unlimited');
     // Permissions for own personal albums
     // Note: we set i_view to 1 as default on storing the permissions
     $permissions->cats[phpbb_gallery_auth::OWN_ALBUM] = array('i' => array('i_watermark', 'i_upload', 'i_approve', 'i_edit', 'i_delete', 'i_report', 'i_rate'), 'c' => array('c_read', 'c_post', 'c_edit', 'c_delete'), 'm' => array('m_comments', 'm_delete', 'm_edit', 'm_move', 'm_report', 'm_status'), 'misc' => array('a_list', 'i_count', 'i_unlimited', 'album_count', 'album_unlimited'));
     $permissions->p_masks[phpbb_gallery_auth::OWN_ALBUM] = array_merge($permissions->cats[phpbb_gallery_auth::OWN_ALBUM]['i'], $permissions->cats[phpbb_gallery_auth::OWN_ALBUM]['c'], $permissions->cats[phpbb_gallery_auth::OWN_ALBUM]['m'], $permissions->cats[phpbb_gallery_auth::OWN_ALBUM]['misc']);
     $permissions->p_masks_anti[phpbb_gallery_auth::OWN_ALBUM] = array();
     // Note: we set i_view to 1 as default, so it's not needed on anti array('i_view');
     // Permissions for personal albums of other users
     // Note: Do !NOT! hide the i_upload. It's used for the moving-permissions
     $permissions->cats[phpbb_gallery_auth::PERSONAL_ALBUM] = array('i' => array('i_view', 'i_watermark', 'i_upload', 'i_report', 'i_rate'), 'c' => array('c_read', 'c_post', 'c_edit', 'c_delete'), 'm' => array('m_comments', 'm_delete', 'm_edit', 'm_move', 'm_report', 'm_status'), 'misc' => array('a_list'));
     $permissions->p_masks[phpbb_gallery_auth::PERSONAL_ALBUM] = array_merge($permissions->cats[phpbb_gallery_auth::PERSONAL_ALBUM]['i'], $permissions->cats[phpbb_gallery_auth::PERSONAL_ALBUM]['c'], $permissions->cats[phpbb_gallery_auth::PERSONAL_ALBUM]['m'], $permissions->cats[phpbb_gallery_auth::PERSONAL_ALBUM]['misc']);
     $permissions->p_masks_anti[phpbb_gallery_auth::PERSONAL_ALBUM] = array('i_approve', 'i_edit', 'i_delete', 'i_count', 'i_unlimited', 'album_count', 'album_unlimited');
     switch ($mode) {
         case 'manage':
             switch ($action) {
                 case 'set':
                     $this->permissions_set();
                     break;
                 case 'v_mask':
                     if (!$submit) {
                         $this->permissions_v_mask();
                     } else {
                         $this->permissions_p_mask();
                     }
                     break;
                 default:
                     $this->permissions_c_mask();
                     break;
             }
             break;
         case 'copy':
             $this->copy_album_permissions();
             break;
         default:
             trigger_error('NO_MODE', E_USER_ERROR);
             break;
     }
 }
Exemplo n.º 3
0
 public static function viewonline($on_page, $album_id, $session_page)
 {
     static $album_data;
     global $template, $user, $location, $location_url;
     // Initial load of some needed stuff, like permissions, album data, ...
     phpbb_gallery::init();
     if (empty($album_data)) {
         global $cache;
         $user->add_lang(array('mods/info_acp_gallery', 'mods/gallery'));
         $album_data = $cache->obtain_album_list();
     }
     // Handle user location
     $location = $user->lang['GALLERY'];
     $location_url = phpbb_gallery_url::append_sid('index');
     if ($album_id && phpbb_gallery::$auth->acl_check('i_view', $album_id)) {
         switch ($on_page[1]) {
             case phpbb_gallery_url::path('relative') . 'album':
                 $location = sprintf($user->lang['VIEWING_ALBUM'], $album_data[$album_id]['album_name']);
                 $location_url = phpbb_gallery_url::append_sid('album', 'album_id=' . $album_id);
                 break;
             case phpbb_gallery_url::path('relative') . 'image_page':
             case phpbb_gallery_url::path('relative') . 'image':
                 $location = sprintf($user->lang['VIEWING_IMAGE'], $album_data[$album_id]['album_name']);
                 $location_url = phpbb_gallery_url::append_sid('album', 'album_id=' . $album_id);
                 break;
             case phpbb_gallery_url::path('relative') . 'posting':
                 preg_match('#mode=([a-z]+)#', $session_page, $on_page);
                 $on_page = sizeof($on_page) ? $on_page[1] : '';
                 switch ($on_page) {
                     case 'comment':
                         $location = sprintf($user->lang['COMMENT_IMAGE'], $album_data[$album_id]['album_name']);
                         break;
                     default:
                         $location = sprintf($user->lang['VIEWING_ALBUM'], $album_data[$album_id]['album_name']);
                         break;
                 }
                 $location_url = phpbb_gallery_url::append_sid('album', 'album_id=' . $album_id);
                 break;
         }
     } else {
         preg_match('#mode=([a-z]+)#', $session_page, $on_page);
         $on_page = sizeof($on_page) ? $on_page[1] : '';
         if ($on_page == 'personal' && phpbb_gallery::$auth->acl_check('i_view', PERSONAL_GALLERY_PERMISSIONS)) {
             $location = $user->lang['PERSONAL_ALBUMS'];
             $location_url = phpbb_gallery_url::append_sid('index', 'mode=personal');
         }
     }
 }
Exemplo n.º 4
0
 /**
  * Sets up some basic stuff for the gallery.
  */
 public static function init()
 {
     global $db, $user;
     phpbb_gallery_url::_include('functions_phpbb', 'phpbb', 'includes/gallery/');
     phpbb_gallery_plugins::init(phpbb_gallery_url::path());
     // Little precaution.
     $user->data['user_id'] = (int) $user->data['user_id'];
     self::$user = new phpbb_gallery_user($db, $user->data['user_id']);
     $user_id = $user->data['user_perm_from'] == 0 ? $user->data['user_id'] : $user->data['user_perm_from'];
     self::$auth = new phpbb_gallery_auth($user_id);
     if (phpbb_gallery_config::get('mvc_time') < time()) {
         // Check the version, do we need to update?
         phpbb_gallery_config::set('mvc_time', time() + 86400);
         phpbb_gallery_config::set('mvc_version', phpbb_gallery_modversioncheck::check(true));
     }
     self::$loaded = true;
 }
Exemplo n.º 5
0
* @version $Id$
* @copyright (c) 2007 nickvergessen nickvergessen@gmx.de http://www.flying-bits.org
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* partially borrowed from phpBB3
* @author: phpBB Group
* @location: search.php
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include 'common.' . $phpEx;
include $phpbb_root_path . 'common.' . $phpEx;
phpbb_gallery::setup(array('mods/gallery', 'search'));
phpbb_gallery_url::_include('functions_display', 'phpbb');
// Define initial vars
//@todo: $mode			= request_var('mode', '');
$search_id = request_var('search_id', '');
$start = request_var('start', 0);
$image_id = request_var('image_id', 0);
$submit = request_var('submit', false);
$keywords = utf8_normalize_nfc(request_var('keywords', '', true));
$add_keywords = utf8_normalize_nfc(request_var('add_keywords', '', true));
$username = request_var('username', '', true);
$user_id = request_var('user_id', 0);
$search_terms = request_var('terms', 'all');
$search_album = request_var('aid', array(0));
$search_child = request_var('sc', true);
$search_fields = request_var('sf', 'all');
Exemplo n.º 6
0
/**
*
* @package phpBB Gallery
* @version $Id$
* @copyright (c) 2007 nickvergessen nickvergessen@gmx.de http://www.flying-bits.org
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include 'common.' . $phpEx;
include $phpbb_root_path . 'common.' . $phpEx;
phpbb_gallery::setup(array('mods/gallery', 'mods/exif_data'));
phpbb_gallery_url::_include('functions_display', 'phpbb');
/**
* Filestructure:
*
* - Check the request and get image_data
* - Check the permissions and approval
* - Main work here...
* - Exif-Data
* - Rating
* - Posting comment
* - Listing comment
*
*/
/**
* Check the request and get image_data
Exemplo n.º 7
0
    $db->sql_query($sql_update);
    $sql_update = 'UPDATE ' . GALLERY_IMAGES_TABLE . '
		SET image_contest_end = ' . $contest_end_time . ',
			image_contest_rank = 3
		WHERE image_id = ' . $third;
    $db->sql_query($sql_update);
    phpbb_gallery_config::inc('contests_ended', 1);
    $album_data['contest_marked'] = phpbb_gallery_image::NO_CONTEST;
}
/**
* Build auth-list
*/
phpbb_gallery::$auth->gen_auth_level('album', $album_id, $album_data['album_status'], $album_data['album_user_id']);
if (!phpbb_gallery::$auth->acl_check('i_view', $album_id, $album_data['album_user_id'])) {
    if ($user->data['is_bot']) {
        phpbb_gallery::redirect('index');
    }
    if (!$user->data['is_registered']) {
        login_box();
    } else {
        trigger_error('NOT_AUTHORISED');
    }
}
// Build the navigation & display subalbums
phpbb_gallery_album::generate_nav($album_data);
phpbb_gallery_album::display_albums($album_data, $config['load_moderators']);
// Set some variables to their defaults
$allowed_create = false;
$image_counter = 0;
$l_moderator = $moderators_list = $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
$grouprows = $album_moderators = array();
Exemplo n.º 8
0
 public function phpbb_gallery_block($mode = false, $options = false, $nums = false, $toggle_comments = '', $display_pegas = '')
 {
     $this->set_mode($mode ? $mode : self::MODE_RECENT + self::MODE_RANDOM + self::MODE_COMMENT);
     $this->set_options($options ? $options : self::DISPLAY_ALBUMNAME + self::DISPLAY_IMAGENAME + self::DISPLAY_IMAGETIME + self::DISPLAY_IMAGEVIEWS + self::DISPLAY_USERNAME + self::DISPLAY_IP);
     $this->set_nums($nums ? $nums : array(1, 4, 5, 0));
     $this->set_toggle(is_bool($toggle_comments) ? $toggle_comments : false);
     $this->set_pegas(is_bool($display_pegas) ? $display_pegas : true);
     if (!phpbb_gallery::$loaded) {
         phpbb_gallery::init();
     }
     global $user;
     $user->add_lang('mods/gallery');
     if (!function_exists('generate_text_for_display')) {
         phpbb_gallery_url::_include('message_parser', 'phpbb');
     }
 }
    function main($id, $mode)
    {
        global $cache, $db, $user, $auth, $template;
        phpbb_gallery::init();
        $manage_albums = new phpbb_gallery_album_manage(request_var('user_id', 0), request_var('parent_id', 0), $this->u_action);
        $user->add_lang(array('mods/gallery_acp', 'mods/gallery'));
        $this->tpl_name = 'gallery_albums';
        $this->page_title = 'ACP_GALLERY_MANAGE_ALBUMS';
        $form_key = 'acp_gallery_albums';
        add_form_key($form_key);
        $action = request_var('action', '');
        $update = isset($_POST['update']) ? true : false;
        $album_id = request_var('a', 0);
        $this->parent_id = request_var('parent_id', 0);
        $album_data = $errors = array();
        if ($update && !check_form_key($form_key)) {
            $update = false;
            $errors[] = $user->lang['FORM_INVALID'];
        }
        // Major routines
        if ($update) {
            switch ($action) {
                case 'delete':
                    $action_subalbums = request_var('action_subalbums', '');
                    $subalbums_to_id = request_var('subalbums_to_id', 0);
                    $action_images = request_var('action_images', '');
                    $images_to_id = request_var('images_to_id', 0);
                    $errors = $manage_albums->delete_album($album_id, $action_images, $action_subalbums, $images_to_id, $subalbums_to_id);
                    if (sizeof($errors)) {
                        break;
                    }
                    $cache->destroy('sql', GALLERY_ALBUMS_TABLE);
                    trigger_error($user->lang['ALBUM_DELETED'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
                    break;
                case 'edit':
                    $album_data = array('album_id' => $album_id);
                    // No break; here
                // No break; here
                case 'add':
                    $album_data += array('parent_id' => request_var('album_parent_id', $this->parent_id), 'album_type' => request_var('album_type', phpbb_gallery_album::TYPE_UPLOAD), 'type_action' => request_var('type_action', ''), 'album_status' => request_var('album_status', phpbb_gallery_album::STATUS_OPEN), 'album_parents' => '', 'album_name' => utf8_normalize_nfc(request_var('album_name', '', true)), 'album_desc' => utf8_normalize_nfc(request_var('album_desc', '', true)), 'album_desc_uid' => '', 'album_desc_options' => 7, 'album_desc_bitfield' => '', 'album_image' => request_var('album_image', ''), 'album_watermark' => request_var('album_watermark', false), 'album_sort_key' => request_var('album_sort_key', ''), 'album_sort_dir' => request_var('album_sort_dir', ''), 'display_subalbum_list' => request_var('display_subalbum_list', false), 'display_on_index' => request_var('display_on_index', false), 'display_in_rrc' => request_var('display_in_rrc', false));
                    // Categories are not able to be locked...
                    if ($album_data['album_type'] == phpbb_gallery_album::TYPE_CAT) {
                        $album_data['album_status'] = phpbb_gallery_album::STATUS_OPEN;
                    }
                    // Contests need contest_data, freaky... :-O
                    $contest_data = array('contest_start' => request_var('contest_start', ''), 'contest_rating' => request_var('contest_rating', ''), 'contest_end' => request_var('contest_end', ''));
                    // Get data for album description if specified
                    if ($album_data['album_desc']) {
                        generate_text_for_storage($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options'], request_var('desc_parse_bbcode', false), request_var('desc_parse_urls', false), request_var('desc_parse_smilies', false));
                    }
                    $errors = $manage_albums->update_album_data($album_data, $contest_data);
                    if (!sizeof($errors)) {
                        $album_perm_from = request_var('album_perm_from', 0);
                        // Copy permissions? You do not need permissions for that in the gallery
                        if ($album_perm_from && $album_perm_from != $album_data['album_id']) {
                            // If we edit a album delete current permissions first
                            if ($action == 'edit') {
                                $sql = 'DELETE FROM ' . GALLERY_PERMISSIONS_TABLE . '
									WHERE perm_album_id = ' . $album_data['album_id'];
                                $db->sql_query($sql);
                                $sql = 'DELETE FROM ' . GALLERY_MODSCACHE_TABLE . '
									WHERE album_id = ' . $album_data['album_id'];
                                $db->sql_query($sql);
                            }
                            $sql = 'SELECT *
								FROM ' . GALLERY_PERMISSIONS_TABLE . '
								WHERE perm_album_id = ' . $album_perm_from;
                            $result = $db->sql_query($sql);
                            while ($row = $db->sql_fetchrow($result)) {
                                $perm_data[] = array('perm_role_id' => $row['perm_role_id'], 'perm_album_id' => $album_data['album_id'], 'perm_user_id' => $row['perm_user_id'], 'perm_group_id' => $row['perm_group_id'], 'perm_system' => $row['perm_system']);
                            }
                            $db->sql_freeresult($result);
                            $modscache_ary = array();
                            $sql = 'SELECT * FROM ' . GALLERY_MODSCACHE_TABLE . '
								WHERE album_id = ' . $album_perm_from;
                            $result = $db->sql_query($sql);
                            while ($row = $db->sql_fetchrow($result)) {
                                $modscache_ary[] = array('album_id' => $album_data['album_id'], 'user_id' => $row['user_id'], 'username' => $row['username'], 'group_id' => $row['group_id'], 'group_name' => $row['group_name'], 'display_on_index' => $row['display_on_index']);
                            }
                            $db->sql_freeresult($result);
                            $db->sql_multi_insert(GALLERY_PERMISSIONS_TABLE, $perm_data);
                            $db->sql_multi_insert(GALLERY_MODSCACHE_TABLE, $modscache_ary);
                        }
                        $cache->destroy('sql', GALLERY_ALBUMS_TABLE);
                        $cache->destroy('sql', GALLERY_MODSCACHE_TABLE);
                        $cache->destroy('sql', GALLERY_PERMISSIONS_TABLE);
                        $cache->destroy('_albums');
                        phpbb_gallery_auth::set_user_permissions('all', '');
                        $acl_url = '&amp;mode=manage&amp;action=v_mask&amp;album_id[]=' . $album_data['album_id'];
                        $message = $action == 'add' ? $user->lang['ALBUM_CREATED'] : $user->lang['ALBUM_UPDATED'];
                        $message .= '<br /><br />' . sprintf($user->lang['REDIRECT_ACL'], '<a href="' . phpbb_gallery_url::append_sid('admin', 'index', 'i=gallery_permissions' . $acl_url) . '">', '</a>');
                        // Redirect directly to permission settings screen
                        if ($action == 'add' && !$album_perm_from) {
                            meta_refresh(5, phpbb_gallery_url::append_sid('admin', 'index', 'i=gallery_permissions' . $acl_url));
                        }
                        trigger_error($message . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id));
                    }
                    break;
            }
        }
        switch ($action) {
            case 'move_up':
            case 'move_down':
                if (!$album_id) {
                    trigger_error($user->lang['NO_ALBUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
                }
                $sql = 'SELECT *
					FROM ' . GALLERY_ALBUMS_TABLE . "\n\t\t\t\t\tWHERE album_id = {$album_id}";
                $result = $db->sql_query($sql);
                $row = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if (!$row) {
                    trigger_error($user->lang['NO_ALBUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
                }
                $move_album_name = $manage_albums->move_album_by($row, $action, 1);
                if ($move_album_name !== false) {
                    add_log('admin', 'LOG_ALBUM_' . strtoupper($action), $row['album_name'], $move_album_name);
                    $cache->destroy('sql', GALLERY_ALBUMS_TABLE);
                }
                break;
            case 'sync':
            case 'sync_album':
                if (!$album_id) {
                    trigger_error($user->lang['NO_ALBUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
                }
                $sql = 'SELECT album_name, album_type
					FROM ' . GALLERY_ALBUMS_TABLE . "\n\t\t\t\t\tWHERE album_id = {$album_id}";
                $result = $db->sql_query($sql);
                $row = $db->sql_fetchrow($result);
                $db->sql_freeresult($result);
                if (!$row) {
                    trigger_error($user->lang['NO_ALBUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
                }
                phpbb_gallery_album::update_info($album_id);
                add_log('admin', 'LOG_ALBUM_SYNC', $row['album_name']);
                $template->assign_var('L_ALBUM_RESYNCED', sprintf($user->lang['ALBUM_RESYNCED'], $row['album_name']));
                break;
            case 'add':
            case 'edit':
                // Show form to create/modify a album
                if ($action == 'edit') {
                    $this->page_title = 'EDIT_ALBUM';
                    $row = phpbb_gallery_album::get_info($album_id);
                    $old_album_type = $row['album_type'];
                    if (!$update) {
                        $album_data = $row;
                    } else {
                        $album_data['left_id'] = $row['left_id'];
                        $album_data['right_id'] = $row['right_id'];
                    }
                    if ($row['album_type'] == phpbb_gallery_album::TYPE_CONTEST) {
                        $contest_data = $this->get_contest_info('album', $album_id);
                    } else {
                        // Default values, 3 days later rate and 7 for the end of the contest
                        $contest_data = array('contest_start' => time(), 'contest_rating' => 3 * 86400, 'contest_end' => 7 * 86400);
                    }
                    // Make sure no direct child albums are able to be selected as parents.
                    $exclude_albums = array();
                    foreach (phpbb_gallery_album::get_branch(phpbb_gallery_album::PUBLIC_ALBUM, $album_id, 'children') as $row) {
                        $exclude_albums[] = $row['album_id'];
                    }
                    $parents_list = phpbb_gallery_album::get_albumbox(true, '', $album_data['parent_id'], false, $exclude_albums);
                    /*
                    $album_data['album_password_confirm'] = $album_data['album_password'];
                    */
                } else {
                    $this->page_title = 'CREATE_ALBUM';
                    $album_id = $this->parent_id;
                    $parents_list = phpbb_gallery_album::get_albumbox(true, '', $this->parent_id);
                    // Fill album data with default values
                    if (!$update) {
                        $album_data = array('parent_id' => $this->parent_id, 'album_type' => phpbb_gallery_album::TYPE_UPLOAD, 'album_status' => phpbb_gallery_album::STATUS_OPEN, 'album_name' => utf8_normalize_nfc(request_var('album_name', '', true)), 'album_desc' => '', 'album_image' => '', 'album_watermark' => true, 'album_sort_key' => '', 'album_sort_dir' => '', 'display_subalbum_list' => true, 'display_on_index' => true, 'display_in_rrc' => true);
                        // Default values, 3 days later rate and 7 for the end of the contest
                        $contest_data = array('contest_start' => time(), 'contest_rating' => 3 * 86400, 'contest_end' => 7 * 86400);
                    }
                }
                $album_desc_data = array('text' => $album_data['album_desc'], 'allow_bbcode' => true, 'allow_smilies' => true, 'allow_urls' => true);
                // Parse desciption if specified
                if ($album_data['album_desc']) {
                    if (!isset($album_data['album_desc_uid'])) {
                        // Before we are able to display the preview and plane text, we need to parse our request_var()'d value...
                        $album_data['album_desc_uid'] = '';
                        $album_data['album_desc_bitfield'] = '';
                        $album_data['album_desc_options'] = 0;
                        generate_text_for_storage($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_bitfield'], $album_data['album_desc_options'], request_var('desc_allow_bbcode', false), request_var('desc_allow_urls', false), request_var('desc_allow_smilies', false));
                    }
                    // decode...
                    $album_desc_data = generate_text_for_edit($album_data['album_desc'], $album_data['album_desc_uid'], $album_data['album_desc_options']);
                }
                $album_type_options = '';
                $album_type_ary = array(phpbb_gallery_album::TYPE_CAT => 'CAT', phpbb_gallery_album::TYPE_UPLOAD => 'UPLOAD', phpbb_gallery_album::TYPE_CONTEST => 'CONTEST');
                foreach ($album_type_ary as $value => $lang) {
                    $album_type_options .= '<option value="' . $value . '"' . ($value == $album_data['album_type'] ? ' selected="selected"' : '') . '>' . $user->lang['ALBUM_TYPE_' . $lang] . '</option>';
                }
                $album_sort_key_options = '';
                $album_sort_key_options .= '<option' . (!in_array($album_data['album_sort_key'], array('t', 'n', 'vc', 'u', 'ra', 'r', 'c', 'lc')) ? ' selected="selected"' : '') . " value=''>" . $user->lang['SORT_DEFAULT'] . '</option>';
                $album_sort_key_options .= '<option' . ($album_data['album_sort_key'] == 't' ? ' selected="selected"' : '') . " value='t'>" . $user->lang['TIME'] . '</option>';
                $album_sort_key_options .= '<option' . ($album_data['album_sort_key'] == 'n' ? ' selected="selected"' : '') . " value='n'>" . $user->lang['IMAGE_NAME'] . '</option>';
                $album_sort_key_options .= '<option' . ($album_data['album_sort_key'] == 'vc' ? ' selected="selected"' : '') . " value='vc'>" . $user->lang['VIEWS'] . '</option>';
                $album_sort_key_options .= '<option' . ($album_data['album_sort_key'] == 'u' ? ' selected="selected"' : '') . " value='u'>" . $user->lang['USERNAME'] . '</option>';
                $album_sort_key_options .= '<option' . ($album_data['album_sort_key'] == 'ra' ? ' selected="selected"' : '') . " value='ra'>" . $user->lang['RATING'] . '</option>';
                $album_sort_key_options .= '<option' . ($album_data['album_sort_key'] == 'r' ? ' selected="selected"' : '') . " value='r'>" . $user->lang['RATES_COUNT'] . '</option>';
                $album_sort_key_options .= '<option' . ($album_data['album_sort_key'] == 'c' ? ' selected="selected"' : '') . " value='c'>" . $user->lang['COMMENTS'] . '</option>';
                $album_sort_key_options .= '<option' . ($album_data['album_sort_key'] == 'lc' ? ' selected="selected"' : '') . " value='lc'>" . $user->lang['NEW_COMMENT'] . '</option>';
                $album_sort_dir_options = '';
                $album_sort_dir_options .= '<option' . ($album_data['album_sort_dir'] != 'd' && $album_data['album_sort_dir'] != 'a' ? ' selected="selected"' : '') . " value=''>" . $user->lang['SORT_DEFAULT'] . '</option>';
                $album_sort_dir_options .= '<option' . ($album_data['album_sort_dir'] == 'd' ? ' selected="selected"' : '') . " value='d'>" . $user->lang['SORT_DESCENDING'] . '</option>';
                $album_sort_dir_options .= '<option' . ($album_data['album_sort_dir'] == 'a' ? ' selected="selected"' : '') . " value='a'>" . $user->lang['SORT_ASCENDING'] . '</option>';
                $statuslist = '<option value="' . phpbb_gallery_album::STATUS_OPEN . '"' . ($album_data['album_status'] == phpbb_gallery_album::STATUS_OPEN ? ' selected="selected"' : '') . '>' . $user->lang['UNLOCKED'] . '</option><option value="' . phpbb_gallery_album::STATUS_LOCKED . '"' . ($album_data['album_status'] == phpbb_gallery_album::STATUS_LOCKED ? ' selected="selected"' : '') . '>' . $user->lang['LOCKED'] . '</option>';
                $sql = 'SELECT album_id
					FROM ' . GALLERY_ALBUMS_TABLE . '
					WHERE album_type = ' . phpbb_gallery_album::TYPE_UPLOAD . '
						AND album_user_id = ' . phpbb_gallery_album::PUBLIC_ALBUM . "\n\t\t\t\t\t\tAND album_id <> {$album_id}";
                $result = $db->sql_query_limit($sql, 1);
                $uploadable_album_exists = false;
                if ($db->sql_fetchrow($result)) {
                    $uploadable_album_exists = true;
                }
                $db->sql_freeresult($result);
                // Subalbum move options
                if ($action == 'edit' && in_array($album_data['album_type'], array(phpbb_gallery_album::TYPE_UPLOAD, phpbb_gallery_album::TYPE_CONTEST))) {
                    $subalbums_id = array();
                    $subalbums = phpbb_gallery_album::get_branch(phpbb_gallery_album::PUBLIC_ALBUM, $album_id, 'children');
                    foreach ($subalbums as $row) {
                        $subalbums_id[] = $row['album_id'];
                    }
                    $albums_list = phpbb_gallery_album::get_albumbox(true, '', $album_data['parent_id'], false, $subalbums_id);
                    if ($uploadable_album_exists) {
                        $template->assign_vars(array('S_MOVE_ALBUM_OPTIONS' => phpbb_gallery_album::get_albumbox(true, '', $album_data['parent_id'], false, $subalbums_id, phpbb_gallery_album::PUBLIC_ALBUM, phpbb_gallery_album::TYPE_UPLOAD)));
                    }
                    $template->assign_vars(array('S_HAS_SUBALBUMS' => $album_data['right_id'] - $album_data['left_id'] > 1 ? true : false, 'S_ALBUMS_LIST' => $albums_list));
                } elseif ($uploadable_album_exists) {
                    $template->assign_vars(array('S_MOVE_ALBUM_OPTIONS' => phpbb_gallery_album::get_albumbox(true, '', $album_data['parent_id'], false, $album_id, 0, phpbb_gallery_album::TYPE_UPLOAD)));
                }
                /*
                if (strlen($album_data['album_password']) == 32)
                {
                	$errors[] = $user->lang['ALBUM_PASSWORD_OLD'];
                }
                */
                $template->assign_vars(array('S_EDIT_ALBUM' => true, 'S_ERROR' => sizeof($errors) ? true : false, 'S_PARENT_ID' => $this->parent_id, 'S_ALBUM_PARENT_ID' => $album_data['parent_id'], 'S_ADD_ACTION' => $action == 'add' ? true : false, 'U_BACK' => $this->u_action . '&amp;parent_id=' . $this->parent_id, 'U_EDIT_ACTION' => $this->u_action . "&amp;parent_id={$this->parent_id}&amp;action={$action}&amp;a={$album_id}", 'L_COPY_PERMISSIONS_EXPLAIN' => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'], 'L_TITLE' => $user->lang[$this->page_title], 'ERROR_MSG' => sizeof($errors) ? implode('<br />', $errors) : '', 'ALBUM_NAME' => $album_data['album_name'], 'ALBUM_IMAGE' => $album_data['album_image'], 'ALBUM_IMAGE_SRC' => $album_data['album_image'] ? phpbb_gallery_url::path('phpbb') . $album_data['album_image'] : '', 'ALBUM_DESC' => $album_desc_data['text'], 'S_DESC_BBCODE_CHECKED' => $album_desc_data['allow_bbcode'] ? true : false, 'S_DESC_SMILIES_CHECKED' => $album_desc_data['allow_smilies'] ? true : false, 'S_DESC_URLS_CHECKED' => $album_desc_data['allow_urls'] ? true : false, 'S_ALBUM_TYPE_OPTIONS' => $album_type_options, 'S_STATUS_OPTIONS' => $statuslist, 'S_PARENT_OPTIONS' => $parents_list, 'S_ALBUM_OPTIONS' => phpbb_gallery_album::get_albumbox(true, '', $action == 'add' ? $album_data['parent_id'] : false, false, $action == 'edit' ? $album_data['album_id'] : false), 'S_ALBUM_ORIG_UPLOAD' => isset($old_album_type) && $old_album_type == phpbb_gallery_album::TYPE_UPLOAD ? true : false, 'S_ALBUM_ORIG_CAT' => isset($old_album_type) && $old_album_type == phpbb_gallery_album::TYPE_CAT ? true : false, 'S_ALBUM_ORIG_CONTEST' => isset($old_album_type) && $old_album_type == phpbb_gallery_album::TYPE_CONTEST ? true : false, 'S_ALBUM_UPLOAD' => $album_data['album_type'] == phpbb_gallery_album::TYPE_UPLOAD ? true : false, 'S_ALBUM_CAT' => $album_data['album_type'] == phpbb_gallery_album::TYPE_CAT ? true : false, 'S_ALBUM_CONTEST' => $album_data['album_type'] == phpbb_gallery_album::TYPE_CONTEST ? true : false, 'ALBUM_UPLOAD' => phpbb_gallery_album::TYPE_UPLOAD, 'ALBUM_CAT' => phpbb_gallery_album::TYPE_CAT, 'ALBUM_CONTEST' => phpbb_gallery_album::TYPE_CONTEST, 'S_CAN_COPY_PERMISSIONS' => true, 'S_ALBUM_WATERMARK' => $album_data['album_watermark'] ? true : false, 'ALBUM_SORT_KEY_OPTIONS' => $album_sort_key_options, 'ALBUM_SORT_DIR_OPTIONS' => $album_sort_dir_options, 'S_DISPLAY_SUBALBUM_LIST' => $album_data['display_subalbum_list'] ? true : false, 'S_DISPLAY_ON_INDEX' => $album_data['display_on_index'] ? true : false, 'S_DISPLAY_IN_RRC' => $album_data['display_in_rrc'] ? true : false, 'S_CONTEST_START' => $user->format_date($contest_data['contest_start'], 'Y-m-d H:i'), 'CONTEST_RATING' => $user->format_date($contest_data['contest_start'] + $contest_data['contest_rating'], 'Y-m-d H:i'), 'CONTEST_END' => $user->format_date($contest_data['contest_start'] + $contest_data['contest_end'], 'Y-m-d H:i')));
                return;
                break;
            case 'delete':
                if (!$album_id) {
                    trigger_error($user->lang['NO_ALBUM'] . adm_back_link($this->u_action . '&amp;parent_id=' . $this->parent_id), E_USER_WARNING);
                }
                $album_data = phpbb_gallery_album::get_info($album_id);
                $subalbums_id = array();
                $subalbums = phpbb_gallery_album::get_branch(phpbb_gallery_album::PUBLIC_ALBUM, $album_id, 'children');
                foreach ($subalbums as $row) {
                    $subalbums_id[] = $row['album_id'];
                }
                $albums_list = phpbb_gallery_album::get_albumbox(true, '', $album_data['parent_id'], false, $subalbums_id);
                $sql = 'SELECT album_id
					FROM ' . GALLERY_ALBUMS_TABLE . '
					WHERE album_type = ' . phpbb_gallery_album::TYPE_UPLOAD . "\n\t\t\t\t\t\tAND album_id <> {$album_id}\n\t\t\t\t\t\tAND album_user_id = " . phpbb_gallery_album::PUBLIC_ALBUM;
                $result = $db->sql_query_limit($sql, 1);
                if ($db->sql_fetchrow($result)) {
                    $template->assign_vars(array('S_MOVE_ALBUM_OPTIONS' => phpbb_gallery_album::get_albumbox(true, '', $album_data['parent_id'], false, $subalbums_id, phpbb_gallery_album::PUBLIC_ALBUM, phpbb_gallery_album::TYPE_UPLOAD)));
                }
                $db->sql_freeresult($result);
                $parent_id = $this->parent_id == $album_id ? 0 : $this->parent_id;
                $template->assign_vars(array('S_DELETE_ALBUM' => true, 'U_ACTION' => $this->u_action . "&amp;parent_id={$parent_id}&amp;action=delete&amp;a=" . $album_id, 'U_BACK' => $this->u_action . '&amp;parent_id=' . $this->parent_id, 'ALBUM_NAME' => $album_data['album_name'], 'S_ALBUM_POST' => in_array($album_data['album_type'], array(phpbb_gallery_album::TYPE_UPLOAD, phpbb_gallery_album::TYPE_CONTEST)) ? true : false, 'S_HAS_SUBALBUMS' => $album_data['right_id'] - $album_data['left_id'] > 1 ? true : false, 'S_ALBUMS_LIST' => $albums_list, 'S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => sizeof($errors) ? implode('<br />', $errors) : ''));
                return;
                break;
        }
        // Default management page
        if (!$this->parent_id) {
            $navigation = $user->lang['GALLERY_INDEX'];
        } else {
            $navigation = '<a href="' . $this->u_action . '">' . $user->lang['GALLERY_INDEX'] . '</a>';
            $albums_nav = phpbb_gallery_album::get_branch(phpbb_gallery_album::PUBLIC_ALBUM, $this->parent_id, 'parents', 'descending');
            foreach ($albums_nav as $row) {
                if ($row['album_id'] == $this->parent_id) {
                    $navigation .= ' -&gt; ' . $row['album_name'];
                } else {
                    $navigation .= ' -&gt; <a href="' . $this->u_action . '&amp;parent_id=' . $row['album_id'] . '">' . $row['album_name'] . '</a>';
                }
            }
        }
        // Jumpbox
        $album_box = phpbb_gallery_album::get_albumbox(true, '', $this->parent_id, false, false);
        if ($action == 'sync' || $action == 'sync_album') {
            $template->assign_var('S_RESYNCED', true);
        }
        $sql = 'SELECT *
			FROM ' . GALLERY_ALBUMS_TABLE . "\n\t\t\tWHERE parent_id = {$this->parent_id}\n\t\t\t\tAND album_user_id = " . phpbb_gallery_album::PUBLIC_ALBUM . '
			ORDER BY left_id';
        $result = $db->sql_query($sql);
        if ($row = $db->sql_fetchrow($result)) {
            do {
                $album_type = $row['album_type'];
                if ($row['album_status'] == phpbb_gallery_album::STATUS_LOCKED) {
                    $folder_image = '<img src="images/icon_folder_lock.gif" alt="' . $user->lang['LOCKED'] . '" />';
                } else {
                    $folder_image = $row['left_id'] + 1 != $row['right_id'] ? '<img src="images/icon_subfolder.gif" alt="' . $user->lang['SUBALBUM'] . '" />' : '<img src="images/icon_folder.gif" alt="' . $user->lang['FOLDER'] . '" />';
                }
                $url = $this->u_action . "&amp;parent_id={$this->parent_id}&amp;a={$row['album_id']}";
                $template->assign_block_vars('albums', array('FOLDER_IMAGE' => $folder_image, 'ALBUM_IMAGE' => $row['album_image'] ? '<img src="' . phpbb_gallery_url::path('phpbb') . $row['album_image'] . '" alt="" />' : '', 'ALBUM_IMAGE_SRC' => $row['album_image'] ? phpbb_gallery_url::path('phpbb') . $row['album_image'] : '', 'ALBUM_NAME' => $row['album_name'], 'ALBUM_DESCRIPTION' => generate_text_for_display($row['album_desc'], $row['album_desc_uid'], $row['album_desc_bitfield'], $row['album_desc_options']), 'ALBUM_IMAGES' => $row['album_images'], 'S_ALBUM_POST' => $album_type != phpbb_gallery_album::TYPE_CAT ? true : false, 'U_ALBUM' => $this->u_action . '&amp;parent_id=' . $row['album_id'], 'U_MOVE_UP' => $url . '&amp;action=move_up', 'U_MOVE_DOWN' => $url . '&amp;action=move_down', 'U_EDIT' => $url . '&amp;action=edit', 'U_DELETE' => $url . '&amp;action=delete', 'U_SYNC' => $url . '&amp;action=sync'));
            } while ($row = $db->sql_fetchrow($result));
        } else {
            if ($this->parent_id) {
                $row = get_album_info($this->parent_id);
                $url = $this->u_action . '&amp;parent_id=' . $this->parent_id . '&amp;a=' . $row['album_id'];
                $template->assign_vars(array('S_NO_ALBUMS' => true, 'U_EDIT' => $url . '&amp;action=edit', 'U_DELETE' => $url . '&amp;action=delete', 'U_SYNC' => $url . '&amp;action=sync'));
            }
        }
        $db->sql_freeresult($result);
        $template->assign_vars(array('ERROR_MSG' => sizeof($errors) ? implode('<br />', $errors) : '', 'NAVIGATION' => $navigation, 'ALBUM_BOX' => $album_box, 'U_SEL_ACTION' => $this->u_action, 'U_ACTION' => $this->u_action . '&amp;parent_id=' . $this->parent_id, 'U_PROGRESS_BAR' => $this->u_action . '&amp;action=progress_bar', 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&amp;action=progress_bar')));
    }
Exemplo n.º 10
0
 function info()
 {
     global $template, $user;
     if (!phpbb_gallery::$user->get_data('personal_album_id')) {
         // User will probally go to initialise_album()
         $template->assign_vars(array('S_INFO_CREATE' => true, 'S_UCP_ACTION' => $this->u_action . '&amp;action=initialise', 'L_TITLE' => $user->lang['UCP_GALLERY_PERSONAL_ALBUMS'], 'L_TITLE_EXPLAIN' => $user->lang['NO_PERSONAL_ALBUM']));
     } else {
         phpbb_gallery::redirect('phpbb', 'ucp', 'i=gallery&amp;mode=manage_albums');
     }
 }
Exemplo n.º 11
0
/**
*
* @package phpBB Gallery
* @version $Id$
* @copyright (c) 2007 nickvergessen nickvergessen@gmx.de http://www.flying-bits.org
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include 'common.' . $phpEx;
include $phpbb_root_path . 'common.' . $phpEx;
phpbb_gallery::setup(array('mods/gallery', 'mods/gallery_mcp'));
phpbb_gallery_url::_include(array('functions_display'), 'phpbb');
$mode = request_var('mode', 'album');
$action = request_var('action', '');
$option_id = request_var('option_id', 0);
$image_id = request_var('image_id', 0);
$album_id = request_var('album_id', 0);
if (request_var('quickmod', 0) == 1 && $action == 'report_details') {
    $mode = 'report_details';
    $option_id = (int) $image_data['image_reported'];
} else {
    if (request_var('quickmod', 0) == 1 && $action == 'image_edit') {
        phpbb_gallery_url::redirect('posting', "mode=image&amp;submode=edit&amp;album_id={$album_id}&amp;image_id={$image_id}");
    }
}
if ($mode == 'whois' && $auth->acl_get('a_') && request_var('ip', '')) {
Exemplo n.º 12
0
/**
*
* @package phpBB Gallery
* @version $Id$
* @copyright (c) 2007 nickvergessen nickvergessen@gmx.de http://www.flying-bits.org
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include 'common.' . $phpEx;
include $phpbb_root_path . 'common.' . $phpEx;
phpbb_gallery::setup(array('mods/gallery', 'posting'));
phpbb_gallery_url::_include(array('functions_display', 'functions_posting', 'functions_user'), 'phpbb');
phpbb_gallery_url::_include(array('bbcode', 'message_parser'), 'phpbb');
add_form_key('gallery');
$submit = isset($_POST['submit']) ? true : false;
$mode = request_var('mode', '');
$submode = request_var('submode', '');
$album_id = request_var('album_id', 0);
$image_id = request_var('image_id', 0);
$comment_id = request_var('comment_id', 0);
$error = $message = $s_album_action = '';
$error_count = array();
$slower_redirect = false;
// Check for permissions cheaters!
if ($comment_id) {
    $sql = 'SELECT *
Exemplo n.º 13
0
/**
*
* @package phpBB Gallery
* @version $Id$
* @copyright (c) 2007 nickvergessen nickvergessen@gmx.de http://www.flying-bits.org
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include 'common.' . $phpEx;
include $phpbb_root_path . 'common.' . $phpEx;
phpbb_gallery::setup(array('mods/gallery'), false);
//phpbb_gallery_url::_include('functions_display', 'phpbb');
// Get general album information
define('S_GALLERY_PLUGINS', false);
/**
* Check whether the requested image & album exit.
*/
$image_id = request_var('image_id', 0);
$image_data = phpbb_gallery_image::get_info($image_id);
$album_id = $image_data['image_album_id'];
$album_data = phpbb_gallery_album::get_info($album_id);
$image_error = '';
$image_filetype = utf8_substr($image_data['image_filename'], strlen($image_data['image_filename']) - 4, 4);
if (!file_exists(phpbb_gallery_url::path('upload') . $image_data['image_filename'])) {
    $sql = 'UPDATE ' . GALLERY_IMAGES_TABLE . ' 
		SET image_filemissing = 1
Exemplo n.º 14
0
/**
*
* @package phpBB Gallery
* @version $Id$
* @copyright (c) 2007 nickvergessen nickvergessen@gmx.de http://www.flying-bits.org
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include 'common.' . $phpEx;
include $phpbb_root_path . 'common.' . $phpEx;
phpbb_gallery::setup(array('mods/gallery'));
phpbb_gallery_url::_include('functions_display', 'phpbb');
/**
* Display albums
*/
$mode = request_var('mode', 'index', true);
phpbb_gallery_album::display_albums($mode == 'personal' ? 'personal' : 0, $config['load_moderators']);
if ($mode == 'personal') {
    $template->assign_block_vars('navlinks', array('FORUM_NAME' => $user->lang['PERSONAL_ALBUMS'], 'U_VIEW_FORUM' => phpbb_gallery_url::append_sid('index', 'mode=personal')));
    $template->assign_var('S_PERSONAL_GALLERY', true);
} else {
    if (phpbb_gallery_config::get('pegas_index_album') && phpbb_gallery::$auth->acl_check('a_list', phpbb_gallery_auth::PERSONAL_ALBUM)) {
        $images = $images_real = $last_image = 0;
        $last_image = $lastimage_image_id = $lastimage_user_id = $lastimage_album_id = 0;
        $lastimage_time = $lastimage_name = $lastimage_username = $lastimage_user_colour = $last_image_page_url = $last_thumb_url = '';
        $sql = 'SELECT *
    function main($id, $mode)
    {
        global $db, $user, $auth, $cache, $template;
        phpbb_gallery::init();
        $user->add_lang(array('mods/gallery_acp', 'mods/gallery'));
        $submit = isset($_POST['submit']) ? true : false;
        $form_key = 'acp_time';
        add_form_key($form_key);
        switch ($mode) {
            case 'main':
                // Disable some Options if they can not be used
                if (!function_exists('exif_read_data')) {
                    $this->display_vars['vars']['exif_data']['type'] = 'custom';
                    $this->display_vars['vars']['exif_data']['explain'] = true;
                    $this->display_vars['vars']['exif_data']['method'] = 'disabled_boolean';
                }
                if (!function_exists('imagerotate')) {
                    $this->display_vars['vars']['allow_rotate_images']['type'] = 'custom';
                    $this->display_vars['vars']['allow_rotate_images']['explain'] = true;
                    $this->display_vars['vars']['allow_rotate_images']['method'] = 'disabled_boolean';
                }
                break;
            default:
                trigger_error('NO_MODE', E_USER_ERROR);
                break;
        }
        phpbb_gallery_config::load(true);
        $this->new_config = phpbb_gallery_config::get_array();
        $cfg_array = isset($_REQUEST['config']) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
        $error = array();
        // We validate the complete config if whished
        validate_config_vars($this->display_vars['vars'], $cfg_array, $error);
        if ($submit && !check_form_key($form_key)) {
            $error[] = $user->lang['FORM_INVALID'];
        }
        // Do not write values if there is an error
        if (sizeof($error)) {
            $submit = false;
        }
        // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
        foreach ($this->display_vars['vars'] as $config_name => $null) {
            if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) {
                continue;
            }
            $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
            if ($submit) {
                // Check for RRC-display-options
                if (isset($null['method']) && ($null['method'] == 'rrc_display' || $null['method'] == 'rrc_modes')) {
                    // Changing the value, casted by int to not mess up anything
                    $config_value = (int) array_sum(request_var($config_name, array(0)));
                }
                // Recalculate the Watermark-position
                if (isset($null['method']) && $null['method'] == 'watermark_position') {
                    // Changing the value, casted by int to not mess up anything
                    $config_value = request_var('watermark_position_x', 0) + request_var('watermark_position_y', 0);
                }
                if ($config_name == 'link_thumbnail') {
                    $update_bbcode = request_var('update_bbcode', '');
                    // Update the BBCode
                    if ($update_bbcode) {
                        if (!class_exists('acp_bbcodes')) {
                            phpbb_gallery_url::_include('acp/acp_bbcodes', 'phpbb');
                        }
                        $acp_bbcodes = new acp_bbcodes();
                        $bbcode_match = '[album]{NUMBER}[/album]';
                        $bbcode_tpl = $this->bbcode_tpl($config_value);
                        $sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl);
                        $sql_ary = array_merge($sql_ary, array('bbcode_match' => $bbcode_match, 'bbcode_tpl' => $bbcode_tpl, 'display_on_posting' => true, 'bbcode_helpline' => 'GALLERY_HELPLINE_ALBUM'));
                        $sql = 'UPDATE ' . BBCODES_TABLE . '
							SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\t\t\t\tWHERE bbcode_tag = '" . $sql_ary['bbcode_tag'] . "'";
                        $db->sql_query($sql);
                        $cache->destroy('sql', BBCODES_TABLE);
                    }
                }
                phpbb_gallery_config::set($config_name, $config_value);
            }
        }
        if ($submit) {
            $cache->destroy('sql', CONFIG_TABLE);
            trigger_error($user->lang['GALLERY_CONFIG_UPDATED'] . adm_back_link($this->u_action));
        }
        $this->tpl_name = 'acp_board';
        $this->page_title = $this->display_vars['title'];
        $template->assign_vars(array('L_TITLE' => $user->lang[$this->display_vars['title']], 'L_TITLE_EXPLAIN' => $user->lang[$this->display_vars['title'] . '_EXPLAIN'], 'S_ERROR' => sizeof($error) ? true : false, 'ERROR_MSG' => implode('<br />', $error), 'U_ACTION' => $this->u_action));
        // Output relevant page
        foreach ($this->display_vars['vars'] as $config_key => $vars) {
            if (!is_array($vars) && strpos($config_key, 'legend') === false) {
                continue;
            }
            if (strpos($config_key, 'legend') !== false) {
                $template->assign_block_vars('options', array('S_LEGEND' => true, 'LEGEND' => isset($user->lang[$vars]) ? $user->lang[$vars] : $vars));
                continue;
            }
            $this->new_config[$config_key] = phpbb_gallery_config::get($config_key);
            $type = explode(':', $vars['type']);
            $l_explain = '';
            if ($vars['explain']) {
                $l_explain = isset($user->lang[$vars['lang'] . '_EXP']) ? $user->lang[$vars['lang'] . '_EXP'] : '';
            }
            $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars);
            if (empty($content)) {
                continue;
            }
            $template->assign_block_vars('options', array('KEY' => $config_key, 'TITLE' => isset($user->lang[$vars['lang']]) ? $user->lang[$vars['lang']] : $vars['lang'], 'S_EXPLAIN' => $vars['explain'], 'TITLE_EXPLAIN' => $l_explain, 'CONTENT' => $content));
            unset($this->display_vars['vars'][$config_key]);
        }
    }