当前位置: 首页>>代码示例>>PHP>>正文


PHP Gdn::Authenticator方法代码示例

本文整理汇总了PHP中Gdn::Authenticator方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn::Authenticator方法的具体用法?PHP Gdn::Authenticator怎么用?PHP Gdn::Authenticator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gdn的用法示例。


在下文中一共展示了Gdn::Authenticator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Base_Render_Before

 public function Base_Render_Before(&$Sender)
 {
     // Add menu items.
     $Session = Gdn::Session();
     if ($Sender->Menu) {
         $Sender->Menu->AddLink('Dashboard', 'Dashboard', '/garden/settings', array('Garden.Settings.Manage'));
         $Sender->Menu->AddLink('Dashboard', 'Users', '/user/browse', array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'));
         $Sender->Menu->AddLink('Activity', 'Activity', '/activity');
         $Authenticator = Gdn::Authenticator();
         if ($Session->IsValid()) {
             $Sender->Menu->AddLink('SignOut', 'Sign Out', '/entry/leave/{Session_TransientKey}', FALSE, array('class' => 'NonTab'));
             $Notifications = Gdn::Translate('Notifications');
             $CountNotifications = $Session->User->CountNotifications;
             if (is_numeric($CountNotifications) && $CountNotifications > 0) {
                 $Notifications .= '<span>' . $CountNotifications . '</span>';
             }
             $Sender->Menu->AddLink('User', '{Username}', '/profile/{Username}', array('Garden.SignIn.Allow'));
             $Sender->Menu->AddLink('User', '\\' . $Notifications, 'profile/notifications/{Username}');
         } else {
             $Sender->Menu->AddLink('Entry', 'Sign In', $Authenticator->SignInUrl());
         }
     }
     // Enable theme previewing
     if ($Session->IsValid()) {
         $PreviewTheme = $Session->GetPreference('PreviewTheme', '');
         if ($PreviewTheme != '') {
             $Sender->Theme = $PreviewTheme;
         }
     }
 }
开发者ID:kidmax,项目名称:Garden,代码行数:30,代码来源:hooks.php

示例2: view

 /**
  * Emulate a call to index.php?p=$vanilla_module_path
  * Much of this ripped out of Vanilla's index.php
  */
 public function view($segments)
 {
     // if a static asset, return it outright
     $asset = $this->is_static_asset($segments);
     if ($asset) {
         return \Response::make(\File::get($asset))->header('Content-Type', $this->get_content_type($asset));
     }
     // otherwise, dispatch into vanilla
     $user = $this->user;
     $bootstrap = new VanillaBootstrap();
     $bootstrap->call(function () use($user, $segments) {
         // Create the session and stuff the user in
         \Gdn::Authenticator()->SetIdentity($user->getKey(), false);
         \Gdn::Session()->Start(false, false);
         \Gdn::Session()->SetPreference('Authenticator', 'Gdn_Authenticator');
         // Create and configure the dispatcher.
         $Dispatcher = \Gdn::Dispatcher();
         $EnabledApplications = \Gdn::ApplicationManager()->EnabledApplicationFolders();
         $Dispatcher->EnabledApplicationFolders($EnabledApplications);
         $Dispatcher->PassProperty('EnabledApplications', $EnabledApplications);
         // Process the request.
         $Dispatcher->Start();
         $Dispatcher->Dispatch(implode('/', $segments));
     });
 }
开发者ID:bishopb,项目名称:laravel-forums,代码行数:29,代码来源:VanillaRunner.php

示例3: smarty_function_link

/**
 * Takes a route and prepends the web root (expects "/controller/action/params" as $Path).
 *
 * @param array The parameters passed into the function.
 * The parameters that can be passed to this function are as follows.
 * - <b>path</b>: The relative path for the url. There are some special paths that can be used to return "intelligent" links:
 *    - <b>signinout</b>: This will return a signin/signout url that will toggle depending on whether or not the user is already signed in. When this path is given the text is automaticall set.
 * - <b>withdomain</b>: Whether or not to add the domain to the url.
 * - <b>text</b>: Html text to be put inside an anchor. If this value is set then an html <a></a> is returned rather than just a url.
 * - <b>id, class, etc.></b>: When an anchor is generated then any other attributes are passed through and will be written in the resulting tag.
 * @param Smarty The smarty object rendering the template.
 * @return The url.
 */
function smarty_function_link($Params, &$Smarty)
{
    $Path = GetValue('path', $Params, '', TRUE);
    $WithDomain = GetValue('withdomain', $Params, FALSE, TRUE);
    $RemoveSyndication = GetValue('removeSyndication', $Params, FALSE, TRUE);
    $Text = GetValue('text', $Params, '', TRUE);
    $NoTag = GetValue('notag', $Params, FALSE, TRUE);
    $Class = GetValue('class', $Params, '', TRUE);
    $Session = Gdn::Session();
    $Authenticator = Gdn::Authenticator();
    // Use some logic to expan special urls.
    switch (strtolower($Path)) {
        case "signinout":
            // The destination is the signin/signout toggle link.
            if ($Session->IsValid()) {
                if (!$Text && !$NoTag) {
                    $Text = T('Sign Out');
                }
                $Path = $Authenticator->SignOutUrl();
                $Class = ConcatSep(' ', $Class, 'SignOut');
            } else {
                if (!$Text && !$NoTag) {
                    $Text = T('Sign In');
                }
                $Attribs = array();
                $Path = $Authenticator->SignInUrl('');
                if (Gdn::Config('Garden.SignIn.Popup')) {
                    $Class = ConcatSep(' ', $Class, 'SignInPopup');
                }
            }
            break;
    }
    $Url = Url($Path, $WithDomain, $RemoveSyndication);
    $Url = str_replace('{Session_TransientKey}', $Session->TransientKey(), $Url);
    if (!$Text) {
        $NoTag = TRUE;
    }
    if ($NoTag) {
        $Result = $Url;
    } else {
        $Result = '<a';
        // Add the standard attrbutes to the anchor.
        $ID = GetValue('id', $Params, '', TRUE);
        if ($ID) {
            $Result .= ' id="' . urlencode($ID) . '"';
        }
        $Result .= ' href="' . $Url . '"';
        if ($Class) {
            $Result .= ' class="' . urlencode($Class) . '"';
        }
        // Add anything that's left over.
        foreach ($Params as $Key => $Value) {
            $Result .= ' ' . $Key . '="' . urlencode($Value) . '"';
        }
        // Add the link text.
        $Result .= '>' . $Text . '</a>';
    }
    return $Result;
}
开发者ID:sipp11,项目名称:Garden,代码行数:72,代码来源:function.link.php

示例4: ActivityController_Render_Before

 public function ActivityController_Render_Before(&$Sender)
 {
     $Session = Gdn::Session();
     if (!$Session->CheckPermission('Plugins.Privacy.Activity')) {
         if (!$Session->IsValid()) {
             Redirect(Gdn::Authenticator()->SignInUrl(Gdn_Url::Request()));
         } else {
             Redirect(Gdn::Config('Routes.DefaultPermission'));
         }
     }
 }
开发者ID:grahamlyons,项目名称:VanillaPrivacy,代码行数:11,代码来源:default.php

示例5: EntryController_RegisterBasic_Create

 public function EntryController_RegisterBasic_Create($Sender)
 {
     // print_r($Values);
     // die('ok');
     Gdn::UserModel()->AddPasswordStrength($Sender);
     if ($Sender->Form->IsPostBack() === TRUE) {
         // Add validation rules that are not enforced by the model
         $Sender->UserModel->DefineSchema();
         $Sender->UserModel->Validation->ApplyRule('Name', 'Username', $Sender->UsernameError);
         $Sender->UserModel->Validation->ApplyRule('TermsOfService', 'Required', T('You must agree to the terms of service.'));
         $Sender->UserModel->Validation->ApplyRule('Password', 'Required');
         $Sender->UserModel->Validation->ApplyRule('Password', 'Strength');
         $Sender->UserModel->Validation->ApplyRule('Password', 'Match');
         // $Sender->UserModel->Validation->ApplyRule('DateOfBirth', 'MinimumAge');
         $Sender->FireEvent('RegisterValidation');
         try {
             $Values = $Sender->Form->FormValues();
             unset($Values['Roles']);
             $AuthUserID = $Sender->UserModel->Register($Values);
             if ($AuthUserID == UserModel::REDIRECT_APPROVE) {
                 $Sender->Form->SetFormValue('Target', '/entry/registerthanks');
                 $Sender->_SetRedirect();
                 return;
             } elseif (!$AuthUserID) {
                 $Sender->Form->SetValidationResults($Sender->UserModel->ValidationResults());
             } else {
                 // The user has been created successfully, so sign in now.
                 Gdn::Session()->Start($AuthUserID);
                 if ($Sender->Form->GetFormValue('RememberMe')) {
                     Gdn::Authenticator()->SetIdentity($AuthUserID, TRUE);
                 }
                 try {
                     $Sender->UserModel->SendWelcomeEmail($AuthUserID, '', 'Register');
                 } catch (Exception $Ex) {
                 }
                 $Sender->FireEvent('RegistrationSuccessful');
                 // ... and redirect them appropriately
                 $Route = $Sender->RedirectTo();
                 if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
                     $Sender->RedirectUrl = Url($Route);
                 } else {
                     if ($Route !== FALSE) {
                         Redirect($Route);
                     }
                 }
             }
         } catch (Exception $Ex) {
             $Sender->Form->AddError($Ex);
         }
     }
     $Sender->Render();
 }
