public function run() { // Since we added the origfilename column in 5.0.0b1 we need to populate it Loader::block('library_file'); $bl = new LibraryFileBlockController(); $bl->populateOriginalFilenames(); // install the new block types made available BlockType::installBlockType('flash_content'); BlockType::installBlockType('guestbook'); BlockType::installBlockType('slideshow'); BlockType::installBlockType('search'); BlockType::installBlockType('google_map'); BlockType::installBlockType('video'); BlockType::installBlockType('rss_displayer'); BlockType::installBlockType('youtube'); BlockType::installBlockType('survey'); // rename external form $bt = BlockType::getByHandle('custom_form'); $db = Loader::db(); $tables = $db->MetaTables('TABLES'); if (isset($tables['btCustomForm']) && !isset($tables['btExternalForm'])) { $db->Execute("alter table btCustomForm rename btExternalForm"); } if (is_object($bt)) { BlockType::installBlockType('external_form', $bt->getBlockTypeID()); } // add new theme $th = PageTheme::getByHandle('greensalad'); if (!is_object($th)) { PageTheme::add('greensalad'); } }
function save($data) { Loader::library("file/importer"); if (file_exists($data['file'])) { $fi = new FileImporter(); $resp = $fi->import($data['file'], $data['name']); $lbc = new LibraryFileBlockController(); return $lbc->getFile($resp->getFileID()); } }
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); Loader::block('premium_google_map'); //Permissions Check if ($_GET['bID']) { $b = Block::getByID(intval($_GET['bID'])); $c = $b->getBlockCollectionObject(); if (!$b) { throw new Exception(t('File not found.')); } $mapController = new PremiumGoogleMapBlockController($b); $fileId = intval($mapController->getFileID()); $fileController = LibraryFileBlockController::getFile($fileId); if (!$fileController) { throw new Exception(t('File not found.')); } header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/vnd.google-earth.kml+xml kml; charset=utf8"); header("Content-Disposition: inline; filename=" . $fileController->getFilename()); header("Content-Title: Google Earth KML"); $cp = new Permissions($c); if ($cp->canRead()) { $filePath = $fileController->getFilePath(); if (!file_exists($filePath)) { throw new Exception(t('File not found.')); }