$t_name = '<a href="' . string_attribute(plugin_page($t_page, false, $t_basename)) . '">' . $t_name . '</a>';
 }
 if (!is_blank($t_author)) {
     if (is_array($t_author)) {
         $t_author = implode($t_author, ', ');
     }
     if (!is_blank($t_contact)) {
         $t_author = '<br />' . sprintf(lang_get('plugin_author'), '<a href="mailto:' . string_attribute($t_contact) . '">' . string_display_line($t_author) . '</a>');
     } else {
         $t_author = '<br />' . string_display_line(sprintf(lang_get('plugin_author'), $t_author));
     }
 }
 if (!is_blank($t_url)) {
     $t_url = '<br />' . lang_get('plugin_url') . lang_get('word_separator') . "<a href=\"{$t_url}\">{$t_url}</a>";
 }
 $t_upgrade = plugin_needs_upgrade($t_plugin);
 $t_uninstall = 'MantisCore' != $t_basename && !$t_protected;
 if (is_array($t_requires)) {
     foreach ($t_requires as $t_plugin => $t_version) {
         $t_dependency = plugin_dependency($t_plugin, $t_version);
         if (1 == $t_dependency) {
             if (is_blank($t_upgrade)) {
                 $t_depends[] = '<span class="small dependency_met">' . string_display_line($t_plugins[$t_plugin]->name . ' ' . $t_version) . '</span>';
             } else {
                 $t_depends[] = '<span class="small dependency_upgrade">' . string_display_line($t_plugins[$t_plugin]->name . ' ' . $t_version) . '</span>';
             }
         } else {
             if (-1 == $t_dependency) {
                 $t_depends[] = '<span class="small dependency_dated">' . string_display_line($t_plugins[$t_plugin]->name . ' ' . $t_version) . '</span>';
             } else {
                 $t_depends[] = '<span class="small dependency_unmet">' . string_display_line($t_plugin . ' ' . $t_version) . '</span>';
<?php

$GLOBALS['t_dir_emailreporting_adjust'] = dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
require_once $GLOBALS['t_dir_emailreporting_adjust'] . 'core.php';
$t_basename = 'EmailReporting';
$t_pagename = 'bug_report_mail';
if (plugin_needs_upgrade($g_plugin_cache[$t_basename])) {
    error_parameters($t_basename);
    echo error_string(ERROR_PLUGIN_UPGRADE_NEEDED);
    exit;
}
// This would work but skips some important checks done in plugin.php.
// For the moment this code will be disabled
/*
$t_pagename = 'pages/bug_report_mail.php';
plugin_push_current( $t_basename );
plugin_require_api( $t_pagename );
*/
$t_tmp_plugin_page = plugin_page($t_pagename, TRUE, $t_basename);
$t_tmp_plugin_page = explode('?', $t_tmp_plugin_page, 2);
$t_tmp_plugin_page[1] = explode('=', $t_tmp_plugin_page[1], 2);
$_GET[$t_tmp_plugin_page[1][0]] = $t_tmp_plugin_page[1][1];
require_once $GLOBALS['t_dir_emailreporting_adjust'] . $t_tmp_plugin_page[0];
Exemple #3
0
/**
 * Initialize a single plugin.
 * @param string Plugin basename
 * @return boolean True if plugin initialized, false otherwise.
 */
function plugin_init($p_basename)
{
    global $g_plugin_cache, $g_plugin_cache_init;
    # handle dependent plugins
    if (isset($g_plugin_cache[$p_basename])) {
        $t_plugin = $g_plugin_cache[$p_basename];
        # hard dependencies; return false if the dependency is not registered,
        # does not meet the version requirement, or is not yet initialized.
        if (is_array($t_plugin->requires)) {
            foreach ($t_plugin->requires as $t_required => $t_version) {
                if (plugin_dependency($t_required, $t_version, true) !== 1) {
                    return false;
                }
            }
        }
        # soft dependencies; only return false if the soft dependency is
        # registered, but not yet initialized.
        if (is_array($t_plugin->uses)) {
            foreach ($t_plugin->uses as $t_used => $t_version) {
                if (isset($g_plugin_cache[$t_used]) && !isset($g_plugin_cache_init[$t_used])) {
                    return false;
                }
            }
        }
        # if plugin schema needs an upgrade, do not initialize
        if (plugin_needs_upgrade($t_plugin)) {
            return false;
        }
        plugin_push_current($p_basename);
        # load plugin error strings
        global $g_lang_strings;
        $t_lang = lang_get_current();
        $t_plugin_errors = $t_plugin->errors();
        foreach ($t_plugin_errors as $t_error_name => $t_error_string) {
            $t_error_code = "plugin_{$p_basename}_{$t_error_name}";
            $g_lang_strings[$t_lang]['MANTIS_ERROR'][$t_error_code] = $t_error_string;
        }
        # finish initializing the plugin
        $t_plugin->__init();
        $g_plugin_cache_init[$p_basename] = true;
        plugin_pop_current();
        return true;
    } else {
        return false;
    }
}
Exemple #4
0
 */
require_once 'core.php';
require_api('config_api.php');
require_api('constant_inc.php');
require_api('gpc_api.php');
require_api('plugin_api.php');
$t_plugin_path = config_get('plugin_path');
$f_page = gpc_get_string('page');
if (!preg_match('/^([a-zA-Z0-9_-]+)\\/([a-zA-Z0-9_-]+[\\/a-zA-Z0-9_-]*)/', $f_page, $t_matches)) {
    error_parameters($f_page);
    trigger_error(ERROR_PLUGIN_INVALID_PAGE, ERROR);
}
$t_basename = $t_matches[1];
$t_action = $t_matches[2];
$t_plugin = plugin_get($t_basename);
if (plugin_needs_upgrade($t_plugin)) {
    error_parameters($t_basename);
    trigger_error(ERROR_PLUGIN_UPGRADE_NEEDED, ERROR);
}
# Plugin can be registered but fail to load e.g. due to unmet dependencies
if (!plugin_is_loaded($t_basename)) {
    error_parameters($t_basename);
    trigger_error(ERROR_PLUGIN_NOT_LOADED, ERROR);
}
$t_page = $t_plugin_path . $t_basename . '/pages/' . $t_action . '.php';
if (!is_file($t_page)) {
    error_parameters($t_basename, $t_action);
    trigger_error(ERROR_PLUGIN_PAGE_NOT_FOUND, ERROR);
}
plugin_push_current($t_basename);
include $t_page;