bludit/kernel/admin/controllers/dashboard.php

74 lines
1.8 KiB
PHP
Raw Normal View History

2015-06-26 06:31:53 +02:00
<?php defined('BLUDIT') or die('Bludit CMS.');
2015-03-27 02:00:01 +01:00
2015-06-26 06:31:53 +02:00
// ============================================================================
// Functions
// ============================================================================
function updateBludit()
{
global $Site;
// Check if Bludit need to be update.
if( ($Site->currentBuild() < BLUDIT_BUILD) || isset($_GET['update']) )
{
$directories = array(
PATH_POSTS,
PATH_PAGES,
PATH_PLUGINS_DATABASES,
PATH_UPLOADS_PROFILES,
PATH_UPLOADS_THUMBNAILS,
PATH_TMP
);
foreach($directories as $dir)
{
// Check if the directory is already created.
if(!file_exists($dir)) {
// Create the directory recursive.
mkdir($dir, DIR_PERMISSIONS, true);
}
}
// Set and save the database.
$Site->set(array('currentBuild'=>BLUDIT_BUILD));
Log::set('updateBludit'.LOG_SEP.'System updated');
}
}
2015-03-27 02:00:01 +01:00
2015-08-03 02:49:12 +02:00
// ============================================================================
// Main before POST
// ============================================================================
2015-06-26 06:31:53 +02:00
// ============================================================================
// POST Method
// ============================================================================
// ============================================================================
2015-08-03 02:49:12 +02:00
// Main after POST
2015-06-26 06:31:53 +02:00
// ============================================================================
// Try update Bludit
updateBludit();
// Get draft posts and schedules
2015-07-27 02:29:47 +02:00
$_draftPosts = array();
2015-10-22 05:14:22 +02:00
$_scheduledPosts = array();
2015-07-27 02:29:47 +02:00
foreach($posts as $Post)
{
2015-08-26 05:49:15 +02:00
if($Post->draft()) {
2015-07-27 02:29:47 +02:00
array_push($_draftPosts, $Post);
}
2015-10-22 05:14:22 +02:00
elseif($Post->scheduled()) {
array_push($_scheduledPosts, $Post);
}
2015-07-27 02:29:47 +02:00
}
// Get draft pages
2015-07-27 02:29:47 +02:00
$_draftPages = array();
foreach($pages as $Page)
{
if(!$Page->published()) {
array_push($_draftPages, $Page);
}
2015-08-29 07:02:09 +02:00
}