Plugin configuration
This commit is contained in:
parent
551009dab8
commit
3e52d937af
|
@ -51,7 +51,7 @@ if($Login->role()!=='admin') {
|
|||
$layout['parameters'] = $Login->username();
|
||||
}
|
||||
|
||||
$_user = $dbUsers->get($layout['parameters']);
|
||||
$_user = $dbUsers->getDb($layout['parameters']);
|
||||
|
||||
// If the user doesn't exist, redirect to the users list.
|
||||
if($_user===false) {
|
||||
|
|
|
@ -36,20 +36,6 @@ class dbJSON
|
|||
}
|
||||
}
|
||||
|
||||
// Get database.
|
||||
public function get()
|
||||
{
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
// Set and save database.
|
||||
public function set($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
// Returns the amount of database items.
|
||||
public function count()
|
||||
{
|
||||
|
|
|
@ -144,7 +144,8 @@ class Plugin {
|
|||
|
||||
// Create database
|
||||
$Tmp = new dbJSON($this->filenameDb);
|
||||
$Tmp->set($this->dbFields);
|
||||
$Tmp->db = $this->dbFields;
|
||||
$Tmp->save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ function build_page($key)
|
|||
// Parse username for the page.
|
||||
if( $dbUsers->userExists( $Page->username() ) )
|
||||
{
|
||||
$user = $dbUsers->get( $Page->username() );
|
||||
$user = $dbUsers->getDb( $Page->username() );
|
||||
|
||||
$Page->setField('authorFirstName', $user['firstName'], false);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ function buildPost($key)
|
|||
// Parse username for the post.
|
||||
if( $dbUsers->userExists( $Post->username() ) )
|
||||
{
|
||||
$user = $dbUsers->get( $Post->username() );
|
||||
$user = $dbUsers->getDb( $Post->username() );
|
||||
|
||||
$Post->setField('authorFirstName', $user['firstName'], false);
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ function build_plugins()
|
|||
$database = new dbJSON($languageFilename, false);
|
||||
}
|
||||
|
||||
$databaseArray = $database->get();
|
||||
$databaseArray = $database->db;
|
||||
$Plugin->setData( $databaseArray['plugin-data'] );
|
||||
|
||||
// Add words to language dictionary.
|
||||
|
|
|
@ -19,7 +19,7 @@ class dbUsers extends dbJSON
|
|||
}
|
||||
|
||||
// Return an array with the username databases
|
||||
public function get($username)
|
||||
public function getDb($username)
|
||||
{
|
||||
if($this->userExists($username))
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ class dbUsers extends dbJSON
|
|||
{
|
||||
$dataForDb = array();
|
||||
|
||||
$user = $this->get($args['username']);
|
||||
$user = $this->getDb($args['username']);
|
||||
|
||||
if($user===false)
|
||||
{
|
||||
|
@ -70,10 +70,10 @@ class dbUsers extends dbJSON
|
|||
{
|
||||
if( isset($this->dbFields[$field]) )
|
||||
{
|
||||
// Sanitize if will be saved on database.
|
||||
// Sanitize.
|
||||
$tmpValue = Sanitize::html($value);
|
||||
|
||||
// Set type
|
||||
// Set type.
|
||||
settype($tmpValue, gettype($this->dbFields[$field]['value']));
|
||||
|
||||
$user[$field] = $tmpValue;
|
||||
|
|
|
@ -60,7 +60,7 @@ class Login {
|
|||
return false;
|
||||
}
|
||||
|
||||
$user = $this->dbUsers->get($username);
|
||||
$user = $this->dbUsers->getDb($username);
|
||||
if($user==false) {
|
||||
Log::set(__METHOD__.LOG_SEP.'Username not exist: '.$username);
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue