Merge branch '12.x'
This commit is contained in:
@@ -365,7 +365,8 @@ class baseHelper
|
||||
}
|
||||
|
||||
/* Check decrypted password. Judge whether there is garbled code. */
|
||||
if(json_encode($decryptedPassword) === 'null') $decryptedPassword = '';
|
||||
$jsoned = json_encode($decryptedPassword);
|
||||
if($jsoned === 'null' or empty($jsoned)) $decryptedPassword = '';
|
||||
}
|
||||
if(empty($decryptedPassword)) $decryptedPassword = $password;
|
||||
|
||||
|
||||
@@ -259,12 +259,13 @@ class baseModel
|
||||
if(!empty($moduleExtPath['site'])) $extensionFile = $moduleExtPath['site'] . 'class/' . $extensionName . '.class.php';
|
||||
if(!isset($extensionFile) or !file_exists($extensionFile)) $extensionFile = $moduleExtPath['common'] . 'class/' . $extensionName . '.class.php';
|
||||
|
||||
/* 设置扩展类的名字。Set the extension class name. */
|
||||
$extensionClass = $extensionName . ucfirst($moduleName);
|
||||
if(isset($this->$extensionClass)) return $this->$extensionClass;
|
||||
|
||||
/* 载入父类。Try to import parent model file auto and then import the extension file. */
|
||||
if(!class_exists($moduleName . 'Model')) helper::import($this->app->getModulePath($this->appName, $moduleName) . 'model.php');
|
||||
if(!helper::import($extensionFile)) return false;
|
||||
|
||||
/* 设置扩展类的名字。Set the extension class name. */
|
||||
$extensionClass = $extensionName . ucfirst($moduleName);
|
||||
if(!class_exists($extensionClass)) return false;
|
||||
|
||||
/* 实例化扩展类。Create an instance of the extension class and return it. */
|
||||
|
||||
@@ -831,6 +831,7 @@ class baseRouter
|
||||
{
|
||||
$sessionName = $this->config->sessionVar;
|
||||
session_name($sessionName);
|
||||
session_set_cookie_params(0, $this->config->webRoot);
|
||||
if($this->config->customSession) session_save_path($this->getTmpRoot() . 'session');
|
||||
session_start();
|
||||
|
||||
|
||||
@@ -302,6 +302,7 @@ class control extends baseControl
|
||||
if(!isset($this->config->bizVersion)) return false;
|
||||
if(empty($_POST)) return false;
|
||||
|
||||
$flow = $this->dao->select('*')->from(TABLE_WORKFLOW)->where('module')->eq($this->moduleName)->fetch();
|
||||
$fields = $this->loadModel('workflowaction')->getFields($this->moduleName, $this->methodName);
|
||||
$layouts = $this->loadModel('workflowlayout')->getFields($this->moduleName, $this->methodName);
|
||||
$rules = $this->dao->select('*')->from(TABLE_WORKFLOWRULE)->orderBy('id_desc')->fetchAll('id');
|
||||
@@ -330,10 +331,29 @@ class control extends baseControl
|
||||
}
|
||||
elseif($rule->type == 'system' and isset($_POST[$field->field]))
|
||||
{
|
||||
$checkFunc = 'check' . $rule->rule;
|
||||
if(validater::$checkFunc($_POST[$field->field]) === false)
|
||||
$pass = true;
|
||||
if($rule->rule == 'unique')
|
||||
{
|
||||
if(!empty($_POST[$field->field]))
|
||||
{
|
||||
$sqlClass = new sql();
|
||||
$sql = "SELECT COUNT(*) AS count FROM $flow->table WHERE `$field->field` = " . $sqlClass->quote(fixer::input('post')->get($field->field));
|
||||
if(isset($_POST['id'])) $sql .= ' AND `id` != ' . (int)$_POST['id'];
|
||||
|
||||
$row = $this->dbh->query($sql)->fetch();
|
||||
if($row->count != 0) $pass = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$checkFunc = 'check' . $rule->rule;
|
||||
if(validater::$checkFunc($_POST[$field->field]) === false) $pass = false;
|
||||
}
|
||||
|
||||
if(!$pass)
|
||||
{
|
||||
$error = zget($this->lang->error, $rule->rule, '');
|
||||
if($rule->rule == 'unique') $error = sprintf($error, $field->name, $_POST[$field->field]);
|
||||
if($error) $error = sprintf($error, $field->name);
|
||||
if(empty($error)) $error = sprintf($this->lang->error->reg, $field->name, $rule->rule);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user