Exemple #1
0
 function post($action = null)
 {
     $users = new UsersData();
     if ($action == 'process' && $users->checkPass() && !$users->authNeeded()) {
         DashboardUtils::backupFiles($_POST['files']);
         MinimizeTools::minimizeHTMLFiles($_POST['files']);
         new AnalyticsData();
         new MediaData();
         new SettingsData();
         $rss = new RSSData();
         $rss->buildDataFile($_POST['files']);
         $nav = new NavigationData();
         $nav->buildDataFile($_POST['files']);
         $blog = new BlogData();
         $blog->buildDataFile($_POST['files']);
         $footer = new FooterData();
         $footer->buildDataFile($_POST['files']);
         $pages = new PagesData();
         $pages->buildDataFile($_POST['files']);
         DashboardUtils::renameFiles($_POST['files']);
         DashboardUtils::copyApacheConfig();
         DashboardUtils::createXMLSiteMap();
         $logsData = new LogsData();
         $logsData->addToLog('has initiated the CMS on the following files:', implode(" ", $_POST['files']));
         header('Location: /admin/');
     } else {
         include_once '401.html';
     }
 }
Exemple #2
0
<?php

$pagesData = new PagesData();
$pages = $pagesData->getData();
?>
<!DOCTYPE html>
<html lang="en" style="overflow: hidden;">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <meta name="description" content="">
        <meta name="author" content="">
        <title>autoCMS</title>
        <!-- Bootstrap Core CSS -->
        <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" type="text/css">
        <!-- MetisMenu CSS -->
        <link href="//cdnjs.cloudflare.com/ajax/libs/metisMenu/2.0.0/metisMenu.min.css" rel="stylesheet" type="text/css">
        <!-- Custom Fonts -->
        <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
        <!-- Custom CSS -->
        <link href="/admin/css/autocms.css" rel="stylesheet">
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
            <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
            <script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body style="background-color: #f8f8f8; overflow: hidden;">
        <div id="wrapper">
Exemple #3
0
 function post_xhr($page = null)
 {
     $users = new UsersData();
     if (is_null($page)) {
         echo json_encode(StatusReturn::E400('400 Missing Required Data!'), JSON_NUMERIC_CHECK);
     } else {
         if ($page != 'nav' && $users->checkPass() && !$users->authNeeded()) {
             PagesData::saveDescription('page-' . $page, $_POST['pk'], $_POST['value']);
             echo json_encode(StatusReturn::S200('Description Saved!'), JSON_NUMERIC_CHECK);
         } else {
             if ($users->checkPass() && !$users->authNeeded()) {
                 PagesData::saveDescription('autocms-' . $page, $_POST['pk'], $_POST['value']);
                 echo json_encode(StatusReturn::S200('Description Saved!'), JSON_NUMERIC_CHECK);
             } else {
                 echo json_encode(StatusReturn::E401('401 Not Authorized!'), JSON_NUMERIC_CHECK);
             }
         }
     }
 }
