Server : nginx/1.22.1
System : Linux iZwz9daxib3w3i063fw434Z 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User : www ( 1000)
PHP Version : 7.2.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Directory :  /www/wwwroot/www.jkmold.com/phpcms/modules/admin/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/www.jkmold.com/phpcms/modules/admin/setting.php
<?php

defined('IN_PHPCMS') or exit('No permission resources.');

pc_base::load_app_class('admin','admin',0);

class setting extends admin {

	private $db;

	function __construct() {

		parent::__construct();

		$this->db = pc_base::load_model('module_model');

		pc_base::load_app_func('global');

	}

	

	/**

	 * 配置信息

	 */

	public function init() {

		$show_validator = true;

		$setconfig = pc_base::load_config('system');	

		extract($setconfig);

		if(!function_exists('ob_gzhandler')) $gzip = 0;

		$info = $this->db->get_one(array('module'=>'admin'));

		extract(string2array($info['setting']));

		$show_header = true;

		$show_validator = 1;

		

		include $this->admin_tpl('setting');

	}

	

	/**

	 * 保存配置信息

	 */

	public function save() {

		

		$setting = array();

		$setting['admin_email'] = is_email($_POST['setting']['admin_email']) ? trim($_POST['setting']['admin_email']) : showmessage(L('email_illegal'),HTTP_REFERER);

		$setting['maxloginfailedtimes'] = intval($_POST['setting']['maxloginfailedtimes']);

		$setting['minrefreshtime'] = intval($_POST['setting']['minrefreshtime']);

		$setting['mail_type'] = intval($_POST['setting']['mail_type']);		

		$setting['mail_server'] = trim($_POST['setting']['mail_server']);	

		$setting['mail_port'] = intval($_POST['setting']['mail_port']);	

		$setting['category_ajax'] = intval(abs($_POST['setting']['category_ajax']));	

		$setting['mail_user'] = trim($_POST['setting']['mail_user']);

		$setting['mail_auth'] = intval($_POST['setting']['mail_auth']);		

		$setting['mail_from'] = trim($_POST['setting']['mail_from']);		

		$setting['mail_password'] = trim($_POST['setting']['mail_password']);

		$setting['errorlog_size'] = trim($_POST['setting']['errorlog_size']);

		$setting = array2string($setting);

		$this->db->update(array('setting'=>$setting), array('module'=>'admin')); //存入admin模块setting字段

		

		//如果开始盛大通行证接入,判断服务器是否支持curl

		$snda_error = '';

		if($_POST['setconfig']['snda_akey'] || $_POST['setconfig']['snda_skey']) {

			if(function_exists('curl_init') == FALSE) {

				$snda_error = L('snda_need_curl_init');

				$_POST['setconfig']['snda_enable'] = 0;

			}

		}

		$cfg['host']=$setting['mail_server'] ;

			$cfg['port']=$setting['mail_port'];

			$cfg['username']=$setting['mail_user'];

			$cfg['password']=$setting['mail_password'];



		file_put_contents('./caches/configs/email.php',$setting);

		set_config($_POST['setconfig']);	 //保存进config文件

		$this->setcache();

		showmessage(L('setting_succ').$snda_error, HTTP_REFERER);

	}

	

	/*

	 * 测试邮件配置

	 */

	 	public function public_test_mail() {

			//pc_base::load_sys_func('mail');

			

			$toemail=$_GET['mail_to'];

			$subject = 'yiran test mail';

			$message = 'this is a test mail from yiran team';

		

			$cfg['host']=$_POST['mail_server'];

			$cfg['port']=intval($_POST['mail_port']);

			$cfg['username']=$_POST['mail_user'];

			$cfg['password']=$_POST['mail_password'];

			$from= $_POST['mail_user'];

			

		//	file_put_contents('./caches/configs/email.php',$cfg);

			$status=yr_send_email($toemail, $subject, $message, $from,$cfg);

			

		

			if($status) {

				echo L('test_email_succ').$_GET['mail_to'];

			} else {

				echo L('test_email_faild');

			}

			

		}

	 

	public function public_test_mail1() {

		pc_base::load_sys_func('mail');

		$subject = 'phpcms test mail';

		$message = 'this is a test mail from phpcms team';

		$mail= Array (

			'mailsend' => 2,

			'maildelimiter' => 1,

			'mailusername' => 1,

			'server' => $_POST['mail_server'],

			'port' => intval($_POST['mail_port']),

			'mail_type' => intval($_POST['mail_type']),

			'auth' => intval($_POST['mail_auth']),

			'from' => $_POST['mail_from'],

			'auth_username' => $_POST['mail_user'],

			'auth_password' => $_POST['mail_password']

		);	

		

		if(sendmail($_GET['mail_to'],$subject,$message,$_POST['mail_from'],$mail)) {

			echo L('test_email_succ').$_GET['mail_to'];

		} else {

			echo L('test_email_faild');

		}	

	}

	

	/**

	 * 设置缓存

	 * Enter description here ...

	 */

	private function setcache() {

		$result = $this->db->get_one(array('module'=>'admin'));

		$setting = string2array($result['setting']);

		setcache('common', $setting,'commons');

	}

}

?>