-
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] = $L->g('About') . ' - ' . $layout['title'];
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
activatePlugin('pluginAPI');
|
||||
$apiURL = DOMAIN_BASE.'api/';
|
||||
$pluginAPI = getPlugin('pluginAPI');
|
||||
$apiToken = $pluginAPI->getToken();
|
||||
$username = $login->username();
|
||||
$admin = new User($username);
|
||||
$authToken = $admin->tokenAuth();
|
||||
$output = array(
|
||||
'apiURL'=>$apiURL,
|
||||
'username'=>$username,
|
||||
'apiToken'=>$apiToken,
|
||||
'authToken'=>$authToken
|
||||
);
|
||||
exit(json_encode($output));
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Categories');
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
$plugin = false;
|
||||
$pluginClassName = $layout['parameters'];
|
||||
|
||||
// Check if the plugin exists
|
||||
if (isset($plugins['all'][$pluginClassName])) {
|
||||
$plugin = $plugins['all'][$pluginClassName];
|
||||
} else {
|
||||
Redirect::page('plugins');
|
||||
}
|
||||
|
||||
// Check if the plugin has the method form()
|
||||
if (!method_exists($plugin, 'form')) {
|
||||
Redirect::page('plugins');
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
// Add to syslog
|
||||
$syslog->add(array(
|
||||
'dictionaryKey'=>'plugin-configured',
|
||||
'notes'=>$plugin->name()
|
||||
));
|
||||
|
||||
// Call the method post of the plugin
|
||||
$plugin->post();
|
||||
Alert::set( $L->g('The changes have been saved') );
|
||||
Redirect::page('configure-plugin/'.$plugin->className());
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] = $L->g('Plugin').' - '.$plugin->name().' - '.$layout['title'];
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin', 'editor', 'author'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// Returns the content belongs to the current user if the user has the role Editor
|
||||
function filterContentOwner($list) {
|
||||
global $login;
|
||||
global $pages;
|
||||
$tmp = array();
|
||||
foreach ($list as $pageKey) {
|
||||
if ($pages->db[$pageKey]['username']==$login->username()) {
|
||||
array_push($tmp, $pageKey);
|
||||
}
|
||||
}
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
$published = $pages->getList($url->pageNumber(), ITEMS_PER_PAGE_ADMIN);
|
||||
$drafts = $pages->getDraftDB(true);
|
||||
$scheduled = $pages->getScheduledDB(true);
|
||||
$static = $pages->getStaticDB(true);
|
||||
$sticky = $pages->getStickyDB(true);
|
||||
$autosave = $pages->getAutosaveDB(true);
|
||||
|
||||
// If the user is an Author filter the content he/she can edit
|
||||
if (checkRole(array('author'), false)) {
|
||||
$published = filterContentOwner($published);
|
||||
$drafts = filterContentOwner($drafts);
|
||||
$scheduled = filterContentOwner($scheduled);
|
||||
$static = filterContentOwner($static);
|
||||
$sticky = filterContentOwner($sticky);
|
||||
}
|
||||
|
||||
// Check if out of range the pageNumber
|
||||
if (empty($published) && $url->pageNumber()>1) {
|
||||
Redirect::page('content');
|
||||
}
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Manage content');
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
function updateBludit() {
|
||||
global $site;
|
||||
global $syslog;
|
||||
|
||||
// New installation
|
||||
if ($site->currentBuild()==0) {
|
||||
$site->set(array('currentBuild'=>BLUDIT_BUILD));
|
||||
}
|
||||
|
||||
// Check if Bludit need to be updated
|
||||
if ( ($site->currentBuild() < BLUDIT_BUILD) || isset($_GET['update']) ) {
|
||||
Log::set('UPDATE SYSTEM - Starting.');
|
||||
|
||||
// Updates only for version less than Bludit v3.0 rc-3
|
||||
if ($site->currentBuild()<='20180910') {
|
||||
@mkdir(PATH_WORKSPACES, DIR_PERMISSIONS, true);
|
||||
$plugins = array('pluginVisitsStats', 'pluginRSS', 'pluginSitemap', 'pluginTimeMachineX', 'pluginBackup');
|
||||
foreach ($plugins as $plugin) {
|
||||
if (pluginActivated($plugin)) {
|
||||
Log::set('UPDATE SYSTEM - Re-enable plugin: '.$plugin);
|
||||
deactivatePlugin($plugin);
|
||||
activatePlugin($plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Updates only for version less than Bludit v3.1
|
||||
if ($site->currentBuild()<='20180921') {
|
||||
@mkdir(PATH_UPLOADS_PAGES, DIR_PERMISSIONS, true);
|
||||
$site->set(array('imageRelativeToAbsolute'=>true, 'imageRestrict'=>false));
|
||||
}
|
||||
|
||||
// Set the current build number
|
||||
$site->set(array('currentBuild'=>BLUDIT_BUILD));
|
||||
Log::set('UPDATE SYSTEM - Finished.');
|
||||
|
||||
// Add to syslog
|
||||
$syslog->add(array(
|
||||
'dictionaryKey'=>'system-updated',
|
||||
'notes'=>'Bludit v'.BLUDIT_VERSION
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Try update Bludit
|
||||
updateBludit();
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Dashboard');
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// This function is used on the VIEW to show the tables
|
||||
function printTable($title, $array) {
|
||||
echo '<h2 class="mb-2 mt-4">'.$title.'</h2>';
|
||||
echo '<table class="table table-striped mt-3">
|
||||
<tbody>
|
||||
';
|
||||
|
||||
foreach ($array as $key=>$value) {
|
||||
if($value===false) { $value = 'false'; }
|
||||
elseif($value===true) { $value = 'true'; }
|
||||
echo '<tr>';
|
||||
echo '<td>'.$key.'</td>';
|
||||
if (is_array($value)) {
|
||||
echo '<td>'.json_encode($value).'</td>';
|
||||
} else {
|
||||
echo '<td>'.Sanitize::html($value).'</td>';
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '
|
||||
</tbody>
|
||||
</table>
|
||||
';
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
$layout['title'] .= ' - '.$L->g('Developers');
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if ($_POST['action']=='delete') {
|
||||
deleteCategory($_POST);
|
||||
} elseif ($_POST['action']=='edit') {
|
||||
editCategory($_POST);
|
||||
}
|
||||
|
||||
Redirect::page('categories');
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
$categoryKey = $layout['parameters'];
|
||||
|
||||
if (!$categories->exists($categoryKey)) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the category: '.$categoryKey);
|
||||
Redirect::page('categories');
|
||||
}
|
||||
|
||||
$categoryMap = $categories->getMap($categoryKey);
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Edit Category').' [ '.$categoryMap['name'] . ' ] ';
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
if (checkRole(array('author'), false)) {
|
||||
try {
|
||||
$pageKey = isset($_POST['key']) ? $_POST['key'] : $layout['parameters'];
|
||||
$page = new Page($pageKey);
|
||||
} catch (Exception $e) {
|
||||
Alert::set($L->g('You do not have sufficient permissions'));
|
||||
Redirect::page('dashboard');
|
||||
}
|
||||
|
||||
if ($page->username()!==$login->username()) {
|
||||
// Add to syslog
|
||||
$syslog->add(array(
|
||||
'dictionaryKey'=>'access-denied',
|
||||
'notes'=>$login->username()
|
||||
));
|
||||
|
||||
Alert::set($L->g('You do not have sufficient permissions'));
|
||||
Redirect::page('dashboard');
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if ($_POST['type']==='delete') {
|
||||
// Get the page type before deleting to redirect to the correct tab
|
||||
if (empty($_POST['tab'])) {
|
||||
try {
|
||||
$pageToDelete = new Page($_POST['key']);
|
||||
$pageType = $pageToDelete->type();
|
||||
if ($pageType === 'autosave') {
|
||||
$_POST['tab'] = 'autosave';
|
||||
} elseif ($pageType === 'draft') {
|
||||
$_POST['tab'] = 'draft';
|
||||
} elseif ($pageType === 'scheduled') {
|
||||
$_POST['tab'] = 'scheduled';
|
||||
} elseif ($pageType === 'static') {
|
||||
$_POST['tab'] = 'static';
|
||||
} else {
|
||||
$_POST['tab'] = 'pages';
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$_POST['tab'] = 'pages';
|
||||
}
|
||||
}
|
||||
|
||||
if (deletePage($_POST['key'])) {
|
||||
Alert::set( $L->g('The changes have been saved') );
|
||||
}
|
||||
} else {
|
||||
$key = editPage($_POST);
|
||||
if ($key!==false) {
|
||||
Alert::set( $L->g('The changes have been saved') );
|
||||
Redirect::page('edit-content/'.$key);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_POST['tab'])) {
|
||||
$tab = preg_replace('/[^a-zA-Z0-9_-]/', '', $_POST['tab']);
|
||||
Redirect::page('content#'.$tab);
|
||||
}
|
||||
Redirect::page('content');
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
try {
|
||||
$pageKey = $layout['parameters'];
|
||||
$page = new Page($pageKey);
|
||||
} catch (Exception $e) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the page: '.$pageKey, LOG_TYPE_ERROR);
|
||||
Redirect::page('content');
|
||||
}
|
||||
|
||||
// Images prefix directory
|
||||
define('PAGE_IMAGES_KEY', $page->uuid());
|
||||
|
||||
// Images and thubmnails directories
|
||||
if (IMAGE_RESTRICT) {
|
||||
define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/'));
|
||||
define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/'));
|
||||
define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.DS.'thumbnails'.DS);
|
||||
define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/');
|
||||
define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/');
|
||||
} else {
|
||||
define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS));
|
||||
define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS));
|
||||
define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_THUMBNAILS);
|
||||
define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_THUMBNAILS);
|
||||
define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_THUMBNAILS);
|
||||
}
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Edit content').' - '.$page->title();
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
// Prevent non-administrators to change other users
|
||||
if ($login->role()!=='admin') {
|
||||
$_POST['username'] = $login->username();
|
||||
unset($_POST['role']);
|
||||
}
|
||||
|
||||
if (isset($_POST['deleteUserAndDeleteContent']) && ($login->role()==='admin')) {
|
||||
$_POST['deleteContent'] = true;
|
||||
deleteUser($_POST);
|
||||
} elseif (isset($_POST['deleteUserAndKeepContent']) && ($login->role()==='admin')) {
|
||||
$_POST['deleteContent'] = false;
|
||||
deleteUser($_POST);
|
||||
} elseif (isset($_POST['disableUser']) && ($login->role()==='admin')) {
|
||||
disableUser(array('username'=>$_POST['username']));
|
||||
} else {
|
||||
editUser($_POST);
|
||||
}
|
||||
|
||||
Alert::set($L->g('The changes have been saved'));
|
||||
|
||||
if ($login->role()==='admin') {
|
||||
Redirect::page('users');
|
||||
}
|
||||
Redirect::page('edit-user/'.$login->username());
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
$username = $layout['parameters'];
|
||||
|
||||
// Prevent non-administrators to change other users
|
||||
if ($login->role()!=='admin') {
|
||||
$username = $login->username();
|
||||
}
|
||||
|
||||
try {
|
||||
$user = new User($username);
|
||||
} catch (Exception $e) {
|
||||
Redirect::page('users');
|
||||
}
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] = $L->g('Edit user').' - '.$layout['title'];
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
$pluginClassName = $layout['parameters'];
|
||||
if (!activatePlugin($pluginClassName)) {
|
||||
Log::set('Fail when try to activate the plugin.', LOG_TYPE_ERROR);
|
||||
}
|
||||
|
||||
if (isset($plugins['all'][$pluginClassName])) {
|
||||
$plugin = $plugins['all'][$pluginClassName];
|
||||
} else {
|
||||
Redirect::page('plugins');
|
||||
}
|
||||
|
||||
if (method_exists($plugin, 'form')) {
|
||||
Redirect::page('configure-plugin/'.$pluginClassName);
|
||||
}
|
||||
|
||||
Redirect::page('plugins#'.$pluginClassName);
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
$themeDirectory = $layout['parameters'];
|
||||
|
||||
// Activate theme
|
||||
activateTheme($themeDirectory);
|
||||
|
||||
// Redirect
|
||||
Redirect::page('themes');
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
function checkLogin($args)
|
||||
{
|
||||
global $security;
|
||||
global $login;
|
||||
global $L;
|
||||
|
||||
if ($security->isBlocked()) {
|
||||
Alert::set($L->g('IP address has been blocked').'<br>'.$L->g('Try again in a few minutes'), ALERT_STATUS_FAIL);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($login->verifyUser($_POST['username'], $_POST['password'])) {
|
||||
if (isset($_POST['remember'])) {
|
||||
$login->setRememberMe($_POST['username']);
|
||||
}
|
||||
// Renew the token. This token will be the same inside the session for multiple forms.
|
||||
$security->generateTokenCSRF();
|
||||
|
||||
if (isset($_GET['enableAPI'])) {
|
||||
Redirect::page('api');
|
||||
}
|
||||
Redirect::page('dashboard');
|
||||
return true;
|
||||
}
|
||||
|
||||
// Bruteforce protection, add IP to the blacklist
|
||||
$security->addToBlacklist();
|
||||
|
||||
// Create alert
|
||||
Alert::set($L->g('Username or password incorrect'), ALERT_STATUS_FAIL);
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkRememberMe()
|
||||
{
|
||||
global $security;
|
||||
global $login;
|
||||
|
||||
if ($security->isBlocked()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($login->verifyUserByRemember()) {
|
||||
$security->generateTokenCSRF();
|
||||
Redirect::page('dashboard');
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD']!=='POST') {
|
||||
checkRememberMe();
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD']=='POST') {
|
||||
checkLogin($_POST);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
if ($login->logout()) {
|
||||
Redirect::admin();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if (createCategory($_POST)) {
|
||||
Redirect::page('categories');
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('New category');
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin', 'editor', 'author'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
createPage($_POST);
|
||||
Redirect::page('content');
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// UUID of the page is need it for autosave and media manager
|
||||
$uuid = $pages->generateUUID();
|
||||
|
||||
// Images prefix directory
|
||||
define('PAGE_IMAGES_KEY', $uuid);
|
||||
|
||||
// Images and thubmnails directories
|
||||
if (IMAGE_RESTRICT) {
|
||||
define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/'));
|
||||
define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/'));
|
||||
define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.DS.'thumbnails'.DS);
|
||||
define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/');
|
||||
define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_PAGES.PAGE_IMAGES_KEY.'/thumbnails/');
|
||||
} else {
|
||||
define('PAGE_IMAGES_DIRECTORY', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : HTML_PATH_UPLOADS));
|
||||
define('PAGE_IMAGES_URL', (IMAGE_RELATIVE_TO_ABSOLUTE? '' : DOMAIN_UPLOADS));
|
||||
define('PAGE_THUMBNAILS_DIRECTORY', PATH_UPLOADS_THUMBNAILS);
|
||||
define('PAGE_THUMBNAILS_HTML', HTML_PATH_UPLOADS_THUMBNAILS);
|
||||
define('PAGE_THUMBNAILS_URL', DOMAIN_UPLOADS_THUMBNAILS);
|
||||
}
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] = $L->g('New content').' - '.$layout['title'];
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if (createUser($_POST)) {
|
||||
Redirect::page('users');
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Add a new user');
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
changePluginsPosition(explode(',',$_POST['plugin-list']));
|
||||
Redirect::page('plugins-position');
|
||||
}
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Plugins');
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Plugins');
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
editSettings($_POST);
|
||||
Redirect::page('settings');
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Advanced Settings');
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
$themes = buildThemes();
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Themes');
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
$pluginClassName = $layout['parameters'];
|
||||
deactivatePlugin($pluginClassName);
|
||||
Redirect::page('plugins');
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
// Prevent non-administrators to change other users
|
||||
$username = $_POST['username'];
|
||||
if ($login->role()!=='admin') {
|
||||
$username = $login->username();
|
||||
}
|
||||
|
||||
if (changeUserPassword(array(
|
||||
'username'=>$username,
|
||||
'newPassword'=>$_POST['newPassword'],
|
||||
'confirmPassword'=>$_POST['confirmPassword']
|
||||
))) {
|
||||
if ($login->role()==='admin') {
|
||||
Redirect::page('users');
|
||||
}
|
||||
Redirect::page('edit-user/'.$login->username());
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Prevent non-administrators to change other users
|
||||
if ($login->role()!=='admin') {
|
||||
$layout['parameters'] = $login->username();
|
||||
}
|
||||
|
||||
try {
|
||||
$username = $layout['parameters'];
|
||||
$user = new User($username);
|
||||
} catch (Exception $e) {
|
||||
Redirect::page('users');
|
||||
}
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] = $L->g('Change password').' - '.$layout['title'];
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
// ============================================================================
|
||||
// Check role
|
||||
// ============================================================================
|
||||
|
||||
checkRole(array('admin'));
|
||||
|
||||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// POST Method
|
||||
// ============================================================================
|
||||
|
||||
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
||||
{
|
||||
$site->set($_POST);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$L->g('Users');
|
||||
Reference in New Issue
Block a user