开发者ID:er0k,项目名称:trickno,代码行数:52,代码来源:class.chat.plugin.php

示例6: StartAuthenticator

 public function StartAuthenticator()
 {
     // Start the 'session'
     Gdn::Session()->Start();
     // Get list of enabled authenticators
     $AuthenticationSchemes = Gdn::Config('Garden.Authenticator.EnabledSchemes', array());
     // Bring all enabled authenticator classes into the defined scope to allow them to be picked up by the plugin manager
     foreach ($AuthenticationSchemes as $AuthenticationSchemeAlias) {
         $Registered = $this->RegisterAuthenticator($AuthenticationSchemeAlias);
     }
     $this->_Started = TRUE;
     $this->WakeUpAuthenticators();
     if (Gdn::Session()->IsValid() && !Gdn::Session()->CheckPermission('Garden.SignIn.Allow')) {
         return Gdn::Authenticator()->AuthenticateWith('user')->DeAuthenticate();
     }
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:16,代码来源:class.auth.php

示例7: authenticate

 /**
  * Return the unique id assigned to the user in the database.
  *
  * This method returns 0 if the username/password combination were not found, or -1 if the user does not
  * have permission to sign in.
  *
  * @param string $Email The email address (or unique username) assigned to the user in the database.
  * @param string $Password The password assigned to the user in the database.
  * @return int The UserID of the authenticated user or 0 if one isn't found.
  */
 public function authenticate($Email = '', $Password = '')
 {
     if (!$Email || !$Password) {
         // We werent given parameters, check if they exist in our DataSource
         if ($this->currentStep() != Gdn_Authenticator::MODE_VALIDATE) {
             return Gdn_Authenticator::AUTH_INSUFFICIENT;
         }
         // Get the values from the DataSource
         $Email = $this->GetValue('Email');
         $Password = $this->GetValue('Password');
         $PersistentSession = $this->GetValue('RememberMe');
         $ClientHour = $this->GetValue('ClientHour');
     } else {
         $PersistentSession = false;
         $ClientHour = 0;
     }
     $UserID = 0;
     // Retrieve matching username/password values
     $UserModel = Gdn::Authenticator()->GetUserModel();
     $UserData = $UserModel->ValidateCredentials($Email, 0, $Password);
     if ($UserData !== false) {
         // Get ID
         $UserID = $UserData->UserID;
         // Get Sign-in permission
         $SignInPermission = $UserData->Admin ? true : false;
         if ($SignInPermission === false && !$UserData->Banned) {
             $PermissionModel = Gdn::Authenticator()->GetPermissionModel();
             foreach ($PermissionModel->GetUserPermissions($UserID) as $Permissions) {
                 $SignInPermission |= val('Garden.SignIn.Allow', $Permissions, false);
             }
         }
         // Update users Information
         $UserID = $SignInPermission ? $UserID : -1;
         if ($UserID > 0) {
             // Create the session cookie
             $this->setIdentity($UserID, $PersistentSession);
             // Update some information about the user...
             $UserModel->UpdateVisit($UserID, $ClientHour);
             Gdn::Authenticator()->Trigger(Gdn_Authenticator::AUTH_SUCCESS);
             $this->FireEvent('Authenticated');
         } else {
             Gdn::Authenticator()->Trigger(Gdn_Authenticator::AUTH_DENIED);
         }
     }
     return $UserID;
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:56,代码来源:class.passwordauthenticator.php

示例8: Configure

 public function Configure($AuthenticationSchemeAlias = NULL)
 {
     $Message = T("Please choose an authenticator to configure.");
     if (!is_null($AuthenticationSchemeAlias)) {
         $AuthenticatorInfo = Gdn::Authenticator()->GetAuthenticatorInfo($AuthenticationSchemeAlias);
         if ($AuthenticatorInfo !== FALSE) {
             $this->AuthenticatorChoice = $AuthenticationSchemeAlias;
             if (array_key_exists($AuthenticationSchemeAlias, $this->ConfigureList) && $this->ConfigureList[$AuthenticationSchemeAlias] !== FALSE) {
                 echo Gdn::Slice($this->ConfigureList[$AuthenticationSchemeAlias]);
                 return;
             } else {
                 $Message = sprintf(T("The %s Authenticator does not have any custom configuration options."), $AuthenticatorInfo['Name']);
             }
         }
     }
     $this->SetData('ConfigureMessage', $Message);
     $this->Render();
 }
开发者ID:tautomers,项目名称:knoopvszombies,代码行数:18,代码来源:class.authenticationcontroller.php

示例9: Authenticate

 /**
  * Returns the unique id assigned to the user in the database, 0 if the
  * username/password combination weren't found, or -1 if the user does not
  * have permission to sign in.
  *
  * @param string $Email The email address (or unique username) assigned to the user in the database.
  * @param string $Password The password assigned to the user in the database.
  * @param boolean $PersistentSession Should the user's session remain persistent across visits?
  * @param int $ClientHour The current hour (24 hour format) of the client.
  */
 public function Authenticate($Email = '', $Password = '')
 {
     if (!$Email || !$Password) {
         if ($this->CurrentStep() != Gdn_Authenticator::MODE_VALIDATE) {
             return Gdn_Authenticator::AUTH_INSUFFICIENT;
         }
         $Email = $this->GetValue('Email');
         $Password = $this->GetValue('Password');
         $PersistentSession = $this->GetValue('RememberMe');
         $ClientHour = $this->GetValue('ClientHour');
     } else {
         $PersistentSession = FALSE;
         $ClientHour = 0;
     }
     $UserID = 0;
     // Retrieve matching username/password values
     $UserModel = Gdn::Authenticator()->GetUserModel();
     $UserData = $UserModel->ValidateCredentials($Email, 0, $Password);
     if ($UserData !== FALSE) {
         // Get ID
         $UserID = $UserData->UserID;
         // Get Sign-in permission
         $SignInPermission = $UserData->Admin == '1' ? TRUE : FALSE;
         if ($SignInPermission === FALSE) {
             $PermissionModel = Gdn::Authenticator()->GetPermissionModel();
             foreach ($PermissionModel->GetUserPermissions($UserID) as $Permissions) {
                 $SignInPermission |= ArrayValue('Garden.SignIn.Allow', $Permissions, FALSE);
             }
         }
         // Update users Information
         $UserID = $SignInPermission ? $UserID : -1;
         if ($UserID > 0) {
             // Create the session cookie
             $this->SetIdentity($UserID, $PersistentSession);
             // Update some information about the user...
             $UserModel->UpdateLastVisit($UserID, $UserData->Attributes, $ClientHour);
             $this->FireEvent('Authenticated');
         }
     }
     return $UserID;
 }
开发者ID:sipp11,项目名称:Garden,代码行数:51,代码来源:class.passwordauthenticator.php

示例10: Base_Render_Before

 public function Base_Render_Before(&$Sender)
 {
     // Add menu items.
     $Session = Gdn::Session();
     if ($Sender->Menu) {
         $Sender->Menu->AddLink('Dashboard', 'Dashboard', '/garden/settings', array('Garden.Settings.Manage'));
         $Sender->Menu->AddLink('Dashboard', 'Users', '/user/browse', array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'));
         $Sender->Menu->AddLink('Activity', 'Activity', '/activity');
         $Authenticator = Gdn::Authenticator();
         if ($Session->IsValid()) {
             $Sender->Menu->AddLink('SignOut', 'Sign Out', '/entry/leave/{Session_TransientKey}', FALSE, array('class' => 'NonTab'));
             $Notifications = Gdn::Translate('Notifications');
             $CountNotifications = $Session->User->CountNotifications;
             if (is_numeric($CountNotifications) && $CountNotifications > 0) {
                 $Notifications .= '<span>' . $CountNotifications . '</span>';
             }
             $Sender->Menu->AddLink('User', '{Username}', '/profile/{Username}', array('Garden.SignIn.Allow'));
             $Sender->Menu->AddLink('User', '\\' . $Notifications, 'profile/notifications/{Username}');
         } else {
             $Sender->Menu->AddLink('Entry', 'Sign In', $Authenticator->SignInUrl());
         }
     }
     // Enable theme previewing
     if ($Session->IsValid()) {
         $PreviewTheme = $Session->GetPreference('PreviewTheme', '');
         if ($PreviewTheme != '') {
             $Sender->Theme = $PreviewTheme;
         }
     }
     // Add Message Modules (if necessary)
     $MessageCache = Gdn::Config('Garden.Messages.Cache', array());
     $Location = $Sender->Application . '/' . substr($Sender->ControllerName, 0, -10) . '/' . $Sender->RequestMethod;
     if (in_array('Base', $MessageCache) || InArrayI($Location, $MessageCache)) {
         $MessageModel = new Gdn_MessageModel();
         $MessageData = $MessageModel->GetMessagesForLocation($Location);
         foreach ($MessageData as $Message) {
             $MessageModule = new Gdn_MessageModule($Sender, $Message);
             $Sender->AddModule($MessageModule);
         }
     }
 }
开发者ID:Valooo,项目名称:Garden,代码行数:41,代码来源:hooks.php

示例11: Pagename

 public static function Pagename()
 {
     $Application = Gdn::Dispatcher()->Application();
     $Controller = Gdn::Dispatcher()->Controller();
     switch ($Controller) {
         case 'discussions':
         case 'discussion':
         case 'post':
             return 'discussions';
         case 'inbox':
             return 'inbox';
         case 'activity':
             return 'activity';
         case 'profile':
             $Args = Gdn::Dispatcher()->ControllerArguments();
             if (!sizeof($Args) || sizeof($Args) && $Args[0] == Gdn::Authenticator()->GetIdentity()) {
                 return 'profile';
             }
             break;
     }
     return 'unknown';
 }
开发者ID:sipp11,项目名称:Garden,代码行数:22,代码来源:class.theme.php

示例12: Wrap

      echo Wrap($this->Form->TextBox('Body', array('MultiLine' => TRUE)), 'div', array('class' => 'TextBoxWrapper'));
      echo "<div class=\"Buttons\">\n";
      if ($Session->IsValid()) {
         $AuthenticationUrl = Gdn::Authenticator()->SignOutUrl(Gdn::Request()->PathAndQuery());
         echo Wrap(
            sprintf(
               T('Commenting as %1$s (%2$s)'),
               Gdn_Format::Text($Session->User->Name),
               Anchor(T('Sign Out'), $AuthenticationUrl, 'SignOut')
            ),
            'div',
            array('class' => 'Author')
         );
         echo $this->Form->Button('Post Comment', array('class' => 'Button CommentButton'));
      } else {
         $AuthenticationUrl = Gdn::Authenticator()->SignInUrl(Gdn::Request()->PathAndQuery());
         echo Anchor(T('Comment As ...'), $AuthenticationUrl, 'SignInPopup Button Stash');
      }
      echo "</div>\n";
      echo $this->Form->Close();
      ?>
   </div>
<?php } ?>
<ul class="MessageList Discussion">
   <?php
   $this->FireEvent('BeforeCommentsRender');
   $CurrentOffset = $this->Offset;
   $CommentData = $this->CommentData->Result();
   foreach ($CommentData as $Comment) {
      ++$CurrentOffset;
      $this->CurrentComment = $Comment;
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:31,代码来源:embed.php

示例13: Index


//.........这里部分代码省略.........
                     $RoleData = $Database->Query("select * from " . $DestPrefix . "Role where Name = " . $PDO->quote($OldRole->Name));
                     if ($RoleData->NumRows() == 0) {
                         $Role = array();
                         $Role['ImportID'] = $OldRole->RoleID;
                         $Role['Name'] = $OldRole->Name;
                         $Role['Description'] = $OldRole->Description;
                         $RoleModel->Save($Role);
                     } else {
                         $Database->Query("update " . $DestPrefix . "Role set ImportID = '" . $OldRole->RoleID . "' where RoleID = " . $RoleData->FirstRow()->RoleID);
                     }
                 }
                 $this->Message = T('<strong>3/19</strong> Importing users.');
                 $this->RedirectUrl = Url('/upgrade/3');
             } else {
                 if ($Step == 3) {
                     // 3. Import users
                     // Grab the current admin user.
                     $AdminUser = $SQL->GetWhere('User', array('Admin' => 1))->FirstRow('', DATASET_TYPE_ARRAY);
                     // Delete the users.
                     $SQL->Delete('User', array('UserID <>' => 0));
                     // where kludge
                     $Database->Query("insert into " . $DestPrefix . "User\n         (UserID, Name, Password, Email, ShowEmail,    Gender, CountVisits, CountInvitations, InviteUserID, DiscoveryText, Preferences, Permissions, Attributes, DateSetInvitations, DateOfBirth, DateFirstVisit, DateLastActive, DateInserted,   DateUpdated,    HourOffset, About, CountNotifications, CountUnreadConversations, CountDiscussions, CountUnreadDiscussions, CountComments, CountDrafts, CountBookmarks) select\n          UserID, Name, Password, Email, UtilizeEmail, 'm',    CountVisit,  0,                null,         Discovery,     null,        null,        null,       null,               null,        DateFirstVisit, DateLastActive, DateFirstVisit, DateLastActive, 0,          null,  0,                  0,                        CountDiscussions, 0,                      CountComments, 0,           0\n         from " . $SourcePrefix . "User");
                     // Check to see if there is an existing user in the database that should now be root.
                     $User = $SQL->GetWhere('User', array('Name' => $AdminUser['Name']))->FirstRow('', DATASET_TYPE_ARRAY);
                     if (is_array($User)) {
                         $NewUserID = $User['UserID'];
                         $SQL->Put('User', array('Password' => $AdminUser['Password'], 'Admin' => 1), array('UserID' => $User['UserID']));
                     } else {
                         unset($AdminUser['UserID']);
                         $NewUserID = $SQL->Insert('User', $AdminUser);
                     }
                     Gdn::Session()->UserID = $NewUserID;
                     Gdn::Session()->User->UserID = $NewUserID;
                     Gdn::Authenticator()->SetIdentity($NewUserID);
                     $this->Message = T('<strong>4/19</strong> Importing role histories.');
                     $this->RedirectUrl = Url('/upgrade/4');
                 } else {
                     if ($Step == 4) {
                         // 4. Import user role relationships
                         $SQL->Delete('UserRole', array('UserID <>' => 0));
                         $Database->Query("insert into " . $DestPrefix . "UserRole\n         (UserID, RoleID)\n         select u.UserID, r.RoleID\n         from " . $SourcePrefix . "User u\n         inner join " . $DestPrefix . "Role r\n            on u.RoleID = r.ImportID");
                         $this->Message = T('<strong>5/19</strong> Importing user/role relationships.');
                         $this->RedirectUrl = Url('/upgrade/5');
                     } else {
                         if ($Step == 5) {
                             // 5. Import user role history into activity table
                             $Database->Query("insert into " . $DestPrefix . "Activity\n         (ActivityTypeID, ActivityUserID, RegardingUserID, Story, InsertUserID, DateInserted)\n         select 8, rh.AdminUserID, rh.UserID, concat('Assigned to ', r.Name, ' Role <blockquote>', rh.Notes, '</blockquote>'), rh.AdminUserID, rh.Date\n         from " . $SourcePrefix . "UserRoleHistory rh\n         inner join " . $DestPrefix . "Role r\n            on rh.RoleID = r.ImportID\n         order by rh.Date asc");
                             $this->Message = T('<strong>6/19</strong> Preparing whispers.');
                             $this->RedirectUrl = Url('/upgrade/6');
                         } else {
                             if ($Step == 6) {
                                 // 6. Update the WhisperUserID on all comments that are within whispered discussions
                                 $Database->Query("update " . $SourcePrefix . "Comment c\n         join " . $SourcePrefix . "Discussion d\n           on c.DiscussionID = d.DiscussionID\n         set c.WhisperUserID = d.WhisperUserID\n         where d.WhisperUserID > 0\n           and c.AuthUserID <> d.WhisperUserID");
                                 $Database->Query("update " . $SourcePrefix . "Comment c\n         join " . $SourcePrefix . "Discussion d\n           on c.DiscussionID = d.DiscussionID\n         set c.WhisperUserID = d.AuthUserID\n         where d.WhisperUserID > 0\n           and c.AuthUserID <> d.AuthUserID");
                                 $this->Message = T('<strong>7/19</strong> Creating conversations.');
                                 $this->RedirectUrl = Url('/upgrade/7');
                             } else {
                                 if ($Step == 7) {
                                     // 7. Create conversations
                                     $Database->Query("insert into " . $DestPrefix . "Conversation\n         (InsertUserID, DateInserted, UpdateUserID, DateUpdated, Contributors)\n         select AuthUserID, now(), WhisperUserID, now(), ''\n         from " . $SourcePrefix . "Comment\n         where WhisperUserID > 0\n         group by AuthUserID, WhisperUserID");
                                     // 7b. Remove duplicate combinations
                                     $Database->Query("delete " . $DestPrefix . "Conversation c\n         from " . $DestPrefix . "Conversation c\n         join " . $DestPrefix . "Conversation c2\n           on c.InsertUserID = c2.UpdateUserID\n           and c.UpdateUserID = c2.InsertUserID\n         where c.ConversationID > c2.ConversationID");
                                     $this->Message = T('<strong>8/19</strong> Preparing conversations messages.');
                                     $this->RedirectUrl = Url('/upgrade/8');
                                 } else {
                                     if ($Step == 8) {
开发者ID:nbudin,项目名称:Garden,代码行数:67,代码来源:upgrade.php

示例14: Leave

 public function Leave($AuthenticationSchemeAlias = 'default', $TransientKey = '')
 {
     try {
         $Authenticator = Gdn::Authenticator()->AuthenticateWith($AuthenticationSchemeAlias);
     } catch (Exception $e) {
         $Authenticator = Gdn::Authenticator()->AuthenticateWith('default');
     }
     // Only sign the user out if this is an authenticated postback!
     $Session = Gdn::Session();
     $this->Leaving = FALSE;
     $Result = Gdn_Authenticator::REACT_RENDER;
     $AuthenticatedPostbackRequired = $Authenticator->RequireLogoutTransientKey();
     if (!$AuthenticatedPostbackRequired || $Session->ValidateTransientKey($TransientKey)) {
         $Result = $Authenticator->DeAuthenticate();
         $this->Leaving = TRUE;
     }
     if ($Result == Gdn_Authenticator::AUTH_SUCCESS) {
         $this->View = 'auth/' . $Authenticator->GetAuthenticationSchemeAlias();
         if ($Target = GetIncomingValue('Target', '')) {
             $Reaction = $Target;
         } else {
             $Reaction = $Authenticator->SuccessResponse();
         }
     } else {
         $Reaction = $Authenticator->LoginResponse();
     }
     if (is_string($Reaction)) {
         $Route = $Reaction;
         if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
             $this->RedirectUrl = Url($Route);
         } else {
             if ($Route !== FALSE) {
                 Redirect($Route);
             } else {
                 Redirect(Gdn::Router()->GetDestination('DefaultController'));
             }
         }
     } else {
         switch ($Reaction) {
             case Gdn_Authenticator::REACT_RENDER:
                 break;
             case Gdn_Authenticator::REACT_EXIT:
                 exit;
                 break;
             case Gdn_Authenticator::REACT_REMOTE:
                 // Render the view, but set the delivery type to VIEW
                 $this->_DeliveryType = DELIVERY_TYPE_VIEW;
                 break;
             case Gdn_Authenticator::REACT_REDIRECT:
             default:
                 $Route = '/entry';
                 if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
                     $this->RedirectUrl = Url($Route);
                 } else {
                     if ($Route !== FALSE) {
                         Redirect($Route);
                     } else {
                         Redirect(Gdn::Router()->GetDestination('DefaultController'));
                     }
                 }
                 break;
         }
     }
     $this->Render();
 }
开发者ID:TiGR,项目名称:Garden,代码行数:65,代码来源:class.entrycontroller.php

示例15: SetIdentity

 public function SetIdentity($UserID, $Persist = TRUE)
 {
     $AuthenticationSchemeAlias = $this->GetAuthenticationSchemeAlias();
     Gdn::Authenticator()->SetIdentity($UserID, $Persist);
     Gdn::Session()->Start();
     if ($UserID > 0) {
         Gdn::Session()->SetPreference('Authenticator', $AuthenticationSchemeAlias);
     } else {
         Gdn::Session()->SetPreference('Authenticator', '');
     }
 }
开发者ID:nickhx,项目名称:Garden,代码行数:11,代码来源:class.authenticator.php


注:本文中的Gdn::Authenticator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。