Files
OMS/app/desktop/controller/pam.php
2025-12-28 23:13:25 +08:00

81 lines
2.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
class desktop_ctl_pam extends desktop_controller{
function index(){
$this->finder('desktop_mdl_pam',array(
'title'=>app::get('desktop')->_('通行证管理'),
'actions'=>array(
),
));
}
function setting($passport){
$passport_model =new $passport;
if($_POST){
$this->begin('index.php?app=desktop&ctl=pam&act=index');
if($_POST['site_passport_status'] === 'false'){
if(!$this->checkpassport($passport_model)){
$this->end(false,app::get('desktop')->_('配置失败,前台必须开启一种认证方式'));
}
}
if(!$passport_model->set_config($_POST)){
if(!$_POST['error']) $this->end(false,app::get('desktop')->_('配置失败'));
else
$this->end(false,$_POST['error']);
}
else{
$this->end(true,app::get('desktop')->_('配置成功'));
}
}
$len = strlen($html);
foreach($passport_model->get_config() as $name=>$config){
if($config['editable'] == 'false' || (isset($config['editable']) && !$config['editable'])) continue;
$input['name'] = $name;
$input['title'] = $config['label'];
$input['type'] = $config['type'];
$input['required'] = $config['required'];
if($config['options']){
$input['options'] = $config['options'];
}
if($config['value']){
$input['value'] = $config['value'];
}
$html .= $this->ui()->form_input($input);
unset($input);
}
if($len == strlen($html)){
$this->pagedata['basic'] = "true";
$this->pagedata['html'] = $html;
$this->pagedata['passport'] = $passport;
$this->page('pam.html');
}else{
$this->pagedata['html'] = $html;
$this->pagedata['passport'] = $passport;
$this->page('pam.html');
}
}
function checkpassport($model_passport){
foreach(kernel::servicelist('passport') as $k=>$passport){
if($model_passport != $passport){
$config = $passport->get_config();
if($config['site_passport_status']['value'] == 'true'){
$flag = true;
break;
}
else $flag = false;
}
}
return $flag;
}
}