Ejemplo n.º 1
0
 public function getMessagePrefix($message)
 {
     if ($this->prefix !== null) {
         return call_user_func($this->prefix, $message);
     }
     $ip = Utility::getIp();
     $userID = LuLu::getIdentity()->username;
     if (empty($userID)) {
         return "[{$ip}]";
     } else {
         return "[{$ip}]<br/>[{$userID}]";
     }
 }
Ejemplo n.º 2
0
 private function getEnvData()
 {
     $isWritable = [['系统临时文件(data/runtime)', true, FileHelper::canWrite(LuLu::getAlias('@data/runtime')), '系统核心', '必须可读写'], ['附件上传目录(data/attachment)', false, FileHelper::canWrite(LuLu::getAlias('@data/attachment')), '附件上传', '若无附件上传可不用写权限'], ['数据备份目录(data/backup)', false, FileHelper::canWrite(LuLu::getAlias('@data/backup')), '数据库备份', '若不备份数据库可不用写权限'], ['配置文件目录(data/config)', false, FileHelper::canWrite(LuLu::getAlias('@data/attachment')), '安装程序', '若手动安装系统写可不用写权限'], ['公共资源文件(statics/assets)', true, FileHelper::canWrite(LuLu::getAlias('@statics/assets')), '系统核心', '必须可读写']];
     $requirements = array(['PHP版本', true, version_compare(PHP_VERSION, "5.4.0", ">="), '系统核心', 'PHP 5.4.0 或更高版本是必须的.'], ['$_SERVER 服务器变量', true, 'ok' === ($message = Utility::checkServerVar()), '系统核心', $message], ['Reflection 扩展模块', true, class_exists('Reflection', false), '系统核心', ''], ['PCRE 扩展模块', true, extension_loaded("pcre"), '系统核心', ''], ['SPL 扩展模块', true, extension_loaded("SPL"), '系统核心', ''], ['PDO 扩展模块', true, extension_loaded('pdo'), '所有和使用PDO数据库连接相关的类', ''], ['PDO MySQL 扩展模块', true, extension_loaded('pdo_mysql'), 'MySql数据库', '使用MySql数据库必须支持'], ['OpenSSL 扩展模块', true, extension_loaded('openssl'), 'Security', '加密和解密方法'], ['GD 扩展模块', false, 'ok' === ($message = Utility::checkCaptchaSupport()), 'CaptchaAction', $message]);
     $requireResult = 1;
     foreach ($requirements as $i => $requirement) {
         if ($requirement[1] && !$requirement[2]) {
             $requireResult = 0;
         } else {
             if ($requireResult > 0 && !$requirement[1] && !$requirement[2]) {
                 $requireResult = -1;
             }
         }
         if ($requirement[4] === '') {
             $requirements[$i][4] = '&nbsp;';
         }
     }
     $writeableResult = 1;
     foreach ($isWritable as $k => $val) {
         if ($val[1] && !$val[2]) {
             $writeableResult = 0;
         } else {
             if ($requireResult > 0 && !$val[1] && !$val[2]) {
                 $writeableResult = -1;
             }
         }
         if ($val[4] === '') {
             $isWritable[$i][4] = '&nbsp;';
         }
     }
     $data = ['isWritable' => $isWritable, 'writeableResult' => $writeableResult, 'requireResult' => $requireResult, 'requirements' => $requirements];
     return $data;
 }
Ejemplo n.º 3
0
 private function convertPermissionValue($rows)
 {
     $ret = [];
     if ($rows === null) {
         return $ret;
     }
     foreach ($rows as $row) {
         $form = intval($row['form']);
         if ($form === Permission::Form_Boolean) {
             $v = Utility::isTrue($row['value']);
         } else {
             if ($form === Permission::Form_CheckboxList) {
                 $v = explode(',', $row['value']);
             } else {
                 $v = $row['value'];
             }
         }
         $row['value'] = $v;
         $ret[$row['id']][] = $row;
     }
     return $ret;
 }