InstallDatabase.php page.'; } elseif ( $errstring ) { $error[] = $errstring; } } else { // OK, we can connect to database & config table exists. $result = db_query( "SELECT * FROM staff WHERE SYEAR='" . $DefaultSyear . "'" ); if ( ! db_fetch_row( $result ) ) { $error[] = 'The value for $DefaultSyear in the config.inc.php file is incorrect.'; } else { require_once './Warehouse.php'; // OK, $DefaultSyear is correct so we can login. if ( ( isset( $_SESSION['STAFF_ID'] ) && $_SESSION['STAFF_ID'] < 1 ) || User( 'PROFILE' ) !== 'admin' ) { // @since 9.0 Restrict diagnostic access to logged in admin. $error[] = 'Please login as an administrator before accessing the diagnostic.php page.'; // Exit. echo _ErrorMessage( $error, 'fatal' ); } } } } } } if ( ! is_array( $RosarioLocales ) || empty( $RosarioLocales ) ) { $error[] = 'The value for $RosarioLocales in the config.inc.php file is not correct.'; } // Check wkhtmltopdf binary exists. if ( ! empty( $wkhtmltopdfPath ) && ( ! file_exists( $wkhtmltopdfPath ) || strpos( basename( $wkhtmltopdfPath ), 'wkhtmltopdf' ) !== 0 ) ) { $error[] = 'The value for $wkhtmltopdfPath in the config.inc.php file is not correct.'; } if ( ! empty( $pg_dumpPath ) && empty( $DatabaseDumpPath ) && $DatabaseType === 'postgresql' ) { // @since 10.0 Rename $pg_dumpPath configuration variable to $DatabaseDumpPath $DatabaseDumpPath = $pg_dumpPath; } // Check pg_dump binary exists. if ( ! empty( $DatabaseDumpPath ) && $DatabaseType === 'postgresql' && ( ! file_exists( $DatabaseDumpPath ) || strpos( basename( $DatabaseDumpPath ), 'pg_dump' ) !== 0 ) ) { $error[] = 'The value for $DatabaseDumpPath in the config.inc.php file is not correct. pg_dump utility not found.'; } // Check mysqldump binary exists. if ( ! empty( $DatabaseDumpPath ) && $DatabaseType === 'mysql' && ( ! file_exists( $DatabaseDumpPath ) || strpos( basename( $DatabaseDumpPath ), 'mysqldump' ) !== 0 ) ) { $error[] = 'The value for $DatabaseDumpPath in the config.inc.php file is not correct. mysqldump utility not found.'; } // Check for gd extension. if ( ! extension_loaded( 'gd' ) ) { $error[] = 'PHP extensions: RosarioSIS relies on the gd extension (used to resize and compress images). Please install and activate it.'; } // Check for zip extension. if ( ! extension_loaded( 'zip' ) ) { $error[] = 'PHP extensions: RosarioSIS relies on the zip extension (used to upload add-ons and by Import add-ons). Please install and activate it.'; } // Check for xmlrpc extension. if ( version_compare( PHP_VERSION, '8.0' ) == -1 && ! extension_loaded( 'xmlrpc' ) ) { $error[] = 'PHP extensions: RosarioSIS relies on the xmlrpc extension (only used to connect to Moodle). Please install and activate it.'; } // Check for curl extension. if ( ! extension_loaded( 'curl' ) ) { $error[] = 'PHP extensions: RosarioSIS relies on the curl extension (only used to connect to Moodle). Please install and activate it.'; } // Check for intl extension. if ( ! extension_loaded( 'intl' ) ) { $error[] = 'PHP extensions: RosarioSIS relies on the intl extension. Please install and activate it.'; } // Check session.auto_start. if ( (bool) ini_get( 'session.auto_start' ) ) { $error[] = 'session.auto_start is set to On in your PHP configuration. See the php.ini file to deactivate it.' . $inipath; } echo _ErrorMessage( $error, 'error' ); if ( ! count( $error ) ) { echo '

Your RosarioSIS installation is properly configured.

'; } /** * Error Message * * Local function * * @param array $error Errors. * @param string $code error|fatal. * * @return string Errors HTML, exits if fatal error */ function _ErrorMessage( $error, $code = 'error' ) { if ( $error ) { $return = '

'; if ( count( $error ) == 1 ) { if ( $code === 'error' || $code === 'fatal' ) { $return .= 'Error: '; } else $return .= 'Note: '; $return .= reset( $error ); } else { if ( $code === 'error' || $code === 'fatal' ) { $return .= 'Errors:'; } else $return .= 'Notes:'; $return .= '

    '; foreach ( (array) $error as $value ) { $return .= '
  • ' . $value . '
  • '; } $return .= '
'; } $return .= '


'; if ( $code === 'fatal' ) { echo $return; exit; } return $return; } }