public function display(BugData $p_bug, $p_columns_target)
 {
     plugin_push_current('RelationshipColumnView');
     $p_bug_id = $p_bug->id;
     echo GetRelationshipContent($p_bug_id, plugin_config_get('ShowRelationshipsColorful'), $p_columns_target == COLUMNS_TARGET_VIEW_PAGE, plugin_config_get('ShowRelationships'), plugin_config_get('ShowRelationshipIcons'));
     plugin_pop_current();
 }
 public function display($p_bug, $p_columns_target)
 {
     plugin_push_current('Source');
     if (isset($this->changeset_cache[$p_bug->id])) {
         echo '<a href="view.php?id=', $p_bug->id, '#changesets">', $this->changeset_cache[$p_bug->id], '</a>';
     }
     plugin_pop_current();
 }
 function options()
 {
     plugin_push_current('CustomerManagement');
     if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) {
         $options = array(1 => lang_get('yes'), 2 => lang_get('no'));
     }
     plugin_pop_current();
     return $options;
 }
 public function display($p_bug, $p_columns_target)
 {
     plugin_push_current('Timecard');
     $p_bug_id = $p_bug->id;
     $t_bug = TimecardBug::load($p_bug_id, true);
     $t_bug->calculate();
     if ($t_bug->estimate >= 0) {
         echo $t_bug->estimate, plugin_lang_get('hours');
     }
     plugin_pop_current();
 }
 public function display($p_bug, $p_columns_target)
 {
     plugin_push_current('CustomerManagement');
     if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) {
         $bugData = CustomerManagementDao::getBugData($p_bug->id);
         if (count($bugData) > 0) {
             $isBillable = CustomerManagementDao::getService($bugData['is_billable']);
             echo string_display_line($isBillable ? lang_get('yes') : lang_get('no'));
         }
     }
     plugin_pop_current();
 }
 function options()
 {
     plugin_push_current('CustomerManagement');
     if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) {
         $options = array();
         foreach (CustomerManagementDao::findAllGroups() as $group) {
             $options[$group['id']] = $group['name'];
         }
     }
     plugin_pop_current();
     return $options;
 }
 public function display($p_bug, $p_columns_target)
 {
     plugin_push_current('CustomerManagement');
     if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) {
         $bugData = CustomerManagementDao::getBugData($p_bug->id);
         if (count($bugData) > 0) {
             $group = CustomerManagementDao::getGroupForCustomer($bugData['customer_id']);
             echo string_display_line($group['name']);
         }
     }
     plugin_pop_current();
 }
 function query($p_filter_input)
 {
     $invoice = $p_filter_input;
     if (is_blank($invoice)) {
         return;
     }
     plugin_push_current('CustomerManagement');
     if (access_has_global_level(plugin_config_get('view_customer_fields_threshold'))) {
         $t_query = CustomerManagementDao::buildFilterArrayForInvoice($invoice);
     }
     plugin_pop_current();
     return $t_query;
 }
Exemplo n.º 9
0
 /**
  * Wrap method calls to the target object in plugin_push/pop calls.
  */
 function __call($p_method, $p_args)
 {
     plugin_push_current($this->basename);
     $value = call_user_func_array(array($this->object, $p_method), $p_args);
     plugin_pop_current();
     return $value;
 }
Exemplo n.º 10
0
print_test_row('check mail configuration: send_reset_password = ON requires enable_email_notification = ON', OFF == config_get_global('send_reset_password') || ON == config_get_global('enable_email_notification'));
print_test_row('check mail configuration: allow_signup = ON requires enable_email_notification = ON', OFF == config_get_global('allow_signup') || ON == config_get_global('enable_email_notification'));
print_test_row('check mail configuration: allow_signup = ON requires send_reset_password = ON', OFF == config_get_global('allow_signup') || ON == config_get_global('send_reset_password'));
print_test_row('check language configuration: fallback_language is not \'auto\'', 'auto' != config_get_global('fallback_language'));
print_test_row('check configuration: allow_anonymous_login = ON requires anonymous_account to be set', OFF == config_get_global('allow_anonymous_login') || strlen(config_get_global('anonymous_account')) > 0);
$t_anon_user = false;
print_test_row('check configuration: anonymous_account is a valid username if set', strlen(config_get_global('anonymous_account')) > 0 ? ($t_anon_user = user_get_id_by_name(config_get_global('anonymous_account'))) !== false : TRUE);
print_test_row('check configuration: anonymous_account should not be an administrator', $t_anon_user ? !user_is_administrator($t_anon_user) : TRUE);
print_test_row('$g_bug_link_tag is not empty ("' . config_get_global('bug_link_tag') . '")', '' != config_get_global('bug_link_tag'));
print_test_row('$g_bugnote_link_tag is not empty ("' . config_get_global('bugnote_link_tag') . '")', '' != config_get_global('bugnote_link_tag'));
print_test_row('filters: dhtml_filters = ON requires use_javascript = ON', OFF == config_get_global('dhtml_filters') || ON == config_get_global('use_javascript'));
print_test_row('Phpmailer sendmail configuration requires escapeshellcmd. Please use a different phpmailer method if this is blocked.', PHPMAILER_METHOD_SENDMAIL != config_get('phpMailer_method') || PHPMAILER_METHOD_SENDMAIL == config_get('phpMailer_method') && function_exists('escapeshellcmd'));
print_test_row('Phpmailer sendmail configuration requires escapeshellarg. Please use a different phpmailer method if this is blocked.', PHPMAILER_METHOD_SENDMAIL != config_get('phpMailer_method') || PHPMAILER_METHOD_SENDMAIL == config_get('phpMailer_method') && function_exists('escapeshellarg'));
check_zend_optimiser_version();
if (plugin_is_installed('MantisGraph')) {
    plugin_push_current('MantisGraph');
    print_test_row('checking gd is enabled, and version 2...', get_gd_version() == 2);
    if (plugin_config_get('eczlibrary', ON) == OFF) {
        $t_jpgraph_path = config_get('absolute_path') . 'library' . DIRECTORY_SEPARATOR . 'jpgraph' . DIRECTORY_SEPARATOR;
        if (!file_exists($t_jpgraph_path . 'jpgraph.php')) {
            print_test_row('checking we can find jpgraph class files...', false);
        } else {
            require_once $t_jpgraph_path . 'jpgraph.php';
            print_test_row('Checking Jpgraph version (if installed)...', version_compare(JPG_VERSION, '2.3.0') ? true : false, JPG_VERSION);
        }
        print_test_row('check configuration: jpgraph (if used) requires php bundled gd for antialiasing support', plugin_config_get('jpgraph_antialias', OFF) == OFF || function_exists('imageantialias'));
    }
    plugin_pop_current();
}
print_test_row('Checking if ctype is enabled in php (required for rss feeds)....', extension_loaded('ctype'));
print_test_row('Checking for mysql is at least version 4.1...', !(db_is_mysql() && version_compare($t_serverinfo['version'], '4.1.0', '<')));
Exemplo n.º 11
0
/**
 * Executes a plugin's callback function for a given event.
 * @param string Event name
 * @param string Callback name
 * @param string Plugin basename
 * @param multi Parameters for event callback
 * @return multi Null if callback not found, value from callback otherwise
 * @access public
 */
function event_callback( $p_event, $p_callback, $p_plugin, $p_params = null ) {
	$t_value = null;
	if( !is_array( $p_params ) ) {
		$p_params = array(
			$p_params,
		);
	}

	if( $p_plugin !== 0 ) {
		global $g_plugin_cache;

		plugin_push_current( $p_plugin );

		if( method_exists( $g_plugin_cache[$p_plugin], $p_callback ) ) {
			$t_value = call_user_func_array( array( $g_plugin_cache[$p_plugin], $p_callback ), array_merge( array( $p_event ), $p_params ) );
		}

		plugin_pop_current();
	} else {
		if( function_exists( $p_callback ) ) {
			$t_value = call_user_func_array( $p_callback, array_merge( array( $p_event ), $p_params ) );
		}
	}

	return $t_value;
}
Exemplo n.º 12
0
 * @uses config_api.php
 * @uses constant_inc.php
 * @uses gpc_api.php
 * @uses plugin_api.php
 */
