예제 #1
0
if ($this->Menu) {
    $this->Menu->AddLink('Dashboard', T('Dashboard'), '/dashboard/settings', array('Garden.Settings.Manage'));
    // $this->Menu->AddLink('Dashboard', T('Users'), '/user/browse', array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'));
    //$this->Menu->AddLink('Activity', T('Activity'), '/activity');
    $Authenticator = Gdn::Authenticator();
    if ($Session->IsValid()) {
        $Name = $Session->User->Name;
        $CountNotifications = $Session->User->CountNotifications;
        if (is_numeric($CountNotifications) && $CountNotifications > 0) {
            $Name .= ' <span>' . $CountNotifications . '</span>';
        }
        //$this->Menu->AddLink('User', $Name, '/profile/{UserID}/{Username}', array('Garden.SignIn.Allow'), array('class' => 'UserNotifications'));
        //$this->Menu->AddLink('SignOut', T('Sign Out'), Gdn::Authenticator()->SignOutUrl(), FALSE, array('class' => 'NonTab SignOut'));
    } else {
        $Attribs = array();
        if (SignInPopup() && strpos(Gdn::Request()->Url(), 'entry') === FALSE) {
            $Attribs['class'] = 'SignInPopup';
        }
        //$this->Menu->AddLink('Entry', T('Sign In'), Gdn::Authenticator()->SignInUrl(), FALSE, array('class' => 'NonTab'), $Attribs);
    }
    echo $this->Menu->ToString();
}
?>
            <!--<div class="Search"><?php 
$Form = Gdn::Factory('Form');
$Form->InputPrefix = '';
echo $Form->Open(array('action' => Url('/search'), 'method' => 'get')), $Form->TextBox('Search'), $Form->Button('Go', array('Name' => '')), $Form->Close();
?>
</div>-->
         </div>
      </div>
예제 #2
0
파일: me.php 프로젝트: robhazkes/Garden
        $CSpam = $SpamCount > 0 ? ' ' . Wrap($SpamCount, 'span class="Alert"') : '';
        $CModeration = $ModerationCount > 0 ? ' ' . Wrap($ModerationCount, 'span class="Alert"') : '';
        echo Wrap(Anchor(Sprite('SpApplicants') . ' ' . T('Applicants') . $CApplicant, '/dashboard/user/applicants'), 'li');
        echo Wrap(Anchor(Sprite('SpSpam') . ' ' . T('Spam Queue') . $CSpam, '/dashboard/log/spam'), 'li');
        echo Wrap(Anchor(Sprite('SpMod') . ' ' . T('Moderation Queue') . $CModeration, '/dashboard/log/moderation'), 'li');
        echo Wrap(Anchor(Sprite('SpDashboard') . ' ' . T('Dashboard'), '/dashboard/settings'), 'li');
    }
    $this->FireEvent('FlyoutMenu');
    echo Wrap('<hr />', 'li');
    echo Wrap(Anchor(Sprite('SpSignOut') . ' ' . T('Sign Out'), SignOutUrl()), 'li');
    echo '</div>';
    echo '</span>';
    // Sign Out
    // echo Anchor(Sprite('SpSignOut', 'Sprite16').Wrap(T('Sign Out'), 'em'), SignOutUrl(), 'MeButton', array('title' => T('Sign Out')));
    echo '</div>';
    echo '</div>';
    echo '</div>';
} else {
    echo '<div class="MeBox MeBox-SignIn' . $CssClass . '">';
    echo '<div class="SignInLinks">';
    echo Anchor(T('Sign In'), SignInUrl($this->_Sender->SelfUrl), SignInPopup() ? ' SignInPopup' : '', array('rel' => 'nofollow'));
    $Url = RegisterUrl($this->_Sender->SelfUrl);
    if (!empty($Url)) {
        echo ' <span class="Bullet">•</span> ' . Anchor(T('Register'), $Url, 'ApplyButton', array('rel' => 'nofollow')) . ' ';
    }
    echo '</div>';
    echo ' <div class="SignInIcons">';
    $this->FireEvent('SignInIcons');
    echo '</div>';
    echo '</div>';
}
예제 #3
0
echo t('Howdy, Stranger!');
?>
</h4>

    <p><?php 
echo t($this->MessageCode, $this->MessageDefault);
?>
</p>

    <p><?php 
$this->fireEvent('BeforeSignInButton');
?>
</p>

    <?php 
