Beispiel #1
0
/**
 * Initilise wiki engine
 * @return null
 * @access public
 */
function wiki_init()
{
    if (wiki_enabled()) {
        # handle legacy style wiki integration
        require_once config_get_global('class_path') . 'MantisCoreWikiPlugin.class.php';
        switch (config_get_global('wiki_engine')) {
            case 'dokuwiki':
                plugin_child('MantisCoreDokuwiki');
                break;
            case 'mediawiki':
                plugin_child('MantisCoreMediaWiki');
                break;
            case 'twiki':
                plugin_child('MantisCoreTwiki');
                break;
            case 'WikkaWiki':
                plugin_child('MantisCoreWikkaWiki');
                break;
            case 'xwiki':
                plugin_child('MantisCoreXwiki');
                break;
        }
        if (is_null(event_signal('EVENT_WIKI_INIT'))) {
            config_set_global('wiki_enable', OFF);
        }
    }
}
Beispiel #2
0
 /**
  * Tests string_sanitize_url()
  *
  * @dataProvider provider
  * @param string $p_in  Input.
  * @param string $p_out Expected output.
  * @return void
  */
 public function testStringSanitize($p_in, $p_out)
 {
     $t_a = string_sanitize_url($p_in, false);
     $this->assertEquals($p_out, $t_a);
     # Since unit tests are run from command-line, with a default MantisBT
     # config $g_short_path will be that of the phpunit binary. We also
     # need to cover the case of Mantis being installed at the server's
     # root (i.e. $g_short_path = '/')
     config_set_global('short_path', '/');
     $t_a = string_sanitize_url($p_in, false);
     $this->assertEquals($p_out, $t_a);
 }
 public function create()
 {
     $t_issue_ext_table = plugin_table("issue");
     # Insert the rest of the data
     $query = "INSERT INTO {$t_issue_ext_table}\n\t\t\t\t\t    ( project_id ,              issue_id,       report_id,   report_fingerprint,\n                        file_path,               phone_model,    phone_build, phone_brand,\n                        product_name,            total_mem_size, available_mem_size, custom_data,\n                        initial_configuration,   crash_configuration, display, user_comment,\n                        dumpsys_meminfo,         dropbox,        eventslog,    radiolog,\n                        is_silent,               device_id,      installation_id,  user_email,\n                        device_features,         environment,    settings_system, settings_secure,\n                        shared_preferences,      android_version,app_version,     crash_date,\n                        report_date,             install_date\n\t\t\t\t\t    )\n\t\t\t\t\t  VALUES\n\t\t\t\t\t    ( " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ",\n\t\t\t\t\t      " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ",\n\t\t\t\t\t      " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ",\n\t\t\t\t\t      " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ",\n\t\t\t\t\t      " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ",\n\t\t\t\t\t      " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ",\n\t\t\t\t\t      " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ",\n\t\t\t\t\t      " . db_param() . ',' . db_param() . ',' . db_param() . ',' . db_param() . ",\n\t\t\t\t\t      " . 'now()' . ',' . db_param() . ')';
     $t_display_errors = config_get_global('display_errors');
     $t_on_error_handler = $t_display_errors[E_USER_ERROR];
     $t_display_errors[E_USER_ERROR] = "none";
     config_set_global('display_errors', $t_display_errors);
     $t_result = db_query_bound($query, array($this->project_id, $this->issue_id, $this->report_id, $this->report_fingerprint, $this->file_path, $this->phone_model, $this->phone_build, $this->phone_brand, $this->product_name, $this->total_mem_size, $this->available_mem_size, $this->custom_data, $this->initial_configuration, $this->crash_configuration, $this->display, $this->user_comment, $this->dumpsys_meminfo, $this->dropbox, $this->eventslog, $this->radiolog, $this->is_silent, $this->device_id, $this->installation_id, $this->user_email, $this->device_features, $this->environment, $this->settings_system, $this->settings_secure, $this->shared_preferences, $this->android_version, $this->app_version, $this->crash_date . $this->report_date, $this->install_date));
     $t_display_errors[E_USER_ERROR] = $t_on_error_handler;
     config_set_global('display_errors', $t_display_errors);
     if ($t_result === false) {
         return false;
     }
     $this->id = db_insert_id($t_issue_ext_table);
     return true;
 }
Beispiel #4
0
/**
 * Initialise wiki engine
 * @return void
 * @access public
 */
function wiki_init()
{
    if (!wiki_enabled()) {
        return;
    }
    $t_wiki_engine = config_get_global('wiki_engine');
    if (is_blank(config_get_global('wiki_engine_url'))) {
        # Build default Wiki URL root based on MantisBT path
        $t_url = parse_url(config_get_global('path'));
        # Remove unwanted components and set path to Wiki engine name
        unset($t_url['query'], $t_url['fragment']);
        $t_url['path'] = '/' . $t_wiki_engine . '/';
        $t_url = http_build_url($t_url);
        config_set_global('wiki_engine_url', $t_url);
    }
    # handle legacy style wiki integration
    require_once config_get_global('class_path') . 'MantisCoreWikiPlugin.class.php';
    switch ($t_wiki_engine) {
        case 'dokuwiki':
            plugin_child('MantisCoreDokuwiki');
            break;
        case 'mediawiki':
            plugin_child('MantisCoreMediaWiki');
            break;
        case 'twiki':
            plugin_child('MantisCoreTwiki');
            break;
        case 'WikkaWiki':
            plugin_child('MantisCoreWikkaWiki');
            break;
        case 'xwiki':
            plugin_child('MantisCoreXwiki');
            break;
    }
    if (is_null(event_signal('EVENT_WIKI_INIT'))) {
        config_set_global('wiki_enable', OFF);
    }
}
Beispiel #5
0
            print_test_result(BAD, false, 'Database user doesn\'t have access to the database ( ' . db_error_msg() . ' )');
        }
        $g_db->Close();
        ?>
