Bug fixes

This commit is contained in:
Diego Najar 2018-07-28 21:00:12 +02:00
parent bb481498be
commit 5b63241d10
9 changed files with 139 additions and 106 deletions

View File

@ -23,8 +23,7 @@ checkRole(array('admin'));
// ============================================================================
$themeDirname = $layout['parameters'];
if( Sanitize::pathFile(PATH_THEMES.$themeDirname) ) {
// Set the theme
if (Sanitize::pathFile(PATH_THEMES.$themeDirname)) {
$site->set(array('theme'=>$themeDirname));
// Add to syslog

View File

@ -126,7 +126,7 @@ function table($type) {
echo '<td class="pt-3 d-none d-lg-table-cell"><a target="_blank" href="'.$page->permalink().'">'.$friendlyURL.'</a></td>';
echo '<td class="pt-3 text-center d-none d-sm-table-cell">'.PHP_EOL;
echo '<a type="button" class="btn btn-secondary btn-sm" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">Edit</a>'.PHP_EOL;
echo '<a class="btn btn-secondary btn-sm" href="'.HTML_PATH_ADMIN_ROOT.'edit-content/'.$page->key().'">Edit</a>'.PHP_EOL;
echo '<button type="button" class="btn btn-secondary btn-sm deletePageButton" data-toggle="modal" data-target="#jsdeletePageModal" data-key="'.$page->key().'"><span class="oi oi-trash"></span> Delete</button>'.PHP_EOL;
echo '</td>';

View File

@ -12,6 +12,9 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
<li class="nav-item">
<a class="nav-link " id="advanced-tab" data-toggle="tab" href="#advanced" role="tab" aria-controls="advanced" aria-selected="false">Advanced</a>
</li>
<li class="nav-item">
<a class="nav-link " id="seo-tab" data-toggle="tab" href="#seo" role="tab" aria-controls="seo" aria-selected="false">SEO</a>
</li>
<li class="nav-item">
<a class="nav-link " id="social-tab" data-toggle="tab" href="#social" role="tab" aria-controls="social" aria-selected="false">Social Networks</a>
</li>
@ -158,13 +161,65 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
'placeholder'=>'https://'
));
echo Bootstrap::formTitle(array('title'=>$L->g('URL Filters')));
echo Bootstrap::formInputText(array(
'name'=>'uriPage',
'label'=>$L->g('Pages'),
'value'=>$site->uriFilters('page'),
'class'=>'',
'placeholder'=>'',
'tip'=>DOMAIN_PAGES
));
echo Bootstrap::formInputText(array(
'name'=>'uriTag',
'label'=>$L->g('Tags'),
'value'=>$site->uriFilters('tag'),
'class'=>'',
'placeholder'=>'',
'tip'=>DOMAIN_TAGS
));
echo Bootstrap::formInputText(array(
'name'=>'uriCategory',
'label'=>$L->g('Category'),
'value'=>$site->uriFilters('category'),
'class'=>'',
'placeholder'=>'',
'tip'=>DOMAIN_CATEGORIES
));
echo Bootstrap::formInputText(array(
'name'=>'uriBlog',
'label'=>$L->g('Blog'),
'value'=>$site->uriFilters('blog'),
'class'=>'',
'placeholder'=>'',
'tip'=>DOMAIN.$site->uriFilters('blog'),
'disabled'=>!$site->uriFilters('blog')
));
echo '
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'dashboard" role="button">'.$L->g('Cancel').'</a>
</div>
';
?>
</div>
<!-- TABS SEO -->
<div class="tab-pane" id="seo" role="tabpanel" aria-labelledby="seo-tab">
<?php
echo Bootstrap::formTitle(array('title'=>$L->g('Extreme friendly URL')));
echo Bootstrap::formSelect(array(
'name'=>'extremeFriendly',
'label'=>'Allow Unicode',
'options'=>array('true'=>'Enabled', 'false'=>'Disable'),
'selected'=>$site->extremeFriendly(),
'selected'=>($site->extremeFriendly()?'true':'false'),
'class'=>'',
'tip'=>'Allow unicode characters in the URL and some part of the system.'
));
@ -211,45 +266,6 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
'placeholder'=>''
));
echo Bootstrap::formTitle(array('title'=>$L->g('URL Filters')));
echo Bootstrap::formInputText(array(
'name'=>'uriPage',
'label'=>$L->g('Pages'),
'value'=>$site->uriFilters('page'),
'class'=>'',
'placeholder'=>'',
'tip'=>DOMAIN_PAGES
));
echo Bootstrap::formInputText(array(
'name'=>'uriTag',
'label'=>$L->g('Tags'),
'value'=>$site->uriFilters('tag'),
'class'=>'',
'placeholder'=>'',
'tip'=>DOMAIN_TAGS
));
echo Bootstrap::formInputText(array(
'name'=>'uriCategory',
'label'=>$L->g('Category'),
'value'=>$site->uriFilters('category'),
'class'=>'',
'placeholder'=>'',
'tip'=>DOMAIN_CATEGORIES
));
echo Bootstrap::formInputText(array(
'name'=>'uriBlog',
'label'=>$L->g('Blog'),
'value'=>$site->uriFilters('blog'),
'class'=>'',
'placeholder'=>'',
'tip'=>DOMAIN.$site->uriFilters('blog'),
'disabled'=>!$site->uriFilters('blog')
));
echo '
<div class="form-group mt-4">
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>

