} else { if ($type || $url) { $response = $Cosmo->blocksRead(NULL, $type, $url); } else { $response = $Cosmo->blocksRead(); } } } break; case 'POST': if ($role === 'admin') { $type = isset($_POST['type']) ? $_POST['type'] : ''; $requirement = isset($_POST['requirement']) ? $_POST['requirement'] : ''; $name = isset($_POST['name']) ? $_POST['name'] : ''; if (isset($segments[2])) { $response = $Cosmo->blocksRequirementsCreate($segments[1], $type, $requirement); } else { $response = $Cosmo->blocksCreate($name); } } break; case 'PUT': if ($role === 'admin') { $blockID = isset($_PUT['blockID']) ? $_PUT['blockID'] : ''; $type = isset($_PUT['type']) ? $_PUT['type'] : ''; $requirement = isset($_PUT['requirement']) ? $_PUT['requirement'] : ''; $name = isset($_PUT['name']) ? $_PUT['name'] : ''; $block = isset($_PUT['block']) ? $_PUT['block'] : ''; $priority = isset($_PUT['priority']) ? $_PUT['priority'] : ''; $area = isset($_PUT['area']) ? $_PUT['area'] : ''; if (isset($segments[3])) {
// Insert records try { // Create admin username/password $Cosmo->usersCreate($adminUsername, $email, $adminPassword, 'admin'); // Create first post $Cosmo->contentCreate('Welcome to Cosmo', 'Welcome to Pendant, a blog theme developed for Cosmo.', 'Welcome to Cosmo', 'Your new website awaits', 'uploads/MIbCzcvxQdahamZSNQ26_12082014-IMG_3526-54571eebdae22.jpg', '<p class="ng-scope">Your site is now running on Cosmo, an open source content management system that\'s designed to help make editing your website quick and easy, it\'s created by James and<a href="http://twitter.com/jordandunn"> Jordan Dunn</a>. If this is your first time using Cosmo we recommend <a href="http://cosmocms.org/cosmo-basics">checking out our how-to\'s</a> for creating pages, editing content, uploading media and more. Once you\'re ready to make your first page, click the umbrella to your left, go to content > new page and you\'ll be on your way.</p><p class="ng-scope"><span class="ng-scope">If you\'re looking to create a new theme for Cosmo you can view all documentation for <a href="http://cosmocms.org/how-to-create-a-theme-for-cosmo">theme creation</a> along with how to use or <a href="http://cosmocms.org/how-to-create-a-module-for-cosmo">create new modules</a> to run within Cosmo.</span></p><p class="ng-scope">If you\'re looking for some free photos to work well with your new site, we recommend checking out <a href="http://deathtothestockphoto.com">Death to Stock Photo</a> or <a href="https://unsplash.com">Unsplash</a>.</p><p class="ng-scope">Once your website is up and running, <a href="http://twitter.com/cosmocms">send us a link</a> so we can check it out and maybe even highlight it on our website or social media.</p>', '/welcome-to-cosmo', 1, 'post.html', 'Y', NULL); $Cosmo->contentExtrasCreate(4, 'featured', '{"id":"featured","alt":"Welcome","src":"uploads/MIbCzcvxQdahamZSNQ26_12082014-IMG_3526-54571eebdae22.jpg","size":"responsive","responsive":"yes"}'); $Cosmo->contentTagsCreate(4, 'blog'); // Insert first file $stmt = $pdo->prepare('INSERT INTO ' . $prefix . 'files (filename, responsive, type, timestamp) VALUES (?,?,?,?)'); $data = array('uploads/MIbCzcvxQdahamZSNQ26_12082014-IMG_3526-54571eebdae22.jpg', 'yes', 'image', time()); $stmt->execute($data); // Insert first block $Cosmo->blocksCreate('Home Page'); $Cosmo->blocksUpdate('Home Page', '<div one-post="blog"></div>', 0, 'block1', 1); $Cosmo->blocksRequirementsCreate(1, 'visible', '/'); // Insert footer block $Cosmo->blocksCreate('Copyright'); $Cosmo->blocksUpdate('Copyright', '<p>Copyright © {{page.current_year}} | Built with <a href="http://www.cosmocms.org/"><img class="cosmo-logo" alt="Single Page Application CMS" src="core/img/cosmo-logo.svg"></a></p>', 0, 'footer', 2); // Insert example primary menu $Cosmo->menusCreate('Primary'); $Cosmo->menusUpdate(1, 'Primary', '[{"id":1,"title":"About","url":"about","items":[]},{"id":100,"title":"Contact","url":"contact","items":[]}]', 'primary'); } catch (Exception $e) { } } // User hasn't submitted the form yet if (!$_GET) { ?> <html ng-app="app"> <head> <title translate>install_cosmo</title>