/* 初始化ACT */ $_REQUEST['act'] = $_DBD['acts'][$step - 1]; /* ------------------------------------------------------ */ // - 环境检查 /* ------------------------------------------------------ */ if ($_REQUEST['act'] == 'envcheck') { /* 错误标识 */ $tpl['error'] = 0; /* ------------------------------------------------------ */ // - 目录权限检查 /* ------------------------------------------------------ */ $tpl['files'][] = array('type' => 'dir', 'file' => $_CFG['DIR_ADMIN_PFILE'], 'url' => $_CFG['URL_ADMIN_PFILE']); $tpl['files'][] = array('type' => 'file', 'file' => $_CFG['DIR_SYSTEMCONFIG'], 'url' => $_CFG['URL_SYSTEMCONFIG']); foreach ($tpl['files'] as $i => $r) { /* 文件权限检测 */ $filepriv = file_privilege($r['file']); /* 文件不存在 */ if ($filepriv == 0) { $tpl['files'][$i]['need'] = $_DBD['fileexist'][1]; $tpl['files'][$i]['error'] = isset($_POST['submit']) ? 1 : 0; $tpl['files'][$i]['filepriv'] = $_DBD['fileexist'][0]; } elseif ($r['file'] == $_CFG['DIR_SYSTEMCONFIG'] && file_systemconfig_valid() === false) { $tpl['files'][$i]['need'] = $_DBD['filevalid'][1]; $tpl['files'][$i]['error'] = isset($_POST['submit']) ? 1 : 0; $tpl['files'][$i]['filepriv'] = $_DBD['filevalid'][0]; } else { /* 目录权限检查 */ if ($r['type'] == 'dir') { $tpl['files'][$i]['need'] = $_DBD['filewrite'][1]; $tpl['files'][$i]['error'] = isset($_POST['submit']) ? 1 * (($filepriv & 2) == 0) : 0; $tpl['files'][$i]['filepriv'] = $_DBD['filewrite'][(($filepriv & 2) == 2) * 1];
/** * 插件配置检查 * * @return arr 错误信息 */ function valid_plugin($plugin) { global $_CFG, $_LANG; /* 初始化 */ $errors = array(); /* 插件安装配置检查 */ if (!is_array($plugin['install'])) { /* 安装配置变量有效性检查 */ $errors[] = $_LANG['fail_plugin_config_unfind']; } else { /* 安装配置文件有效性检查 */ foreach ($plugin['install'] as $i => $install) { /* 构建插件文件(安装源)的绝对路径 */ $install['src_fpath'] = $_CFG['DIR_PLUGIN'] . $plugin['folder'] . $install['src']; /* 无效的插件文件 */ if (!is_file($install['src_fpath'])) { $errors[] = $_LANG['fail_plugin_pfile_unfind'] . ' ' . $install['src_fpath']; } elseif (file_get_contents($install['src_fpath']) === false) { $errors[] = $_LANG['fail_plugin_pfile_unwrite'] . ' ' . $install['src_fpath']; } /* 无效的安装文件 */ if (!in_array($install['fpath'], $_CFG['TMP_INSTALL_FILES'])) { $errors[] = $_LANG['fail_plugin_ifile_unallow'] . ' ' . $install['fpath']; } elseif (!is_file($install['fpath'])) { $errors[] = $_LANG['fail_plugin_ifile_unfind'] . ' ' . $install['fpath']; } elseif ((file_privilege($install['fpath']) & 7) != 7) { $errors[] = $_LANG['fail_plugin_ifile_unwrite'] . ' ' . $install['fpath']; } } } return array_unique($errors); }
// +---------------------------------------------------------------------- // | LengdoFrame - 系统信息模块 // +---------------------------------------------------------------------- // | Copyright (c) 2009 http://lengdo.com All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: Yangfan Dai <*****@*****.**> // +---------------------------------------------------------------------- // $Id$ /* ------------------------------------------------------ */ // - 文件加载 /* ------------------------------------------------------ */ require '../../includes/init.php'; /* 权限检查 */ if (admin_id() != 1) { sys_msg($_LANG['lawless_act']); } /* 运行环境 */ $tpl['env']['php'] = phpversion(); $tpl['env']['mysql'] = $db->version(); $tpl['env']['kernel'] = $_LANG['sys_kernel']; /* 目录权限 */ $tpl['dir']['path_sql'] = '<span style="color:#333">' . $_CFG['URL_ADMIN_DUMPSQL'] . '</span>'; $tpl['dir']['path_dbc'] = '<span style="color:#333">' . $_CFG['URL_ADMIN_CACHESQL'] . '</span>'; $tpl['dir']['path_pfile'] = '<span style="color:#333">' . $_CFG['URL_ADMIN_PFILE'] . '</span>'; $tpl['dir']['priv_sql'] = file_privilege($_CFG['DIR_ADMIN_DUMPSQL']) >= 3 ? '<span class="yes"></span>' : '<span class="no"></span>'; $tpl['dir']['priv_dbc'] = file_privilege($_CFG['DIR_ADMIN_CACHESQL']) >= 3 ? '<span class="yes"></span>' : '<span class="no"></span>'; $tpl['dir']['priv_pfile'] = file_privilege($_CFG['DIR_ADMIN_PFILE']) >= 3 ? '<span class="yes"></span>' : '<span class="no"></span>'; /* 加载视图 */ include $_CFG['DIR_ADMIN_TPL'] . 'sysinfo.html';
/** * 备份文件夹权限检查 */ function valid_dbbackup_folder() { global $_LANG, $_CFG; $mask = file_privilege($_CFG['DIR_ADMIN_DUMPSQL']); if ($mask === false) { $msg = $_LANG['fail_dbbackup_fdno'] . '<br />' . $_CFG['DIR_ADMIN_DUMPSQL']; } elseif ($mask < 7) { $msg = $_LANG['fail_dbbackup_fdpriv']; if (($mask & 1) < 1) { $tpl['error'] .= $_LANG['file_unread'] . ', '; } if (($mask & 2) < 1) { $tpl['error'] .= $_LANG['file_unwrite'] . ', '; } if (($mask & 4) < 1) { $tpl['error'] .= $_LANG['file_unedit'] . '.'; } $msg .= '<br />' . $_CFG['DIR_ADMIN_DUMPSQL']; } /* 显示消息 */ if ($msg) { sys_msg($msg); } }