File diff suppressed because one or more lines are too long

View File

@ -3,42 +3,42 @@
class dbSite extends dbJSON
{
public $dbFields = array(
'title'=> array('inFile'=>false, 'value'=>'I am Guybrush Threepwood, mighty developer'),
'slogan'=> array('inFile'=>false, 'value'=>''),
'description'=> array('inFile'=>false, 'value'=>''),
'footer'=> array('inFile'=>false, 'value'=>'I wanna be a pirate!'),
'itemsPerPage'=> array('inFile'=>false, 'value'=>6),
'language'=> array('inFile'=>false, 'value'=>'en'),
'locale'=> array('inFile'=>false, 'value'=>'en, en_US, en_AU, en_CA, en_GB, en_IE, en_NZ'),
'timezone'=> array('inFile'=>false, 'value'=>'America/Argentina/Buenos_Aires'),
'theme'=> array('inFile'=>false, 'value'=>'pure'),
'adminTheme'=> array('inFile'=>false, 'value'=>'default'),
'homepage'=> array('inFile'=>false, 'value'=>''),
'pageNotFound'=> array('inFile'=>false, 'value'=>''),
'uriPage'=> array('inFile'=>false, 'value'=>'/'),
'uriTag'=> array('inFile'=>false, 'value'=>'/tag/'),
'uriCategory'=> array('inFile'=>false, 'value'=>'/category/'),
'uriBlog'=> array('inFile'=>false, 'value'=>'/blog/'),
'url'=> array('inFile'=>false, 'value'=>''),
'emailFrom'=> array('inFile'=>false, 'value'=>''),
'dateFormat'=> array('inFile'=>false, 'value'=>'F j, Y'),
'timeFormat'=> array('inFile'=>false, 'value'=>'g:i a'),
'currentBuild'=> array('inFile'=>false, 'value'=>0),
'twitter'=> array('inFile'=>false, 'value'=>''),
'facebook'=> array('inFile'=>false, 'value'=>''),
'codepen'=> array('inFile'=>false, 'value'=>''),
'googlePlus'=> array('inFile'=>false, 'value'=>''),
'instagram'=> array('inFile'=>false, 'value'=>''),
'github'=> array('inFile'=>false, 'value'=>''),
'gitlab'=> array('inFile'=>false, 'value'=>''),
'linkedin'=> array('inFile'=>false, 'value'=>''),
'orderBy'=> array('inFile'=>false, 'value'=>'date'), // date or position
'extremeFriendly'=> array('inFile'=>false, 'value'=>true),
'autosaveInterval'=> array('inFile'=>false, 'value'=>2),
'titleFormatHomepage'=> array('inFile'=>false, 'value'=>'{{site-slogan}} | {{site-title}}'),
'titleFormatPages'=> array('inFile'=>false, 'value'=>'{{page-title}} | {{site-title}}'),
'titleFormatCategory'=> array('inFile'=>false, 'value'=>'{{category-name}} | {{site-title}}'),
'titleFormatTag'=> array('inFile'=>false, 'value'=>'{{tag-name}} | {{site-title}}')
'title'=> 'I am Guybrush Threepwood, mighty developer',
'slogan'=> '',
'description'=> '',
'footer'=> 'I wanna be a pirate!',
'itemsPerPage'=> 6,
'language'=> 'en',
'locale'=> 'en, en_US, en_AU, en_CA, en_GB, en_IE, en_NZ',
'timezone'=> 'America/Argentina/Buenos_Aires',
'theme'=> 'pure',
'adminTheme'=> 'default',
'homepage'=> '',
'pageNotFound'=> '',
'uriPage'=> '/',
'uriTag'=> '/tag/',
'uriCategory'=> '/category/',
'uriBlog'=> '/blog/',
'url'=> '',
'emailFrom'=> '',
'dateFormat'=> 'F j, Y',
'timeFormat'=> 'g:i a',
'currentBuild'=> 0,
'twitter'=> '',
'facebook'=> '',
'codepen'=> '',
'googlePlus'=> '',
'instagram'=> '',
'github'=> '',
'gitlab'=> '',
'linkedin'=> '',
'orderBy'=> 'date', // date or position
'extremeFriendly'=> true,
'autosaveInterval'=> 2, // minutes
'titleFormatHomepage'=> '{{site-slogan}} | {{site-title}}',
'titleFormatPages'=> '{{page-title}} | {{site-title}}',
'titleFormatCategory'=> '{{category-name}} | {{site-title}}',
'titleFormatTag'=> '{{tag-name}} | {{site-title}}'
);
function __construct()
@ -60,12 +60,15 @@ class dbSite extends dbJSON
public function set($args)
{
foreach ($args as $field=>$value) {
if (isset($this->dbFields[$field])) {
$this->db[$field] = Sanitize::html($value);
// Check values on args or set default values
foreach ($this->dbFields as $field=>$value) {
if (isset($args[$field])) {
// Sanitize if will be stored on database
$finalValue = Sanitize::html($args[$field]);
settype($finalValue, gettype($value));
$this->db[$field] = $finalValue;
}
}
return $this->save();
}

View File

@ -568,6 +568,8 @@ function editSettings($args) {
$args['uriBlog'] = '';
}
$args['extremeFriendly'] = (($args['extremeFriendly']=='true')?true:false);
if ($site->set($args)) {
// Check current order-by if changed it reorder the content
if ($site->orderBy()!=ORDER_BY) {

File diff suppressed because one or more lines are too long

View File

@ -317,7 +317,7 @@ function install($adminPassword, $timezone)
'description'=>'',
'username'=>'admin',
'tags'=>array(),
'type'=>'published',
'type'=>(($slug=='example-page-4-slug')?'static':'published'),
'date'=>$currentDate,
'dateModified'=>'',
'allowComments'=>true,
@ -378,7 +378,11 @@ function install($adminPassword, $timezone)
'linkedin'=>'',
'dateFormat'=>'F j, Y',
'extremeFriendly'=>true,
'autosaveInterval'=>2
'autosaveInterval'=>2,
'titleFormatHomepage'=>'{{site-slogan}} | {{site-title}}',
'titleFormatPages'=>'{{page-title}} | {{site-title}}',
'titleFormatCategory'=>'{{category-name}} | {{site-title}}',
'titleFormatTag'=>'{{tag-name}} | {{site-title}}'
);
file_put_contents(PATH_DATABASES.'site.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);
@ -389,6 +393,7 @@ function install($adminPassword, $timezone)
$data = array(
'admin'=>array(
'nickname'=>'Admin',
'firstName'=>$Language->get('Administrator'),
'lastName'=>'',
'role'=>'admin',
@ -402,7 +407,11 @@ function install($adminPassword, $timezone)
'twitter'=>'',
'facebook'=>'',
'googlePlus'=>'',
'instagram'=>''
'instagram'=>'',
'codepen'=>'',
'linkedin'=>'',
'github'=>'',
'gitlab'=>''
)
);
file_put_contents(PATH_DATABASES.'users.php', $dataHead.json_encode($data, JSON_PRETTY_PRINT), LOCK_EX);

View File

@ -6,25 +6,29 @@ Things to do:
- settings->advanced->Predefined pages->Page not found
-- Search and select a page
- settings->plugins->settings
-- Update plugins to use Bootstrap on the CSS
- settings->plugins->change order of plugins
-- not implemented
- manage->users->edit user
-- Change profile avatar
- new content -> options -> Advanced
-- Date, javascript for select the date
--
- Fix Tinymce plugin
- Edit content
-- If the parent is set, the
- add to settings
- Add to Settings
-- time for autosave
-- time for check user logged
-- thumbnails sizes and compression
- Plugin Links
-- Update CSS for Bootstrap
- Plugin sitemap
-- Update CSS for Bootstrap
- Plugin remote content
-- Refactor with the new database
- Filter by tags is not working
- Plugin timemachine
-- Update CSS for Bootstrap
- Plugin updater
- Cover Image
-- Check better way to select an image