public function processRequest()
 {
     // No CSRF for SendGrid.
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     $request = $this->getRequest();
     $user = $request->getUser();
     $raw_headers = $request->getStr('headers');
     $raw_headers = explode("\n", rtrim($raw_headers));
     $raw_dict = array();
     foreach (array_filter($raw_headers) as $header) {
         list($name, $value) = explode(':', $header, 2);
         $raw_dict[$name] = ltrim($value);
     }
     $headers = array('to' => $request->getStr('to'), 'from' => $request->getStr('from'), 'subject' => $request->getStr('subject')) + $raw_dict;
     $received = new PhabricatorMetaMTAReceivedMail();
     $received->setHeaders($headers);
     $received->setBodies(array('text' => $request->getStr('text'), 'html' => $request->getStr('from')));
     $file_phids = array();
     foreach ($_FILES as $file_raw) {
         try {
             $file = PhabricatorFile::newFromPHPUpload($file_raw, array('authorPHID' => $user->getPHID()));
             $file_phids[] = $file->getPHID();
         } catch (Exception $ex) {
             phlog($ex);
         }
     }
     $received->setAttachments($file_phids);
     $received->save();
     $received->processReceivedMail();
     $response = new AphrontWebpageResponse();
     $response->setContent("Got it! Thanks, SendGrid!\n");
     return $response;
 }
 public function processRequest()
 {
     $root = dirname(phutil_get_library_root('phabricator'));
     require_once $root . '/support/phame/libskin.php';
     $this->cssResources = array();
     $css = $this->getPath('css/');
     if (Filesystem::pathExists($css)) {
         foreach (Filesystem::listDirectory($css) as $path) {
             if (!preg_match('/.css$/', $path)) {
                 continue;
             }
             $this->cssResources[] = phutil_tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $this->getResourceURI('css/' . $path)));
         }
     }
     $map = CelerityResourceMap::getNamedInstance('phabricator');
     $resource_symbol = 'syntax-highlighting-css';
     $resource_uri = $map->getURIForSymbol($resource_symbol);
     $this->cssResources[] = phutil_tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => PhabricatorEnv::getCDNURI($resource_uri)));
     $this->cssResources = phutil_implode_html("\n", $this->cssResources);
     $request = $this->getRequest();
     // Render page parts in order so the templates execute in order, if we're
     // using templates.
     $header = $this->renderHeader();
     $content = $this->renderContent($request);
     $footer = $this->renderFooter();
     if (!$content) {
         $content = $this->render404Page();
     }
     $content = array($header, $content, $footer);
     $response = new AphrontWebpageResponse();
     $response->setContent(phutil_implode_html("\n", $content));
     return $response;
 }
 /**
  * @phutil-external-symbol class PhabricatorStartup
  */
 public function handleRequest(AphrontRequest $request)
 {
     $raw_body = PhabricatorStartup::getRawInput();
     $body = phutil_json_decode($raw_body);
     $payload = $body['payload'];
     $parameters = idx($payload, 'build_parameters');
     if (!$parameters) {
         $parameters = array();
     }
     $target_phid = idx($parameters, 'HARBORMASTER_BUILD_TARGET_PHID');
     // NOTE: We'll get callbacks here for builds we triggered, but also for
     // arbitrary builds the system executes for other reasons. So it's normal
     // to get some notifications with no Build Target PHID. We just ignore
     // these under the assumption that they're routine builds caused by events
     // like branch updates.
     if ($target_phid) {
         $viewer = PhabricatorUser::getOmnipotentUser();
         $target = id(new HarbormasterBuildTargetQuery())->setViewer($viewer)->withPHIDs(array($target_phid))->needBuildSteps(true)->executeOne();
         if ($target) {
             $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
             $this->updateTarget($target, $payload);
         }
     }
     $response = new AphrontWebpageResponse();
     $response->setContent(pht("Request OK\n"));
     return $response;
 }
