public function getHost() { if (!DashboardUtils::endsWith($this->data['site-host']['text'], '/')) { $this->data['site-host']['text'] .= '/'; } return $this->data['site-host']['text']; }
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'; } }
public function orderBlog() { $this->data['posts'] = DashboardUtils::arrayMSort($this->data['posts'], array('published' => SORT_DESC)); }
public static function updatePage($file, $data) { $dataFile = 'data/page-' . $file . '.json'; $json = json_decode(file_get_contents($dataFile), true); $changeLog = array(); foreach ($data as $key => $datum) { if (DashboardUtils::endsWith($key, '-loaded') && trim($datum) != '') { $key = str_replace('-loaded', '', $key); } if ($key != 'key' && isset($json[$key]) && $json[$key][$json[$key]['type']] != trim($datum)) { $changeLog[] = array('key' => $key, 'change' => array('original' => $json[$key][$json[$key]['type']], 'new' => trim($datum))); $json[$key][$json[$key]['type']] = trim($datum); } else { list($repeatKey, $iteration, $itemKey) = explode("-", $key); if (isset($json[$repeatKey]['repeat'][$iteration][$itemKey]) && $json[$repeatKey]['repeat'][$iteration][$itemKey][$json[$repeatKey]['repeat'][$iteration][$itemKey]['type']] != trim($datum)) { $changeLog[] = array('key' => $key, 'change' => array('original' => $json[$repeatKey]['repeat'][$iteration][$itemKey][$json[$repeatKey]['repeat'][$iteration][$itemKey]['type']], 'new' => trim($datum))); $json[$repeatKey]['repeat'][$iteration][$itemKey][$json[$repeatKey]['repeat'][$iteration][$itemKey]['type']] = trim($datum); } } } if (count($changeLog) > 0) { $logsData = new LogsData(); $logsData->addToLog('has updated', $file . ' page', $changeLog); } $fp = fopen($dataFile, 'w'); fwrite($fp, json_encode($json)); fclose($fp); }
<?php include_once 'header.php'; $files = DashboardUtils::scanFiles('.html'); $logsData = new LogsData(); $logs = $logsData->getLogData(-5); ?> <div class="container"> <div class="row"> <div class="col-lg-12"> <h2 class="page-header">Dashboard</h2> </div> </div> <div class="row"> <?php if (count($files) > 0) { ?> <div class="col-xs-12 col-sm-6 col-md-4"> <div class="panel panel-red"> <div class="panel-heading"> Unprocessed Files </div> <div class="panel-body"> <ul> <?php foreach ($files as $file) { ?> <li><?php echo $file; ?>