/**
 * MantisBT Core API's
 */
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');
$t_matches = array();
if (!preg_match('/^([a-zA-Z0-9_-]+)\\/([a-zA-Z0-9_-]+[\\/a-zA-Z0-9_-]*)/', $f_page, $t_matches)) {
    trigger_error(ERROR_GENERIC, ERROR);
}
$t_basename = $t_matches[1];
$t_action = $t_matches[2];
global $g_plugin_cache;
if (!isset($g_plugin_cache[$t_basename])) {
    trigger_error(ERROR_PLUGIN_NOT_REGISTERED, ERROR);
}
$t_page = $t_plugin_path . $t_basename . DIRECTORY_SEPARATOR . 'pages' . DIRECTORY_SEPARATOR . $t_action . '.php';
if (!is_file($t_page)) {
    trigger_error(ERROR_PLUGIN_PAGE_NOT_FOUND, ERROR);
}
plugin_push_current($t_basename);
include $t_page;
Exemplo n.º 13
0
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
#
#  Autochange status Plugin for Mantis BugTracker :
#  © Hennes Hervé <*****@*****.**>
#    2015-2016
#  http://www.h-hennes.fr/blog/
require_once dirname(__FILE__) . '/../../../core.php';
#En cron on push le nom du module
plugin_push_current('AutoChangeStatus');
#Utilisateur par défaut
$g_cron_current_user_id = plugin_config_get('change_status_user');
#Nom des statuts avec les traductions
$t_status_names = MantisEnum::getAssocArrayIndexedByValues(lang_get('status_enum_string'));
#Requête pour récupérer la date de modification du statut avec le nombre de jours correspondants
$sql_status = "SELECT h.* , FROM_UNIXTIME(date_modified, '%Y-%m-%d') AS date_status_modified\r\n             FROM mantis_bug_table b\r\n             LEFT JOIN mantis_bug_history_table h ON ( b.id = h.bug_id AND field_name='status' AND new_value=" . db_param() . " )\r\n             WHERE b.status = " . db_param() . " AND b.project_id = " . db_param() . "\r\n             AND CURDATE() = DATE_ADD(FROM_UNIXTIME(date_modified, '%Y-%m-%d'), INTERVAL " . db_param() . " DAY)";
#@ToDO : Essayer de grouper les requêtes
$sql_status_no_project = "SELECT h.* , FROM_UNIXTIME(date_modified, '%Y-%m-%d') AS date_status_modified\r\n             FROM mantis_bug_table b\r\n             LEFT JOIN mantis_bug_history_table h ON ( b.id = h.bug_id AND field_name='status' AND new_value=" . db_param() . " )\r\n             WHERE b.status = " . db_param() . "\r\n             AND CURDATE() = DATE_ADD(FROM_UNIXTIME(date_modified, '%Y-%m-%d'), INTERVAL " . db_param() . " DAY)";
#Requête pour récupérer la date de la dernière note UTILISATEUR sur le bug
$sql_notes = "SELECT * FROM mantis_bugnote_table\r\n                  WHERE bug_id= " . db_param() . " AND reporter_id <> " . plugin_config_get('change_status_user') . " AND date_submitted > " . db_param();
#Récupération des changements automatiques qui sont actifs
$change_status = db_query("SELECT * FROM mantis_autochange_status WHERE active=1");
#Boucle de traitement
while ($change = db_fetch_array($change_status)) {
    ####
Exemplo n.º 14
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;
    }
}
Exemplo n.º 15
0
<?php

# EXIT on access not as AJAX request
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {
    exit("This script can only be accessed with an AJAX request.");
}
# EXIT on missing GET param
if (!isset($_GET['partial']) || !isset($_GET['contentType'])) {
    exit("Error in " . __FILE__ . ": Missing GET param 'partial' or 'contentType'.");
}
# reload mantis environment - otherwise database access is not possible in the partials
# Note: can't move this into 'mitePartialsController' due to PHP warning messages
#######################################################################################
require_once '../../../core.php';
//
plugin_push_current("Mantis2mite");
$o_pluginController = $g_plugin_cache['Mantis2mite'];
try {
    /*
     * @local object mitePartialsController
     */
    $o_pluginPartialsController = $o_pluginController->getMitePartialsController();
    $o_pluginPartialsController->includePartial(urldecode($_GET['partial']), urldecode($_GET['contentType']));
} catch (Exception $e) {
    echo $e->getMessage();
}