示例#1
0
 if ($mode == 'comment') {
     $comment = $comment_username = $s_captcha_hidden_fields = '';
     $comment_username_req = $contest_rating_msg = false;
     /**
      * Rating-System: now you can comment and rate in one form
      */
     if (phpbb_gallery_config::get('allow_rates') && $submode != 'edit') {
         $rating = new phpbb_gallery_image_rating($image_id, $image_data, $album_data);
         $user_rating = $rating->get_user_rating($user->data['user_id']);
         // Check: User didn't rate yet, has permissions, it's not the users own image and the user is logged in
         if (!$user_rating && $rating->is_allowed()) {
             $rating->display_box();
             // User just rated the image, so we store it
             $rate_point = request_var('rating', 0);
             if ($rating->rating_enabled && $rate_point > 0) {
                 $rating->submit_rating();
                 $message .= $user->lang['RATING_SUCCESSFUL'] . '<br />';
             }
         }
         $template->assign_vars(array('S_ALLOWED_TO_RATE' => $rating->is_allowed()));
         if ($submode == 'rate') {
             $s_album_action = '';
         }
     }
     switch ($submode) {
         case 'add':
             if (phpbb_gallery_misc::display_captcha('comment')) {
                 phpbb_gallery_url::_include('captcha/captcha_factory', 'phpbb');
                 $captcha =& phpbb_captcha_factory::get_instance($config['captcha_plugin']);
                 $captcha->init(CONFIRM_POST);
             }