public function exportProject($exportsettings, $dontsavesettings = false) { $userid = $this->getUserId(); $projectid = $this->getProjectId(); $data = $this->loadProjectData(); if (!$dontsavesettings) { $this->userdata->saveExportSettings($exportsettings); } // $theme = (strlen($exportsettings['styleTemplate'])) ? $exportsettings['styleTemplate'] : 'default'; $theme = "default"; $zip = new Zipper(); $filename = $this->projectpath . $data['path'] . "/" . $this->standardize($data['project']) . '.zip'; if (@file_exists($filename)) { @unlink($filename); } if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) { exit("cannot open <{$filename}>\n"); } $zip->addEmptyDir('images'); $zip->addEmptyDir('thumbs'); $zip->addEmptyDir('audio'); $zip->addEmptyDir('config'); $zip->addDir('./css'); $zip->addFile('./themes/' . $theme . '/css/styles.css', './css/styles.css'); $zip->addEmptyDir('icons'); $zip->addFilesFromDir('./themes/' . $theme . '/icons', './icons'); $zip->addDir('./js'); $zip->addFile('_index.html', '/index.html'); $zip->addFile('integration.html', '/integration.html'); $zip->addFile('_index_computer.html', '/_index_computer.html'); $zip->addFile('./flash/mmslides.swf', '/mmslides.swf'); $imageformat = strlen($exportsettings['width']) ? $exportsettings['width'] : "1024"; foreach ($data['data']['slides'] as $idx => $filedata) { if (array_key_exists('file', $filedata) && strlen($filedata['file'])) { $filepaths = array('1280' => $this->projectpath . $data['path'] . DIRECTORY_SEPARATOR . "1280" . DIRECTORY_SEPARATOR . $filedata['file'], '1024' => $this->projectpath . $data['path'] . DIRECTORY_SEPARATOR . "1024" . DIRECTORY_SEPARATOR . $filedata['file'], '800' => $this->projectpath . $data['path'] . DIRECTORY_SEPARATOR . "800" . DIRECTORY_SEPARATOR . $filedata['file'], '640' => $this->projectpath . $data['path'] . DIRECTORY_SEPARATOR . "640" . DIRECTORY_SEPARATOR . $filedata['file'], '480' => $this->projectpath . $data['path'] . DIRECTORY_SEPARATOR . "480" . DIRECTORY_SEPARATOR . $filedata['file'], '320' => $this->projectpath . $data['path'] . DIRECTORY_SEPARATOR . "320" . DIRECTORY_SEPARATOR . $filedata['file']); foreach ($filepaths as $filesize => $filepath) { if (@file_exists($filepath)) { $zip->addFile($filepath, '/images/' . $filesize . '/' . $filedata['file']); } $thumbpath = $this->projectpath . $data['path'] . "/thumbs/" . $filedata['file']; if (@file_exists($thumbpath)) { $zip->addFile($thumbpath, '/thumbs/' . $filedata['file'] . ".thumb.jpg"); } } } } $audiotrack = $data['data']['meta']['audio']; if (is_array($audiotrack) && strlen($audiotrack['file']) > 0) { $audiopath = $this->projectpath . $data['path'] . "/" . $audiotrack['file']; if (@file_exists($audiopath)) { $zip->addFile($audiopath, '/audio/' . $audiotrack['file']); } } $projectdata = $data; if (strlen($exportsettings['password'])) { $exportsettings['password'] = md5($exportsettings['password']); } $projectdata['slideshow'] = $exportsettings; $zip->addFromString('config/jsonconfig.js', json_encode($projectdata)); $zip->close(); return array('url' => $data['path'] . '/' . basename($filename)); }