Updater, Profile Image bug fixes, Catch language files corrupt
This commit is contained in:
parent
bf53719fca
commit
c0ce1c3c31
|
@ -46,7 +46,7 @@ class dbJSON
|
|||
}
|
||||
}
|
||||
|
||||
public function restoreDb()
|
||||
public function restoreDB()
|
||||
{
|
||||
$this->db = $this->dbBackup;
|
||||
return true;
|
||||
|
|
|
@ -3,6 +3,28 @@
|
|||
// ============================================================================
|
||||
// Functions
|
||||
// ============================================================================
|
||||
function updateBludit()
|
||||
{
|
||||
global $Site;
|
||||
|
||||
// Check if Bludit need to be update.
|
||||
if($Site->currentBuild() < BLUDIT_BUILD)
|
||||
{
|
||||
$directories = array(PATH_POSTS, PATH_PAGES, PATH_PLUGINS_DATABASES, PATH_UPLOADS_PROFILES);
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Main before POST
|
||||
|
@ -16,6 +38,10 @@
|
|||
// Main after POST
|
||||
// ============================================================================
|
||||
|
||||
// Try update Bludit
|
||||
updateBludit();
|
||||
|
||||
// Get draft posts and schedules
|
||||
$_draftPosts = array();
|
||||
$_scheduledPosts = array();
|
||||
foreach($posts as $Post)
|
||||
|
@ -28,6 +54,7 @@ foreach($posts as $Post)
|
|||
}
|
||||
}
|
||||
|
||||
// Get draft pages
|
||||
$_draftPages = array();
|
||||
foreach($pages as $Page)
|
||||
{
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
|
@ -99,9 +99,9 @@ $(document).ready(function() {
|
|||
<ul class="uk-navbar-nav">
|
||||
<li class="uk-parent" data-uk-dropdown>
|
||||
<?php
|
||||
$profilePictureSrc = HTML_PATH_UPLOADS_PROFILES.$Login->username().'.jpg';
|
||||
if(!file_exists($profilePictureSrc)) {
|
||||
$profilePictureSrc = HTML_PATH_ADMIN_THEME_IMG.'default.jpg';
|
||||
$profilePictureSrc = HTML_PATH_ADMIN_THEME_IMG.'default.jpg';
|
||||
if(file_exists(PATH_UPLOADS_PROFILES.$Login->username().'.jpg')) {
|
||||
$profilePictureSrc = HTML_PATH_UPLOADS_PROFILES.$Login->username().'.jpg';
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$Login->username() ?>">
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
define('BLUDIT_VERSION', 'githubVersion');
|
||||
define('BLUDIT_CODENAME', '');
|
||||
define('BLUDIT_RELEASE_DATE', '');
|
||||
define('BLUDIT_BUILD', '20151119');
|
||||
|
||||
// Debug mode
|
||||
define('DEBUG_MODE', TRUE);
|
||||
|
@ -85,6 +86,9 @@ define('TOKEN_EMAIL_TTL', '+15 minutes');
|
|||
// Charset, default UTF-8.
|
||||
define('CHARSET', 'UTF-8');
|
||||
|
||||
// Directory permissions
|
||||
define('DIR_PERMISSIONS', '0755');
|
||||
|
||||
// Multibyte string extension loaded.
|
||||
define('MB_STRING', extension_loaded('mbstring'));
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ function reIndexTagsPosts()
|
|||
$dbTags->reindexPosts( $dbPosts->db );
|
||||
|
||||
// Restore de db on dbPost
|
||||
$dbPosts->restoreDb();
|
||||
$dbPosts->restoreDB();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -93,14 +93,17 @@ class dbLanguage extends dbJSON
|
|||
|
||||
foreach($files as $file)
|
||||
{
|
||||
|
||||
$t = new dbJSON($file, false);
|
||||
$native = $t->db['language-data']['native'];
|
||||
$locale = basename($file, '.json');
|
||||
$tmp[$locale] = $native;
|
||||
|
||||
// Check if the JSON is complete.
|
||||
if(isset($t->db['language-data']['native']))
|
||||
{
|
||||
$native = $t->db['language-data']['native'];
|
||||
$locale = basename($file, '.json');
|
||||
$tmp[$locale] = $native;
|
||||
}
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
}
|
|
@ -21,7 +21,8 @@ class dbSite extends dbJSON
|
|||
'cliMode'=> array('inFile'=>false, 'value'=>true),
|
||||
'emailFrom'=> array('inFile'=>false, 'value'=>''),
|
||||
'dateFormat'=> array('inFile'=>false, 'value'=>'F j, Y'),
|
||||
'timeFormat'=> array('inFile'=>false, 'value'=>'g:i a')
|
||||
'timeFormat'=> array('inFile'=>false, 'value'=>'g:i a'),
|
||||
'currentBuild'=> array('inFile'=>false, 'value'=>0)
|
||||
);
|
||||
|
||||
function __construct()
|
||||
|
@ -167,6 +168,12 @@ class dbSite extends dbJSON
|
|||
return $this->getField('timezone');
|
||||
}
|
||||
|
||||
// Returns the current build / version of Bludit.
|
||||
public function currentBuild()
|
||||
{
|
||||
return $this->getField('currentBuild');
|
||||
}
|
||||
|
||||
// Returns posts per page.
|
||||
public function postsPerPage()
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ class dbTags extends dbJSON
|
|||
$postsIndex['tag2']['name'] = 'Tag 2';
|
||||
$postsIndex['tag2']['posts'] = array('post1','post5');
|
||||
*/
|
||||
private $dbFields = array(
|
||||
public $dbFields = array(
|
||||
'postsIndex'=>array('inFile'=>false, 'value'=>array()),
|
||||
'pagesIndex'=>array('inFile'=>false, 'value'=>array())
|
||||
);
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
class dbUsers extends dbJSON
|
||||
{
|
||||
private $dbFields = array(
|
||||
'firstName'=> array('inFile'=>false, 'value'=>''),
|
||||
'lastName'=> array('inFile'=>false, 'value'=>''),
|
||||
'username'=> array('inFile'=>false, 'value'=>''),
|
||||
'role'=> array('inFile'=>false, 'value'=>'editor'),
|
||||
'password'=> array('inFile'=>false, 'value'=>''),
|
||||
'salt'=> array('inFile'=>false, 'value'=>'!Pink Floyd!Welcome to the machine!'),
|
||||
'email'=> array('inFile'=>false, 'value'=>''),
|
||||
'registered'=> array('inFile'=>false, 'value'=>'1985-03-15 10:00'),
|
||||
'tokenEmail'=> array('inFile'=>false, 'value'=>''),
|
||||
'tokenEmailTTL'=>array('inFile'=>false, 'value'=>'2009-03-15 14:00')
|
||||
public $dbFields = array(
|
||||
'firstName'=> array('inFile'=>false, 'value'=>''),
|
||||
'lastName'=> array('inFile'=>false, 'value'=>''),
|
||||
'username'=> array('inFile'=>false, 'value'=>''),
|
||||
'role'=> array('inFile'=>false, 'value'=>'editor'),
|
||||
'password'=> array('inFile'=>false, 'value'=>''),
|
||||
'salt'=> array('inFile'=>false, 'value'=>'!Pink Floyd!Welcome to the machine!'),
|
||||
'email'=> array('inFile'=>false, 'value'=>''),
|
||||
'registered'=> array('inFile'=>false, 'value'=>'1985-03-15 10:00'),
|
||||
'tokenEmail'=> array('inFile'=>false, 'value'=>''),
|
||||
'tokenEmailTTL'=> array('inFile'=>false, 'value'=>'2009-03-15 14:00')
|
||||
);
|
||||
|
||||
function __construct()
|
||||
|
@ -20,6 +20,11 @@ class dbUsers extends dbJSON
|
|||
parent::__construct(PATH_DATABASES.'users.php');
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
// Return an array with the username databases, filtered by username.
|
||||
public function getDb($username)
|
||||
{
|
||||
|
@ -51,11 +56,6 @@ class dbUsers extends dbJSON
|
|||
return isset($this->db[$username]);
|
||||
}
|
||||
|
||||
public function getAll()
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
public function generateTokenEmail($username)
|
||||
{
|
||||
// Random hash
|
||||
|
|
Loading…
Reference in New Issue