Ejemplo n.º 1
0
 /**
  * Executes view action : displays the user profile
  */
 public function executeView()
 {
     $id = $this->getRequestParameter('id');
     parent::executeView();
     $hasPublicProfile = UserPrivateData::hasPublicProfile($id);
     if (!$this->getUser()->isConnected() && !$hasPublicProfile) {
         // page owner has not allowed anonymous users to access his personal page
         $this->setTemplate('login');
     } else {
         if (!$this->document->isArchive() && $this->document['redirects_to'] == NULL) {
             if ($hasPublicProfile) {
                 $this->getResponse()->addMeta('robots', 'index, follow');
             } else {
                 $this->getResponse()->addMeta('robots', 'noindex, nofollow');
             }
             // get associated outings
             $associated_outings = array();
             $nb_outings = count(Association::countAllLinked(array($id), 'uo'));
             $nb_outings_limit = 0;
             if ($nb_outings > 0) {
                 $outing_params = array('users' => $id);
                 $nb_outings_limit = sfConfig::get('app_users_outings_limit');
                 $associated_outings = Outing::listLatest($nb_outings_limit, array(), array(), array(), $outing_params, false, false);
                 $associated_outings = Language::getTheBest($associated_outings, 'Outing');
             }
             $this->nb_outings = $nb_outings;
             $this->nb_outings_limit = $nb_outings_limit;
             $this->associated_outings = $associated_outings;
             $forum_nickname = Punbb::getNickname($id);
             $this->forum_nickname = $forum_nickname[0]['username'];
             // check if user is forum and / or topoguide moderator
             $this->forum_moderator = UserPrivateData::isForumModerator($id);
             $user_permissions = Doctrine_Query::create()->from('User.groups.permissions, User.permissions')->where('User.id = ?', $id)->execute(array(), Doctrine::FETCH_ARRAY);
             $topoguide_moderator = false;
             $moderator_credential = sfConfig::get('app_credentials_moderator');
             foreach ($user_permissions[0]['groups'] as $group) {
                 foreach ($group['permissions'] as $permission) {
                     if ($permission['name'] == $moderator_credential) {
                         $topoguide_moderator = true;
                         break 2;
                     }
                 }
             }
             foreach ($user_permissions[0]['permissions'] as $permission) {
                 if ($permission['name'] == $moderator_credential) {
                     $topoguide_moderator = true;
                     break;
                 }
             }
             $this->topoguide_moderator = $topoguide_moderator;
         } else {
             // only moderators and user itself should see archive versions of user docs
             $this->filterAuthorizedPeople($id);
         }
     }
 }
Ejemplo n.º 2
0
 // parse_message always use html_special_chars, and so does retrieval of the text
 echo $text;
 ?>
                 </p>
             </div>
         </div>
         <div class="clearer"></div>
         <div class="postfootright">
             <ul><?php 
 if ($sf_user->getId() > 1) {
     echo '<li class="postreport">' . f_link_to(__('Report'), 'misc.php?report=' . $comment->id) . ' | ';
 } else {
     echo '<li class="postreport">' . f_link_to(__('Report'), 'misc.php?email=' . sfConfig::get('app_moderator_forum_user_id') . '&doc=' . urlencode('/forums/viewtopic.php?pid=' . $comment->id . '#p' . $comment->id)) . ' | ';
 }
 // Following line is only ok because comments page is not cached
 $is_forum_moderator = UserPrivateData::isForumModerator($sf_user->getId());
 if ($is_forum_moderator) {
     echo '</li><li class="movepost">' . f_link_to(__('Move'), 'movepost.php?id=' . $comment->id) . ' | ';
 }
 if ($comment['poster_id'] == $sf_user->getId() || $is_forum_moderator) {
     echo '</li><li class="postedit">' . f_link_to(__('Edit'), 'edit.php?id=' . $comment->id) . ' | ';
 }
 echo '</li>';
 // check if anonymous comments allowed
 if ($sf_user->getId() > 1 || in_array($lang, sfConfig::get('app_anonymous_comments_allowed_list'))) {
     echo '<li class="postquote">' . f_link_to(__('Quoted reply'), 'post.php?tid=' . $topic_id . '&amp;' . 'qid=' . $comment->id, array('rel' => 'nofollow')) . '</li>';
 }
 ?>
             </ul>
         </div>
     </div>