/** * getInstanceメソッド * * このクラスのオブジェクトを生成する。 * 既に生成されていたら、前回と同じものを返す。 * * @return object $instance */ public static function getInstance() { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
/** * 媒体CHK認証処理を行う。 * * @param integer $id ユーザーID * @param string $password パスワード * @return boolean 認証成功ならtrue、失敗ならfalse */ public function baitaiAuthentication($id = null, $password = null) { // カレントユーザーが認証済みか? if (!$this->_authOBJ->hasIdentity()) { if (!$id or !$password) { return FALSE; } $passwordKey = AdmBaitai::createPasswordKey($password); $adapter = new ComAuthAdapterDbTable($this->getDbObject(), "baitai_admin", "login_id", "password"); $adapter->setIdentity($id)->setCredential($passwordKey); $select = $adapter->getDbSelect(); $select->where("disable = 0"); $select->limit(1); // 認証処理を実行 $result = $this->_authOBJ->authenticate($adapter); if (!$result->isValid()) { return FALSE; } else { // 必要な情報をセッションに登録 $this->_authOBJ->getStorage()->write($adapter->getResultRowObject(NULL, array("password", "disable"))); return TRUE; } // 認証済み } else { return TRUE; } }
* baitaiRegExec.php * * Copyright (c) 2009 Fraise, Inc. * All rights reserved. */ /** * 管理画面媒体CHKユーザー登録処理ページファイル。 * * @copyright 2009 Fraise, Inc. * @author mitsuhiro nakamura */ require_once D_BASE_DIR . "/common/admin_common.php"; $param = $requestOBJ->getParameterExcept($exceptArray); $execMsgSessOBJ = new ComSessionNamespace("exec_msg"); $returnSessOBJ = new ComSessionNamespace("return"); $AdmBaitaiOBJ = AdmBaitai::getInstance(); $insertData = null; if (!$param["disable"][0]) { $insertData["name"] = $param["name"]; $insertData["login_id"] = $param["login_id"]; $insertData["password"] = $AdmBaitaiOBJ->createPasswordKey($param["password"]); $insertData["authority_type"] = $param["authority_type"]; $insertData["update_datetime"] = date("YmdHis"); $validationOBJ = new ComArrayValidation($param); $validationOBJ->check("name", "名前", array("Value" => null), array("Value" => "名前は必須項目です")); $validationOBJ->check("login_id", "ログインID", array("Value" => null), array("Value" => "ログインIDは必須項目です")); $validationOBJ->check("password", "パスワード", array("Value" => null), array("Value" => "パスワードは必須項目です")); // ログインID重複チェック if ($AdmBaitaiOBJ->duplicateLoginId($param["login_id"], $param["id"])) { $validationOBJ->setErrorMessage("duplicate", "ログインIDが重複しています"); }