예제 #4
0
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Herald');
     $page->setBaseURI('/herald/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("☿");
     $doclink = PhabricatorEnv::getDoclink('article/Herald_User_Guide.html');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/herald/'))->addLabel('Rules')->addFilter('new', 'Create Rule');
     $rules_map = HeraldContentTypeConfig::getContentTypeMap();
     $first_filter = null;
     foreach ($rules_map as $key => $value) {
         $nav->addFilter('view/' . $key, $value);
         if (!$first_filter) {
             $first_filter = 'view/' . $key;
         }
     }
     $nav->addSpacer()->addLabel('Utilities')->addFilter('test', 'Test Console')->addFilter('transcript', 'Transcripts');
     $user = $this->getRequest()->getUser();
     if ($user->getIsAdmin()) {
         $nav->addSpacer()->addLabel('Admin');
         $view_PHID = nonempty($this->getRequest()->getStr('phid'), null);
         foreach ($rules_map as $key => $value) {
             $nav->addFilter('all/view/' . $key, $value);
         }
     }
     $nav->selectFilter($this->getFilter(), $first_filter);
     $nav->appendChild($view);
     $page->appendChild($nav);
     $tabs = array('help' => array('href' => $doclink, 'name' => 'Help'));
     $page->setTabs($tabs, null);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Conduit');
     $page->setBaseURI('/conduit/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("⇵");
     if ($this->showSideNav()) {
         $nav = new AphrontSideNavFilterView();
         $nav->setBaseURI(new PhutilURI('/conduit/'));
         $method_filters = $this->getMethodFilters();
         foreach ($method_filters as $group => $methods) {
             $nav->addLabel($group);
             foreach ($methods as $method) {
                 $method_name = $method['full_name'];
                 $display_name = $method_name;
                 switch ($method['status']) {
                     case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
                         $display_name = '(' . $display_name . ')';
                         break;
                 }
                 $nav->addFilter('method/' . $method_name, $display_name);
             }
             $nav->addSpacer();
         }
         $nav->selectFilter($this->getFilter());
         $nav->appendChild($view);
         $body = $nav;
     } else {
         $body = $view;
     }
     $page->appendChild($body);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function handleRequest(AphrontRequest $request)
 {
     // No CSRF for Mailgun.
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     if (!$this->verifyMessage()) {
         throw new Exception(pht('Mail signature is not valid. Check your Mailgun API key.'));
     }
     $user = $request->getUser();
     $raw_headers = $request->getStr('headers');
     $raw_headers = explode("\n", rtrim($raw_headers));
     $raw_dict = array();
     foreach (array_filter($raw_headers) as $header) {
         list($name, $value) = explode(':', $header, 2);
         $raw_dict[$name] = ltrim($value);
     }
     $headers = array('to' => $request->getStr('recipient'), 'from' => $request->getStr('from'), 'subject' => $request->getStr('subject')) + $raw_dict;
     $received = new PhabricatorMetaMTAReceivedMail();
     $received->setHeaders($headers);
     $received->setBodies(array('text' => $request->getStr('stripped-text'), 'html' => $request->getStr('stripped-html')));
     $file_phids = array();
     foreach ($_FILES as $file_raw) {
         try {
             $file = PhabricatorFile::newFromPHPUpload($file_raw, array('viewPolicy' => PhabricatorPolicies::POLICY_NOONE));
             $file_phids[] = $file->getPHID();
         } catch (Exception $ex) {
             phlog($ex);
         }
     }
     $received->setAttachments($file_phids);
     $received->save();
     $received->processReceivedMail();
     $response = new AphrontWebpageResponse();
     $response->setContent(pht("Got it! Thanks, Mailgun!\n"));
     return $response;
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $user = $this->getRequest()->getUser();
     $page = $this->buildStandardPageView();
     $page->setApplicationName('OAuth Server');
     $page->setBaseURI('/oauthserver/');
     $page->setTitle(idx($data, 'title'));
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI('/oauthserver/'));
     $nav->addLabel('Client Authorizations');
     $nav->addFilter('clientauthorization', 'My Authorizations');
     $nav->addSpacer();
     $nav->addLabel('Clients');
     $nav->addFilter('client/create', 'Create Client');
     foreach ($this->getExtraClientFilters() as $filter) {
         $nav->addFilter($filter['url'], $filter['label']);
     }
     $nav->addFilter('client', 'My Clients');
     $nav->selectFilter($this->getFilter(), 'clientauthorization');
     $nav->appendChild($view);
     $page->appendChild($nav);
     $doc_href = PhabricatorEnv::getDoclink('article/Using_the_Phabricator_OAuth_Server.html');
     $page->setTabs(array('help' => array('name' => 'Help', 'href' => $doc_href)), null);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function processRequest()
 {
     $id = $this->id;
     $response = new AphrontWebpageResponse();
     $response->setFrameable(true);
     $response->setContent(phutil_tag('frameset', array('cols' => '33%, 34%, 33%'), array(phutil_tag('frame', array('src' => "/xhpast/input/{$id}/")), phutil_tag('frame', array('src' => "/xhpast/tree/{$id}/")), phutil_tag('frame', array('src' => "/xhpast/stream/{$id}/")))));
     return $response;
 }
 public function processRequest()
 {
     $id = $this->id;
     $response = new AphrontWebpageResponse();
     $response->setFrameable(true);
     $response->setContent('<frameset cols="33%, 34%, 33%">' . '<frame src="/xhpast/input/' . $id . '/" />' . '<frame src="/xhpast/tree/' . $id . '/" />' . '<frame src="/xhpast/stream/' . $id . '/" />' . '</frameset>');
     return $response;
 }
예제 #10
0
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     $response->setContent($page->render());
     return $response;
 }
 public function handleRequest(AphrontRequest $request)
 {
     $id = $request->getURIData('id');
     $response = new AphrontWebpageResponse();
     $response->setFrameable(true);
     $response->setContent(phutil_tag('frameset', array('cols' => '33%, 34%, 33%'), array(phutil_tag('frame', array('src' => "/xhpast/input/{$id}/")), phutil_tag('frame', array('src' => "/xhpast/tree/{$id}/")), phutil_tag('frame', array('src' => "/xhpast/stream/{$id}/")))));
     return $response;
 }
 public function renderExample()
 {
     $view = new PhabricatorBarePageView();
     $view->appendChild(phutil_tag('h1', array(), $this->getDescription()));
     $response = new AphrontWebpageResponse();
     $response->setContent($view->render());
     return $response;
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setBaseURI('/fact/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("Σ");
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName(pht('Login'));
     $page->setBaseURI('/login/');
     $page->setTitle(idx($data, 'title'));
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $path = phutil_escape_html($request->getPath());
     $host = phutil_escape_html($request->getHost());
     $controller_name = phutil_escape_html(get_class($this));
     $page = new PhabricatorStandardPageView();
     $response = new AphrontWebpageResponse();
     $response->setContent($page->render());
     return $response;
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Repositories');
     $page->setBaseURI('/repository/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("rX");
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
예제 #17
0
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Diffusion');
     $page->setBaseURI('/diffusion/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("≈");
     $page->setTabs(array('help' => array('href' => PhabricatorEnv::getDoclink('article/Diffusion_User_Guide.html'), 'name' => 'Help')), null);
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
예제 #18
0
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Herald');
     $page->setBaseURI('/herald/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("☿");
     $page->appendChild($view);
     $page->setIsAdminInterface(idx($data, 'admin'));
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('PHID');
     $page->setBaseURI('/phid/');
     $page->setTitle(idx($data, 'title'));
     $page->setTabs(array('lookup' => array('href' => '/phid/', 'name' => 'PHID Lookup'), 'phids' => array('href' => '/phid/list/', 'name' => 'PHID List')), idx($data, 'tab'));
     $page->setGlyph('#');
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Countdown');
     $page->setBaseURI('/countdown/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("⚲");
     $page->setShowChrome(idx($data, 'chrome', true));
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Daemon Console');
     $page->setBaseURI('/daemon/');
     $page->setTitle(idx($data, 'title'));
     $page->setTabs(array('console' => array('href' => '/daemon/', 'name' => 'Console'), 'timeline' => array('href' => '/daemon/timeline/', 'name' => 'Timeline')), idx($data, 'tab'));
     $page->setGlyph("☯");
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
예제 #22
0
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Ponder!');
     $page->setBaseURI('/ponder/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("◳");
     $page->appendChild($view);
     $page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_QUESTIONS);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Files');
     $page->setBaseURI('/file/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("⇪");
     $page->setTabs(array('files' => array('name' => 'Files', 'href' => '/file/'), 'macros' => array('name' => 'Image Macros', 'href' => '/file/macro/')), idx($data, 'tab'));
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Owners');
     $page->setBaseURI('/owners/');
     $page->setTitle(idx($data, 'title'));
     $page->setTabs(array('index' => array('href' => '/owners/', 'name' => 'Package Index')), idx($data, 'tab'));
     $page->setGlyph("☁");
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Calendar');
     $page->setBaseURI('/calendar/');
     $page->setTitle(idx($data, 'title'));
     // Unicode has a calendar character but it's in some distant code plane,
     // use "keyboard" since it looks vaguely similar.
     $page->setGlyph("тМи");
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('MetaMTA');
     $page->setBaseURI('/mail/');
     $page->setTitle(idx($data, 'title'));
     $page->setTabs(array('queue' => array('name' => 'Mail Queue', 'href' => '/mail/'), 'lists' => array('name' => 'Mailing Lists', 'href' => '/mail/lists/'), 'received' => array('name' => 'Received', 'href' => '/mail/received/')), idx($data, 'tab'));
     $page->setGlyph("@");
     $page->appendChild($view);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
예제 #27
0
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Herald');
     $page->setBaseURI('/herald/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("☿");
     $page->appendChild($view);
     $doclink = PhabricatorEnv::getDoclink('article/Herald_User_Guide.html');
     $page->setTabs(array('rules' => array('href' => '/herald/', 'name' => 'Rules'), 'test' => array('href' => '/herald/test/', 'name' => 'Test Console'), 'transcripts' => array('href' => '/herald/transcript/', 'name' => 'Transcripts'), 'help' => array('href' => $doclink, 'name' => 'Help')), idx($data, 'tab'));
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     require_celerity_resource('differential-core-view-css');
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Differential');
     $page->setBaseURI('/differential/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("⚙");
     $page->appendChild($view);
     $page->setTabs(array('revisions' => array('name' => 'Revisions', 'href' => '/differential/'), 'create' => array('name' => 'Create Diff', 'href' => '/differential/diff/create/')), idx($data, 'tab'));
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Owners');
     $page->setBaseURI('/owners/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("☁");
     $nav = $this->renderSideNav();
     $nav->appendChild($view);
     $page->appendChild($nav);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }
예제 #30
0
 public function buildStandardPageResponse($view, array $data)
 {
     $page = $this->buildStandardPageView();
     $page->setApplicationName('Maniphest');
     $page->setBaseURI('/maniphest/');
     $page->setTitle(idx($data, 'title'));
     $page->setGlyph("⚓");
     $page->appendPageObjects(idx($data, 'pageObjects', array()));
     $page->appendChild($view);
     $page->setSearchDefaultScope(PhabricatorSearchScope::SCOPE_OPEN_TASKS);
     $response = new AphrontWebpageResponse();
     return $response->setContent($page->render());
 }