@@ -29,31 +29,31 @@ |
||
| 29 | 29 | |
| 30 | 30 | class Additional implements ISettings { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @return TemplateResponse returns the instance with all parameters set, ready to be rendered |
|
| 34 | - * @since 9.1 |
|
| 35 | - */ |
|
| 36 | - public function getForm() { |
|
| 37 | - return new TemplateResponse('settings', 'settings/empty'); |
|
| 38 | - } |
|
| 32 | + /** |
|
| 33 | + * @return TemplateResponse returns the instance with all parameters set, ready to be rendered |
|
| 34 | + * @since 9.1 |
|
| 35 | + */ |
|
| 36 | + public function getForm() { |
|
| 37 | + return new TemplateResponse('settings', 'settings/empty'); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return string the section ID, e.g. 'sharing' |
|
| 42 | - * @since 9.1 |
|
| 43 | - */ |
|
| 44 | - public function getSection() { |
|
| 45 | - return 'additional'; |
|
| 46 | - } |
|
| 40 | + /** |
|
| 41 | + * @return string the section ID, e.g. 'sharing' |
|
| 42 | + * @since 9.1 |
|
| 43 | + */ |
|
| 44 | + public function getSection() { |
|
| 45 | + return 'additional'; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @return int whether the form should be rather on the top or bottom of |
|
| 50 | - * the admin section. The forms are arranged in ascending order of the |
|
| 51 | - * priority values. It is required to return a value between 0 and 100. |
|
| 52 | - * |
|
| 53 | - * E.g.: 70 |
|
| 54 | - * @since 9.1 |
|
| 55 | - */ |
|
| 56 | - public function getPriority() { |
|
| 57 | - return '5'; |
|
| 58 | - } |
|
| 48 | + /** |
|
| 49 | + * @return int whether the form should be rather on the top or bottom of |
|
| 50 | + * the admin section. The forms are arranged in ascending order of the |
|
| 51 | + * priority values. It is required to return a value between 0 and 100. |
|
| 52 | + * |
|
| 53 | + * E.g.: 70 |
|
| 54 | + * @since 9.1 |
|
| 55 | + */ |
|
| 56 | + public function getPriority() { |
|
| 57 | + return '5'; |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -26,189 +26,189 @@ |
||
| 26 | 26 | use OCP\IDBConnection; |
| 27 | 27 | |
| 28 | 28 | class Mapper { |
| 29 | - const TABLE_ADMIN_SETTINGS = 'admin_settings'; |
|
| 30 | - const TABLE_ADMIN_SECTIONS = 'admin_sections'; |
|
| 31 | - const TABLE_PERSONAL_SETTINGS = 'personal_settings'; |
|
| 32 | - const TABLE_PERSONAL_SECTIONS = 'personal_sections'; |
|
| 33 | - |
|
| 34 | - /** @var IDBConnection */ |
|
| 35 | - private $dbc; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @param IDBConnection $dbc |
|
| 39 | - */ |
|
| 40 | - public function __construct(IDBConnection $dbc) { |
|
| 41 | - $this->dbc = $dbc; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Get the configured admin settings from the database for the provided section |
|
| 46 | - * |
|
| 47 | - * @param string $section |
|
| 48 | - * @return array[] [['class' => string, 'priority' => int], ...] |
|
| 49 | - */ |
|
| 50 | - public function getAdminSettingsFromDB($section) { |
|
| 51 | - return $this->getSettingsFromDB(self::TABLE_ADMIN_SETTINGS, $section); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Get the configured personal settings from the database for the provided section |
|
| 56 | - * |
|
| 57 | - * @param string $section |
|
| 58 | - * @return array[] [['class' => string, 'priority' => int], ...] |
|
| 59 | - */ |
|
| 60 | - public function getPersonalSettingsFromDB($section) { |
|
| 61 | - return $this->getSettingsFromDB(self::TABLE_PERSONAL_SETTINGS, $section); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * Get the configured settings from the database for the provided table and section |
|
| 66 | - * |
|
| 67 | - * @param $table |
|
| 68 | - * @param $section |
|
| 69 | - * @return array |
|
| 70 | - */ |
|
| 71 | - private function getSettingsFromDB($table, $section) { |
|
| 72 | - $query = $this->dbc->getQueryBuilder(); |
|
| 73 | - $query->select(['class', 'priority']) |
|
| 74 | - ->from($table) |
|
| 75 | - ->where($query->expr()->eq('section', $this->dbc->getQueryBuilder()->createParameter('section'))) |
|
| 76 | - ->setParameter('section', $section); |
|
| 77 | - |
|
| 78 | - $result = $query->execute(); |
|
| 79 | - return $result->fetchAll(); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * Get the configured admin sections from the database |
|
| 84 | - * |
|
| 85 | - * @return array[] [['class' => string, 'priority' => int], ...] |
|
| 86 | - */ |
|
| 87 | - public function getAdminSectionsFromDB() { |
|
| 88 | - return $this->getSectionsFromDB('admin'); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Get the configured admin sections from the database |
|
| 93 | - * |
|
| 94 | - * @return array[] [['class' => string, 'priority' => int], ...] |
|
| 95 | - */ |
|
| 96 | - public function getPersonalSectionsFromDB() { |
|
| 97 | - return $this->getSectionsFromDB('personal'); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * Get the configured sections from the database by table |
|
| 102 | - * |
|
| 103 | - * @param string $type either 'personal' or 'admin' |
|
| 104 | - * @return array[] [['class' => string, 'priority' => int], ...] |
|
| 105 | - */ |
|
| 106 | - public function getSectionsFromDB($type) { |
|
| 107 | - if($type === 'admin') { |
|
| 108 | - $sectionsTable = self::TABLE_ADMIN_SECTIONS; |
|
| 109 | - $settingsTable = self::TABLE_ADMIN_SETTINGS; |
|
| 110 | - } else if($type === 'personal') { |
|
| 111 | - $sectionsTable = self::TABLE_PERSONAL_SECTIONS; |
|
| 112 | - $settingsTable = self::TABLE_PERSONAL_SETTINGS; |
|
| 113 | - } else { |
|
| 114 | - throw new \InvalidArgumentException('"admin" or "personal" expected'); |
|
| 115 | - } |
|
| 116 | - $query = $this->dbc->getQueryBuilder(); |
|
| 117 | - $query->selectDistinct('s.class') |
|
| 118 | - ->addSelect('s.priority') |
|
| 119 | - ->from($sectionsTable, 's') |
|
| 120 | - ->from($settingsTable, 'f') |
|
| 121 | - ->where($query->expr()->eq('s.id', 'f.section')); |
|
| 122 | - $result = $query->execute(); |
|
| 123 | - return array_map(function ($row) { |
|
| 124 | - $row['priority'] = (int)$row['priority']; |
|
| 125 | - return $row; |
|
| 126 | - }, $result->fetchAll()); |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * @param string $table one of the Mapper::TABLE_* constants |
|
| 131 | - * @param array $values |
|
| 132 | - */ |
|
| 133 | - public function add($table, array $values) { |
|
| 134 | - $query = $this->dbc->getQueryBuilder(); |
|
| 135 | - $values = array_map(function ($value) use ($query) { |
|
| 136 | - return $query->createNamedParameter($value); |
|
| 137 | - }, $values); |
|
| 138 | - $query->insert($table)->values($values); |
|
| 139 | - $query->execute(); |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * returns the registered classes in the given table |
|
| 144 | - * |
|
| 145 | - * @param string $table one of the Mapper::TABLE_* constants |
|
| 146 | - * @return string[] |
|
| 147 | - */ |
|
| 148 | - public function getClasses($table) { |
|
| 149 | - $q = $this->dbc->getQueryBuilder(); |
|
| 150 | - $resultStatement = $q->select('class') |
|
| 151 | - ->from($table) |
|
| 152 | - ->execute(); |
|
| 153 | - $data = $resultStatement->fetchAll(); |
|
| 154 | - $resultStatement->closeCursor(); |
|
| 155 | - |
|
| 156 | - return array_map(function ($row) { |
|
| 157 | - return $row['class']; |
|
| 158 | - }, $data); |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Check if a class is configured in the database |
|
| 163 | - * |
|
| 164 | - * @param string $table one of the Mapper::TABLE_* constants |
|
| 165 | - * @param string $className |
|
| 166 | - * @return bool |
|
| 167 | - */ |
|
| 168 | - public function has($table, $className) { |
|
| 169 | - $query = $this->dbc->getQueryBuilder(); |
|
| 170 | - $query->select('class') |
|
| 171 | - ->from($table) |
|
| 172 | - ->where($query->expr()->eq('class', $query->createNamedParameter($className))) |
|
| 173 | - ->setMaxResults(1); |
|
| 174 | - |
|
| 175 | - $result = $query->execute(); |
|
| 176 | - $row = $result->fetch(); |
|
| 177 | - $result->closeCursor(); |
|
| 178 | - |
|
| 179 | - return (bool)$row; |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - /** |
|
| 183 | - * deletes an settings or admin entry from the given table |
|
| 184 | - * |
|
| 185 | - * @param string $table one of the Mapper::TABLE_* constants |
|
| 186 | - * @param string $className |
|
| 187 | - */ |
|
| 188 | - public function remove($table, $className) { |
|
| 189 | - $query = $this->dbc->getQueryBuilder(); |
|
| 190 | - $query->delete($table) |
|
| 191 | - ->where($query->expr()->eq('class', $query->createNamedParameter($className))); |
|
| 192 | - |
|
| 193 | - $query->execute(); |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * @param string $table one of the Mapper::TABLE_* constants |
|
| 198 | - * @param string $idCol |
|
| 199 | - * @param string $id |
|
| 200 | - * @param array $values |
|
| 201 | - */ |
|
| 202 | - public function update($table, $idCol, $id, $values) { |
|
| 203 | - $query = $this->dbc->getQueryBuilder(); |
|
| 204 | - $query->update($table); |
|
| 205 | - foreach ($values as $key => $value) { |
|
| 206 | - $query->set($key, $query->createNamedParameter($value)); |
|
| 207 | - } |
|
| 208 | - $query |
|
| 209 | - ->where($query->expr()->eq($idCol, $query->createParameter($idCol))) |
|
| 210 | - ->setParameter($idCol, $id) |
|
| 211 | - ->execute(); |
|
| 212 | - } |
|
| 29 | + const TABLE_ADMIN_SETTINGS = 'admin_settings'; |
|
| 30 | + const TABLE_ADMIN_SECTIONS = 'admin_sections'; |
|
| 31 | + const TABLE_PERSONAL_SETTINGS = 'personal_settings'; |
|
| 32 | + const TABLE_PERSONAL_SECTIONS = 'personal_sections'; |
|
| 33 | + |
|
| 34 | + /** @var IDBConnection */ |
|
| 35 | + private $dbc; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @param IDBConnection $dbc |
|
| 39 | + */ |
|
| 40 | + public function __construct(IDBConnection $dbc) { |
|
| 41 | + $this->dbc = $dbc; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Get the configured admin settings from the database for the provided section |
|
| 46 | + * |
|
| 47 | + * @param string $section |
|
| 48 | + * @return array[] [['class' => string, 'priority' => int], ...] |
|
| 49 | + */ |
|
| 50 | + public function getAdminSettingsFromDB($section) { |
|
| 51 | + return $this->getSettingsFromDB(self::TABLE_ADMIN_SETTINGS, $section); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Get the configured personal settings from the database for the provided section |
|
| 56 | + * |
|
| 57 | + * @param string $section |
|
| 58 | + * @return array[] [['class' => string, 'priority' => int], ...] |
|
| 59 | + */ |
|
| 60 | + public function getPersonalSettingsFromDB($section) { |
|
| 61 | + return $this->getSettingsFromDB(self::TABLE_PERSONAL_SETTINGS, $section); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * Get the configured settings from the database for the provided table and section |
|
| 66 | + * |
|
| 67 | + * @param $table |
|
| 68 | + * @param $section |
|
| 69 | + * @return array |
|
| 70 | + */ |
|
| 71 | + private function getSettingsFromDB($table, $section) { |
|
| 72 | + $query = $this->dbc->getQueryBuilder(); |
|
| 73 | + $query->select(['class', 'priority']) |
|
| 74 | + ->from($table) |
|
| 75 | + ->where($query->expr()->eq('section', $this->dbc->getQueryBuilder()->createParameter('section'))) |
|
| 76 | + ->setParameter('section', $section); |
|
| 77 | + |
|
| 78 | + $result = $query->execute(); |
|
| 79 | + return $result->fetchAll(); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * Get the configured admin sections from the database |
|
| 84 | + * |
|
| 85 | + * @return array[] [['class' => string, 'priority' => int], ...] |
|
| 86 | + */ |
|
| 87 | + public function getAdminSectionsFromDB() { |
|
| 88 | + return $this->getSectionsFromDB('admin'); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Get the configured admin sections from the database |
|
| 93 | + * |
|
| 94 | + * @return array[] [['class' => string, 'priority' => int], ...] |
|
| 95 | + */ |
|
| 96 | + public function getPersonalSectionsFromDB() { |
|
| 97 | + return $this->getSectionsFromDB('personal'); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * Get the configured sections from the database by table |
|
| 102 | + * |
|
| 103 | + * @param string $type either 'personal' or 'admin' |
|
| 104 | + * @return array[] [['class' => string, 'priority' => int], ...] |
|
| 105 | + */ |
|
| 106 | + public function getSectionsFromDB($type) { |
|
| 107 | + if($type === 'admin') { |
|
| 108 | + $sectionsTable = self::TABLE_ADMIN_SECTIONS; |
|
| 109 | + $settingsTable = self::TABLE_ADMIN_SETTINGS; |
|
| 110 | + } else if($type === 'personal') { |
|
| 111 | + $sectionsTable = self::TABLE_PERSONAL_SECTIONS; |
|
| 112 | + $settingsTable = self::TABLE_PERSONAL_SETTINGS; |
|
| 113 | + } else { |
|
| 114 | + throw new \InvalidArgumentException('"admin" or "personal" expected'); |
|
| 115 | + } |
|
| 116 | + $query = $this->dbc->getQueryBuilder(); |
|
| 117 | + $query->selectDistinct('s.class') |
|
| 118 | + ->addSelect('s.priority') |
|
| 119 | + ->from($sectionsTable, 's') |
|
| 120 | + ->from($settingsTable, 'f') |
|
| 121 | + ->where($query->expr()->eq('s.id', 'f.section')); |
|
| 122 | + $result = $query->execute(); |
|
| 123 | + return array_map(function ($row) { |
|
| 124 | + $row['priority'] = (int)$row['priority']; |
|
| 125 | + return $row; |
|
| 126 | + }, $result->fetchAll()); |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * @param string $table one of the Mapper::TABLE_* constants |
|
| 131 | + * @param array $values |
|
| 132 | + */ |
|
| 133 | + public function add($table, array $values) { |
|
| 134 | + $query = $this->dbc->getQueryBuilder(); |
|
| 135 | + $values = array_map(function ($value) use ($query) { |
|
| 136 | + return $query->createNamedParameter($value); |
|
| 137 | + }, $values); |
|
| 138 | + $query->insert($table)->values($values); |
|
| 139 | + $query->execute(); |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * returns the registered classes in the given table |
|
| 144 | + * |
|
| 145 | + * @param string $table one of the Mapper::TABLE_* constants |
|
| 146 | + * @return string[] |
|
| 147 | + */ |
|
| 148 | + public function getClasses($table) { |
|
| 149 | + $q = $this->dbc->getQueryBuilder(); |
|
| 150 | + $resultStatement = $q->select('class') |
|
| 151 | + ->from($table) |
|
| 152 | + ->execute(); |
|
| 153 | + $data = $resultStatement->fetchAll(); |
|
| 154 | + $resultStatement->closeCursor(); |
|
| 155 | + |
|
| 156 | + return array_map(function ($row) { |
|
| 157 | + return $row['class']; |
|
| 158 | + }, $data); |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Check if a class is configured in the database |
|
| 163 | + * |
|
| 164 | + * @param string $table one of the Mapper::TABLE_* constants |
|
| 165 | + * @param string $className |
|
| 166 | + * @return bool |
|
| 167 | + */ |
|
| 168 | + public function has($table, $className) { |
|
| 169 | + $query = $this->dbc->getQueryBuilder(); |
|
| 170 | + $query->select('class') |
|
| 171 | + ->from($table) |
|
| 172 | + ->where($query->expr()->eq('class', $query->createNamedParameter($className))) |
|
| 173 | + ->setMaxResults(1); |
|
| 174 | + |
|
| 175 | + $result = $query->execute(); |
|
| 176 | + $row = $result->fetch(); |
|
| 177 | + $result->closeCursor(); |
|
| 178 | + |
|
| 179 | + return (bool)$row; |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + /** |
|
| 183 | + * deletes an settings or admin entry from the given table |
|
| 184 | + * |
|
| 185 | + * @param string $table one of the Mapper::TABLE_* constants |
|
| 186 | + * @param string $className |
|
| 187 | + */ |
|
| 188 | + public function remove($table, $className) { |
|
| 189 | + $query = $this->dbc->getQueryBuilder(); |
|
| 190 | + $query->delete($table) |
|
| 191 | + ->where($query->expr()->eq('class', $query->createNamedParameter($className))); |
|
| 192 | + |
|
| 193 | + $query->execute(); |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * @param string $table one of the Mapper::TABLE_* constants |
|
| 198 | + * @param string $idCol |
|
| 199 | + * @param string $id |
|
| 200 | + * @param array $values |
|
| 201 | + */ |
|
| 202 | + public function update($table, $idCol, $id, $values) { |
|
| 203 | + $query = $this->dbc->getQueryBuilder(); |
|
| 204 | + $query->update($table); |
|
| 205 | + foreach ($values as $key => $value) { |
|
| 206 | + $query->set($key, $query->createNamedParameter($value)); |
|
| 207 | + } |
|
| 208 | + $query |
|
| 209 | + ->where($query->expr()->eq($idCol, $query->createParameter($idCol))) |
|
| 210 | + ->setParameter($idCol, $id) |
|
| 211 | + ->execute(); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | 214 | } |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | * @return array[] [['class' => string, 'priority' => int], ...] |
| 105 | 105 | */ |
| 106 | 106 | public function getSectionsFromDB($type) { |
| 107 | - if($type === 'admin') { |
|
| 107 | + if ($type === 'admin') { |
|
| 108 | 108 | $sectionsTable = self::TABLE_ADMIN_SECTIONS; |
| 109 | 109 | $settingsTable = self::TABLE_ADMIN_SETTINGS; |
| 110 | - } else if($type === 'personal') { |
|
| 110 | + } else if ($type === 'personal') { |
|
| 111 | 111 | $sectionsTable = self::TABLE_PERSONAL_SECTIONS; |
| 112 | 112 | $settingsTable = self::TABLE_PERSONAL_SETTINGS; |
| 113 | 113 | } else { |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | ->from($settingsTable, 'f') |
| 121 | 121 | ->where($query->expr()->eq('s.id', 'f.section')); |
| 122 | 122 | $result = $query->execute(); |
| 123 | - return array_map(function ($row) { |
|
| 124 | - $row['priority'] = (int)$row['priority']; |
|
| 123 | + return array_map(function($row) { |
|
| 124 | + $row['priority'] = (int) $row['priority']; |
|
| 125 | 125 | return $row; |
| 126 | 126 | }, $result->fetchAll()); |
| 127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function add($table, array $values) { |
| 134 | 134 | $query = $this->dbc->getQueryBuilder(); |
| 135 | - $values = array_map(function ($value) use ($query) { |
|
| 135 | + $values = array_map(function($value) use ($query) { |
|
| 136 | 136 | return $query->createNamedParameter($value); |
| 137 | 137 | }, $values); |
| 138 | 138 | $query->insert($table)->values($values); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $data = $resultStatement->fetchAll(); |
| 154 | 154 | $resultStatement->closeCursor(); |
| 155 | 155 | |
| 156 | - return array_map(function ($row) { |
|
| 156 | + return array_map(function($row) { |
|
| 157 | 157 | return $row['class']; |
| 158 | 158 | }, $data); |
| 159 | 159 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $row = $result->fetch(); |
| 177 | 177 | $result->closeCursor(); |
| 178 | 178 | |
| 179 | - return (bool)$row; |
|
| 179 | + return (bool) $row; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
@@ -31,75 +31,75 @@ |
||
| 31 | 31 | use OCP\Template; |
| 32 | 32 | |
| 33 | 33 | class PersonalSettingsController extends Controller { |
| 34 | - use CommonSettingsTrait; |
|
| 34 | + use CommonSettingsTrait; |
|
| 35 | 35 | |
| 36 | - /** @var INavigationManager */ |
|
| 37 | - private $navigationManager; |
|
| 36 | + /** @var INavigationManager */ |
|
| 37 | + private $navigationManager; |
|
| 38 | 38 | |
| 39 | - public function __construct( |
|
| 40 | - $appName, |
|
| 41 | - IRequest $request, |
|
| 42 | - INavigationManager $navigationManager, |
|
| 43 | - ISettingsManager $settingsManager |
|
| 44 | - ) { |
|
| 45 | - parent::__construct($appName, $request); |
|
| 46 | - $this->navigationManager = $navigationManager; |
|
| 47 | - $this->settingsManager = $settingsManager; |
|
| 48 | - } |
|
| 39 | + public function __construct( |
|
| 40 | + $appName, |
|
| 41 | + IRequest $request, |
|
| 42 | + INavigationManager $navigationManager, |
|
| 43 | + ISettingsManager $settingsManager |
|
| 44 | + ) { |
|
| 45 | + parent::__construct($appName, $request); |
|
| 46 | + $this->navigationManager = $navigationManager; |
|
| 47 | + $this->settingsManager = $settingsManager; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param string $section |
|
| 52 | - * @return TemplateResponse |
|
| 53 | - * |
|
| 54 | - * @NoCSRFRequired |
|
| 55 | - * @NoAdminRequired |
|
| 56 | - * @NoSubadminRequired |
|
| 57 | - */ |
|
| 58 | - public function index($section) { |
|
| 59 | - $this->navigationManager->setActiveEntry('personal'); |
|
| 60 | - return $this->getIndexResponse($section); |
|
| 61 | - } |
|
| 50 | + /** |
|
| 51 | + * @param string $section |
|
| 52 | + * @return TemplateResponse |
|
| 53 | + * |
|
| 54 | + * @NoCSRFRequired |
|
| 55 | + * @NoAdminRequired |
|
| 56 | + * @NoSubadminRequired |
|
| 57 | + */ |
|
| 58 | + public function index($section) { |
|
| 59 | + $this->navigationManager->setActiveEntry('personal'); |
|
| 60 | + return $this->getIndexResponse($section); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @param string $section |
|
| 65 | - * @return array |
|
| 66 | - */ |
|
| 67 | - protected function getSettings($section) { |
|
| 68 | - $settings = $this->settingsManager->getPersonalSettings($section); |
|
| 69 | - $formatted = $this->formatSettings($settings); |
|
| 70 | - if($section === 'additional') { |
|
| 71 | - $formatted['content'] .= $this->getLegacyForms(); |
|
| 72 | - } |
|
| 73 | - return $formatted; |
|
| 74 | - } |
|
| 63 | + /** |
|
| 64 | + * @param string $section |
|
| 65 | + * @return array |
|
| 66 | + */ |
|
| 67 | + protected function getSettings($section) { |
|
| 68 | + $settings = $this->settingsManager->getPersonalSettings($section); |
|
| 69 | + $formatted = $this->formatSettings($settings); |
|
| 70 | + if($section === 'additional') { |
|
| 71 | + $formatted['content'] .= $this->getLegacyForms(); |
|
| 72 | + } |
|
| 73 | + return $formatted; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * @return bool|string |
|
| 78 | - */ |
|
| 79 | - private function getLegacyForms() { |
|
| 80 | - $forms = \OC_App::getForms('personal'); |
|
| 76 | + /** |
|
| 77 | + * @return bool|string |
|
| 78 | + */ |
|
| 79 | + private function getLegacyForms() { |
|
| 80 | + $forms = \OC_App::getForms('personal'); |
|
| 81 | 81 | |
| 82 | - $forms = array_map(function ($form) { |
|
| 83 | - if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) { |
|
| 84 | - $sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]); |
|
| 85 | - $sectionName = str_replace('</h2>', '', $sectionName); |
|
| 86 | - $anchor = strtolower($sectionName); |
|
| 87 | - $anchor = str_replace(' ', '-', $anchor); |
|
| 82 | + $forms = array_map(function ($form) { |
|
| 83 | + if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) { |
|
| 84 | + $sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]); |
|
| 85 | + $sectionName = str_replace('</h2>', '', $sectionName); |
|
| 86 | + $anchor = strtolower($sectionName); |
|
| 87 | + $anchor = str_replace(' ', '-', $anchor); |
|
| 88 | 88 | |
| 89 | - return array( |
|
| 90 | - 'anchor' => $anchor, |
|
| 91 | - 'section-name' => $sectionName, |
|
| 92 | - 'form' => $form |
|
| 93 | - ); |
|
| 94 | - } |
|
| 95 | - return array( |
|
| 96 | - 'form' => $form |
|
| 97 | - ); |
|
| 98 | - }, $forms); |
|
| 89 | + return array( |
|
| 90 | + 'anchor' => $anchor, |
|
| 91 | + 'section-name' => $sectionName, |
|
| 92 | + 'form' => $form |
|
| 93 | + ); |
|
| 94 | + } |
|
| 95 | + return array( |
|
| 96 | + 'form' => $form |
|
| 97 | + ); |
|
| 98 | + }, $forms); |
|
| 99 | 99 | |
| 100 | - $out = new Template('settings', 'settings/additional'); |
|
| 101 | - $out->assign('forms', $forms); |
|
| 100 | + $out = new Template('settings', 'settings/additional'); |
|
| 101 | + $out->assign('forms', $forms); |
|
| 102 | 102 | |
| 103 | - return $out->fetchPage(); |
|
| 104 | - } |
|
| 103 | + return $out->fetchPage(); |
|
| 104 | + } |
|
| 105 | 105 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | protected function getSettings($section) { |
| 68 | 68 | $settings = $this->settingsManager->getPersonalSettings($section); |
| 69 | 69 | $formatted = $this->formatSettings($settings); |
| 70 | - if($section === 'additional') { |
|
| 70 | + if ($section === 'additional') { |
|
| 71 | 71 | $formatted['content'] .= $this->getLegacyForms(); |
| 72 | 72 | } |
| 73 | 73 | return $formatted; |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | private function getLegacyForms() { |
| 80 | 80 | $forms = \OC_App::getForms('personal'); |
| 81 | 81 | |
| 82 | - $forms = array_map(function ($form) { |
|
| 82 | + $forms = array_map(function($form) { |
|
| 83 | 83 | if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) { |
| 84 | - $sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]); |
|
| 84 | + $sectionName = str_replace('<h2'.$regs['class'].'>', '', $regs[0]); |
|
| 85 | 85 | $sectionName = str_replace('</h2>', '', $sectionName); |
| 86 | 86 | $anchor = strtolower($sectionName); |
| 87 | 87 | $anchor = str_replace(' ', '-', $anchor); |
@@ -35,83 +35,83 @@ |
||
| 35 | 35 | * @package OC\Settings\Controller |
| 36 | 36 | */ |
| 37 | 37 | class AdminSettingsController extends Controller { |
| 38 | - use CommonSettingsTrait; |
|
| 38 | + use CommonSettingsTrait; |
|
| 39 | 39 | |
| 40 | - /** @var INavigationManager */ |
|
| 41 | - private $navigationManager; |
|
| 42 | - /** @var ISettingsManager */ |
|
| 43 | - private $settingsManager; |
|
| 40 | + /** @var INavigationManager */ |
|
| 41 | + private $navigationManager; |
|
| 42 | + /** @var ISettingsManager */ |
|
| 43 | + private $settingsManager; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @param string $appName |
|
| 47 | - * @param IRequest $request |
|
| 48 | - * @param INavigationManager $navigationManager |
|
| 49 | - * @param ISettingsManager $settingsManager |
|
| 50 | - */ |
|
| 51 | - public function __construct( |
|
| 52 | - $appName, |
|
| 53 | - IRequest $request, |
|
| 54 | - INavigationManager $navigationManager, |
|
| 55 | - ISettingsManager $settingsManager |
|
| 56 | - ) { |
|
| 57 | - parent::__construct($appName, $request); |
|
| 58 | - $this->navigationManager = $navigationManager; |
|
| 59 | - $this->settingsManager = $settingsManager; |
|
| 60 | - } |
|
| 45 | + /** |
|
| 46 | + * @param string $appName |
|
| 47 | + * @param IRequest $request |
|
| 48 | + * @param INavigationManager $navigationManager |
|
| 49 | + * @param ISettingsManager $settingsManager |
|
| 50 | + */ |
|
| 51 | + public function __construct( |
|
| 52 | + $appName, |
|
| 53 | + IRequest $request, |
|
| 54 | + INavigationManager $navigationManager, |
|
| 55 | + ISettingsManager $settingsManager |
|
| 56 | + ) { |
|
| 57 | + parent::__construct($appName, $request); |
|
| 58 | + $this->navigationManager = $navigationManager; |
|
| 59 | + $this->settingsManager = $settingsManager; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @param string $section |
|
| 64 | - * @return TemplateResponse |
|
| 65 | - * |
|
| 66 | - * @NoCSRFRequired |
|
| 67 | - */ |
|
| 68 | - public function index($section) { |
|
| 69 | - $this->navigationManager->setActiveEntry('admin'); |
|
| 70 | - return $this->getIndexResponse($section); |
|
| 71 | - } |
|
| 62 | + /** |
|
| 63 | + * @param string $section |
|
| 64 | + * @return TemplateResponse |
|
| 65 | + * |
|
| 66 | + * @NoCSRFRequired |
|
| 67 | + */ |
|
| 68 | + public function index($section) { |
|
| 69 | + $this->navigationManager->setActiveEntry('admin'); |
|
| 70 | + return $this->getIndexResponse($section); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * @param string $section |
|
| 75 | - * @return array |
|
| 76 | - */ |
|
| 77 | - protected function getSettings($section) { |
|
| 78 | - $settings = $this->settingsManager->getAdminSettings($section); |
|
| 79 | - $formatted = $this->formatSettings($settings); |
|
| 80 | - if($section === 'additional') { |
|
| 81 | - $formatted['content'] .= $this->getLegacyForms(); |
|
| 82 | - } |
|
| 83 | - return $formatted; |
|
| 84 | - } |
|
| 73 | + /** |
|
| 74 | + * @param string $section |
|
| 75 | + * @return array |
|
| 76 | + */ |
|
| 77 | + protected function getSettings($section) { |
|
| 78 | + $settings = $this->settingsManager->getAdminSettings($section); |
|
| 79 | + $formatted = $this->formatSettings($settings); |
|
| 80 | + if($section === 'additional') { |
|
| 81 | + $formatted['content'] .= $this->getLegacyForms(); |
|
| 82 | + } |
|
| 83 | + return $formatted; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * @return bool|string |
|
| 88 | - */ |
|
| 89 | - private function getLegacyForms() { |
|
| 90 | - $forms = \OC_App::getForms('admin'); |
|
| 86 | + /** |
|
| 87 | + * @return bool|string |
|
| 88 | + */ |
|
| 89 | + private function getLegacyForms() { |
|
| 90 | + $forms = \OC_App::getForms('admin'); |
|
| 91 | 91 | |
| 92 | - $forms = array_map(function ($form) { |
|
| 93 | - if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) { |
|
| 94 | - $sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]); |
|
| 95 | - $sectionName = str_replace('</h2>', '', $sectionName); |
|
| 96 | - $anchor = strtolower($sectionName); |
|
| 97 | - $anchor = str_replace(' ', '-', $anchor); |
|
| 92 | + $forms = array_map(function ($form) { |
|
| 93 | + if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) { |
|
| 94 | + $sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]); |
|
| 95 | + $sectionName = str_replace('</h2>', '', $sectionName); |
|
| 96 | + $anchor = strtolower($sectionName); |
|
| 97 | + $anchor = str_replace(' ', '-', $anchor); |
|
| 98 | 98 | |
| 99 | - return array( |
|
| 100 | - 'anchor' => $anchor, |
|
| 101 | - 'section-name' => $sectionName, |
|
| 102 | - 'form' => $form |
|
| 103 | - ); |
|
| 104 | - } |
|
| 105 | - return array( |
|
| 106 | - 'form' => $form |
|
| 107 | - ); |
|
| 108 | - }, $forms); |
|
| 99 | + return array( |
|
| 100 | + 'anchor' => $anchor, |
|
| 101 | + 'section-name' => $sectionName, |
|
| 102 | + 'form' => $form |
|
| 103 | + ); |
|
| 104 | + } |
|
| 105 | + return array( |
|
| 106 | + 'form' => $form |
|
| 107 | + ); |
|
| 108 | + }, $forms); |
|
| 109 | 109 | |
| 110 | - $out = new Template('settings', 'settings/additional'); |
|
| 111 | - $out->assign('forms', $forms); |
|
| 110 | + $out = new Template('settings', 'settings/additional'); |
|
| 111 | + $out->assign('forms', $forms); |
|
| 112 | 112 | |
| 113 | - return $out->fetchPage(); |
|
| 114 | - } |
|
| 113 | + return $out->fetchPage(); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | 116 | |
| 117 | 117 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | protected function getSettings($section) { |
| 78 | 78 | $settings = $this->settingsManager->getAdminSettings($section); |
| 79 | 79 | $formatted = $this->formatSettings($settings); |
| 80 | - if($section === 'additional') { |
|
| 80 | + if ($section === 'additional') { |
|
| 81 | 81 | $formatted['content'] .= $this->getLegacyForms(); |
| 82 | 82 | } |
| 83 | 83 | return $formatted; |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | private function getLegacyForms() { |
| 90 | 90 | $forms = \OC_App::getForms('admin'); |
| 91 | 91 | |
| 92 | - $forms = array_map(function ($form) { |
|
| 92 | + $forms = array_map(function($form) { |
|
| 93 | 93 | if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) { |
| 94 | - $sectionName = str_replace('<h2' . $regs['class'] . '>', '', $regs[0]); |
|
| 94 | + $sectionName = str_replace('<h2'.$regs['class'].'>', '', $regs[0]); |
|
| 95 | 95 | $sectionName = str_replace('</h2>', '', $sectionName); |
| 96 | 96 | $anchor = strtolower($sectionName); |
| 97 | 97 | $anchor = str_replace(' ', '-', $anchor); |
@@ -41,89 +41,89 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | class Application extends App implements IBackendProvider, IAuthMechanismProvider { |
| 43 | 43 | |
| 44 | - public function __construct(array $urlParams = array()) { |
|
| 45 | - parent::__construct('files_external', $urlParams); |
|
| 46 | - |
|
| 47 | - $container = $this->getContainer(); |
|
| 48 | - |
|
| 49 | - $container->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) { |
|
| 50 | - return $c->getServer()->query('UserMountCache'); |
|
| 51 | - }); |
|
| 52 | - |
|
| 53 | - $backendService = $container->query('OCA\\Files_External\\Service\\BackendService'); |
|
| 54 | - $backendService->registerBackendProvider($this); |
|
| 55 | - $backendService->registerAuthMechanismProvider($this); |
|
| 56 | - |
|
| 57 | - // force-load auth mechanisms since some will register hooks |
|
| 58 | - // TODO: obsolete these and use the TokenProvider to get the user's password from the session |
|
| 59 | - $this->getAuthMechanisms(); |
|
| 60 | - |
|
| 61 | - // app developers: do NOT depend on this! it will disappear with oC 9.0! |
|
| 62 | - \OC::$server->getEventDispatcher()->dispatch( |
|
| 63 | - 'OCA\\Files_External::loadAdditionalBackends' |
|
| 64 | - ); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * @{inheritdoc} |
|
| 69 | - */ |
|
| 70 | - public function getBackends() { |
|
| 71 | - $container = $this->getContainer(); |
|
| 72 | - |
|
| 73 | - $backends = [ |
|
| 74 | - $container->query('OCA\Files_External\Lib\Backend\Local'), |
|
| 75 | - $container->query('OCA\Files_External\Lib\Backend\FTP'), |
|
| 76 | - $container->query('OCA\Files_External\Lib\Backend\DAV'), |
|
| 77 | - $container->query('OCA\Files_External\Lib\Backend\OwnCloud'), |
|
| 78 | - $container->query('OCA\Files_External\Lib\Backend\SFTP'), |
|
| 79 | - $container->query('OCA\Files_External\Lib\Backend\AmazonS3'), |
|
| 80 | - $container->query('OCA\Files_External\Lib\Backend\Dropbox'), |
|
| 81 | - $container->query('OCA\Files_External\Lib\Backend\Google'), |
|
| 82 | - $container->query('OCA\Files_External\Lib\Backend\Swift'), |
|
| 83 | - $container->query('OCA\Files_External\Lib\Backend\SFTP_Key'), |
|
| 84 | - $container->query('OCA\Files_External\Lib\Backend\SMB'), |
|
| 85 | - $container->query('OCA\Files_External\Lib\Backend\SMB_OC'), |
|
| 86 | - ]; |
|
| 87 | - |
|
| 88 | - return $backends; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * @{inheritdoc} |
|
| 93 | - */ |
|
| 94 | - public function getAuthMechanisms() { |
|
| 95 | - $container = $this->getContainer(); |
|
| 96 | - |
|
| 97 | - return [ |
|
| 98 | - // AuthMechanism::SCHEME_NULL mechanism |
|
| 99 | - $container->query('OCA\Files_External\Lib\Auth\NullMechanism'), |
|
| 100 | - |
|
| 101 | - // AuthMechanism::SCHEME_BUILTIN mechanism |
|
| 102 | - $container->query('OCA\Files_External\Lib\Auth\Builtin'), |
|
| 103 | - |
|
| 104 | - // AuthMechanism::SCHEME_PASSWORD mechanisms |
|
| 105 | - $container->query('OCA\Files_External\Lib\Auth\Password\Password'), |
|
| 106 | - $container->query('OCA\Files_External\Lib\Auth\Password\SessionCredentials'), |
|
| 107 | - $container->query('OCA\Files_External\Lib\Auth\Password\LoginCredentials'), |
|
| 108 | - $container->query('OCA\Files_External\Lib\Auth\Password\UserProvided'), |
|
| 109 | - $container->query('OCA\Files_External\Lib\Auth\Password\GlobalAuth'), |
|
| 110 | - |
|
| 111 | - // AuthMechanism::SCHEME_OAUTH1 mechanisms |
|
| 112 | - $container->query('OCA\Files_External\Lib\Auth\OAuth1\OAuth1'), |
|
| 113 | - |
|
| 114 | - // AuthMechanism::SCHEME_OAUTH2 mechanisms |
|
| 115 | - $container->query('OCA\Files_External\Lib\Auth\OAuth2\OAuth2'), |
|
| 116 | - |
|
| 117 | - // AuthMechanism::SCHEME_PUBLICKEY mechanisms |
|
| 118 | - $container->query('OCA\Files_External\Lib\Auth\PublicKey\RSA'), |
|
| 119 | - |
|
| 120 | - // AuthMechanism::SCHEME_OPENSTACK mechanisms |
|
| 121 | - $container->query('OCA\Files_External\Lib\Auth\OpenStack\OpenStack'), |
|
| 122 | - $container->query('OCA\Files_External\Lib\Auth\OpenStack\Rackspace'), |
|
| 123 | - |
|
| 124 | - // Specialized mechanisms |
|
| 125 | - $container->query('OCA\Files_External\Lib\Auth\AmazonS3\AccessKey'), |
|
| 126 | - ]; |
|
| 127 | - } |
|
| 44 | + public function __construct(array $urlParams = array()) { |
|
| 45 | + parent::__construct('files_external', $urlParams); |
|
| 46 | + |
|
| 47 | + $container = $this->getContainer(); |
|
| 48 | + |
|
| 49 | + $container->registerService('OCP\Files\Config\IUserMountCache', function (IAppContainer $c) { |
|
| 50 | + return $c->getServer()->query('UserMountCache'); |
|
| 51 | + }); |
|
| 52 | + |
|
| 53 | + $backendService = $container->query('OCA\\Files_External\\Service\\BackendService'); |
|
| 54 | + $backendService->registerBackendProvider($this); |
|
| 55 | + $backendService->registerAuthMechanismProvider($this); |
|
| 56 | + |
|
| 57 | + // force-load auth mechanisms since some will register hooks |
|
| 58 | + // TODO: obsolete these and use the TokenProvider to get the user's password from the session |
|
| 59 | + $this->getAuthMechanisms(); |
|
| 60 | + |
|
| 61 | + // app developers: do NOT depend on this! it will disappear with oC 9.0! |
|
| 62 | + \OC::$server->getEventDispatcher()->dispatch( |
|
| 63 | + 'OCA\\Files_External::loadAdditionalBackends' |
|
| 64 | + ); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * @{inheritdoc} |
|
| 69 | + */ |
|
| 70 | + public function getBackends() { |
|
| 71 | + $container = $this->getContainer(); |
|
| 72 | + |
|
| 73 | + $backends = [ |
|
| 74 | + $container->query('OCA\Files_External\Lib\Backend\Local'), |
|
| 75 | + $container->query('OCA\Files_External\Lib\Backend\FTP'), |
|
| 76 | + $container->query('OCA\Files_External\Lib\Backend\DAV'), |
|
| 77 | + $container->query('OCA\Files_External\Lib\Backend\OwnCloud'), |
|
| 78 | + $container->query('OCA\Files_External\Lib\Backend\SFTP'), |
|
| 79 | + $container->query('OCA\Files_External\Lib\Backend\AmazonS3'), |
|
| 80 | + $container->query('OCA\Files_External\Lib\Backend\Dropbox'), |
|
| 81 | + $container->query('OCA\Files_External\Lib\Backend\Google'), |
|
| 82 | + $container->query('OCA\Files_External\Lib\Backend\Swift'), |
|
| 83 | + $container->query('OCA\Files_External\Lib\Backend\SFTP_Key'), |
|
| 84 | + $container->query('OCA\Files_External\Lib\Backend\SMB'), |
|
| 85 | + $container->query('OCA\Files_External\Lib\Backend\SMB_OC'), |
|
| 86 | + ]; |
|
| 87 | + |
|
| 88 | + return $backends; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * @{inheritdoc} |
|
| 93 | + */ |
|
| 94 | + public function getAuthMechanisms() { |
|
| 95 | + $container = $this->getContainer(); |
|
| 96 | + |
|
| 97 | + return [ |
|
| 98 | + // AuthMechanism::SCHEME_NULL mechanism |
|
| 99 | + $container->query('OCA\Files_External\Lib\Auth\NullMechanism'), |
|
| 100 | + |
|
| 101 | + // AuthMechanism::SCHEME_BUILTIN mechanism |
|
| 102 | + $container->query('OCA\Files_External\Lib\Auth\Builtin'), |
|
| 103 | + |
|
| 104 | + // AuthMechanism::SCHEME_PASSWORD mechanisms |
|
| 105 | + $container->query('OCA\Files_External\Lib\Auth\Password\Password'), |
|
| 106 | + $container->query('OCA\Files_External\Lib\Auth\Password\SessionCredentials'), |
|
| 107 | + $container->query('OCA\Files_External\Lib\Auth\Password\LoginCredentials'), |
|
| 108 | + $container->query('OCA\Files_External\Lib\Auth\Password\UserProvided'), |
|
| 109 | + $container->query('OCA\Files_External\Lib\Auth\Password\GlobalAuth'), |
|
| 110 | + |
|
| 111 | + // AuthMechanism::SCHEME_OAUTH1 mechanisms |
|
| 112 | + $container->query('OCA\Files_External\Lib\Auth\OAuth1\OAuth1'), |
|
| 113 | + |
|
| 114 | + // AuthMechanism::SCHEME_OAUTH2 mechanisms |
|
| 115 | + $container->query('OCA\Files_External\Lib\Auth\OAuth2\OAuth2'), |
|
| 116 | + |
|
| 117 | + // AuthMechanism::SCHEME_PUBLICKEY mechanisms |
|
| 118 | + $container->query('OCA\Files_External\Lib\Auth\PublicKey\RSA'), |
|
| 119 | + |
|
| 120 | + // AuthMechanism::SCHEME_OPENSTACK mechanisms |
|
| 121 | + $container->query('OCA\Files_External\Lib\Auth\OpenStack\OpenStack'), |
|
| 122 | + $container->query('OCA\Files_External\Lib\Auth\OpenStack\Rackspace'), |
|
| 123 | + |
|
| 124 | + // Specialized mechanisms |
|
| 125 | + $container->query('OCA\Files_External\Lib\Auth\AmazonS3\AccessKey'), |
|
| 126 | + ]; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | 129 | } |
@@ -32,72 +32,72 @@ |
||
| 32 | 32 | |
| 33 | 33 | class Personal implements ISettings { |
| 34 | 34 | |
| 35 | - /** @var IManager */ |
|
| 36 | - private $encryptionManager; |
|
| 35 | + /** @var IManager */ |
|
| 36 | + private $encryptionManager; |
|
| 37 | 37 | |
| 38 | - /** @var UserGlobalStoragesService */ |
|
| 39 | - private $userGlobalStoragesService; |
|
| 38 | + /** @var UserGlobalStoragesService */ |
|
| 39 | + private $userGlobalStoragesService; |
|
| 40 | 40 | |
| 41 | - /** @var BackendService */ |
|
| 42 | - private $backendService; |
|
| 41 | + /** @var BackendService */ |
|
| 42 | + private $backendService; |
|
| 43 | 43 | |
| 44 | - /** @var GlobalAuth */ |
|
| 45 | - private $globalAuth; |
|
| 44 | + /** @var GlobalAuth */ |
|
| 45 | + private $globalAuth; |
|
| 46 | 46 | |
| 47 | - /** @var IUserSession */ |
|
| 48 | - private $userSession; |
|
| 47 | + /** @var IUserSession */ |
|
| 48 | + private $userSession; |
|
| 49 | 49 | |
| 50 | - public function __construct( |
|
| 51 | - IManager $encryptionManager, |
|
| 52 | - UserGlobalStoragesService $userGlobalStoragesService, |
|
| 53 | - BackendService $backendService, |
|
| 54 | - GlobalAuth $globalAuth, |
|
| 55 | - IUserSession $userSession |
|
| 56 | - ) { |
|
| 57 | - $this->encryptionManager = $encryptionManager; |
|
| 58 | - $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
| 59 | - $this->backendService = $backendService; |
|
| 60 | - $this->globalAuth = $globalAuth; |
|
| 61 | - $this->userSession = $userSession; |
|
| 62 | - } |
|
| 50 | + public function __construct( |
|
| 51 | + IManager $encryptionManager, |
|
| 52 | + UserGlobalStoragesService $userGlobalStoragesService, |
|
| 53 | + BackendService $backendService, |
|
| 54 | + GlobalAuth $globalAuth, |
|
| 55 | + IUserSession $userSession |
|
| 56 | + ) { |
|
| 57 | + $this->encryptionManager = $encryptionManager; |
|
| 58 | + $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
| 59 | + $this->backendService = $backendService; |
|
| 60 | + $this->globalAuth = $globalAuth; |
|
| 61 | + $this->userSession = $userSession; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @return TemplateResponse |
|
| 66 | - */ |
|
| 67 | - public function getForm() { |
|
| 68 | - $uid = $this->userSession->getUser()->getUID(); |
|
| 64 | + /** |
|
| 65 | + * @return TemplateResponse |
|
| 66 | + */ |
|
| 67 | + public function getForm() { |
|
| 68 | + $uid = $this->userSession->getUser()->getUID(); |
|
| 69 | 69 | |
| 70 | - $parameters = [ |
|
| 71 | - 'encryptionEnabled' => $this->encryptionManager->isEnabled(), |
|
| 72 | - 'visibilityType' => BackendService::VISIBILITY_PERSONAL, |
|
| 73 | - 'storages' => $this->userGlobalStoragesService->getStorages(), |
|
| 74 | - 'backends' => $this->backendService->getAvailableBackends(), |
|
| 75 | - 'authMechanisms' => $this->backendService->getAuthMechanisms(), |
|
| 76 | - 'dependencies' => \OC_Mount_Config::dependencyMessage($this->backendService->getBackends()), |
|
| 77 | - 'allowUserMounting' => $this->backendService->isUserMountingAllowed(), |
|
| 78 | - 'globalCredentials' => $this->globalAuth->getAuth($uid), |
|
| 79 | - 'globalCredentialsUid' => $uid, |
|
| 80 | - ]; |
|
| 70 | + $parameters = [ |
|
| 71 | + 'encryptionEnabled' => $this->encryptionManager->isEnabled(), |
|
| 72 | + 'visibilityType' => BackendService::VISIBILITY_PERSONAL, |
|
| 73 | + 'storages' => $this->userGlobalStoragesService->getStorages(), |
|
| 74 | + 'backends' => $this->backendService->getAvailableBackends(), |
|
| 75 | + 'authMechanisms' => $this->backendService->getAuthMechanisms(), |
|
| 76 | + 'dependencies' => \OC_Mount_Config::dependencyMessage($this->backendService->getBackends()), |
|
| 77 | + 'allowUserMounting' => $this->backendService->isUserMountingAllowed(), |
|
| 78 | + 'globalCredentials' => $this->globalAuth->getAuth($uid), |
|
| 79 | + 'globalCredentialsUid' => $uid, |
|
| 80 | + ]; |
|
| 81 | 81 | |
| 82 | - return new TemplateResponse('files_external', 'settings', $parameters, ''); |
|
| 83 | - } |
|
| 82 | + return new TemplateResponse('files_external', 'settings', $parameters, ''); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * @return string the section ID, e.g. 'sharing' |
|
| 87 | - */ |
|
| 88 | - public function getSection() { |
|
| 89 | - return 'externalstorages'; |
|
| 90 | - } |
|
| 85 | + /** |
|
| 86 | + * @return string the section ID, e.g. 'sharing' |
|
| 87 | + */ |
|
| 88 | + public function getSection() { |
|
| 89 | + return 'externalstorages'; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * @return int whether the form should be rather on the top or bottom of |
|
| 94 | - * the admin section. The forms are arranged in ascending order of the |
|
| 95 | - * priority values. It is required to return a value between 0 and 100. |
|
| 96 | - * |
|
| 97 | - * E.g.: 70 |
|
| 98 | - */ |
|
| 99 | - public function getPriority() { |
|
| 100 | - return 40; |
|
| 101 | - } |
|
| 92 | + /** |
|
| 93 | + * @return int whether the form should be rather on the top or bottom of |
|
| 94 | + * the admin section. The forms are arranged in ascending order of the |
|
| 95 | + * priority values. It is required to return a value between 0 and 100. |
|
| 96 | + * |
|
| 97 | + * E.g.: 70 |
|
| 98 | + */ |
|
| 99 | + public function getPriority() { |
|
| 100 | + return 40; |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | 103 | } |
@@ -29,39 +29,39 @@ |
||
| 29 | 29 | use OCP\IUserSession; |
| 30 | 30 | |
| 31 | 31 | class PersonalSection extends Section { |
| 32 | - /** @var IUserSession */ |
|
| 33 | - private $userSession; |
|
| 32 | + /** @var IUserSession */ |
|
| 33 | + private $userSession; |
|
| 34 | 34 | |
| 35 | - /** @var UserGlobalStoragesService */ |
|
| 36 | - private $userGlobalStoragesService; |
|
| 35 | + /** @var UserGlobalStoragesService */ |
|
| 36 | + private $userGlobalStoragesService; |
|
| 37 | 37 | |
| 38 | - /** @var BackendService */ |
|
| 39 | - private $backendService; |
|
| 38 | + /** @var BackendService */ |
|
| 39 | + private $backendService; |
|
| 40 | 40 | |
| 41 | - public function __construct( |
|
| 42 | - IURLGenerator $url, |
|
| 43 | - IL10N $l, |
|
| 44 | - IUserSession $userSession, |
|
| 45 | - UserGlobalStoragesService $userGlobalStoragesService, |
|
| 46 | - BackendService $backendService |
|
| 47 | - ) { |
|
| 48 | - parent::__construct($url, $l); |
|
| 49 | - $this->userSession = $userSession; |
|
| 50 | - $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
| 51 | - $this->backendService = $backendService; |
|
| 52 | - } |
|
| 41 | + public function __construct( |
|
| 42 | + IURLGenerator $url, |
|
| 43 | + IL10N $l, |
|
| 44 | + IUserSession $userSession, |
|
| 45 | + UserGlobalStoragesService $userGlobalStoragesService, |
|
| 46 | + BackendService $backendService |
|
| 47 | + ) { |
|
| 48 | + parent::__construct($url, $l); |
|
| 49 | + $this->userSession = $userSession; |
|
| 50 | + $this->userGlobalStoragesService = $userGlobalStoragesService; |
|
| 51 | + $this->backendService = $backendService; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public function getID() { |
|
| 55 | - if (!$this->userSession->isLoggedIn()) { |
|
| 56 | - // we need to return the proper id while installing/upgrading the app |
|
| 57 | - return parent::getID(); |
|
| 58 | - } |
|
| 54 | + public function getID() { |
|
| 55 | + if (!$this->userSession->isLoggedIn()) { |
|
| 56 | + // we need to return the proper id while installing/upgrading the app |
|
| 57 | + return parent::getID(); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - if (count($this->userGlobalStoragesService->getStorages()) > 0 || $this->backendService->isUserMountingAllowed()) { |
|
| 61 | - return parent::getID(); |
|
| 62 | - } else { |
|
| 63 | - // by returning a different id, no matching settings will be found and the item will be hidden |
|
| 64 | - return null; |
|
| 65 | - } |
|
| 66 | - } |
|
| 60 | + if (count($this->userGlobalStoragesService->getStorages()) > 0 || $this->backendService->isUserMountingAllowed()) { |
|
| 61 | + return parent::getID(); |
|
| 62 | + } else { |
|
| 63 | + // by returning a different id, no matching settings will be found and the item will be hidden |
|
| 64 | + return null; |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -36,14 +36,14 @@ |
||
| 36 | 36 | $appContainer = \OC_Mount_Config::$app->getContainer(); |
| 37 | 37 | |
| 38 | 38 | \OCA\Files\App::getNavigationManager()->add(function () { |
| 39 | - $l = \OC::$server->getL10N('files_external'); |
|
| 40 | - return [ |
|
| 41 | - 'id' => 'extstoragemounts', |
|
| 42 | - 'appname' => 'files_external', |
|
| 43 | - 'script' => 'list.php', |
|
| 44 | - 'order' => 30, |
|
| 45 | - 'name' => $l->t('External storages'), |
|
| 46 | - ]; |
|
| 39 | + $l = \OC::$server->getL10N('files_external'); |
|
| 40 | + return [ |
|
| 41 | + 'id' => 'extstoragemounts', |
|
| 42 | + 'appname' => 'files_external', |
|
| 43 | + 'script' => 'list.php', |
|
| 44 | + 'order' => 30, |
|
| 45 | + 'name' => $l->t('External storages'), |
|
| 46 | + ]; |
|
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | 49 | $mountProvider = $appContainer->query('OCA\Files_External\Config\ConfigAdapter'); |
@@ -29,13 +29,13 @@ |
||
| 29 | 29 | |
| 30 | 30 | OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php'; |
| 31 | 31 | |
| 32 | -require_once __DIR__ . '/../3rdparty/autoload.php'; |
|
| 32 | +require_once __DIR__.'/../3rdparty/autoload.php'; |
|
| 33 | 33 | |
| 34 | 34 | // register Application object singleton |
| 35 | 35 | \OC_Mount_Config::$app = new \OCA\Files_External\AppInfo\Application(); |
| 36 | 36 | $appContainer = \OC_Mount_Config::$app->getContainer(); |
| 37 | 37 | |
| 38 | -\OCA\Files\App::getNavigationManager()->add(function () { |
|
| 38 | +\OCA\Files\App::getNavigationManager()->add(function() { |
|
| 39 | 39 | $l = \OC::$server->getL10N('files_external'); |
| 40 | 40 | return [ |
| 41 | 41 | 'id' => 'extstoragemounts', |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | 24 | script('settings', [ |
| 25 | - 'authtoken', |
|
| 26 | - 'authtoken_collection', |
|
| 27 | - 'authtoken_view', |
|
| 28 | - 'settings/authtoken-init' |
|
| 25 | + 'authtoken', |
|
| 26 | + 'authtoken_collection', |
|
| 27 | + 'authtoken_view', |
|
| 28 | + 'settings/authtoken-init' |
|
| 29 | 29 | ]); |
| 30 | 30 | |
| 31 | 31 | ?> |
@@ -32,13 +32,13 @@ |
||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | <div id="security" class="section"> |
| 35 | - <h2><?php p($l->t('Security'));?></h2> |
|
| 36 | - <p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.'));?></p> |
|
| 35 | + <h2><?php p($l->t('Security')); ?></h2> |
|
| 36 | + <p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.')); ?></p> |
|
| 37 | 37 | <table class="icon-loading"> |
| 38 | 38 | <thead class="token-list-header"> |
| 39 | 39 | <tr> |
| 40 | - <th><?php p($l->t('Device'));?></th> |
|
| 41 | - <th><?php p($l->t('Last activity'));?></th> |
|
| 40 | + <th><?php p($l->t('Device')); ?></th> |
|
| 41 | + <th><?php p($l->t('Last activity')); ?></th> |
|
| 42 | 42 | <th></th> |
| 43 | 43 | </tr> |
| 44 | 44 | </thead> |