$signInUrl = SignInUrl($this->_Sender->SelfUrl);
if ($signInUrl) {
    echo '<div class="P">';
    echo anchor(t('Sign In'), SignInUrl($this->_Sender->SelfUrl), 'Button Primary' . (SignInPopup() ? ' SignInPopup' : ''), array('rel' => 'nofollow'));
    $Url = RegisterUrl($this->_Sender->SelfUrl);
    if (!empty($Url)) {
        echo ' ' . anchor(t('Register', t('Apply for Membership', 'Register')), $Url, 'Button ApplyButton', array('rel' => 'nofollow'));
    }
    echo '</div>';
}
?>
    <?php 
$this->fireEvent('AfterSignInButton');
?>
</div>
예제 #4
0
 public static function Link($Path, $Text = FALSE, $Format = NULL, $Options = array())
 {
     $Session = Gdn::Session();
     $Class = GetValue('class', $Options, '');
     $WithDomain = GetValue('WithDomain', $Options);
     $Target = GetValue('Target', $Options, '');
     if ($Target == 'current') {
         $Target = trim(Url('', TRUE), '/ ');
     }
     if (is_null($Format)) {
         $Format = '<a href="%url" class="%class">%text</a>';
     }
     switch ($Path) {
         case 'activity':
             TouchValue('Permissions', $Options, 'Garden.Activity.View');
             break;
         case 'category':
             $Breadcrumbs = Gdn::Controller()->Data('Breadcrumbs');
             if (is_array($Breadcrumbs) && count($Breadcrumbs) > 0) {
                 $Last = array_pop($Breadcrumbs);
                 $Path = GetValue('Url', $Last);
                 $DefaultText = GetValue('Name', $Last, T('Back'));
             } else {
                 $Path = '/';
                 $DefaultText = C('Garden.Title', T('Back'));
             }
             if (!$Text) {
                 $Text = $DefaultText;
             }
             break;
         case 'dashboard':
             $Path = 'dashboard/settings';
             TouchValue('Permissions', $Options, array('Garden.Settings.Manage', 'Garden.Settings.View'));
             if (!$Text) {
                 $Text = T('Dashboard');
             }
             break;
         case 'home':
             $Path = '/';
             if (!$Text) {
                 $Text = T('Home');
             }
             break;
         case 'inbox':
             $Path = 'messages/inbox';
             TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
             if (!$Text) {
                 $Text = T('Inbox');
             }
             if ($Session->IsValid() && $Session->User->CountUnreadConversations) {
                 $Class = trim($Class . ' HasCount');
                 $Text .= ' <span class="Alert">' . $Session->User->CountUnreadConversations . '</span>';
             }
             if (!$Session->IsValid()) {
                 $Text = FALSE;
             }
             break;
         case 'forumroot':
             $Route = Gdn::Router()->GetDestination('DefaultForumRoot');
             if (is_null($Route)) {
                 $Path = '/';
             } else {
                 $Path = CombinePaths(array('/', $Route));
             }
             break;
         case 'profile':
             TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
             if (!$Text && $Session->IsValid()) {
                 $Text = $Session->User->Name;
             }
             if ($Session->IsValid() && $Session->User->CountNotifications) {
                 $Class = trim($Class . ' HasCount');
                 $Text .= ' <span class="Alert">' . $Session->User->CountNotifications . '</span>';
             }
             break;
         case 'user':
             $Path = 'profile';
             TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
             if (!$Text && $Session->IsValid()) {
                 $Text = $Session->User->Name;
             }
             break;
         case 'photo':
             $Path = 'profile';
             TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
             if (!$Text && $Session->IsValid()) {
                 $IsFullPath = strtolower(substr($Session->User->Photo, 0, 7)) == 'http://' || strtolower(substr($Session->User->Photo, 0, 8)) == 'https://';
                 $PhotoUrl = $IsFullPath ? $Session->User->Photo : Gdn_Upload::Url(ChangeBasename($Session->User->Photo, 'n%s'));
                 $Text = Img($PhotoUrl, array('alt' => htmlspecialchars($Session->User->Name)));
             }
             break;
         case 'drafts':
             TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
             if (!$Text) {
                 $Text = T('My Drafts');
             }
             if ($Session->IsValid() && $Session->User->CountDrafts) {
                 $Class = trim($Class . ' HasCount');
                 $Text .= ' <span class="Alert">' . $Session->User->CountDrafts . '</span>';
             }
             break;
         case 'discussions/bookmarked':
             TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
             if (!$Text) {
                 $Text = T('My Bookmarks');
             }
             if ($Session->IsValid() && $Session->User->CountBookmarks) {
                 $Class = trim($Class . ' HasCount');
                 $Text .= ' <span class="Count">' . $Session->User->CountBookmarks . '</span>';
             }
             break;
         case 'discussions/mine':
             TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
             if (!$Text) {
                 $Text = T('My Discussions');
             }
             if ($Session->IsValid() && $Session->User->CountDiscussions) {
                 $Class = trim($Class . ' HasCount');
                 $Text .= ' <span class="Count">' . $Session->User->CountDiscussions . '</span>';
             }
             break;
         case 'signin':
         case 'signinout':
             // The destination is the signin/signout toggle link.
             if ($Session->IsValid()) {
                 if (!$Text) {
                     $Text = T('Sign Out');
                 }
                 $Path = SignOutUrl($Target);
                 $Class = ConcatSep(' ', $Class, 'SignOut');
             } else {
                 if (!$Text) {
                     $Text = T('Sign In');
                 }
                 $Attribs = array();
                 $Path = SignInUrl($Target);
                 if (SignInPopup() && strpos(Gdn::Request()->Url(), 'entry') === FALSE) {
                     $Class = ConcatSep(' ', $Class, 'SignInPopup');
                 }
             }
             break;
     }
     if ($Text == FALSE && strpos($Format, '%text') !== FALSE) {
         return '';
     }
     if (GetValue('Permissions', $Options) && !$Session->CheckPermission($Options['Permissions'], FALSE)) {
         return '';
     }
     $Url = Gdn::Request()->Url($Path, $WithDomain);
     if ($TK = GetValue('TK', $Options)) {
         if (in_array($TK, array(1, 'true'))) {
             $TK = 'TransientKey';
         }
         $Url .= (strpos($Url, '?') === FALSE ? '?' : '&') . $TK . '=' . urlencode(Gdn::Session()->TransientKey());
     }
     if (strcasecmp(trim($Path, '/'), Gdn::Request()->Path()) == 0) {
         $Class = ConcatSep(' ', $Class, 'Selected');
     }
     // Build the final result.
     $Result = $Format;
     $Result = str_replace('%url', $Url, $Result);
     $Result = str_replace('%text', $Text, $Result);
     $Result = str_replace('%class', $Class, $Result);
     return $Result;
 }
