From 870f4773cc8b0d4ff0e6986eddce5687c4cc36de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Ra=C3=B1a?= Date: Wed, 12 Jan 2011 21:56:35 +0100 Subject: [PATCH] Feature #2497 integration of pediaphon audio services, and update changelog and credits --- documentation/changelog.html | 4 +- documentation/credits.html | 13 +- main/document/create_audio.php | 187 +++++++++++++++++++++++++-- main/lang/bulgarian/trad4all.inc.php | 1 + main/lang/english/document.inc.php | 11 +- main/lang/english/trad4all.inc.php | 1 + main/lang/spanish/document.inc.php | 11 +- 7 files changed, 208 insertions(+), 20 deletions(-) diff --git a/documentation/changelog.html b/documentation/changelog.html index d110664264..c02be10e60 100755 --- a/documentation/changelog.html +++ b/documentation/changelog.html @@ -34,7 +34,7 @@
  • An optional "Course (training) validation" feature has been implemented. When it is activated, teachers loose ability to create coursers. Teachers fill course requests instead. Then, after approval, the requested courses are created by the platform administrator. (Feature # 2099)
  • A new UI option "Fill with exemplary content" have been added to the forms about training/course creation. Now teachers and platform administrators are able to choose whether exemplary content should be put or not in the trainings/courses they are going to create. When a training/course is not created directly by a user, then the platform setting "Example material on training creation" is taken into account. (Feature # 539)
  • Added install/uninstall script possibilities for plugins (BT#1752)
  • -
  • Integrate svg-edit. Teachers, students (into his/her user folder) and groups can create, edit and import SVG vector graphics online and export to PNG (Feature #2044, #2101,)
  • +
  • New drawing tool. Integrate svg-edit. Teachers, students (into his/her user folder) and groups can create, edit and import SVG vector graphics online and export to PNG (Feature #2044, #2101,)
  • A new plugin for making ASCIIsvg-based mathematical graphics has been created for the online editor (enable it from administrator's section). For using it, browsers should support SVG-technology. See a demo, implemented on TinyMCE: http://www.imathas.com/editordemo/demo.html; for syntax and additional information see http://www1.chapman.edu/~jipsen/svg/asciisvg.html. This plugin uses the library file chamilo/main/inc/lib/asciimath/ASCIIMathML.js which has combined functionality ASCIIMathML + ASCIIsvg (Feature #2132)
  • Feature #2132: In the administrator's section "Administration > Configuration settings > Editor" some settings are to be used as follows:

    Debugging

    Online Authoring

    +

    HTML Editor

  • - +

    Drawing tool

    + +

    Voice generator

    + +

     

    Translations

    There are too much translators to list them all.
    Please see http://www.chamilo.com/DLTT/ to see a list of the translators. diff --git a/main/document/create_audio.php b/main/document/create_audio.php index b6398e323b..b4ec0ba30a 100644 --- a/main/document/create_audio.php +++ b/main/document/create_audio.php @@ -198,7 +198,7 @@ echo '
    '; echo '
     
     '.get_lang('GoogleAudio').' '.get_lang('GoogleAudio').''; echo '   '; echo ' '.get_lang('vozMe').' '.get_lang('vozMe').''; + echo '   '; + echo ''; Display :: display_footer(); -//Functions +//Functions. TODO:all at one /** - * This function save a post into a file mp3 + * This function save a post into a file mp3 from google services * * @param $filepath * @param $dir * @author Juan Carlos Raña Trabado * @version january 2011, chamilo 1.8.8 */ -function downloadMP3($filepath, $dir){ +function downloadMP3_google($filepath, $dir){ //security if(!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) { return; } - - $clean_title=trim(Security::remove_XSS($_POST['title'])); - $clean_text=trim(Security::remove_XSS($_POST['text'])); - $clean_lang=Security::remove_XSS($_POST['lang']); - - if (strlen($clean_title) < "1") { + + $clean_title=trim($_POST['title']); + $clean_text=trim($_POST['text']); + if(empty($clean_title) || empty($clean_text)){ return; } + $clean_title=Security::remove_XSS($clean_title); + $clean_title=Database::escape_string($clean_title); + $clean_text=Security::remove_XSS($clean_text); + $clean_lang=Security::remove_XSS($_POST['lang']); + $AudioFilename=$clean_title.'.mp3'; $documentPath = $filepath.$AudioFilename; @@ -334,4 +422,75 @@ function downloadMP3($filepath, $dir){ api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id); } } + +/** + * This function save a post into a file mp3 from pediaphone services + * + * @param $filepath + * @param $dir + * @author Juan Carlos Raña Trabado + * @version january 2011, chamilo 1.8.8 + */ +function downloadMP3_pediaphone($filepath, $dir){ + //security + if(!isset($_POST['lang']) && !isset($_POST['text']) && !isset($_POST['title']) && !isset($filepath) && !isset($dir)) { + return; + } + $clean_title=trim($_POST['title']); + $clean_text=trim($_POST['text']); + if(empty($clean_title) || empty($clean_text)){ + return; + } + $clean_title=Security::remove_XSS($clean_title); + $clean_title=Database::escape_string($clean_title); + $clean_text=Security::remove_XSS($clean_text); + $clean_lang=Security::remove_XSS($_POST['lang']); + $clean_voices=Security::remove_XSS($_POST['voices']); + $clean_speed=Security::remove_XSS($_POST['speed']); + + $AudioFilename=$clean_title.'.mp3'; + $documentPath = $filepath.$AudioFilename; + + //prev for a fine unicode, borrowed from main api TODO:clean + // Safe replacements for some non-letter characters (whitout blank spaces) + $search = array("\0", "\t", "\n", "\r", "\x0B", '/', "\\", '"', "'", '?', '*', '>', '<', '|', ':', '$', '(', ')', '^', '[', ']', '#', '+', '&', '%'); + $replace = array('', '_', '_', '_', '_', '-', '-', '-', '_', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-', '-'); + $filename=$clean_text; + // Encoding detection. + $encoding = api_detect_encoding($filename); + // Converting html-entities into encoded characters. + $filename = api_html_entity_decode($filename, ENT_QUOTES, $encoding); + // Transliteration to ASCII letters, they are not dangerous for filesystems. + $filename = api_transliterate($filename, 'x', $encoding); + // Replacing remaining dangerous non-letter characters. + $clean_text = str_replace($search, $replace, $filename); + + //adding the file + if (!file_exists($documentPath)){ + //add new file to disk + + if($clean_lang=='de'){ + $url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice.cgi'; + } + elseif($clean_lang=='en'){ + $url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_en.cgi'; + } + elseif($clean_lang=='es'){ + $url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_es.cgi'; + } + elseif($clean_lang=='fr'){ + $url_pediaphon='http://www.pediaphon.org/~bischoff/radiopedia/sprich_multivoice_fr.cgi'; + } + + file_put_contents($documentPath, file_get_contents($url_pediaphon."?stimme=".$clean_voice."&inputtext=".urlencode($clean_text)."&speed=".$clean_speed."&go=Sprich"));///speed + //add document to database + $current_session_id = api_get_session_id(); + $groupId=$_SESSION['_gid']; + $file_size = filesize($documentPath); + $relativeUrlPath=$dir; + $doc_id = add_document($_course, $relativeUrlPath.$AudioFilename, 'file', filesize($documentPath), $AudioFilename); + api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id); + } +} + ?> \ No newline at end of file diff --git a/main/lang/bulgarian/trad4all.inc.php b/main/lang/bulgarian/trad4all.inc.php index bc5dc15b49..5c3c65ade5 100644 --- a/main/lang/bulgarian/trad4all.inc.php +++ b/main/lang/bulgarian/trad4all.inc.php @@ -836,4 +836,5 @@ $ReadTermsAndConditions = "Прочетете Условията за ползв $IAcceptTermsAndConditions = "Прочетох и приемам Условията за ползване"; $YouHaveToAcceptTermsAndConditions = "Tрябва да приемете нашите Условия за ползване, за да продължите."; $FillWithExemplaryContent = "Да се добави примерно съдържание"; +$OpenInANewWindow = "Показване в отделен прозорец"; ?> \ No newline at end of file diff --git a/main/lang/english/document.inc.php b/main/lang/english/document.inc.php index b5acce3f16..9483ca305c 100644 --- a/main/lang/english/document.inc.php +++ b/main/lang/english/document.inc.php @@ -258,6 +258,15 @@ $Male = "Male"; $GoogleAudio = "Use Google audio services"; $vozMe = "Use vozMe audio services"; $HelpGoogleAudio = "Supports up to 100 characters, supporting a wide variety of languages. The files are generated and automatically saved into Chamilo directory where you currently are."; -$HelpvozMe = "Supports text of several thousand characters long, you can also select the type of voice, male or female. However, working with fewer languages, audio quality is inferior and you have to download the files manually to your computer in a new window."; +$HelpvozMe = "Supports text of several thousand characters, you can also select the type of voice, male or female. However, working with fewer languages, audio quality is lower and you have to download the files manually from a new window."; $SaveMP3 = "Save mp3"; +$Speed = "Speed"; +$GoFaster = "Go faster"; +$Fast = "Fast"; +$Normal = "Normal"; +$Slow = "Slow"; +$SlowDown = "Slow down"; +$Pediaphon = "Use Pediaphon audio services"; +$HelpPediaphon = "Supports text with several thousand characters, being able to select various types of male and female voice (depending on language). Audio files will be generated and automatically saved Chamilo directory in which you are."; +$FirstSelectALanguage = "First select a language"; ?> \ No newline at end of file diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index 46c219ef91..d8f1bf627a 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -979,4 +979,5 @@ $ChatFiles = "Conversation history in chat"; $Flash = "Flash"; $Video = "Video"; $Images = "Images"; +$OpenInANewWindow = "Open in a new window"; ?> \ No newline at end of file diff --git a/main/lang/spanish/document.inc.php b/main/lang/spanish/document.inc.php index 09756f459e..5d401c7724 100644 --- a/main/lang/spanish/document.inc.php +++ b/main/lang/spanish/document.inc.php @@ -258,6 +258,15 @@ $Male = "Masculina"; $GoogleAudio = "Usar los servicios de audio de Google"; $vozMe = "Usar los servicios de audio de vozMe"; $HelpGoogleAudio = "Admite un máximo de 100 caracteres, soportando una amplia variedad de idiomas. Los archivos se generarán y guardarán automáticamente en el directorio de Chamilo en el que Usted actualmente se encuentra."; -$HelpvozMe = "Admite textos de varios miles de caracteres de longitud, también podrá seleccionar el tipo de voz: masculina o femenina. Sin embargo, trabaja con menos idiomas, la calidad del audio es inferior y Usted tendrá que descargar los archivos manualmente a su ordenador desde una nueva ventana."; +$HelpvozMe = "Admite textos de varios miles de caracteres, también podrá seleccionar el tipo de voz: masculina o femenina. Sin embargo, trabaja con menos idiomas, la calidad del audio es inferior y Usted tendrá que descargar los archivos manualmente desde una nueva ventana."; $SaveMP3 = "Guardar mp3"; +$Speed = "Velocidad"; +$GoFaster = "Más rápida"; +$Fast = "Rápida"; +$Normal = "Normal"; +$Slow = "Lenta"; +$SlowDown = "Más lenta"; +$Pediaphon = "Usar los servicios de audio de Pediaphon"; +$HelpPediaphon = "Admite textos con varios miles de caracteres, pudiéndose seleccionar varios tipos de voz masculinas y femeninas (según el idioma). Los archivos de audio se generarán y guardarán automáticamente en el directorio de Chamilo en el que Usted actualmente se encuentra."; +$FirstSelectALanguage = "Primero seleccione un idioma"; ?> \ No newline at end of file