Exemple #4
0
 public function buildDataFile($files)
 {
     foreach ($files as $file) {
         $fileData = file_get_contents('../' . $file, true);
         $html = str_get_html($fileData);
         foreach ($html->find('.auto-blog-next, .auto-blog-prev, .auto-blog-has-prev, .auto-blog-has-next') as $pagination) {
             if (strpos($pagination->class, 'auto-blog-next') !== false) {
                 $pagination->href = '<?=getBlogPage("next")?>';
                 $pagination->class = str_replace('auto-blog-next', '', $pagination->class);
                 $this->data['types']['link-next'] = true;
                 $this->data['list-pagination-pages'] = str_replace(array('.html', '.htm'), '', $file);
             } else {
                 if (strpos($pagination->class, 'auto-blog-prev') !== false) {
                     $pagination->href = '<?=getBlogPage("prev")?>';
                     $pagination->class = str_replace('auto-blog-prev', '', $pagination->class);
                     $this->data['types']['link-prev'] = true;
                     $this->data['list-pagination-pages'] = str_replace(array('.html', '.htm'), '', $file);
                 } else {
                     if (strpos($pagination->class, 'auto-blog-has-next') !== false) {
                         $this->data['pagination']['has-next'] = $pagination->style;
                         $pagination->style = '<?=getBlogPage("has-next")?>';
                         $pagination->class = str_replace('auto-blog-has-next', '', $pagination->class);
                     } else {
                         if (strpos($pagination->class, 'auto-blog-has-prev') !== false) {
                             $this->data['pagination']['has-prev'] = $pagination->style;
                             $pagination->style = '<?=getBlogPage("has-prev")?>';
                             $pagination->class = str_replace('auto-blog-has-prev', '', $pagination->class);
                         }
                     }
                 }
             }
         }
         foreach ($html->find('.auto-blog-head, .auto-blog-list, .auto-blog-post') as $blog) {
             if (strpos($blog->class, 'auto-blog-head') !== false) {
                 foreach ($html->find('.auto-blog-head title') as $pageTitle) {
                     $pageTitle->innertext = "<?=getBlog('title')?>";
                     $this->data['types']['title'] = true;
                 }
                 foreach ($html->find('.auto-blog-head meta') as $pageMeta) {
                     if ($pageMeta->name == 'keywords' || $pageMeta->name == 'description' || $pageMeta->name == 'author') {
                         $pageMeta->content = "<?=getBlog('{$pageMeta->name}')?>";
                         $this->data['types'][$pageMeta->name] = true;
                     }
                     if (isset($pageMeta->property) && isset($pageMeta->content)) {
                         $property = preg_replace("/[^a-z^A-Z^0-9_-]/", "", $pageMeta->property);
                         if ($pageMeta->property == "og:image") {
                             $pageMeta->content = "<?=get('autocms-settings.json', 'site-host')?><?=getBlog('image')?>";
                         } else {
                             if ($pageMeta->property == "og:title") {
                                 $pageMeta->content = "<?=getBlog('title')?>";
                             } else {
                                 if ($pageMeta->property == "og:description") {
                                     $pageMeta->content = "<?=getBlog('description')?>";
                                 } else {
                                     if ($pageMeta->property == "og:author" || $pageMeta->property == 'article:author') {
                                         $pageMeta->content = "<?=getBlog('author')?>";
                                     } else {
                                         if ($pageMeta->property == "og:url") {
                                             $pageMeta->content = "<?=getBlog('link-href')?>";
                                         } else {
                                             if ($pageMeta->property == "og:type") {
                                                 $pageMeta->content = "article";
                                             } else {
                                                 if ($pageMeta->property == "og:site_name") {
                                                     $pageMeta->content = "<?=get('autocms-settings.json', 'site-name')?>";
                                                 } else {
                                                     $pageMeta->content = "<?=getBlog('{$property}')?>";
                                                     $this->data['types']['open-graph'] = true;
                                                     $this->data['og-types'][$property] = $pageMeta->property;
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
                 $blog->innertext .= "<?=get('autocms-analytics.json', 'analytics')?>";
                 $blog->class = str_replace('auto-blog-head', '', $blog->class);
             } else {
                 if (strpos($blog->class, 'auto-blog-list') !== false) {
                     foreach ($html->find('.auto-blog-list .auto-blog-title, .auto-blog-list .auto-blog-date, .auto-blog-list .auto-blog-cats, .auto-blog-list .auto-blog-bg-img, .auto-blog-list .auto-blog-img, .auto-blog-list .auto-blog-short, .auto-blog-list .auto-blog-full, .auto-blog-list .auto-blog-link, .auto-blog-list .auto-blog-link-href') as $list) {
                         if (strpos($list->class, 'auto-blog-title') !== false) {
                             $list->innertext = '<?=getBlog("title", $x)?>';
                             $list->class = str_replace('auto-blog-title', '', $list->class);
                             $this->data['types']['title'] = true;
                         } else {
                             if (strpos($list->class, 'auto-blog-bg-img') !== false) {
                                 $list->style = "background-image: url('<?=getBlog(" . '"image", $x' . ")?>');";
                                 $list->class = str_replace('auto-blog-bg-img', '', $list->class);
                                 $this->data['types']['image'] = true;
                             } else {
                                 if (strpos($list->class, 'auto-blog-img') !== false) {
                                     $list->src = '<?=getBlog("image", $x)?>';
                                     $list->alt = '<?=getBlog("image-alt-text", $x)?>';
                                     $list->class = str_replace('auto-blog-img', '', $list->class);
                                     $this->data['types']['image'] = true;
                                     $this->data['types']['image-alt-text'] = true;
                                 } else {
                                     if (strpos($list->class, 'auto-blog-short') !== false) {
                                         $list->innertext = '<?=getBlog("short-blog", $x)?>';
                                         $list->class = str_replace('auto-blog-short', '', $list->class);
                                         $this->data['types']['short-blog'] = true;
                                     } else {
                                         if (strpos($list->class, 'auto-blog-full') !== false) {
                                             $list->innertext = '<?=getBlog("full-blog", $x)?>';
                                             $list->class = str_replace('auto-blog-full', '', $list->class);
                                             $this->data['types']['full'] = true;
                                         } else {
                                             if (strpos($list->class, 'auto-blog-date') !== false) {
                                                 $list->innertext = '<?=getBlog("date", $x)?>';
                                                 $list->class = str_replace('auto-blog-date', '', $list->class);
                                                 $this->data['types']['date'] = true;
                                             } else {
                                                 if (strpos($list->class, 'auto-blog-cats') !== false) {
                                                     $list->innertext = '<?=getBlog("cats", $x)?>';
                                                     $list->class = str_replace('auto-blog-cats', '', $list->class);
                                                     $this->data['types']['categories'] = true;
                                                 } else {
                                                     if (strpos($list->class, 'auto-blog-link-href') !== false) {
                                                         $list->href = '<?=getBlog("link-href", $x)?>';
                                                         $list->class = str_replace('auto-blog-link-href', '', $list->class);
                                                         $this->data['types']['link-href'] = true;
                                                     } else {
                                                         if (strpos($list->class, 'auto-blog-link') !== false) {
                                                             $list->href = '<?=getBlog("link", $x)?>';
                                                             $list->innertext = '<?=getBlog("link-text", $x)?>';
                                                             $list->class = str_replace('auto-blog-link', '', $list->class);
                                                             $this->data['types']['link-text'] = true;
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                         if (trim($list->class) === '') {
                             $list->class = null;
                         }
                     }
                     $fieldID = uniqid();
                     $blog->class = str_replace('auto-blog-list', '', $blog->class);
                     $blog->outertext = '<?php for ($x = 0; $x ' . '< blogCount("' . $file . '", "' . $fieldID . '");' . ' $x++) { ?>' . $blog->outertext . "<?php } ?>";
                     PagesData::addVariableToPage($file, $fieldID, array('blog-count' => 3, 'description' => 'blog display count', 'type' => 'blog-count'));
                 } else {
                     if (strpos($blog->class, 'auto-blog-post') !== false) {
                         $this->data['post-page'] = str_replace(array('.html', '.htm'), '', $file);
                         foreach ($html->find('.auto-blog-post .auto-blog-title, .auto-blog-post .auto-blog-date, .auto-blog-post .auto-blog-cats, .auto-blog-post .auto-blog-bg-img, .auto-blog-post .auto-blog-img, .auto-blog-post .auto-blog-short, .auto-blog-post .auto-blog-full') as $post) {
                             if (strpos($post->class, 'auto-blog-title') !== false) {
                                 $post->innertext = '<?=getBlog("title")?>';
                                 $post->class = str_replace('auto-blog-title', '', $post->class);
                                 $this->data['types']['title'] = true;
                             } else {
                                 if (strpos($post->class, 'auto-blog-bg-img') !== false) {
                                     $post->style = "background-image: url('<?=getBlog(" . '"image"' . ")?>');";
                                     $post->class = str_replace('auto-blog-bg-img', '', $post->class);
                                     $this->data['types']['image'] = true;
                                 } else {
                                     if (strpos($post->class, 'auto-blog-img') !== false) {
                                         $post->src = '<?=getBlog("image")?>';
                                         $post->alt = '<?=getBlog("image-alt-text")?>';
                                         $post->class = str_replace('auto-blog-img', '', $post->class);
                                         $this->data['types']['image'] = true;
                                         $this->data['types']['image-alt-text'] = true;
                                     } else {
                                         if (strpos($post->class, 'auto-blog-short') !== false) {
                                             $post->innertext = '<?=getBlog("short-blog")?>';
                                             $post->class = str_replace('auto-blog-short', '', $post->class);
                                             $this->data['types']['short-blog'] = true;
                                         } else {
                                             if (strpos($post->class, 'auto-blog-full') !== false) {
                                                 $post->innertext = '<?=getBlog("full-blog")?>';
                                                 $post->class = str_replace('auto-blog-full', '', $post->class);
                                                 $this->data['types']['full-blog'] = true;
                                             } else {
                                                 if (strpos($post->class, 'auto-blog-date') !== false) {
                                                     $post->innertext = '<?=getBlog("date")?>';
                                                     $post->class = str_replace('auto-blog-date', '', $post->class);
                                                     $this->data['types']['date'] = true;
                                                 } else {
                                                     if (strpos($post->class, 'auto-blog-cats') !== false) {
                                                         $post->innertext = '<?=getBlog("cats", "$x")?>';
                                                         $post->class = str_replace('auto-blog-cats', '', $post->class);
                                                         $this->data['types']['categories'] = true;
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                             if (trim($post->class) === '') {
                                 $post->class = null;
                             }
                         }
                         $blog->class = str_replace('auto-blog-post', '', $blog->class);
                     }
                 }
             }
             if (trim($blog->class) === '') {
                 $blog->class = null;
             }
         }
         $fp = fopen('../' . $file, 'w');
         fwrite($fp, $html);
         fclose($fp);
     }
 }