예제 #5
0
   $this->AddDefinition('Vanilla_Comments_AutoRefresh', Gdn::Config('Vanilla.Comments.AutoRefresh', 0));
}

echo $this->Pager->ToString('more');

// Write out the comment form
if ($this->Discussion->Closed == '1') {
   ?>
   <div class="Foot Closed">
      <div class="Note Closed"><?php echo T('This discussion has been closed.'); ?></div>
      <?php echo Anchor(T('&larr; All Discussions'), 'discussions', 'TabLink'); ?>
   </div>
   <?php
} else if ($Session->IsValid() && $Session->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $this->Discussion->PermissionCategoryID)) {
   echo $this->FetchView('comment', 'post');
} else if ($Session->IsValid()) { ?>
   <div class="Foot Closed">
      <div class="Note Closed"><?php echo T('Commenting not allowed.'); ?></div>
      <?php echo Anchor(T('&larr; All Discussions'), 'discussions', 'TabLink'); ?>
   </div>
   <?php
} else {
   ?>
   <div class="Foot">
      <?php
      echo Anchor(T('Add a Comment'), SignInUrl($this->SelfUrl.(strpos($this->SelfUrl, '?') ? '&' : '?').'post#Form_Body'), 'TabLink'.(SignInPopup() ? ' SignInPopup' : ''));
      ?> 
   </div>
   <?php 
}
예제 #6
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
?>
<!--<div class="Box GuestBox">
   <h4><?php 
echo T('Howdy, Stranger!');
?>
</h4>
   <p><?php 
echo T($this->MessageCode, $this->MessageDefault);
?>
</p>
   <?php 
$this->FireEvent('BeforeSignInButton');
?>
   <p>
      <?php 
echo Anchor(T('Sign In'), Gdn::Authenticator()->SignInUrl($this->_Sender->SelfUrl), 'Button' . (SignInPopup() ? ' SignInPopup' : ''));
$Url = Gdn::Authenticator()->RegisterUrl($this->_Sender->SelfUrl);
if (!empty($Url)) {
    echo ' ' . Anchor(T('Apply for Membership'), $Url, 'Button');
}
?>
   </p>
   <?php 
