本文整理汇总了PHP中General::CheckPostMasterPassword方法的典型用法代码示例。如果您正苦于以下问题:PHP General::CheckPostMasterPassword方法的具体用法?PHP General::CheckPostMasterPassword怎么用?PHP General::CheckPostMasterPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类General
的用法示例。
在下文中一共展示了General::CheckPostMasterPassword方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createNewSession
/**
* Creates a new Session-object, if password is correct
*/
static function createNewSession($password, $project_id = null)
{
if (!$project_id) {
$project_id = Config::$default_project_id;
}
// Delete old Session object from php_session cache
// and create new session_id to prevent session fixation:
self::destroySession();
$session = self::getInstance();
if ($password) {
// some password has to be entered
//Allow login via Master Password
if (Config::$allow_project_login_with_master_password && General::CheckPostMasterPassword($password)) {
$password = '';
}
try {
$session->project = new Project($project_id, $password);
} catch (PasswordException $e) {
$session->project = null;
}
} else {
$session->project = null;
}
return $session;
}
示例2: processForm
function processForm()
{
if (!$_POST['name']) {
return Messages::getString('CreateProjectPage.ProjectNameNotEmpty');
}
if (!$_POST['pwd']) {
return Messages::getString('CreateProjectPage.PasswordNotEmpty');
}
if ($_POST['pwd'] != $_POST['pwd2']) {
return Messages::getString('CreateProjectPage.PasswordsNotEqual');
}
if (!General::CheckPostMasterPassword()) {
return Messages::getString('CreateProjectPage.MasterPasswordWrong');
}
try {
$db = Database::getInstance();
$project_info = array('name' => stripslashes($_POST['name']), 'pwd' => stripslashes($_POST['pwd']), 'info' => Config::$default_project_info['info'], 'access' => Config::$default_project_info['access'], 'introduction' => Config::$default_project_info['introduction'], 'hint' => Config::$default_project_info['hint']);
if (!($this->new_project_id = $db->insertProject($project_info))) {
return sprintf("%s: %s", Messages::getString('General.dbError'), $db->lastError());
}
} catch (Exception $exception) {
// in this case, render exception as error.
return $exception;
}
return '';
}
示例3: __construct
function __construct()
{
parent::__construct();
$this->setTitle(Messages::getString('SetupPage.Title'));
$this->menu = array(Messages::getString('General.Admin') => "admin.php") + $this->menu;
$this->menu = array(Messages::getString('General.Home') => "index.php") + $this->menu;
$this->menu = array(Messages::getString('CreateProjectPage.NewProject') => "create_project.php") + $this->menu;
//Set absolute basedir
$this->BASEDIR = dirname(dirname(__FILE__));
// Check, if transmitted master password is correct
if (Config::$master_password) {
$check = General::CheckPostMasterPassword();
if ($check !== null && $check === false) {
$this->error = Messages::getString('CreateProjectPage.MasterPasswordWrong');
}
$this->master_password_correct = $check;
}
// process transmitted form
if ((!Config::$master_password || General::CheckPostMasterPassword()) && isset($_POST['setup'])) {
$this->error = $this->processForm();
if (!$this->error) {
header("Location: " . $this->SUCCESS_REDIRECT_PAGE);
//Redirect to create_project, if succeeded
}
}
}