function xoonips_admin_system_check_command(&$category) { $commands = array('pdftotext' => 'PDF', 'wvText' => 'MS-Word', 'xlhtml' => 'MS-Excel', 'ppthtml' => 'MS-PowerPoint'); foreach ($commands as $command => $filetype) { $res = new XooNIpsAdminSystemCheckResult($command); $path = system_check_find_path($command); if ($path) { $res->setResult(_XASC_STATUS_OK, $path, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, 'not found', _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('External program \'' . $command . '\' not found. It is required for \'' . $filetype . '\' file search index creation.'); $category->setError(_XASC_ERRORTYPE_COMMAND, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); } }
function xoonips_admin_system_check_mysql(&$category) { // mysql class $mysqlinfo =& xoonips_getutility('mysqlinfo'); // version $name = 'MySQL version'; $res = new XooNIpsAdminSystemCheckResult($name); $version = $mysqlinfo->getVersion('full'); $res->setResult(_XASC_STATUS_OK, $version, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); $category->registerResult($res); unset($res); if ($mysqlinfo->isVersion41orHigher()) { $keys = array('character_set_database' => true, 'character_set_client' => false, 'character_set_connection' => false, 'character_set_results' => false); foreach ($keys as $key => $is_database) { $res = new XooNIpsAdminSystemCheckResult($key); $charset = $mysqlinfo->getVariable($key); $accept_charsets = $mysqlinfo->getAcceptableCharsets($is_database, _CHARSET); if (in_array($charset, $accept_charsets)) { $res->setResult(_XASC_STATUS_OK, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable have to set ' . implode(' or ', $accept_charsets)); $category->setError(_XASC_ERRORTYPE_MYSQL, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); } } else { $key = 'character_set'; $res = new XooNIpsAdminSystemCheckResult($key); $charset = $mysqlinfo->getVariable($key); $accept_charsets = $mysqlinfo->getAcceptableCharsets(true, _CHARSET); if (in_array($charset, $accept_charsets)) { $res->setResult(_XASC_STATUS_OK, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $charset, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable have to set ' . implode(' or ', $accept_charsets)); $category->setError(_XASC_ERRORTYPE_MYSQL, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); } }
function xoonips_admin_system_check_phpext(&$category) { // mbstring $name = 'mbstring'; $res = new XooNIpsAdminSystemCheckResult($name); $ext = $name; if (extension_loaded($ext)) { $res->setResult(_XASC_STATUS_OK, '', _AM_XOONIPS_SYSTEM_CHECK_LABEL_ENABLE); $category->registerResult($res); unset($res); // -- mbstring_language $name = 'mbstring.language'; $ans[$name] = mb_language(); $res = new XooNIpsAdminSystemCheckResult(' » ' . $name); $res->setResult(_XASC_STATUS_OK, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); $category->registerResult($res); unset($res); // -- mbstring.internal_encoding $name = 'mbstring.internal_encoding'; $ans[$name] = mb_internal_encoding(); $res = new XooNIpsAdminSystemCheckResult(' » ' . $name); if ($ans[$name] == _CHARSET) { $res->setResult(_XASC_STATUS_OK, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should set \'' . _CHARSET . '\''); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- mbstring.detect_order $name = 'mbstring.detect_order'; $ans[$name] = mb_detect_order(); $res = new XooNIpsAdminSystemCheckResult(' » ' . $name); $mb_require_order = array('ASCII', _CHARSET); if (_CHARSET != 'UTF-8') { array_push($mb_require_order, 'UTF-8'); } $mb_req_success = true; foreach ($mb_require_order as $mb_req) { if (!in_array($mb_req, $ans[$name])) { $mb_req_success = false; } } $mes = implode(',', $ans[$name]); if ($mb_req_success) { $res->setResult(_XASC_STATUS_OK, $mes, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $mes, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This results must be included charset ' . implode(' and ', $mb_require_order)); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- mbstring.func_overload $name = 'mbstring.func_overload'; $ans[$name] = ini_get($name); $res = new XooNIpsAdminSystemCheckResult(' » ' . $name); if ($ans[$name] == 0) { $res->setResult(_XASC_STATUS_OK, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should set \'0\''); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- mbstring.http_input $name = 'mbstring.http_input'; $ans[$name] = ini_get($name); $res = new XooNIpsAdminSystemCheckResult(' » ' . $name); if ($ans[$name] == 'pass') { $res->setResult(_XASC_STATUS_OK, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should set \'pass\''); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- mbstring.http_output $name = 'mbstring.http_output'; $ans[$name] = ini_get($name); $res = new XooNIpsAdminSystemCheckResult(' » ' . $name); if ($ans[$name] == 'pass') { $res->setResult(_XASC_STATUS_OK, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should set \'pass\''); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- mbstring.encoding_translation $name = 'mbstring.encoding_translation'; $ans[$name] = ini_get($name); $res = new XooNIpsAdminSystemCheckResult(' » ' . $name); $res->setResult(_XASC_STATUS_OK, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); $category->registerResult($res); unset($res); // -- mbstring.substitute_character $name = 'mbstring.substitute_character'; $ans[$name] = ini_get($name); $res = new XooNIpsAdminSystemCheckResult(' » ' . $name); if ($ans[$name] == '') { $res->setResult(_XASC_STATUS_OK, '(no value)', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { if ($ans[$name] == 'none') { $res->setResult(_XASC_STATUS_OK, 'none', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $ans[$name], _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should set \'none\''); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } } $category->registerResult($res); unset($res); } else { $res->setResult(_XASC_STATUS_FAIL, '', _AM_XOONIPS_SYSTEM_CHECK_LABEL_DISABLE); $res->setMessage('\'' . $ext . '\' extension is required'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); $category->registerResult($res); unset($res); } // gd $name = 'gd'; $res = new XooNIpsAdminSystemCheckResult($name); $ext = $name; if (extension_loaded($ext)) { $gd_support_info = gd_info(); $gd_support = array('FreeType Support' => false, 'GIF Read Support' => false, 'GIF Create Support' => false, 'JPG Support' => false, 'PNG Support' => false, 'WBMP Support' => false, 'XBM Support' => false); $gd_results = true; if (isset($gd_support_info['JPEG Support'])) { $gd_support_info['JPG Support'] = $gd_support_info['JPEG Support']; } foreach (array_keys($gd_support) as $gd_key) { $gd_support[$gd_key] = $gd_support_info[$gd_key]; if ($gd_support_info[$gd_key]) { $gd_results = false; } } $res->setResult(_XASC_STATUS_OK, '', _AM_XOONIPS_SYSTEM_CHECK_LABEL_ENABLE); $category->registerResult($res); unset($res); foreach ($gd_support as $gd_key => $gd_result) { $res = new XooNIpsAdminSystemCheckResult(' » ' . $gd_key); if ($gd_result) { $res->setResult(_XASC_STATUS_OK, 'enable', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_NOTICE, 'disable', _AM_XOONIPS_SYSTEM_CHECK_LABEL_NOTICE); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_NOTICE); } $category->registerResult($res); unset($res); } } else { $res->setResult(_XASC_STATUS_FAIL, '', _AM_XOONIPS_SYSTEM_CHECK_LABEL_DISABLE); $res->setMessage('\'' . $ext . '\' extension is required'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); $category->registerResult($res); unset($res); } // zlib $name = 'zlib'; $res = new XooNIpsAdminSystemCheckResult($name); $ext = $name; if (extension_loaded($ext)) { $res->setResult(_XASC_STATUS_OK, '', _AM_XOONIPS_SYSTEM_CHECK_LABEL_ENABLE); $category->registerResult($res); unset($res); } else { $res->setResult(_XASC_STATUS_FAIL, '', _AM_XOONIPS_SYSTEM_CHECK_LABEL_DISABLE); $res->setMessage('\'' . $ext . '\' extension is required'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); $category->registerResult($res); unset($res); } // xml $name = 'xml'; $res = new XooNIpsAdminSystemCheckResult($name); $ext = $name; if (extension_loaded($ext)) { $res->setResult(_XASC_STATUS_OK, '', _AM_XOONIPS_SYSTEM_CHECK_LABEL_ENABLE); $category->registerResult($res); unset($res); } else { $res->setResult(_XASC_STATUS_FAIL, '', _AM_XOONIPS_SYSTEM_CHECK_LABEL_DISABLE); $res->setMessage('\'' . $ext . '\' extension is required'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); $category->registerResult($res); unset($res); } // fileinfo $name = 'fileinfo'; $res = new XooNIpsAdminSystemCheckResult($name); $ext = $name; if (extension_loaded($ext)) { $res->setResult(_XASC_STATUS_OK, '', _AM_XOONIPS_SYSTEM_CHECK_LABEL_ENABLE); $category->registerResult($res); unset($res); } else { $res->setResult(_XASC_STATUS_FAIL, '', _AM_XOONIPS_SYSTEM_CHECK_LABEL_DISABLE); $res->setMessage('\'' . $ext . '\' extension is required'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); $category->registerResult($res); unset($res); } }
function xoonips_admin_system_check_xoonips(&$category) { $module_handler =& xoops_gethandler('module'); $module =& $module_handler->getByDirname('xoonips'); $is_windows = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; // version $name = 'XooNIps version'; $res = new XooNIpsAdminSystemCheckResult($name); $version = sprintf('%3.2f', $module->getVar('version', 's') / 100.0); $res->setResult(_XASC_STATUS_OK, $version, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); $category->registerResult($res); unset($res); // file upload dir $keys = array('upload_dir' => 's'); $vals = xoonips_admin_get_configs($keys, 'n'); $upload_dir = $vals['upload_dir']; $name = 'File upload directory'; $res = new XooNIpsAdminSystemCheckResult($name); $ans['status'] = _XASC_STATUS_OK; $ans['label'] = $upload_dir; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK; $ans['message'] = ''; $ans['etype'] = _XASC_ERRORTYPE_XOONIPS; $ans['error'] = _XASC_STATUS_OK; if (trim($upload_dir) == '') { $ans['status'] = _XASC_STATUS_FAIL; $ans['label'] = '(no value)'; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL; $ans['message'] = 'You have to set the file upload directory'; $ans['error'] = _XASC_STATUS_FAIL; } // -- check absolute directory if ($ans['error'] == _XASC_STATUS_OK) { if ($is_windows) { // trim drive letter $upload_dir = preg_replace('/^[a-zA-Z]:/', '', $upload_dir); // use '/' file separator $upload_dir = str_replace('\\', '/', $upload_dir); } if ($upload_dir[0] != '/') { $ans['status'] = _XASC_STATUS_FAIL; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL; $ans['message'] = 'File upload directory must be absolute path'; $ans['error'] = _XASC_STATUS_FAIL; } } // -- check temporary directory if ($ans['error'] == _XASC_STATUS_OK) { if (preg_match('/^(\\/var\\/tmp|\\/tmp)(\\/.*)?$/', $upload_dir)) { $ans['status'] = _XASC_STATUS_FAIL; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL; $ans['message'] = 'File upload directory should not locate under temporary directory'; $ans['error'] = _XASC_STATUS_FAIL; } } // -- check XOOPS_ROOT_PATH if ($ans['error'] == _XASC_STATUS_OK) { $pos = strpos($upload_dir, XOOPS_ROOT_PATH); if ($pos === 0) { $ans['status'] = _XASC_STATUS_FAIL; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL; $ans['message'] = 'File upload directory should not locate under XOOPS_ROOT_PATH'; $ans['error'] = _XASC_STATUS_FAIL; } } // -- check directory if ($ans['error'] == _XASC_STATUS_OK) { if (!is_dir($upload_dir)) { $ans['status'] = _XASC_STATUS_FAIL; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL; $ans['message'] = 'File upload directory not found'; $ans['error'] = _XASC_STATUS_FAIL; } } // -- check permission if ($ans['error'] == _XASC_STATUS_OK) { if (!is_writable($upload_dir) || !is_readable($upload_dir) || !$is_windows && !is_executable($upload_dir)) { $ans['status'] = _XASC_STATUS_FAIL; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL; $ans['message'] = 'File upload directory has invalid permission'; $ans['error'] = _XASC_STATUS_FAIL; } } $res->setResult($ans['status'], $ans['label'], $ans['result']); if (!empty($ans['message'])) { $res->setMessage($ans['message']); } if ($ans['error'] != _XASC_STATUS_OK) { $category->setError($ans['etype'], $ans['error']); } $category->registerResult($res); unset($res); // magic file path $keys = array('magic_file_path' => 's'); $vals = xoonips_admin_get_configs($keys, 'n'); $magic_file_path = $vals['magic_file_path']; $name = 'Magic file path'; $res = new XooNIpsAdminSystemCheckResult($name); $ans['status'] = _XASC_STATUS_OK; $ans['label'] = $magic_file_path == '' ? '(empty)' : $magic_file_path; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK; $ans['message'] = ''; $ans['etype'] = _XASC_ERRORTYPE_XOONIPS; $ans['error'] = _XASC_STATUS_OK; if (!extension_loaded('fileinfo')) { $ans['status'] = _XASC_STATUS_FAIL; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL; $ans['message'] = 'PHP extension PECL Fileinfo not loaded'; $ans['etype'] = _XASC_ERRORTYPE_PHP; $ans['error'] = _XASC_STATUS_FAIL; } else { if ($magic_file_path == '') { $finfo = @finfo_open(FILEINFO_MIME); } else { $finfo = @finfo_open(FILEINFO_MIME, $magic_file_path); } if (!$finfo) { $ans['status'] = _XASC_STATUS_FAIL; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL; $ans['message'] = 'Invalid magic file path'; $ans['error'] = _XASC_STATUS_FAIL; } else { $val = @finfo_file($finfo, __DIR__ . '/index.html'); $val = preg_replace(array('/;.*$/', '/ +.*$/'), array('', ''), $val); if (!in_array($val, array('text/html', 'text/plain'))) { $ans['status'] = _XASC_STATUS_FAIL; $ans['result'] = _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL; $ans['message'] = 'Broken magic database'; $ans['error'] = _XASC_STATUS_FAIL; } finfo_close($finfo); } } $res->setResult($ans['status'], $ans['label'], $ans['result']); if (!empty($ans['message'])) { $res->setMessage($ans['message']); } if ($ans['error'] != _XASC_STATUS_OK) { $category->setError($ans['etype'], $ans['error']); } $category->registerResult($res); unset($res); // TODO: proxy }
function xoonips_admin_system_check_phpini(&$category) { // general settings // -- default_mimetype $name = 'default_mimetype'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); if ($ini == 'text/html') { $res->setResult(_XASC_STATUS_OK, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should set this variable to \'text/html\''); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- default_charset $name = 'default_charset'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); if (empty($ini)) { $res->setResult(_XASC_STATUS_OK, '(no value)', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { if (_CHARSET == $ini) { $res->setResult(_XASC_STATUS_OK, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_NOTICE, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_NOTICE); $res->setMessage('This variable is recommended that you comment out the \'default_charset = ' . $ini . '\' line.'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_NOTICE); } } $category->registerResult($res); unset($res); // -- register_globals $name = 'register_globals'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); $cond = inival2bool($ini); if (!$cond) { $res->setResult(_XASC_STATUS_OK, 'Off', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, 'On', _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should turn off'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- magic_quotes_gpc $name = 'magic_quotes_gpc'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); $cond = inival2bool($ini); if (!$cond) { $res->setResult(_XASC_STATUS_OK, 'Off', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, 'On', _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should turn off'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- allow_url_fopen $name = 'allow_url_fopen'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); $cond = inival2bool($ini); if (!$cond) { $res->setResult(_XASC_STATUS_OK, 'Off', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, 'On', _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should turn off'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- memory limit $name = 'memory_limit'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); $memory_limit = inival2num($ini); $unlimit['memory_limit'] = false; if ($ini == '') { // disable to limit memory $res->setResult(_XASC_STATUS_OK, '(disable memory limit)', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); $unlimit['memory_limit'] = true; } else { if ($memory_limit <= -1) { // disable to limit memory $res->setResult(_XASC_STATUS_OK, '(unlimit)', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); $unlimit['memory_limit'] = true; } else { if ($memory_limit >= inival2num('128M')) { $res->setResult(_XASC_STATUS_OK, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should be more than \'128M\''); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } } } $category->registerResult($res); unset($res); // -- post_max_size $name = 'post_max_size'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); $post_max_size = inival2num($ini); $unlimit['post_max_size'] = false; if ($unlimit['memory_limit'] || $memory_limit >= $post_max_size) { if ($ini == '') { // disable to limit memory $res->setResult(_XASC_STATUS_OK, '(disable memory limit)', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); $unlimit['post_max_size'] = true; } else { if ($post_max_size <= -1) { // unlimit memory $res->setResult(_XASC_STATUS_OK, '(unlimit)', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); $unlimit['post_max_size'] = true; } else { if ($post_max_size >= inival2num('128M')) { $res->setResult(_XASC_STATUS_OK, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_NOTICE, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_NOTICE); $res->setMessage('This variable is \'128M\' or more is recommended'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_NOTICE); } } } } else { $res->setResult(_XASC_STATUS_FAIL, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should be less than \'memory_limit\''); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // file uploads // -- file uploads $name = 'file_uploads'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); $file_uploads = inival2bool($ini); if ($file_uploads) { $res->setResult(_XASC_STATUS_OK, 'On', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, 'Off', _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should turn on'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- upload_max_filesize $name = 'upload_max_filesize'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); $upload_max_filesize = inival2num($ini); $unlimit['upload_max_filesize'] = false; if ($unlimit['post_max_size'] || $post_max_size >= $upload_max_filesize) { if ($ini == '' || $upload_max_filesize <= -1) { // unlimit memory size $res->setResult(_XASC_STATUS_OK, '(unlimit)', _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { if ($upload_max_filesize >= inival2num('128M')) { $res->setResult(_XASC_STATUS_OK, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_NOTICE, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_NOTICE); $res->setMessage('This variable is \'128M\' or more is recommended'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_NOTICE); } } } else { $res->setResult(_XASC_STATUS_FAIL, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should be less than \'post_max_size\''); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // session extension // -- session.use_trans_sid $name = 'session.use_trans_sid'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); $cond = inival2bool($ini); if (!$cond) { $res->setResult(_XASC_STATUS_OK, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should set 0 (disable)'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- session.use_cookies $name = 'session.use_cookies'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); $cond = inival2bool($ini); if ($cond) { $res->setResult(_XASC_STATUS_OK, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_FAIL, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_FAIL); $res->setMessage('This variable should set 1'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_FAIL); } $category->registerResult($res); unset($res); // -- session.use_only_cookies $name = 'session.use_only_cookies'; $res = new XooNIpsAdminSystemCheckResult($name); $key = $name; $ini = ini_get($key); $cond = inival2bool($ini); if ($cond) { $res->setResult(_XASC_STATUS_OK, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_OK); } else { $res->setResult(_XASC_STATUS_NOTICE, $ini, _AM_XOONIPS_SYSTEM_CHECK_LABEL_NOTICE); $res->setMessage('This variable should set 1'); $category->setError(_XASC_ERRORTYPE_PHP, _XASC_STATUS_NOTICE); } $category->registerResult($res); unset($res); }