Changes on variables names
This commit is contained in:
parent
077bc21434
commit
786f73cc5a
|
@ -26,17 +26,17 @@ checkRole(array('admin', 'editor'));
|
|||
$onlyPublished = true;
|
||||
$amountOfItems = ITEMS_PER_PAGE_ADMIN;
|
||||
$pageNumber = $url->pageNumber();
|
||||
$published = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
$published = $pages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
|
||||
// Check if out of range the pageNumber
|
||||
if (empty($published) && $url->pageNumber()>1) {
|
||||
Redirect::page('content');
|
||||
}
|
||||
|
||||
$drafts = $dbPages->getDraftDB(true);
|
||||
$scheduled = $dbPages->getScheduledDB(true);
|
||||
$static = $dbPages->getStaticDB(true);
|
||||
$sticky = $dbPages->getStickyDB(true);
|
||||
$drafts = $pages->getDraftDB(true);
|
||||
$scheduled = $pages->getScheduledDB(true);
|
||||
$static = $pages->getStaticDB(true);
|
||||
$sticky = $pages->getStickyDB(true);
|
||||
|
||||
// Title of the page
|
||||
$layout['title'] .= ' - '.$Language->g('Manage content');
|
|
@ -33,7 +33,7 @@
|
|||
// UUID
|
||||
echo Bootstrap::formInputHidden(array(
|
||||
'name'=>'uuid',
|
||||
'value'=>$dbPages->generateUUID()
|
||||
'value'=>$pages->generateUUID()
|
||||
));
|
||||
|
||||
// Status = published, draft, sticky, static
|
||||
|
@ -154,7 +154,7 @@
|
|||
'name'=>'position',
|
||||
'label'=>$L->g('Position'),
|
||||
'tip'=>'Field used when ordering content by position',
|
||||
'value'=>$dbPages->nextPositionNumber()
|
||||
'value'=>$pages->nextPositionNumber()
|
||||
));
|
||||
|
||||
// Template
|
||||
|
|
|
@ -24,7 +24,7 @@ echo '
|
|||
<tbody>
|
||||
';
|
||||
|
||||
$list = $dbUsers->getAllUsernames();
|
||||
$list = $users->keys();
|
||||
foreach ($list as $username) {
|
||||
try {
|
||||
$user = new User($username);
|
||||
|
|
|
@ -5,7 +5,7 @@ $text = isset($_POST['text']) ? $_POST['text'] : '';
|
|||
$parent = isset($_POST['parentKey']) ? $_POST['parentKey'] : PARENT;
|
||||
$oldKey = isset($_POST['currentKey']) ? $_POST['currentKey'] : '';
|
||||
|
||||
$slug = $dbPages->generateKey($text, $parent, $returnSlug=true, $oldKey);
|
||||
$slug = $pages->generateKey($text, $parent, $returnSlug=true, $oldKey);
|
||||
|
||||
exit (json_encode(array(
|
||||
'status'=>0,
|
||||
|
|
|
@ -38,7 +38,7 @@ $page = array(
|
|||
);
|
||||
|
||||
// Get the page key by the UUID
|
||||
$pageKey = $dbPages->getByUUID($autosaveUUID);
|
||||
$pageKey = $pages->getByUUID($autosaveUUID);
|
||||
|
||||
// if pageKey is empty means the autosave page doesn't exist
|
||||
if (empty($pageKey)) {
|
||||
|
|
|
@ -78,13 +78,13 @@ include(PATH_ABSTRACT.'dblist.class.php');
|
|||
include(PATH_ABSTRACT.'plugin.class.php');
|
||||
|
||||
// Inclde Classes
|
||||
include(PATH_KERNEL.'dbpages.class.php');
|
||||
include(PATH_KERNEL.'dbusers.class.php');
|
||||
include(PATH_KERNEL.'dbtags.class.php');
|
||||
include(PATH_KERNEL.'dblanguage.class.php');
|
||||
include(PATH_KERNEL.'dbsite.class.php');
|
||||
include(PATH_KERNEL.'dbcategories.class.php');
|
||||
include(PATH_KERNEL.'dbsyslog.class.php');
|
||||
include(PATH_KERNEL.'pages.class.php');
|
||||
include(PATH_KERNEL.'users.class.php');
|
||||
include(PATH_KERNEL.'tags.class.php');
|
||||
include(PATH_KERNEL.'language.class.php');
|
||||
include(PATH_KERNEL.'site.class.php');
|
||||
include(PATH_KERNEL.'categories.class.php');
|
||||
include(PATH_KERNEL.'syslog.class.php');
|
||||
include(PATH_KERNEL.'pagex.class.php');
|
||||
include(PATH_KERNEL.'category.class.php');
|
||||
include(PATH_KERNEL.'tag.class.php');
|
||||
|
@ -120,14 +120,14 @@ if (file_exists(PATH_KERNEL.'bludit.pro.php')) {
|
|||
}
|
||||
|
||||
// Objects
|
||||
$pages = $dbPages = new dbPages(); // DEPRECATED v3.0.0 $dbPages
|
||||
$users = $dbUsers = new dbUsers(); // DEPRECATED v3.0.0 $dbUsers
|
||||
$tags = $dbTags = new dbTags(); // DEPRECATED v3.0.0 $dbTags
|
||||
$categories = $dbCategories = new dbCategories(); // DEPRECATED v3.0.0 $dbCategories
|
||||
$site = new dbSite();
|
||||
$pages = new Pages(); // DEPRECATED v3.0.0 $dbPages
|
||||
$users = new Users(); // DEPRECATED v3.0.0 $users
|
||||
$tags = new Tags(); // DEPRECATED v3.0.0 $dbTags
|
||||
$categories = new Categories(); // DEPRECATED v3.0.0 $dbCategories
|
||||
$site = new Site();
|
||||
$url = new Url();
|
||||
$security = new Security();
|
||||
$syslog = new dbSyslog();
|
||||
$syslog = new Syslog();
|
||||
|
||||
// --- Relative paths ---
|
||||
// This paths are relative for the user / web browsing.
|
||||
|
@ -175,7 +175,7 @@ define('HTML_PATH_UPLOADS_THUMBNAILS', HTML_PATH_UPLOADS.'thumbnails/');
|
|||
define('HTML_PATH_PLUGINS', HTML_PATH_ROOT.'bl-plugins/');
|
||||
|
||||
// --- Objects with dependency ---
|
||||
$language = $Language = new dbLanguage( $site->language() );
|
||||
$language = $Language = new Language( $site->language() );
|
||||
$url->checkFilters( $site->uriFilters() );
|
||||
|
||||
// --- CONSTANTS with dependency ---
|
||||
|
|
|
@ -36,7 +36,7 @@ $staticContent = $staticPages = buildStaticPages();
|
|||
// ============================================================================
|
||||
|
||||
// Execute the scheduler
|
||||
if ($dbPages->scheduler()) {
|
||||
if ($pages->scheduler()) {
|
||||
reindexTags();
|
||||
reindexCategories();
|
||||
|
||||
|
@ -50,7 +50,7 @@ if ($dbPages->scheduler()) {
|
|||
// Set home page if the user defined them
|
||||
if ($site->homepage() && $url->whereAmI()==='home') {
|
||||
$pageKey = $site->homepage();
|
||||
if ($dbPages->exists($pageKey)) {
|
||||
if ($pages->exists($pageKey)) {
|
||||
$url->setSlug($pageKey);
|
||||
$url->setWhereAmI('page');
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ Paginator::set('currentPage', $currentPage);
|
|||
|
||||
if($url->whereAmI()=='admin') {
|
||||
$itemsPerPage = ITEMS_PER_PAGE_ADMIN;
|
||||
$amountOfItems = $dbPages->count(true);
|
||||
$amountOfItems = $pages->count(true);
|
||||
}
|
||||
elseif($url->whereAmI()=='tag') {
|
||||
$itemsPerPage = $site->itemsPerPage();
|
||||
|
@ -20,7 +20,7 @@ elseif($url->whereAmI()=='category') {
|
|||
}
|
||||
else {
|
||||
$itemsPerPage = $site->itemsPerPage();
|
||||
$amountOfItems = $dbPages->count(true);
|
||||
$amountOfItems = $pages->count(true);
|
||||
}
|
||||
|
||||
// Items per page
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class dbCategories extends dbList
|
||||
{
|
||||
class Categories extends dbList {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct(DB_CATEGORIES);
|
||||
|
@ -14,7 +14,7 @@ class dbCategories extends dbList
|
|||
|
||||
public function reindex()
|
||||
{
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
|
||||
// Foreach category
|
||||
foreach ($this->db as $key=>$value) {
|
||||
|
@ -22,7 +22,7 @@ class dbCategories extends dbList
|
|||
}
|
||||
|
||||
// Get a database with published pages
|
||||
$db = $dbPages->getPublishedDB(false);
|
||||
$db = $pages->getPublishedDB(false);
|
||||
foreach ($db as $pageKey=>$pageFields) {
|
||||
if (!empty($pageFields['category'])) {
|
||||
$categoryKey = $pageFields['category'];
|
|
@ -18,7 +18,7 @@ function reindexTags() {
|
|||
function buildErrorPage() {
|
||||
global $site;
|
||||
global $language;
|
||||
global $dbUsers;
|
||||
global $users;
|
||||
|
||||
try {
|
||||
$pageNotFoundKey = $site->pageNotFound();
|
||||
|
@ -80,7 +80,7 @@ function buildPagesByTag() {
|
|||
// Generate the global variables $content / $content, defined on 69.pages.php
|
||||
// This function is use for buildPagesForHome(), buildPagesByCategory(), buildPagesByTag()
|
||||
function buildPagesFor($for, $categoryKey=false, $tagKey=false) {
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
global $categories;
|
||||
global $tags;
|
||||
global $site;
|
||||
|
@ -92,11 +92,11 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false) {
|
|||
if ($for=='home') {
|
||||
$onlyPublished = true;
|
||||
$amountOfItems = $site->itemsPerPage();
|
||||
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
$list = $pages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
|
||||
// Include sticky pages only in the first page
|
||||
if ($pageNumber==1) {
|
||||
$sticky = $dbPages->getStickyDB();
|
||||
$sticky = $pages->getStickyDB();
|
||||
$list = array_merge($sticky, $list);
|
||||
}
|
||||
}
|
||||
|
@ -130,10 +130,10 @@ function buildPagesFor($for, $categoryKey=false, $tagKey=false) {
|
|||
// Returns an array with all the static pages as Page-Object
|
||||
// The static pages are order by position all the time
|
||||
function buildStaticPages() {
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
|
||||
$list = array();
|
||||
$pagesKey = $dbPages->getStaticDB();
|
||||
$pagesKey = $pages->getStaticDB();
|
||||
foreach ($pagesKey as $pageKey) {
|
||||
try {
|
||||
$page = new Page($pageKey);
|
||||
|
@ -159,10 +159,10 @@ function buildPage($pageKey) {
|
|||
// Returns an array with all the parent pages as Page-Object
|
||||
// The pages are order by the settings on the system
|
||||
function buildParentPages() {
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
|
||||
$list = array();
|
||||
$pagesKey = $dbPages->getPublishedDB();
|
||||
$pagesKey = $pages->getPublishedDB();
|
||||
foreach ($pagesKey as $pageKey) {
|
||||
try {
|
||||
$page = new Page($pageKey);
|
||||
|
@ -265,13 +265,13 @@ function changePluginsPosition($pluginClassList) {
|
|||
}
|
||||
|
||||
function createPage($args) {
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
global $syslog;
|
||||
global $Language;
|
||||
|
||||
// Check if the autosave page exists for this new page and delete it
|
||||
if (isset($args['uuid'])) {
|
||||
$autosaveKey = $dbPages->getByUUID('autosave-'.$args['uuid']);
|
||||
$autosaveKey = $pages->getByUUID('autosave-'.$args['uuid']);
|
||||
if (!empty($autosaveKey)) {
|
||||
Log::set('Function createPage()'.LOG_SEP.'Autosave deleted for '.$args['title'], LOG_TYPE_INFO);
|
||||
deletePage($autosaveKey);
|
||||
|
@ -285,7 +285,7 @@ function createPage($args) {
|
|||
return false;
|
||||
}
|
||||
|
||||
$key = $dbPages->add($args);
|
||||
$key = $pages->add($args);
|
||||
if ($key) {
|
||||
// Call the plugins after page created
|
||||
Theme::plugins('afterPageCreate');
|
||||
|
@ -312,12 +312,12 @@ function createPage($args) {
|
|||
}
|
||||
|
||||
function editPage($args) {
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
global $syslog;
|
||||
|
||||
// Check if the autosave page exists for this new page and delete it
|
||||
if (isset($args['uuid'])) {
|
||||
$pageKey = $dbPages->getByUUID('autosave-'.$args['uuid']);
|
||||
$pageKey = $pages->getByUUID('autosave-'.$args['uuid']);
|
||||
if (!empty($pageKey)) {
|
||||
Log::set('Function editPage()'.LOG_SEP.'Autosave deleted for '.$args['title'], LOG_TYPE_INFO);
|
||||
deletePage($pageKey);
|
||||
|
@ -331,7 +331,7 @@ function editPage($args) {
|
|||
}
|
||||
|
||||
// Check if the page key exist
|
||||
if (!$dbPages->exists($args['key'])) {
|
||||
if (!$pages->exists($args['key'])) {
|
||||
Log::set('Function editPage()'.LOG_SEP.'Page key does not exist, '.$args['key'], LOG_TYPE_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ function editPage($args) {
|
|||
}
|
||||
}
|
||||
|
||||
$key = $dbPages->edit($args);
|
||||
$key = $pages->edit($args);
|
||||
if ($key) {
|
||||
// Call the plugins after page modified
|
||||
Theme::plugins('afterPageModify');
|
||||
|
@ -373,10 +373,10 @@ function editPage($args) {
|
|||
}
|
||||
|
||||
function deletePage($key) {
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
global $syslog;
|
||||
|
||||
if ($dbPages->delete($key)) {
|
||||
if ($pages->delete($key)) {
|
||||
// Call the plugins after page deleted
|
||||
Theme::plugins('afterPageDelete');
|
||||
|
||||
|
@ -396,10 +396,10 @@ function deletePage($key) {
|
|||
}
|
||||
|
||||
function editUser($args) {
|
||||
global $dbUsers;
|
||||
global $users;
|
||||
global $syslog;
|
||||
|
||||
if ($dbUsers->set($args)) {
|
||||
if ($users->set($args)) {
|
||||
// Add to syslog
|
||||
$syslog->add(array(
|
||||
'dictionaryKey'=>'user-edited',
|
||||
|
@ -413,7 +413,7 @@ function editUser($args) {
|
|||
}
|
||||
|
||||
function disableUser($args) {
|
||||
global $dbUsers;
|
||||
global $users;
|
||||
global $login;
|
||||
global $syslog;
|
||||
|
||||
|
@ -426,12 +426,12 @@ function disableUser($args) {
|
|||
}
|
||||
|
||||
// Check if the username exists
|
||||
if (!$dbUsers->exists($username)) {
|
||||
if (!$users->exists($username)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Disable the user
|
||||
if ($dbUsers->disableUser($username)) {
|
||||
if ($users->disableUser($username)) {
|
||||
// Add to syslog
|
||||
$syslog->add(array(
|
||||
'dictionaryKey'=>'user-disabled',
|
||||
|
@ -445,7 +445,7 @@ function disableUser($args) {
|
|||
}
|
||||
|
||||
function deleteUser($args) {
|
||||
global $dbUsers, $dbPages;
|
||||
global $users, $pages;
|
||||
global $login;
|
||||
global $syslog;
|
||||
|
||||
|
@ -464,17 +464,17 @@ function deleteUser($args) {
|
|||
}
|
||||
|
||||
// Check if the username exists
|
||||
if (!$dbUsers->exists($username)) {
|
||||
if (!$users->exists($username)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($deleteContent) {
|
||||
$dbPages->deletePagesByUser(array('username'=>$username));
|
||||
$pages->deletePagesByUser(array('username'=>$username));
|
||||
} else {
|
||||
$dbPages->transferPages(array('oldUsername'=>$username));
|
||||
$pages->transferPages(array('oldUsername'=>$username));
|
||||
}
|
||||
|
||||
if ($dbUsers->delete($username)) {
|
||||
if ($users->delete($username)) {
|
||||
// Add to syslog
|
||||
$syslog->add(array(
|
||||
'dictionaryKey'=>'user-deleted',
|
||||
|
@ -488,7 +488,7 @@ function deleteUser($args) {
|
|||
}
|
||||
|
||||
function createUser($args) {
|
||||
global $dbUsers;
|
||||
global $users;
|
||||
global $Language;
|
||||
global $syslog;
|
||||
|
||||
|
@ -499,7 +499,7 @@ function createUser($args) {
|
|||
}
|
||||
|
||||
// Check already exist username
|
||||
if ($dbUsers->exists($args['new_username'])) {
|
||||
if ($users->exists($args['new_username'])) {
|
||||
Alert::set($Language->g('username-already-exists'), ALERT_STATUS_FAIL);
|
||||
return false;
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ function createUser($args) {
|
|||
$tmp['email'] = $args['email'];
|
||||
|
||||
// Add the user to the database
|
||||
if ($dbUsers->add($tmp)) {
|
||||
if ($users->add($tmp)) {
|
||||
// Add to syslog
|
||||
$syslog->add(array(
|
||||
'dictionaryKey'=>'new-user-created',
|
||||
|
@ -541,7 +541,7 @@ function editSettings($args) {
|
|||
global $site;
|
||||
global $syslog;
|
||||
global $Language;
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
|
||||
if (isset($args['language'])) {
|
||||
if ($args['language']!=$site->language()) {
|
||||
|
@ -578,11 +578,11 @@ function editSettings($args) {
|
|||
// Check current order-by if changed it reorder the content
|
||||
if ($site->orderBy()!=ORDER_BY) {
|
||||
if ($site->orderBy()=='date') {
|
||||
$dbPages->sortByDate();
|
||||
$pages->sortByDate();
|
||||
} else {
|
||||
$dbPages->sortByPosition();
|
||||
$pages->sortByPosition();
|
||||
}
|
||||
$dbPages->save();
|
||||
$pages->save();
|
||||
}
|
||||
|
||||
// Add syslog
|
||||
|
@ -600,7 +600,7 @@ function editSettings($args) {
|
|||
}
|
||||
|
||||
function changeUserPassword($args) {
|
||||
global $dbUsers;
|
||||
global $users;
|
||||
global $Language;
|
||||
global $syslog;
|
||||
|
||||
|
@ -620,7 +620,7 @@ function changeUserPassword($args) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($dbUsers->setPassword(array('username'=>$username, 'password'=>$newPassword))) {
|
||||
if ($users->setPassword(array('username'=>$username, 'password'=>$newPassword))) {
|
||||
// Add to syslog
|
||||
$syslog->add(array(
|
||||
'dictionaryKey'=>'user-password-changed',
|
||||
|
@ -690,7 +690,7 @@ function createCategory($category) {
|
|||
|
||||
function editCategory($args) {
|
||||
global $Language;
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
global $categories;
|
||||
global $syslog;
|
||||
|
||||
|
@ -707,7 +707,7 @@ function editCategory($args) {
|
|||
}
|
||||
|
||||
// Change the category key in the pages database
|
||||
$dbPages->changeCategory($args['oldKey'], $newCategoryKey);
|
||||
$pages->changeCategory($args['oldKey'], $newCategoryKey);
|
||||
|
||||
// Add to syslog
|
||||
$syslog->add(array(
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class dbLanguage extends dbJSON
|
||||
{
|
||||
class Language extends dbJSON {
|
||||
public $data;
|
||||
public $db;
|
||||
public $currentLanguage;
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
class Login {
|
||||
|
||||
private $dbUsers;
|
||||
private $users;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
if (isset($GLOBALS['dbUsers'])) {
|
||||
$this->dbUsers = $GLOBALS['dbUsers'];
|
||||
if (isset($GLOBALS['users'])) {
|
||||
$this->users = $GLOBALS['users'];
|
||||
} else {
|
||||
$this->dbUsers = new dbUsers();
|
||||
$this->users = new users();
|
||||
}
|
||||
|
||||
// Start the Session
|
||||
|
@ -64,8 +64,8 @@ class Login {
|
|||
$username = Sanitize::html($username);
|
||||
|
||||
// Set the token on the users database
|
||||
$token = $this->dbUsers->generateRememberToken();
|
||||
$this->dbUsers->setRememberToken($username, $token);
|
||||
$token = $this->users->generateRememberToken();
|
||||
$this->users->setRememberToken($username, $token);
|
||||
|
||||
// Set the token on the cookies
|
||||
Cookie::set(REMEMBER_COOKIE_USERNAME, $username, REMEMBER_COOKIE_EXPIRE_IN_DAYS);
|
||||
|
@ -77,7 +77,7 @@ class Login {
|
|||
public function invalidateRememberMe()
|
||||
{
|
||||
// Invalidate all tokens on the user databases
|
||||
$this->dbUsers->invalidateAllRememberTokens();
|
||||
$this->users->invalidateAllRememberTokens();
|
||||
|
||||
// Destroy the cookies
|
||||
Cookie::set(REMEMBER_COOKIE_USERNAME, '', -1);
|
||||
|
@ -110,7 +110,7 @@ class Login {
|
|||
return false;
|
||||
}
|
||||
|
||||
$passwordHash = $this->dbUsers->generatePasswordHash($password, $user->salt());
|
||||
$passwordHash = $this->users->generatePasswordHash($password, $user->salt());
|
||||
if ($passwordHash===$user->password()) {
|
||||
$this->setLogin($username, $user->role());
|
||||
Log::set(__METHOD__.LOG_SEP.'User logged succeeded by username and password - Username ['.$username.']');
|
||||
|
@ -143,14 +143,14 @@ class Login {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($username !== $this->dbUsers->getByRememberToken($token)) {
|
||||
if ($username !== $this->users->getByRememberToken($token)) {
|
||||
$this->invalidateRememberMe();
|
||||
Log::set(__METHOD__.LOG_SEP.'The user has different token or the token doesn\'t exist.');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate user and login
|
||||
$user = $this->dbUsers->getDb($username);
|
||||
$user = $this->users->getDb($username);
|
||||
$this->setLogin($username, $user['role']);
|
||||
Log::set(__METHOD__.LOG_SEP.'User authenticated via Remember Me.');
|
||||
return true;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class dbPages extends dbJSON {
|
||||
class Pages extends dbJSON {
|
||||
|
||||
private $parentKeyList = array();
|
||||
private $dbFields = array(
|
|
@ -6,21 +6,21 @@ class Page {
|
|||
|
||||
function __construct($key)
|
||||
{
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
|
||||
$this->vars['key'] = $key;
|
||||
|
||||
// If key is FALSE, the page is create with default values, like an empty page
|
||||
// Useful for Page Not Found
|
||||
if ($key===false) {
|
||||
$row = $dbPages->getDefaultFields();
|
||||
$row = $pages->getDefaultFields();
|
||||
} else {
|
||||
if (Text::isEmpty($key) || !$dbPages->exists($key)) {
|
||||
if (Text::isEmpty($key) || !$pages->exists($key)) {
|
||||
$errorMessage = 'Page not found in database by key ['.$key.']';
|
||||
Log::set(__METHOD__.LOG_SEP.$errorMessage);
|
||||
throw new Exception($errorMessage);
|
||||
}
|
||||
$row = $dbPages->getPageDB($key);
|
||||
$row = $pages->getPageDB($key);
|
||||
}
|
||||
|
||||
foreach ($row as $field=>$value) {
|
||||
|
@ -151,15 +151,15 @@ class Page {
|
|||
// Returns the previous page key
|
||||
public function previousKey()
|
||||
{
|
||||
global $dbPages;
|
||||
return $dbPages->previousPageKey($this->key());
|
||||
global $pages;
|
||||
return $pages->previousPageKey($this->key());
|
||||
}
|
||||
|
||||
// Returns the next page key
|
||||
public function nextKey()
|
||||
{
|
||||
global $dbPages;
|
||||
return $dbPages->nextPageKey($this->key());
|
||||
global $pages;
|
||||
return $pages->nextPageKey($this->key());
|
||||
}
|
||||
|
||||
// Returns the category name
|
||||
|
@ -459,17 +459,17 @@ class Page {
|
|||
// Returns an array with all children's keys
|
||||
public function childrenKeys()
|
||||
{
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
$key = $this->key();
|
||||
return $dbPages->getChildren($key);
|
||||
return $pages->getChildren($key);
|
||||
}
|
||||
|
||||
// Returns an array with all children as Page-Object
|
||||
public function children()
|
||||
{
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
$list = array();
|
||||
$childrenKeys = $dbPages->getChildren($this->key());
|
||||
$childrenKeys = $pages->getChildren($this->key());
|
||||
foreach ($childrenKeys as $childKey) {
|
||||
try {
|
||||
$child = new Page($childKey);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class dbSite extends dbJSON
|
||||
{
|
||||
class Site extends dbJSON {
|
||||
public $dbFields = array(
|
||||
'title'=> 'I am Guybrush Threepwood, mighty developer',
|
||||
'slogan'=> '',
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class dbSyslog extends dbJSON
|
||||
{
|
||||
class Syslog extends dbJSON {
|
||||
|
||||
public $dbFields = array(
|
||||
'date'=> array('inFile'=>false, 'value'=>''),
|
||||
'dictionaryKey'=> array('inFile'=>false, 'value'=>''),
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class dbTags extends dbList
|
||||
{
|
||||
class Tags extends dbList {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct(DB_TAGS);
|
||||
|
@ -14,10 +14,10 @@ class dbTags extends dbList
|
|||
|
||||
public function reindex()
|
||||
{
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
|
||||
// Get a database with published pages
|
||||
$db = $dbPages->getPublishedDB(false);
|
||||
$db = $pages->getPublishedDB(false);
|
||||
|
||||
$tagsIndex = array();
|
||||
|
|
@ -5,19 +5,19 @@ class User {
|
|||
|
||||
function __construct($username)
|
||||
{
|
||||
global $dbUsers;
|
||||
global $users;
|
||||
|
||||
$this->vars['username'] = $username;
|
||||
|
||||
if ($username===false) {
|
||||
$row = $dbUsers->getDefaultFields();
|
||||
$row = $users->getDefaultFields();
|
||||
} else {
|
||||
if (Text::isEmpty($username) || !$dbUsers->exists($username)) {
|
||||
if (Text::isEmpty($username) || !$users->exists($username)) {
|
||||
$errorMessage = 'User not found in database by username ['.$username.']';
|
||||
Log::set(__METHOD__.LOG_SEP.$errorMessage);
|
||||
throw new Exception($errorMessage);
|
||||
}
|
||||
$row = $dbUsers->getUserDB($username);
|
||||
$row = $users->getUserDB($username);
|
||||
}
|
||||
|
||||
foreach ($row as $field=>$value) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||
|
||||
class dbUsers extends dbJSON {
|
||||
class Users extends dbJSON {
|
||||
|
||||
public $dbFields = array(
|
||||
'firstName'=>'',
|
||||
|
@ -208,7 +208,7 @@ class dbUsers extends dbJSON {
|
|||
return $this->save();
|
||||
}
|
||||
|
||||
public function getAllUsernames()
|
||||
public function keys()
|
||||
{
|
||||
return array_keys($this->db);
|
||||
}
|
|
@ -45,8 +45,8 @@ class pluginAPI extends Plugin {
|
|||
public function beforeAll()
|
||||
{
|
||||
global $url;
|
||||
global $dbPages;
|
||||
global $dbUsers;
|
||||
global $pages;
|
||||
global $users;
|
||||
|
||||
// CHECK URL
|
||||
// ------------------------------------------------------------
|
||||
|
@ -96,11 +96,11 @@ class pluginAPI extends Plugin {
|
|||
if ( !empty($inputs['authentication']) ) {
|
||||
|
||||
// Get the user with the authentication token, FALSE if doesn't exit
|
||||
$username = $dbUsers->getByAuthToken($inputs['authentication']);
|
||||
$username = $users->getByAuthToken($inputs['authentication']);
|
||||
if ($username!==false) {
|
||||
|
||||
// Get the object user to check the role
|
||||
$user = $dbUsers->getUser($username);
|
||||
$user = $users->getUser($username);
|
||||
if (($user->role()=='admin') && ($user->enabled())) {
|
||||
// Loggin the user to create the session
|
||||
$login = new Login();
|
||||
|
@ -235,12 +235,12 @@ class pluginAPI extends Plugin {
|
|||
|
||||
private function getPages()
|
||||
{
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
|
||||
$onlyPublished = true;
|
||||
$amountOfItems = $this->getValue('amountOfItems');
|
||||
$pageNumber = 1;
|
||||
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
$list = $pages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
|
||||
$tmp = array(
|
||||
'status'=>'0',
|
||||
|
|
|
@ -52,7 +52,7 @@ class pluginNavigation extends Plugin {
|
|||
global $Language;
|
||||
global $url;
|
||||
global $site;
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
|
||||
// HTML for sidebar
|
||||
$html = '<div class="plugin plugin-navigation">';
|
||||
|
@ -101,7 +101,7 @@ class pluginNavigation extends Plugin {
|
|||
$onlyPublished = true;
|
||||
$pageNumber = 1;
|
||||
$amountOfItems = $this->getValue('amountOfItems');
|
||||
$publishedPages = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
$publishedPages = $pages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
|
||||
foreach ($publishedPages as $pageKey) {
|
||||
try {
|
||||
|
|
|
@ -36,7 +36,7 @@ class pluginRSS extends Plugin {
|
|||
private function createXML()
|
||||
{
|
||||
global $site;
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
global $url;
|
||||
|
||||
// Amount of pages to show
|
||||
|
@ -49,7 +49,7 @@ class pluginRSS extends Plugin {
|
|||
$onlyPublished = true;
|
||||
|
||||
// Get the list of pages
|
||||
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished, true);
|
||||
$list = $pages->getList($pageNumber, $amountOfItems, $onlyPublished, true);
|
||||
|
||||
$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
|
||||
$xml .= '<rss version="2.0">';
|
||||
|
|
|
@ -23,7 +23,7 @@ class pluginSitemap extends Plugin {
|
|||
private function createXML()
|
||||
{
|
||||
global $site;
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
|
||||
$xml = '<?xml version="1.0" encoding="UTF-8" ?>';
|
||||
$xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
||||
|
@ -36,7 +36,7 @@ class pluginSitemap extends Plugin {
|
|||
$pageNumber = 1;
|
||||
$amountOfItems = -1;
|
||||
$onlyPublished = true;
|
||||
$list = $dbPages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
$list = $pages->getList($pageNumber, $amountOfItems, $onlyPublished);
|
||||
|
||||
foreach($list as $pageKey) {
|
||||
try {
|
||||
|
|
|
@ -44,7 +44,7 @@ class pluginStaticPages extends Plugin {
|
|||
global $Language;
|
||||
global $url;
|
||||
global $site;
|
||||
global $dbPages;
|
||||
global $pages;
|
||||
|
||||
// HTML for sidebar
|
||||
$html = '<div class="plugin plugin-static-pages">';
|
||||
|
|
|
@ -155,7 +155,7 @@ foreach ($languageFiles as $fname=>$native) {
|
|||
}
|
||||
}
|
||||
|
||||
$Language = new dbLanguage($finalLanguage);
|
||||
$Language = new Language($finalLanguage);
|
||||
|
||||
// Set locale
|
||||
setlocale(LC_ALL, $localeFromHTTP);
|
||||
|
|
Loading…
Reference in New Issue