diff --git a/public/img/legacy/angel_smile.png b/public/img/legacy/angel_smile.png new file mode 100755 index 0000000000..559e5e71a3 Binary files /dev/null and b/public/img/legacy/angel_smile.png differ diff --git a/public/img/legacy/angry_smile.png b/public/img/legacy/angry_smile.png new file mode 100755 index 0000000000..c05d2be3a7 Binary files /dev/null and b/public/img/legacy/angry_smile.png differ diff --git a/public/img/legacy/broken_heart.png b/public/img/legacy/broken_heart.png new file mode 100755 index 0000000000..a711c0d8d8 Binary files /dev/null and b/public/img/legacy/broken_heart.png differ diff --git a/public/img/legacy/confused_smile.png b/public/img/legacy/confused_smile.png new file mode 100755 index 0000000000..e0b8e5c6f1 Binary files /dev/null and b/public/img/legacy/confused_smile.png differ diff --git a/public/img/legacy/cry_smile.png b/public/img/legacy/cry_smile.png new file mode 100755 index 0000000000..a1891a3428 Binary files /dev/null and b/public/img/legacy/cry_smile.png differ diff --git a/public/img/legacy/devil_smile.png b/public/img/legacy/devil_smile.png new file mode 100755 index 0000000000..53247a8835 Binary files /dev/null and b/public/img/legacy/devil_smile.png differ diff --git a/public/img/legacy/embarrassed_smile.png b/public/img/legacy/embarrassed_smile.png new file mode 100755 index 0000000000..34904b6667 Binary files /dev/null and b/public/img/legacy/embarrassed_smile.png differ diff --git a/public/img/legacy/envelope.png b/public/img/legacy/envelope.png new file mode 100755 index 0000000000..44398ad137 Binary files /dev/null and b/public/img/legacy/envelope.png differ diff --git a/public/img/legacy/heart.png b/public/img/legacy/heart.png new file mode 100755 index 0000000000..df409e62f5 Binary files /dev/null and b/public/img/legacy/heart.png differ diff --git a/public/img/legacy/kiss.png b/public/img/legacy/kiss.png new file mode 100755 index 0000000000..a4f2f36382 Binary files /dev/null and b/public/img/legacy/kiss.png differ diff --git a/public/img/legacy/lightbulb.png b/public/img/legacy/lightbulb.png new file mode 100755 index 0000000000..0c4a92400d Binary files /dev/null and b/public/img/legacy/lightbulb.png differ diff --git a/public/img/legacy/omg_smile.png b/public/img/legacy/omg_smile.png new file mode 100755 index 0000000000..abc4e2d0fd Binary files /dev/null and b/public/img/legacy/omg_smile.png differ diff --git a/public/img/legacy/regular_smile.png b/public/img/legacy/regular_smile.png new file mode 100755 index 0000000000..0f2649b78a Binary files /dev/null and b/public/img/legacy/regular_smile.png differ diff --git a/public/img/legacy/sad_smile.png b/public/img/legacy/sad_smile.png new file mode 100755 index 0000000000..f20f3bf3c0 Binary files /dev/null and b/public/img/legacy/sad_smile.png differ diff --git a/public/img/legacy/shades_smile.png b/public/img/legacy/shades_smile.png new file mode 100755 index 0000000000..fdaa28b786 Binary files /dev/null and b/public/img/legacy/shades_smile.png differ diff --git a/public/img/legacy/teeth_smile.png b/public/img/legacy/teeth_smile.png new file mode 100755 index 0000000000..5e63785e42 Binary files /dev/null and b/public/img/legacy/teeth_smile.png differ diff --git a/public/img/legacy/thumbs_down.png b/public/img/legacy/thumbs_down.png new file mode 100755 index 0000000000..1823481f2f Binary files /dev/null and b/public/img/legacy/thumbs_down.png differ diff --git a/public/img/legacy/thumbs_up.png b/public/img/legacy/thumbs_up.png new file mode 100755 index 0000000000..d4e8b22a3c Binary files /dev/null and b/public/img/legacy/thumbs_up.png differ diff --git a/public/img/legacy/tongue_smile.png b/public/img/legacy/tongue_smile.png new file mode 100755 index 0000000000..56553fbe11 Binary files /dev/null and b/public/img/legacy/tongue_smile.png differ diff --git a/public/img/legacy/whatchutalkingabout_smile.png b/public/img/legacy/whatchutalkingabout_smile.png new file mode 100755 index 0000000000..f9714d1b3b Binary files /dev/null and b/public/img/legacy/whatchutalkingabout_smile.png differ diff --git a/public/img/legacy/wink_smile.png b/public/img/legacy/wink_smile.png new file mode 100755 index 0000000000..7c99c3fc54 Binary files /dev/null and b/public/img/legacy/wink_smile.png differ diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20240924120200.php b/src/CoreBundle/Migrations/Schema/V200/Version20240924120200.php new file mode 100644 index 0000000000..1fadf7657a --- /dev/null +++ b/src/CoreBundle/Migrations/Schema/V200/Version20240924120200.php @@ -0,0 +1,80 @@ +entityManager->clear(); + + // Define the content fields to update + $updateConfigurations = [ + ['table' => 'c_tool_intro', 'field' => 'intro_text'], + ['table' => 'c_course_description', 'field' => 'content'], + ['table' => 'c_quiz', 'fields' => ['description', 'text_when_finished']], + ['table' => 'c_quiz_question', 'fields' => ['description', 'question']], + ['table' => 'c_quiz_answer', 'fields' => ['answer', 'comment']], + ['table' => 'c_student_publication', 'field' => 'description'], + ['table' => 'c_student_publication_comment', 'field' => 'comment'], + ['table' => 'c_forum_post', 'field' => 'post_text'], + ['table' => 'c_glossary', 'field' => 'description'], + ['table' => 'c_survey', 'fields' => ['title', 'subtitle']], + ['table' => 'c_survey_question', 'fields' => ['survey_question', 'survey_question_comment']], + ['table' => 'c_survey_question_option', 'field' => 'option_text'], + ]; + + foreach ($updateConfigurations as $config) { + $this->updateContent($config); + } + } + + private function updateContent(array $config): void + { + $fields = isset($config['field']) ? [$config['field']] : $config['fields'] ?? []; + + foreach ($fields as $field) { + $sql = "SELECT iid, {$field} FROM {$config['table']}"; + $result = $this->connection->executeQuery($sql); + $items = $result->fetchAllAssociative(); + + foreach ($items as $item) { + $originalText = $item[$field]; + if (!empty($originalText)) { + $updatedText = $this->replaceGifWithPng($originalText); + if ($originalText !== $updatedText) { + $updateSql = "UPDATE {$config['table']} SET {$field} = :newText WHERE iid = :id"; + $this->connection->executeQuery($updateSql, ['newText' => $updatedText, 'id' => $item['iid']]); + } + } + } + } + } + + private function replaceGifWithPng(string $content): string + { + $pattern = '/(src=["\'])(https?:\/\/[^\/]+\/)?(\/?web\/assets\/ckeditor\/plugins\/smiley\/images\/([a-zA-Z0-9_\-]+))\.(gif|png)(["\'])/i'; + + $content = preg_replace_callback($pattern, function ($matches) { + $prefix = $matches[1]; + $filename = $matches[4]; + $extension = 'png'; + + return "{$prefix}/img/legacy/{$filename}.{$extension}{$matches[6]}"; + }, $content); + + return $content; + } +}