public function loadFixtures(TBGScope $scope) { $i18n = TBGContext::getI18n(); $crit = $this->getCriteria(); $crit->addInsert(self::SCOPE, $scope->getID()); $crit->addInsert(self::NAME, "Default workflow scheme"); $crit->addInsert(self::DESCRIPTION, "This is the default workflow scheme. It is used by all projects with no specific workflow scheme selected. This scheme cannot be edited or removed."); $this->doInsert($crit); }
protected static function getFinalTemplateName($template, $module_file = null) { if (!isset($module_file)) { $module_file = self::getModuleAndTemplate($template); } if (($template_name = TBGContext::getI18n()->hasTranslatedTemplate($template, true)) === false) { $template_name = THEBUGGENIE_MODULES_PATH . $module_file['module'] . DS . 'templates' . DS . "_{$module_file['file']}.inc.php"; } return $template_name; }
public function componentFilter() { $i18n = TBGContext::getI18n(); $this->selected_value = isset($this->selected_value) ? $this->selected_value : 0; $this->selected_operator = isset($this->selected_operator) ? $this->selected_operator : '='; $filters = array(); $filters['status'] = array('description' => $i18n->__('Status'), 'options' => TBGStatus::getAll()); $filters['category'] = array('description' => $i18n->__('Category'), 'options' => TBGCategory::getAll()); $filters['priority'] = array('description' => $i18n->__('Priority'), 'options' => TBGPriority::getAll()); $filters['severity'] = array('description' => $i18n->__('Severity'), 'options' => TBGSeverity::getAll()); $filters['reproducability'] = array('description' => $i18n->__('Reproducability'), 'options' => TBGReproducability::getAll()); $filters['resolution'] = array('description' => $i18n->__('Resolution'), 'options' => TBGResolution::getAll()); $filters['issuetype'] = array('description' => $i18n->__('Issue type'), 'options' => TBGIssuetype::getAll()); $this->filters = $filters; }
public function componentAccountSettings() { $i18n = TBGContext::getI18n(); $general_settings = array(); $issues_settings = array(); $general_settings['notify_add_friend'] = $i18n->__('Notify me when someone adds me as their friend'); $issues_settings[TBGMailing::NOTIFY_ISSUE_POSTED_UPDATED] = $i18n->__('Notify me when an issue I posted gets updated or created'); $issues_settings[TBGMailing::NOTIFY_ISSUE_ONCE] = $i18n->__('Only notify me once per issue until I open the issue'); $issues_settings[TBGMailing::NOTIFY_ISSUE_ASSIGNED_UPDATED] = $i18n->__("Notify me when an issue I'm assigned to gets updated or created"); $issues_settings[TBGMailing::NOTIFY_ISSUE_UPDATED_SELF] = $i18n->__('Notify me when I update or create an issue'); $issues_settings[TBGMailing::NOTIFY_ISSUE_TEAMASSIGNED_UPDATED] = $i18n->__("Notify me when an issue assigned to one of my teams is updated or created"); $issues_settings[TBGMailing::NOTIFY_ISSUE_RELATED_PROJECT_TEAMASSIGNED] = $i18n->__("Notify me when an issue assigned to one of my team projects is updated or created"); $issues_settings[TBGMailing::NOTIFY_ISSUE_PROJECT_ASSIGNED] = $i18n->__("Notify me when an issue assigned to one of my projects is updated or created"); $this->general_settings = $general_settings; $this->issues_settings = $issues_settings; $this->uid = TBGContext::getUser()->getID(); }
public function componentLeftmenu() { $i18n = TBGContext::getI18n(); $config_sections = array(); if (TBGContext::getUser()->getScope()->getID() == 1) { $config_sections[TBGSettings::CONFIGURATION_SECTION_SCOPES] = array('route' => 'configure_scopes', 'description' => $i18n->__('Scopes'), 'icon' => 'scopes', 'module' => 'core'); } $config_sections[TBGSettings::CONFIGURATION_SECTION_SETTINGS] = array('route' => 'configure_settings', 'description' => $i18n->__('Settings'), 'icon' => 'general', 'module' => 'core'); $config_sections[TBGSettings::CONFIGURATION_SECTION_PERMISSIONS] = array('route' => 'configure_permissions', 'description' => $i18n->__('Permissions'), 'icon' => 'permissions', 'module' => 'core'); $config_sections[TBGSettings::CONFIGURATION_SECTION_AUTHENTICATION] = array('route' => 'configure_authentication', 'description' => $i18n->__('Authentication'), 'icon' => 'authentication', 'module' => 'core'); if (TBGContext::getScope()->isUploadsEnabled()) { $config_sections[TBGSettings::CONFIGURATION_SECTION_UPLOADS] = array('route' => 'configure_files', 'description' => $i18n->__('Uploads & attachments'), 'icon' => 'files', 'module' => 'core'); } $config_sections[TBGSettings::CONFIGURATION_SECTION_IMPORT] = array('route' => 'configure_import', 'description' => $i18n->__('Import data'), 'icon' => 'import', 'module' => 'core'); $config_sections[TBGSettings::CONFIGURATION_SECTION_PROJECTS] = array('route' => 'configure_projects', 'description' => $i18n->__('Projects'), 'icon' => 'projects', 'module' => 'core'); $config_sections[TBGSettings::CONFIGURATION_SECTION_ISSUETYPES] = array('icon' => 'issuetypes', 'description' => $i18n->__('Issue types'), 'route' => 'configure_issuetypes', 'module' => 'core'); $config_sections[TBGSettings::CONFIGURATION_SECTION_ISSUEFIELDS] = array('icon' => 'resolutiontypes', 'description' => $i18n->__('Issue fields'), 'route' => 'configure_issuefields', 'module' => 'core'); $config_sections[TBGSettings::CONFIGURATION_SECTION_WORKFLOW] = array('icon' => 'workflow', 'description' => $i18n->__('Workflow'), 'route' => 'configure_workflow', 'module' => 'core'); $config_sections[TBGSettings::CONFIGURATION_SECTION_USERS] = array('route' => 'configure_users', 'description' => $i18n->__('Users, teams, clients & groups'), 'icon' => 'users', 'module' => 'core'); $config_sections[TBGSettings::CONFIGURATION_SECTION_MODULES][] = array('route' => 'configure_modules', 'description' => $i18n->__('Modules'), 'icon' => 'modules', 'module' => 'core'); foreach (TBGContext::getModules() as $module) { if ($module->hasConfigSettings() && $module->isEnabled()) { $config_sections[TBGSettings::CONFIGURATION_SECTION_MODULES][] = array('route' => array('configure_module', array('config_module' => $module->getName())), 'description' => $module->getConfigTitle(), 'icon' => $module->getName(), 'module' => $module->getName()); } } $breadcrumblinks = array(); foreach ($config_sections as $section) { if (is_array($section) && !array_key_exists('route', $section)) { foreach ($section as $subsection) { $url = is_array($subsection['route']) ? make_url($subsection['route'][0], $subsection['route'][1]) : make_url($subsection['route']); $breadcrumblinks[] = array('url' => $url, 'title' => $subsection['description']); } } else { $breadcrumblinks[] = array('url' => make_url($section['route']), 'title' => $section['description']); } } $this->breadcrumblinks = $breadcrumblinks; $this->config_sections = $config_sections; if ($this->selected_section == TBGSettings::CONFIGURATION_SECTION_MODULES) { if (TBGContext::getRouting()->getCurrentRouteName() == 'configure_modules') { $this->selected_subsection = 'core'; } else { $this->selected_subsection = TBGContext::getRequest()->getParameter('config_module'); } } }
/** * Send a test email * * @param TBGRequest $request */ public function runTestEmail(TBGRequest $request) { if ($email_to = $request->getParameter('test_email_to')) { try { if (TBGMailing::getModule()->sendTestEmail($email_to)) { TBGContext::setMessage('module_message', TBGContext::getI18n()->__('The email was successfully accepted for delivery')); } else { TBGContext::setMessage('module_error', TBGContext::getI18n()->__('The email was not sent')); TBGContext::setMessage('module_error_details', TBGLogging::getMessagesForCategory('mailing', TBGLogging::LEVEL_NOTICE)); } } catch (Exception $e) { TBGContext::setMessage('module_error', TBGContext::getI18n()->__('The email was not sent')); TBGContext::setMessage('module_error_details', $e->getMessage()); } } else { TBGContext::setMessage('module_error', TBGContext::getI18n()->__('Please specify an email address')); } $this->forward(TBGContext::getRouting()->generate('configure_module', array('config_module' => 'mailing'))); }
public function componentLeftmenu() { $config_sections = TBGSettings::getConfigSections(TBGContext::getI18n()); $breadcrumblinks = array(); foreach ($config_sections as $key => $sections) { foreach ($sections as $section) { if ($key == TBGSettings::CONFIGURATION_SECTION_MODULES) { $url = is_array($section['route']) ? make_url($section['route'][0], $section['route'][1]) : make_url($section['route']); $breadcrumblinks[] = array('url' => $url, 'title' => $section['description']); } else { $breadcrumblinks[] = array('url' => make_url($section['route']), 'title' => $section['description']); } } } $this->breadcrumblinks = $breadcrumblinks; $this->config_sections = $config_sections; if ($this->selected_section == TBGSettings::CONFIGURATION_SECTION_MODULES) { if (TBGContext::getRouting()->getCurrentRouteName() == 'configure_modules') { $this->selected_subsection = 'core'; } else { $this->selected_subsection = TBGContext::getRequest()->getParameter('config_module'); } } }
/** * Return an array specifying visibility, requirement and choices for fields in issues * * @param integer $issue_type * @param boolean $reportable[optional] Whether to only include fields that can be reported * * @return array */ protected function _getFieldsArray($issue_type, $reportable = true) { $issue_type = is_object($issue_type) ? $issue_type->getID() : $issue_type; if (!isset($this->_fieldsarrays[$issue_type][(int) $reportable])) { $retval = array(); $res = B2DB::getTable('TBGIssueFieldsTable')->getBySchemeIDandIssuetypeID($this->getIssuetypeScheme()->getID(), $issue_type); if ($res) { $builtin_types = TBGDatatype::getAvailableFields(true); while ($row = $res->getNextRow()) { if (!$reportable || (bool) $row->get(TBGIssueFieldsTable::REPORTABLE) == true) { if ($reportable) { if (in_array($row->get(TBGIssueFieldsTable::FIELD_KEY), $builtin_types) && (!$this->fieldPermissionCheck($row->get(TBGIssueFieldsTable::FIELD_KEY), $reportable) && !($row->get(TBGIssueFieldsTable::REQUIRED) && $reportable))) { continue; } elseif (!in_array($row->get(TBGIssueFieldsTable::FIELD_KEY), $builtin_types) && (!$this->fieldPermissionCheck($row->get(TBGIssueFieldsTable::FIELD_KEY), $reportable, true) && !($row->get(TBGIssueFieldsTable::REQUIRED) && $reportable))) { continue; } } $field_key = $row->get(TBGIssueFieldsTable::FIELD_KEY); $retval[$field_key] = array('required' => (bool) $row->get(TBGIssueFieldsTable::REQUIRED), 'additional' => (bool) $row->get(TBGIssueFieldsTable::ADDITIONAL)); if (!in_array($field_key, $builtin_types)) { $retval[$field_key]['custom'] = true; $custom_type = TBGCustomDatatype::getByKey($field_key); if ($custom_type instanceof TBGCustomDatatype) { $retval[$field_key]['custom_type'] = $custom_type->getType(); } else { unset($retval[$field_key]); } } } } if (array_key_exists('user_pain', $retval)) { $retval['pain_bug_type'] = array('required' => $retval['user_pain']['required']); $retval['pain_likelihood'] = array('required' => $retval['user_pain']['required']); $retval['pain_effect'] = array('required' => $retval['user_pain']['required']); } if ($reportable) { foreach ($retval as $key => $return_details) { if ($key == 'edition' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::EDITIONS_LIST, TBGCustomDatatype::EDITIONS_CHOICE))) { $retval[$key]['values'] = array(); $retval[$key]['values'][''] = TBGContext::getI18n()->__('None'); foreach ($this->getEditions() as $edition) { $retval[$key]['values'][$edition->getID()] = $edition->getName(); } if (!$this->isEditionsEnabled() || empty($retval[$key]['values'])) { if (!$retval[$key]['required']) { unset($retval[$key]); } else { unset($retval[$key]['values']); } } if (array_key_exists($key, $retval) && array_key_exists('values', $retval[$key])) { asort($retval[$key]['values'], SORT_STRING); } } elseif ($key == 'status' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::EDITIONS_LIST, TBGCustomDatatype::STATUS_CHOICE))) { $retval[$key]['values'] = array(); foreach (TBGStatus::getAll() as $status) { $retval[$key]['values'][$status->getID()] = $status->getName(); } if (empty($retval[$key]['values'])) { if (!$retval[$key]['required']) { unset($retval[$key]); } else { unset($retval[$key]['values']); } } if (array_key_exists($key, $retval) && array_key_exists('values', $retval[$key])) { asort($retval[$key]['values'], SORT_STRING); } } elseif ($key == 'component' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::COMPONENTS_LIST, TBGCustomDatatype::COMPONENTS_CHOICE))) { $retval[$key]['values'] = array(); $retval[$key]['values'][''] = TBGContext::getI18n()->__('None'); foreach ($this->getComponents() as $component) { $retval[$key]['values'][$component->getID()] = $component->getName(); } if (!$this->isComponentsEnabled() || empty($retval[$key]['values'])) { if (!$retval[$key]['required']) { unset($retval[$key]); } else { unset($retval[$key]['values']); } } if (array_key_exists($key, $retval) && array_key_exists('values', $retval[$key])) { asort($retval[$key]['values'], SORT_STRING); } } elseif ($key == 'build' || array_key_exists('custom', $return_details) && $return_details['custom'] && in_array($return_details['custom_type'], array(TBGCustomDatatype::RELEASES_LIST, TBGCustomDatatype::RELEASES_CHOICE))) { $retval[$key]['values'] = array(); $retval[$key]['values'][''] = TBGContext::getI18n()->__('None'); foreach ($this->getBuilds() as $build) { $retval[$key]['values'][$build->getID()] = $build->getName() . ' (' . $build->getVersion() . ')'; } if (!$this->isBuildsEnabled() || empty($retval[$key]['values'])) { if (!$retval[$key]['required']) { unset($retval[$key]); } else { unset($retval[$key]['values']); } } } } } } $this->_fieldsarrays[$issue_type][(int) $reportable] = $retval; } return $this->_fieldsarrays[$issue_type][(int) $reportable]; }
public function runSaveColumnSettings(TBGRequest $request) { TBGSettings::saveSetting('search_scs_' . $request['template'], join(',', $request['columns'])); return $this->renderJSON(array('failed' => false, 'message' => TBGContext::getI18n()->__('Visible columns has been set successfully'))); }
public function runListFieldvalues(TBGRequest $request) { $field_key = $request['field_key']; $return_array = array('description' => null, 'type' => null, 'choices' => null); if ($field_key == 'title' || in_array($field_key, TBGDatatypeBase::getAvailableFields(true))) { switch ($field_key) { case 'title': $return_array['description'] = TBGContext::getI18n()->__('Single line text input without formatting'); $return_array['type'] = 'single_line_input'; break; case 'description': case 'reproduction_steps': $return_array['description'] = TBGContext::getI18n()->__('Text input with wiki formatting capabilities'); $return_array['type'] = 'wiki_input'; break; case 'status': case 'resolution': case 'reproducability': case 'priority': case 'severity': case 'category': $return_array['description'] = TBGContext::getI18n()->__('Choose one of the available values'); $return_array['type'] = 'choice'; $classname = "TBG" . ucfirst($field_key); $choices = $classname::getAll(); foreach ($choices as $choice_key => $choice) { $return_array['choices'][$choice_key] = $choice->getName(); } break; case 'percent_complete': $return_array['description'] = TBGContext::getI18n()->__('Value of percentage completed'); $return_array['type'] = 'choice'; $return_array['choices'][] = "1-100%"; break; case 'owner': case 'assignee': $return_array['description'] = TBGContext::getI18n()->__('Select an existing user or <none>'); $return_array['type'] = 'select_user'; break; case 'estimated_time': case 'spent_time': $return_array['description'] = TBGContext::getI18n()->__('Enter time, such as points, hours, minutes, etc or <none>'); $return_array['type'] = 'time'; break; case 'milestone': $return_array['description'] = TBGContext::getI18n()->__('Select from available project milestones'); $return_array['type'] = 'choice'; if ($this->selected_project instanceof TBGProject) { $milestones = $this->selected_project->getAvailableMilestones(); foreach ($milestones as $milestone) { $return_array['choices'][$milestone->getID()] = $milestone->getName(); } } break; } } else { } $this->field_info = $return_array; }
<rss version="2.0"> <channel> <title><?php echo TBGSettings::getTBGname() . ' ~ ' . $searchtitle; ?> </title> <link><?php echo make_url('home', array(), false); ?> </link> <description><?php echo strip_tags(TBGSettings::getTBGname()); ?> </description> <language><?php echo mb_strtolower(str_replace('_', '-', TBGContext::getI18n()->getCurrentLanguage())); ?> </language> <image> <?php if (TBGSettings::isUsingCustomHeaderIcon() == '2') { ?> <url><?php echo TBGSettings::getHeaderIconURL(); ?> </url> <?php } elseif (TBGSettings::isUsingCustomHeaderIcon() == '1') { ?> <url><?php echo TBGContext::getUrlHost() . TBGContext::getTBGPath() . 'header.png';
/** * Returns an ISO-8859-1 encoded string if UTF-8 encoded and current charset not UTF-8 * * @param string $str the encode string * @param boolean $htmlentities [optional] whether to convert applicable characters to HTML entities * * @return string */ function tbg_decodeUTF8($str, $htmlentities = false) { if (tbg_isUTF8($str) && !stristr(TBGContext::getI18n()->getCharset(), 'UTF-8')) { $str = utf8_decode($str); } if ($htmlentities) { $str = htmlentities($str, ENT_NOQUOTES + ENT_IGNORE, TBGContext::getI18n()->getCharset()); } return $str; }
public static function getTBGname() { try { if (!TBGContext::isReadySetup()) { return 'The Bug Genie'; } $name = self::get(self::SETTING_TBG_NAME); if (!self::isHeaderHtmlFormattingAllowed()) { $name = htmlspecialchars($name, ENT_COMPAT, TBGContext::getI18n()->getCharset()); } return $name; } catch (Exception $e) { return 'The Bug Genie'; } }
public function getMenuTitle($project_context = null) { $project_context = $project_context !== null ? $project_context : TBGContext::isProjectContext(); $i18n = TBGContext::getI18n(); if (($menu_title = $this->getSetting('menu_title')) !== null) { switch ($menu_title) { case 5: return $project_context ? $i18n->__('Project archive') : $i18n->__('Archive'); case 3: return $project_context ? $i18n->__('Project documentation') : $i18n->__('Documentation'); case 4: return $project_context ? $i18n->__('Project documents') : $i18n->__('Documents'); case 2: return $project_context ? $i18n->__('Project help') : $i18n->__('Help'); } } return $project_context ? $i18n->__('Project wiki') : $i18n->__('Wiki'); }
/** * Create an imap connection for this account */ public function connect() { if ($this->_connection === null) { $options = array(); if ($this->usesPlaintextAuthentication()) { $options['DISABLE_AUTHENTICATOR'] = 'GSSAPI'; } $this->_connection = imap_open($this->getConnectionString(), $this->getUsername(), $this->getPassword(), $options); } if (!is_resource($this->_connection)) { $error = imap_last_error(); $error = $error === false ? TBGContext::getI18n()->__('No error message provided') : $error; throw new Exception(TBGContext::getI18n()->__('Could not connect to the specified email server(%connection_string): %error_message', array('%connection_string' => $this->getConnectionString(), '%error_message' => $error))); } }
/** * Forward the user with HTTP status code 403 and an (optional) message * based on a boolean check * * @param boolean $condition * @param string $message[optional] The message */ public function forward403unless($condition, $message = null) { if (!$condition) { $message = $message === null ? TBGContext::getI18n()->__("You are not allowed to access to this page") : $message; TBGContext::setMessage('forward', $message); $this->forward(TBGContext::getRouting()->generate('login_redirect'), 403); } }
/** * Retrieve the users real name * * @return string */ public function getName() { if ($this->isDeleted()) { return TBGContext::getI18n()->__('No such user'); } return $this->_buddyname ? $this->_buddyname : ($this->_realname ? $this->_realname : $this->_username); }
public function getPredefinedBreadcrumbLinks($type, $project = null) { $i18n = TBGContext::getI18n(); $links = array(); switch ($type) { case 'main_links': $links[] = array('url' => TBGContext::getRouting()->generate('home'), 'title' => $i18n->__('Frontpage')); $links[] = array('url' => TBGContext::getRouting()->generate('dashboard'), 'title' => $i18n->__('Personal dashboard')); $links[] = array('title' => $i18n->__('Issues')); $links[] = array('title' => $i18n->__('Teams')); $links[] = array('title' => $i18n->__('Clients')); $links = TBGEvent::createNew('core', 'breadcrumb_main_links', null, array(), $links)->trigger()->getReturnList(); if (TBGContext::getUser()->canAccessConfigurationPage()) { $links[] = array('url' => make_url('configure'), 'title' => $i18n->__('Configure The Bug Genie')); } $links[] = array('url' => TBGContext::getRouting()->generate('about'), 'title' => $i18n->__('About %sitename%', array('%sitename%' => TBGSettings::getTBGname()))); $links[] = array('url' => TBGContext::getRouting()->generate('account'), 'title' => $i18n->__('Account details')); break; case 'project_summary': $links[] = array('url' => TBGContext::getRouting()->generate('project_dashboard', array('project_key' => $project->getKey())), 'title' => $i18n->__('Dashboard')); $links[] = array('url' => TBGContext::getRouting()->generate('project_scrum', array('project_key' => $project->getKey())), 'title' => $i18n->__('Sprint planning')); $links[] = array('url' => TBGContext::getRouting()->generate('project_roadmap', array('project_key' => $project->getKey())), 'title' => $i18n->__('Roadmap')); $links[] = array('url' => TBGContext::getRouting()->generate('project_team', array('project_key' => $project->getKey())), 'title' => $i18n->__('Team overview')); $links[] = array('url' => TBGContext::getRouting()->generate('project_statistics', array('project_key' => $project->getKey())), 'title' => $i18n->__('Statistics')); $links[] = array('url' => TBGContext::getRouting()->generate('project_timeline', array('project_key' => $project->getKey())), 'title' => $i18n->__('Timeline')); $links[] = array('url' => TBGContext::getRouting()->generate('project_reportissue', array('project_key' => $project->getKey())), 'title' => $i18n->__('Report an issue')); $links[] = array('url' => TBGContext::getRouting()->generate('project_issues', array('project_key' => $project->getKey())), 'title' => $i18n->__('Issues')); $links = TBGEvent::createNew('core', 'breadcrumb_project_links', null, array(), $links)->trigger()->getReturnList(); break; case 'client_list': foreach (TBGClient::getAll() as $client) { if ($client->hasAccess()) { $links[] = array('url' => TBGContext::getRouting()->generate('client_dashboard', array('client_id' => $client->getID())), 'title' => $client->getName()); } } break; case 'team_list': foreach (TBGTeam::getAll() as $team) { if ($team->hasAccess()) { $links[] = array('url' => TBGContext::getRouting()->generate('team_dashboard', array('team_id' => $team->getID())), 'title' => $team->getName()); } } break; } return $links; }
protected function _mail2(TBGMimemail $email) { if (TBGContext::isCLI()) { $server = php_uname('n'); } else { $server = $_SERVER['SERVER_NAME']; } /* Open a socket connection to the mail server SMTP port (25) and read the welcome message. */ $fp = fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout); if (!$fp) { if ($this->debug) { echo "No server? {$errno} {$errstr}<br>"; } throw new Exception(TBGContext::getI18n()->__('Could not open connection to server %server on port %port', array('%server' => $this->server, '%port' => $this->port))); } $this->_read_buffer($fp, 'open'); /* Standard "ehlo" message. */ if ($this->ehlo) { fputs($fp, "ehlo {$server}\r\n"); $this->_read_buffer($fp, 'ehlo'); } else { fputs($fp, "helo {$server}\r\n"); $this->_read_buffer($fp, 'helo'); } /* Auth login: (Note that Username and password must be Base64 encoded string.) */ if ($this->username != '') { fputs($fp, "AUTH LOGIN\r\n"); $rv = fgets($fp, 4096); if ($this->debug) { echo base64_decode(mb_substr($rv, 4)) . $this->username . ' ' . $rv . '<br>'; } fputs($fp, base64_encode($this->username) . "\r\n"); $rv = fgets($fp, 4096); if ($this->debug) { echo base64_decode(mb_substr($rv, 4)) . $this->password . ' ' . $rv . '<br>'; } fputs($fp, base64_encode($this->password) . "\r\n"); $rv = $this->_read_buffer($fp, 'user/pass'); if (preg_match("/^500/i", $rv)) { if ($this->debug) { echo 'Not ready to authenticate. (' . $rv . ') Try changing server type'; } throw new Exception(TBGContext::getI18n()->__('Not ready to authenticate. (%rv) Try changing server type', array('%rv' => $rv))); } if (!preg_match("/^235/i", $rv)) { /* OK Authenticated */ if ($this->debug) { echo 'Username / password not accepted on server<br>'; } fclose($fp); throw new Exception(TBGContext::getI18n()->__('Username / password not accepted on server: %rv', array('%rv' => $rv))); } } // "mail from" message and read the return. Assume everything is OK. fputs($fp, "mail from: <{$email->getFromaddress()}>\r\n"); $rv = $this->_read_buffer($fp, 'mail_from'); // "rcpt to" message and read the return. Each name in the $to, $cc, and $bcc array requires one "rcpt to" foreach ($email->getRecipients() as $recipient) { fputs($fp, "rcpt to: <{$recipient['address']}>\r\n"); $rv = $this->_read_buffer($fp, 'to'); } if (preg_match("/^550/i", $rv)) { if ($this->debug) { echo "You are not allowed to send emails through this server."; } throw new Exception(TBGContext::getI18n()->__("You are not allowed to send emails through this server. \nThe error was: %rv", array('%rv' => $rv))); } foreach ($email->getCC() as $cc) { fputs($fp, "rcpt to: <{$cc['address']}>\r\n"); $this->_read_buffer($fp, 'cc'); } foreach ($email->getBCC() as $bcc) { fputs($fp, "rcpt to: <{$bcc['address']}>\r\n"); $this->_read_buffer($fp, 'bcc'); } /* "data" message and the message body follows. */ fputs($fp, "data\r\n"); $this->_read_buffer($fp, 'data'); /* Standard message parts. */ fputs($fp, $email->getHeadersAsString()); foreach ($email->getBody(true) as $body_line) { fputs($fp, $body_line); } /* "quit" message and done. */ fputs($fp, ".\r\n"); fputs($fp, "quit\r\n"); $rv = $this->_read_buffer($fp, 'quit'); fclose($fp); /* status 250 if Message accepted for delivery */ if (preg_match("/^250/i", $rv)) { return true; } else { if ($this->debug) { echo "Did not receive a confirmation message from the mail server."; } throw new Exception(TBGContext::getI18n()->__("Did not receive a confirmation message from the mail server.. \nHowever, we received: %rv", array('%rv' => $rv))); } }
public function loadFixtures(TBGScope $scope) { $i18n = TBGContext::getI18n(); $settings = array(); $settings[TBGSettings::SETTING_THEME_NAME] = 'oxygen'; $settings[TBGSettings::SETTING_REQUIRE_LOGIN] = 0; $settings[TBGSettings::SETTING_DEFAULT_USER_IS_GUEST] = 1; $settings[TBGSettings::SETTING_ALLOW_REGISTRATION] = 1; $settings[TBGSettings::SETTING_RETURN_FROM_LOGIN] = 'referer'; $settings[TBGSettings::SETTING_RETURN_FROM_LOGOUT] = 'home'; $settings[TBGSettings::SETTING_SHOW_PROJECTS_OVERVIEW] = 1; $settings[TBGSettings::SETTING_ALLOW_USER_THEMES] = 0; $settings[TBGSettings::SETTING_ENABLE_UPLOADS] = 0; $settings[TBGSettings::SETTING_ENABLE_GRAVATARS] = 1; $settings[TBGSettings::SETTING_UPLOAD_RESTRICTION_MODE] = 'blacklist'; $settings[TBGSettings::SETTING_UPLOAD_EXTENSIONS_LIST] = 'exe,bat,php,asp,jsp'; $settings[TBGSettings::SETTING_UPLOAD_STORAGE] = 'files'; $settings[TBGSettings::SETTING_UPLOAD_LOCAL_PATH] = THEBUGGENIE_PATH . 'files/'; $settings[TBGSettings::SETTING_TBG_NAME] = 'The Bug Genie'; $settings[TBGSettings::SETTING_TBG_TAGLINE] = '<b>Friendly</b> issue tracking and project management'; $settings[TBGSettings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_LANGUAGE] = 'html4strict'; $settings[TBGSettings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_NUMBERING] = '3'; $settings[TBGSettings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_INTERVAL] = '10'; $settings[TBGSettings::SETTING_SALT] = sha1(time() . mt_rand(1000, 10000)); $scope_id = $scope->getID(); foreach ($settings as $settings_name => $settings_val) { $this->saveSetting($settings_name, 'core', $settings_val, 0, $scope_id); } }
<td> <input type="text" name="<?php echo TBGSettings::SETTING_DEFAULT_CHARSET; ?> " id="charset" value="<?php echo TBGSettings::getCharset(); ?> " style="width: 150px;"<?php if ($access_level != TBGSettings::ACCESS_FULL) { ?> disabled<?php } ?> > <span class="config_explanation"><?php echo __('Current character set is %charset%', array('%charset%' => '<b>' . TBGContext::getI18n()->getLangCharset() . '</b>')); ?> </span> </td> </tr> <tr> <td class="config_explanation" colspan="2"><?php echo __('What charset to use for the selected language - leave blank to use the charset specified in the language file'); ?> </td> </tr> <tr> <td><label for="server_timezone"><?php echo __('Server timezone'); ?> </label></td>
<?php TBGContext::getI18n()->setCharset('utf-8'); setlocale(LC_ALL, array('en_US@euro', 'en_US', 'en'));
?> </span> <span class="single" style="display: none;"><?php echo __('%click_here to add files', array('%click_here' => '<span class="upload_click_here">' . __('click here') . '</span>')); ?> </span> </div> <div class="upload_file_listing"> <ul id="file_upload_list" data-filename-label="<?php echo htmlentities(__('File'), ENT_COMPAT, TBGContext::getI18n()->getCharset()); ?> " data-description-label="<?php echo htmlentities(__('Description'), ENT_COMPAT, TBGContext::getI18n()->getCharset()); ?> " data-description-placeholder="<?php echo htmlentities(__('Enter a short file description here'), ENT_COMPAT, TBGContext::getI18n()->getCharset()); ?> "> <?php if (isset($existing_files)) { ?> <?php foreach ($existing_files as $file) { ?> <li> <?php if ($file->isImage()) { ?> <span class="imagepreview" title="<?php echo $file->getOriginalFilename(); ?>
public function runFindUsers(TBGRequest $request) { $this->too_short = false; $findstring = $request['findstring']; if (mb_strlen($findstring) >= 1) { $this->users = TBGUsersTable::getTable()->findInConfig($findstring); $this->total_results = count($this->users); } else { $this->too_short = true; } switch ($findstring) { case 'unactivated': $this->findstring = TBGContext::getI18n()->__('Unactivated users'); break; case 'newusers': $this->findstring = TBGContext::getI18n()->__('New users'); break; case 'all': $this->findstring = TBGContext::getI18n()->__('All users'); break; default: $this->findstring = $findstring; } }
public function runUnassignFromProject(TBGRequest $request) { try { $project = TBGContext::factory()->TBGProject($request->getParameter('project_id')); $project->removeAssignee($request->getParameter('assignee_type'), $request->getParameter('assignee_id')); return $this->renderJSON(array('failed' => false, 'message' => TBGContext::getI18n()->__('The assignee has been removed'))); } catch (Exception $e) { return $this->renderJSON(array('failed' => true, 'message' => $e->getMessage())); } }
protected function _prepareMessages() { if ($this->template !== null) { if ($this->message_plain === null && $this->message_html === null) { if ($this->language !== null) { try { $current_language = TBGContext::getI18n()->getCurrentLanguage(); TBGContext::getI18n()->setLanguage($this->language); $this->message_html = TBGAction::returnTemplateHTML("mailing/{$this->template}.html", $this->template_parameters); if ($this->message_html == '') { $this->message_html = null; } $this->message_plain = TBGAction::returnTemplateHTML("mailing/{$this->template}.text", $this->template_parameters); if ($this->message_plain == '') { $this->message_plain = null; } TBGContext::getI18n()->setLanguage($current_language); } catch (Exception $e) { TBGContext::getI18n()->setLanguage($current_language); throw $e; } } else { $this->message_html = TBGAction::returnTemplateHTML("mailing/{$this->template}.html", $this->template_parameters); $this->message_plain = TBGAction::returnTemplateHTML("mailing/{$this->template}.text", $this->template_parameters); } } } }
public function doSave($options = array(), $reason = null) { if (TBGArticlesTable::getTable()->doesNameConflictExist($this->_name, $this->_id, TBGContext::getScope()->getID())) { if (!array_key_exists('overwrite', $options) || !$options['overwrite']) { throw new Exception(TBGContext::getI18n()->__('Another article with this name already exists')); } } $user_id = TBGContext::getUser() instanceof TBGUser ? TBGContext::getUser()->getID() : 0; if (!isset($options['revert']) || !$options['revert']) { TBGArticleHistoryTable::getTable()->addArticleHistory($this->_name, $this->_old_content, $this->_content, $user_id, $reason); } $this->save(); $this->_old_content = $this->_content; TBGArticleLinksTable::getTable()->deleteLinksByArticle($this->_name); TBGArticleCategoriesTable::getTable()->deleteCategoriesByArticle($this->_name); if (substr($this->getContent(), 0, 10) == "#REDIRECT ") { $content = explode("\n", $this->getContent()); preg_match('/(\\[\\[([^\\]]*?)\\]\\])$/im', substr(array_shift($content), 10), $matches); if (count($matches) == 3) { return; } } list($links, $categories) = $this->_retrieveLinksAndCategoriesFromContent($options); foreach ($links as $link => $occurrences) { TBGArticleLinksTable::getTable()->addArticleLink($this->_name, $link); } foreach ($categories as $category => $occurrences) { TBGArticleCategoriesTable::getTable()->addArticleCategory($this->_name, $category, $this->isCategory()); } $this->_history = null; return true; }
public function runUnassignFromProject(TBGRequest $request) { if ($this->getUser()->canManageProject($this->selected_project) || $this->getUser()->canManageProjectReleases($this->selected_project)) { try { $assignee = $request['assignee_type'] == 'user' ? new TBGUser($request['assignee_id']) : new TBGTeam($request['assignee_id']); $this->selected_project->removeAssignee($assignee); return $this->renderJSON(array('message' => TBGContext::getI18n()->__('The assignee has been removed'))); } catch (Exception $e) { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('message' => $e->getMessage())); } } $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array("error" => $this->getI18n()->__("You don't have access to perform this action"))); }
?> <li class="rounded_box white shadowed" id="delete_scheme_<?php echo $scheme->getID(); ?> _popup" style="margin-bottom: 5px; padding: 10px; display: none;"> <div class="header"><?php echo __('Are you sure?'); ?> </div> <div class="content"> <?php echo __('Please confirm that you want to delete this issue type scheme.'); ?> <br> <form accept-charset="<?php echo TBGContext::getI18n()->getCharset(); ?> " action="<?php echo make_url('configure_issuetypes_delete_scheme', array('scheme_id' => $scheme->getID())); ?> " onsubmit="TBG.Config.IssuetypeScheme.remove('<?php echo make_url('configure_issuetypes_delete_scheme', array('scheme_id' => $scheme->getID())); ?> ', <?php echo $scheme->getID(); ?> );return false;" id="delete_issuetype_scheme_<?php echo $scheme->getID(); ?> _form"> <div style="text-align: right;">
<?php TBGContext::getI18n()->setCharset('UTF-8'); setlocale(LC_ALL, array('es_ES@dolar', 'es_ES', 'es')); // see TBGi18n::getDateTimeFormat for the list of all available formats TBGContext::getI18n()->setDateTimeFormats(array(1 => '%H:%M - %a %d %b %Y', 2 => '%H:%M - %a %d.m %Y', 3 => '%a %d de %b %H:%M', 4 => '%d de %b %H:%M', 5 => '%d de %B de %Y', 6 => '%d de %B de %Y (%H:%M)', 7 => '%A %d de %B de %Y (%H:%M)', 8 => '%d de %b de %Y %H:%M', 9 => '%d de %b de %Y - %H:%M', 10 => '%d de %b de %Y (%H:%M)', 11 => '%B', 12 => '%d de %b', 13 => '%a', 14 => '%H:%M', 15 => '%d de %b de %Y', 16 => '%Gh %im', 17 => '%a, %d de %b de %Y %H:%M:%S GMT'));