Esempio n. 1
0
function graph_get_font()
{
    $t_font = plugin_config_get('font', '');
    if (plugin_config_get('eczlibrary') == ON) {
        $ttf_dir = '';
        $t_font = '';
        $t_font_map = array('arial' => 'arial.ttf', 'verdana' => 'verdana.ttf', 'trebuchet' => 'trebuc.ttf', 'verasans' => 'Vera.ttf', 'times' => 'times.ttf', 'georgia' => 'georgia.ttf', 'veraserif' => 'VeraSe.ttf', 'courier' => 'cour.ttf', 'veramono' => 'VeraMono.ttf');
        if (isset($t_font_map[$t_font])) {
            $t_font = $t_font_map[$t_font];
        } else {
            $t_font = 'arial.ttf';
        }
        $t_font_path = get_font_path();
        if (empty($t_font_path)) {
            error_text('unable to load font(s)', 'unable to load font(s)');
        }
        $f = $t_font_path . $t_font;
        if (file_exists($f) === false || is_readable($f) === false) {
            error_text('unable to read/find font', 'unable to read/find font');
        }
        return $f;
    } else {
        $t_font_map = array('arial' => FF_ARIAL, 'verdana' => FF_VERDANA, 'trebuchet' => FF_TREBUCHE, 'verasans' => FF_VERA, 'times' => FF_TIMES, 'georgia' => FF_GEORGIA, 'veraserif' => FF_VERASERIF, 'courier' => FF_COURIER, 'veramono' => FF_VERAMONO);
        if (isset($t_font_map[$t_font])) {
            return $t_font_map[$t_font];
        } else {
            return FF_FONT1;
        }
    }
}
Esempio n. 2
0
 * @uses config_api.php
 * @uses crypto_api.php
 * @uses gpc_api.php
 * @uses utility_api.php
 */
/**
 * MantisBT Core API's
 */
require_once 'core.php';
require_api('config_api.php');
require_api('crypto_api.php');
require_api('gpc_api.php');
require_api('utility_api.php');
$f_public_key = gpc_get_string('public_key');
$t_private_key = substr(hash('whirlpool', 'captcha' . config_get_global('crypto_master_salt') . $f_public_key, false), 0, 5);
$t_system_font_folder = get_font_path();
$t_font_per_captcha = config_get('font_per_captcha');
$t_captcha_init = array('TTF_folder' => $t_system_font_folder, 'TTF_RANGE' => array($t_font_per_captcha));
$captcha = new masc_captcha($t_captcha_init);
$captcha->make_captcha($t_private_key);
#
# The class below was derived from
# http://www.phpclasses.org/browse/package/1163.html
#
# *** 3.0 Author
# Pascal Rehfeldt
# Pascal@Pascal-Rehfeldt.com
#
# http://www.phpclasses.org/browse.html/author/102754.html
#
#
Esempio n. 3
0
 */