</tr>
<?php 
    }
    # install the tables
    if (false == $g_failed) {
        $g_db_connected = false;
        # fake out database access routines used by config_get
        config_set_global('db_type', $f_db_type);
        # Initialize table prefixes as specified by user
        config_set_global('db_table_prefix', $f_db_table_prefix);
        config_set_global('db_table_plugin_prefix', $f_db_table_plugin_prefix);
        config_set_global('db_table_suffix', $f_db_table_suffix);
        # database_api references this
        require_once dirname(__FILE__) . '/schema.php';
        $g_db = ADONewConnection($f_db_type);
        $t_result = @$g_db->Connect($f_hostname, $f_admin_username, $f_admin_password, $f_database_name);
        if (!$f_log_queries) {
            $g_db_connected = true;
            # fake out database access routines used by config_get
        }
        $t_last_update = config_get('database_version', -1, ALL_USERS, ALL_PROJECTS);
        $t_last_id = count($g_upgrade) - 1;
        $i = $t_last_update + 1;
        if ($f_log_queries) {
            echo '<tr><td bgcolor="#ffffff" col_span="2"> Database Creation Suppressed, SQL Queries follow <pre>';
        }
        # Make sure we do the upgrades using UTF-8 if needed
Beispiel #6
0
/**
 * Set plugin default values to global values without overriding anything.
 * @param array Array of configuration option name/value pairs.
 */
function plugin_config_defaults($p_options)
{
    if (!is_array($p_options)) {
        return;
    }
    $t_basename = plugin_get_current();
    $t_option_base = 'plugin_' . $t_basename . '_';
    foreach ($p_options as $t_option => $t_value) {
        $t_full_option = $t_option_base . $t_option;
        config_set_global($t_full_option, $t_value, false);
    }
}
Beispiel #7
0
if (!isset($g_login_anonymous)) {
    $g_login_anonymous = true;
}
# Attempt to set the current timezone to the user's desired value
# Note that PHP 5.1 on RHEL/CentOS doesn't support the timezone functions
# used here so we just skip this action on RHEL/CentOS platforms.
if (function_exists('timezone_identifiers_list')) {
    if (in_array(config_get_global('default_timezone'), timezone_identifiers_list())) {
        # if a default timezone is set in config, set it here, else we use php.ini's value
        # having a timezone set avoids a php warning
        date_default_timezone_set(config_get_global('default_timezone'));
    } else {
        # To ensure proper detection of timezone settings issues, we must not
        # initialize the default timezone when executing admin checks
        if (basename($g_short_path) != 'check') {
            config_set_global('default_timezone', date_default_timezone_get(), true);
        }
    }
    require_api('authentication_api.php');
    if (auth_is_user_authenticated()) {
        require_api('user_pref_api.php');
        $t_user_timezone = user_pref_get_pref(auth_get_current_user_id(), 'timezone');
        if (!is_blank($t_user_timezone)) {
            date_default_timezone_set($t_user_timezone);
        }
    }
}
if (!defined('MANTIS_MAINTENANCE_MODE')) {
    require_api('collapse_api.php');
    collapse_cache_token();
}
Beispiel #8
0
}

if( !isset( $g_login_anonymous ) ) {
	$g_login_anonymous = true;
}

# Set the current timezone
if( !defined( 'MANTIS_MAINTENANCE_MODE' ) ) {
	require_api( 'authentication_api.php' );

	# To reduce overhead, we assume that the timezone configuration is valid,
	# i.e. it exists in timezone_identifiers_list(). If not, a PHP NOTICE will
	# be raised. Use admin checks to validate configuration.
	@date_default_timezone_set( config_get_global( 'default_timezone' ) );
	$t_tz = @date_default_timezone_get();
	config_set_global( 'default_timezone', $t_tz, true );

	if( auth_is_user_authenticated() ) {
		# Determine the current timezone according to user's preferences
		require_api( 'user_pref_api.php' );
		$t_tz = user_pref_get_pref( auth_get_current_user_id(), 'timezone' );
		@date_default_timezone_set( $t_tz );
	}
	unset( $t_tz );
}

# Cache current user's collapse API data
if( !defined( 'MANTIS_MAINTENANCE_MODE' ) ) {
	require_api( 'collapse_api.php' );
	collapse_cache_token();
}
Beispiel #9
0
function ERP_set_temporary_overwrite($p_config_name, $p_value)
{
    global $g_cache_bypass_lookup;
    $g_cache_bypass_lookup[$p_config_name] = TRUE;
    config_set_global($p_config_name, $p_value);
}