From: vincent@cubedesigners.com Date: Wed, 24 Aug 2022 16:22:37 +0000 (+0000) Subject: wip #5415 @0:15 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3b6c11795a8013364369e5e40d938a6d3e00b8aa;p=cubeextranet.git wip #5415 @0:15 --- diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 8297bab99..2c022640e 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -1471,91 +1471,6 @@ class commonTools header('Location: https://toolbox.fluidbook.com/quiz/'); } - /** - * @param $tmp_name - * @param $name - * @return false|string - * @throws Exception - */ - protected static function _updateOneQuiz($tmp_name, $name) - { - $tidySettings = ['input-xml' => 1, 'indent' => 1, 'wrap' => 0]; - - $template = ROOT . '/quiz/template.zip'; - $temp = ROOT . '/quiz/quiz-' . md5(random_int(0, 10000000)) . '.zip'; - copy($template, $temp); - - $assets = ['assets/logo.png', 'assets/banner.jpg']; - - $uploaded = new ZipArchive(); - $uploaded->open($tmp_name); - - $template = new ZipArchive(); - $template->open($temp); - - $data = simplexml_load_string($uploaded->getFromName('data.xml'), "SimpleXMLElement", LIBXML_NOERROR | LIBXML_ERR_NONE); - $quizTitle = (string)$data->xpath('/quiz/title')[0]; - - // Replace assets - foreach ($assets as $asset) { - $template->addFromString($asset, $uploaded->getFromName($asset)); - } - // *** Replace XML *** - // First, merge both xml - $oMX = new MergeXML(); - $oMX->AddSource($template->getFromName('data.xml')); - $oMX->AddSource($uploaded->getFromName('data.xml')); - $template->deleteName('data.xml'); - // Save data.xml in dest zip - $template->addFromString('data.xml', tidy_repair_string($oMX->Get(1), $tidySettings)); - // *** IMS Manifest *** - $imsmanifest = file_get_contents(ROOT . '/quiz/imsmanifest.xml'); - $imsmanifest = str_replace('$title', $quizTitle, tidy_repair_string($imsmanifest, $tidySettings)); - $template->addFromString('imsmanifest.xml', $imsmanifest); - // *** Save zip *** - $template->close(); - - $res = file_get_contents($temp); - unlink($temp); - return $res; - } - - /** - * @throws Exception - */ - public static function updateQuiz() - { - $multiple = count($_FILES['file']['name']) > 1; - if ($multiple) { - $fname = 'updated.zip'; - $zip = new ZipArchive(); - $zipName = ROOT . '/quiz/quiz-' . md5(random_int(0, 10000000)) . '.zip'; - $zip->open($zipName, ZipArchive::CREATE); - } else { - $fname = $_FILES['file']['name'][0]; - } - - foreach ($_FILES['file']['name'] as $i => $name) { - $tmp_name = $_FILES['file']['tmp_name'][$i]; - $res = self::_updateOneQuiz($tmp_name, $name); - if ($multiple) { - $zip->addFromString($name, $res); - } - } - - header('Content-Type: application/zip'); - header('Content-Disposition: attachment; filename=' . $fname); - ob_end_clean(); - - if ($multiple) { - $zip->close(); - echo file_get_contents($zipName); - unlink($zipName); - } else { - echo $res; - } - exit; - } public static function formVerificationCode($args) { diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 76ce91d97..1b8b24de3 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -436,8 +436,6 @@ class wsHTML5Compiler $this->config->manifest = $this->writeManifest(); } - $this->writeGPUDatabase(); - if ($this->config->form == 'bulle') { $this->addJsLib('bulle', 'js/libs/fluidbook/forms/fluidbook.form.bulle.js'); } else if ($this->config->form == 'bourbon') { @@ -962,19 +960,6 @@ class wsHTML5Compiler } } - public function writeGPUDatabase() - { - global $core; - $r = $core->con->select('SELECT gpu,rgpu,score FROM gpu'); - $gpu = []; - while ($r->fetch()) { - $gpu[$r->gpu] = $r->score; - $gpu[$r->rgpu] = $r->score; - } - $this->config->gupsc = $gpu; - $this->config->gupse = wsServices::gpuSeparators(); - } - public function log($step) { $currenttime = microtime(true);