$this->FireEvent('AfterSignInButton');
?>
</div>-->
예제 #7
0
파일: guest.php 프로젝트: ru4/arabbnota
?>
<div class="Box GuestBox">
   <h4><?php 
echo T('Howdy, Stranger!');
?>
</h4>
   <p><?php 
echo T($this->MessageCode, $this->MessageDefault);
?>
</p>
   <div class="GuestBox_cont">
   <?php 
$this->FireEvent('BeforeSignInButton');
?>
   
   <?php 
if (strcasecmp(C('Garden.Registration.Method'), 'Connect') != 0) {
    echo '<div class="P">';
    echo Anchor(T('Sign In'), SignInUrl($this->_Sender->SelfUrl), 'Button' . (SignInPopup() ? ' SignInPopup' : ''));
    $Url = RegisterUrl($this->_Sender->SelfUrl);
    if (!empty($Url)) {
        echo ' ' . Anchor(T('Apply for Membership'), $Url, 'Button ApplyButton');
    }
    echo '</div>';
}
?>
   <?php 
$this->FireEvent('AfterSignInButton');
?>
   </div>
</div>
예제 #8
0
    ?>
   </div>
   <?php 
} else {
    if ($Session->IsValid() && $Session->CheckPermission('Vanilla.Comments.Add', TRUE, 'Category', $this->Discussion->CategoryID)) {
        echo $this->FetchView('comment', 'post');
    } else {
        if ($Session->IsValid()) {
            ?>
   <div class="Foot Closed">
      <div class="Note Closed"><?php 
            echo T('Commenting not allowed.');
            ?>
</div>
      <?php 
            echo Anchor(T('&larr; All Discussions'), 'discussions', 'TabLink');
            ?>
   </div>
   <?php 
        } else {
            ?>
   <div class="Foot">
      <?php 
            echo Anchor(T('Add a Comment'), Gdn::Authenticator()->SignInUrl($this->SelfUrl . '#Form_Body'), 'TabLink' . (SignInPopup() ? ' SignInPopup' : ''));
            ?>
 
   </div>
   <?php 
        }
    }
}
예제 #9
0
 public static function Link($Path, $Text = FALSE, $Format = '<a href="%url" class="%class">%text</a>', $Options = array())
 {
     $Session = Gdn::Session();
     $Class = GetValue('class', $Options, '');
     switch ($Path) {
         case 'dashboard':
             $Path = 'dashboard/settings';
             TouchValue('Permissions', $Options, 'Garden.Settings.Manage');
             if (!$Text) {
                 $Text = T('Dashboard');
             }
             break;
         case 'inbox':
             $Path = 'messages/inbox';
             TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
             if (!$Text) {
                 $Text = T('Inbox');
             }
             if ($Session->IsValid() && $Session->User->CountUnreadConversations) {
                 $Text .= ' <span>' . $Session->User->CountUnreadConversations . '</span>';
             }
             break;
         case 'profile':
             TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
             if (!$Text && $Session->IsValid()) {
                 $Text = $Session->User->Name;
             }
             if ($Session->IsValid() && $Session->User->CountNotifications) {
                 $Text .= ' <span>' . $Session->User->CountNotifications . '</span>';
             }
             break;
         case 'signin':
         case 'signinout':
             // The destination is the signin/signout toggle link.
             if ($Session->IsValid()) {
                 if (!$Text) {
                     $Text = T('Sign Out');
                 }
                 $Path = Gdn::Authenticator()->SignOutUrl();
                 $Class = ConcatSep(' ', $Class, 'SignOut');
             } else {
                 if (!$Text) {
                     $Text = T('Sign In');
                 }
                 $Attribs = array();
                 $Path = Gdn::Authenticator()->SignInUrl('');
                 if (SignInPopup() && strpos(Gdn::Request()->Url(), 'entry') === FALSE) {
                     $Class = ConcatSep(' ', $Class, 'SignInPopup');
                 }
             }
             break;
     }
     if (GetValue('Permissions', $Options) && !$Session->CheckPermission($Options['Permissions'])) {
         return '';
     }
     $Url = Gdn::Request()->Url($Path, GetValue('WithDomain', $Options));
     if (strcasecmp(trim($Path, '/'), Gdn::Request()->Path()) == 0) {
         $Class = ConcatSep(' ', $Class, 'Selected');
     }
     // Build the final result.
     $Result = $Format;
     $Result = str_replace('%url', $Url, $Result);
     $Result = str_replace('%text', $Text, $Result);
     $Result = str_replace('%class', $Class, $Result);
     return $Result;
 }
