@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Detect and prevent invalid configuation of "ui.footer-items"

Summary: Fixes T12775. Currently, we do not validate this option and it's possible to configure it in an invalid way.

Test Plan: Tried to misconfigure things, was helpfully pointed toward errors.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12775

Differential Revision: https://secure.phabricator.com/D18041

+45 -1
+2
src/__phutil_library_map__.php
··· 2522 2522 'PhabricatorCustomFieldStorageQuery' => 'infrastructure/customfield/query/PhabricatorCustomFieldStorageQuery.php', 2523 2523 'PhabricatorCustomFieldStringIndexStorage' => 'infrastructure/customfield/storage/PhabricatorCustomFieldStringIndexStorage.php', 2524 2524 'PhabricatorCustomLogoConfigType' => 'applications/config/custom/PhabricatorCustomLogoConfigType.php', 2525 + 'PhabricatorCustomUIFooterConfigType' => 'applications/config/custom/PhabricatorCustomUIFooterConfigType.php', 2525 2526 'PhabricatorDaemon' => 'infrastructure/daemon/PhabricatorDaemon.php', 2526 2527 'PhabricatorDaemonBulkJobController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobController.php', 2527 2528 'PhabricatorDaemonBulkJobListController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobListController.php', ··· 7779 7780 'PhabricatorCustomFieldStorageQuery' => 'Phobject', 7780 7781 'PhabricatorCustomFieldStringIndexStorage' => 'PhabricatorCustomFieldIndexStorage', 7781 7782 'PhabricatorCustomLogoConfigType' => 'PhabricatorConfigOptionType', 7783 + 'PhabricatorCustomUIFooterConfigType' => 'PhabricatorConfigJSONOptionType', 7782 7784 'PhabricatorDaemon' => 'PhutilDaemon', 7783 7785 'PhabricatorDaemonBulkJobController' => 'PhabricatorDaemonController', 7784 7786 'PhabricatorDaemonBulkJobListController' => 'PhabricatorDaemonBulkJobController',
+41
src/applications/config/custom/PhabricatorCustomUIFooterConfigType.php
··· 1 + <?php 2 + 3 + final class PhabricatorCustomUIFooterConfigType 4 + extends PhabricatorConfigJSONOptionType { 5 + 6 + public function validateOption(PhabricatorConfigOption $option, $value) { 7 + if (!is_array($value)) { 8 + throw new Exception( 9 + pht( 10 + 'Footer configuration is not valid: value must be a list of '. 11 + 'items.')); 12 + } 13 + 14 + foreach ($value as $idx => $item) { 15 + if (!is_array($item)) { 16 + throw new Exception( 17 + pht( 18 + 'Footer item with index "%s" is invalid: each item must be a '. 19 + 'dictionary describing a footer item.', 20 + $idx)); 21 + } 22 + 23 + try { 24 + PhutilTypeSpec::checkMap( 25 + $item, 26 + array( 27 + 'name' => 'string', 28 + 'href' => 'optional string', 29 + )); 30 + } catch (Exception $ex) { 31 + throw new Exception( 32 + pht( 33 + 'Footer item with index "%s" is invalid: %s', 34 + $idx, 35 + $ex->getMessage())); 36 + } 37 + } 38 + } 39 + 40 + 41 + }
+2 -1
src/applications/config/option/PhabricatorUIConfigOptions.php
··· 46 46 EOJSON; 47 47 48 48 $logo_type = 'custom:PhabricatorCustomLogoConfigType'; 49 + $footer_type = 'custom:PhabricatorCustomUIFooterConfigType'; 49 50 50 51 return array( 51 52 $this->newOption('ui.header-color', 'enum', 'blindigo') ··· 63 64 "Phabricator logo in the site header.\n\n". 64 65 " - **Wordmark**: Choose new text to display next to the logo. ". 65 66 "By default, the header displays //Phabricator//.\n\n")), 66 - $this->newOption('ui.footer-items', 'list<wild>', array()) 67 + $this->newOption('ui.footer-items', $footer_type, array()) 67 68 ->setSummary( 68 69 pht( 69 70 'Allows you to add footer links on most pages.'))