} else { if ($_GET['keyword']) { // Get list of users starting with a keyword $response = $Cosmo->usersRead(NULL, $_GET['keyword']); } else { // Get a list of all users $response = $Cosmo->usersRead(); } } } break; case 'POST': $username = isset($_POST['username']) ? $_POST['username'] : ''; $email = isset($_POST['email']) ? $_POST['email'] : ''; $password = isset($_POST['password']) ? $_POST['password'] : ''; $response = $Cosmo->usersCreate($username, $email, $password); break; case 'PUT': $username = isset($_PUT['username']) ? $_PUT['username'] : ''; $password = isset($_PUT['password']) ? $_PUT['password'] : ''; $name = isset($_PUT['name']) ? $_PUT['name'] : ''; $photo = isset($_PUT['photo']) ? $_PUT['photo'] : ''; $bio = isset($_PUT['bio']) ? $_PUT['bio'] : ''; $facebook = isset($_PUT['facebook']) ? $_PUT['facebook'] : ''; $twitter = isset($_PUT['twitter']) ? $_PUT['twitter'] : ''; $role = isset($_PUT['role']) ? $_PUT['role'] : ''; $email = isset($_PUT['email']) ? $_PUT['email'] : ''; $reset = isset($_PUT['reset']) ? $_PUT['reset'] : ''; $token = isset($_PUT['token']) ? $_PUT['token'] : ''; if ($token) { if ($Cosmo->passwordResetVerify($segments[1], $token)) {
// Create home page $stmt = $pdo->prepare('INSERT INTO ' . $prefix . 'content (url, type, published) VALUES (?,?,?) ON DUPLICATE KEY UPDATE url=VALUES(url)'); $data = array('/', 'home.html', 'Y'); $stmt->execute($data); // Create new page $stmt = $pdo->prepare('INSERT INTO ' . $prefix . 'content (url, author, published) VALUES (?,?,?) ON DUPLICATE KEY UPDATE url=VALUES(url)'); $data = array('/new', 1, 'Y'); $stmt->execute($data); // Create error page $stmt = $pdo->prepare('INSERT INTO ' . $prefix . 'content (url, type, author, published) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE url=VALUES(url)'); $data = array('/error', 'home.html', 1, 'Y'); $stmt->execute($data); // 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);