Updater, Profile Image bug fixes, Catch language files corrupt

This commit is contained in:
dignajar 2015-11-20 00:21:39 -03:00
parent bf53719fca
commit c0ce1c3c31
10 changed files with 69 additions and 28 deletions

View File

@ -46,7 +46,7 @@ class dbJSON
}
}
public function restoreDb()
public function restoreDB()
{
$this->db = $this->dbBackup;
return true;

View File

@ -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

View File

@ -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';
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() ?>">

View File

@ -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'));

View File

@ -22,7 +22,7 @@ function reIndexTagsPosts()
$dbTags->reindexPosts( $dbPosts->db );
// Restore de db on dbPost
$dbPosts->restoreDb();
$dbPosts->restoreDB();
return true;
}

View File

@ -93,14 +93,17 @@ class dbLanguage extends dbJSON
foreach($files as $file)
{
$t = new dbJSON($file, false);
// 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;
}
}

View File

@ -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()
{

View File

@ -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())
);

View File

@ -2,7 +2,7 @@
class dbUsers extends dbJSON
{
private $dbFields = array(
public $dbFields = array(
'firstName'=> array('inFile'=>false, 'value'=>''),
'lastName'=> array('inFile'=>false, 'value'=>''),
'username'=> array('inFile'=>false, 'value'=>''),
@ -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