require_once 'core.php';
require_api('authentication_api.php');
require_api('compress_api.php');
require_api('config_api.php');
require_api('graphviz_api.php');
require_api('workflow_api.php');
auth_ensure_user_authenticated();
if (!config_get('relationship_graph_enable')) {
    access_denied();
}
compress_enable();
$t_status_arr = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
$t_graph_fontname = config_get('relationship_graph_fontname');
$t_graph_fontsize = config_get('relationship_graph_fontsize');
$t_graph_fontpath = get_font_path();
$t_dot_tool = config_get('dot_tool');
$t_graph_attributes = array();
if (!empty($t_graph_fontpath)) {
    $t_graph_attributes['fontpath'] = $t_graph_fontpath;
}
$t_graph = new Graph('workflow', $t_graph_attributes, $t_dot_tool);
$t_graph->set_default_node_attr(array('fontname' => $t_graph_fontname, 'fontsize' => $t_graph_fontsize, 'shape' => 'record', 'style' => 'filled', 'height' => '0.2', 'width' => '0.4'));
$t_graph->set_default_edge_attr(array('style' => 'solid', 'color' => '#0000C0', 'dir' => 'forward'));
foreach ($t_status_arr as $t_from_status => $t_from_label) {
    $t_enum_status = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
    foreach ($t_enum_status as $t_to_status_id => $t_to_status_label) {
        if (workflow_transition_edge_exists($t_from_status, $t_to_status_id)) {
            $t_graph->add_edge(string_no_break(MantisEnum::getLabel(lang_get('status_enum_string'), $t_from_status)), string_no_break(MantisEnum::getLabel(lang_get('status_enum_string'), $t_to_status_id)), array());
        }
    }
function relgraph_generate_dep_graph($p_bug_id, $p_bug = null, $p_horizontal = false)
{
    # List of visited issues and their data.
    $v_bug_list = array();
    # Firstly, we visit all ascendant issues and all descendant issues
    # and collect all the necessary data in the $v_bug_list variable.
    # We do not visit other descendants of our parents, neither other
    # ascendants of our children, to avoid displaying too much unrelated
    # issues. We still collect the information about those relationships,
    # so, if these issues happen to be visited also, relationship links
    # will be preserved.
    # The first issue in the list is the one we are parting from.
    if (null === $p_bug) {
        $p_bug = bug_get($p_bug_id, true);
    }
    $v_bug_list[$p_bug_id] = $p_bug;
    $v_bug_list[$p_bug_id]->is_descendant = true;
    $v_bug_list[$p_bug_id]->parents = array();
    $v_bug_list[$p_bug_id]->children = array();
    # Now we visit all ascendants of the root issue.
    $t_relationships = relationship_get_all_dest($p_bug_id);
    foreach ($t_relationships as $t_relationship) {
        if ($t_relationship->type != BUG_DEPENDANT) {
            continue;
        }
        $v_bug_list[$p_bug_id]->parents[] = $t_relationship->src_bug_id;
        relgraph_add_parent($v_bug_list, $t_relationship->src_bug_id);
    }
    $t_relationships = relationship_get_all_src($p_bug_id);
    foreach ($t_relationships as $t_relationship) {
        if ($t_relationship->type != BUG_DEPENDANT) {
            continue;
        }
        $v_bug_list[$p_bug_id]->children[] = $t_relationship->dest_bug_id;
        relgraph_add_child($v_bug_list, $t_relationship->dest_bug_id);
    }
    # We have already collected all the information we need to generate
    # the graph. Now it is the matter to create a Digraph object and
    # store the information there, along with graph formatting attributes.
    $t_id_string = relgraph_bug_format_id($p_bug_id);
    $t_graph_fontname = config_get('relationship_graph_fontname');
    $t_graph_fontsize = config_get('relationship_graph_fontsize');
    $t_graph_fontpath = get_font_path();
    $t_view_on_click = config_get('relationship_graph_view_on_click');
    $t_dot_tool = config_get('dot_tool');
    $t_graph_attributes = array();
    if (!empty($t_graph_fontpath)) {
        $t_graph_attributes['fontpath'] = $t_graph_fontpath;
    }
    if ($p_horizontal) {
        $t_graph_attributes['rankdir'] = 'LR';
        $t_graph_orientation = 'horizontal';
    } else {
        $t_graph_orientation = 'vertical';
    }
    $t_graph = new Digraph($t_id_string, $t_graph_attributes, $t_dot_tool);
    $t_graph->set_default_node_attr(array('fontname' => $t_graph_fontname, 'fontsize' => $t_graph_fontsize, 'shape' => 'record', 'style' => 'filled', 'height' => '0.2', 'width' => '0.4'));
    $t_graph->set_default_edge_attr(array('style' => 'solid', 'color' => '#C00000', 'dir' => 'back'));
    # Add all issue nodes and edges to the graph.
    foreach ($v_bug_list as $t_related_bug_id => $t_related_bug) {
        $t_id_string = relgraph_bug_format_id($t_related_bug_id);
        if ($t_view_on_click) {
            $t_url = string_get_bug_view_url($t_related_bug_id);
        } else {
            $t_url = "bug_relationship_graph.php?bug_id={$t_related_bug_id}&graph=dependency&orientation={$t_graph_orientation}";
        }
        relgraph_add_bug_to_graph($t_graph, $t_id_string, $t_related_bug, $t_url, $t_related_bug_id == $p_bug_id);
        # Now add all relationship edges to the graph.
        foreach ($v_bug_list[$t_related_bug_id]->parents as $t_parent_id) {
            # Do not create edges for unvisited bugs.
            if (!isset($v_bug_list[$t_parent_id])) {
                continue;
            }
            $t_parent_node = relgraph_bug_format_id($t_parent_id);
            $t_graph->add_edge($t_parent_node, $t_id_string);
        }
    }
    return $t_graph;
}
Esempio n. 5
0
 * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
 * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
 * @link http://www.mantisbt.org
 */
require_once 'core.php';
if (plugin_config_get('eczlibrary') != config_get('plugin_MantisGraph_eczlibrary')) {
    plugin_config_set('eczlibrary', config_get('plugin_MantisGraph_eczlibrary'));
}
if (plugin_config_get('jpgraph_path') != config_get('plugin_MantisGraph_jpgraph_path')) {
    plugin_config_set('jpgraph_path', config_get('plugin_MantisGraph_jpgraph_path'));
}
plugin_require_api('core/graph_api.php', 'MantisGraph');
require_api('version_api.php');
require_api('history_api.php');
if (OFF == plugin_config_get('eczlibrary')) {
    $t_font_path = get_font_path();
    if ($t_font_path !== '' && !defined('TTF_DIR')) {
        define('TTF_DIR', $t_font_path);
    }
    $t_jpgraph_path = plugin_config_get('jpgraph_path');
    if ($t_jpgraph_path !== '') {
        set_include_path(get_include_path() . PATH_SEPARATOR . $t_jpgraph_path);
        $ip = get_include_path();
        require_once 'jpgraph_gantt.php';
        require_once 'jpgraph_mgraph.php';
    } else {
        require_lib('jpgraph/jpgraph_gantt.php');
        require_lib('jpgraph/jpgraph_mgraph.php');
    }
} else {
    require_lib('ezc/Base/src/base.php');