removing posts
This commit is contained in:
parent
63fe327fe4
commit
457c981208
|
@ -70,6 +70,10 @@ else
|
||||||
$Security->generateTokenCSRF();
|
$Security->generateTokenCSRF();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Define variables
|
||||||
|
$ADMIN_CONTROLLER = $layout['controller'];
|
||||||
|
$ADMIN_VIEW = $layout['view'];
|
||||||
|
|
||||||
// Load plugins before the admin area will be load.
|
// Load plugins before the admin area will be load.
|
||||||
Theme::plugins('beforeAdminLoad');
|
Theme::plugins('beforeAdminLoad');
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ define('DB_PAGES', PATH_DATABASES.'pages.php');
|
||||||
define('DB_SITE', PATH_DATABASES.'site.php');
|
define('DB_SITE', PATH_DATABASES.'site.php');
|
||||||
define('DB_CATEGORIES', PATH_DATABASES.'categories.php');
|
define('DB_CATEGORIES', PATH_DATABASES.'categories.php');
|
||||||
define('DB_TAGS', PATH_DATABASES.'tags.php');
|
define('DB_TAGS', PATH_DATABASES.'tags.php');
|
||||||
|
define('DB_NOTIFICATIONS', PATH_DATABASES.'notifications.php');
|
||||||
|
|
||||||
// ADMIN URI FILTER
|
// ADMIN URI FILTER
|
||||||
define('ADMIN_URI_FILTER', '/admin/');
|
define('ADMIN_URI_FILTER', '/admin/');
|
||||||
|
@ -274,6 +275,9 @@ $L = $Language;
|
||||||
// --- CONSTANTS with dependency ---
|
// --- CONSTANTS with dependency ---
|
||||||
define('ORDER_BY', $Site->orderBy());
|
define('ORDER_BY', $Site->orderBy());
|
||||||
|
|
||||||
|
$ADMIN_CONTROLLER = ''; // modified on bl-kernel/
|
||||||
|
$ADMIN_VIEW = '';
|
||||||
|
|
||||||
// DEBUG: Print constants
|
// DEBUG: Print constants
|
||||||
// $arr = array_filter(get_defined_constants(), 'is_string');
|
// $arr = array_filter(get_defined_constants(), 'is_string');
|
||||||
// echo json_encode($arr);
|
// echo json_encode($arr);
|
||||||
|
|
|
@ -14,22 +14,17 @@ $plugins = array(
|
||||||
|
|
||||||
'pageBegin'=>array(),
|
'pageBegin'=>array(),
|
||||||
'pageEnd'=>array(),
|
'pageEnd'=>array(),
|
||||||
'postBegin'=>array(),
|
|
||||||
'postEnd'=>array(),
|
|
||||||
|
|
||||||
|
'beforeAdminLoad'=>array(),
|
||||||
|
'afterAdminLoad'=>array(),
|
||||||
'adminHead'=>array(),
|
'adminHead'=>array(),
|
||||||
'adminBodyBegin'=>array(),
|
'adminBodyBegin'=>array(),
|
||||||
'adminBodyEnd'=>array(),
|
'adminBodyEnd'=>array(),
|
||||||
'adminSidebar'=>array(),
|
'adminSidebar'=>array(),
|
||||||
'beforeAdminLoad'=>array(),
|
|
||||||
'afterAdminLoad'=>array(),
|
|
||||||
|
|
||||||
'beforeRulesLoad'=>array(),
|
'beforeRulesLoad'=>array(),
|
||||||
'afterFormSave'=>array(),
|
'afterFormSave'=>array(),
|
||||||
|
|
||||||
'afterPostCreate'=>array(),
|
|
||||||
'afterPostModify'=>array(),
|
|
||||||
'afterPostDelete'=>array(),
|
|
||||||
'afterPageCreate'=>array(),
|
'afterPageCreate'=>array(),
|
||||||
'afterPageModify'=>array(),
|
'afterPageModify'=>array(),
|
||||||
'afterPageDelete'=>array(),
|
'afterPageDelete'=>array(),
|
||||||
|
|
|
@ -0,0 +1,211 @@
|
||||||
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||||
|
|
||||||
|
class dbNotifications extends dbJSON
|
||||||
|
{
|
||||||
|
public $dbFields = array(
|
||||||
|
'dictionaryKey'=> array('inFile'=>false, 'value'=>''),
|
||||||
|
'date'=> array('inFile'=>false, 'value'=>''),
|
||||||
|
'username'=> array('inFile'=>false, 'value'=>'')
|
||||||
|
);
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct(DB_NOTIFICATIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser($username)
|
||||||
|
{
|
||||||
|
$User = new User();
|
||||||
|
|
||||||
|
if($this->userExists($username))
|
||||||
|
{
|
||||||
|
$User->setField('username', $username);
|
||||||
|
|
||||||
|
foreach($this->db[$username] as $key=>$value) {
|
||||||
|
$User->setField($key, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $User;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAll()
|
||||||
|
{
|
||||||
|
return $this->db;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return an array with the username databases, filtered by username.
|
||||||
|
public function getDb($username)
|
||||||
|
{
|
||||||
|
if($this->userExists($username))
|
||||||
|
{
|
||||||
|
$user = $this->db[$username];
|
||||||
|
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the username associated to an email, if the email does not exists return FALSE.
|
||||||
|
public function getByEmail($email)
|
||||||
|
{
|
||||||
|
foreach($this->db as $username=>$values) {
|
||||||
|
if($values['email']==$email) {
|
||||||
|
return $username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return TRUE if the user exists, FALSE otherwise.
|
||||||
|
public function userExists($username)
|
||||||
|
{
|
||||||
|
return isset($this->db[$username]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateTokenEmail($username)
|
||||||
|
{
|
||||||
|
// Random hash
|
||||||
|
$token = sha1(Text::randomText(SALT_LENGTH).time());
|
||||||
|
$this->db[$username]['tokenEmail'] = $token;
|
||||||
|
|
||||||
|
// Token time to live, defined by TOKEN_EMAIL_TTL
|
||||||
|
$this->db[$username]['tokenEmailTTL'] = Date::currentOffset(DB_DATE_FORMAT, TOKEN_EMAIL_TTL);
|
||||||
|
|
||||||
|
// Save the database
|
||||||
|
if( $this->save() === false ) {
|
||||||
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPassword($username, $password)
|
||||||
|
{
|
||||||
|
$salt = Text::randomText(SALT_LENGTH);
|
||||||
|
$hash = sha1($password.$salt);
|
||||||
|
|
||||||
|
$args['username'] = $username;
|
||||||
|
$args['salt'] = $salt;
|
||||||
|
$args['password'] = $hash;
|
||||||
|
|
||||||
|
return $this->set($args);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable the user
|
||||||
|
public function disableUser($username)
|
||||||
|
{
|
||||||
|
$args['username'] = $username;
|
||||||
|
$args['password'] = '!';
|
||||||
|
|
||||||
|
return $this->set($args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set($args)
|
||||||
|
{
|
||||||
|
$dataForDb = array();
|
||||||
|
|
||||||
|
$user = $this->getDb($args['username']);
|
||||||
|
|
||||||
|
if($user===false)
|
||||||
|
{
|
||||||
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to get the username '.$args['username']);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify arguments with the database fields.
|
||||||
|
foreach($args as $field=>$value)
|
||||||
|
{
|
||||||
|
if( isset($this->dbFields[$field]) )
|
||||||
|
{
|
||||||
|
// Sanitize.
|
||||||
|
$tmpValue = Sanitize::html($value);
|
||||||
|
|
||||||
|
// Set type.
|
||||||
|
settype($tmpValue, gettype($this->dbFields[$field]['value']));
|
||||||
|
|
||||||
|
$user[$field] = $tmpValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the database
|
||||||
|
$this->db[$args['username']] = $user;
|
||||||
|
if( $this->save() === false ) {
|
||||||
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($username)
|
||||||
|
{
|
||||||
|
unset($this->db[$username]);
|
||||||
|
|
||||||
|
if( $this->save() === false ) {
|
||||||
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add($args)
|
||||||
|
{
|
||||||
|
$dataForDb = array();
|
||||||
|
|
||||||
|
// Verify arguments with the database fields.
|
||||||
|
foreach($this->dbFields as $field=>$options)
|
||||||
|
{
|
||||||
|
// If the user send the field.
|
||||||
|
if( isset($args[$field]) )
|
||||||
|
{
|
||||||
|
// Sanitize if will be saved on database.
|
||||||
|
if( !$options['inFile'] ) {
|
||||||
|
$tmpValue = Sanitize::html($args[$field]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$tmpValue = $args[$field];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Uses a default value for the field.
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tmpValue = $options['value'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set type
|
||||||
|
settype($tmpValue, gettype($options['value']));
|
||||||
|
|
||||||
|
// Save on database
|
||||||
|
$dataForDb[$field] = $tmpValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the user alredy exists.
|
||||||
|
if( $this->userExists($dataForDb['username']) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Current date.
|
||||||
|
$dataForDb['registered'] = Date::current(DB_DATE_FORMAT);
|
||||||
|
|
||||||
|
// Password
|
||||||
|
$dataForDb['salt'] = Text::randomText(SALT_LENGTH);
|
||||||
|
$dataForDb['password'] = sha1($dataForDb['password'].$dataForDb['salt']);
|
||||||
|
|
||||||
|
// Save the database
|
||||||
|
$this->db[$dataForDb['username']] = $dataForDb;
|
||||||
|
if( $this->save() === false ) {
|
||||||
|
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to save the database file.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "За мен",
|
||||||
|
"description": "Кратко описание за вашия сайт или за себе си."
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "Über",
|
||||||
|
"description": "Kurzer Text über die Website oder zu dir."
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "Über",
|
||||||
|
"description": "Kurzer Text über die Website oder zu dir."
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "About",
|
||||||
|
"description": "Little description about your site or yourself."
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "Acerca de",
|
||||||
|
"description": "Breve descripción de ti mismo o sobre tu sitio."
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "About",
|
||||||
|
"description": "サイトやあなた自身についての概要を表示します。"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "Over mij",
|
||||||
|
"description": "Een korte beschrijving over je site of jezelf."
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "О блоге",
|
||||||
|
"description": "Небольшое описание о вашем сайте или о себя."
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "Hakkında",
|
||||||
|
"description": "Senin veya siten hakkında kısa bilgiler"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"plugin-data":
|
||||||
|
{
|
||||||
|
"name": "Про блог",
|
||||||
|
"description": "Невеликий опис вашого сайту або про Вас."
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"author": "Bludit",
|
||||||
|
"email": "",
|
||||||
|
"website": "https://plugins.bludit.com",
|
||||||
|
"version": "1.5.2",
|
||||||
|
"releaseDate": "2016-05-28",
|
||||||
|
"license": "MIT",
|
||||||
|
"compatible": "1.5.2",
|
||||||
|
"notes": ""
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class pluginTimeMachine extends Plugin {
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function beforeAdminLoad()
|
||||||
|
{
|
||||||
|
global $L;
|
||||||
|
|
||||||
|
$notifyText = '';
|
||||||
|
if($_SERVER['REQUEST_METHOD']=='POST') {
|
||||||
|
if($GLOBALS['ADMIN_CONTROLLER']=='new-page') {
|
||||||
|
$notifyText = $L->g('New page created');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
213
install.php
213
install.php
|
@ -41,7 +41,6 @@ define('PATH_CONTENT', PATH_ROOT.'bl-content'.DS);
|
||||||
define('PATH_KERNEL', PATH_ROOT.'bl-kernel'.DS);
|
define('PATH_KERNEL', PATH_ROOT.'bl-kernel'.DS);
|
||||||
define('PATH_LANGUAGES', PATH_ROOT.'bl-languages'.DS);
|
define('PATH_LANGUAGES', PATH_ROOT.'bl-languages'.DS);
|
||||||
|
|
||||||
define('PATH_POSTS', PATH_CONTENT.'posts'.DS);
|
|
||||||
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
define('PATH_UPLOADS', PATH_CONTENT.'uploads'.DS);
|
||||||
define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
|
define('PATH_TMP', PATH_CONTENT.'tmp'.DS);
|
||||||
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
|
define('PATH_PAGES', PATH_CONTENT.'pages'.DS);
|
||||||
|
@ -172,9 +171,7 @@ function getLanguageList()
|
||||||
$files = glob(PATH_LANGUAGES.'*.json');
|
$files = glob(PATH_LANGUAGES.'*.json');
|
||||||
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
|
foreach($files as $file) {
|
||||||
foreach($files as $file)
|
|
||||||
{
|
|
||||||
$t = new dbJSON($file, false);
|
$t = new dbJSON($file, false);
|
||||||
$native = $t->db['language-data']['native'];
|
$native = $t->db['language-data']['native'];
|
||||||
$locale = basename($file, '.json');
|
$locale = basename($file, '.json');
|
||||||
|
@ -184,13 +181,13 @@ function getLanguageList()
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate a random string.
|
// Generate a random string
|
||||||
// Thanks, http://stackoverflow.com/questions/4356289/php-random-string-generator
|
// Thanks, http://stackoverflow.com/questions/4356289/php-random-string-generator
|
||||||
function getRandomString($length = 10) {
|
function getRandomString($length = 10) {
|
||||||
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
|
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if Bludit is installed.
|
// Check if Bludit is installed
|
||||||
function alreadyInstalled() {
|
function alreadyInstalled() {
|
||||||
return file_exists(PATH_DATABASES.'site.php');
|
return file_exists(PATH_DATABASES.'site.php');
|
||||||
}
|
}
|
||||||
|
@ -203,8 +200,7 @@ function checkSystem()
|
||||||
$dirpermissions = 0755;
|
$dirpermissions = 0755;
|
||||||
|
|
||||||
// Check .htaccess file for different webservers
|
// Check .htaccess file for different webservers
|
||||||
if( !file_exists(PATH_ROOT.'.htaccess') )
|
if( !file_exists(PATH_ROOT.'.htaccess') ) {
|
||||||
{
|
|
||||||
|
|
||||||
if ( !isset($_SERVER['SERVER_SOFTWARE']) ||
|
if ( !isset($_SERVER['SERVER_SOFTWARE']) ||
|
||||||
stripos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false ||
|
stripos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false ||
|
||||||
|
@ -223,8 +219,7 @@ function checkSystem()
|
||||||
@mkdir(PATH_CONTENT, $dirpermissions, true);
|
@mkdir(PATH_CONTENT, $dirpermissions, true);
|
||||||
|
|
||||||
// Check if the directory content is writeable.
|
// Check if the directory content is writeable.
|
||||||
if(!is_writable(PATH_CONTENT))
|
if(!is_writable(PATH_CONTENT)) {
|
||||||
{
|
|
||||||
$errorText = 'Writing test failure, check directory content permissions. (ERR_205)';
|
$errorText = 'Writing test failure, check directory content permissions. (ERR_205)';
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
|
|
||||||
|
@ -236,7 +231,7 @@ function checkSystem()
|
||||||
return $stdOut;
|
return $stdOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finish with the installation.
|
// Installation function
|
||||||
function install($adminPassword, $email, $timezone)
|
function install($adminPassword, $email, $timezone)
|
||||||
{
|
{
|
||||||
global $Language;
|
global $Language;
|
||||||
|
@ -255,65 +250,54 @@ function install($adminPassword, $email, $timezone)
|
||||||
|
|
||||||
// 7=read,write,execute | 5=read,execute
|
// 7=read,write,execute | 5=read,execute
|
||||||
$dirpermissions = 0755;
|
$dirpermissions = 0755;
|
||||||
$firstPostSlug = 'first-post';
|
|
||||||
|
|
||||||
if(!mkdir(PATH_POSTS.$firstPostSlug, $dirpermissions, true))
|
if(!mkdir(PATH_PAGES.'welcome', $dirpermissions, true)) {
|
||||||
{
|
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'welcome';
|
||||||
$errorText = 'Error when trying to created the directory=>'.PATH_POSTS.$firstPostSlug;
|
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mkdir(PATH_PAGES.'error', $dirpermissions, true))
|
if(!mkdir(PATH_PAGES.'about', $dirpermissions, true)) {
|
||||||
{
|
|
||||||
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'error';
|
|
||||||
error_log($errorText, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!mkdir(PATH_PAGES.'about', $dirpermissions, true))
|
|
||||||
{
|
|
||||||
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'about';
|
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'about';
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mkdir(PATH_PLUGINS_DATABASES.'pages', $dirpermissions, true))
|
if(!mkdir(PATH_PAGES.'error', $dirpermissions, true)) {
|
||||||
{
|
$errorText = 'Error when trying to created the directory=>'.PATH_PAGES.'error';
|
||||||
|
error_log($errorText, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mkdir(PATH_PLUGINS_DATABASES.'pages', $dirpermissions, true)) {
|
||||||
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'pages';
|
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'pages';
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mkdir(PATH_PLUGINS_DATABASES.'simplemde', $dirpermissions, true))
|
if(!mkdir(PATH_PLUGINS_DATABASES.'simplemde', $dirpermissions, true)) {
|
||||||
{
|
|
||||||
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'simplemde';
|
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'simplemde';
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mkdir(PATH_PLUGINS_DATABASES.'tags', $dirpermissions, true))
|
if(!mkdir(PATH_PLUGINS_DATABASES.'tags', $dirpermissions, true)) {
|
||||||
{
|
|
||||||
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'tags';
|
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'tags';
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mkdir(PATH_PLUGINS_DATABASES.'about', $dirpermissions, true))
|
if(!mkdir(PATH_PLUGINS_DATABASES.'about', $dirpermissions, true)) {
|
||||||
{
|
|
||||||
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'about';
|
$errorText = 'Error when trying to created the directory=>'.PATH_PLUGINS_DATABASES.'about';
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mkdir(PATH_UPLOADS_PROFILES, $dirpermissions, true))
|
if(!mkdir(PATH_UPLOADS_PROFILES, $dirpermissions, true)) {
|
||||||
{
|
|
||||||
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_PROFILES;
|
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_PROFILES;
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mkdir(PATH_TMP, $dirpermissions, true))
|
if(!mkdir(PATH_UPLOADS_THUMBNAILS, $dirpermissions, true)) {
|
||||||
{
|
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_THUMBNAILS;
|
||||||
$errorText = 'Error when trying to created the directory=>'.PATH_TMP;
|
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mkdir(PATH_UPLOADS_THUMBNAILS, $dirpermissions, true))
|
if(!mkdir(PATH_TMP, $dirpermissions, true)) {
|
||||||
{
|
$errorText = 'Error when trying to created the directory=>'.PATH_TMP;
|
||||||
$errorText = 'Error when trying to created the directory=>'.PATH_UPLOADS_THUMBNAILS;
|
|
||||||
error_log($errorText, 0);
|
error_log($errorText, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,50 +310,51 @@ function install($adminPassword, $email, $timezone)
|
||||||
// File pages.php
|
// File pages.php
|
||||||
$data = array(
|
$data = array(
|
||||||
'error'=>array(
|
'error'=>array(
|
||||||
'description'=>'Error page',
|
'description'=>$Language->get('Page not found'),
|
||||||
'username'=>'admin',
|
'username'=>'admin',
|
||||||
'tags'=>array(),
|
'tags'=>array(),
|
||||||
'status'=>'published',
|
'status'=>'published',
|
||||||
'date'=>$currentDate,
|
'date'=>$currentDate,
|
||||||
'position'=>0,
|
'dateModified'=>'',
|
||||||
'coverImage'=>'',
|
'allowComments'=>false,
|
||||||
'md5file'=>'',
|
'position'=>0,
|
||||||
'category'=>'',
|
'coverImage'=>'',
|
||||||
'uuid'=>md5(uniqid())
|
'md5file'=>'',
|
||||||
|
'category'=>'',
|
||||||
|
'uuid'=>md5(uniqid())
|
||||||
),
|
),
|
||||||
'about'=>array(
|
'about'=>array(
|
||||||
'description'=>$Language->get('About your site or yourself'),
|
'description'=>$Language->get('About your site or yourself'),
|
||||||
'username'=>'admin',
|
'username'=>'admin',
|
||||||
'tags'=>array(),
|
'tags'=>array(),
|
||||||
'status'=>'published',
|
'status'=>'published',
|
||||||
'date'=>$currentDate,
|
'date'=>$currentDate,
|
||||||
'position'=>1,
|
'dateModified'=>'',
|
||||||
'coverImage'=>'',
|
'allowComments'=>false,
|
||||||
'md5file'=>'',
|
'position'=>2,
|
||||||
'category'=>'',
|
'coverImage'=>'',
|
||||||
'uuid'=>md5(uniqid())
|
'md5file'=>'',
|
||||||
|
'category'=>'',
|
||||||
|
'uuid'=>md5(uniqid())
|
||||||
|
),
|
||||||
|
'welcome'=>array(
|
||||||
|
'description'=>$Language->get('Welcome to Bludit'),
|
||||||
|
'username'=>'admin',
|
||||||
|
'tags'=>array('bludit'=>'Bludit','cms'=>'CMS','flat-files'=>'Flat files'),
|
||||||
|
'status'=>'published',
|
||||||
|
'date'=>$currentDate,
|
||||||
|
'dateModified'=>'',
|
||||||
|
'allowComments'=>false,
|
||||||
|
'position'=>1,
|
||||||
|
'coverImage'=>'',
|
||||||
|
'md5file'=>'',
|
||||||
|
'category'=>'',
|
||||||
|
'uuid'=>md5(uniqid())
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
file_put_contents(PATH_DATABASES.'pages.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
file_put_contents(PATH_DATABASES.'pages.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||||
|
|
||||||
// File posts.php
|
|
||||||
$data = array(
|
|
||||||
$firstPostSlug=>array(
|
|
||||||
'description'=>$Language->get('Welcome to Bludit'),
|
|
||||||
'username'=>'admin',
|
|
||||||
'status'=>'published',
|
|
||||||
'tags'=>array('bludit'=>'Bludit','cms'=>'CMS','flat-files'=>'Flat files'),
|
|
||||||
'allowComments'=>'false',
|
|
||||||
'date'=>$currentDate,
|
|
||||||
'coverImage'=>'',
|
|
||||||
'md5file'=>'',
|
|
||||||
'category'=>'',
|
|
||||||
'uuid'=>md5(uniqid())
|
|
||||||
)
|
|
||||||
);
|
|
||||||
file_put_contents(PATH_DATABASES.'posts.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
|
||||||
|
|
||||||
// File site.php
|
// File site.php
|
||||||
$data = array(
|
$data = array(
|
||||||
'title'=>'BLUDIT',
|
'title'=>'BLUDIT',
|
||||||
|
@ -383,10 +368,8 @@ function install($adminPassword, $email, $timezone)
|
||||||
'adminTheme'=>'default',
|
'adminTheme'=>'default',
|
||||||
'homepage'=>'',
|
'homepage'=>'',
|
||||||
'postsperpage'=>'6',
|
'postsperpage'=>'6',
|
||||||
'uriPost'=>'/post/',
|
|
||||||
'uriPage'=>'/',
|
'uriPage'=>'/',
|
||||||
'uriTag'=>'/tag/',
|
'uriTag'=>'/tag/',
|
||||||
'uriBlog'=>'/blog/',
|
|
||||||
'uriCategory'=>'/category/',
|
'uriCategory'=>'/category/',
|
||||||
'url'=>PROTOCOL.DOMAIN.HTML_PATH_ROOT,
|
'url'=>PROTOCOL.DOMAIN.HTML_PATH_ROOT,
|
||||||
'emailFrom'=>'no-reply@'.DOMAIN
|
'emailFrom'=>'no-reply@'.DOMAIN
|
||||||
|
@ -433,28 +416,18 @@ function install($adminPassword, $email, $timezone)
|
||||||
|
|
||||||
// File categories.php
|
// File categories.php
|
||||||
$data = array(
|
$data = array(
|
||||||
'videos'=>array('name'=>'Videos', 'posts'=>array(), 'pages'=>array())
|
'videos'=>array('name'=>'Videos', 'list'=>array()),
|
||||||
|
'music'=>array('name'=>'Music', 'list'=>array())
|
||||||
);
|
);
|
||||||
file_put_contents(PATH_DATABASES.'categories.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
file_put_contents(PATH_DATABASES.'categories.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||||
|
|
||||||
// File tags.php
|
// File tags.php
|
||||||
file_put_contents(
|
$data = array(
|
||||||
PATH_DATABASES.'tags.php',
|
'bludit'=>array('name'=>'Bludit', 'list'=>array('welcome')),
|
||||||
$dataHead.json_encode(
|
'cms'=>array('name'=>'CMS', 'list'=>array('welcome')),
|
||||||
array(
|
'flat-files'=>array('name'=>'Flat files', 'list'=>array('welcome'))
|
||||||
'postsIndex'=>array(
|
|
||||||
'bludit'=>array('name'=>'Bludit', 'posts'=>array('first-post')),
|
|
||||||
'cms'=>array('name'=>'CMS', 'posts'=>array('first-post')),
|
|
||||||
'flat-files'=>array('name'=>'Flat files', 'posts'=>array('first-post'))
|
|
||||||
),
|
|
||||||
'pagesIndex'=>array()
|
|
||||||
),
|
|
||||||
JSON_PRETTY_PRINT),
|
|
||||||
LOCK_EX
|
|
||||||
);
|
);
|
||||||
|
file_put_contents(PATH_DATABASES.'tags.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
|
||||||
|
|
||||||
// PLUGINS
|
|
||||||
|
|
||||||
// File plugins/pages/db.php
|
// File plugins/pages/db.php
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
|
@ -507,22 +480,15 @@ function install($adminPassword, $email, $timezone)
|
||||||
LOCK_EX
|
LOCK_EX
|
||||||
);
|
);
|
||||||
|
|
||||||
// File FILENAME for error page
|
// File for error page
|
||||||
$data = 'Title: '.$Language->get('Error').'
|
$data = 'Title: '.$Language->get('Error').PHP_EOL.'Content: '.$Language->get('The page has not been found');
|
||||||
Content: '.$Language->get('The page has not been found');
|
|
||||||
|
|
||||||
file_put_contents(PATH_PAGES.'error'.DS.FILENAME, $data, LOCK_EX);
|
file_put_contents(PATH_PAGES.'error'.DS.FILENAME, $data, LOCK_EX);
|
||||||
|
|
||||||
// File FILENAME for about page
|
// File for about page
|
||||||
$data = 'Title: '.$Language->get('About').'
|
$data = 'Title: '.$Language->get('About').PHP_EOL.'Content: '.$Language->get('the-about-page-is-very-important').' '.$Language->get('change-this-pages-content-on-the-admin-panel');
|
||||||
Content:
|
|
||||||
'.$Language->get('the-about-page-is-very-important').'
|
|
||||||
|
|
||||||
'.$Language->get('change-this-pages-content-on-the-admin-panel');
|
|
||||||
|
|
||||||
file_put_contents(PATH_PAGES.'about'.DS.FILENAME, $data, LOCK_EX);
|
file_put_contents(PATH_PAGES.'about'.DS.FILENAME, $data, LOCK_EX);
|
||||||
|
|
||||||
// File FILENAME for welcome post
|
// File for welcome page
|
||||||
$text1 = Text::replaceAssoc(
|
$text1 = Text::replaceAssoc(
|
||||||
array(
|
array(
|
||||||
'{{ADMIN_AREA_LINK}}'=>PROTOCOL.DOMAIN.HTML_PATH_ROOT.'admin'
|
'{{ADMIN_AREA_LINK}}'=>PROTOCOL.DOMAIN.HTML_PATH_ROOT.'admin'
|
||||||
|
@ -530,7 +496,7 @@ Content:
|
||||||
$Language->get('Manage your Bludit from the admin panel')
|
$Language->get('Manage your Bludit from the admin panel')
|
||||||
);
|
);
|
||||||
|
|
||||||
$data = 'Title: '.$Language->get('First post').'
|
$data = 'Title: '.$Language->get('Welcome').'
|
||||||
Content:
|
Content:
|
||||||
|
|
||||||
## '.$Language->get('Whats next').'
|
## '.$Language->get('Whats next').'
|
||||||
|
@ -541,7 +507,7 @@ Content:
|
||||||
- '.$Language->get('Read the documentation for more information').'
|
- '.$Language->get('Read the documentation for more information').'
|
||||||
- '.$Language->get('Share with your friends and enjoy');
|
- '.$Language->get('Share with your friends and enjoy');
|
||||||
|
|
||||||
file_put_contents(PATH_POSTS.$firstPostSlug.DS.FILENAME, $data, LOCK_EX);
|
file_put_contents(PATH_POSTS.$welcomePageKey.DS.FILENAME, $data, LOCK_EX);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -552,17 +518,10 @@ function checkPOST($args)
|
||||||
global $Language;
|
global $Language;
|
||||||
|
|
||||||
// Check empty password
|
// Check empty password
|
||||||
if( strlen($args['password']) < 6 )
|
if( strlen($args['password']) < 6 ) {
|
||||||
{
|
|
||||||
return '<div>'.$Language->g('Password must be at least 6 characters long').'</div>';
|
return '<div>'.$Language->g('Password must be at least 6 characters long').'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check invalid email
|
|
||||||
if( !Valid::email($args['email']) && ($args['noCheckEmail']=='0') )
|
|
||||||
{
|
|
||||||
return '<div>'.$Language->g('Your email address is invalid').'</div><div id="jscompleteEmail">'.$Language->g('Proceed anyway').'</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sanitize email
|
// Sanitize email
|
||||||
$email = sanitize::email($args['email']);
|
$email = sanitize::email($args['email']);
|
||||||
|
|
||||||
|
@ -588,7 +547,7 @@ function redirect($url) {
|
||||||
$error = '';
|
$error = '';
|
||||||
|
|
||||||
if( alreadyInstalled() ) {
|
if( alreadyInstalled() ) {
|
||||||
exit('Bludit already installed');
|
exit('Bludit is already installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isset($_GET['demo']) ) {
|
if( isset($_GET['demo']) ) {
|
||||||
|
@ -598,7 +557,6 @@ if( isset($_GET['demo']) ) {
|
||||||
|
|
||||||
if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||||
$error = checkPOST($_POST);
|
$error = checkPOST($_POST);
|
||||||
|
|
||||||
if($error===true) {
|
if($error===true) {
|
||||||
redirect(HTML_PATH_ROOT);
|
redirect(HTML_PATH_ROOT);
|
||||||
}
|
}
|
||||||
|
@ -625,7 +583,6 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||||
<script charset="utf-8" src="./js/jquery.min.js?version=<?php echo time() ?>"></script>
|
<script charset="utf-8" src="./js/jquery.min.js?version=<?php echo time() ?>"></script>
|
||||||
<script charset="utf-8" src="./js/uikit/uikit.min.js?version=<?php echo time() ?>"></script>
|
<script charset="utf-8" src="./js/uikit/uikit.min.js?version=<?php echo time() ?>"></script>
|
||||||
<script charset="utf-8" src="./js/jstz.min.js?version=<?php echo time() ?>"></script>
|
<script charset="utf-8" src="./js/jstz.min.js?version=<?php echo time() ?>"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="uk-height-1-1">
|
<body class="uk-height-1-1">
|
||||||
<div class="uk-vertical-align uk-text-center uk-height-1-1">
|
<div class="uk-vertical-align uk-text-center uk-height-1-1">
|
||||||
|
@ -637,10 +594,8 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||||
$system = checkSystem();
|
$system = checkSystem();
|
||||||
|
|
||||||
// Missing requirements
|
// Missing requirements
|
||||||
if(!empty($system))
|
if(!empty($system)) {
|
||||||
{
|
foreach($system as $values) {
|
||||||
foreach($system as $values)
|
|
||||||
{
|
|
||||||
echo '<div class="uk-panel">';
|
echo '<div class="uk-panel">';
|
||||||
echo '<div class="uk-panel-badge uk-badge uk-badge-danger">FAIL</div>';
|
echo '<div class="uk-panel-badge uk-badge uk-badge-danger">FAIL</div>';
|
||||||
echo '<h3 class="uk-panel-title">'.$values['title'].'</h3>';
|
echo '<h3 class="uk-panel-title">'.$values['title'].'</h3>';
|
||||||
|
@ -661,7 +616,6 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<form id="jsformInstaller" class="uk-form uk-form-stacked" method="post" action="" autocomplete="off">
|
<form id="jsformInstaller" class="uk-form uk-form-stacked" method="post" action="" autocomplete="off">
|
||||||
<input type="hidden" name="noCheckEmail" id="jsnoCheckEmail" value="0">
|
|
||||||
<input type="hidden" name="timezone" id="jstimezone" value="0">
|
<input type="hidden" name="timezone" id="jstimezone" value="0">
|
||||||
|
|
||||||
<div class="uk-form-row">
|
<div class="uk-form-row">
|
||||||
|
@ -718,19 +672,10 @@ if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Timezone
|
// Timezone
|
||||||
var timezone = jstz.determine();
|
var timezone = jstz.determine();
|
||||||
$("#jstimezone").val( timezone.name() );
|
$("#jstimezone").val( timezone.name() );
|
||||||
|
|
||||||
// Proceed without email field.
|
|
||||||
$("#jscompleteEmail").on("click", function() {
|
|
||||||
|
|
||||||
$("#jsnoCheckEmail").val("1");
|
|
||||||
|
|
||||||
$("#jsformInstaller").submit();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Show password
|
// Show password
|
||||||
$("#jsshowPassword").on("click", function() {
|
$("#jsshowPassword").on("click", function() {
|
||||||
var input = document.getElementById("jspassword");
|
var input = document.getElementById("jspassword");
|
||||||
|
|
Loading…
Reference in New Issue