Skip to content

Commit

Permalink
Dec: phpDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Jan 15, 2018
1 parent 98c5293 commit becba13
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions application/helpers/remotecontrol/remotecontrol_handle.php
Expand Up @@ -37,14 +37,15 @@ public function __construct(AdminController $controller)
* @access public
* @param string $username
* @param string $password
* @param string $plugin to be used
* @return string|array
*/
public function get_session_key($username, $password, $plugin = 'Authdb')
{
$username = (string) $username;
$password = (string) $password;
$loginResult = $this->_doLogin($username, $password, $plugin);
if ( $loginResult === true) {
if ($loginResult === true) {
$this->_jumpStartSession($username);
$sSessionKey = Yii::app()->securityManager->generateRandomString(32);
$sDatabasetype = Yii::app()->db->getDriverName();
Expand All @@ -55,7 +56,7 @@ public function get_session_key($username, $password, $plugin = 'Authdb')
$session->save();
return $sSessionKey;
} else {
if(is_string($loginResult)) {
if (is_string($loginResult)) {
return array('status' => $loginResult);
}
return array('status' => 'Invalid user name or password');
Expand Down Expand Up @@ -2976,21 +2977,22 @@ public function get_uploaded_files($sSessionKey, $iSurveyID, $sToken)
* @access protected
* @param string $sUsername username
* @param string $sPassword password
* @return bool
* @param string $sPlugin plugin to be used
* @return bool|string
*/
protected function _doLogin($sUsername, $sPassword,$sPlugin)
protected function _doLogin($sUsername, $sPassword, $sPlugin)
{

/* @var $identity LSUserIdentity */
$identity = new LSUserIdentity($sUsername, $sPassword);
$identity->setPlugin($sPlugin);
$event = new PluginEvent('remoteControlLogin');
$event->set('plugin',$sPlugin);
$event->set('username',$sUsername);
$event->set('password',$sPassword);
$event->set('plugin', $sPlugin);
$event->set('username', $sUsername);
$event->set('password', $sPassword);
App()->getPluginManager()->dispatchEvent($event, array($sPlugin));
if (!$identity->authenticate()) {
if($identity->errorMessage) {
if( $identity->errorMessage ) {
// Be sure to don't return an empty string
return $identity->errorMessage;
}
return false;
Expand Down Expand Up @@ -3021,7 +3023,7 @@ protected function _jumpStartSession($username)
'adminlang' => 'en'
);
foreach ($session as $k => $v) {
Yii::app()->session[$k] = $v;
Yii::app()->session[$k] = $v;
}
Yii::app()->user->setId($aUserData['uid']);

Expand All @@ -3045,7 +3047,7 @@ protected function _checkSessionKey($sSessionKey)
$oResult = Session::model()->findByPk($sSessionKey);

if (is_null($oResult)) {
return false;
return false;
} else {
$this->_jumpStartSession($oResult->data);
return true;
Expand Down

0 comments on commit becba13

Please sign in to comment.