protected function set_personal_settings()
 {
     if ($this->request->is_set_post('submit')) {
         $gallery_settings = array('watch_own' => $this->request->variable('watch_own', false), 'watch_com' => $this->request->variable('watch_com', false), 'user_allow_comments' => $this->request->variable('allow_comments', false));
         $additional_settings = array();
         /**
          * Event set personal settings
          *
          * @event phpbbgallery.core.ucp.set_settings_submit
          * @var	array	additional_settings		array of additional settings
          * @since 1.2.0
          */
         $vars = array('additional_settings');
         extract($this->dispatcher->trigger_event('phpbbgallery.core.ucp.set_settings_submit', compact($vars)));
         $gallery_settings = array_merge($gallery_settings, $additional_settings);
         if (!$this->config['phpbb_gallery_allow_comments'] || !$this->config['phpbb_gallery_comment_user_control']) {
             unset($gallery_settings['user_allow_comments']);
         }
         $this->gallery_user->set_user_id($this->user->data['user_id']);
         $this->gallery_user->update_data($gallery_settings);
         meta_refresh(3, $this->u_action);
         trigger_error($this->user->lang['WATCH_CHANGED'] . '<br /><br />' . sprintf($this->user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'));
     }
     /**
      * Event no submit personal settings
      *
      * @event phpbbgallery.core.ucp.set_settings_nosubmit
      * @since 1.2.0
      */
     $this->dispatcher->dispatch('phpbbgallery.core.ucp.set_settings_nosubmit');
     $this->template->assign_vars(array('S_PERSONAL_SETTINGS' => true, 'S_UCP_ACTION' => $this->u_action, 'L_TITLE' => $this->user->lang['UCP_GALLERY_SETTINGS'], 'L_TITLE_EXPLAIN' => $this->user->lang['WATCH_NOTE'], 'S_WATCH_OWN' => $this->gallery_user->get_data('watch_own'), 'S_WATCH_COM' => $this->gallery_user->get_data('watch_com'), 'S_ALLOW_COMMENTS' => $this->gallery_user->get_data('user_allow_comments'), 'S_COMMENTS_ENABLED' => $this->config['phpbb_gallery_allow_comments'] && $this->config['phpbb_gallery_comment_user_control']));
 }
Esempio n. 2
0
 /**
  * Get permission
  *
  * @param	string	$acl	One of the permissions, Exp: i_view
  * @param	int		$a_id	The album_id, from which we want to have the permissions
  * @param	int		$u_id	The user_id from the album-owner. If not specified we need to get it from the cache.
  *
  * @return	bool			Is the user allowed to do the $acl?
  */
 public function acl_check($acl, $a_id, $u_id = -1)
 {
     global $user;
     $bit = self::$_permissions_flipped[$acl];
     if ($bit < 0) {
         $bit = $acl;
     }
     if (isset($this->acl_cache[$a_id][$bit])) {
         return $this->acl_cache[$a_id][$bit];
     }
     // Do we have a function call without $album_user_id ?
     if ($u_id < self::PUBLIC_ALBUM && $a_id > 0) {
         static $_album_list;
         // Yes, from viewonline.php
         if (!$_album_list) {
             $_album_list = $this->cache->get_albums();
         }
         if (!isset($_album_list[$a_id])) {
             // Do not give permissions, if the album does not exist.
             return false;
         }
         $u_id = $_album_list[$a_id]['album_user_id'];
     }
     $get_acl = 'get_bit';
     if (!is_int($bit)) {
         $get_acl = 'get_count';
     }
     $p_id = $a_id;
     if ($u_id) {
         $this->user->set_user_id($user->data['user_id']);
         if ($this->user->is_user($u_id)) {
             $p_id = self::OWN_ALBUM;
         } else {
             if (!isset($this->_auth_data[$a_id])) {
                 $p_id = self::PERSONAL_ALBUM;
             }
         }
     }
     if (isset($this->_auth_data[$p_id])) {
         $this->acl_cache[$a_id][$bit] = $this->_auth_data[$p_id]->{$get_acl}($bit);
         return $this->acl_cache[$a_id][$bit];
     }
     return false;
 }