$jsArray = $currentWmc->toJavaScript(); if (is_array($jsArray) && count($jsArray) > 0) { $resultObj["javascript"] = $jsArray; $ajaxResponse->setResult($resultObj); $ajaxResponse->setSuccess(true); } else { $ajaxResponse->setMessage(_mb("WMC could not be merged.")); $ajaxResponse->setSuccess(false); } break; // appends a WMC (returns JS code) // appends a WMC (returns JS code) case 'appendWmc': // generate a WMC for the current client state $currentWmc = new wmc(); $currentWmc->createFromJs($json->decode($ajaxResponse->getParameter("mapObject")), $ajaxResponse->getParameter("generalTitle"), $ajaxResponse->getParameter("extensionData")); // get the desired WMC from the database $wmcId = $ajaxResponse->getParameter("id"); $wmcXml = wmc::getDocument($wmcId); // merge the two WMCs $currentWmc->append($wmcXml); // load the merged WMC $jsArray = $currentWmc->toJavaScript(); if (is_array($jsArray) && count($jsArray) > 0) { $resultObj["javascript"] = $jsArray; $ajaxResponse->setResult($resultObj); $ajaxResponse->setSuccess(true); } else { $ajaxResponse->setMessage(_mb("WMC could not be appended.")); $ajaxResponse->setSuccess(false); }
if ($lzwCompressed == 'true') { //$e = new mb_exception('mod_savewmc_server.php: mapObject: '.implode(',',$mapObject)); $mapObject = lzw_decompress($mapObject); //$e = new mb_exception('mod_savewmc_server.php: mapObject uncompressed: '.$mapObject); //$filename = TMPDIR."/formerly_compressed_json.txt";//will be set to new one cause ? } else { //$filename = TMPDIR."/formerly_uncompressed_json.txt";//will be set to new one cause ? } //file_put_contents($filename, $mapObject); //$e = new mb_exception('mod_savewmc_server.php: mapObject is here ;-)'); $mapObject = $json->decode($mapObject); $e = new mb_notice('mod_savewmc_server.php: mapObject has been decoded from json'); // create WMC object $wmc = new wmc(); if ($overwrite) { $wmc->createFromJs($mapObject, $attributes->title, $extensionData, $attributes->wmc_id); } else { $wmc->createFromJs($mapObject, $attributes->title, $extensionData); } if ($saveInSession === 1) { // CLEAN SESSION WMC FILES //do this by cronjob! //$tmp = scandir(TMPDIR); // get all files from tmp folder /*for($p = 0; $p < count($tmp); $p++) { // match timestamp on begin of the filename if(preg_match("/^([\d]+).*$/i", $tmp[$p],$timestamp)) { // if file older than 24h, remove it. if((time() - $timestamp[1]) >= 86400) { // 86400 = 24h unlink(TMPDIR."/wmc/".$tmp[$p]); }