From 248a7fa48a161aedf619dd9a36718775c9a2677f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 30 Mar 2020 10:46:54 -0400 Subject: [PATCH 001/544] Welcome 2020.06-dev! --- CHANGELOG | 9 +++++++++ VERSION | 2 +- boot.php | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 19edb6eca..197b2bca0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,12 @@ +Version 2020.06 (unreleased) + Friendica Core: + + Friendica Addons: + showmore_dyn: + New addon to collapse long post depending on their actual height [wiwie] + + Closed Issues: + Version 2020.03 "Red Hot Poker" (2020-03-30) Friendica Core: Updates to the translations (DE, FR, JA, NL, PL, RU, ZH-CN) [translation teams] diff --git a/VERSION b/VERSION index d8ba5c6c2..51ae1fea5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2020.03 +2020.06-dev diff --git a/boot.php b/boot.php index 17126fd38..348e1b2c4 100644 --- a/boot.php +++ b/boot.php @@ -39,7 +39,7 @@ use Friendica\Util\DateTimeFormat; define('FRIENDICA_PLATFORM', 'Friendica'); define('FRIENDICA_CODENAME', 'Red Hot Poker'); -define('FRIENDICA_VERSION', '2020.03'); +define('FRIENDICA_VERSION', '2020.06-dev'); define('DFRN_PROTOCOL_VERSION', '2.23'); define('NEW_UPDATE_ROUTINE_VERSION', 1170); From dcf59e34c195fb3c8c07a29fdf6525ce47c3f736 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 30 Mar 2020 01:57:10 -0400 Subject: [PATCH 002/544] Add new Strings::substringReplace method - Add tests for the method --- src/Util/Strings.php | 38 +++++++++++++++++++++ tests/src/Util/StringsTest.php | 60 ++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/src/Util/Strings.php b/src/Util/Strings.php index c520b54b9..3dd91193d 100644 --- a/src/Util/Strings.php +++ b/src/Util/Strings.php @@ -420,4 +420,42 @@ class Strings return $pathItem; } + + /** + * Multi-byte safe implementation of substr_replace where $start and $length are character offset and count rather + * than byte offset and counts. + * + * Depends on mbstring, use default encoding. + * + * @param string $string + * @param string $replacement + * @param int $start + * @param int|null $length + * @return string + * @see substr_replace() + */ + public static function substringReplace(string $string, string $replacement, int $start, int $length = null) + { + $string_length = mb_strlen($string); + + $length = $length ?? $string_length; + + if ($start < 0) { + $start = max(0, $string_length + $start); + } else if ($start > $string_length) { + $start = $string_length; + } + + if ($length < 0) { + $length = max(0, $string_length - $start + $length); + } else if ($length > $string_length) { + $length = $string_length; + } + + if (($start + $length) > $string_length) { + $length = $string_length - $start; + } + + return mb_substr($string, 0, $start) . $replacement . mb_substr($string, $start + $length, $string_length - $start - $length); + } } diff --git a/tests/src/Util/StringsTest.php b/tests/src/Util/StringsTest.php index 86280cc5f..66fb2f0f5 100644 --- a/tests/src/Util/StringsTest.php +++ b/tests/src/Util/StringsTest.php @@ -134,4 +134,64 @@ class StringsTest extends TestCase { $this->assertEquals($valid, Strings::isHex($input)); } + + /** + * Tests that Strings::substringReplace behaves the same as substr_replace with ASCII strings in all the possible + * numerical parameter configurations (positive, negative, zero, out of bounds either side, null) + */ + public function testSubstringReplaceASCII() + { + for ($start = -10; $start <= 10; $start += 5) { + $this->assertEquals( + substr_replace('string', 'replacement', $start), + Strings::substringReplace('string', 'replacement', $start) + ); + + for ($length = -10; $length <= 10; $length += 5) { + $this->assertEquals( + substr_replace('string', 'replacement', $start, $length), + Strings::substringReplace('string', 'replacement', $start, $length) + ); + } + } + } + + + public function dataSubstringReplaceMultiByte() + { + return [ + 'issue-8470' => [ + 'expected' => 'Je n’y pense que maintenant (pask ma sonnette ne fonctionne pas) : mettre un gentil mot avec mes coordonnées sur ma porte est le moyen le plus simple de rester en contact si besoin avec mon voisinage direct ! [url=https://www.instagram.com/p/B-UdH2loee1/?igshid=x4aglyju9kva]instagram.com/p/B-UdH2loee1/…[/url] [rest of the post]', + 'string' => 'Je n’y pense que maintenant (pask ma sonnette ne fonctionne pas) : mettre un gentil mot avec mes coordonnées sur ma porte est le moyen le plus simple de rester en contact si besoin avec mon voisinage direct ! https://t.co/YoBWTHsAAk [rest of the post]', + 'replacement' => '[url=https://www.instagram.com/p/B-UdH2loee1/?igshid=x4aglyju9kva]instagram.com/p/B-UdH2loee1/…[/url]', + 'start' => 209, + 'length' => 23, + ], + ]; + } + + /** + * Tests cases where Strings::substringReplace is needed over substr_replace with multi-byte strings and character + * offsets + * + * @param string $expected + * @param string $string + * @param string $replacement + * @param int $start + * @param int|null $length + * + * @dataProvider dataSubstringReplaceMultiByte + */ + public function testSubstringReplaceMultiByte(string $expected, string $string, string $replacement, int $start, int $length = null) + { + $this->assertEquals( + $expected, + Strings::substringReplace( + $string, + $replacement, + $start, + $length + ) + ); + } } From 33957dc2a4d4d68497bc29d775974074e8e86319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Wagner?= Date: Tue, 31 Mar 2020 18:54:46 +0200 Subject: [PATCH 003/544] be more precise about items to copy be more precise about items to copy to the new friendica folder when upgrading --- doc/Update.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/Update.md b/doc/Update.md index 1fca48ac1..7f8a0fcae 100644 --- a/doc/Update.md +++ b/doc/Update.md @@ -8,7 +8,13 @@ Updating Friendica If you installed Friendica in the ``path/to/friendica`` folder: 1. Unpack the new Friendica archive in ``path/to/friendica_new``. -2. Copy ``config/local.config.php``, ``photo/`` and ``proxy/`` from ``path/to/friendica`` to ``path/to/friendica_new``. +2. Copy the following items from ``path/to/friendica`` to ``path/to/friendica_new``: + * ``config/local.config.php`` + * ``proxy/`` +The following items only need to be copied if they are located inside your friendica path: + * your storage folder as set in **Admin -> Site -> File Upload -> Storage base path** + * your item cache as set in **Admin -> Site -> Performance -> Path to item cache** + * your temp folder as set in **Admin -> Site -> Advanced -> Temp path** 3. Rename the ``path/to/friendica`` folder to ``path/to/friendica_old``. 4. Rename the ``path/to/friendica_new`` folder to ``path/to/friendica``. 5. Check your site. Note: it may go into maintenance mode to update the database schema. From d3722c945b99955b33a813a7369ee4581a784f8a Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 1 Apr 2020 05:42:44 +0000 Subject: [PATCH 004/544] Improved Mime Type detection --- include/api.php | 9 +- mod/photos.php | 4 +- mod/wall_upload.php | 18 +--- src/Content/Text/BBCode.php | 15 ++- src/Model/Photo.php | 4 +- src/Model/User.php | 13 ++- src/Module/Settings/Profile/Photo/Index.php | 5 +- src/Object/Image.php | 16 --- src/Util/Images.php | 107 ++++++++++++-------- 9 files changed, 89 insertions(+), 102 deletions(-) diff --git a/include/api.php b/include/api.php index bcfd5af24..8291d1892 100644 --- a/include/api.php +++ b/include/api.php @@ -4734,13 +4734,8 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $ } } - if ($filetype == "") { - $filetype = Images::guessType($filename); - } - $imagedata = @getimagesize($src); - if ($imagedata) { - $filetype = $imagedata['mime']; - } + $filetype = Images::getMimeTypeBySource($src, $filename, $filetype); + Logger::log( "File upload src: " . $src . " - filename: " . $filename . " - size: " . $filesize . " - type: " . $filetype, diff --git a/mod/photos.php b/mod/photos.php index ef957ad5b..3f558429d 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -706,9 +706,7 @@ function photos_post(App $a) return; } - if ($type == "") { - $type = Images::guessType($filename); - } + $type = Images::getMimeTypeBySource($src, $filename, $type); Logger::log('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', Logger::DEBUG); diff --git a/mod/wall_upload.php b/mod/wall_upload.php index fd33cdd17..3841ef97b 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -174,23 +174,7 @@ function wall_upload_post(App $a, $desktopmode = true) exit(); } - // This is a special treatment for picture upload from Twidere - if (($filename == "octet-stream") && ($filetype != "")) { - $filename = $filetype; - $filetype = ""; - } - - if ($filetype == "") { - $filetype = Images::guessType($filename); - } - - // If there is a temp name, then do a manual check - // This is more reliable than the provided value - - $imagedata = getimagesize($src); - if ($imagedata) { - $filetype = $imagedata['mime']; - } + $filetype = Images::getMimeTypeBySource($src, $filename, $filetype); Logger::log("File upload src: " . $src . " - filename: " . $filename . " - size: " . $filesize . " - type: " . $filetype, Logger::DEBUG); diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 7a316c251..334efb32a 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -453,6 +453,10 @@ class BBCode { $s = $srctext; + // Simplify image links + $s = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $s); + $s = preg_replace("/\[img\=(.*?)\](.*?)\[\/img\]/ism", '[img]$1[/img]', $s); + $matches = null; $c = preg_match_all('/\[img.*?\](.*?)\[\/img\]/ism', $s, $matches, PREG_SET_ORDER); if ($c) { @@ -464,13 +468,14 @@ class BBCode continue; } - $i = Network::fetchUrl($mtch[1]); - if (!$i) { - return $srctext; + $curlResult = Network::curl($mtch[1], true); + if (!$curlResult->isSuccess()) { + continue; } - // guess mimetype from headers or filename - $type = Images::guessType($mtch[1], true); + $i = $curlResult->getBody(); + $type = $curlResult->getContentType(); + $type = Images::getMimeTypeByData($i, $mtch[1], $type); if ($i) { $Image = new Image($i, $type); diff --git a/src/Model/Photo.php b/src/Model/Photo.php index 45a8a92e1..9d8b5611f 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -432,9 +432,7 @@ class Photo return false; } - if (empty($type)) { - $type = Images::guessType($image_url, true); - } + $type = Images::getMimeTypeByData($img_str, $image_url, $type); $Image = new Image($img_str, $type); if ($Image->isValid()) { diff --git a/src/Model/User.php b/src/Model/User.php index 351982e8a..4ef5ffa33 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -839,9 +839,16 @@ class User $photo_failure = false; $filename = basename($photo); - $img_str = Network::fetchUrl($photo, true); - // guess mimetype from headers or filename - $type = Images::guessType($photo, true); + $curlResult = Network::curl($photo, true); + if ($curlResult->isSuccess()) { + $img_str = $curlResult->getBody(); + $type = $curlResult->getContentType(); + } else { + $img_str = ''; + $type = ''; + } + + $type = Images::getMimeTypeByData($img_str, $photo, $type); $Image = new Image($img_str, $type); if ($Image->isValid()) { diff --git a/src/Module/Settings/Profile/Photo/Index.php b/src/Module/Settings/Profile/Photo/Index.php index 40b4ab153..3e4f9b8a4 100644 --- a/src/Module/Settings/Profile/Photo/Index.php +++ b/src/Module/Settings/Profile/Photo/Index.php @@ -52,9 +52,8 @@ class Index extends BaseSettings $filename = basename($_FILES['userfile']['name']); $filesize = intval($_FILES['userfile']['size']); $filetype = $_FILES['userfile']['type']; - if ($filetype == '') { - $filetype = Images::guessType($filename); - } + + $filetype = Images::getMimeTypeBySource($src, $filename, $filetype); $maximagesize = DI::config()->get('system', 'maximagesize', 0); diff --git a/src/Object/Image.php b/src/Object/Image.php index 535eae0b3..4d064f3c3 100644 --- a/src/Object/Image.php +++ b/src/Object/Image.php @@ -708,22 +708,6 @@ class Image return Images::getFormatsMap(); } - /** - * Guess image mimetype from filename or from Content-Type header - * - * @param string $filename Image filename - * @param boolean $fromcurl Check Content-Type header from curl request - * @param string $header passed headers to take into account - * - * @return string|null - * @throws Exception - * @deprecated in version 2019.12 please use Util\Images::guessType() instead. - */ - public static function guessType($filename, $fromcurl = false, $header = '') - { - return Images::guessType($filename, $fromcurl, $header); - } - /** * @param string $url url * @return array diff --git a/src/Util/Images.php b/src/Util/Images.php index 6471ed526..35f0cfc04 100644 --- a/src/Util/Images.php +++ b/src/Util/Images.php @@ -24,7 +24,6 @@ namespace Friendica\Util; use Friendica\Core\Logger; use Friendica\Core\System; use Friendica\DI; -use Imagick; /** * Image utilities @@ -74,61 +73,79 @@ class Images } /** - * Guess image mimetype from filename or from Content-Type header + * Fetch image mimetype from the image data or guessing from the file name * - * @param string $filename Image filename - * @param boolean $fromcurl Check Content-Type header from curl request - * @param string $header passed headers to take into account + * @param string $image_data Image data + * @param string $filename File name (for guessing the type via the extension) + * @param string $mime default mime type * - * @return string|null + * @return string * @throws \Exception */ - public static function guessType($filename, $fromcurl = false, $header = '') + public static function getMimeTypeByData(string $image_data, string $filename = '', string $mime = '') { - Logger::info('Image: guessType: ' . $filename . ($fromcurl ? ' from curl headers' : '')); - $type = null; - if ($fromcurl) { - $headers = []; - $h = explode("\n", $header); - foreach ($h as $l) { - $data = array_map("trim", explode(":", trim($l), 2)); - if (count($data) > 1) { - list($k, $v) = $data; - $headers[$k] = $v; - } - } - - if (array_key_exists('Content-Type', $headers)) { - $type = $headers['Content-Type']; - } + if (substr($mime, 0, 6) == 'image/') { + Logger::info('Using default mime type', ['filename' => $filename, 'mime' => $mime]); + return $mime; } - if (is_null($type)) { - // Guessing from extension? Isn't that... dangerous? - if (class_exists('Imagick') && file_exists($filename) && is_readable($filename)) { - /** - * Well, this not much better, - * but at least it comes from the data inside the image, - * we won't be tricked by a manipulated extension - */ - $image = new Imagick($filename); - $type = $image->getImageMimeType(); - } else { - $ext = pathinfo($filename, PATHINFO_EXTENSION); - $types = self::supportedTypes(); - $type = 'image/jpeg'; - foreach ($types as $m => $e) { - if ($ext == $e) { - $type = $m; - } - } - } + $image = @getimagesizefromstring($image_data); + if (!empty($image['mime'])) { + Logger::info('Mime type detected via data', ['filename' => $filename, 'default' => $mime, 'mime' => $image['mime']]); + return $image['mime']; } - Logger::info('Image: guessType: type=' . $type); - return $type; + return self::guessTypeByExtension($filename); } + /** + * Fetch image mimetype from the image data or guessing from the file name + * + * @param string $sourcefile Source file of the image + * @param string $filename File name (for guessing the type via the extension) + * @param string $mime default mime type + * + * @return string + * @throws \Exception + */ + public static function getMimeTypeBySource(string $sourcefile, string $filename = '', string $mime = '') + { + if (substr($mime, 0, 6) == 'image/') { + Logger::info('Using default mime type', ['filename' => $filename, 'mime' => $mime]); + return $mime; + } + + $image = @getimagesize($sourcefile); + if (!empty($image['mime'])) { + Logger::info('Mime type detected via file', ['filename' => $filename, 'default' => $mime, 'image' => $image]); + return $image['mime']; + } + + return self::guessTypeByExtension($filename); + } + + /** + * Guess image mimetype from the filename + * + * @param string $filename Image filename + * + * @return string + * @throws \Exception + */ + public static function guessTypeByExtension(string $filename) + { + $ext = pathinfo(parse_url($filename, PHP_URL_PATH), PATHINFO_EXTENSION); + $types = self::supportedTypes(); + $type = 'image/jpeg'; + foreach ($types as $m => $e) { + if ($ext == $e) { + $type = $m; + } + } + + Logger::info('Mime type guessed via extension', ['filename' => $filename, 'type' => $type]); + return $type; + } /** * @param string $url From 3c50f985a9f9a482c5a254db416c3363c29af3fc Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 31 Mar 2020 21:43:04 -0400 Subject: [PATCH 005/544] Remove modal window for default post permission setting --- mod/settings.php | 1 - view/templates/settings/settings.tpl | 22 ++++------------ .../frio/templates/settings/settings.tpl | 26 +++---------------- 3 files changed, 9 insertions(+), 40 deletions(-) diff --git a/mod/settings.php b/mod/settings.php index 4b34e9c18..3832de1b1 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -937,7 +937,6 @@ function settings_content(App $a) '$maxreq' => ['maxreq', DI::l10n()->t('Maximum Friend Requests/Day:'), $maxreq , DI::l10n()->t("\x28to prevent spam abuse\x29")], '$permissions' => DI::l10n()->t('Default Post Permissions'), - '$permdesc' => DI::l10n()->t("\x28click to open/close\x29"), '$visibility' => $profile['net-publish'], '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->user), '$blockwall'=> $blockwall, // array('blockwall', DI::l10n()->t('Allow friends to post to your profile page:'), !$blockwall, ''), diff --git a/view/templates/settings/settings.tpl b/view/templates/settings/settings.tpl index fd0de22da..fe83ebf0c 100644 --- a/view/templates/settings/settings.tpl +++ b/view/templates/settings/settings.tpl @@ -65,24 +65,12 @@ {{include file="field_input.tpl" field=$cntunkmail}} -
- {{$permissions}} {{$permdesc}} -
- - -
-
-
- {{$group_select nofilter}} + +

