当前位置: 首页>>代码示例>>PHP>>正文


PHP Settings::get方法代码示例

本文整理汇总了PHP中thebuggenie\core\framework\Settings::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Settings::get方法的具体用法?PHP Settings::get怎么用?PHP Settings::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在thebuggenie\core\framework\Settings的用法示例。


在下文中一共展示了Settings::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: do_execute

 public function do_execute()
 {
     /* Prepare variables */
     try {
         $project_id = $this->getProvidedArgument('projectid');
         $project_row = \thebuggenie\core\entities\tables\Projects::getTable()->getById($project_id, false);
         \thebuggenie\core\framework\Context::setScope(new \thebuggenie\core\entities\Scope($project_row[\thebuggenie\core\entities\tables\Projects::SCOPE]));
         $project = new \thebuggenie\core\entities\Project($project_id, $project_row);
     } catch (\Exception $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 (\thebuggenie\core\framework\Settings::get('access_method_' . $project->getKey()) == Vcs_integration::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 && !ctype_digit($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 = Vcs_integration::processCommit($project, $commit_msg, $old_rev, $new_rev, $date, $changed, $author, $branch);
     $this->cliEcho($output);
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:33,代码来源:Report.php

示例2: loadFixtures

 public static function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     $scope_id = $scope->getID();
     $admin_group = new \thebuggenie\core\entities\Group();
     $admin_group->setName('Administrators');
     $admin_group->setScope($scope);
     $admin_group->save();
     \thebuggenie\core\framework\Settings::saveSetting('admingroup', $admin_group->getID(), 'core', $scope_id);
     $user_group = new \thebuggenie\core\entities\Group();
     $user_group->setName('Regular users');
     $user_group->setScope($scope);
     $user_group->save();
     \thebuggenie\core\framework\Settings::saveSetting('defaultgroup', $user_group->getID(), 'core', $scope_id);
     $guest_group = new \thebuggenie\core\entities\Group();
     $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) = \thebuggenie\core\entities\User::loadFixtures($scope, $admin_group, $user_group, $guest_group);
         tables\UserScopes::getTable()->addUserToScope($guestuser_id, $scope->getID(), $guest_group->getID(), true);
         tables\UserScopes::getTable()->addUserToScope($adminuser_id, $scope->getID(), $admin_group->getID(), true);
     } else {
         $default_scope_id = \thebuggenie\core\framework\Settings::getDefaultScopeID();
         $default_user_id = (int) \thebuggenie\core\framework\Settings::get(\thebuggenie\core\framework\Settings::SETTING_DEFAULT_USER_ID, 'core', $default_scope_id);
         tables\UserScopes::getTable()->addUserToScope($default_user_id, $scope->getID(), $user_group->getID(), true);
         tables\UserScopes::getTable()->addUserToScope(1, $scope->getID(), $admin_group->getID());
         \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_DEFAULT_USER_ID, $default_user_id, 'core', $scope->getID());
     }
     tables\Permissions::getTable()->loadFixtures($scope, $admin_group->getID(), $guest_group->getID());
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:31,代码来源:Group.php

示例3: addUserToScope

 public function addUserToScope($user_id, $scope_id, $group_id = null, $confirmed = false)
 {
     $group_id = $group_id === null ? \thebuggenie\core\framework\Settings::get(\thebuggenie\core\framework\Settings::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);
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:10,代码来源:UserScopes.php

示例4: do_execute

 public function do_execute()
 {
     $hostname = $this->getProvidedArgument('hostname');
     $this->cliEcho('Checking scope availability ...');
     if (tables\ScopeHostnames::getTable()->getScopeIDForHostname($hostname) === null) {
         $this->cliEcho("available!\n");
         $this->cliEcho("Creating scope ...");
         $scope = new entities\Scope();
         $scope->addHostname($hostname);
         $scope->setName($this->getProvidedArgument('shortname'));
         $uploads_enabled = $this->getProvidedArgument('enable_uploads', 'yes') == 'yes';
         $scope->setUploadsEnabled((bool) $uploads_enabled);
         $scope->setMaxUploadLimit($this->getProvidedArgument('upload_limit', 0));
         $scope->setMaxProjects($this->getProvidedArgument('projects', 0));
         $scope->setMaxUsers($this->getProvidedArgument('users', 0));
         $scope->setMaxTeams($this->getProvidedArgument('teams', 0));
         $scope->setMaxWorkflowsLimit($this->getProvidedArgument('workflows', 0));
         $scope->setEnabled();
         $this->cliEcho(".");
         $scope->save();
         $this->cliEcho(".done!\n");
         $admin_user = $this->getProvidedArgument('scope_admin');
         if ($admin_user) {
             $user = entities\User::getByUsername($admin_user);
             if ($user instanceof entities\User) {
                 $this->cliEcho("Adding user {$admin_user} to scope\n");
                 $admin_group_id = (int) framework\Settings::get(framework\Settings::SETTING_ADMIN_GROUP, 'core', $scope->getID());
                 tables\UserScopes::getTable()->addUserToScope($user->getID(), $scope->getID(), $admin_group_id, true);
             } else {
                 $this->cliEcho("Could not add user {$admin_user} to scope (username not found)\n");
             }
         }
         if ($this->getProvidedArgument('remove_admin', 'no') == 'yes') {
             $this->cliEcho("Removing administrator user from scope\n");
             tables\UserScopes::getTable()->removeUserFromScope(1, $scope->getID());
         }
         foreach (framework\Context::getModules() as $module) {
             $module_name = $module->getName();
             if ($module_name == 'publish') {
                 continue;
             }
             if ($this->getProvidedArgument("install_module_{$module_name}", "no") == 'yes') {
                 $this->cliEcho("Installing module {$module_name}\n");
                 entities\Module::installModule($module_name, $scope);
             }
         }
     } else {
         $this->cliEcho("not available\n", 'red');
     }
     $this->cliEcho("\n");
 }
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:51,代码来源:CreateScope.php

示例5: __

        <td><label for="highlight_default_interval"><?php 
echo __('Default line highlight interval');
?>
</label></td>
        <td>
            <input type="text" name="<?php 
echo \thebuggenie\core\framework\Settings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_INTERVAL;
?>
" style="width: 50px;"<?php 
if ($access_level != \thebuggenie\core\framework\Settings::ACCESS_FULL) {
    ?>
 disabled<?php 
}
?>
 id="highlight_default_interval" value="<?php 
echo \thebuggenie\core\framework\Settings::get('highlight_default_interval');
?>
" />
            <?php 
echo config_explanation(__('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>
    <tr>
        <td><label for="notification_poll_interval"><?php 
echo __('Notification poll interval');
?>
</label></td>
        <td>
            <input type="text" name="<?php 
echo \thebuggenie\core\framework\Settings::SETTING_NOTIFICATION_POLL_INTERVAL;
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:31,代码来源:_general.inc.php

示例6: tbg_parse_text

?>
            </ul>
        </div>
        <div id="account_tabs_panes">
            <div id="tab_profile_pane" style="<?php 
if ($selected_tab != 'profile') {
    ?>
 display: none;<?php 
}
?>
">
                <?php 
if (\thebuggenie\core\framework\Settings::isUsingExternalAuthenticationBackend()) {
    ?>
                    <?php 
    echo tbg_parse_text(\thebuggenie\core\framework\Settings::get('changedetails_message'), false, null, array('embedded' => true));
    ?>
                <?php 
} else {
    ?>
                    <form accept-charset="<?php 
    echo \thebuggenie\core\framework\Context::getI18n()->getCharset();
    ?>
" action="<?php 
    echo make_url('account_save_information');
    ?>
" onsubmit="TBG.Main.Profile.updateInformation('<?php 
    echo make_url('account_save_information');
    ?>
'); return false;" method="post" id="profile_information_form">
                        <h3><?php 
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:31,代码来源:myaccount.html.php

示例7: reinitializeI18n

 /**
  * Reinitialize the i18n object, used only when changing the language in the middle of something
  *
  * @param string $language The language code to change to
  */
 public static function reinitializeI18n($language = null)
 {
     if (!$language) {
         self::$_i18n = new I18n(Settings::get('language'));
     } else {
         Logging::log('Changing language to ' . $language);
         self::$_i18n = new I18n($language);
         self::$_i18n->initialize();
     }
 }
开发者ID:JonathanRH,项目名称:thebuggenie,代码行数:15,代码来源:Context.php

示例8: runAddCommitGitorious

 public function runAddCommitGitorious(framework\Request $request)
 {
     framework\Context::getResponse()->setContentType('text/plain');
     framework\Context::getResponse()->renderHeaders();
     $passkey = framework\Context::getRequest()->getParameter('passkey');
     $project_id = framework\Context::getRequest()->getParameter('project_id');
     $project = Project::getB2DBTable()->selectByID($project_id);
     // Validate access
     if (!$project) {
         echo 'Error: The project with the ID ' . $project_id . ' does not exist';
         exit;
     }
     if (framework\Settings::get('access_method_' . $project->getID(), 'vcs_integration') == Vcs_integration::ACCESS_DIRECT) {
         echo 'Error: This project uses the CLI access method, and so access via HTTP has been disabled';
         exit;
     }
     if (framework\Settings::get('access_passkey_' . $project->getID(), 'vcs_integration') != $passkey) {
         echo 'Error: The passkey specified does not match the passkey specified for this project';
         exit;
     }
     // Validate data
     $data = html_entity_decode(framework\Context::getRequest()->getParameter('payload', null, false));
     if (empty($data) || $data == null) {
         die('Error: No payload was provided');
     }
     $entries = json_decode($data);
     if ($entries == null) {
         die('Error: The payload could not be decoded');
     }
     $entries = json_decode($data);
     $previous = $entries->before;
     // Branch is stored in the ref
     $ref = $entries->ref;
     $parts = explode('/', $ref);
     if (count($parts) == 3) {
         $branch = $parts[2];
     } else {
         $branch = null;
     }
     // Parse each commit individually
     foreach (array_reverse($entries->commits) as $commit) {
         $email = $commit->author->email;
         $author = $commit->author->name;
         $new_rev = $commit->id;
         $old_rev = $previous;
         $commit_msg = $commit->message;
         $time = strtotime($commit->timestamp);
         // Add commit
         echo Vcs_integration::processCommit($project, $commit_msg, $old_rev, $previous, $time, "", $author, $branch);
         $previous = $new_rev;
         exit;
     }
 }
开发者ID:underblaze,项目名称:thebuggenie-4.1.0,代码行数:53,代码来源:Main.php

示例9: __

</label></td>
                        <td style="width: 580px; position: relative;">
                            <input type="text" name="blob_url" style="width: 100%" id="blob_url" value="<?php 
    echo \thebuggenie\core\framework\Settings::get('blob_url_' . $project->getID(), 'vcs_integration');
    ?>
" style="width: 100;">
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 200px;"><label for="diff_url"><?php 
    echo __('Diff page');
    ?>
</label></td>
                        <td style="width: 580px; position: relative;">
                            <input type="text" name="diff_url" style="width: 100%" id="diff_url" value="<?php 
    echo \thebuggenie\core\framework\Settings::get('diff_url_' . $project->getID(), 'vcs_integration');
    ?>
" style="width: 100;">
                        </td>
                    </tr>
                </table>
            </div>
            <table style="clear: both; width: 780px;" class="padded_table" cellpadding=0 cellspacing=0>
                <tr>
                    <td colspan="2" style="padding: 10px 0 10px 10px; text-align: right;">
                        <div style="float: left; font-size: 13px; padding-top: 2px; font-style: italic;" class="config_explanation"><?php 
    echo __('When you are done, click "%save" to save your changes on all tabs', array('%save' => __('Save')));
    ?>
</div>
                        <div id="vcs_button" style="float: right; font-size: 14px; font-weight: bold;">
                            <input type="submit" class="button button-green" value="<?php 
开发者ID:founderio,项目名称:thebuggenie,代码行数:31,代码来源:_projectconfig_panel.inc.php

示例10: get_spaced_name

} else {
    ?>
    <?php 
    if ($article->getArticleType() == \thebuggenie\modules\publish\entities\Article::TYPE_MANUAL) {
        echo get_spaced_name($article->getManualName());
    } else {
        $namespaces = explode(':', $article_name);
        if (count($namespaces) > 1 && $namespaces[0] == 'Category') {
            array_shift($namespaces);
            echo '<span class="faded_out blue">Category:</span>';
        }
        if (\thebuggenie\core\framework\Context::isProjectContext() && count($namespaces) > 1 && mb_strtolower($namespaces[0]) == \thebuggenie\core\framework\Context::getCurrentProject()->getKey()) {
            array_shift($namespaces);
            echo '<span>', \thebuggenie\core\framework\Context::getCurrentProject()->getName(), ':</span>';
        }
        echo \thebuggenie\core\framework\Settings::get('allow_camelcase_links', 'publish', \thebuggenie\core\framework\Context::getScope()->getID(), 0) ? get_spaced_name(implode(':', $namespaces)) : implode(':', $namespaces);
    }
    ?>
    <?php 
}
?>
    <?php 
if ($article->getID() && $mode) {
    switch ($mode) {
        /* case 'edit':
           ?><span class="faded_out"><?php echo __('%article_name ~ Edit', array('%article_name' => '')); ?></span><?php
           break; */
        case 'history':
            ?>
<span class="faded_out"><?php 
            echo __('%article_name ~ History', array('%article_name' => ''));
开发者ID:nrensen,项目名称:thebuggenie,代码行数:31,代码来源:_header.inc.php

示例11: _geshify

 protected function _geshify($matches)
 {
     if (!(is_array($matches) && count($matches) > 1)) {
         return '';
     }
     $codeblock = $matches[2];
     if (strlen(trim($codeblock))) {
         $params = $matches[1];
         $language = preg_match('/(?<=lang=")(.+?)(?=")/', $params, $matches);
         if ($language !== 0) {
             $language = $matches[0];
         } else {
             $language = \thebuggenie\core\framework\Settings::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 = \thebuggenie\core\framework\Settings::get('highlight_default_interval');
         }
         if ($highlighting === false) {
             switch (\thebuggenie\core\framework\Settings::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>';
 }
开发者ID:underblaze,项目名称:thebuggenie-4.1.0,代码行数:73,代码来源:TextParser.php

示例12: processCommit

 public static function processCommit(\thebuggenie\core\entities\Project $project, $commit_msg, $old_rev, $new_rev, $date = null, $changed, $author, $branch = null, \Closure $callback = null)
 {
     $output = '';
     framework\Context::setCurrentProject($project);
     if ($project->isArchived()) {
         return;
     }
     if (Commits::getTable()->isProjectCommitProcessed($new_rev, $project->getID())) {
         return;
     }
     try {
         framework\Context::getI18n();
     } catch (\Exception $e) {
         framework\Context::reinitializeI18n(null);
     }
     // Is VCS Integration enabled?
     if (framework\Settings::get('vcs_mode_' . $project->getID(), 'vcs_integration') == self::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 = \thebuggenie\core\entities\Issue::getIssuesFromTextByRegex($commit_msg);
     $issues = $parsed_commit["issues"];
     $transitions = $parsed_commit["transitions"];
     // 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
      */
     // a)
     $user = \thebuggenie\core\entities\tables\Users::getTable()->getByEmail($author);
     if (!$user instanceof \thebuggenie\core\entities\User && preg_match("/(?<=<)(.*)(?=>)/", $author, $matches)) {
         $email = $matches[0];
         // a2)
         $user = \thebuggenie\core\entities\tables\Users::getTable()->getByEmail($email);
         if (!$user instanceof \thebuggenie\core\entities\User) {
             // Not found by email
             preg_match("/(?<=^)(.*)(?= <)/", $author, $matches);
             $author = $matches[0];
         }
     }
     // b)
     if (!$user instanceof \thebuggenie\core\entities\User) {
         $user = \thebuggenie\core\entities\tables\Users::getTable()->getByRealname($author);
     }
     // c)
     if (!$user instanceof \thebuggenie\core\entities\User) {
         $user = \thebuggenie\core\entities\tables\Users::getTable()->getByBuddyname($author);
     }
     // d)
     if (!$user instanceof \thebuggenie\core\entities\User) {
         $user = \thebuggenie\core\entities\tables\Users::getTable()->getByUsername($author);
     }
     // e)
     if (!$user instanceof \thebuggenie\core\entities\User) {
         $user = framework\Settings::getDefaultUser();
     }
     framework\Context::setUser($user);
     framework\Settings::forceSettingsReload();
     framework\Context::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 Commit();
     $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);
     }
     if ($callback !== null) {
         $commit = $callback($commit);
     }
     $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 IssueLink();
         $inst->setIssue($issue);
//.........这里部分代码省略.........
开发者ID:AzerothShard,项目名称:thebuggenie,代码行数:101,代码来源:Vcs_integration.php

示例13: getPlanningColumns

 /**
  * @param \thebuggenie\core\entities\User $user
  * @return array
  */
 public function getPlanningColumns(\thebuggenie\core\entities\User $user)
 {
     $columns = framework\Settings::get('planning_columns_' . $this->getID(), 'project', framework\Context::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;
 }
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:16,代码来源:Project.php

示例14: runRegister

 /**
  * Registration logic
  *
  * @Route(name="register", url="/do/register")
  * @AnonymousRoute
  *
  * @param \thebuggenie\core\framework\Request $request
  */
 public function runRegister(framework\Request $request)
 {
     framework\Context::loadLibrary('common');
     $i18n = framework\Context::getI18n();
     $fields = array();
     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 = tables\Users::getTable()->isUsernameAvailable($username);
         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;
             if (tbg_check_syntax($email, "EMAIL")) {
                 $email_ok = true;
             }
             if ($email_ok && framework\Settings::get('limit_registration') != '') {
                 $allowed_domains = preg_replace('/[[:space:]]*,[[:space:]]*/', '|', framework\Settings::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 ($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 = entities\User::createPassword();
             $user = new entities\User();
             $user->setUsername($username);
             $user->setRealname($realname);
             $user->setBuddyname($buddyname);
             $user->setGroup(framework\Settings::getDefaultGroup());
             $user->setEnabled();
             $user->setPassword($password);
             $user->setEmail($email);
             $user->setJoined();
             $user->save();
             $_SESSION['activation_number'] = tbg_printRandomNumber();
             if ($user->isActivated()) {
                 framework\Context::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));
     }
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:78,代码来源:Main.php

示例15: listen_get_backdrop_partial

 /**
  * @Listener(module='core', identifier='get_backdrop_partial')
  * @param \thebuggenie\core\framework\Event $event
  */
 public function listen_get_backdrop_partial(framework\Event $event)
 {
     $request = framework\Context::getRequest();
     $options = array();
     switch ($event->getSubject()) {
         case 'agileboard':
             $template_name = 'agile/editagileboard';
             $board = $request['board_id'] ? entities\tables\AgileBoards::getTable()->selectById($request['board_id']) : new entities\AgileBoard();
             if (!$board->getID()) {
                 $board->setAutogeneratedSearch(\thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES);
                 $board->setTaskIssuetype(framework\Settings::get('issuetype_task'));
                 $board->setEpicIssuetype(framework\Settings::get('issuetype_epic'));
                 $board->setIsPrivate($request->getParameter('is_private', true));
                 $board->setProject($request['project_id']);
             }
             $options['board'] = $board;
             break;
         case 'milestone_finish':
             $template_name = 'agile/milestonefinish';
             $options['project'] = \thebuggenie\core\entities\tables\Projects::getTable()->selectById($request['project_id']);
             $options['board'] = entities\tables\AgileBoards::getTable()->selectById($request['board_id']);
             $options['milestone'] = \thebuggenie\core\entities\tables\Milestones::getTable()->selectById($request['milestone_id']);
             if (!$options['milestone']->hasReachedDate()) {
                 $options['milestone']->setReachedDate(time());
             }
             break;
         case 'agilemilestone':
             $template_name = 'agile/milestone';
             $options['project'] = \thebuggenie\core\entities\tables\Projects::getTable()->selectById($request['project_id']);
             $options['board'] = entities\tables\AgileBoards::getTable()->selectById($request['board_id']);
             if ($request->hasParameter('milestone_id')) {
                 $options['milestone'] = \thebuggenie\core\entities\tables\Milestones::getTable()->selectById($request['milestone_id']);
             }
             break;
         default:
             return;
     }
     foreach ($options as $key => $value) {
         $event->addToReturnList($value, $key);
     }
     $event->setReturnValue($template_name);
     $event->setProcessed();
 }
开发者ID:shoreless-Limited,项目名称:thebuggenie,代码行数:47,代码来源:Agile.php


注:本文中的thebuggenie\core\framework\Settings::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。