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


PHP TBGContext::getRequest方法代码示例

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


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

示例1: componentLeftmenu

 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');
         }
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:46,代码来源:actioncomponents.class.php

示例2: log

 /**
  * Log a message to the logger
  *
  * @param string $message The message to log
  * @param string $category[optional] The message category (default "main")
  * @param integer $level[optional] The loglevel
  */
 public static function log($message, $category = 'main', $level = 1)
 {
     if (!self::$_logging_enabled) {
         return false;
     }
     if (self::$_loglevel > $level) {
         return false;
     }
     if (self::$_cli_log_to_screen_in_debug_mode && TBGContext::isCLI() && TBGContext::isDebugMode() && class_exists('TBGCliCommand')) {
         TBGCliCommand::cli_echo(mb_strtoupper(self::getLevelName($level)), 'white', 'bold');
         TBGCliCommand::cli_echo(" [{$category}] ", 'green', 'bold');
         TBGCliCommand::cli_echo("{$message}\n");
     }
     if (self::$_logonajaxcalls || TBGContext::getRequest()->isAjaxCall()) {
         if (self::$_logfile !== null) {
             file_put_contents(self::$_logfile, mb_strtoupper(self::getLevelName($level)) . " [{$category}] {$message}\n", FILE_APPEND);
         }
         $time_msg = TBGContext::isDebugMode() ? ($load_time = TBGContext::getLoadtime()) >= 1 ? round($load_time, 2) . ' seconds' : round($load_time * 1000, 3) . ' ms' : '';
         self::$_entries[] = array('category' => $category, 'time' => $time_msg, 'message' => $message, 'level' => $level);
         self::$_categorized_entries[$category][] = array('time' => $time_msg, 'message' => $message, 'level' => $level);
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:29,代码来源:TBGLogging.class.php

示例3: componentLeftmenu

 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');
         }
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:24,代码来源:actioncomponents.class.php

示例4: processIncomingEmailCommand

 public function processIncomingEmailCommand($content, TBGIssue $issue, TBGUser $user)
 {
     if (!$issue->isWorkflowTransitionsAvailable()) {
         return false;
     }
     $lines = preg_split("/(\r?\n)/", $content);
     $first_line = array_shift($lines);
     $commands = explode(" ", trim($first_line));
     $command = array_shift($commands);
     foreach ($issue->getAvailableWorkflowTransitions() as $transition) {
         if (strpos(str_replace(array(' ', '/'), array('', ''), mb_strtolower($transition->getName())), str_replace(array(' ', '/'), array('', ''), mb_strtolower($command))) !== false) {
             foreach ($commands as $single_command) {
                 if (mb_strpos($single_command, '=')) {
                     list($key, $val) = explode('=', $single_command);
                     switch ($key) {
                         case 'resolution':
                             if (($resolution = TBGResolution::getResolutionByKeyish($val)) instanceof TBGResolution) {
                                 TBGContext::getRequest()->setParameter('resolution_id', $resolution->getID());
                             }
                             break;
                         case 'status':
                             if (($status = TBGStatus::getStatusByKeyish($val)) instanceof TBGStatus) {
                                 TBGContext::getRequest()->setParameter('status_id', $status->getID());
                             }
                             break;
                     }
                 }
             }
             TBGContext::getRequest()->setParameter('comment_body', join("\n", $lines));
             return $transition->transitionIssueToOutgoingStepWithoutRequest($issue);
         }
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:33,代码来源:TBGMailing.class.php

示例5: runSaveAuthentication

 public function runSaveAuthentication(TBGRequest $request)
 {
     if (TBGContext::getRequest()->isMethod(TBGRequest::POST)) {
         $this->forward403unless($this->access_level == TBGSettings::ACCESS_FULL);
         $settings = array(TBGSettings::SETTING_AUTH_BACKEND, 'register_message', 'forgot_message', 'changepw_message', 'changedetails_message');
         foreach ($settings as $setting) {
             if (TBGContext::getRequest()->getParameter($setting) !== null) {
                 $value = TBGContext::getRequest()->getParameter($setting);
                 TBGSettings::saveSetting($setting, $value);
             }
         }
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:13,代码来源:actions.class.php

示例6: componentSpecialWhatLinksHere

 public function componentSpecialWhatLinksHere()
 {
     $this->linked_article_name = TBGContext::getRequest()->getParameter('linked_article_name');
     $this->articles = TBGArticlesTable::getTable()->getAllByLinksToArticleName($this->linked_article_name);
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:5,代码来源:actioncomponents.class.php

示例7: runAddCommitGitorious

 public function runAddCommitGitorious(TBGRequest $request)
 {
     if (!TBGContext::getModule('vcs_integration')->isUsingHTTPMethod()) {
         echo 'Error: This access method has been disallowed';
         exit;
     }
     $passkey = TBGContext::getRequest()->getParameter('passkey');
     if ($passkey != TBGContext::getModule('vcs_integration')->getSetting('vcs_passkey')) {
         echo 'Error: Invalid passkey';
         exit;
     }
     $project = TBGContext::getRequest()->getParameter('project');
     $data = TBGContext::getRequest()->getParameter('payload', null, false);
     if (empty($data) || $data == null) {
         die('Error: Invalid data');
     }
     if (!function_exists('json_decode')) {
         die('Error: Gitorious support requires either PHP 5.2.0 or later, or the json PECL module version 1.2.0 or later for prior versions of PHP');
     }
     $entries = json_decode($data);
     echo $project;
     $previous = $entries->before;
     // 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);
         //$f_issues = array_unique($f_issues[3]);
         //$file_lines = preg_split('/[\n\r]+/', $changed);
         //$files = array();
         echo TBGContext::getModule('vcs_integration')->addNewCommit($project, $commit_msg, $old_rev, $previous, $time, "", $author);
         $previous = $new_rev;
         exit;
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:38,代码来源:actions.class.php

示例8: loginCheck

 /**
  * Returns the logged in user, or default user if not logged in
  *
  * @param TBGRequest $request
  * @param TBGAction  $action
  *
  * @return TBGUser
  */
 public static function loginCheck(TBGRequest $request, TBGAction $action)
 {
     try {
         $authentication_method = $action->getAuthenticationMethodForAction(TBGContext::getRouting()->getCurrentRouteAction());
         $user = null;
         $external = false;
         switch ($authentication_method) {
             case TBGAction::AUTHENTICATION_METHOD_ELEVATED:
             case TBGAction::AUTHENTICATION_METHOD_CORE:
                 $username = $request['tbg3_username'];
                 $password = $request['tbg3_password'];
                 if ($authentication_method == TBGAction::AUTHENTICATION_METHOD_ELEVATED) {
                     $elevated_password = $request['tbg3_elevated_password'];
                 }
                 $raw = true;
                 // If no username and password specified, check if we have a session that exists already
                 if ($username === null && $password === null) {
                     if (TBGContext::getRequest()->hasCookie('tbg3_username') && TBGContext::getRequest()->hasCookie('tbg3_password')) {
                         $username = TBGContext::getRequest()->getCookie('tbg3_username');
                         $password = TBGContext::getRequest()->getCookie('tbg3_password');
                         $user = TBGUsersTable::getTable()->getByUsername($username);
                         if ($authentication_method == TBGAction::AUTHENTICATION_METHOD_ELEVATED) {
                             $elevated_password = TBGContext::getRequest()->getCookie('tbg3_elevated_password');
                             if ($user instanceof TBGUser && !$user->hasPasswordHash($password)) {
                                 $user = null;
                             } else {
                                 if ($user instanceof TBGUser && !$user->hasPasswordHash($elevated_password)) {
                                     TBGContext::setUser($user);
                                     TBGContext::getRouting()->setCurrentRouteName('elevated_login_page');
                                     throw new TBGElevatedLoginException('reenter');
                                 }
                             }
                         } else {
                             if ($user instanceof TBGUser && !$user->hasPasswordHash($password)) {
                                 $user = null;
                             }
                         }
                         $raw = false;
                         if (!$user instanceof TBGUser) {
                             TBGContext::logout();
                             throw new Exception('No such login');
                         }
                     }
                 }
                 // If we have authentication details, validate them
                 if (TBGSettings::isUsingExternalAuthenticationBackend() && $username !== null && $password !== null) {
                     $external = true;
                     TBGLogging::log('Authenticating with backend: ' . TBGSettings::getAuthenticationBackend(), 'auth', TBGLogging::LEVEL_INFO);
                     try {
                         $mod = TBGContext::getModule(TBGSettings::getAuthenticationBackend());
                         if ($mod->getType() !== TBGModule::MODULE_AUTH) {
                             TBGLogging::log('Auth module is not the right type', 'auth', TBGLogging::LEVEL_FATAL);
                         }
                         if (TBGContext::getRequest()->hasCookie('tbg3_username') && TBGContext::getRequest()->hasCookie('tbg3_password')) {
                             $user = $mod->verifyLogin($username, $password);
                         } else {
                             $user = $mod->doLogin($username, $password);
                         }
                         if (!$user instanceof TBGUser) {
                             // Invalid
                             TBGContext::logout();
                             throw new Exception('No such login');
                             //TBGContext::getResponse()->headerRedirect(TBGContext::getRouting()->generate('login'));
                         }
                     } catch (Exception $e) {
                         throw $e;
                     }
                 } elseif (TBGSettings::isUsingExternalAuthenticationBackend()) {
                     $external = true;
                     TBGLogging::log('Authenticating without credentials with backend: ' . TBGSettings::getAuthenticationBackend(), 'auth', TBGLogging::LEVEL_INFO);
                     try {
                         $mod = TBGContext::getModule(TBGSettings::getAuthenticationBackend());
                         if ($mod->getType() !== TBGModule::MODULE_AUTH) {
                             TBGLogging::log('Auth module is not the right type', 'auth', TBGLogging::LEVEL_FATAL);
                         }
                         $user = $mod->doAutoLogin();
                         if ($user == false) {
                             // Invalid
                             TBGContext::logout();
                             throw new Exception('No such login');
                             //TBGContext::getResponse()->headerRedirect(TBGContext::getRouting()->generate('login'));
                         }
                     } catch (Exception $e) {
                         throw $e;
                     }
                 } elseif ($username !== null && $password !== null && !$user instanceof TBGUser) {
                     $external = false;
                     TBGLogging::log('Using internal authentication', 'auth', TBGLogging::LEVEL_INFO);
                     $user = TBGUsersTable::getTable()->getByUsername($username);
                     if (!$user->hasPassword($password)) {
                         $user = null;
                     }
//.........这里部分代码省略.........
开发者ID:oparoz,项目名称:thebuggenie,代码行数:101,代码来源:TBGUser.class.php

示例9: getPredefinedFilters

 public static function getPredefinedFilters($type, TBGSavedSearch $search)
 {
     $filters = array();
     switch ($type) {
         case TBGContext::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES:
             $filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
             $filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => TBGContext::getCurrentProject()->getID()), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES_INCLUDING_SUBPROJECTS:
             $filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
             $filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => TBGContext::getCurrentProject()->getID()), $search);
             $filters['subprojects'] = self::createFilter('subprojects', array('operator' => '=', 'value' => 'all'), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_PROJECT_CLOSED_ISSUES:
             $filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'closed'), $search);
             $filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => TBGContext::getCurrentProject()->getID()), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_PROJECT_CLOSED_ISSUES_INCLUDING_SUBPROJECTS:
             $filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'closed'), $search);
             $filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => TBGContext::getCurrentProject()->getID()), $search);
             $filters['subprojects'] = self::createFilter('subprojects', array('operator' => '=', 'value' => 'all'), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_PROJECT_WISHLIST:
             $filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
             $filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => TBGContext::getCurrentProject()->getID()), $search);
             $types = array();
             foreach (TBGContext::getCurrentProject()->getIssuetypeScheme()->getIssuetypes() as $issuetype) {
                 if (in_array($issuetype->getIcon(), array('feature_request', 'enhancement'))) {
                     $types[] = $issuetype->getID();
                 }
             }
             if (count($types)) {
                 $filters['issuetype'] = self::createFilter('issuetype', array('operator' => '=', 'value' => join(',', $types)));
             }
             break;
         case TBGContext::PREDEFINED_SEARCH_PROJECT_REPORTED_LAST_NUMBEROF_TIMEUNITS:
             $filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => TBGContext::getCurrentProject()->getID()), $search);
             $units = TBGContext::getRequest()->getParameter('units');
             switch (TBGContext::getRequest()->getParameter('time_unit')) {
                 case 'seconds':
                     $time_unit = NOW - $units;
                     break;
                 case 'minutes':
                     $time_unit = NOW - 60 * $units;
                     break;
                 case 'hours':
                     $time_unit = NOW - 60 * 60 * $units;
                     break;
                 case 'days':
                     $time_unit = NOW - 86400 * $units;
                     break;
                 case 'weeks':
                     $time_unit = NOW - 86400 * 7 * $units;
                     break;
                 case 'months':
                     $time_unit = NOW - 86400 * 30 * $units;
                     break;
                 case 'years':
                     $time_unit = NOW - 86400 * 365 * $units;
                     break;
                 default:
                     $time_unit = NOW - 86400 * 30;
             }
             $filters['posted'] = self::createFilter('posted', array('operator' => '>=', 'value' => $time_unit), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_PROJECT_REPORTED_THIS_MONTH:
             $filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => TBGContext::getCurrentProject()->getID()), $search);
             $filters['posted'] = self::createFilter('posted', array('operator' => '>=', 'value' => mktime(date('H'), date('i'), date('s'), date('n'), 1)), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_PROJECT_MILESTONE_TODO:
             $filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
             $filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => TBGContext::getCurrentProject()->getID()), $search);
             $filters['milestone'] = self::createFilter('milestone', array('operator' => '!=', 'value' => 0), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_PROJECT_MOST_VOTED:
             $filters['project_id'] = self::createFilter('project_id', array('operator' => '=', 'value' => TBGContext::getCurrentProject()->getID()), $search);
             $filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
             $filters['votes_total'] = self::createFilter('votes_total', array('operator' => '>=', 'value' => '1'), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_MY_REPORTED_ISSUES:
             $filters['posted_by'] = self::createFilter('posted_by', array('operator' => '=', 'value' => TBGContext::getUser()->getID()), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_MY_ASSIGNED_OPEN_ISSUES:
             $filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
             $filters['assignee_user'] = self::createFilter('assignee_user', array('operator' => '=', 'value' => TBGContext::getUser()->getID()), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_TEAM_ASSIGNED_OPEN_ISSUES:
             $filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
             $teams = array();
             foreach (TBGContext::getUser()->getTeams() as $team_id => $team) {
                 $teams[] = $team_id;
             }
             $filters['assignee_team'] = self::createFilter('assignee_team', array('operator' => '=', 'value' => join(',', $teams)), $search);
             break;
         case TBGContext::PREDEFINED_SEARCH_MY_OWNED_OPEN_ISSUES:
             $filters['status'] = self::createFilter('status', array('operator' => '=', 'value' => 'open'), $search);
             $filters['owner_user'] = self::createFilter('owner_user', array('operator' => '=', 'value' => TBGContext::getUser()->getID()), $search);
             break;
     }
     return $filters;
//.........这里部分代码省略.........
开发者ID:oparoz,项目名称:thebuggenie,代码行数:101,代码来源:TBGSearchFilter.class.php

示例10: runUpload

 public function runUpload(TBGRequest $request)
 {
     $apc_exists = TBGRequest::CanGetUploadStatus();
     if ($apc_exists && !$request['APC_UPLOAD_PROGRESS']) {
         $request->setParameter('APC_UPLOAD_PROGRESS', $request['upload_id']);
     }
     $this->getResponse()->setDecoration(TBGResponse::DECORATE_NONE);
     $canupload = false;
     if ($request['mode'] == 'issue') {
         $issue = TBGContext::factory()->TBGIssue($request['issue_id']);
         $canupload = (bool) ($issue instanceof TBGIssue && $issue->hasAccess() && $issue->canAttachFiles());
     } elseif ($request['mode'] == 'article') {
         $article = TBGWikiArticle::getByName($request['article_name']);
         $canupload = (bool) ($article instanceof TBGWikiArticle && $article->canEdit());
     } else {
         $event = TBGEvent::createNew('core', 'upload', $request['mode']);
         $event->triggerUntilProcessed();
         $canupload = $event->isProcessed() ? (bool) $event->getReturnValue() : true;
     }
     if ($canupload) {
         try {
             $file = TBGContext::getRequest()->handleUpload('uploader_file');
             if ($file instanceof TBGFile) {
                 switch ($request['mode']) {
                     case 'issue':
                         if (!$issue instanceof TBGIssue) {
                             break;
                         }
                         $issue->attachFile($file, $request->getRawParameter('comment'), $request['uploader_file_description']);
                         $issue->save();
                         break;
                     case 'article':
                         if (!$article instanceof TBGWikiArticle) {
                             break;
                         }
                         $article->attachFile($file);
                         break;
                 }
                 if ($apc_exists) {
                     return $this->renderText('ok');
                 }
             }
             $this->error = TBGContext::getI18n()->__('An unhandled error occured with the upload');
         } catch (Exception $e) {
             $this->getResponse()->setHttpStatus(400);
             $this->error = $e->getMessage();
         }
     } else {
         //				$this->getResponse()->setHttpStatus(401);
         $this->error = TBGContext::getI18n()->__('You are not allowed to attach files here');
     }
     if (!$apc_exists) {
         switch ($request['mode']) {
             case 'issue':
                 if (!$issue instanceof TBGIssue) {
                     break;
                 }
                 $this->forward(TBGContext::getRouting()->generate('viewissue', array('project_key' => $issue->getProject()->getKey(), 'issue_no' => $issue->getFormattedIssueNo())));
                 break;
             case 'article':
                 if (!$article instanceof TBGWikiArticle) {
                     break;
                 }
                 $this->forward(TBGContext::getRouting()->generate('publish_article_attachments', array('article_name' => $article->getName())));
                 break;
         }
     }
     TBGLogging::log('marking upload ' . $request['APC_UPLOAD_PROGRESS'] . ' as completed with error ' . $this->error);
     $request->markUploadAsFinishedWithError($request['APC_UPLOAD_PROGRESS'], $this->error);
     return $this->renderText($request['APC_UPLOAD_PROGRESS'] . ': ' . $this->error);
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:71,代码来源:actions.class.php

示例11: processCommit


//.........这里部分代码省略.........
     }
     // 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();
         // Process all commit-message transitions for an issue.
         foreach ($transitions[$issue->getFormattedIssueNo()] as $transition) {
             if (TBGSettings::get('vcs_workflow_' . $project->getID(), 'vcs_integration') == TBGVCSIntegration::WORKFLOW_ENABLED) {
                 TBGContext::setUser($user);
                 TBGSettings::forceSettingsReload();
                 TBGContext::cacheAllPermissions();
                 if ($issue->isWorkflowTransitionsAvailable()) {
                     // Go through the list of possible transitions for an issue. Only
                     // process transitions that are applicable to issue's workflow.
                     foreach ($issue->getAvailableWorkflowTransitions() as $possible_transition) {
                         if (mb_strtolower($possible_transition->getName()) == mb_strtolower($transition[0])) {
                             $output .= '[VCS ' . $project->getKey() . '] Running transition ' . $transition[0] . ' on issue ' . $issue->getFormattedIssueNo() . "\n";
                             // String representation of parameters. Used for log message.
                             $parameters_string = "";
                             // Iterate over the list of this transition's parameters, and
                             // set them.
                             foreach ($transition[1] as $parameter => $value) {
                                 $parameters_string .= "{$parameter}={$value} ";
                                 switch ($parameter) {
                                     case 'resolution':
                                         if (($resolution = TBGResolution::getResolutionByKeyish($value)) instanceof TBGResolution) {
                                             TBGContext::getRequest()->setParameter('resolution_id', $resolution->getID());
                                         }
                                         break;
                                     case 'status':
                                         if (($status = TBGStatus::getStatusByKeyish($value)) instanceof TBGStatus) {
                                             TBGContext::getRequest()->setParameter('status_id', $status->getID());
                                         }
                                         break;
                                 }
                             }
                             // Run the transition.
                             $possible_transition->transitionIssueToOutgoingStepWithoutRequest($issue);
                             // Log an informative message about the transition.
                             $output .= '[VCS ' . $project->getKey() . '] Ran transition ' . $possible_transition->getName() . ' with parameters \'' . $parameters_string . '\' on issue ' . $issue->getFormattedIssueNo() . "\n";
                         }
                     }
                 }
             }
         }
         $issue->addSystemComment(TBGContext::getI18n()->__('This issue has been updated with the latest changes from the code repository.<source>%commit_msg</source>', array('%commit_msg' => $commit_msg)), $user->getID());
         $output .= '[VCS ' . $project->getKey() . '] Updated issue ' . $issue->getFormattedIssueNo() . "\n";
     }
     // Create file links
     foreach ($files as $afile) {
         // index 0 is action, index 1 is file
         $inst = new TBGVCSIntegrationFile();
         $inst->setAction($afile[0]);
         $inst->setFile($afile[1]);
         $inst->setCommit($commit);
         $inst->save();
         $output .= '[VCS ' . $project->getKey() . '] Added with action ' . $afile[0] . ' file ' . $afile[1] . "\n";
     }
     TBGEvent::createNew('vcs_integration', 'new_commit')->trigger(array('commit' => $commit));
     return $output;
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:101,代码来源:TBGVCSIntegration.class.php

示例12: performAction

 /**
  * Performs an action
  * 
  * @param string $module Name of the action module
  * @param string $method Name of the action method to run
  */
 public static function performAction($action, $module, $method)
 {
     // Set content variable
     $content = null;
     // Set the template to be used when rendering the html (or other) output
     $templatePath = THEBUGGENIE_MODULES_PATH . $module . DS . 'templates' . DS;
     $actionClassName = get_class($action);
     $actionToRunName = 'run' . ucfirst($method);
     $preActionToRunName = 'pre' . ucfirst($method);
     // Set up the response object, responsible for controlling any output
     self::getResponse()->setPage(self::getRouting()->getCurrentRouteName());
     self::getResponse()->setTemplate(mb_strtolower($method) . '.' . TBGContext::getRequest()->getRequestedFormat() . '.php');
     self::getResponse()->setupResponseContentType(self::getRequest()->getRequestedFormat());
     self::setCurrentProject(null);
     // Run the specified action method set if it exists
     if (method_exists($action, $actionToRunName)) {
         // Turning on output buffering
         ob_start('mb_output_handler');
         ob_implicit_flush(0);
         if (self::getRouting()->isCurrentRouteCSRFenabled()) {
             // If the csrf check fails, don't proceed
             if (!self::checkCSRFtoken(true)) {
                 return true;
             }
         }
         if (self::$_debug_mode) {
             $time = explode(' ', microtime());
             $pretime = $time[1] + $time[0];
         }
         if ($content === null) {
             TBGLogging::log('Running main pre-execute action');
             // Running any overridden preExecute() method defined for that module
             // or the default empty one provided by TBGAction
             if ($pre_action_retval = $action->preExecute(self::getRequest(), $method)) {
                 $content = ob_get_clean();
                 TBGLogging::log('preexecute method returned something, skipping further action');
                 if (self::$_debug_mode) {
                     $visited_templatename = "{$actionClassName}::preExecute()";
                 }
             }
         }
         if ($content === null) {
             $action_retval = null;
             if (self::getResponse()->getHttpStatus() == 200) {
                 // Checking for and running action-specific preExecute() function if
                 // it exists
                 if (method_exists($action, $preActionToRunName)) {
                     TBGLogging::log('Running custom pre-execute action');
                     $action->{$preActionToRunName}(self::getRequest(), $method);
                 }
                 // Running main route action
                 TBGLogging::log('Running route action ' . $actionToRunName . '()');
                 if (self::$_debug_mode) {
                     $time = explode(' ', microtime());
                     $action_pretime = $time[1] + $time[0];
                 }
                 $action_retval = $action->{$actionToRunName}(self::getRequest());
                 if (self::$_debug_mode) {
                     $time = explode(' ', microtime());
                     $action_posttime = $time[1] + $time[0];
                     TBGContext::visitPartial("{$actionClassName}::{$actionToRunName}", $action_posttime - $action_pretime);
                 }
             }
             if (self::getResponse()->getHttpStatus() == 200 && $action_retval) {
                 // If the action returns *any* output, we're done, and collect the
                 // output to a variable to be outputted in context later
                 $content = ob_get_clean();
                 TBGLogging::log('...done');
             } elseif (!$action_retval) {
                 // If the action doesn't return any output (which it usually doesn't)
                 // we continue on to rendering the template file for that specific action
                 TBGLogging::log('...done');
                 TBGLogging::log('Displaying template');
                 // Check to see if we have a translated version of the template
                 if ($method != 'notFound' && (!self::isReadySetup() || ($templateName = self::getI18n()->hasTranslatedTemplate(self::getResponse()->getTemplate())) === false)) {
                     // Check to see if any modules provide an alternate template
                     $event = TBGEvent::createNew('core', "TBGContext::performAction::renderTemplate")->triggerUntilProcessed(array('class' => $actionClassName, 'action' => $actionToRunName));
                     if ($event->isProcessed()) {
                         $templateName = $event->getReturnValue();
                     }
                     // Check to see if the template has been changed, and whether it's in a
                     // different module, specified by "module/templatename"
                     if (mb_strpos(self::getResponse()->getTemplate(), '/')) {
                         $newPath = explode('/', self::getResponse()->getTemplate());
                         $templateName = THEBUGGENIE_MODULES_PATH . $newPath[0] . DS . 'templates' . DS . $newPath[1] . '.' . TBGContext::getRequest()->getRequestedFormat() . '.php';
                     } else {
                         $templateName = $templatePath . self::getResponse()->getTemplate();
                     }
                 }
                 // Check to see if the template exists and throw an exception otherwise
                 if (!file_exists($templateName)) {
                     TBGLogging::log('The template file for the ' . $method . ' action ("' . self::getResponse()->getTemplate() . '") does not exist', 'core', TBGLogging::LEVEL_FATAL);
                     throw new TBGTemplateNotFoundException('The template file for the ' . $method . ' action ("' . self::getResponse()->getTemplate() . '") does not exist');
                 }
//.........这里部分代码省略.........
开发者ID:oparoz,项目名称:thebuggenie,代码行数:101,代码来源:TBGContext.class.php

示例13: componentLogin

 public function componentLogin()
 {
     $this->selected_tab = isset($this->section) ? $this->section : 'login';
     $this->options = $this->getParameterHolder();
     try {
         $this->article = null;
         $this->article = PublishFactory::articleName('LoginIntro');
     } catch (Exception $e) {
     }
     if (TBGContext::getRequest()->getParameter('redirect') == true) {
         $this->mandatory = true;
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:13,代码来源:actioncomponents.class.php

示例14: __

				<div class="main_header">
					<?php 
    echo $searchtitle;
    ?>
					&nbsp;&nbsp;<span class="faded_out"><?php 
    echo __('%number_of% issue(s)', array('%number_of%' => (int) $resultcount));
    ?>
</span>
					<div class="search_export_links">
						<?php 
    if (TBGContext::getRequest()->hasParameter('quicksearch')) {
        $searchfor = TBGContext::getRequest()->getParameter('searchfor');
        $project_key = TBGContext::getCurrentProject() instanceof TBGProject ? TBGContext::getCurrentProject()->getKey() : 0;
        echo __('Export results as:') . '&nbsp;&nbsp;<a href="' . make_url('project_issues', array('project_key' => $project_key, 'quicksearch' => 'true', 'format' => 'csv')) . '?searchfor=' . $searchfor . '"> ' . image_tag('icon_csv.png', array('class' => 'image', 'style' => 'vertical-align: top')) . '&nbsp;CSV</a>&nbsp;&nbsp;<a href="' . make_url('project_issues', array('project_key' => $project_key, 'quicksearch' => 'true', 'format' => 'rss')) . '?searchfor=' . $searchfor . '"> ' . image_tag('icon_rss.png', array('class' => 'image', 'style' => 'vertical-align: top')) . '&nbsp;RSS</a>';
    } elseif (TBGContext::getRequest()->hasParameter('predefined_search')) {
        $searchno = TBGContext::getRequest()->getParameter('predefined_search');
        $project_key = TBGContext::getCurrentProject() instanceof TBGProject ? TBGContext::getCurrentProject()->getKey() : 0;
        $url = TBGContext::getCurrentProject() instanceof TBGProject ? 'project_issues' : 'search';
        echo __('Export results as:') . '&nbsp;&nbsp;<a href="' . make_url($url, array('project_key' => $project_key, 'predefined_search' => $searchno, 'search' => '1', 'format' => 'csv')) . '"> ' . image_tag('icon_csv.png', array('class' => 'image', 'style' => 'vertical-align: top')) . '&nbsp;CSV</a>&nbsp;&nbsp;<a href="' . make_url($url, array('project_key' => $project_key, 'predefined_search' => $searchno, 'search' => '1', 'format' => 'rss')) . '"> ' . image_tag('icon_rss.png', array('class' => 'image', 'style' => 'vertical-align: top')) . '&nbsp;RSS</a>';
    } else {
        /* Produce get parameters for query */
        preg_match('/((?<=\\/)issues).+$/i', $_SERVER['QUERY_STRING'], $get);
        if (!isset($get[0])) {
            preg_match('/((?<=url=)issues).+$/i', $_SERVER['QUERY_STRING'], $get);
        }
        if (isset($get[0])) {
            if (TBGContext::isProjectContext()) {
                echo __('Export results as:') . '&nbsp;&nbsp;<a href="' . make_url('project_issues', array('project_key' => TBGContext::getCurrentProject()->getKey(), 'format' => 'csv')) . '/' . $get[0] . '"> ' . image_tag('icon_csv.png', array('class' => 'image', 'style' => 'vertical-align: top')) . '&nbsp;CSV</a>&nbsp;&nbsp;<a href="' . make_url('project_issues', array('project_key' => TBGContext::getCurrentProject()->getKey(), 'format' => 'rss')) . '?' . $get[0] . '"> ' . image_tag('icon_rss.png', array('class' => 'image', 'style' => 'vertical-align: top')) . '&nbsp;RSS</a>';
            } else {
                echo __('Export results as:') . '&nbsp;&nbsp;<a href="' . make_url('search', array('format' => 'csv')) . '/' . $get[0] . '"> ' . image_tag('icon_csv.png', array('class' => 'image', 'style' => 'vertical-align: top')) . '&nbsp;CSV</a>&nbsp;&nbsp;<a href="' . make_url('search', array('format' => 'rss')) . '?' . $get[0] . '"> ' . image_tag('icon_rss.png', array('class' => 'image', 'style' => 'vertical-align: top')) . '&nbsp;RSS</a>';
            }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:31,代码来源:findissues.html.php

示例15: componentExtralinks

 public function componentExtralinks()
 {
     switch (true) {
         case TBGContext::getRequest()->hasParameter('quicksearch'):
             $searchfor = TBGContext::getRequest()->getParameter('searchfor');
             $project_key = TBGContext::getCurrentProject() instanceof TBGProject ? TBGContext::getCurrentProject()->getKey() : 0;
             $this->csv_url = TBGContext::getRouting()->generate('project_issues', array('project_key' => $project_key, 'quicksearch' => 'true', 'format' => 'csv')) . '?searchfor=' . $searchfor;
             $this->rss_url = TBGContext::getRouting()->generate('project_issues', array('project_key' => $project_key, 'quicksearch' => 'true', 'format' => 'rss')) . '?searchfor=' . $searchfor;
             break;
         case TBGContext::getRequest()->hasParameter('predefined_search'):
             $searchno = TBGContext::getRequest()->getParameter('predefined_search');
             $project_key = TBGContext::getCurrentProject() instanceof TBGProject ? TBGContext::getCurrentProject()->getKey() : 0;
             $url = TBGContext::getCurrentProject() instanceof TBGProject ? 'project_issues' : 'search';
             $this->csv_url = TBGContext::getRouting()->generate($url, array('project_key' => $project_key, 'predefined_search' => $searchno, 'search' => '1', 'format' => 'csv'));
             $this->rss_url = TBGContext::getRouting()->generate($url, array('project_key' => $project_key, 'predefined_search' => $searchno, 'search' => '1', 'format' => 'rss'));
             break;
         default:
             preg_match('/((?<=\\/)issues).+$/i', TBGContext::getRequest()->getQueryString(), $get);
             if (!isset($get[0])) {
                 preg_match('/((?<=url=)issues).+$/i', TBGContext::getRequest()->getQueryString(), $get);
             }
             if (isset($get[0])) {
                 if (TBGContext::isProjectContext()) {
                     $this->csv_url = TBGContext::getRouting()->generate('project_issues', array('project_key' => TBGContext::getCurrentProject()->getKey(), 'format' => 'csv')) . '/' . $get[0];
                     $this->rss_url = TBGContext::getRouting()->generate('project_issues', array('project_key' => TBGContext::getCurrentProject()->getKey(), 'format' => 'rss')) . '?' . $get[0];
                 } else {
                     $this->csv_url = TBGContext::getRouting()->generate('search', array('format' => 'csv')) . '/' . $get[0];
                     $this->rss_url = TBGContext::getRouting()->generate('search', array('format' => 'rss')) . '?' . $get[0];
                 }
             }
             break;
     }
     $i18n = TBGContext::getI18n();
     $this->columns = array('title' => $i18n->__('Issue title'), 'issuetype' => $i18n->__('Issue type'), 'assigned_to' => $i18n->__('Assigned to'), 'status' => $i18n->__('Status'), 'resolution' => $i18n->__('Resolution'), 'category' => $i18n->__('Category'), 'severity' => $i18n->__('Severity'), 'percent_complete' => $i18n->__('% completed'), 'reproducability' => $i18n->__('Reproducability'), 'priority' => $i18n->__('Priority'), 'components' => $i18n->__('Component(s)'), 'milestone' => $i18n->__('Milestone'), 'estimated_time' => $i18n->__('Estimate'), 'spent_time' => $i18n->__('Time spent'), 'last_updated' => $i18n->__('Last updated time'), 'comments' => $i18n->__('Number of comments'));
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:35,代码来源:actioncomponents.class.php


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