예제 #10
0
   public static function Link($Path, $Text = FALSE, $Format = '<a href="%url" class="%class">%text</a>', $Options = array()) {
      $Session = Gdn::Session();
      $Class = GetValue('class', $Options, '');
      $WithDomain = GetValue('WithDomain', $Options);
      $Target = GetValue('Target', $Options, '');

      switch ($Path) {
         case 'activity':
            TouchValue('Permissions', $Options, 'Garden.Activity.View');
            break;
         case 'dashboard':
            $Path = 'dashboard/settings';
            TouchValue('Permissions', $Options, 'Garden.Settings.Manage');
            if (!$Text)
               $Text = T('Dashboard');
            break;
         case 'inbox':
            $Path = 'messages/inbox';
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text)
               $Text = T('Inbox');
            if ($Session->IsValid() && $Session->User->CountUnreadConversations) {
               $Class = trim($Class.' HasCount');
               $Text .= ' <span class="Alert">'.$Session->User->CountUnreadConversations.'</span>';
            }
            break;
         case 'profile':
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text && $Session->IsValid())
               $Text = $Session->User->Name;
            if ($Session->IsValid() && $Session->User->CountNotifications) {
               $Class = trim($Class.' HasCount');
               $Text .= ' <span class="Alert">'.$Session->User->CountNotifications.'</span>';
            }
            break;
         case 'user':
            $Path = 'profile';
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text && $Session->IsValid())
               $Text = $Session->User->Name;

            break;
         case 'photo':
            $Path = 'profile';
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text && $Session->IsValid()) {
               $IsFullPath = strtolower(substr($Session->User->Photo, 0, 7)) == 'http://' || strtolower(substr($Session->User->Photo, 0, 8)) == 'https://';
               $PhotoUrl = ($IsFullPath) ? $Session->User->Photo : Gdn_Upload::Url(ChangeBasename($Session->User->Photo, 'n%s'));
               $Text = Img($PhotoUrl, array('alt' => htmlspecialchars($Session->User->Name)));
            }

            break;
         case 'drafts':
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text)
               $Text = T('My Drafts');
            if ($Session->IsValid() && $Session->User->CountDrafts) {
               $Class = trim($Class.' HasCount');
               $Text .= ' <span class="Alert">'.$Session->User->CountDrafts.'</span>';
            }
            break;
         case 'discussions/bookmarked':
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text)
               $Text = T('My Bookmarks');
            if ($Session->IsValid() && $Session->User->CountBookmarks) {
               $Class = trim($Class.' HasCount');
               $Text .= ' <span class="Count">'.$Session->User->CountBookmarks.'</span>';
            }
            break;
         case 'discussions/mine':
            TouchValue('Permissions', $Options, 'Garden.SignIn.Allow');
            if (!$Text)
               $Text = T('My Discussions');
            if ($Session->IsValid() && $Session->User->CountDiscussions) {
               $Class = trim($Class.' HasCount');
               $Text .= ' <span class="Count">'.$Session->User->CountDiscussions.'</span>';
            }
            break;
         case 'signin':
         case 'signinout':
            // The destination is the signin/signout toggle link.
            if ($Session->IsValid()) {
               if(!$Text)
                  $Text = T('Sign Out');
               $Path =  SignOutUrl($Target);
               $Class = ConcatSep(' ', $Class, 'SignOut');
            } else {
               if(!$Text)
                  $Text = T('Sign In');
               $Attribs = array();

               $Path = SignInUrl($Target);
               if (SignInPopup() && strpos(Gdn::Request()->Url(), 'entry') === FALSE)
                  $Class = ConcatSep(' ', $Class, 'SignInPopup');
            }
            break;
      }

      if (GetValue('Permissions', $Options) && !$Session->CheckPermission($Options['Permissions']))
         return '';

      $Url = Gdn::Request()->Url($Path, $WithDomain);

      if (strcasecmp(trim($Path, '/'), Gdn::Request()->Path()) == 0)
         $Class = ConcatSep(' ', $Class, 'Selected');

      // Build the final result.
      $Result = $Format;
      $Result = str_replace('%url', $Url, $Result);
      $Result = str_replace('%text', $Text, $Result);
      $Result = str_replace('%class', $Class, $Result);

      return $Result;
   }