Changes on admin panel, categories templates
This commit is contained in:
parent
ab1d795259
commit
75a7190ca0
@ -6,10 +6,12 @@ Database structure
|
|||||||
{
|
{
|
||||||
"videos": {
|
"videos": {
|
||||||
"name": "Videos",
|
"name": "Videos",
|
||||||
|
"template: "",
|
||||||
"list": [ "my-page", "second-page" ]
|
"list": [ "my-page", "second-page" ]
|
||||||
},
|
},
|
||||||
"pets": {
|
"pets": {
|
||||||
"name": "Pets",
|
"name": "Pets",
|
||||||
|
"template: "",
|
||||||
"list": [ "cats-and-dogs" ]
|
"list": [ "cats-and-dogs" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,77 +26,62 @@ class dbList extends dbJSON
|
|||||||
parent::__construct($file);
|
parent::__construct($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an array with a list of key of pages, FALSE if out of range
|
// Returns the list of keys filter by pageNumber
|
||||||
public function getList($key, $pageNumber, $amountOfItems)
|
public function getList($key, $pageNumber, $amountOfItems)
|
||||||
{
|
{
|
||||||
if (empty($key)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($this->db[$key])) {
|
if (!isset($this->db[$key])) {
|
||||||
Log::set(__METHOD__.LOG_SEP.'Error key does not exist '.$key);
|
Log::set(__METHOD__.LOG_SEP.'Error key does not exist '.$key);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List of keys
|
||||||
$list = $this->db[$key]['list'];
|
$list = $this->db[$key]['list'];
|
||||||
|
|
||||||
|
// Returns all the items from the list
|
||||||
if ($amountOfItems==-1) {
|
if ($amountOfItems==-1) {
|
||||||
// Invert keys to values, is necesary returns as key the key pages
|
// Invert keys to values, is necesary returns as key the key pages
|
||||||
//$list = array_flip($list);
|
$list = array_flip($list);
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The first page number is 1, so the real is 0
|
// The first page number is 1, so the real is 0
|
||||||
$realPageNumber = $pageNumber - 1;
|
$realPageNumber = $pageNumber - 1;
|
||||||
|
$chunks = array_chunk($list, $realPageNumber);
|
||||||
$total = count($list);
|
if (isset($chunks[$realPageNumber])) {
|
||||||
$init = (int) $amountOfItems * $realPageNumber;
|
return $chunks[$realPageNumber];
|
||||||
$end = (int) min( ($init + $amountOfItems - 1), $total );
|
|
||||||
$outrange = $init<0 ? true : $init>$end;
|
|
||||||
|
|
||||||
if($outrange) {
|
|
||||||
Log::set(__METHOD__.LOG_SEP.'Error out of range');
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//$list = array_flip($list);
|
// Out of index,returns FALSE
|
||||||
return array_slice($list, $init, $amountOfItems, true);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateKey($name)
|
public function generateKey($name)
|
||||||
{
|
{
|
||||||
$key = Text::cleanUrl($name);
|
$key = Text::cleanUrl($name);
|
||||||
if (empty($key)) {
|
while (isset($this->db[$key])) {
|
||||||
return false;
|
$key++;
|
||||||
}
|
}
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add($name)
|
// Add a new item to the dblist
|
||||||
|
// $args => 'name', 'template', 'list'
|
||||||
|
public function add($args)
|
||||||
{
|
{
|
||||||
$key = $this->generateKey($name);
|
$key = $this->generateKey($args['name']);
|
||||||
if ($key===false) {
|
|
||||||
Log::set(__METHOD__.LOG_SEP.'Error when try to generate the key');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($this->db[$key])) {
|
$this->db[$key]['name'] = $args['name'];
|
||||||
Log::set(__METHOD__.LOG_SEP.'Error key already exists: '.$key);
|
$this->db[$key]['template'] = isset($args['template'])?$args['template']:'';
|
||||||
return false;
|
$this->db[$key]['list'] = isset($args['list'])?$args['list']:array();
|
||||||
}
|
|
||||||
|
|
||||||
$this->db[$key]['name'] = Sanitize::html($name);
|
|
||||||
$this->db[$key]['list'] = array();
|
|
||||||
|
|
||||||
$this->sortAlphanumeric();
|
$this->sortAlphanumeric();
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
return $key;
|
return $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function remove($key)
|
public function remove($key)
|
||||||
{
|
{
|
||||||
if( !isset($this->db[$key]) ) {
|
if (!isset($this->db[$key])) {
|
||||||
Log::set(__METHOD__.LOG_SEP.'The key does not exist, key: '.$key);
|
Log::set(__METHOD__.LOG_SEP.'The key does not exist, key: '.$key);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -103,41 +90,27 @@ class dbList extends dbJSON
|
|||||||
return $this->save();
|
return $this->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($oldKey, $newName)
|
// Edit an item to the dblist
|
||||||
|
// $args => 'name', 'oldkey', 'newKey', 'template'
|
||||||
|
public function edit($args)
|
||||||
{
|
{
|
||||||
$newKey = $this->generateKey($newName);
|
if (isset($this->db[$args['newKey']])) {
|
||||||
|
Log::set(__METHOD__.LOG_SEP.'The new key already exists. Key: '.$args['newKey']);
|
||||||
$this->db[$newKey]['name'] = Sanitize::html($newName);
|
|
||||||
$this->db[$newKey]['list'] = $this->db[$oldKey]['list'];
|
|
||||||
|
|
||||||
// Remove the old key
|
|
||||||
if ($oldKey!=$newKey) {
|
|
||||||
unset( $this->db[$oldKey] );
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->sortAlphanumeric();
|
|
||||||
$this->save();
|
|
||||||
return $newKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function changeKey($oldKey, $newKey)
|
|
||||||
{
|
|
||||||
if ($this->exists($newKey)) {
|
|
||||||
Log::set(__METHOD__.LOG_SEP.'Error key already exists: '.$newKey);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db[$newKey]['name'] = $this->db[$oldKey]['name'];
|
$this->db[$args['newKey']]['name'] = $args['name'];
|
||||||
$this->db[$newKey]['list'] = $this->db[$oldKey]['list'];
|
$this->db[$args['newKey']]['template'] = isset($args['template'])?$args['template']:'';
|
||||||
|
$this->db[$args['newKey']]['list'] = $this->db[$args['oldKey']]['list'];
|
||||||
|
|
||||||
// Remove the old key
|
// Remove the old category
|
||||||
if ($oldKey!=$newKey) {
|
if ($args['oldKey'] !== $args['newKey']) {
|
||||||
unset( $this->db[$oldKey] );
|
unset( $this->db[$args['oldKey']] );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sortAlphanumeric();
|
$this->sortAlphanumeric();
|
||||||
$this->save();
|
$this->save();
|
||||||
return $newKey;
|
return $args['newKey'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort the categories by "Natural order"
|
// Sort the categories by "Natural order"
|
||||||
@ -150,10 +123,9 @@ class dbList extends dbJSON
|
|||||||
// Returns the name associated to the key, FALSE if the key doesn't exist
|
// Returns the name associated to the key, FALSE if the key doesn't exist
|
||||||
public function getName($key)
|
public function getName($key)
|
||||||
{
|
{
|
||||||
if( isset($this->db[$key]) ) {
|
if (isset($this->db[$key])) {
|
||||||
return $this->db[$key]['name'];
|
return $this->db[$key]['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +136,6 @@ class dbList extends dbJSON
|
|||||||
foreach($this->db as $key=>$fields) {
|
foreach($this->db as $key=>$fields) {
|
||||||
$tmp[$key] = $fields['name'];
|
$tmp[$key] = $fields['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $tmp;
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +145,6 @@ class dbList extends dbJSON
|
|||||||
if( isset($this->db[$key]) ) {
|
if( isset($this->db[$key]) ) {
|
||||||
return count($this->db[$key]['list']);
|
return count($this->db[$key]['list']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,14 +153,25 @@ class dbList extends dbJSON
|
|||||||
return isset( $this->db[$key] );
|
return isset( $this->db[$key] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function existsName($name)
|
||||||
|
{
|
||||||
|
foreach ($this->db as $key=>$fields) {
|
||||||
|
if ($name==$fields['name']) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns an array with a portion of the database filtered by key
|
// Returns an array with a portion of the database filtered by key
|
||||||
// Returns array( 'name'=>'', 'list'=>array() )
|
// Returns array( 'key'=>'', 'name'=>'', 'template'=>'', 'list'=>array() )
|
||||||
public function getMap($key)
|
public function getMap($key)
|
||||||
{
|
{
|
||||||
if( isset($this->db[$key]) ) {
|
if (isset($this->db[$key])) {
|
||||||
return $this->db[$key];
|
$tmp = $this->db[$key];
|
||||||
|
$tmp['key'] = $key;
|
||||||
|
return $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ if (!$dbCategories->exists($categoryKey)) {
|
|||||||
Redirect::page('categories');
|
Redirect::page('categories');
|
||||||
}
|
}
|
||||||
|
|
||||||
$categoryName = $dbCategories->getName($layout['parameters']);
|
$categoryMap = $dbCategories->getMap($categoryKey);
|
||||||
|
|
||||||
// Title of the page
|
// Title of the page
|
||||||
$layout['title'] .= ' - '.$Language->g('Edit Category').' - '.$categoryName;
|
$layout['title'] .= ' - '.$Language->g('Edit Category').' [ '.$categoryMap['name'] . ' ] ';
|
@ -12,21 +12,20 @@
|
|||||||
// POST Method
|
// POST Method
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
if( $_SERVER['REQUEST_METHOD'] == 'POST' )
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
{
|
|
||||||
// Prevent non-administrators to change other users
|
// Prevent non-administrators to change other users
|
||||||
if($Login->role()!=='admin') {
|
if ($Login->role()!=='admin') {
|
||||||
$_POST['username'] = $Login->username();
|
$_POST['username'] = $Login->username();
|
||||||
unset($_POST['role']);
|
unset($_POST['role']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST['delete-user-all'])) {
|
if (isset($_POST['delete-user-all'])) {
|
||||||
deleteUser($_POST, $deleteContent=true);
|
deleteUser($_POST, $deleteContent=true);
|
||||||
}
|
}
|
||||||
elseif(isset($_POST['delete-user-associate'])) {
|
elseif (isset($_POST['delete-user-associate'])) {
|
||||||
deleteUser($_POST, $deleteContent=false);
|
deleteUser($_POST, $deleteContent=false);
|
||||||
}
|
}
|
||||||
elseif(isset($_POST['disable-user'])) {
|
elseif (isset($_POST['disable-user'])) {
|
||||||
disableUser($_POST['username']);
|
disableUser($_POST['username']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -23,31 +23,12 @@ if ($Login->role()!=='admin') {
|
|||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
editSettings($_POST);
|
editSettings($_POST);
|
||||||
Redirect::page('settings-advanced');
|
Redirect::page('settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Main after POST
|
// Main after POST
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
$allPages = buildAllpages($publishedPages=true, $staticPages=true, $draftPages=false, $scheduledPages=false);
|
|
||||||
|
|
||||||
// Generate $pagesByParentByKey and pagesByParent
|
|
||||||
$pagesByParent = array(PARENT=>array());
|
|
||||||
$pagesByParentByKey = array(PARENT=>array());
|
|
||||||
buildPagesByParent(true, true);
|
|
||||||
|
|
||||||
// Homepage select options
|
|
||||||
$homepageOptions = array(' '=>'- '.$L->g('Default').' -');
|
|
||||||
foreach ($allPages as $key=>$page) {
|
|
||||||
$parentKey = $page->parentKey();
|
|
||||||
if ($parentKey) {
|
|
||||||
$homepageOptions[$key] = $pagesByParentByKey[PARENT][$parentKey]->title() .'->'. $page->title();
|
|
||||||
} else {
|
|
||||||
$homepageOptions[$key] = $page->title();
|
|
||||||
}
|
|
||||||
|
|
||||||
ksort($homepageOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Title of the page
|
// Title of the page
|
||||||
$layout['title'] .= ' - '.$Language->g('Advanced Settings');
|
$layout['title'] .= ' - '.$Language->g('Advanced Settings');
|
@ -57,8 +57,8 @@
|
|||||||
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
|
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
|
||||||
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
|
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
|
||||||
} else {
|
} else {
|
||||||
echo '<h1 style="width:100%; text-align:center">'.$L->g('Page not found').'</h1>';
|
echo '<h1 class="text-center">'.$L->g('Page not found').'</h1>';
|
||||||
echo '<h2 style="width:100%; text-align:center">'.$L->g('Choose a page from the sidebar.').'</h2>';
|
echo '<h2 class="text-center">'.$L->g('Choose a page from the sidebar.').'</h2>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,40 +45,51 @@ class Bootstrap {
|
|||||||
|
|
||||||
public static function pageTitle($args)
|
public static function pageTitle($args)
|
||||||
{
|
{
|
||||||
return '<h2 class="mt-0 mb-3"><span class="oi oi-'.$args['icon'].'" style="font-size: 0.7em;"></span> '.$args['title'].'</h2>';
|
$icon = $args['icon'];
|
||||||
|
$title = $args['title'];
|
||||||
|
return <<<EOF
|
||||||
|
<h2 class="mt-0 mb-3">
|
||||||
|
<span class="oi oi-$icon" style="font-size: 0.7em;"></span> $title
|
||||||
|
</h2>
|
||||||
|
EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function formOpen($args)
|
public static function formOpen($args)
|
||||||
{
|
{
|
||||||
$class = empty($args['class']) ? '' : ' '.$args['class'];
|
$class = empty($args['class'])?'':'class="'.$args['class'].'"';
|
||||||
$id = empty($args['id']) ? '' : ' id="'.$args['id'].'" ';
|
$id = empty($args['id'])?'':'id="'.$args['id'].'"';
|
||||||
$enctype = empty($args['enctype']) ? '' : ' enctype="'.$args['enctype'].'" ';
|
$enctype = empty($args['enctype'])?'':'enctype="'.$args['enctype'].'"';
|
||||||
|
$action = empty($args['action'])?'action=""':'action="'.$args['action'].'"';
|
||||||
|
$method = empty($args['method'])?'method="post"':'method="'.$args['method'].'"';
|
||||||
|
|
||||||
$html = '<form class="'.$class.'" '.$enctype.$id.' method="post" action="" autocomplete="off">';
|
return <<<EOF
|
||||||
return $html;
|
<form $class $enctype $id $method $action autocomplete="off">
|
||||||
|
EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function formClose()
|
public static function formClose()
|
||||||
{
|
{
|
||||||
$html = '</form>';
|
return <<<EOF
|
||||||
|
</form>
|
||||||
$script = '<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Prevent the form submit when press enter key.
|
// Prevent the form submit when press enter key.
|
||||||
$("form").keypress(function(e) {
|
$("form").keypress(function(e) {
|
||||||
if ((e.which == 13) && (e.target.type !== "textarea")) {
|
if ((e.which == 13) && (e.target.type !== "textarea")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>';
|
</script>
|
||||||
|
EOF;
|
||||||
return $html.$script;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function formTitle($args)
|
public static function formTitle($args)
|
||||||
{
|
{
|
||||||
return '<h4 class="mt-4 mb-3">'.$args['title'].'</h4>';
|
$title = $args['title'];
|
||||||
|
return <<<EOF
|
||||||
|
<h4 class="mt-4 mb-3 font-weight-normal">$title</h4>
|
||||||
|
EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function formInputTextBlock($args)
|
public static function formInputTextBlock($args)
|
||||||
@ -188,31 +199,36 @@ EOF;
|
|||||||
|
|
||||||
public static function formInputText($args)
|
public static function formInputText($args)
|
||||||
{
|
{
|
||||||
$id = 'js'.$args['name'];
|
$label = isset($args['label'])?$args['label']:'';
|
||||||
|
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
|
||||||
|
$tip = isset($args['tip'])?$args['tip']:'';
|
||||||
|
$value = isset($args['value'])?$args['value']:'';
|
||||||
|
$name = $args['name'];
|
||||||
|
$id = 'js'.$name;
|
||||||
if (isset($args['id'])) {
|
if (isset($args['id'])) {
|
||||||
$id = $args['id'];
|
$id = $args['id'];
|
||||||
}
|
}
|
||||||
|
$disabled = isset($args['disabled'])?'disabled':'';
|
||||||
|
|
||||||
$class = 'form-control';
|
$class = 'form-control';
|
||||||
if (isset($args['class'])) {
|
if (isset($args['class'])) {
|
||||||
$class = $class.' '.$args['class'];
|
$class = $class.' '.$args['class'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = '<div class="form-group row">';
|
$type = 'text';
|
||||||
|
if (isset($args['type'])) {
|
||||||
if (isset($args['label'])) {
|
$type = $args['type'];
|
||||||
$html .= '<label for="'.$id.'" class="col-sm-2 col-form-label">'.$args['label'].'</label>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= '<div class="col-sm-10">';
|
return <<<EOF
|
||||||
$html .= '<input type="text" class="'.$class.'" id="'.$id.'" name="'.$args['name'].'" placeholder="'.$args['placeholder'].'">';
|
<div class="form-group row">
|
||||||
if (isset($args['tip'])) {
|
<label for="$id" class="col-sm-2 col-form-label">$label</label>
|
||||||
$html .= '<small class="form-text text-muted">'.$args['tip'].'</small>';
|
<div class="col-sm-10">
|
||||||
}
|
<input class="$class" id="$id" name="$name" value="$value" placeholder="$placeholder" type="$type" $disabled>
|
||||||
$html .= '</div>';
|
<small class="form-text text-muted">$tip</small>
|
||||||
$html .= '</div>';
|
</div>
|
||||||
|
</div>
|
||||||
return $html;
|
EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function formSelect($args)
|
public static function formSelect($args)
|
||||||
|
@ -10,29 +10,33 @@ echo Bootstrap::formOpen(array());
|
|||||||
));
|
));
|
||||||
|
|
||||||
echo Bootstrap::formInputHidden(array(
|
echo Bootstrap::formInputHidden(array(
|
||||||
'name'=>'oldCategoryName',
|
'name'=>'oldKey',
|
||||||
'value'=>$categoryName
|
'value'=>$categoryMap['key']
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputHidden(array(
|
|
||||||
'name'=>'oldCategoryKey',
|
|
||||||
'value'=>$categoryKey
|
|
||||||
));
|
));
|
||||||
|
|
||||||
echo Bootstrap::formInputTextBlock(array(
|
echo Bootstrap::formInputTextBlock(array(
|
||||||
'name'=>'categoryName',
|
'name'=>'name',
|
||||||
'label'=>$L->g('Category name'),
|
'label'=>$L->g('Category name'),
|
||||||
'value'=>$categoryName,
|
'value'=>$categoryMap['name'],
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
'placeholder'=>'',
|
'placeholder'=>'',
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
echo Bootstrap::formInputGroupText(array(
|
echo Bootstrap::formInputGroupText(array(
|
||||||
'name'=>'categoryKey',
|
'name'=>'newKey',
|
||||||
'label'=>$L->g('Category key'),
|
'label'=>$L->g('Category key'),
|
||||||
'labelInside'=>DOMAIN_CATEGORIES,
|
'labelInside'=>DOMAIN_CATEGORIES,
|
||||||
'value'=>$categoryKey,
|
'value'=>$categoryMap['key'],
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputTextBlock(array(
|
||||||
|
'name'=>'template',
|
||||||
|
'label'=>$L->g('Category template'),
|
||||||
|
'value'=>isset($categoryMap['template'])?$categoryMap['template']:'',
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
'placeholder'=>'',
|
'placeholder'=>'',
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
|
@ -1,60 +1,66 @@
|
|||||||
<?php
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||||
|
|
||||||
HTML::title(array('title'=>$L->g('Add a new user'), 'icon'=>'user-plus'));
|
echo Bootstrap::pageTitle(array('title'=>$L->g('Add a new user'), 'icon'=>'person'));
|
||||||
|
|
||||||
HTML::formOpen(array('id'=>'add-user-form', 'class'=>'uk-form-horizontal'));
|
echo Bootstrap::formOpen(array());
|
||||||
|
|
||||||
// Security token
|
echo Bootstrap::formInputHidden(array(
|
||||||
HTML::formInputHidden(array(
|
|
||||||
'name'=>'tokenCSRF',
|
'name'=>'tokenCSRF',
|
||||||
'value'=>$Security->getTokenCSRF()
|
'value'=>$Security->getTokenCSRF()
|
||||||
));
|
));
|
||||||
|
|
||||||
HTML::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'new_username',
|
'name'=>'new_username',
|
||||||
'label'=>$L->g('Username'),
|
'label'=>$L->g('Username'),
|
||||||
'value'=>(isset($_POST['new_username'])?$_POST['new_username']:''),
|
'value'=>(isset($_POST['new_username'])?$_POST['new_username']:''),
|
||||||
'class'=>'uk-width-1-2 uk-form-medium',
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
HTML::formInputPassword(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'new_password',
|
'name'=>'new_password',
|
||||||
|
'type'=>'password',
|
||||||
'label'=>$L->g('Password'),
|
'label'=>$L->g('Password'),
|
||||||
'value'=>'',
|
'value'=>'',
|
||||||
'class'=>'uk-width-1-2 uk-form-medium',
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
HTML::formInputPassword(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'confirm_password',
|
'name'=>'confirm_password',
|
||||||
|
'type'=>'password',
|
||||||
'label'=>$L->g('Confirm Password'),
|
'label'=>$L->g('Confirm Password'),
|
||||||
'value'=>'',
|
'value'=>'',
|
||||||
'class'=>'uk-width-1-2 uk-form-medium',
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
HTML::formSelect(array(
|
echo Bootstrap::formSelect(array(
|
||||||
'name'=>'role',
|
'name'=>'role',
|
||||||
'label'=>$L->g('Role'),
|
'label'=>$L->g('Role'),
|
||||||
'options'=>array('editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
|
'options'=>array('editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
|
||||||
'selected'=>'editor',
|
'selected'=>'editor',
|
||||||
|
'class'=>'',
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
HTML::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'email',
|
'name'=>'email',
|
||||||
'label'=>$L->g('Email'),
|
'label'=>$L->g('Email'),
|
||||||
'value'=>(isset($_POST['email'])?$_POST['email']:''),
|
'value'=>(isset($_POST['email'])?$_POST['email']:''),
|
||||||
'class'=>'uk-width-1-2 uk-form-medium',
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
echo '<div class="uk-form-row">
|
echo '
|
||||||
<div class="uk-form-controls">
|
<div class="form-group mt-4">
|
||||||
<button type="submit" class="uk-button uk-button-primary">'.$L->g('Save').'</button>
|
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
|
||||||
<a href="'.HTML_PATH_ADMIN_ROOT.'users" class="uk-button">'.$L->g('Cancel').'</a>
|
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'users" role="button">'.$L->g('Cancel').'</a>
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
';
|
||||||
|
|
||||||
HTML::formClose();
|
echo Bootstrap::formClose();
|
@ -1,58 +1,61 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
HTML::title(array('title'=>$L->g('Plugins'), 'icon'=>'puzzle-piece'));
|
echo Bootstrap::pageTitle(array('title'=>$L->g('Plugins'), 'icon'=>'puzzle-piece'));
|
||||||
|
|
||||||
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'plugins-position"><i class="uk-icon-plus"></i> '.$L->g('Change the position of the plugins').'</a>';
|
echo Bootstrap::link(array(
|
||||||
|
'title'=>$L->g('Change the position of the plugins'),
|
||||||
|
'href'=>HTML_PATH_ADMIN_ROOT.'plugins-position',
|
||||||
|
'icon'=>'elevator'
|
||||||
|
));
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<table class="uk-table">
|
<table class="table mt-3">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="uk-width-1-5">'.$L->g('Name').'</th>
|
<th class="border-bottom-0 w-25" scope="col">'.$L->g('Name').'</th>
|
||||||
<th class="uk-width-3-5">'.$L->g('Description').'</th>
|
<th class="border-bottom-0" scope="col">'.$L->g('Description').'</th>
|
||||||
<th class="uk-text-center">'.$L->g('Version').'</th>
|
<th class="text-center border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('Version').'</th>
|
||||||
<th class="uk-text-center">'.$L->g('Author').'</th>
|
<th class="text-center border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('Author').'</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
';
|
';
|
||||||
|
|
||||||
foreach ($plugins['all'] as $Plugin) {
|
foreach ($plugins['all'] as $plugin) {
|
||||||
echo '<tr id="'.$Plugin->className().'" '.($Plugin->installed()?'class="plugin-installed"':'class="plugin-notInstalled"').'>
|
echo '<tr id="'.$plugin->className().'" '.($plugin->installed()?'class="bg-light"':'').'>
|
||||||
<td>
|
|
||||||
<div class="plugin-name">'.$Plugin->name().'</div>
|
|
||||||
<div class="plugin-links">';
|
|
||||||
|
|
||||||
if ($Plugin->installed()) {
|
<td class="align-middle pt-3 pb-3">
|
||||||
if (method_exists($Plugin, 'form')) {
|
<div>'.$plugin->name().'</div>
|
||||||
echo '<a class="configure" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$Plugin->className().'">'.$L->g('Settings').'</a>';
|
<div class="mt-1">';
|
||||||
echo '<span class="separator"> | </span>';
|
|
||||||
|
if ($plugin->installed()) {
|
||||||
|
if (method_exists($plugin, 'form')) {
|
||||||
|
echo '<a class="mr-3" href="'.HTML_PATH_ADMIN_ROOT.'configure-plugin/'.$plugin->className().'">'.$L->g('Settings').'</a>';
|
||||||
|
}
|
||||||
|
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$plugin->className().'">'.$L->g('Deactivate').'</a>';
|
||||||
|
} else {
|
||||||
|
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$plugin->className().'">'.$L->g('Activate').'</a>';
|
||||||
}
|
}
|
||||||
echo '<a class="uninstall" href="'.HTML_PATH_ADMIN_ROOT.'uninstall-plugin/'.$Plugin->className().'">'.$L->g('Deactivate').'</a>';
|
|
||||||
} else {
|
|
||||||
echo '<a class="install" href="'.HTML_PATH_ADMIN_ROOT.'install-plugin/'.$Plugin->className().'">'.$L->g('Activate').'</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="align-middle">';
|
||||||
echo $Plugin->description();
|
echo $plugin->description();
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
echo '<td class="uk-text-center">';
|
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
||||||
// if( !$Plugin->isCompatible() ) {
|
echo '<span>'.$plugin->version().'</span>';
|
||||||
// echo '<i class="uk-icon-exclamation-triangle incompatible-warning" title="'.$L->g('This plugin may not be supported by this version of Bludit').'"></i>';
|
|
||||||
// }
|
|
||||||
echo '<span>'.$Plugin->version().'</span>';
|
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
echo '<td class="uk-text-center"><a target="_blank" href="'.$Plugin->website().'">'.$Plugin->author().'</a></td>';
|
echo '<td class="text-center align-middle d-none d-lg-table-cell">
|
||||||
|
<a target="_blank" href="'.$plugin->website().'">'.$plugin->author().'</a>
|
||||||
|
</td>';
|
||||||
|
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
';
|
';
|
@ -19,15 +19,18 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
|
|||||||
<a class="nav-link" id="language-tab" data-toggle="tab" href="#language" role="tab" aria-controls="language" aria-selected="false">Language</a>
|
<a class="nav-link" id="language-tab" data-toggle="tab" href="#language" role="tab" aria-controls="language" aria-selected="false">Language</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<form class="tab-content mt-4" id="dynamicTabContent">
|
<?php
|
||||||
|
echo Bootstrap::formOpen(array(
|
||||||
|
'id'=>'dynamicTabContent',
|
||||||
|
'class'=>'tab-content mt-4',
|
||||||
|
));
|
||||||
|
|
||||||
<?php
|
// Token CSRF
|
||||||
// Token CSRF
|
echo Bootstrap::formInputHidden(array(
|
||||||
echo Bootstrap::formInputHidden(array(
|
'name'=>'tokenCSRF',
|
||||||
'name'=>'tokenCSRF',
|
'value'=>$Security->getTokenCSRF()
|
||||||
'value'=>$Security->getTokenCSRF()
|
));
|
||||||
));
|
?>
|
||||||
?>
|
|
||||||
|
|
||||||
<!-- TABS GENERAL -->
|
<!-- TABS GENERAL -->
|
||||||
<div class="tab-pane show active" id="general" role="tabpanel" aria-labelledby="general-tab">
|
<div class="tab-pane show active" id="general" role="tabpanel" aria-labelledby="general-tab">
|
||||||
@ -67,6 +70,13 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
|
|||||||
'placeholder'=>'',
|
'placeholder'=>'',
|
||||||
'tip'=>$L->g('you-can-add-a-small-text-on-the-bottom')
|
'tip'=>$L->g('you-can-add-a-small-text-on-the-bottom')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
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>
|
</div>
|
||||||
|
|
||||||
@ -129,7 +139,7 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
|
|||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'url',
|
'name'=>'url',
|
||||||
'label'=>'',
|
'label'=>'URL',
|
||||||
'value'=>$Site->url(),
|
'value'=>$Site->url(),
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
'placeholder'=>'',
|
'placeholder'=>'',
|
||||||
@ -137,13 +147,15 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
|
|||||||
'placeholder'=>'https://'
|
'placeholder'=>'https://'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Extreme friendly URL')));
|
||||||
|
|
||||||
echo Bootstrap::formSelect(array(
|
echo Bootstrap::formSelect(array(
|
||||||
'name'=>'extremeFriendly',
|
'name'=>'extremeFriendly',
|
||||||
'label'=>$L->g('Extreme Friendly URL'),
|
'label'=>'Allow Unicode',
|
||||||
'options'=>array('true'=>'Enabled', 'false'=>'Disable'),
|
'options'=>array('true'=>'Enabled', 'false'=>'Disable'),
|
||||||
'selected'=>$Site->extremeFriendly(),
|
'selected'=>$Site->extremeFriendly(),
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
'tip'=>'Is on, allow unicode characters in the URL and some part of the system'
|
'tip'=>'Allow unicode characters in the URL and some part of the system.'
|
||||||
));
|
));
|
||||||
|
|
||||||
echo Bootstrap::formTitle(array('title'=>$L->g('URL Filters')));
|
echo Bootstrap::formTitle(array('title'=>$L->g('URL Filters')));
|
||||||
@ -184,6 +196,13 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
|
|||||||
'tip'=>DOMAIN.$Site->uriFilters('blog'),
|
'tip'=>DOMAIN.$Site->uriFilters('blog'),
|
||||||
'disabled'=>!$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>
|
</div>
|
||||||
|
|
||||||
@ -252,11 +271,66 @@ echo Bootstrap::pageTitle(array('title'=>$L->g('Settings'), 'icon'=>'cog'));
|
|||||||
'placeholder'=>'',
|
'placeholder'=>'',
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
));
|
));
|
||||||
|
|
||||||
|
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>
|
</div>
|
||||||
|
|
||||||
<!-- TABS TIMEZONE AND LANGUAGES -->
|
<!-- TABS TIMEZONE AND LANGUAGES -->
|
||||||
<div class="tab-pane" id="language" role="tabpanel" aria-labelledby="language-tab">
|
<div class="tab-pane" id="language" role="tabpanel" aria-labelledby="language-tab">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo Bootstrap::formSelect(array(
|
||||||
|
'name'=>'language',
|
||||||
|
'label'=>$L->g('Language'),
|
||||||
|
'options'=>$Language->getLanguageList(),
|
||||||
|
'selected'=>$Site->language(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>$L->g('select-your-sites-language')
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formSelect(array(
|
||||||
|
'name'=>'timezone',
|
||||||
|
'label'=>$L->g('Timezone'),
|
||||||
|
'options'=>Date::timezoneList(),
|
||||||
|
'selected'=>$Site->timezone(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>$L->g('select-a-timezone-for-a-correct')
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'locale',
|
||||||
|
'label'=>$L->g('Locale'),
|
||||||
|
'value'=>$Site->locale(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>$L->g('with-the-locales-you-can-set-the-regional-user-interface')
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Date and time formats')));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'dateFormat',
|
||||||
|
'label'=>$L->g('Date format'),
|
||||||
|
'value'=>$Site->dateFormat(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>$L->g('Current format').': '.Date::current($Site->dateFormat())
|
||||||
|
));
|
||||||
|
|
||||||
|
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>
|
</div>
|
||||||
</form>
|
<?php
|
||||||
|
echo Bootstrap::formClose();
|
||||||
|
?>
|
@ -1,54 +1,53 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
HTML::title(array('title'=>$L->g('Themes'), 'icon'=>'paint-brush'));
|
echo Bootstrap::pageTitle(array('title'=>$L->g('Themes'), 'icon'=>'puzzle-piece'));
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<table class="uk-table">
|
<table class="table mt-3">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="uk-width-1-5">'.$L->g('Name').'</th>
|
<th class="border-bottom-0 w-25" scope="col">'.$L->g('Name').'</th>
|
||||||
<th class="uk-width-3-5">'.$L->g('Description').'</th>
|
<th class="border-bottom-0" scope="col">'.$L->g('Description').'</th>
|
||||||
<th class="uk-text-center">'.$L->g('Version').'</th>
|
<th class="text-center border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('Version').'</th>
|
||||||
<th class="uk-text-center">'.$L->g('Author').'</th>
|
<th class="text-center border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('Author').'</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
';
|
';
|
||||||
|
|
||||||
foreach($themes as $theme)
|
foreach ($themes as $theme) {
|
||||||
{
|
|
||||||
echo '
|
echo '
|
||||||
<tr '.($theme['dirname']==$Site->theme()?'class="theme-installed"':'class="theme-notInstalled"').'>
|
<tr '.($theme['dirname']==$Site->theme()?'class="bg-light"':'').'>
|
||||||
<td>
|
<td class="align-middle pt-3 pb-3">
|
||||||
<div class="plugin-name">'.$theme['name'].'</div>
|
<div>'.$theme['name'].'</div>
|
||||||
<div class="plugin-links">
|
<div class="mt-1">
|
||||||
';
|
';
|
||||||
|
|
||||||
if($theme['dirname']!=$Site->theme()) {
|
if ($theme['dirname']!=$Site->theme()) {
|
||||||
echo '<a class="install" href="'.HTML_PATH_ADMIN_ROOT.'install-theme/'.$theme['dirname'].'">'.$L->g('Activate').'</a>';
|
echo '<a href="'.HTML_PATH_ADMIN_ROOT.'install-theme/'.$theme['dirname'].'">'.$L->g('Activate').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</div>
|
</div>
|
||||||
</td>';
|
</td>
|
||||||
|
';
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="align-middle">';
|
||||||
echo $theme['description'];
|
echo $theme['description'];
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
echo '<td class="uk-text-center">';
|
echo '<td class="text-center align-middle d-none d-lg-table-cell">';
|
||||||
// if( !$theme['compatible'] ) {
|
echo '<span>'.$theme['version'].'</span>';
|
||||||
// echo '<i class="uk-icon-exclamation-triangle incompatible-warning" title="'.$L->g('This theme may not be supported by this version of Bludit').'"></i>';
|
|
||||||
// }
|
|
||||||
echo $theme['version'];
|
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
echo '<td class="uk-text-center"><a targe="_blank" href="'.$theme['website'].'">'.$theme['author'].'</a></td>';
|
echo '<td class="text-center align-middle d-none d-lg-table-cell">
|
||||||
|
<a target="_blank" href="'.$theme['website'].'">'.$theme['author'].'</a>
|
||||||
|
</td>';
|
||||||
|
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
';
|
';
|
@ -13,12 +13,12 @@ echo '
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="border-bottom-0" scope="col">'.$L->g('Username').'</th>
|
<th class="border-bottom-0" scope="col">'.$L->g('Username').'</th>
|
||||||
<th class="border-bottom-0" scope="col">'.$L->g('First name').'</th>
|
<th class="border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('First name').'</th>
|
||||||
<th class="border-bottom-0" scope="col">'.$L->g('Last name').'</th>
|
<th class="border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('Last name').'</th>
|
||||||
<th class="border-bottom-0" scope="col">'.$L->g('Email').'</th>
|
<th class="border-bottom-0" scope="col">'.$L->g('Email').'</th>
|
||||||
<th class="border-bottom-0" scope="col">'.$L->g('Status').'</th>
|
<th class="border-bottom-0" scope="col">'.$L->g('Status').'</th>
|
||||||
<th class="border-bottom-0" scope="col">'.$L->g('Role').'</th>
|
<th class="border-bottom-0" scope="col">'.$L->g('Role').'</th>
|
||||||
<th class="border-bottom-0" scope="col">'.$L->g('Registered').'</th>
|
<th class="border-bottom-0 d-none d-lg-table-cell" scope="col">'.$L->g('Registered').'</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -28,12 +28,12 @@ $users = $dbUsers->getAllUsers();
|
|||||||
foreach ($users as $username=>$User) {
|
foreach ($users as $username=>$User) {
|
||||||
echo '<tr>';
|
echo '<tr>';
|
||||||
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-user/'.$username.'">'.$username.'</a></td>';
|
echo '<td><a href="'.HTML_PATH_ADMIN_ROOT.'edit-user/'.$username.'">'.$username.'</a></td>';
|
||||||
echo '<td>'.$User->firstName().'</td>';
|
echo '<td class="d-none d-lg-table-cell">'.$User->firstName().'</td>';
|
||||||
echo '<td>'.$User->lastName().'</td>';
|
echo '<td class="d-none d-lg-table-cell">'.$User->lastName().'</td>';
|
||||||
echo '<td>'.$User->email().'</td>';
|
echo '<td>'.$User->email().'</td>';
|
||||||
echo '<td class="uk-text-center">'.($User->enabled()?'<b>'.$L->g('Enabled').'</b>':$L->g('Disabled')).'</td>';
|
echo '<td>'.($User->enabled()?'<b>'.$L->g('Enabled').'</b>':$L->g('Disabled')).'</td>';
|
||||||
echo '<td class="uk-text-center">'.($User->role()=='admin'?$L->g('Administrator'):$L->g('Editor')).'</td>';
|
echo '<td>'.($User->role()=='admin'?$L->g('Administrator'):$L->g('Editor')).'</td>';
|
||||||
echo '<td class="uk-text-center">'.Date::format($User->registered(), DB_DATE_FORMAT, ADMIN_PANEL_DATE_FORMAT).'</td>';
|
echo '<td class="d-none d-lg-table-cell">'.Date::format($User->registered(), DB_DATE_FORMAT, ADMIN_PANEL_DATE_FORMAT).'</td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ class Category {
|
|||||||
|
|
||||||
if (isset($dbCategories->db[$key])) {
|
if (isset($dbCategories->db[$key])) {
|
||||||
$this->vars['name'] = $dbCategories->db[$key]['name'];
|
$this->vars['name'] = $dbCategories->db[$key]['name'];
|
||||||
|
$this->vars['template'] = $dbCategories->db[$key]['template'];
|
||||||
$this->vars['key'] = $key;
|
$this->vars['key'] = $key;
|
||||||
$this->vars['permalink'] = DOMAIN_CATEGORIES . $key;
|
$this->vars['permalink'] = DOMAIN_CATEGORIES . $key;
|
||||||
$this->vars['list'] = $dbCategories->db[$key]['list'];
|
$this->vars['list'] = $dbCategories->db[$key]['list'];
|
||||||
@ -48,6 +49,11 @@ class Category {
|
|||||||
return $this->getValue('permalink');
|
return $this->getValue('permalink');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function template()
|
||||||
|
{
|
||||||
|
return $this->getValue('template');
|
||||||
|
}
|
||||||
|
|
||||||
// Returns an array with the keys of pages linked to the category
|
// Returns an array with the keys of pages linked to the category
|
||||||
public function pages()
|
public function pages()
|
||||||
{
|
{
|
||||||
|
@ -47,18 +47,15 @@ class dbUsers extends dbJSON
|
|||||||
$dataForDb = array();
|
$dataForDb = array();
|
||||||
|
|
||||||
// Verify arguments with the database fields
|
// Verify arguments with the database fields
|
||||||
foreach($this->dbFields as $field=>$options) {
|
foreach ($this->dbFields as $field=>$options) {
|
||||||
if( isset($args[$field]) ) {
|
if (isset($args[$field])) {
|
||||||
$value = Sanitize::html($args[$field]);
|
$value = Sanitize::html($args[$field]);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$value = $options['value'];
|
$value = $options['value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set type
|
// Set type
|
||||||
settype($value, gettype($options['value']));
|
settype($value, gettype($options['value']));
|
||||||
|
|
||||||
// Save on database
|
|
||||||
$dataForDb[$field] = $value;
|
$dataForDb[$field] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,25 +601,25 @@ function createUser($args) {
|
|||||||
global $syslog;
|
global $syslog;
|
||||||
|
|
||||||
// Check empty username
|
// Check empty username
|
||||||
if( Text::isEmpty($args['new_username']) ) {
|
if (Text::isEmpty($args['new_username'])) {
|
||||||
Alert::set($Language->g('username-field-is-empty'), ALERT_STATUS_FAIL);
|
Alert::set($Language->g('username-field-is-empty'), ALERT_STATUS_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check already exist username
|
// Check already exist username
|
||||||
if( $dbUsers->exists($args['new_username']) ) {
|
if ($dbUsers->exists($args['new_username'])) {
|
||||||
Alert::set($Language->g('username-already-exists'), ALERT_STATUS_FAIL);
|
Alert::set($Language->g('username-already-exists'), ALERT_STATUS_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Password length
|
// Password length
|
||||||
if( Text::length($args['new_password']) < PASSWORD_LENGTH ) {
|
if (Text::length($args['new_password']) < PASSWORD_LENGTH) {
|
||||||
Alert::set($Language->g('Password must be at least '.PASSWORD_LENGTH.' characters long'), ALERT_STATUS_FAIL);
|
Alert::set($Language->g('Password must be at least '.PASSWORD_LENGTH.' characters long'), ALERT_STATUS_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check new password and confirm password are equal
|
// Check new password and confirm password are equal
|
||||||
if( $args['new_password'] != $args['confirm_password'] ) {
|
if ($args['new_password'] != $args['confirm_password']) {
|
||||||
Alert::set($Language->g('The password and confirmation password do not match'), ALERT_STATUS_FAIL);
|
Alert::set($Language->g('The password and confirmation password do not match'), ALERT_STATUS_FAIL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -632,7 +632,7 @@ function createUser($args) {
|
|||||||
$tmp['email'] = $args['email'];
|
$tmp['email'] = $args['email'];
|
||||||
|
|
||||||
// Add the user to the database
|
// Add the user to the database
|
||||||
if( $dbUsers->add($tmp) ) {
|
if ($dbUsers->add($tmp)) {
|
||||||
// Add to syslog
|
// Add to syslog
|
||||||
$syslog->add(array(
|
$syslog->add(array(
|
||||||
'dictionaryKey'=>'new-user-created',
|
'dictionaryKey'=>'new-user-created',
|
||||||
@ -717,7 +717,7 @@ function createCategory($category) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($dbCategories->add($category)) {
|
if ($dbCategories->add(array('name'=>$category))) {
|
||||||
$syslog->add(array(
|
$syslog->add(array(
|
||||||
'dictionaryKey'=>'new-category-created',
|
'dictionaryKey'=>'new-category-created',
|
||||||
'notes'=>$category
|
'notes'=>$category
|
||||||
@ -737,18 +737,12 @@ function editCategory($args) {
|
|||||||
global $dbCategories;
|
global $dbCategories;
|
||||||
global $syslog;
|
global $syslog;
|
||||||
|
|
||||||
if (Text::isEmpty($args['categoryName']) || Text::isEmpty($args['categoryKey']) ) {
|
if (Text::isEmpty($args['name']) || Text::isEmpty($args['newKey']) ) {
|
||||||
Alert::set($Language->g('Empty fields'));
|
Alert::set($Language->g('Empty fields'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($args['oldCategoryKey']!==$args['categoryKey']) {
|
$newCategoryKey = $dbCategories->edit($args);
|
||||||
// Edit the category key and keep the category name
|
|
||||||
$newCategoryKey = $dbCategories->changeKey($args['oldCategoryKey'], $args['categoryKey']);
|
|
||||||
} else {
|
|
||||||
// Edit the category name
|
|
||||||
$newCategoryKey = $dbCategories->edit($args['oldCategoryKey'], $args['categoryName']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($newCategoryKey==false) {
|
if ($newCategoryKey==false) {
|
||||||
Alert::set($Language->g('The category already exists'));
|
Alert::set($Language->g('The category already exists'));
|
||||||
@ -756,7 +750,7 @@ function editCategory($args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Change the category key in the pages database
|
// Change the category key in the pages database
|
||||||
$dbPages->changeCategory($args['oldCategoryKey'], $newCategoryKey);
|
$dbPages->changeCategory($args['oldKey'], $newCategoryKey);
|
||||||
|
|
||||||
$syslog->add(array(
|
$syslog->add(array(
|
||||||
'dictionaryKey'=>'category-edited',
|
'dictionaryKey'=>'category-edited',
|
||||||
|
@ -216,6 +216,12 @@ class Page {
|
|||||||
return $this->categoryMap('name');
|
return $this->categoryMap('name');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns the category name
|
||||||
|
public function categoryTemplate()
|
||||||
|
{
|
||||||
|
return $this->categoryMap('template');
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the category key
|
// Returns the category key
|
||||||
public function categoryKey()
|
public function categoryKey()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user