{{$permissions}}

+ +{{$aclselect nofilter}} +
diff --git a/view/theme/frio/templates/settings/settings.tpl b/view/theme/frio/templates/settings/settings.tpl index 11e697b30..40c1d85dd 100644 --- a/view/theme/frio/templates/settings/settings.tpl +++ b/view/theme/frio/templates/settings/settings.tpl @@ -101,30 +101,12 @@ {{include file="field_input.tpl" field=$cntunkmail}} - {{* Block for setting default permissions *}} -
- {{$permissions}} {{$permdesc}} -
- - {{* We include the aclModal directly into the template since we cant use frio's default modal *}} - -
-
- {{$group_select nofilter}} +

{{$permissions}}

+ + {{$aclselect nofilter}} +
From 01c6179feb8d8de25515858aaaf2c237031a7969 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 1 Apr 2020 18:11:06 +0000 Subject: [PATCH 006/544] Check for Antelope and convert to Barracuda --- src/Console/DatabaseStructure.php | 2 +- src/Database/DBStructure.php | 12 +++++++++--- src/Model/Item.php | 2 +- src/Module/Admin/Summary.php | 5 +++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Console/DatabaseStructure.php b/src/Console/DatabaseStructure.php index 62c813640..6b1fa8d4d 100644 --- a/src/Console/DatabaseStructure.php +++ b/src/Console/DatabaseStructure.php @@ -54,7 +54,7 @@ Commands dryrun Show database update schema queries without running them update Update database schema dumpsql Dump database schema - toinnodb Convert all tables from MyISAM to InnoDB + toinnodb Convert all tables from MyISAM or InnoDB in the Antelope file format to InnoDB in the Barracuda file format Options -h|--help|-? Show help information diff --git a/src/Database/DBStructure.php b/src/Database/DBStructure.php index 06b652494..6fe4d614d 100644 --- a/src/Database/DBStructure.php +++ b/src/Database/DBStructure.php @@ -49,7 +49,7 @@ class DBStructure private static $definition = []; /** - * Converts all tables from MyISAM to InnoDB + * Converts all tables from MyISAM/InnoDB Antelope to InnoDB Barracuda */ public static function convertToInnoDB() { @@ -59,13 +59,19 @@ class DBStructure ['engine' => 'MyISAM', 'table_schema' => DBA::databaseName()] ); + $tables = array_merge($tables, DBA::selectToArray( + ['information_schema' => 'tables'], + ['table_name'], + ['engine' => 'InnoDB', 'ROW_FORMAT' => ['COMPACT', 'REDUNDANT'], 'table_schema' => DBA::databaseName()] + )); + if (!DBA::isResult($tables)) { - echo DI::l10n()->t('There are no tables on MyISAM.') . "\n"; + echo DI::l10n()->t('There are no tables on MyISAM or InnoDB with the Antelope file format.') . "\n"; return; } foreach ($tables AS $table) { - $sql = "ALTER TABLE " . DBA::quoteIdentifier($table['table_name']) . " engine=InnoDB;"; + $sql = "ALTER TABLE " . DBA::quoteIdentifier($table['table_name']) . " ENGINE=InnoDB ROW_FORMAT=DYNAMIC;"; echo $sql . "\n"; $result = DBA::e($sql); diff --git a/src/Model/Item.php b/src/Model/Item.php index 7ac1ab300..a9a6eede2 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -1957,7 +1957,7 @@ class Item // There are duplicates. We delete our just created entry. Logger::info('Delete duplicated item', ['id' => $current_post, 'uri' => $item['uri'], 'uid' => $item['uid'], 'guid' => $item['guid']]); - // Yes, we could do a rollback here - but we are having many users with MyISAM. + // Yes, we could do a rollback here - but we possibly are still having users with MyISAM. DBA::delete('item', ['id' => $current_post]); DBA::commit(); return 0; diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index 7e3505e7a..f676792d8 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -50,6 +50,11 @@ class Summary extends BaseAdmin $warningtext[] = DI::l10n()->t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See here for a guide that may be helpful converting the table engines. You may also use the command php bin/console.php dbstructure toinnodb of your Friendica installation for an automatic conversion.
', 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html'); } + // are there InnoDB tables in Antelope in the DB? If so, trigger a warning message + if (DBA::count(['information_schema' => 'tables'], ['ENGINE' => 'InnoDB', 'ROW_FORMAT' => ['COMPACT', 'REDUNDANT'], 'table_schema' => DBA::databaseName()])) { + $warningtext[] = DI::l10n()->t('Your DB still runs with InnoDB tables in the Antelope file format. You should change the file format to Barracuda. Friendica is using features that are not provided by the Antelope format. See here for a guide that may be helpful converting the table engines. You may also use the command php bin/console.php dbstructure toinnodb of your Friendica installation for an automatic conversion.
', 'https://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html'); + } + // Check if github.com/friendica/master/VERSION is higher then // the local version of Friendica. Check is opt-in, source may be master or devel branch if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') { From 5ce404f517c9de6e4b7a1e2564b5c4857c14c8f2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Tue, 31 Mar 2020 21:38:56 -0400 Subject: [PATCH 007/544] Refactor user settings page - Fix header hierarchy - [frio] Fix panel display - Move checkbox sub-template calls to template --- mod/settings.php | 105 ++----- view/templates/settings/settings.tpl | 282 +++++++++--------- view/theme/frio/css/style.css | 6 + .../frio/templates/settings/settings.tpl | 277 ++++++++--------- 4 files changed, 289 insertions(+), 381 deletions(-) diff --git a/mod/settings.php b/mod/settings.php index 3832de1b1..c4e248293 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -823,44 +823,11 @@ function settings_content(App $a) ]); } + $net_pub_desc = ''; if (strlen(DI::config()->get('system', 'directory'))) { $net_pub_desc = ' ' . DI::l10n()->t('Your profile will also be published in the global friendica directories (e.g. %s).', DI::config()->get('system', 'directory'), DI::config()->get('system', 'directory')); - } else { - $net_pub_desc = ''; } - $profile_in_net_dir = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['profile_in_netdirectory', DI::l10n()->t('Allow your profile to be searchable globally?'), $profile['net-publish'], DI::l10n()->t("Activate this setting if you want others to easily find and follow you. Your profile will be searchable on remote systems. This setting also determines whether Friendica will inform search engines that your profile should be indexed or not.") . $net_pub_desc] - ]); - - $hide_friends = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['hide-friends', DI::l10n()->t('Hide your contact/friend list from viewers of your profile?'), $profile['hide-friends'], DI::l10n()->t('A list of your contacts is displayed on your profile page. Activate this option to disable the display of your contact list.')], - ]); - - $hide_wall = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['hidewall', DI::l10n()->t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], DI::l10n()->t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Your public posts and replies will still be accessible by other means.')], - ]); - - $unlisted = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['unlisted', DI::l10n()->t('Make public posts unlisted'), DI::pConfig()->get(local_user(), 'system', 'unlisted'), DI::l10n()->t('Your public posts will not appear on the community pages or in search results, nor be sent to relay servers. However they can still appear on public feeds on remote servers.')], - ]); - - $accessiblephotos = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['accessible-photos', DI::l10n()->t('Make all posted pictures accessible'), DI::pConfig()->get(local_user(), 'system', 'accessible-photos'), DI::l10n()->t("This option makes every posted picture accessible via the direct link. This is a workaround for the problem that most other networks can't handle permissions on pictures. Non public pictures still won't be visible for the public on your photo albums though.")], - ]); - - $blockwall = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['blockwall', DI::l10n()->t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), DI::l10n()->t('Your contacts may write posts on your profile wall. These posts will be distributed to your contacts')], - ]); - - $blocktags = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['blocktags', DI::l10n()->t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), DI::l10n()->t('Your contacts can add additional tags to your posts.')], - ]); - - $unkmail = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['unkmail', DI::l10n()->t('Permit unknown people to send you private mail?'), $unkmail, DI::l10n()->t('Friendica network users may send you private messages even if they are not in your contact list.')], - ]); - $tpl_addr = Renderer::getMarkupTemplate('settings/nick_set.tpl'); $prof_addr = Renderer::replaceMacros($tpl_addr,[ @@ -870,18 +837,6 @@ function settings_content(App $a) $stpl = Renderer::getMarkupTemplate('settings/settings.tpl'); - $expire_arr = [ - 'days' => ['expire', DI::l10n()->t("Automatically expire posts after this many days:"), $expire, DI::l10n()->t('If empty, posts will not expire. Expired posts will be deleted')], - 'label' => DI::l10n()->t('Expiration settings'), - 'items' => ['expire_items', DI::l10n()->t('Expire posts'), $expire_items, DI::l10n()->t('When activated, posts and comments will be expired.')], - 'notes' => ['expire_notes', DI::l10n()->t('Expire personal notes'), $expire_notes, DI::l10n()->t('When activated, the personal notes on your profile page will be expired.')], - 'starred' => ['expire_starred', DI::l10n()->t('Expire starred posts'), $expire_starred, DI::l10n()->t('Starring posts keeps them from being expired. That behaviour is overwritten by this setting.')], - 'photos' => ['expire_photos', DI::l10n()->t('Expire photos'), $expire_photos, DI::l10n()->t('When activated, photos will be expired.')], - 'network_only' => ['expire_network_only', DI::l10n()->t('Only expire posts by others'), $expire_network_only, DI::l10n()->t('When activated, your own posts never expire. Then the settings above are only valid for posts you received.')], - ]; - - $group_select = Group::displayGroupSelection(local_user(), $a->user['def_gid']); - // Private/public post links for the non-JS ACL form $private_post = 1; if (!empty($_REQUEST['public']) && !$_REQUEST['public']) { @@ -932,40 +887,32 @@ function settings_content(App $a) '$defloc' => ['defloc', DI::l10n()->t('Default Post Location:'), $defloc, ''], '$allowloc' => ['allow_location', DI::l10n()->t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''], + '$h_prv' => DI::l10n()->t('Security and Privacy Settings'), + '$visibility' => $profile['net-publish'], + '$maxreq' => ['maxreq', DI::l10n()->t('Maximum Friend Requests/Day:'), $maxreq , DI::l10n()->t("\x28to prevent spam abuse\x29")], + '$profile_in_dir' => $profile_in_dir, + '$profile_in_net_dir' => ['profile_in_netdirectory', DI::l10n()->t('Allow your profile to be searchable globally?'), $profile['net-publish'], DI::l10n()->t("Activate this setting if you want others to easily find and follow you. Your profile will be searchable on remote systems. This setting also determines whether Friendica will inform search engines that your profile should be indexed or not.") . $net_pub_desc], + '$hide_friends' => ['hide-friends', DI::l10n()->t('Hide your contact/friend list from viewers of your profile?'), $profile['hide-friends'], DI::l10n()->t('A list of your contacts is displayed on your profile page. Activate this option to disable the display of your contact list.')], + '$hide_wall' => ['hidewall', DI::l10n()->t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], DI::l10n()->t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Your public posts and replies will still be accessible by other means.')], + '$unlisted' => ['unlisted', DI::l10n()->t('Make public posts unlisted'), DI::pConfig()->get(local_user(), 'system', 'unlisted'), DI::l10n()->t('Your public posts will not appear on the community pages or in search results, nor be sent to relay servers. However they can still appear on public feeds on remote servers.')], + '$accessiblephotos' => ['accessible-photos', DI::l10n()->t('Make all posted pictures accessible'), DI::pConfig()->get(local_user(), 'system', 'accessible-photos'), DI::l10n()->t("This option makes every posted picture accessible via the direct link. This is a workaround for the problem that most other networks can't handle permissions on pictures. Non public pictures still won't be visible for the public on your photo albums though.")], + '$blockwall' => ['blockwall', DI::l10n()->t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), DI::l10n()->t('Your contacts may write posts on your profile wall. These posts will be distributed to your contacts')], // array('blockwall', DI::l10n()->t('Allow friends to post to your profile page:'), !$blockwall, ''), + '$blocktags' => ['blocktags', DI::l10n()->t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), DI::l10n()->t('Your contacts can add additional tags to your posts.')], // array('blocktags', DI::l10n()->t('Allow friends to tag your posts:'), !$blocktags, ''), + '$unkmail' => ['unkmail', DI::l10n()->t('Permit unknown people to send you private mail?'), $unkmail, DI::l10n()->t('Friendica network users may send you private messages even if they are not in your contact list.')], + '$cntunkmail' => ['cntunkmail', DI::l10n()->t('Maximum private messages per day from unknown people:'), $cntunkmail , DI::l10n()->t("\x28to prevent spam abuse\x29")], + '$group_select' => Group::displayGroupSelection(local_user(), $a->user['def_gid']), + '$permissions' => DI::l10n()->t('Default Post Permissions'), + '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->user), - '$h_prv' => DI::l10n()->t('Security and Privacy Settings'), - - '$maxreq' => ['maxreq', DI::l10n()->t('Maximum Friend Requests/Day:'), $maxreq , DI::l10n()->t("\x28to prevent spam abuse\x29")], - '$permissions' => DI::l10n()->t('Default Post Permissions'), - '$visibility' => $profile['net-publish'], - '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->user), - '$blockwall'=> $blockwall, // array('blockwall', DI::l10n()->t('Allow friends to post to your profile page:'), !$blockwall, ''), - '$blocktags'=> $blocktags, // array('blocktags', DI::l10n()->t('Allow friends to tag your posts:'), !$blocktags, ''), - - // ACL permissions box - '$group_perms' => DI::l10n()->t('Show to Groups'), - '$contact_perms' => DI::l10n()->t('Show to Contacts'), - '$private' => DI::l10n()->t('Default Private Post'), - '$public' => DI::l10n()->t('Default Public Post'), - '$is_private' => $private_post, - '$return_path' => $query_str, - '$public_link' => $public_post_link, - '$settings_perms' => DI::l10n()->t('Default Permissions for New Posts'), - - '$group_select' => $group_select, - - - '$expire' => $expire_arr, - - '$profile_in_dir' => $profile_in_dir, - '$profile_in_net_dir' => $profile_in_net_dir, - '$hide_friends' => $hide_friends, - '$hide_wall' => $hide_wall, - '$unlisted' => $unlisted, - '$accessiblephotos' => $accessiblephotos, - '$unkmail' => $unkmail, - '$cntunkmail' => ['cntunkmail', DI::l10n()->t('Maximum private messages per day from unknown people:'), $cntunkmail , DI::l10n()->t("\x28to prevent spam abuse\x29")], - + '$expire' => [ + 'label' => DI::l10n()->t('Expiration settings'), + 'days' => ['expire', DI::l10n()->t("Automatically expire posts after this many days:"), $expire, DI::l10n()->t('If empty, posts will not expire. Expired posts will be deleted')], + 'items' => ['expire_items', DI::l10n()->t('Expire posts'), $expire_items, DI::l10n()->t('When activated, posts and comments will be expired.')], + 'notes' => ['expire_notes', DI::l10n()->t('Expire personal notes'), $expire_notes, DI::l10n()->t('When activated, the personal notes on your profile page will be expired.')], + 'starred' => ['expire_starred', DI::l10n()->t('Expire starred posts'), $expire_starred, DI::l10n()->t('Starring posts keeps them from being expired. That behaviour is overwritten by this setting.')], + 'photos' => ['expire_photos', DI::l10n()->t('Expire photos'), $expire_photos, DI::l10n()->t('When activated, photos will be expired.')], + 'network_only' => ['expire_network_only', DI::l10n()->t('Only expire posts by others'), $expire_network_only, DI::l10n()->t('When activated, your own posts never expire. Then the settings above are only valid for posts you received.')], + ], '$h_not' => DI::l10n()->t('Notification Settings'), '$lbl_not' => DI::l10n()->t('Send a notification email when:'), diff --git a/view/templates/settings/settings.tpl b/view/templates/settings/settings.tpl index fe83ebf0c..bd0fa5f20 100644 --- a/view/templates/settings/settings.tpl +++ b/view/templates/settings/settings.tpl @@ -2,183 +2,173 @@ {{$nickname_block nofilter}} -
- + + -

{{$h_pass}}

-
-{{include file="field_password.tpl" field=$password1}} -{{include file="field_password.tpl" field=$password2}} -{{include file="field_password.tpl" field=$password3}} +

{{$h_pass}}

+
+ {{include file="field_password.tpl" field=$password1}} + {{include file="field_password.tpl" field=$password2}} + {{include file="field_password.tpl" field=$password3}} -{{if $oid_enable}} -{{include file="field_input.tpl" field=$openid}} -{{/if}} + {{if $oid_enable}} + {{include file="field_input.tpl" field=$openid}} + {{/if}} -
- -
-
+
+ +
+
-

{{$h_basic}}

-
+

{{$h_basic}}

+
-{{include file="field_input.tpl" field=$username}} -{{include file="field_input.tpl" field=$email}} -{{include file="field_password.tpl" field=$password4}} -{{include file="field_custom.tpl" field=$timezone}} -{{include file="field_select.tpl" field=$language}} -{{include file="field_input.tpl" field=$defloc}} -{{include file="field_checkbox.tpl" field=$allowloc}} + {{include file="field_input.tpl" field=$username}} + {{include file="field_input.tpl" field=$email}} + {{include file="field_password.tpl" field=$password4}} + {{include file="field_custom.tpl" field=$timezone}} + {{include file="field_select.tpl" field=$language}} + {{include file="field_input.tpl" field=$defloc}} + {{include file="field_checkbox.tpl" field=$allowloc}} -
- -
-
+
+ +
+
+

{{$h_prv}}

+
-

{{$h_prv}}

-
+ - + {{include file="field_input.tpl" field=$maxreq}} -{{include file="field_input.tpl" field=$maxreq}} + {{$profile_in_dir nofilter}} -{{$profile_in_dir nofilter}} + {{include file="field_checkbox.tpl" field=$profile_in_net_dir}} + {{include file="field_checkbox.tpl" field=$hide_friends}} + {{include file="field_checkbox.tpl" field=$hide_wall}} + {{include file="field_checkbox.tpl" field=$unlisted}} + {{include file="field_checkbox.tpl" field=$accessiblephotos}} + {{include file="field_checkbox.tpl" field=$blockwall}} + {{include file="field_checkbox.tpl" field=$blocktags}} + {{include file="field_checkbox.tpl" field=$unkmail}} + {{include file="field_input.tpl" field=$cntunkmail}} -{{$profile_in_net_dir nofilter}} + {{$group_select nofilter}} -{{$hide_friends nofilter}} +

{{$permissions}}

-{{$hide_wall nofilter}} + {{$aclselect nofilter}} +
+ +
+
-{{$unlisted nofilter}} +

{{$expire.label}}

+
+
+ {{include file="field_input.tpl" field=$expire.days}} + {{include file="field_checkbox.tpl" field=$expire.items}} + {{include file="field_checkbox.tpl" field=$expire.notes}} + {{include file="field_checkbox.tpl" field=$expire.starred}} + {{include file="field_checkbox.tpl" field=$expire.network_only}} -{{$accessiblephotos nofilter}} +
+ +
+
+
-{{$blockwall nofilter}} +

{{$h_not}}

+
+
-{{$blocktags nofilter}} +
{{$lbl_not}}
-{{$unkmail nofilter}} +
+ {{include file="field_intcheckbox.tpl" field=$notify1}} + {{include file="field_intcheckbox.tpl" field=$notify2}} + {{include file="field_intcheckbox.tpl" field=$notify3}} + {{include file="field_intcheckbox.tpl" field=$notify4}} + {{include file="field_intcheckbox.tpl" field=$notify5}} + {{include file="field_intcheckbox.tpl" field=$notify6}} + {{include file="field_intcheckbox.tpl" field=$notify7}} + {{include file="field_intcheckbox.tpl" field=$notify8}} +
-{{include file="field_input.tpl" field=$cntunkmail}} + {{include file="field_checkbox.tpl" field=$email_textonly}} + {{include file="field_checkbox.tpl" field=$detailed_notif}} -{{$group_select nofilter}} + {{include file="field_checkbox.tpl" field=$desktop_notifications}} + -

{{$expire.label}}

-
-
-{{include file="field_input.tpl" field=$expire.days}} -{{include file="field_checkbox.tpl" field=$expire.items}} -{{include file="field_checkbox.tpl" field=$expire.notes}} -{{include file="field_checkbox.tpl" field=$expire.starred}} -{{include file="field_checkbox.tpl" field=$expire.network_only}} +
-
- -
-
-
+
+ +
+
-

{{$h_not}}

-
-
+

{{$h_advn}}

+
+
{{$h_descadvn}}
-
{{$lbl_not}}
+ {{$pagetype nofilter}} -
-{{include file="field_intcheckbox.tpl" field=$notify1}} -{{include file="field_intcheckbox.tpl" field=$notify2}} -{{include file="field_intcheckbox.tpl" field=$notify3}} -{{include file="field_intcheckbox.tpl" field=$notify4}} -{{include file="field_intcheckbox.tpl" field=$notify5}} -{{include file="field_intcheckbox.tpl" field=$notify6}} -{{include file="field_intcheckbox.tpl" field=$notify7}} -{{include file="field_intcheckbox.tpl" field=$notify8}} -
+
+ +
+
-{{include file="field_checkbox.tpl" field=$email_textonly}} -{{include file="field_checkbox.tpl" field=$detailed_notif}} +

{{$importcontact}}

+
+ +
{{$importcontact_text}}
+ -{{include file="field_checkbox.tpl" field=$desktop_notifications}} - - -
- -
- -
-
- -

{{$h_advn}}

-
-
{{$h_descadvn}}
- -{{$pagetype nofilter}} - -
- -
-
- -

{{$importcontact}}

-
- -
{{$importcontact_text}}
- - -
- -
-
- -

{{$relocate}}

-
-
{{$relocate_text}}
- -
- -
-
+
+ +
+
diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index 5ace932ea..d0a4c39e4 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -2904,6 +2904,12 @@ details.profile-jot-net[open] summary:before { font-size: 18px; } +.section-subtitle-wrapper > h2 { + font-size: 18px; + margin-top: 10px; + margin-bottom: 10px; +} + .fakelink > h3:before { padding-right: 10px; } diff --git a/view/theme/frio/templates/settings/settings.tpl b/view/theme/frio/templates/settings/settings.tpl index 40c1d85dd..626d3b4d0 100644 --- a/view/theme/frio/templates/settings/settings.tpl +++ b/view/theme/frio/templates/settings/settings.tpl @@ -1,54 +1,50 @@
- {{* include the title template for the settings title *}} - {{include file="section_title.tpl" title=$ptitle }} +

{{$ptitle}}

{{$nickname_block nofilter}} - + {{* We organize the settings in collapsable panel-groups *}}
{{* The password setting section *}}
-
-
+
{{include file="field_password.tpl" field=$password1}} {{include file="field_password.tpl" field=$password2}} {{include file="field_password.tpl" field=$password3}} - {{if $oid_enable}} + {{if $oid_enable}} {{include file="field_input.tpl" field=$openid}} {{include file="field_checkbox.tpl" field=$delete_openid}} - {{/if}} - -
- -
-
+ {{/if}} +
+
{{* The basic setting section *}}
-
-
- +
{{include file="field_input.tpl" field=$username}} {{include file="field_input.tpl" field=$email}} {{include file="field_password.tpl" field=$password4}} @@ -56,26 +52,24 @@ {{include file="field_select.tpl" field=$language}} {{include file="field_input.tpl" field=$defloc}} {{include file="field_checkbox.tpl" field=$allowloc}} - -
- -
-
+
+
{{* The privacity setting section *}}
-
-
+
@@ -83,212 +77,183 @@ {{$profile_in_dir nofilter}} - {{$profile_in_net_dir nofilter}} - - {{$hide_friends nofilter}} - - {{$hide_wall nofilter}} - - {{$unlisted nofilter}} - - {{$accessiblephotos nofilter}} - - {{$blockwall nofilter}} - - {{$blocktags nofilter}} - - {{$unkmail nofilter}} - + {{include file="field_checkbox.tpl" field=$profile_in_net_dir}} + {{include file="field_checkbox.tpl" field=$hide_friends}} + {{include file="field_checkbox.tpl" field=$hide_wall}} + {{include file="field_checkbox.tpl" field=$unlisted}} + {{include file="field_checkbox.tpl" field=$accessiblephotos}} + {{include file="field_checkbox.tpl" field=$blockwall}} + {{include file="field_checkbox.tpl" field=$blocktags}} + {{include file="field_checkbox.tpl" field=$unkmail}} {{include file="field_input.tpl" field=$cntunkmail}} {{$group_select nofilter}} -

{{$permissions}}

+

{{$permissions}}

{{$aclselect nofilter}} - -
- -
-
- +
+
-
-
- +
{{include file="field_input.tpl" field=$expire.days}} {{include file="field_checkbox.tpl" field=$expire.items}} {{include file="field_checkbox.tpl" field=$expire.notes}} {{include file="field_checkbox.tpl" field=$expire.starred}} {{include file="field_checkbox.tpl" field=$expire.network_only}} - -
- -
-
+
+
{{* The notification setting section *}}
-
-
-
+
-

{{$lbl_not}}

+
{{$lbl_not}}
-
- {{include file="field_intcheckbox.tpl" field=$notify1}} - {{include file="field_intcheckbox.tpl" field=$notify2}} - {{include file="field_intcheckbox.tpl" field=$notify3}} - {{include file="field_intcheckbox.tpl" field=$notify4}} - {{include file="field_intcheckbox.tpl" field=$notify5}} - {{include file="field_intcheckbox.tpl" field=$notify6}} - {{include file="field_intcheckbox.tpl" field=$notify7}} - {{include file="field_intcheckbox.tpl" field=$notify8}} -
- - {{include file="field_checkbox.tpl" field=$email_textonly}} - {{include file="field_checkbox.tpl" field=$detailed_notif}} - - {{* commented out because it was commented out in the original template -
- - {{$desktop_notifications_note}} -
- *}} - - {{include file="field_checkbox.tpl" field=$desktop_notifications}} - +
+ {{include file="field_intcheckbox.tpl" field=$notify1}} + {{include file="field_intcheckbox.tpl" field=$notify2}} + {{include file="field_intcheckbox.tpl" field=$notify3}} + {{include file="field_intcheckbox.tpl" field=$notify4}} + {{include file="field_intcheckbox.tpl" field=$notify5}} + {{include file="field_intcheckbox.tpl" field=$notify6}} + {{include file="field_intcheckbox.tpl" field=$notify7}} + {{include file="field_intcheckbox.tpl" field=$notify8}}
-
- + {{include file="field_checkbox.tpl" field=$email_textonly}} + {{include file="field_checkbox.tpl" field=$detailed_notif}} + + {{* commented out because it was commented out in the original template +
+ + {{$desktop_notifications_note}}
-
+ *}} + + {{include file="field_checkbox.tpl" field=$desktop_notifications}} + +
+
{{* The additional account setting section *}}
-
-
- +
{{$h_descadvn}}
{{$pagetype nofilter}} - -
- -
-
+
+
{{* Import contacts CSV *}}
-
-
- +
{{$importcontact_text}}
- -
-
- -
-
+
+
{{* The relocate setting section *}}
-
-
- +
{{$relocate_text}}
- -
-
- -
-
+
+
From fd8957260693e5ea9071aa6d1773db9f7c5b9f61 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 1 Apr 2020 17:22:46 -0400 Subject: [PATCH 008/544] Refactor admin site settings templates - Fix header hierarchy in admin/site.tpl - Fix panel display in frio/templates/admin/site.tpl --- src/Module/Admin/Site.php | 2 +- view/templates/admin/site.tpl | 242 ++++++++--------- view/theme/frio/templates/admin/site.tpl | 329 ++++++++++++----------- 3 files changed, 291 insertions(+), 282 deletions(-) diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index 501edaf4d..cf3fee31b 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -613,7 +613,7 @@ class Site extends BaseAdmin '$worker_title' => DI::l10n()->t('Worker'), '$relay_title' => DI::l10n()->t('Message Relay'), '$relocate' => DI::l10n()->t('Relocate Instance'), - '$relocate_warning' => DI::l10n()->t('Warning! Advanced function. Could make this server unreachable.'), + '$relocate_warning' => DI::l10n()->t('Warning! Advanced function. Could make this server unreachable.'), '$baseurl' => DI::baseUrl()->get(true), // name, label, value, help string, extra data... diff --git a/view/templates/admin/site.tpl b/view/templates/admin/site.tpl index b6d0c5930..cb948aabe 100644 --- a/view/templates/admin/site.tpl +++ b/view/templates/admin/site.tpl @@ -1,6 +1,6 @@ -
+

{{$title}} - {{$page}}

- - - -
+
+ + +
-
- {{include file="field_input.tpl" field=$sitename}} - {{include file="field_input.tpl" field=$sender_email}} - {{include file="field_textarea.tpl" field=$banner}} - {{include file="field_input.tpl" field=$shortcut_icon}} - {{include file="field_input.tpl" field=$touch_icon}} - {{include file="field_textarea.tpl" field=$additional_info}} - {{include file="field_select.tpl" field=$language}} - {{include file="field_select.tpl" field=$theme}} - {{include file="field_select.tpl" field=$theme_mobile}} - {{include file="field_select.tpl" field=$ssl_policy}} - {{if $ssl_policy.2 == 1}}{{include file="field_checkbox.tpl" field=$force_ssl}}{{/if}} - {{include file="field_checkbox.tpl" field=$hide_help}} - {{include file="field_select.tpl" field=$singleuser}} +
+ {{include file="field_input.tpl" field=$sitename}} + {{include file="field_input.tpl" field=$sender_email}} + {{include file="field_textarea.tpl" field=$banner}} + {{include file="field_input.tpl" field=$shortcut_icon}} + {{include file="field_input.tpl" field=$touch_icon}} + {{include file="field_textarea.tpl" field=$additional_info}} + {{include file="field_select.tpl" field=$language}} + {{include file="field_select.tpl" field=$theme}} + {{include file="field_select.tpl" field=$theme_mobile}} + {{include file="field_select.tpl" field=$ssl_policy}} + {{if $ssl_policy.2 == 1}}{{include file="field_checkbox.tpl" field=$force_ssl}}{{/if}} + {{include file="field_checkbox.tpl" field=$hide_help}} + {{include file="field_select.tpl" field=$singleuser}} +
@@ -63,21 +64,22 @@ * Registration */ -->
-
- - {{include file="field_input.tpl" field=$register_text}} - {{include file="field_select.tpl" field=$register_policy}} - {{include file="field_input.tpl" field=$daily_registrations}} - {{include file="field_checkbox.tpl" field=$no_multi_reg}} - {{include file="field_checkbox.tpl" field=$no_openid}} - {{include file="field_checkbox.tpl" field=$no_regfullname}} +
+ {{include file="field_input.tpl" field=$register_text}} + {{include file="field_select.tpl" field=$register_policy}} + {{include file="field_input.tpl" field=$daily_registrations}} + {{include file="field_checkbox.tpl" field=$no_multi_reg}} + {{include file="field_checkbox.tpl" field=$no_openid}} + {{include file="field_checkbox.tpl" field=$no_regfullname}} +
@@ -91,22 +93,24 @@ * File upload */ -->
-
- {{include file="field_select.tpl" field=$storagebackend}} - {{foreach from=$storageform item=$field}} - {{include file=$field.field field=$field}} - {{/foreach}} -
- {{include file="field_input.tpl" field=$maximagesize}} - {{include file="field_input.tpl" field=$maximagelength}} - {{include file="field_input.tpl" field=$jpegimagequality}} +
+ {{include file="field_select.tpl" field=$storagebackend}} + {{foreach from=$storageform item=$field}} + {{include file=$field.field field=$field}} + {{/foreach}} +
+ {{include file="field_input.tpl" field=$maximagesize}} + {{include file="field_input.tpl" field=$maximagelength}} + {{include file="field_input.tpl" field=$jpegimagequality}} +
@@ -119,46 +123,47 @@ * Corporate */ -->
-
- {{include file="field_input.tpl" field=$allowed_sites}} - {{include file="field_input.tpl" field=$allowed_email}} - {{include file="field_input.tpl" field=$forbidden_nicknames}} - {{include file="field_checkbox.tpl" field=$no_oembed_rich_content}} - {{include file="field_input.tpl" field=$allowed_oembed}} - {{include file="field_checkbox.tpl" field=$block_public}} - {{include file="field_checkbox.tpl" field=$force_publish}} - {{include file="field_select.tpl" field=$community_page_style}} - {{include file="field_input.tpl" field=$max_author_posts_community_page}} +
+ {{include file="field_input.tpl" field=$allowed_sites}} + {{include file="field_input.tpl" field=$allowed_email}} + {{include file="field_input.tpl" field=$forbidden_nicknames}} + {{include file="field_checkbox.tpl" field=$no_oembed_rich_content}} + {{include file="field_input.tpl" field=$allowed_oembed}} + {{include file="field_checkbox.tpl" field=$block_public}} + {{include file="field_checkbox.tpl" field=$force_publish}} + {{include file="field_select.tpl" field=$community_page_style}} + {{include file="field_input.tpl" field=$max_author_posts_community_page}} - {{include file="field_checkbox.tpl" field=$ostatus_disabled}} + {{include file="field_checkbox.tpl" field=$ostatus_disabled}} - {{if $diaspora_able}} - {{include file="field_checkbox.tpl" field=$diaspora_enabled}} - {{else}} -
- - {{$diaspora_not_able}} + {{if $diaspora_able}} + {{include file="field_checkbox.tpl" field=$diaspora_enabled}} + {{else}} +
+ + {{$diaspora_not_able}} +
+ {{/if}} + {{include file="field_checkbox.tpl" field=$dfrn_only}} + {{include file="field_input.tpl" field=$global_directory}} +

+ +

+ {{include file="field_checkbox.tpl" field=$newuser_private}} + {{include file="field_checkbox.tpl" field=$enotify_no_content}} + {{include file="field_checkbox.tpl" field=$private_addons}} + {{include file="field_checkbox.tpl" field=$disable_embedded}} + {{include file="field_checkbox.tpl" field=$allow_users_remote_self}} + {{include file="field_checkbox.tpl" field=$explicit_content}}
- {{/if}} - {{include file="field_checkbox.tpl" field=$dfrn_only}} - {{include file="field_input.tpl" field=$global_directory}} - - {{include file="field_checkbox.tpl" field=$newuser_private}} - {{include file="field_checkbox.tpl" field=$enotify_no_content}} - {{include file="field_checkbox.tpl" field=$private_addons}} - {{include file="field_checkbox.tpl" field=$disable_embedded}} - {{include file="field_checkbox.tpl" field=$allow_users_remote_self}} - {{include file="field_checkbox.tpl" field=$explicit_content}} - @@ -170,28 +175,29 @@ * Corporate */ -->
-
- - {{include file="field_select.tpl" field=$rino}} - {{include file="field_checkbox.tpl" field=$verifyssl}} - {{include file="field_input.tpl" field=$proxy}} - {{include file="field_input.tpl" field=$proxyuser}} - {{include file="field_input.tpl" field=$timeout}} - {{include file="field_input.tpl" field=$maxloadavg_frontend}} - {{include file="field_input.tpl" field=$optimize_max_tablesize}} - {{include file="field_input.tpl" field=$optimize_fragmentation}} - {{include file="field_input.tpl" field=$abandon_days}} - {{include file="field_input.tpl" field=$temppath}} - {{include file="field_checkbox.tpl" field=$suppress_tags}} - {{include file="field_checkbox.tpl" field=$nodeinfo}} - {{include file="field_select.tpl" field=$check_new_version_url}} +
+ {{include file="field_select.tpl" field=$rino}} + {{include file="field_checkbox.tpl" field=$verifyssl}} + {{include file="field_input.tpl" field=$proxy}} + {{include file="field_input.tpl" field=$proxyuser}} + {{include file="field_input.tpl" field=$timeout}} + {{include file="field_input.tpl" field=$maxloadavg_frontend}} + {{include file="field_input.tpl" field=$optimize_max_tablesize}} + {{include file="field_input.tpl" field=$optimize_fragmentation}} + {{include file="field_input.tpl" field=$abandon_days}} + {{include file="field_input.tpl" field=$temppath}} + {{include file="field_checkbox.tpl" field=$suppress_tags}} + {{include file="field_checkbox.tpl" field=$nodeinfo}} + {{include file="field_select.tpl" field=$check_new_version_url}} +
@@ -203,21 +209,22 @@ * Contact Directory */ -->
-
- - {{include file="field_checkbox.tpl" field=$poco_completion}} - {{include file="field_select.tpl" field=$gcontact_discovery}} - {{include file="field_input.tpl" field=$poco_requery_days}} - {{include file="field_select.tpl" field=$poco_discovery}} - {{include file="field_select.tpl" field=$poco_discovery_since}} - {{include file="field_checkbox.tpl" field=$poco_local_search}} +
+ {{include file="field_checkbox.tpl" field=$poco_completion}} + {{include file="field_select.tpl" field=$gcontact_discovery}} + {{include file="field_input.tpl" field=$poco_requery_days}} + {{include file="field_select.tpl" field=$poco_discovery}} + {{include file="field_select.tpl" field=$poco_discovery_since}} + {{include file="field_checkbox.tpl" field=$poco_local_search}} +
@@ -229,24 +236,25 @@ * Performance */ -->
-
- - {{include file="field_checkbox.tpl" field=$only_tag_search}} - {{include file="field_input.tpl" field=$itemcache}} - {{include file="field_input.tpl" field=$itemcache_duration}} - {{include file="field_input.tpl" field=$max_comments}} - {{include file="field_checkbox.tpl" field=$proxy_disabled}} - {{include file="field_checkbox.tpl" field=$dbclean}} - {{include file="field_input.tpl" field=$dbclean_expire_days}} - {{include file="field_input.tpl" field=$dbclean_unclaimed}} - {{include file="field_input.tpl" field=$dbclean_expire_conv}} +
+ {{include file="field_checkbox.tpl" field=$only_tag_search}} + {{include file="field_input.tpl" field=$itemcache}} + {{include file="field_input.tpl" field=$itemcache_duration}} + {{include file="field_input.tpl" field=$max_comments}} + {{include file="field_checkbox.tpl" field=$proxy_disabled}} + {{include file="field_checkbox.tpl" field=$dbclean}} + {{include file="field_input.tpl" field=$dbclean_expire_days}} + {{include file="field_input.tpl" field=$dbclean_unclaimed}} + {{include file="field_input.tpl" field=$dbclean_expire_conv}} +
@@ -258,21 +266,22 @@ * Worker */ -->
-
- - {{include file="field_input.tpl" field=$maxloadavg}} - {{include file="field_input.tpl" field=$min_memory}} - {{include file="field_input.tpl" field=$worker_queues}} - {{include file="field_checkbox.tpl" field=$worker_dont_fork}} - {{include file="field_checkbox.tpl" field=$worker_fastlane}} - {{include file="field_checkbox.tpl" field=$worker_frontend}} +
+ {{include file="field_input.tpl" field=$maxloadavg}} + {{include file="field_input.tpl" field=$min_memory}} + {{include file="field_input.tpl" field=$worker_queues}} + {{include file="field_checkbox.tpl" field=$worker_dont_fork}} + {{include file="field_checkbox.tpl" field=$worker_fastlane}} + {{include file="field_checkbox.tpl" field=$worker_frontend}} +
@@ -284,55 +293,55 @@ * Relay */ -->
-
- - {{include file="field_checkbox.tpl" field=$relay_subscribe}} - {{include file="field_input.tpl" field=$relay_server}} - {{include file="field_checkbox.tpl" field=$relay_directly}} - {{include file="field_select.tpl" field=$relay_scope}} - {{include file="field_input.tpl" field=$relay_server_tags}} - {{include file="field_checkbox.tpl" field=$relay_user_tags}} +
+ {{include file="field_checkbox.tpl" field=$relay_subscribe}} + {{include file="field_input.tpl" field=$relay_server}} + {{include file="field_checkbox.tpl" field=$relay_directly}} + {{include file="field_select.tpl" field=$relay_scope}} + {{include file="field_input.tpl" field=$relay_server_tags}} + {{include file="field_checkbox.tpl" field=$relay_user_tags}} +
- + - -
- -
-
- × - {{$relocate_warning}} + +
+ + + + - {{* separate form for relocate... *}} - - - {{include file="field_input.tpl" field=$relocate_url}} - - +
+
+
+ {{$relocate_warning}} +
+ {{include file="field_input.tpl" field=$relocate_url}} +
- -
+
+
From 6bb210ff7a016674d9428af959207451214170d8 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 1 Apr 2020 18:27:14 -0400 Subject: [PATCH 009/544] Refactor features pages - Create frio template for admin features page - Fix header hierarchy --- src/Module/Admin/Features.php | 18 +++++----- view/templates/admin/features.tpl | 7 ++-- view/templates/settings/features.tpl | 28 +++++++-------- view/theme/frio/css/style.css | 2 +- view/theme/frio/templates/admin/features.tpl | 34 +++++++++++++++++++ .../frio/templates/settings/features.tpl | 23 +++++-------- 6 files changed, 68 insertions(+), 44 deletions(-) create mode 100644 view/theme/frio/templates/admin/features.tpl diff --git a/src/Module/Admin/Features.php b/src/Module/Admin/Features.php index 46c0a1384..a97bc0e7b 100644 --- a/src/Module/Admin/Features.php +++ b/src/Module/Admin/Features.php @@ -64,15 +64,14 @@ class Features extends BaseAdmin { parent::content($parameters); - $arr = []; - $features = Feature::get(false); + $features = []; - foreach ($features as $fname => $fdata) { - $arr[$fname] = []; - $arr[$fname][0] = $fdata[0]; + foreach (Feature::get(false) as $fname => $fdata) { + $features[$fname] = []; + $features[$fname][0] = $fdata[0]; foreach (array_slice($fdata, 1) as $f) { $set = DI::config()->get('feature', $f[0], $f[3]); - $arr[$fname][1][] = [ + $features[$fname][1][] = [ ['feature_' . $f[0], $f[1], $set, $f[2]], ['featurelock_' . $f[0], DI::l10n()->t('Lock feature %s', $f[1]), $f[4], ''] ]; @@ -82,9 +81,10 @@ class Features extends BaseAdmin $tpl = Renderer::getMarkupTemplate('admin/features.tpl'); $o = Renderer::replaceMacros($tpl, [ '$form_security_token' => parent::getFormSecurityToken("admin_manage_features"), - '$title' => DI::l10n()->t('Manage Additional Features'), - '$features' => $arr, - '$submit' => DI::l10n()->t('Save Settings'), + '$baseurl' => DI::baseUrl()->get(true), + '$title' => DI::l10n()->t('Manage Additional Features'), + '$features' => $features, + '$submit' => DI::l10n()->t('Save Settings'), ]); return $o; diff --git a/view/templates/admin/features.tpl b/view/templates/admin/features.tpl index b1c8bad8f..46a7abea2 100644 --- a/view/templates/admin/features.tpl +++ b/view/templates/admin/features.tpl @@ -1,12 +1,11 @@ -

{{$title}}

-
- + + {{foreach $features as $g => $f}} -

{{$f.0}}

+

{{$f.0}}

{{foreach $f.1 as $fcat}} diff --git a/view/templates/settings/features.tpl b/view/templates/settings/features.tpl index c69670b48..e96daea2b 100644 --- a/view/templates/settings/features.tpl +++ b/view/templates/settings/features.tpl @@ -1,22 +1,18 @@ -

{{$title}}

- - + -{{foreach $features as $f}} -

{{$f.0}}

-
- -{{foreach $f.1 as $fcat}} - {{include file="field_checkbox.tpl" field=$fcat}} -{{/foreach}} -
- -
-
-{{/foreach}} + {{foreach $features as $f}} +

{{$f.0}}

+
+ {{foreach $f.1 as $fcat}} + {{include file="field_checkbox.tpl" field=$fcat}} + {{/foreach}} +
+ +
+
+ {{/foreach}} - diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index d0a4c39e4..f5d9a1971 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -2875,7 +2875,7 @@ details.profile-jot-net[open] summary:before { /* Emulates Bootstrap display */ .settings-block { - margin: 0 -15px 5px; + margin: 0 0 5px; color: #333; background-color: rgba(255,255,255,0.95); border-radius: 4px; diff --git a/view/theme/frio/templates/admin/features.tpl b/view/theme/frio/templates/admin/features.tpl new file mode 100644 index 000000000..13db0a300 --- /dev/null +++ b/view/theme/frio/templates/admin/features.tpl @@ -0,0 +1,34 @@ +
+

{{$title}}

+
+ + {{* We organize the settings in collapsable panel-groups *}} +
+ {{foreach $features as $g => $f}} +
+ +
+
+ {{foreach $f.1 as $fcat}} +
+ {{include file="field_checkbox.tpl" field=$fcat.0}} + {{include file="field_checkbox.tpl" field=$fcat.1}} +
+ {{/foreach}} +
+ +
+
+ {{/foreach}} +
+ +
+
diff --git a/view/theme/frio/templates/settings/features.tpl b/view/theme/frio/templates/settings/features.tpl index 1db5fd966..61fecf57f 100644 --- a/view/theme/frio/templates/settings/features.tpl +++ b/view/theme/frio/templates/settings/features.tpl @@ -1,31 +1,26 @@
- {{* include the title template for the settings title *}} - {{include file="section_title.tpl" title=$title }} - - +

{{$title}}

- + {{* We organize the settings in collapsable panel-groups *}}
{{foreach $features as $g => $f}}
-
-
+
{{foreach $f.1 as $fcat}} {{include file="field_checkbox.tpl" field=$fcat}} {{/foreach}} - -
- -
-
+
+
From b480e4eaa97f8708957dbe0eec771bda7a2a376d Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 1 Apr 2020 18:39:40 -0400 Subject: [PATCH 010/544] Refactor display page - Fix header hierarchy - Fix panel display --- view/templates/settings/display.tpl | 49 +++++++------ .../theme/frio/templates/settings/display.tpl | 71 ++++++++----------- 2 files changed, 54 insertions(+), 66 deletions(-) diff --git a/view/templates/settings/display.tpl b/view/templates/settings/display.tpl index a9f82c16b..15247d874 100644 --- a/view/templates/settings/display.tpl +++ b/view/templates/settings/display.tpl @@ -1,35 +1,34 @@ -

{{$ptitle}}

- - + + -{{include file="field_themeselect.tpl" field=$theme}} -{{include file="field_input.tpl" field=$itemspage_network}} + {{include file="field_themeselect.tpl" field=$theme}} + {{include file="field_input.tpl" field=$itemspage_network}} -{{* Show the mobile theme selection only if mobile themes are available *}} -{{if count($mobile_theme.4) > 1}} -{{include file="field_themeselect.tpl" field=$mobile_theme}} -{{/if}} + {{* Show the mobile theme selection only if mobile themes are available *}} + {{if count($mobile_theme.4) > 1}} + {{include file="field_themeselect.tpl" field=$mobile_theme}} + {{/if}} -{{include file="field_input.tpl" field=$itemspage_mobile_network}} -{{include file="field_input.tpl" field=$ajaxint}} -{{include file="field_checkbox.tpl" field=$no_auto_update}} -{{include file="field_checkbox.tpl" field=$nosmile}} -{{include file="field_checkbox.tpl" field=$infinite_scroll}} -{{include file="field_checkbox.tpl" field=$no_smart_threading}} -{{include file="field_checkbox.tpl" field=$hide_dislike}} + {{include file="field_input.tpl" field=$itemspage_mobile_network}} + {{include file="field_input.tpl" field=$ajaxint}} + {{include file="field_checkbox.tpl" field=$no_auto_update}} + {{include file="field_checkbox.tpl" field=$nosmile}} + {{include file="field_checkbox.tpl" field=$infinite_scroll}} + {{include file="field_checkbox.tpl" field=$no_smart_threading}} + {{include file="field_checkbox.tpl" field=$hide_dislike}} -

{{$calendar_title}}

-{{include file="field_select.tpl" field=$first_day_of_week}} +

{{$calendar_title}}

+ {{include file="field_select.tpl" field=$first_day_of_week}} -
- -
+
+ +
-{{if $theme_config}} -

{{$stitle}}

-{{$theme_config nofilter}} -{{/if}} + {{if $theme_config}} +

{{$stitle}}

+ {{$theme_config nofilter}} + {{/if}} diff --git a/view/theme/frio/templates/settings/display.tpl b/view/theme/frio/templates/settings/display.tpl index f67bb3f40..95dde620e 100644 --- a/view/theme/frio/templates/settings/display.tpl +++ b/view/theme/frio/templates/settings/display.tpl @@ -1,71 +1,65 @@ -
- {{* include the title template for the settings title *}} - {{include file="section_title.tpl" title=$ptitle }} - - +

{{$ptitle}}

- +
-
-
- +
{{include file="field_themeselect.tpl" field=$theme}} {{* Show the mobile theme selection only if mobile themes are available *}} {{if count($mobile_theme.4) > 1}} {{include file="field_themeselect.tpl" field=$mobile_theme}} {{/if}} - -
- -
-
- +
+
-
-
+
{{if $theme_config}} {{$theme_config nofilter}} {{/if}}
+
-
-
- +
{{include file="field_input.tpl" field=$itemspage_network}} {{include file="field_input.tpl" field=$itemspage_mobile_network}} {{include file="field_input.tpl" field=$ajaxint}} @@ -74,32 +68,27 @@ {{include file="field_checkbox.tpl" field=$infinite_scroll}} {{include file="field_checkbox.tpl" field=$no_smart_threading}} {{include file="field_checkbox.tpl" field=$hide_dislike}} - -
- -
-
+
+
-
-
- +
{{include file="field_select.tpl" field=$first_day_of_week}} - -
- -
-
+
+
From 91fb396ec17f540dff2dd76d003ee5da262edfaf Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 1 Apr 2020 19:14:37 -0400 Subject: [PATCH 011/544] Refactor profile edit page - Fix header hierarchy - [frio] Fix panel display --- view/templates/settings/profile/index.tpl | 2 +- .../frio/templates/settings/profile/index.tpl | 67 ++++++++----------- .../vier/templates/settings/profile/index.tpl | 8 +-- 3 files changed, 34 insertions(+), 43 deletions(-) diff --git a/view/templates/settings/profile/index.tpl b/view/templates/settings/profile/index.tpl index 8c89dc1ba..7188212c0 100644 --- a/view/templates/settings/profile/index.tpl +++ b/view/templates/settings/profile/index.tpl @@ -97,7 +97,7 @@
-

{{$lbl_custom_fields_section}}

+

{{$lbl_custom_fields_section}}

{{$custom_fields_description nofilter}}
{{foreach $custom_fields as $custom_field}} diff --git a/view/theme/frio/templates/settings/profile/index.tpl b/view/theme/frio/templates/settings/profile/index.tpl index 05a4bb215..21387437e 100644 --- a/view/theme/frio/templates/settings/profile/index.tpl +++ b/view/theme/frio/templates/settings/profile/index.tpl @@ -1,5 +1,5 @@
- {{include file="section_title.tpl" title=$banner}} +

{{$banner}}

{{* The actions dropdown which can performed to the current profile *}}