本文整理汇总了PHP中TBGSettings::get方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGSettings::get方法的具体用法?PHP TBGSettings::get怎么用?PHP TBGSettings::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGSettings
的用法示例。
在下文中一共展示了TBGSettings::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_execute
public function do_execute()
{
/* Prepare variables */
try {
$project_id = $this->getProvidedArgument('projectid');
$project_row = TBGProjectsTable::getTable()->getById($project_id, false);
TBGContext::setScope(new TBGScope($project_row[TBGProjectsTable::SCOPE]));
$project = new TBGProject($project_id, $project_row);
} catch (Exception $e) {
throw $e;
$this->cliEcho("The project with the ID " . $this->getProvidedArgument('projectid') . " does not exist\n", 'red', 'bold');
exit;
}
$author = $this->getProvidedArgument('author');
$new_rev = $this->getProvidedArgument('revno');
$commit_msg = $this->getProvidedArgument('log');
$changed = $this->getProvidedArgument('changed');
$old_rev = $this->getProvidedArgument('oldrev', null);
$date = $this->getProvidedArgument('date', null);
$branch = $this->getProvidedArgument('branch', null);
if (TBGSettings::get('access_method_' . $project->getKey()) == TBGVCSIntegration::ACCESS_HTTP) {
$this->cliEcho("This project uses the HTTP access method, and so access via the CLI has been disabled\n", 'red', 'bold');
exit;
}
if ($old_rev === null && !is_integer($new_rev)) {
$this->cliEcho("Error: if only the new revision is specified, it must be a number so that old revision can be calculated from it (by substracting 1 from new revision number).");
} else {
if ($old_rev === null) {
$old_rev = $new_rev - 1;
}
}
$output = TBGVCSIntegration::processCommit($project, $commit_msg, $old_rev, $new_rev, $date, $changed, $author, $branch);
$this->cliEcho($output);
}
示例2: loadFixtures
public static function loadFixtures(TBGScope $scope)
{
$scope_id = $scope->getID();
$admin_group = new TBGGroup();
$admin_group->setName('Administrators');
$admin_group->setScope($scope);
$admin_group->save();
TBGSettings::saveSetting('admingroup', $admin_group->getID(), 'core', $scope_id);
$user_group = new TBGGroup();
$user_group->setName('Regular users');
$user_group->setScope($scope);
$user_group->save();
TBGSettings::saveSetting('defaultgroup', $user_group->getID(), 'core', $scope_id);
$guest_group = new TBGGroup();
$guest_group->setName('Guests');
$guest_group->setScope($scope);
$guest_group->save();
// Set up initial users, and their permissions
if ($scope->isDefault()) {
list($guestuser_id, $adminuser_id) = TBGUser::loadFixtures($scope, $admin_group, $user_group, $guest_group);
TBGUserScopesTable::getTable()->addUserToScope($guestuser_id, $scope->getID(), $guest_group->getID(), true);
TBGUserScopesTable::getTable()->addUserToScope($adminuser_id, $scope->getID(), $admin_group->getID(), true);
} else {
$default_scope_id = TBGSettings::getDefaultScopeID();
$default_user_id = (int) TBGSettings::get(TBGSettings::SETTING_DEFAULT_USER_ID, 'core', $default_scope_id);
TBGUserScopesTable::getTable()->addUserToScope($default_user_id, $scope->getID(), $user_group->getID(), true);
TBGUserScopesTable::getTable()->addUserToScope(1, $scope->getID(), $admin_group->getID());
TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_USER_ID, $default_user_id, 'core', $scope->getID());
}
TBGPermissionsTable::getTable()->loadFixtures($scope, $admin_group->getID(), $guest_group->getID());
}
示例3: addUserToScope
public function addUserToScope($user_id, $scope_id, $group_id = null, $confirmed = false)
{
$group_id = $group_id === null ? TBGSettings::get(TBGSettings::SETTING_USER_GROUP, 'core', $scope_id) : $group_id;
$crit = $this->getCriteria();
$crit->addInsert(self::USER_ID, $user_id);
$crit->addInsert(self::SCOPE, $scope_id);
$crit->addInsert(self::GROUP_ID, $group_id);
$crit->addInsert(self::CONFIRMED, $confirmed);
$this->doInsert($crit);
}
示例4: tbg_parse_text
<div id="tab_forgot_pane"<?php
if ($selected_tab != 'forgot') {
?>
style="display: none;<?php
}
?>
">
<?php
if (TBGSettings::getAuthenticationBackend() != 'tbg' && TBGSettings::getAuthenticationBackend() != null) {
echo tbg_parse_text(TBGSettings::get('forgot_message'), null, null, array('embedded' => true));
} else {
?>
<div style="vertical-align: middle; padding: 5px;">
<form accept-charset="<?php
echo TBGContext::getI18n()->getCharset();
?>
" action="<?php
echo make_url('forgot');
?>
" method="post" id="forgot_password_form" onsubmit="resetForgotPassword('<?php
echo make_url('forgot');
?>
'); return false;">
<div class="login_boxheader"><?php
echo __('Forgot password?');
?>
</div>
<p><?php
echo __('If you have forgot your password, enter your username here, and we will send you an email that will allow you to change your password');
?>
.</p><br>
示例5: runRegister
/**
* Registration logic
*
* @param TBGRequest $request
*/
public function runRegister(TBGRequest $request)
{
TBGContext::loadLibrary('common');
$i18n = TBGContext::getI18n();
try {
$username = mb_strtolower(trim($request['fieldusername']));
$buddyname = $request['buddyname'];
$email = mb_strtolower(trim($request['email_address']));
$confirmemail = mb_strtolower(trim($request['email_confirm']));
$security = $request['verification_no'];
$realname = $request['realname'];
$available = TBGUsersTable::getTable()->isUsernameAvailable($username);
$fields = array();
if (!$available) {
throw new Exception($i18n->__('This username is in use'));
}
if (!empty($buddyname) && !empty($email) && !empty($confirmemail) && !empty($security)) {
if ($email != $confirmemail) {
array_push($fields, 'email_address', 'email_confirm');
throw new Exception($i18n->__('The email address must be valid, and must be typed twice.'));
}
if ($security != $_SESSION['activation_number']) {
array_push($fields, 'verification_no');
throw new Exception($i18n->__('To prevent automatic sign-ups, enter the verification number shown below.'));
}
$email_ok = false;
$valid_domain = false;
if (tbg_check_syntax($email, "EMAIL")) {
$email_ok = true;
}
if ($email_ok && TBGSettings::get('limit_registration') != '') {
$allowed_domains = preg_replace('/[[:space:]]*,[[:space:]]*/', '|', TBGSettings::get('limit_registration'));
if (preg_match('/@(' . $allowed_domains . ')$/i', $email) == false) {
array_push($fields, 'email_address', 'email_confirm');
throw new Exception($i18n->__('Email adresses from this domain can not be used.'));
}
/*if (count($allowed_domains) > 0)
{
foreach ($allowed_domains as $allowed_domain)
{
$allowed_domain = '@' . trim($allowed_domain);
if (mb_strpos($email, $allowed_domain) !== false ) //mb_strpos checks if $to
{
$valid_domain = true;
break;
}
}
}
else
{
$valid_domain = true;
}*/
}
/*if ($valid_domain == false)
{
array_push($fields, 'email_address', 'email_confirm');
throw new Exception($i18n->__('Email adresses from this domain can not be used.'));
}*/
if ($email_ok == false) {
array_push($fields, 'email_address', 'email_confirm');
throw new Exception($i18n->__('The email address must be valid, and must be typed twice.'));
}
if ($security != $_SESSION['activation_number']) {
array_push($fields, 'verification_no');
throw new Exception($i18n->__('To prevent automatic sign-ups, enter the verification number shown below.'));
}
$password = TBGUser::createPassword();
$user = new TBGUser();
$user->setUsername($username);
$user->setRealname($realname);
$user->setBuddyname($buddyname);
$user->setGroup(TBGSettings::getDefaultGroup());
$user->setEnabled();
$user->setPassword($password);
$user->setEmail($email);
$user->setJoined();
$user->save();
if ($user->isActivated()) {
TBGContext::setMessage('auto_password', $password);
return $this->renderJSON(array('loginmessage' => $i18n->__('After pressing %continue, you need to set your password.', array('%continue' => $i18n->__('Continue'))), 'one_time_password' => $password, 'activated' => true));
}
return $this->renderJSON(array('loginmessage' => $i18n->__('The account has now been registered - check your email inbox for the activation email. Please be patient - this email can take up to two hours to arrive.'), 'activated' => false));
} else {
array_push($fields, 'email_address', 'email_confirm', 'buddyname', 'verification_no');
throw new Exception($i18n->__('You need to fill out all fields correctly.'));
}
} catch (Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $i18n->__($e->getMessage()), 'fields' => $fields));
}
}
示例6: make_url
</li>
<?php
}
?>
<li><a href="javascript:void(0);" onclick="TBG.Main.Helpers.Backdrop.show('<?php
echo make_url('get_partial_for_backdrop', array('key' => 'usercard', 'user_id' => $user->getID()));
?>
');$('bud_<?php
echo $user->getUsername() . "_12";
?>
').hide();"><?php
echo __('Show user details');
?>
</a></li>
<?php
if (!in_array($user->getID(), array(1, (int) TBGSettings::get(TBGSettings::SETTING_DEFAULT_USER_ID)))) {
?>
<?php
if (TBGContext::getScope()->isDefault()) {
?>
<li><?php
echo javascript_link_tag(__('Delete this user'), array('onclick' => "TBG.Main.Helpers.Dialog.show('" . __('Permanently delete this user?') . "', '" . __('Are you sure you want to remove this user? This will remove the users login data, as well as memberships in (and data in) any scopes the user is a member of.') . "', {yes: {click: function() {TBG.Config.User.remove('" . make_url('configure_users_delete_user', array('user_id' => $user->getID())) . "', " . $user->getID() . "); TBG.Main.Helpers.Dialog.dismiss(); } }, no: {click: TBG.Main.Helpers.Dialog.dismiss}});"));
?>
</li>
<?php
} elseif ($user->isScopeConfirmed()) {
?>
<li><?php
echo javascript_link_tag(__('Remove user from this scope'), array('onclick' => "TBG.Main.Helpers.Dialog.show('" . __('Remove this user?') . "', '" . __('Are you sure you want to remove this user from the current scope? The users login is kept, and you can re-add the user later.') . "', {yes: {click: function() {TBG.Config.User.remove('" . make_url('configure_users_delete_user', array('user_id' => $user->getID())) . "', " . $user->getID() . "); TBG.Main.Helpers.Dialog.dismiss(); } }, no: {click: TBG.Main.Helpers.Dialog.dismiss}});"));
?>
</li>
示例7: include_template
?>
</label></td>
<td>
<?php
include_template('main/textarea', array('area_name' => 'changepw_message', 'area_id' => 'changepw_message', 'height' => '75px', 'width' => '100%', 'value' => TBGSettings::get('changepw_message'), 'hide_hint' => true));
?>
</td>
</tr>
<tr>
<td style="vertical-align: top"><label for="changedetails_message"><?php
echo __('Change account details message');
?>
</label></td>
<td>
<?php
include_template('main/textarea', array('area_name' => 'changedetails_message', 'area_id' => 'changedetails_message', 'height' => '75px', 'width' => '100%', 'value' => TBGSettings::get('changedetails_message'), 'hide_hint' => true));
?>
</td>
</tr>
</table>
<?php
if ($access_level == TBGSettings::ACCESS_FULL) {
?>
<div class="greybox" style="margin: 5px 0px 5px 0px; height: 23px; padding: 5px 10px 5px 10px;">
<div style="float: left; font-size: 13px; padding-top: 2px;"><?php
echo __('Click "%save" to save your changes in all categories', array('%save' => __('Save')));
?>
</div>
<input type="submit" id="config_auth_button" style="float: right; padding: 0 10px 0 10px; font-size: 14px; font-weight: bold;" value="<?php
echo __('Save');
?>
示例8: runAddUser
public function runAddUser(TBGRequest $request)
{
try {
if (!TBGContext::getScope()->hasUsersAvailable()) {
throw new Exception($this->getI18n()->__('This instance of The Bug Genie cannot add more users'));
}
if ($username = trim($request['username'])) {
if (!TBGUser::isUsernameAvailable($username)) {
if ($request->getParameter('mode') == 'import') {
$user = TBGUser::getByUsername($username);
$user->addScope(TBGContext::getScope());
return $this->renderJSON(array('imported' => true, 'message' => $this->getI18n()->__('The user was successfully added to this scope (pending user confirmation)')));
} elseif (TBGContext::getScope()->isDefault()) {
throw new Exception($this->getI18n()->__('This username already exists'));
} else {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('allow_import' => true));
}
}
$user = new TBGUser();
$user->setUsername($username);
$user->setRealname($request->getParameter('realname', $username));
$user->setBuddyname($request->getParameter('buddyname', $username));
$user->setEmail($request->getParameter('email'));
$user->setGroup(TBGGroupsTable::getTable()->selectById((int) $request->getParameter('group_id', TBGSettings::get(TBGSettings::SETTING_USER_GROUP))));
$user->setEnabled();
$user->setActivated();
if ($request->hasParameter('password') && !(empty($request['password']) && empty($request['password_repeat']))) {
if (empty($request['password']) || $request['password'] != $request['password_repeat']) {
throw new Exception($this->getI18n()->__('Please enter the same password twice'));
}
$password = $request['password'];
$user->setPassword($password);
} else {
$password = TBGUser::createPassword();
$user->setPassword($password);
}
$user->setJoined();
$user->save();
foreach ((array) $request['teams'] as $team_id) {
$user->addToTeam(TBGTeamsTable::getTable()->selectById((int) $team_id));
}
TBGEvent::createNew('core', 'config.createuser.save', $user, array('password' => $password))->trigger();
} else {
throw new Exception($this->getI18n()->__('Please enter a username'));
}
$this->getResponse()->setTemplate('configuration/findusers');
$this->too_short = false;
$this->created_user = true;
$this->users = array($user);
$this->total_results = 1;
$this->title = $this->getI18n()->__('User %username created', array('%username' => $username));
$this->total_count = TBGUser::getUsersCount();
$this->more_available = TBGContext::getScope()->hasUsersAvailable();
} catch (Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $e->getMessage()));
}
}
示例9: _geshify
protected function _geshify($matches)
{
if (!(is_array($matches) && count($matches) > 1)) {
return '';
}
$codeblock = $matches[2];
$params = $matches[1];
$language = preg_match('/(?<=lang=")(.+?)(?=")/', $params, $matches);
if ($language !== 0) {
$language = $matches[0];
} else {
$language = TBGSettings::get('highlight_default_lang');
}
$numbering_startfrom = preg_match('/(?<=line start=")(.+?)(?=")/', $params, $matches);
if ($numbering_startfrom !== 0) {
$numbering_startfrom = (int) $matches[0];
} else {
$numbering_startfrom = 1;
}
$geshi = new GeSHi($codeblock, $language);
$highlighting = preg_match('/(?<=line=")(.+?)(?=")/', $params, $matches);
if ($highlighting !== 0) {
$highlighting = $matches[0];
} else {
$highlighting = false;
}
$interval = preg_match('/(?<=highlight=")(.+?)(?=")/', $params, $matches);
if ($interval !== 0) {
$interval = $matches[0];
} else {
$interval = TBGSettings::get('highlight_default_interval');
}
if ($highlighting === false) {
switch (TBGSettings::get('highlight_default_numbering')) {
case 1:
// Line numbering with a highloght every n rows
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, $interval);
$geshi->start_line_numbers_at($numbering_startfrom);
break;
case 2:
// Normal line numbering
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS, 10);
$geshi->start_line_numbers_at($numbering_startfrom);
break;
case 3:
break;
// No numbering
}
} else {
switch ($highlighting) {
case 'highlighted':
case 'GESHI_FANCY_LINE_NUMBERS':
// Line numbering with a highloght every n rows
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, $interval);
$geshi->start_line_numbers_at($numbering_startfrom);
break;
case 'normal':
case 'GESHI_NORMAL_LINE_NUMBERS':
// Normal line numbering
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS, 10);
$geshi->start_line_numbers_at($numbering_startfrom);
break;
case 3:
break;
// No numbering
}
}
$codeblock = $geshi->parse_code();
unset($geshi);
return '<code>' . $codeblock . '</code>';
}
示例10: _upgradeFrom3dot1
protected function _upgradeFrom3dot1()
{
// Add classpath for existing old tables used for upgrade
TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'installation' . DS . 'classes' . DS . 'upgrade_3.1');
TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'mailing' . DS . 'classes' . DS . 'B2DB');
TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'mailing' . DS . 'classes');
TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'classes' . DS . 'B2DB');
TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'classes');
// Create new tables
TBGDashboardViewsTable::getTable()->create();
TBGOpenIdAccountsTable::getTable()->create();
TBGProjectAssignedUsersTable::getTable()->create();
TBGProjectAssignedTeamsTable::getTable()->create();
TBGEditionAssignedUsersTable::getTable()->create();
TBGEditionAssignedTeamsTable::getTable()->create();
TBGComponentAssignedUsersTable::getTable()->create();
TBGComponentAssignedTeamsTable::getTable()->create();
TBGRolePermissionsTable::getTable()->create();
TBGUserScopesTable::getTable()->create();
// Upgrade existing tables
TBGProjectsTable::getTable()->upgrade(TBGProjectsTable3dot1::getTable());
TBGUsersTable::getTable()->upgrade(TBGUsersTable3dot1::getTable());
TBGIssuesTable::getTable()->upgrade(TBGIssuesTable3dot1::getTable());
TBGIssueTypesTable::getTable()->upgrade(TBGIssueTypesTable3dot1::getTable());
TBGListTypesTable::getTable()->upgrade(TBGListTypesTable3dot1::getTable());
TBGEditionsTable::getTable()->upgrade(TBGEditionsTable3dot1::getTable());
TBGBuildsTable::getTable()->upgrade(TBGBuildsTable3dot1::getTable());
TBGCommentsTable::getTable()->upgrade(TBGCommentsTable3dot1::getTable());
TBGComponentsTable::getTable()->upgrade(TBGComponentsTable3dot1::getTable());
TBGCustomFieldsTable::getTable()->upgrade(TBGCustomFieldsTable3dot1::getTable());
TBGCustomFieldOptionsTable::getTable()->upgrade(TBGCustomFieldOptionsTable3dot1::getTable());
TBGIssueCustomFieldsTable::getTable()->upgrade(TBGIssueCustomFieldsTable3dot1::getTable());
// Create new module tables
TBGIncomingEmailAccountTable::getTable()->create();
// Add new indexes
TBGArticlesTable::getTable()->createIndexes();
TBGCommentsTable::getTable()->createIndexes();
TBGIssueAffectsBuildTable::getTable()->createIndexes();
TBGIssueAffectsComponentTable::getTable()->createIndexes();
TBGIssueAffectsEditionTable::getTable()->createIndexes();
TBGIssueFieldsTable::getTable()->createIndexes();
TBGIssueFilesTable::getTable()->createIndexes();
TBGIssuesTable::getTable()->createIndexes();
TBGIssuetypeSchemesTable::getTable()->createIndexes();
TBGPermissionsTable::getTable()->createIndexes();
TBGProjectsTable::getTable()->createIndexes();
TBGSettingsTable::getTable()->createIndexes();
TBGTeamMembersTable::getTable()->createIndexes();
TBGUserIssuesTable::getTable()->createIndexes();
TBGUsersTable::getTable()->createIndexes();
TBGUserScopesTable::getTable()->createIndexes();
if (TBGContext::getRequest()->getParameter('fix_my_timestamps', false)) {
$this->_fixTimestamps();
}
foreach (TBGScope::getAll() as $scope) {
TBGRole::loadFixtures($scope);
foreach (TBGDatatype::getTypes() as $type => $class) {
TBGContext::setPermission('set_datatype_' . $type, 0, 'core', 0, 0, 0, true, $scope->getID());
}
TBGContext::setPermission('page_confirm_scope_access', 0, 'core', 0, 0, 0, true, $scope->getID());
if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_WORKFLOW, 'core', $scope->getID())) {
$workflow_id = TBGWorkflowsTable::getTable()->getFirstIdByScope($scope->getID());
if ($workflow_id) {
TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_WORKFLOW, $workflow_id, 'core', $scope->getID());
} else {
TBGWorkflow::loadFixtures($scope);
}
}
if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_WORKFLOWSCHEME, 'core', $scope->getID())) {
$workflow_scheme_id = TBGWorkflowSchemesTable::getTable()->getFirstIdByScope($scope->getID());
if ($workflow_scheme_id) {
TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_WORKFLOWSCHEME, $workflow_scheme_id, 'core', $scope->getID());
} else {
TBGWorkflowScheme::loadFixtures($scope);
}
}
if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_ISSUETYPESCHEME, 'core', $scope->getID())) {
$issuetype_scheme_id = TBGIssuetypeSchemesTable::getTable()->getFirstIdByScope($scope->getID());
if ($issuetype_scheme_id) {
TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_ISSUETYPESCHEME, $issuetype_scheme_id, 'core', $scope->getID());
} else {
TBGIssuetypeScheme::loadFixtures($scope);
}
}
TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_ID, 0, 'core', $scope->getID());
TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_TYPE, 0, 'core', $scope->getID());
TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_ID, 0, 'core', $scope->getID());
TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_TYPE, 0, 'core', $scope->getID());
}
$linkstable = TBGLinksTable::getTable();
$crit = $linkstable->getCriteria();
$crit->addUpdate(TBGLinksTable::URL, 'http://issues.thebuggenie.com');
$crit->addWhere(TBGLinksTable::URL, 'http://thebuggenie.com/thebuggenie');
$crit->addOr(TBGLinksTable::URL, 'http://www.thebuggenie.com/thebuggenie');
$linkstable->doUpdate($crit);
$listtypestable = TBGListTypesTable::getTable();
$crit = $listtypestable->getCriteria();
$crit->addUpdate(TBGListTypesTable::ITEMTYPE, 'role');
$crit->addWhere(TBGListTypesTable::ITEMTYPE, 'projectrole');
$listtypestable->doUpdate($crit);
//.........这里部分代码省略.........
示例11: __
</td>
</tr>
<tr>
<td><label for="highlight_default_interval"><?php
echo __('Default line highlight interval');
?>
</label></td>
<td>
<input type="text" name="<?php
echo TBGSettings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_INTERVAL;
?>
" style="width: 50px;"<?php
if ($access_level != TBGSettings::ACCESS_FULL) {
?>
disabled<?php
}
?>
id="highlight_default_interval" value="<?php
echo TBGSettings::get('highlight_default_interval');
?>
" />
</td>
</tr>
<tr>
<td class="config_explanation" colspan="2"><?php
echo __('When using fancy numbering, you can have a line highlighted at a regular interval. Set the default interval to use here, if not otherwise specified');
?>
</td>
</tr>
</table>
示例12: processCommit
public static function processCommit(TBGProject $project, $commit_msg, $old_rev, $new_rev, $date = null, $changed, $author, $branch = null)
{
$output = '';
TBGContext::setCurrentProject($project);
if ($project->isArchived()) {
return;
}
try {
TBGContext::getI18n();
} catch (Exception $e) {
TBGContext::reinitializeI18n(null);
}
// Is VCS Integration enabled?
if (TBGSettings::get('vcs_mode_' . $project->getID(), 'vcs_integration') == TBGVCSIntegration::MODE_DISABLED) {
$output .= '[VCS ' . $project->getKey() . '] This project does not use VCS Integration' . "\n";
return $output;
}
// Parse the commit message, and obtain the issues and transitions for issues.
$parsed_commit = TBGIssue::getIssuesFromTextByRegex($commit_msg);
$issues = $parsed_commit["issues"];
$transitions = $parsed_commit["transitions"];
// If no issues exist, we may not be able to continue
// if (count($issues) == 0)
// {
// $output .= '[VCS '.$project->getKey().'] This project only accepts commits which affect issues' . "\n";
// return $output;
// }
// Build list of affected files
$file_lines = preg_split('/[\\n\\r]+/', $changed);
$files = array();
foreach ($file_lines as $aline) {
$action = mb_substr($aline, 0, 1);
if ($action == "A" || $action == "U" || $action == "D" || $action == "M") {
$theline = trim(mb_substr($aline, 1));
$files[] = array($action, $theline);
}
}
// Find author of commit, fallback is guest
/*
* Some VCSes use a different format of storing the committer's name. Systems like bzr, git and hg use the format
* Joe Bloggs <me@example.com>, instead of a classic username. Therefore a user will be found via 4 queries:
* a) First we extract the email if there is one, and find a user with that email
* b) If one is not found - or if no email was specified, then instead test against the real name (using the name part if there was an email)
* c) the username or full name is checked against the friendly name field
* d) and if we still havent found one, then we check against the username
* e) and if we STILL havent found one, we use the guest user
*/
if (preg_match("/(?<=<)(.*)(?=>)/", $author, $matches)) {
$email = $matches[0];
// a)
$user = TBGUsersTable::getTable()->getByEmail($email);
if (!$user instanceof TBGUser) {
// Not found by email
preg_match("/(?<=^)(.*)(?= <)/", $author, $matches);
$author = $matches[0];
}
}
// b)
if (!$user instanceof TBGUser) {
$user = TBGUsersTable::getTable()->getByRealname($author);
}
// c)
if (!$user instanceof TBGUser) {
$user = TBGUsersTable::getTable()->getByBuddyname($author);
}
// d)
if (!$user instanceof TBGUser) {
$user = TBGUsersTable::getTable()->getByUsername($author);
}
// e)
if (!$user instanceof TBGUser) {
$user = TBGSettings::getDefaultUser();
}
TBGContext::setUser($user);
TBGSettings::forceSettingsReload();
TBGContext::cacheAllPermissions();
$output .= '[VCS ' . $project->getKey() . '] Commit to be logged by user ' . $user->getName() . "\n";
if ($date == null) {
$date = NOW;
}
// Create the commit data
$commit = new TBGVCSIntegrationCommit();
$commit->setAuthor($user);
$commit->setDate($date);
$commit->setLog($commit_msg);
$commit->setPreviousRevision($old_rev);
$commit->setRevision($new_rev);
$commit->setProject($project);
if ($branch !== null) {
$data = 'branch:' . $branch;
$commit->setMiscData($data);
}
$commit->save();
$output .= '[VCS ' . $project->getKey() . '] Commit logged with revision ' . $commit->getRevision() . "\n";
// Iterate over affected issues and update them.
foreach ($issues as $issue) {
$inst = new TBGVCSIntegrationIssueLink();
$inst->setIssue($issue);
$inst->setCommit($commit);
$inst->save();
//.........这里部分代码省略.........
示例13: _initializeColumns
protected function _initializeColumns()
{
if (!is_array($this->_columns)) {
if (!strlen($this->_columns)) {
if ($columns = TBGSettings::get('search_scs_' . $this->getTemplateName())) {
$this->_columns = explode(',', $columns);
} else {
$this->_columns = self::getDefaultVisibleColumns();
}
} else {
$this->_columns = explode(',', $this->_columns);
}
}
}
示例14: getPlanningColumns
/**
* @param \TBGUser $user
* @return array
*/
public function getPlanningColumns(TBGUser $user)
{
$columns = TBGSettings::get('planning_columns_' . $this->getID(), 'project', TBGContext::getScope()->getID(), $user->getID());
$columns = explode(',', $columns);
if (empty($columns) || isset($columns[0]) && empty($columns[0])) {
// Default values
$columns = array('priority', 'estimated_time', 'spent_time');
}
// Set array keys to equal array values
$columns = array_combine($columns, $columns);
return $columns;
}
示例15: getTimezone
/**
* Get this users timezone
*
* @return mixed
*/
public function getTimezone()
{
if ($this->_timezone == null) {
$this->_timezone = TBGSettings::get('timezone', 'core', null, $this->getID());
}
return $this->_timezone;
}