/** * updates DB with new value * @param int $backlog * @throw exception on failure */ public function setBacklog($backlog) { $old_backlog = NULL; $query = "SELECT value FROM codev_config_table WHERE config_id = " . db_param(); $result = db_query($query, array(IssueMantisPluginHelper::id_customField_backlog)); $row = db_fetch_array($result); if ($row) { $backlogCustomField = $row['value']; } else { $backlogCustomField = 0; } // TODO should be done only once... $query = "SELECT name FROM mantis_custom_field_table WHERE id = " . db_param(); $result = db_query($query, array($backlogCustomField)); $row = db_fetch_array($result); if ($row) { $field_name = $row['name']; } else { $field_name = "Backlog (BL)"; } // check if backlog already defined for this issue $query = "SELECT value FROM `mantis_custom_field_string_table` WHERE bug_id=" . db_param() . " AND field_id = " . db_param(); $result = db_query($query, array($this->id, $backlogCustomField)); $row = db_fetch_array($result); if ($row) { $old_backlog = $row['value']; $query2 = "UPDATE mantis_custom_field_string_table SET value = " . db_param() . " WHERE bug_id=" . db_param() . " AND field_id = " . db_param(); $result2 = db_query($query2, array($backlog, $this->id, $backlogCustomField)); } else { $old_backlog = ''; $query2 = "INSERT INTO mantis_custom_field_string_table (`field_id`, `bug_id`, `value`) VALUES (" . db_param() . ", " . db_param() . ", " . db_param() . ")"; $result2 = db_query($query2, array($backlogCustomField, $this->id, $backlog)); } // Add to history if ("{$old_backlog}" != "{$backlog}") { $userid = current_user_get_field('id'); $now = time(); $query = "INSERT INTO mantis_bug_history_table (`user_id`, `bug_id`, `field_name`, `old_value`, `new_value`, `type`, `date_modified`) " . "VALUES (" . db_param() . "," . db_param() . "," . db_param() . ", " . db_param() . ", " . db_param() . ", " . db_param() . ", " . db_param() . ")"; $result = db_query($query, array($userid, $this->id, $field_name, $old_backlog, $backlog, 0, $now)); } // no need to update lastUpdated field }
/** * Check that there is a user logged-in and authenticated * If the user's account is disabled they will be logged out * If there is no user logged in, redirect to the login page * If parameter is given it is used as a URL to redirect to following * successful login. If none is given, the URL of the current page is used * @param string $p_return_page Page to redirect to following successful logon, defaults to current page. * @access public * @return void */ function auth_ensure_user_authenticated($p_return_page = '') { # if logged in if (auth_is_user_authenticated()) { # check for access enabled # This also makes sure the cookie is valid if (OFF == current_user_get_field('enabled')) { print_header_redirect('logout_page.php'); } } else { # not logged in if (is_blank($p_return_page)) { if (!isset($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING']; } $p_return_page = $_SERVER['REQUEST_URI']; } $p_return_page = string_url($p_return_page); print_header_redirect('login_page.php?return=' . $p_return_page); } }
################################################################# $a_configParams['api_key'] = array('name' => Mantis2mitePlugin::DB_FIELD_API_KEY, 'value' => current_user_get_field(Mantis2mitePlugin::DB_FIELD_API_KEY), 'label' => lang_get('plugin_mite_api_key'), 'type' => 'text', 'readonly' => '', 'cssClass' => '', 'help' => ''); if ($a_configParams['api_key']['value']) { $a_configParams['api_key']['value'] = Mantis2mitePlugin::decodeValue($a_configParams['api_key']['value']); } $a_configParams['account_name'] = array('name' => Mantis2mitePlugin::DB_FIELD_ACCOUNT_NAME, 'value' => current_user_get_field(Mantis2mitePlugin::DB_FIELD_ACCOUNT_NAME), 'label' => lang_get('plugin_mite_account_name'), 'type' => 'text', 'readonly' => '', 'cssClass' => '', 'help' => ''); if ($a_configParams['account_name']['value']) { $a_configParams['account_name']['value'] = Mantis2mitePlugin::decodeValue($a_configParams['account_name']['value']); } # get the path to this plugin $s_pluginDirPath = helper_mantis_url("plugins/" . plugin_get_current() . "/"); # get connection status $b_miteConnectionVerified = current_user_get_field(Mantis2mitePlugin::DB_FIELD_CONNECT_VERIFIED); # add options if the connection was verified ############################################ if ($b_miteConnectionVerified) { $s_miteConnectionStatus = sprintf(lang_get('plugin_mite_connection_verified'), current_user_get_field(Mantis2mitePlugin::DB_FIELD_CONNECT_LAST_UPDATED)); $s_connectionStatusCssClass = 'plugin_mite_positive_connection_status'; $a_configParams['account_name']['readonly'] = $a_configParams['api_key']['readonly'] = " readonly='readonly'"; $a_configParams['account_name']['cssClass'] = $a_configParams['api_key']['cssClass'] = " class='readonly'"; $a_configParams['api_key']['type'] = "password"; $b_visibleBtnUnbindConnection = $b_visibleLinkChangeApiKey = $b_visibleLinkChangeAccountName = true; $s_bgUserAccountDataCssClass = 'mite_user_account_active'; } else { $s_miteConnectionStatus = lang_get('plugin_mite_connection_unverified'); $s_connectionStatusCssClass = 'plugin_mite_negative_connection_status'; $s_bgUserAccountDataCssClass = 'mite_user_account_inactive'; } $s_output = "\n\t\t<noscript>\n\t \t\t<div class='plugin_mite_text_if_no_javascript'>" . lang_get('plugin_mite_no_javascript_enabled') . "\n\t \t\t</div>\n \t\t</noscript>\n\t \t<div class='plugin_mite_hide_if_no_javascript'>\n\t\t<div id='plugin_mite_messages'>\n\t\t\t<div>\n\t\t\t\t<a class='closeBtn' href='#'>" . lang_get('plugin_mite_msg_close_message') . "</a>\n\t\t\t\t<p></p>\n\t\t\t</div>\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_missing_account_data') . "' \n\t\t\t\t id='plugin_mite_msg_missing_account_data' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_success_saving_bindings') . "' \n\t\t\t\t id='plugin_mite_msg_success_saving_bindings' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_error_saving_bindings') . "' \n\t\t\t\t id='plugin_mite_msg_error_saving_bindings' />\t \n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_success_verification') . "' \n\t\t\t\t id='plugin_mite_msg_success_verification' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_success_updating_account_data') . "' \n\t\t\t\t id='plugin_mite_msg_success_updating_account_data' />\t \n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_error_verification') . "' \n\t\t\t\t id='plugin_mite_msg_error_verification' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_txt_error_updating_account_data') . "' \n\t\t\t\t id='plugin_mite_txt_error_updating_account_data' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_confirm_changing_account') . "' \n\t\t\t\t id='plugin_mite_msg_confirm_changing_account' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_confirm_disconnecting_account') . "' \n\t\t\t\t id='plugin_mite_msg_confirm_disconnecting_account' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_confirm_changing_api_key') . "' \n\t\t\t\t id='plugin_mite_msg_confirm_changing_api_key' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_success_disconnecting_account') . "' \n\t\t\t\t id='plugin_mite_msg_success_disconnecting_account' />\t \n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_error_disconnecting_account') . "' \n\t\t\t\t id='plugin_mite_msg_error_disconnecting_account' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_error_loading_binding_area') . "' \n\t\t\t\t id='plugin_mite_msg_error_loading_binding_area' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_connection_verified') . "' \n\t\t\t\t\t\t\t \t id='plugin_mite_txt_connection_verified' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_connection_unverified') . "' \n\t\t\t\t\t\t\t\t id='plugin_mite_txt_connection_unverified' />\n\t\t\t<input type='hidden' value='" . $s_pluginDirPath . "' id='plugin_mite_path' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_loading_user_bindings') . "' \n\t\t\t\t\t\t\t\t id='plugin_mite_txt_loading_user_bindings' />\n\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_msg_database_error') . "' \n\t\t\t\t\t\t\t\t id='plugin_mite_msg_database_error' />\t\t\t\t\t \n\t\t\t\n\t\t</div><!-- plugin_mite_messages -->\n\t\t<div id='plugin_mite_config'>\n\t\t<form id='frm_mite_account_data'>\n\t\t\n\t\t<h2>" . lang_get('plugin_mite_user_config_header') . "</h2>\n\t\n\t<!-- connection status -->\t \n\t\t<div id='plugin_mite_connection_status' class='" . $s_connectionStatusCssClass . "'>" . $s_miteConnectionStatus . "\n\t\t</div>\n\t\t\n\t<!-- account name -->\n\t\t<div class='config_fields {$s_bgUserAccountDataCssClass}'>\n\t\t\t<label>" . $a_configParams['account_name']['label'] . "</label>\n\t\t\thttps://\n\t\t\t<input type='" . $a_configParams['account_name']['type'] . "' \n\t\t\t\t name='" . $a_configParams['account_name']['name'] . "' \n\t\t\t\t value='" . $a_configParams['account_name']['value'] . "'" . $a_configParams['account_name']['cssClass'] . $a_configParams['account_name']['readonly'] . " \n\t\t\t\t id='plugin_mite_account_name' />.mite.yo.lk\n\t\t\t<span class='linkChangeValue'>\n\t\t\t\t<a href='#' id='plugin_mite_change_account_name'\n\t\t\t\t style='display:" . ($b_visibleLinkChangeAccountName ? 'block' : 'none') . "'>" . lang_get('plugin_mite_change_account_name') . "</a>\n\t\t\t</span>\t\t\n\t\t\t\t\t\t \n\t<!-- API key -->\n\t\t\t<label>" . $a_configParams['api_key']['label'] . "</label>\n\t\t\t<input type='" . $a_configParams['api_key']['type'] . "' \n\t\t\t\t name='" . $a_configParams['api_key']['name'] . "' \n\t\t\t\t value='" . $a_configParams['api_key']['value'] . "'" . $a_configParams['api_key']['cssClass'] . $a_configParams['api_key']['readonly'] . " \n\t\t\t\t id='plugin_mite_account_api_key' />\n\t\t\t<span class='linkChangeValue'>\n\t\t\t\t<a href='#' id='plugin_mite_change_api_key'\n\t\t\t\t style='display:" . ($b_visibleLinkChangeApiKey ? 'block' : 'none') . "'>" . lang_get('plugin_mite_change_api_key') . "</a>\n\t\t\t</span>\n\t\t</div>\n\t\t\n\t<!-- button area -->\n\t\t<div class='formularButtons'>\n\t\t\t<div class='buttonsRight'>\n\t\t\t\t<button id='plugin_mite_check_account_data' type='submit'>" . lang_get('plugin_mite_check_account_data') . "\n\t\t\t\t</button>\n\t\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_check_account_data_active') . "' \n\t\t\t\t\t\t\t id='plugin_mite_txt_check_account_data_active' />\n\t\t\t</div>\n\t\t\t<div class='buttonsLeft'>\n\t\t\t\t<button id='plugin_mite_disconnect_account_data' \n\t\t\t\t\tstyle='display:" . ($b_visibleBtnUnbindConnection ? 'block' : 'none') . "'>" . lang_get('plugin_mite_disconnect_account_data') . "\n\t\t\t\t</button>\n\t\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_disconnecting_account_data_active') . "' \n\t\t\t\t\t\t\t id='plugin_mite_disconnecting_account_data_active' />\n\t\t\t</div>\n\t\t\t<div class='clearBoth'></div>\n\t\t</div>\n\t\n\t\t</form>\n\t\t<div id='plugin_mite_user_bindings'></div>\n\t\t</div><!-- plugin_mite_config -->\n\t\t</div><!-- plugin_mite_hide_if_no_javascript -->"; echo $s_output; html_page_bottom1(__FILE__);
/** * return rss news feed url * @param int $p_project_id * @param string $p_username * @param bool $p_relative * @return string */ function rss_get_news_feed_url($p_project_id = null, $p_username = null, $p_relative = true) { if ($p_username === null) { $t_username = current_user_get_field('username'); } else { $t_username = $p_username; } if ($p_project_id === null) { $t_project_id = helper_get_current_project(); } else { $t_project_id = (int) $p_project_id; } if ($p_relative) { $t_rss_link = ''; } else { $t_rss_link = config_get('path'); } $t_user_id = user_get_id_by_name($t_username); // If we have a logged in user then they can be given a 'proper' feed, complete with auth string. if (user_is_anonymous($t_user_id)) { $t_rss_link .= "news_rss.php"; if ($t_project_id != ALL_PROJECTS) { $t_rss_link .= "?project_id={$t_project_id}"; } } else { $t_rss_link .= "news_rss.php?username={$t_username}&key=" . rss_calculate_key($t_user_id); if ($t_project_id != ALL_PROJECTS) { $t_rss_link .= "&project_id={$t_project_id}"; } } return $t_rss_link; }
foreach (Mantis2mitePlugin::$a_rsrcTypes as $s_type) { $a_selectBoxesRsrc[$s_type] = ''; $s_selectBoxRsrc = ''; $i_sizeSelectBox = 0; if ($s_type == Mantis2mitePlugin::API_RSRC_P) { $s_selectBoxRsrc .= "<option value=''>" . lang_get('plugin_mite_please_select') . "</option>"; } foreach ($a_userMiteRsrces[$s_type] as $i_miteRsrc_id => $a_rsrc) { $s_selectBoxRsrc .= "<option value='{$i_miteRsrc_id}'"; # mark as selected if it is binded if (isset($a_userMiteBindings[$s_type][$i_miteRsrc_id]) && in_array($i_project_id, $a_userMiteBindings[$s_type][$i_miteRsrc_id])) { $s_selectBoxRsrc .= " selected='selected'"; } $s_selectBoxRsrc .= ">" . $a_rsrc['name'] . "</option>"; } $i_sizeSelectBox = count($a_userMiteRsrces[$s_type]); $a_selectBoxesRsrc[$s_type] = " \n\t\t\t\t<select name='sb_plugin_mite_" . $s_type . "_mantis_project_" . $i_project_id . "[]' \n\t\t\t\t\tclass='sb_plugin_mite_" . $s_type . "'"; # only allow selecting multiple entries for services if ($s_type == Mantis2mitePlugin::API_RSRC_S) { $a_selectBoxesRsrc[$s_type] .= " multiple='multiple'"; } else { $i_sizeSelectBox = 1; } $a_selectBoxesRsrc[$s_type] .= "size='{$i_sizeSelectBox}'>{$s_selectBoxRsrc}</select>"; } $s_quickLinksList .= "<li><a href='#project_{$i_project_id}'>{$s_projectName}</li>"; $s_projectsBindingOptions .= " \n\t\t\t<a name='project_" . $i_project_id . "'></a>\n\t\t\t<fieldset><legend>" . $s_projectName . "</legend>\n\t\t\t\t<label>" . lang_get('plugin_mite_assignment_mite_project') . "</label>" . $a_selectBoxesRsrc[Mantis2mitePlugin::API_RSRC_P] . "\n\t\t\t\t<label>" . lang_get('plugin_mite_assignment_mite_service') . "</label>" . $a_selectBoxesRsrc[Mantis2mitePlugin::API_RSRC_S] . "\n\t\t\t</fieldset>"; } $s_quickLinksList .= "</ul>"; $s_output .= " \n\t\t<label>" . lang_get('plugin_mite_header_note_pattern') . "</label>\n\t\t<p class='bindings_help'>" . lang_get('plugin_mite_help_note_pattern') . "</p>\t\n\t\t\t<input type='text' class='note_pattern' name='" . Mantis2mitePlugin::DB_FIELD_NOTE_PATTERN . "' \n\t\t\t\t value='" . stripslashes(current_user_get_field(Mantis2mitePlugin::DB_FIELD_NOTE_PATTERN)) . "' />\n\t\t<label>" . lang_get('plugin_mite_header_interconnections') . "</label>\n\t\t<p class='bindings_help'>" . lang_get('plugin_mite_help_interconnections') . "</p>\n\t\t\t{$s_quickLinksList}\n\t\t\t{$s_projectsBindingOptions}\n\t\t<div class='formularButtons'>\n\t\t\t<div class='buttonsRight'>\n\t\t\t\t<button id='plugin_mite_save_bindings' type='submit'>" . lang_get('plugin_mite_save_bindings') . "\n\t\t\t\t</button>\n\t\t\t\t<input type='hidden' value='" . lang_get('plugin_mite_save_bindings_active') . "' \n\t\t\t\t\t\t\t\t\t id='plugin_mite_save_bindings_active' />\n\t\t\t</div>\n\t\t\t<div class='buttonsLeft'>\n\t\t\t\t<input type='reset' value='" . lang_get('plugin_mite_reset_form') . "' \n\t\t\t\t\t id='plugin_mite_reset_bindings' />\n\t\t\t</div>\n\t\t\t<div class='clearBoth'></div>\n\t\t</div>\t\t\t\n\t\t</table>\n\t\t</form>"; echo $s_output;
/** * Print the main menu * @return null */ function print_menu() { if (auth_is_user_authenticated()) { $t_protected = current_user_get_field('protected'); $t_current_project = helper_get_current_project(); $t_menu_options = array(); # Main Page $t_menu_options[] = '<a href="' . helper_mantis_url('main_page.php') . '">' . lang_get('main_link') . '</a>'; # Plugin / Event added options $t_event_menu_options = event_signal('EVENT_MENU_MAIN_FRONT'); foreach ($t_event_menu_options as $t_plugin => $t_plugin_menu_options) { foreach ($t_plugin_menu_options as $t_callback => $t_callback_menu_options) { if (is_array($t_callback_menu_options)) { $t_menu_options = array_merge($t_menu_options, $t_callback_menu_options); } else { if (!is_null($t_callback_menu_options)) { $t_menu_options[] = $t_callback_menu_options; } } } } # My View $t_menu_options[] = '<a href="' . helper_mantis_url('my_view_page.php">') . lang_get('my_view_link') . '</a>'; # View Bugs $t_menu_options[] = '<a href="' . helper_mantis_url('view_all_bug_page.php">') . lang_get('view_bugs_link') . '</a>'; # Report Bugs if (access_has_project_level(config_get('report_bug_threshold'))) { $t_menu_options[] = string_get_bug_report_link(); } # Changelog Page if (access_has_project_level(config_get('view_changelog_threshold'))) { $t_menu_options[] = '<a href="' . helper_mantis_url('changelog_page.php">') . lang_get('changelog_link') . '</a>'; } # Roadmap Page if (access_has_project_level(config_get('roadmap_view_threshold'))) { $t_menu_options[] = '<a href="' . helper_mantis_url('roadmap_page.php">') . lang_get('roadmap_link') . '</a>'; } # Summary Page if (access_has_project_level(config_get('view_summary_threshold'))) { $t_menu_options[] = '<a href="' . helper_mantis_url('summary_page.php">') . lang_get('summary_link') . '</a>'; } # Project Documentation Page if (ON == config_get('enable_project_documentation')) { $t_menu_options[] = '<a href="' . helper_mantis_url('proj_doc_page.php">') . lang_get('docs_link') . '</a>'; } # Project Wiki if (config_get_global('wiki_enable') == ON) { $t_menu_options[] = '<a href="' . helper_mantis_url('wiki.php?type=project&id=') . $t_current_project . '">' . lang_get('wiki') . '</a>'; } # Plugin / Event added options $t_event_menu_options = event_signal('EVENT_MENU_MAIN'); foreach ($t_event_menu_options as $t_plugin => $t_plugin_menu_options) { foreach ($t_plugin_menu_options as $t_callback => $t_callback_menu_options) { if (is_array($t_callback_menu_options)) { $t_menu_options = array_merge($t_menu_options, $t_callback_menu_options); } else { if (!is_null($t_callback_menu_options)) { $t_menu_options[] = $t_callback_menu_options; } } } } # Manage Users (admins) or Manage Project (managers) or Manage Custom Fields if (access_has_global_level(config_get('manage_site_threshold'))) { $t_link = helper_mantis_url('manage_overview_page.php'); $t_menu_options[] = '<a class="manage-menu-link" href="' . $t_link . '">' . lang_get('manage_link') . '</a>'; } else { $t_show_access = min(config_get('manage_user_threshold'), config_get('manage_project_threshold'), config_get('manage_custom_fields_threshold')); if (access_has_global_level($t_show_access) || access_has_any_project($t_show_access)) { $t_current_project = helper_get_current_project(); if (access_has_global_level(config_get('manage_user_threshold'))) { $t_link = helper_mantis_url('manage_user_page.php'); } else { if (access_has_project_level(config_get('manage_project_threshold'), $t_current_project) && $t_current_project != ALL_PROJECTS) { $t_link = helper_mantis_url('manage_proj_edit_page.php?project_id=') . $t_current_project; } else { $t_link = helper_mantis_url('manage_proj_page.php'); } } $t_menu_options[] = "<a href=\"{$t_link}\">" . lang_get('manage_link') . '</a>'; } } # News Page if (news_is_enabled() && access_has_project_level(config_get('manage_news_threshold'))) { # Admin can edit news for All Projects (site-wide) if (ALL_PROJECTS != helper_get_current_project() || current_user_is_administrator()) { $t_menu_options[] = '<a href="' . helper_mantis_url('news_menu_page.php">') . lang_get('edit_news_link') . '</a>'; } else { $t_menu_options[] = '<a href="' . helper_mantis_url('login_select_proj_page.php">') . lang_get('edit_news_link') . '</a>'; } } # Account Page (only show accounts that are NOT protected) if (OFF == $t_protected) { $t_menu_options[] = '<a class="account-menu-link" href="' . helper_mantis_url('account_page.php">') . lang_get('account_link') . '</a>'; } # Add custom options $t_custom_options = prepare_custom_menu_options('main_menu_custom_options'); $t_menu_options = array_merge($t_menu_options, $t_custom_options); # Time Tracking / Billing if (config_get('time_tracking_enabled') && access_has_global_level(config_get('time_tracking_reporting_threshold'))) { $t_menu_options[] = '<a href="' . helper_mantis_url('billing_page.php">') . lang_get('time_tracking_billing_link') . '</a>'; } # Logout (no if anonymously logged in) if (!current_user_is_anonymous()) { $t_menu_options[] = '<a id="logout-link" href="' . helper_mantis_url('logout_page.php">') . lang_get('logout_link') . '</a>'; } echo '<form method="post" action="' . helper_mantis_url('jump_to_bug.php" class="bug-jump-form">'); echo '<fieldset class="bug-jump">'; # CSRF protection not required here - form does not result in modifications $t_bug_label = lang_get('issue_id'); echo '<input type="hidden" name="bug_label" value="', $t_bug_label, '" />'; echo '<input type="text" name="bug_id" size="10" class="small" /> '; echo '<input type="submit" class="button-small" value="' . lang_get('jump') . '" /> '; echo '</fieldset>'; echo '</form>'; echo '<div class="main-menu">'; echo '<div>'; echo '<ul class="menu">'; echo '<li>'; echo implode($t_menu_options, "</li>\n<li>"); echo '</li>'; echo '</ul>'; echo '</div>'; echo '</div>'; } }
<?php require "worklog_api.php"; access_ensure_global_level(plugin_config_get('worklog_view_threshold')); html_page_top1(); html_page_top2(); # Select the faq posts $minimum_level = access_get_global_level(); $t_where_clausole = "view_access <= {$minimum_level}"; if (!isset($_POST['f_all_user']) || !isset($_GET['f_all_user'])) { //allow show all youser $t_where_clausole .= " and poster_id = " . current_user_get_field("id"); } else { if (!isset($_POST['f_user_id'])) { //show by userId $t_where_clausole .= " and poster_id = " . gpc_get_int("poster_id"); } } $p_project_id = helper_get_current_project(); if ($p_project_id != 0) { //pk remove filter by project $t_where_clausole .= " and ((project_id='" . $p_project_id . "' OR project_id=0)"; $t_project_ids = project_hierarchy_get_subprojects($p_project_id); foreach ($t_project_ids as $value) { $t_where_clausole .= " or project_id='" . $value . "'"; } $t_where_clausole .= ")"; } $f_search = $_POST["f_search"]; if (!isset($f_search)) { $f_search = "";
function current_user_is_anonymous() { if (auth_is_user_authenticated()) { return ON == config_get('allow_anonymous_login') && current_user_get_field('username') == config_get('anonymous_account'); } else { return false; } }
function print_menu() { if (auth_is_user_authenticated()) { $t_protected = current_user_get_field('protected'); $t_current_project = helper_get_current_project(); print '<table class="width100" cellspacing="0">'; print '<tr>'; print '<td class="menu">'; $t_menu_options = array(); # Main Page $t_menu_options[] = '<a href="main_page.php">' . lang_get('main_link') . '</a>'; # My View $t_menu_options[] = '<a href="my_view_page.php">' . lang_get('my_view_link') . '</a>'; # View Bugs $t_menu_options[] = '<a href="view_all_bug_page.php">' . lang_get('view_bugs_link') . '</a>'; # Report Bugs if (access_has_project_level(config_get('report_bug_threshold'))) { $t_menu_options[] = string_get_bug_report_link(); } # Changelog Page if (access_has_project_level(config_get('view_changelog_threshold'))) { $t_menu_options[] = '<a href="changelog_page.php">' . lang_get('changelog_link') . '</a>'; } # Roadmap Page if (access_has_project_level(config_get('roadmap_view_threshold'))) { $t_menu_options[] = '<a href="roadmap_page.php">' . lang_get('roadmap_link') . '</a>'; } # Summary Page if (access_has_project_level(config_get('view_summary_threshold'))) { $t_menu_options[] = '<a href="summary_page.php">' . lang_get('summary_link') . '</a>'; } # Project Documentation Page if (ON == config_get('enable_project_documentation')) { $t_menu_options[] = '<a href="proj_doc_page.php">' . lang_get('docs_link') . '</a>'; } # Project Wiki if (wiki_is_enabled()) { $t_menu_options[] = '<a href="wiki.php?type=project&id=' . $t_current_project . '">' . lang_get('wiki') . '</a>'; } # Manage Users (admins) or Manage Project (managers) or Manage Custom Fields $t_show_access = min(config_get('manage_user_threshold'), config_get('manage_project_threshold'), config_get('manage_custom_fields_threshold')); if (access_has_global_level($t_show_access) || access_has_any_project($t_show_access)) { $t_current_project = helper_get_current_project(); if (access_has_global_level(config_get('manage_user_threshold'))) { $t_link = 'manage_user_page.php'; } else { if (access_has_project_level(config_get('manage_project_threshold'), $t_current_project) && $t_current_project != ALL_PROJECTS) { $t_link = 'manage_proj_edit_page.php?project_id=' . $t_current_project; } else { $t_link = 'manage_proj_page.php'; } } $t_menu_options[] = "<a href=\"{$t_link}\">" . lang_get('manage_link') . '</a>'; } # News Page if (access_has_project_level(config_get('manage_news_threshold'))) { # Admin can edit news for All Projects (site-wide) if (ALL_PROJECTS != helper_get_current_project() || access_has_project_level(ADMINISTRATOR)) { $t_menu_options[] = '<a href="news_menu_page.php">' . lang_get('edit_news_link') . '</a>'; } else { $t_menu_options[] = '<a href="login_select_proj_page.php">' . lang_get('edit_news_link') . '</a>'; } } # Account Page (only show accounts that are NOT protected) if (OFF == $t_protected) { $t_menu_options[] = '<a href="account_page.php">' . lang_get('account_link') . '</a>'; } # Add custom options $t_custom_options = prepare_custom_menu_options('main_menu_custom_options'); $t_menu_options = array_merge($t_menu_options, $t_custom_options); if (config_get('time_tracking_enabled') && config_get('time_tracking_with_billing')) { $t_menu_options[] = '<a href="billing_page.php">' . lang_get('time_tracking_billing_link') . '</a>'; } # Logout (no if anonymously logged in) if (!current_user_is_anonymous()) { $t_menu_options[] = '<a href="logout_page.php">' . lang_get('logout_link') . '</a>'; } print implode($t_menu_options, ' | '); print '</td>'; print '<td class="menu right nowrap">'; print '<form method="post" action="jump_to_bug.php">'; if (ON == config_get('use_javascript')) { $t_bug_label = lang_get('issue_id'); print "<input type=\"text\" name=\"bug_id\" size=\"10\" class=\"small\" value=\"{$t_bug_label}\" onfocus=\"if (this.value == '{$t_bug_label}') this.value = ''\" onblur=\"if (this.value == '') this.value = '{$t_bug_label}'\" /> "; } else { print "<input type=\"text\" name=\"bug_id\" size=\"10\" class=\"small\" /> "; } print '<input type="submit" class="button-small" value="' . lang_get('jump') . '" /> '; print '</form>'; print '</td>'; print '</tr>'; print '</table>'; } }
private function get_plugin_menu() { $t_protected = current_user_get_field('protected'); $t_current_project = helper_get_current_project(); $t_menu_options = array(); # Plugin / Event added options $t_event_menu_options = event_signal('EVENT_MENU_MAIN'); foreach ($t_event_menu_options as $t_plugin => $t_plugin_menu_options) { foreach ($t_plugin_menu_options as $t_callback => $t_callback_menu_options) { if (is_array($t_callback_menu_options)) { $t_menu_options = array_merge($t_menu_options, $t_callback_menu_options); } else { if (!is_null($t_callback_menu_options)) { $t_menu_options[] = $t_callback_menu_options; } } } } if ($t_menu_options) { echo ' <li class="divider-vertical"></li> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">Plugin <span class="caret"></span></a> <ul class="dropdown-menu"> '; echo '<li>' . implode($t_menu_options, ' </li> <li> ') . '</li>'; echo ' </ul> </li> </ul> '; } }
function email_bug_reminder($p_recipients, $p_bug_id, $p_message) { if (!is_array($p_recipients)) { $p_recipients = array($p_recipients); } $t_project_id = bug_get_field($p_bug_id, 'project_id'); $t_sender_id = auth_get_current_user_id(); $t_sender = user_get_name($t_sender_id); $t_subject = email_build_subject($p_bug_id); $t_date = date(config_get('normal_date_format')); $result = array(); foreach ($p_recipients as $t_recipient) { lang_push(user_pref_get_language($t_recipient, $t_project_id)); $t_email = user_get_email($t_recipient); $result[] = user_get_name($t_recipient); if (access_has_project_level(config_get('show_user_email_threshold'), $t_project_id, $t_recipient)) { $t_sender_email = ' <' . current_user_get_field('email') . '>'; } else { $t_sender_email = ''; } $t_header = "\n" . lang_get('on') . " {$t_date}, {$t_sender} {$t_sender_email} " . lang_get('sent_you_this_reminder_about') . ": \n\n"; $t_contents = $t_header . string_get_bug_view_url_with_fqdn($p_bug_id, $t_recipient) . " \n\n{$p_message}"; if (ON == config_get('enable_email_notification')) { email_store($t_email, $t_subject, $t_contents); } lang_pop(); } if (OFF == config_get('email_send_using_cronjob')) { email_send_all(); } return $result; }
<br> </br> <br> </br> <h2 align="center"><?php print_bracket_link(plugin_page('install_db_voc'), plugin_lang_get('install_db_voc')); ?> </form> <?php $t_username = current_user_get_field('username'); $t_access_level = get_enum_element('access_levels', current_user_get_access_level()); $t_now = date(config_get('complete_date_format')); $t_realname = current_user_get_field('realname'); ?> <br> </br> <?php $dt = $_POST['date_year'] . '-' . $_POST['date_month'] . '-' . $_POST['date_day']; $dt = $date_year . '-' . $date_month . '-' . $date_day; //echo $dt; $datestamp = date("Y/m/d", strtotime($dt)); exit; ?>
$f_question = gpc_get_string('question'); $f_answere = gpc_get_string('answere'); $f_project_id = gpc_get_string('project_id'); ?> <?php # Add faq Form BEGIN ?> <p> <div align="center"> <form method="post" action="<?php echo $g_faq_add; ?> "> <input type="hidden" name="f_poster_id" value="<?php echo current_user_get_field("id"); ?> "> <table class="width75" cellspacing="1"> <tr> <td class="form-title" colspan="2"> <?php echo plugin_lang_get('add_faq_title'); ?> </td> </tr> <tr class="row-1"> <td class="category" width="25%"> <?php echo plugin_lang_get('question'); ?>
/** * returns the commands from the current users's teams. * */ private function getAvailableCommands($project_id) { $cmdList = array(); $userid = current_user_get_field('id'); // find user teams $query = "SELECT DISTINCT codev_team_table.id, codev_team_table.name " . "FROM `codev_team_user_table`, `codev_team_table` " . "WHERE codev_team_user_table.team_id = codev_team_table.id " . "AND codev_team_user_table.user_id = " . db_param(); // only teams where project is defined $query .= "AND 1 = is_project_in_team(" . (int) $project_id . ", codev_team_table.id) "; $query .= "ORDER BY codev_team_table.name"; $result = db_query_bound($query, array($userid)); $teamidList = array(); while ($row = db_fetch_array($result)) { $teamidList[] = $row['id']; #echo "getAvailableCommands() FOUND $row['id'] - $row['name']<br/>"; } // find team Commands if (0 != count($teamidList)) { $formattedTeamList = implode(", ", $teamidList); $query = "SELECT id, name, reference FROM `codev_command_table` " . "WHERE team_id IN (" . $formattedTeamList . ") " . "AND enabled = 1 "; // do not include closed commands. $query .= "AND state < 6 "; // WARN: HARDCODED value of Command::$state_closed $query .= "ORDER BY reference, name"; $result = db_query_bound($query); $cmdList = array(); while ($row = db_fetch_array($result)) { $cmdList[$row['id']] = $row['reference'] . " :: " . $row['name']; } } return $cmdList; }
html_set_rss_link($t_rss_link); } html_page_top1(); html_page_top2(); if (!current_user_is_anonymous()) { echo '<div class="quick-summary-left">'; echo lang_get('open_and_assigned_to_me') . ': '; echo '<a class="subtle" href="view_all_set.php?type=1&handler_id=' . auth_get_current_user_id() . '&hide_status=' . RESOLVED . '">' . current_user_get_assigned_open_bug_count() . '</a>'; echo '</div>'; echo '<div class="quick-summary-right">'; echo lang_get('open_and_reported_to_me') . ': '; echo '<a class="subtle" href="view_all_set.php?type=1&reporter_id=' . auth_get_current_user_id() . '&hide_status=' . RESOLVED . '">' . current_user_get_reported_open_bug_count() . '</a>'; echo '</div>'; echo '<div class="quick-summary-left">'; echo lang_get('last_visit') . ': '; echo print_date(config_get('normal_date_format'), db_unixtimestamp(current_user_get_field('last_visit'))); echo '</div>'; } echo '<br />'; echo '<br />'; echo '<br />'; $t_news_rows = news_get_limited_rows($f_offset, $t_project_id); $t_news_count = count($t_news_rows); # Loop through results for ($i = 0; $i < $t_news_count; $i++) { $t_row = $t_news_rows[$i]; # only show VS_PRIVATE posts to configured threshold and above if (VS_PRIVATE == $t_row['view_state'] && !access_has_project_level(config_get('private_news_threshold'))) { continue; } print_news_entry_from_row($t_row);
* @local booleans */ $b_pageHasUserTimeEnries = $b_showOtherUsers = $b_showSummaryForCurrentUser = $b_userIsConnected = false; ############ # ACTION ####### $o_pluginController = $g_plugin_cache['Mantis2mite']; $i_currentUserId = $o_pluginController->getCurrentUserId(); $i_bugId = $_GET['bug_id']; $i_projectId = $_GET['project_id']; if (current_user_get_field(Mantis2mitePlugin::DB_FIELD_CONNECT_VERIFIED)) { $b_userIsConnected = true; $a_users[$i_currentUserId] = array('id' => $i_currentUserId, 'username' => current_user_get_field('username'), 'realname' => current_user_get_field('realname')); } # if the current user can see every entry if (current_user_get_field('access_level') >= plugin_config_get('mite_timetracks_visible_threshold_level')) { $b_showOtherUsers = true; $b_showSummaryForCurrentUser = true; $s_query = "SELECT id, username, realname FROM " . db_get_table('mantis_user_table') . " WHERE mite_connection_verified = 1 ORDER by realname"; $r_result = db_query_bound($s_query); if (db_num_rows($r_result) > 0) { while ($a_row = db_fetch_array($r_result)) { $a_users[$a_row['id']] = $a_row; } } } # loop through all users foreach ($a_users as $i_userId => $a_properties) { # get all mite projects and services of the user ################################################ $s_query = "SELECT type, name, mite_project_id , mite_service_id FROM " . plugin_table(Mantis2mitePlugin::DB_TABLE_PS) . " WHERE user_id = " . $i_userId;
} html_page_top(lang_get('main_link')); if (!current_user_is_anonymous()) { $t_current_user_id = auth_get_current_user_id(); $t_hide_status = config_get('bug_resolved_status_threshold'); echo '<div class="quick-summary-left">'; echo lang_get('open_and_assigned_to_me_label') . lang_get('word_separator'); print_link("view_all_set.php?type=1&handler_id={$t_current_user_id}&hide_status={$t_hide_status}", current_user_get_assigned_open_bug_count(), false, 'subtle'); echo '</div>'; echo '<div class="quick-summary-right">'; echo lang_get('open_and_reported_to_me_label') . lang_get('word_separator'); print_link("view_all_set.php?type=1&reporter_id={$t_current_user_id}&hide_status={$t_hide_status}", current_user_get_reported_open_bug_count(), false, 'subtle'); echo '</div>'; echo '<div class="quick-summary-left">'; echo lang_get('last_visit_label') . lang_get('word_separator'); echo date(config_get('normal_date_format'), current_user_get_field('last_visit')); echo '</div>'; } if (news_is_enabled()) { $t_news_rows = news_get_limited_rows($f_offset, $t_project_id); $t_news_count = count($t_news_rows); if ($t_news_count) { echo '<div id="news-items">'; # Loop through results for ($i = 0; $i < $t_news_count; $i++) { $t_row = $t_news_rows[$i]; # only show VS_PRIVATE posts to configured threshold and above if (VS_PRIVATE == $t_row['view_state'] && !access_has_project_level(config_get('private_news_threshold'))) { continue; } print_news_entry_from_row($t_row);
foreach ($a_projectBindedRsrces as $s_type => $a_miteRsrces) { foreach ($a_miteRsrces as $i_rsrc_id => $a_rsrc) { $a_selectBoxesNewTimeEntry[$s_type] .= "<option value='" . $i_rsrc_id . "'>" . $a_rsrc['name'] . "</option>"; } } # add unbinded resources as select box entries if any foreach ($a_projectUnbindedRsrces as $s_type => $a_miteRsrces) { $s_unbindedRsrces = ''; foreach ($a_miteRsrces as $i_miteRsrc_id => $a_rsrc) { $s_unbindedRsrces .= "<option value='{$i_miteRsrc_id}'>" . $a_rsrc['name'] . "</option>"; } if (!empty($a_projectBindedRsrces[$s_type])) { $a_selectBoxesNewTimeEntry[$s_type] .= "<optgroup label='" . lang_get('plugin_mite_other_' . $s_type) . "'>" . $s_unbindedRsrces . "</optgroup>"; } else { $a_selectBoxesNewTimeEntry[$s_type] .= $s_unbindedRsrces; } } # wrap the available entries with the HTML select tag $a_selectBoxesNewTimeEntry[Mantis2mitePlugin::API_RSRC_P] = "\n\t\t\t<select name='plugin_mite_" . Mantis2mitePlugin::API_RSRC_P . "_new_time_entry' \n\t\t\t\t\tid='plugin_mite_" . Mantis2mitePlugin::API_RSRC_P . "_new_time_entry'>" . $a_selectBoxesNewTimeEntry[Mantis2mitePlugin::API_RSRC_P] . "</select>"; # wrap the available entries with the HTML select tag $a_selectBoxesNewTimeEntry[Mantis2mitePlugin::API_RSRC_S] = "\n\t\t\t<select name='plugin_mite_" . Mantis2mitePlugin::API_RSRC_S . "_new_time_entry' \n\t\t\t\t\tid='plugin_mite_" . Mantis2mitePlugin::API_RSRC_S . "_new_time_entry'>" . $a_selectBoxesNewTimeEntry[Mantis2mitePlugin::API_RSRC_S] . "</select>"; if (count($a_projectBindedRsrces[Mantis2mitePlugin::API_RSRC_P]) == 1) { # dirty... $i_bindedMiteProject_id = current($a_projectBindedRsrces[Mantis2mitePlugin::API_RSRC_P]); $i_bindedMiteProject_id = $i_bindedMiteProject_id['mite_project_id']; $a_selectBoxesNewTimeEntry[Mantis2mitePlugin::API_RSRC_P] = $a_projectBindedRsrces[Mantis2mitePlugin::API_RSRC_P][$i_bindedMiteProject_id]['name'] . "\n\t\t\t<input type='hidden' name='plugin_mite_projects_new_time_entry' \n\t\t\t\t value='" . $i_bindedMiteProject_id . "' id='plugin_mite_projects_new_time_entry' />"; } # add the services select list to the output ########################################### $s_output .= " \n\t\t<fieldset><legend>" . lang_get('plugin_mite_header_new_time_entry') . "</legend>\n\t\t\t<div class='time_entry_param'>\n\t\t\t\t<label for='plugin_mite_date_new_time_entry'>" . lang_get('plugin_mite_header_date_new_time_entry') . "\n\t\t\t\t</label>\n\t\t\t\t<input type='text' name='plugin_mite_date_new_time_entry'\n\t\t\t\t\t id='plugin_mite_date_new_time_entry' value='" . date('Y-m-d') . "' />\n\t\t\t\t<span class='plugin_mite_user_input_helper'>\n\t\t\t\t\t<a tabIndex='-1' href='#'>?</a></span>\n\t\t\t\t<span class='plugin_mite_user_input_helper_text' style='display:none'>" . lang_get('plugin_mite_date_help_text') . "</span>\t \n\t\t\t</div>\n\t\t\t<div class='time_entry_param'>\n\t\t\t\t<label for='plugin_mite_projects_new_time_entry'>" . lang_get('plugin_mite_header_projects_new_time_entry') . "\n\t\t\t\t</label>" . $a_selectBoxesNewTimeEntry[Mantis2mitePlugin::API_RSRC_P] . "\n\t\t\t</div>\n\t\t\t<div class='time_entry_param'>\n\t\t\t\t<label for='plugin_mite_services_new_time_entry'>" . lang_get('plugin_mite_header_services_new_time_entry') . "\n\t\t\t\t</label>" . $a_selectBoxesNewTimeEntry[Mantis2mitePlugin::API_RSRC_S] . "\n\t\t\t</div>\n\t\t\t\n\t\t\t<div class='time_entry_param'>\n\t\t\t\t<label for='plugin_mite_hours_new_time_entry'>" . lang_get('plugin_mite_header_hours_new_time_entry') . "\n\t\t\t\t</label>\n\t\t\t\t<input type='text' name='plugin_mite_hours_new_time_entry' \n\t\t\t\t\t id='plugin_mite_hours_new_time_entry' value='0:00'/>\n\t\t\t\t<span class='plugin_mite_user_input_helper'>\n\t\t\t\t\t<a tabIndex='-1' href='#'>?</a></span>\n\t\t\t\t<span class='plugin_mite_user_input_helper_text' style='display:none'>" . lang_get('plugin_mite_hours_help_text') . "</span>\n\t\t\t</div>\n\t\t\t<div class='time_entry_param'>\n\t\t\t\t<label for='plugin_mite_note_new_time_entry'>" . lang_get('plugin_mite_header_note_new_time_entry') . "\n\t\t\t\t</label>\n\t\t\t\t<span class='plugin_mite_user_input_helper'>\n\t\t\t\t\t<a tabIndex='-1' href='#'>?</a></span>\n\t\t\t\t<span class='plugin_mite_user_input_helper_text' style='display:none'>" . lang_get('plugin_mite_help_note_pattern') . "</span> \n\t\t\t\t<input type='text' name='plugin_mite_note_new_time_entry' \n\t\t\t\t\t id='plugin_mite_note_new_time_entry' autocomplete='off' value='" . stripslashes(Mantis2mitePlugin::replacePlaceHolders(current_user_get_field(Mantis2mitePlugin::DB_FIELD_NOTE_PATTERN), $i_bugId)) . "' />\n\t\t\t</div>\n\t\t\t<div class='formularButtons'>\n\t\t\t\t<div class='buttonsRight'>\n\t\t\t\t\t<button type='submit' id='plugin_mite_add_new_time_entry'>" . lang_get('plugin_mite_add_new_time_entry') . "\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<div class='buttonsLeft'>\n\t\t\t\t\t<a href='#' id='plugin_mite_cancel_adding_time_entry'>" . lang_get('plugin_mite_cancel_adding_time_entry') . "\n\t\t\t\t\t</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</fieldset>"; echo $s_output;
public function replacePlaceHolders($s_text, $i_bugId) { /* * @local string */ $s_modifiedText = ''; $s_modifiedText = str_replace("{bug_id}", $i_bugId, $s_text); $s_modifiedText = str_replace("{bug_summary}", bug_get_field($i_bugId, 'summary'), $s_modifiedText); $s_modifiedText = str_replace("{bug_description}", bug_get_text_field($i_bugId, 'description'), $s_modifiedText); $s_modifiedText = str_replace("{bug_category}", category_full_name(bug_get_field($i_bugId, 'category_id'), false), $s_modifiedText); $s_modifiedText = str_replace("{project_id}", bug_get_field($i_bugId, 'project_id'), $s_modifiedText); $s_modifiedText = str_replace("{project_name}", project_get_name(bug_get_field($i_bugId, 'project_id')), $s_modifiedText); $s_modifiedText = str_replace("{user_id}", current_user_get_field('id'), $s_modifiedText); $s_modifiedText = str_replace("{user_name}", current_user_get_field('username'), $s_modifiedText); # '@L@' is a special placeholder for a '+' since jquery's serialize function # replaces all spaces also with a '+' ############################################################################' $s_modifiedText = str_replace("@L@", "+", $s_modifiedText); return $s_modifiedText; }