You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.9 KiB
63 lines
1.9 KiB
3 years ago
|
<?php
|
||
|
/*
|
||
|
* @Author: witersen
|
||
|
* @Date: 2022-05-03 21:06:50
|
||
|
* @LastEditors: witersen
|
||
3 years ago
|
* @LastEditTime: 2022-05-07 00:51:06
|
||
3 years ago
|
* @Description: QQ:1801168257
|
||
|
*/
|
||
|
|
||
3 years ago
|
class Check
|
||
3 years ago
|
{
|
||
3 years ago
|
private $config_reg;
|
||
3 years ago
|
|
||
3 years ago
|
function __construct($config_reg)
|
||
3 years ago
|
{
|
||
3 years ago
|
$this->config_reg = $config_reg;
|
||
3 years ago
|
}
|
||
|
|
||
|
/**
|
||
|
* 检查SVN仓库名称
|
||
|
*/
|
||
|
public function CheckRepName($repName, $message = 'SVN仓库名称只能包含字母、数字、破折号、下划线、点,不能以点开头或结尾')
|
||
|
{
|
||
3 years ago
|
if (preg_match($this->config_reg['REG_SVN_REP_NAME'], $repName) != 1) {
|
||
3 years ago
|
return ['code' => 200, 'status' => 0, 'message' => $message, 'data' => []];
|
||
|
}
|
||
|
return ['code' => 200, 'status' => 1, 'message' => '', 'data' => []];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 检查SVN用户名称
|
||
|
*/
|
||
|
public function CheckRepUser($repUserName)
|
||
|
{
|
||
3 years ago
|
if (preg_match($this->config_reg['REG_SVN_USER_NAME'], $repUserName) != 1) {
|
||
3 years ago
|
return ['code' => 200, 'status' => 0, 'message' => 'SVN用户名只能包含字母、数字、破折号、下划线、点', 'data' => []];
|
||
|
}
|
||
|
return ['code' => 200, 'status' => 1, 'message' => '', 'data' => []];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 检查SVN用户组名称
|
||
|
*/
|
||
|
public function CheckRepGroup($repGroupName)
|
||
|
{
|
||
3 years ago
|
if (preg_match($this->config_reg['REG_SVN_GROUP_NAME'], $repGroupName) != 1) {
|
||
3 years ago
|
return ['code' => 200, 'status' => 0, 'message' => 'SVN分组名只能包含字母、数字、破折号、下划线、点', 'data' => []];
|
||
|
}
|
||
|
return ['code' => 200, 'status' => 1, 'message' => '', 'data' => []];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 邮箱检查
|
||
|
*/
|
||
|
public function CheckMail($mail)
|
||
|
{
|
||
3 years ago
|
if (preg_match_all($this->config_reg['REG_MAIL'], $mail) == 1) {
|
||
3 years ago
|
return ['code' => 200, 'status' => 0, 'message' => '邮箱错误', 'data' => []];
|
||
|
}
|
||
|
return ['code' => 200, 'status' => 1, 'message' => '', 'data' => []];
|
||
|
}
|
||
|
}
|