1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* ModPreload |
4
|
|
|
* |
5
|
|
|
* ユーザ情報変更処理を実現するためのクラス |
6
|
|
|
* |
7
|
|
|
* @package risoluto |
8
|
|
|
* @author Risoluto Developers |
9
|
|
|
* @license http://opensource.org/licenses/bsd-license.php new BSD license |
10
|
|
|
* @copyright (C) 2008-2015 Risoluto Developers / All Rights Reserved. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
//------------------------------------------------------// |
14
|
|
|
// 名前空間の定義 |
15
|
|
|
//------------------------------------------------------// |
16
|
|
|
namespace RisolutoApps\Admin\UserMng; |
17
|
|
|
|
18
|
|
|
//------------------------------------------------------// |
19
|
|
|
// クラス定義 |
20
|
|
|
//------------------------------------------------------// |
21
|
|
|
class ModPreload extends \Risoluto\RisolutoControllerBase implements \Risoluto\RisolutoControllerInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* play() |
25
|
|
|
* |
26
|
|
|
* 主処理を行う |
27
|
|
|
* |
28
|
|
|
* @access public |
29
|
|
|
* |
30
|
|
|
* @param void |
31
|
|
|
* |
32
|
|
|
* @return void なし |
33
|
|
|
* @throws \Exception 必須な情報が渡されていないか情報が取得できない場合はThrow |
34
|
|
|
*/ |
35
|
|
|
public function play() |
36
|
|
|
{ |
37
|
|
|
// セッションをスタート |
38
|
|
|
$sess = new \Risoluto\Session(); |
39
|
|
|
$sess->start(); |
40
|
|
|
|
41
|
|
|
// 共通処理クラスを呼び出し |
42
|
|
|
$common = new \RisolutoApps\Admin\AdminCommon; |
43
|
|
|
/** @noinspection PhpUnusedLocalVariableInspection */ |
44
|
|
|
$detail = $common->loginCheck( $sess, true ); |
|
|
|
|
45
|
|
|
|
46
|
|
|
$param = $this->getParam(); |
47
|
|
View Code Duplication |
if (is_numeric( $param[ 0 ] )) { |
|
|
|
|
48
|
|
|
// 引数値がセットされていれば、それを元に登録情報を呼び出す |
49
|
|
|
$target = \Risoluto\Auth::callProviderMethod( 'showUserByNo', [ 'no' => $param[ 0 ] ] ); |
50
|
|
|
if (empty( $target )) { |
51
|
|
|
// 情報が取得できなかった場合も例外をThrow |
52
|
|
|
Throw new \Exception( 'Cannot load user data' ); |
53
|
|
|
} |
54
|
|
|
} else { |
55
|
|
|
// 指定されていなければ例外をThrowする |
56
|
|
|
Throw new \Exception( 'Require args not found' ); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
// 情報が取得できたら整形してセッションに保存、入力画面へ遷移する |
60
|
|
|
$getVals[ 'entered' ] = [ |
|
|
|
|
61
|
|
|
'no' => $target[ 0 ][ 'no' ], |
62
|
|
|
'userid' => $target[ 0 ][ 'userid' ], |
63
|
|
|
'username' => $target[ 0 ][ 'username' ], |
64
|
|
|
'password' => '', |
65
|
|
|
'password_confirm' => '', |
66
|
|
|
'groupno' => $target[ 0 ][ 'groupno' ], |
67
|
|
|
'status' => $target[ 0 ][ 'status' ] |
68
|
|
|
]; |
69
|
|
|
$sess->store( 'form', $getVals ); |
70
|
|
|
\Risoluto\Url::redirectTo( 'Admin_UserMng_ModEntry' ); |
71
|
|
|
exit; |
72
|
|
|
} |
73
|
|
|
} |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.