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/dbsource/functions/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/www.jkmold.com/phpcms/modules/dbsource/functions/global.func.php
<?php 

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

/**

 * 外部数据源缓存

 */

function dbsource_cache() {

	$db = pc_base::load_model('dbsource_model');

	$list = $db->select();

	$data = array();

	if ($list) {

		foreach ($list as $val) {

			$data[$val['name']] = array('hostname'=>$val['host'].':'.$val['port'], 'database' =>$val['dbname'] , 'db_tablepre'=>$val['dbtablepre'], 'username' =>$val['username'],'password' => $val['password'],'charset'=>$val['charset'],'debug'=>0,'pconnect'=>0,'autoconnect'=>0);

		}

	} else {

		return false;

	}

	return setcache('dbsource', $data, 'commons');

}



/**

 * 获取模型PC标签配置相信

 * @param $module 模型名

 */

function pc_tag_class ($module) {

	$filepath = PC_PATH.'modules'.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.$module.'_tag.class.php';

	if (file_exists($filepath)) {

		$pc_tag = pc_base::load_app_class($module.'_tag', $module); 

		if (!method_exists($pc_tag, 'pc_tag')) {

			showmessage(L('the_module_will_not_support_the_operation'));

		}

		$html  = $pc_tag->pc_tag();

	} else {

		showmessage(L('the_module_will_not_support_the_operation'), HTTP_REFERER);

	}

	return $html;

}



/**

 * 返回模板地址。

 * @param $id 数据源调用ID

 */

function template_url($id) {

	$filepath = CACHE_PATH.'caches_template'.DIRECTORY_SEPARATOR.'dbsource'.DIRECTORY_SEPARATOR.$id.'.php';

	if (!file_exists($filepath)) {

		$datacall = pc_base::load_model('datacall_model');

		$str = $datacall->get_one(array('id'=>$id), 'template');

		$dir = dirname($filepath);

		if(!is_dir($dir)) {

			mkdir($dir, 0777, true);

	    }

	    $tpl = pc_base::load_sys_class('template_cache');

		$str = $tpl->template_parse($str['template']);

		@file_put_contents($filepath, $str);

	}

	return $filepath;

}

?>