예제 #1
0
파일: api.php 프로젝트: andrelotto/Cosmo
     $tag = isset($_POST['tag']) ? $_POST['tag'] : '';
     if (checkPermissions('createPage', $published)) {
         if (count($segments) > 4 && $segments[2] === 'revisions' && $segments[4] === 'extras') {
             $response = $Cosmo->revisionsExtrasCreate($segments[3], $segments[1], $name, $extra);
         }
         if (count($segments) > 2 && $segments[2] === 'revisions') {
             $response['id'] = $Cosmo->revisionsCreate($segments[1], $title, $description, $header, $subheader, $featured, $body, $url, $type, $published, $published_date, $author);
         } else {
             if (count($segments) > 2 && $segments[2] === 'extras') {
                 $response = $Cosmo->contentExtrasCreate($segments[1], $name, $extra);
             } else {
                 if (count($segments) > 2 && $segments[2] === 'tags') {
                     $response = $Cosmo->contentTagsCreate($segments[1], $tag);
                 } else {
                     // Create a new page
                     $response['id'] = $Cosmo->contentCreate($title, $description, $header, $subheader, $featured, $body, $url, $author, $type, $published, $published_date);
                 }
             }
         }
     }
     break;
 case 'PUT':
     $published = isset($_PUT['published']) ? $_PUT['published'] : '';
     $name = isset($_PUT['name']) ? $_PUT['name'] : '';
     $extra = isset($_PUT['extra']) ? $_PUT['extra'] : '';
     $title = isset($_PUT['title']) ? $_PUT['title'] : '';
     $description = isset($_PUT['description']) ? $_PUT['description'] : '';
     $header = isset($_PUT['header']) ? $_PUT['header'] : '';
     $subheader = isset($_PUT['subheader']) ? $_PUT['subheader'] : '';
     $featured = isset($_PUT['featured']) ? $_PUT['featured'] : '';
     $body = isset($_PUT['body']) ? $_PUT['body'] : '';
예제 #2
0
파일: install.php 프로젝트: syqs/Cosmo
 $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&nbsp;<a href="http://cosmocms.org/cosmo-basics">checking out our how-to\'s</a>&nbsp;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 &gt; 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&nbsp;<a href="http://cosmocms.org/how-to-create-a-theme-for-cosmo">theme creation</a>&nbsp;along with&nbsp;how to use or&nbsp;<a href="http://cosmocms.org/how-to-create-a-module-for-cosmo">create new modules</a>&nbsp;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&nbsp;<a href="http://deathtothestockphoto.com">Death to Stock Photo</a>&nbsp;or&nbsp;<a href="https://unsplash.com">Unsplash</a>.</p><p class="ng-scope">Once your website is up and running,&nbsp;<a href="http://twitter.com/cosmocms">send us a link</a>&nbsp;so we can check it out and maybe even highlight it on our&nbsp;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 &copy {{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');