PageRenderTime 43ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/01.Source/01.CORE/install/ini.php

http://creative-portal.googlecode.com/
PHP | 90 lines | 72 code | 10 blank | 8 comment | 20 complexity | 2f371ec2c807544e70ff58757ec0219a MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * @Project NUKEVIET 3.0
  4. * @Author VINADES.,JSC (contact@vinades.vn)
  5. * @copyright 2009
  6. * @createdate 12/28/2009 20:8
  7. */
  8. if ( ! defined( 'NV_MAINFILE' ) ) die( 'Stop!!!' );
  9. if ( headers_sent() || connection_status() != 0 || connection_aborted() )
  10. {
  11. trigger_error( "Warning: Headers already sent", E_USER_WARNING );
  12. }
  13. if ( $sys_info['ini_set_support'] )
  14. {
  15. ini_set( 'magic_quotes_runtime', 'Off' );
  16. ini_set( 'magic_quotes_sybase', 'Off' );
  17. ini_set( 'session.save_handler', 'files' );
  18. ini_set( 'session.use_trans_sid', 0 );
  19. ini_set( 'session.auto_start', 0 );
  20. ini_set( 'session.use_cookies', 1 );
  21. ini_set( 'session.use_only_cookies', 1 );
  22. ini_set( 'session.cookie_httponly', 1 );
  23. ini_set( 'session.gc_probability', 1 ); //Kha nang chay Garbage Collection - trinh xoa session da het han truoc khi bat dau session_start();
  24. ini_set( 'session.gc_divisor', 1000 ); //gc_probability / gc_divisor = phan tram (phan nghin) kha nang chay Garbage Collection
  25. ini_set( 'session.gc_maxlifetime', 3600 ); //thoi gian sau khi het han phien lam viec de Garbage Collection tien hanh xoa, 60 phut
  26. ini_set( 'allow_url_fopen', 1 );
  27. ini_set( "user_agent", 'NV3' );
  28. ini_set( "default_charset", $global_config['site_charset'] );
  29. $memoryLimitMB = ( integer )ini_get( 'memory_limit' );
  30. if ( $memoryLimitMB < 64 )
  31. {
  32. ini_set( "memory_limit", "64M" );
  33. }
  34. ini_set( 'arg_separator.output', '&' );
  35. ini_set( 'auto_detect_line_endings', 0 );
  36. }
  37. $sys_info['safe_mode'] = ( ini_get( 'safe_mode' ) == '1' || strtolower( ini_get( 'safe_mode' ) ) == 'on' ) ? 1 : 0;
  38. $sys_info['php_support'] = ( function_exists( 'version_compare' ) and version_compare( phpversion(), '5.0.0', '>=' ) ) ? 1 : 0;
  39. $sys_info['mysql_support'] = ( extension_loaded( 'mysql' ) and function_exists( 'mysql_connect' ) ) ? 1 : 0;
  40. $sys_info['opendir_support'] = ( function_exists( 'opendir' ) and ! in_array( 'opendir', $sys_info['disable_functions'] ) ) ? 1 : 0;
  41. $sys_info['gd_support'] = ( extension_loaded( 'gd' ) ) ? 1 : 0;
  42. $sys_info['fileuploads_support'] = ( ini_get( 'file_uploads' ) ) ? 1 : 0;
  43. $sys_info['zlib_support'] = ( extension_loaded( 'zlib' ) ) ? 1 : 0;
  44. $sys_info['session_support'] = ( extension_loaded( 'session' ) ) ? 1 : 0;
  45. $sys_info['mb_support'] = ( extension_loaded( 'mbstring' ) ) ? 1 : 0;
  46. $sys_info['iconv_support'] = ( extension_loaded( 'iconv' ) ) ? 1 : 0;
  47. $sys_info['curl_support'] = ( extension_loaded( 'curl' ) and function_exists( "curl_init" ) and ! in_array( 'curl_init', $sys_info['disable_functions'] ) ) ? 1 : 0;
  48. $sys_info['allowed_set_time_limit'] = ( ! $sys_info['safe_mode'] and function_exists( "set_time_limit" ) and ! in_array( 'set_time_limit', $sys_info['disable_functions'] ) ) ? 1 : 0;
  49. $os = strtoupper( ( php_uname( 's' ) != '' ) ? php_uname( 's' ) : PHP_OS );
  50. if ( $os == "LINUX" )
  51. {
  52. $sys_info['ftp_support'] = ( function_exists( "ftp_connect" ) and ! in_array( 'ftp_connect', $sys_info['disable_functions'] ) and function_exists( "ftp_chmod" ) and ! in_array( 'ftp_chmod', $sys_info['disable_functions'] ) and function_exists( "ftp_mkdir" ) and ! in_array( 'ftp_mkdir', $sys_info['disable_functions'] ) and function_exists( "ftp_chdir" ) and ! in_array( 'ftp_chdir', $sys_info['disable_functions'] ) and function_exists( "ftp_nlist" ) and ! in_array( 'ftp_nlist', $sys_info['disable_functions'] ) ) ? 1 : 0;
  53. }
  54. else{
  55. $sys_info['ftp_support'] = 0;
  56. }
  57. //Xac dinh tien ich mo rong lam viec voi string
  58. $sys_info['string_handler'] = $sys_info['mb_support'] ? 'mb' : ( $sys_info['iconv_support'] ? 'iconv' : 'php' );
  59. //Kiem tra ho tro rewrite
  60. $sys_info['supports_rewrite'] = false;
  61. if ( function_exists( 'apache_get_modules' ) )
  62. {
  63. $apache_modules = apache_get_modules();
  64. if ( in_array( "mod_rewrite", $apache_modules ) )
  65. {
  66. $sys_info['supports_rewrite'] = "rewrite_mode_apache";
  67. }
  68. }
  69. elseif ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7.' ) !== false )
  70. {
  71. if ( isset( $_SERVER['IIS_UrlRewriteModule'] ) && ( php_sapi_name() == 'cgi-fcgi' ) && class_exists( 'DOMDocument' ) )
  72. {
  73. $sys_info['supports_rewrite'] = "rewrite_mode_iis";
  74. }
  75. }
  76. elseif ( $os == "LINUX" )
  77. {
  78. $sys_info['supports_rewrite'] = "rewrite_mode_apache";
  79. }
  80. ?>