From 786f73cc5a97e50e4dec64e68be5c55d7546136e Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Fri, 3 Aug 2018 18:59:23 +0200 Subject: [PATCH] Changes on variables names --- bl-kernel/admin/controllers/content.php | 10 +-- bl-kernel/admin/views/new-content.php | 4 +- bl-kernel/admin/views/users.php | 2 +- bl-kernel/ajax/generate-slug.php | 2 +- bl-kernel/ajax/save-as-draft.php | 2 +- bl-kernel/boot/init.php | 28 +++---- bl-kernel/boot/rules/69.pages.php | 4 +- bl-kernel/boot/rules/99.paginator.php | 4 +- ...egories.class.php => categories.class.php} | 8 +- bl-kernel/functions.php | 76 +++++++++---------- ...blanguage.class.php => language.class.php} | 3 +- bl-kernel/login.class.php | 20 ++--- .../{dbpages.class.php => pages.class.php} | 2 +- bl-kernel/pagex.class.php | 24 +++--- .../{dbsite.class.php => site.class.php} | 3 +- .../{dbsyslog.class.php => syslog.class.php} | 4 +- .../{dbtags.class.php => tags.class.php} | 8 +- bl-kernel/user.class.php | 8 +- .../{dbusers.class.php => users.class.php} | 4 +- bl-plugins/api/plugin.php | 12 +-- bl-plugins/navigation/plugin.php | 4 +- bl-plugins/rss/plugin.php | 4 +- bl-plugins/sitemap/plugin.php | 4 +- bl-plugins/static-pages/plugin.php | 2 +- install.php | 2 +- 25 files changed, 121 insertions(+), 123 deletions(-) rename bl-kernel/{dbcategories.class.php => categories.class.php} (87%) rename bl-kernel/{dblanguage.class.php => language.class.php} (98%) rename bl-kernel/{dbpages.class.php => pages.class.php} (99%) rename bl-kernel/{dbsite.class.php => site.class.php} (99%) rename bl-kernel/{dbsyslog.class.php => syslog.class.php} (97%) rename bl-kernel/{dbtags.class.php => tags.class.php} (88%) rename bl-kernel/{dbusers.class.php => users.class.php} (98%) diff --git a/bl-kernel/admin/controllers/content.php b/bl-kernel/admin/controllers/content.php index 33612acb..fb44a492 100644 --- a/bl-kernel/admin/controllers/content.php +++ b/bl-kernel/admin/controllers/content.php @@ -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'); \ No newline at end of file diff --git a/bl-kernel/admin/views/new-content.php b/bl-kernel/admin/views/new-content.php index 4ab9c107..1d2d35e5 100644 --- a/bl-kernel/admin/views/new-content.php +++ b/bl-kernel/admin/views/new-content.php @@ -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 diff --git a/bl-kernel/admin/views/users.php b/bl-kernel/admin/views/users.php index ac5f7c86..3aeffa32 100644 --- a/bl-kernel/admin/views/users.php +++ b/bl-kernel/admin/views/users.php @@ -24,7 +24,7 @@ echo ' '; -$list = $dbUsers->getAllUsernames(); +$list = $users->keys(); foreach ($list as $username) { try { $user = new User($username); diff --git a/bl-kernel/ajax/generate-slug.php b/bl-kernel/ajax/generate-slug.php index 983def3b..d6063926 100644 --- a/bl-kernel/ajax/generate-slug.php +++ b/bl-kernel/ajax/generate-slug.php @@ -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, diff --git a/bl-kernel/ajax/save-as-draft.php b/bl-kernel/ajax/save-as-draft.php index 841748be..41708e70 100644 --- a/bl-kernel/ajax/save-as-draft.php +++ b/bl-kernel/ajax/save-as-draft.php @@ -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)) { diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index 9c5263c4..a7a945d3 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -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 --- diff --git a/bl-kernel/boot/rules/69.pages.php b/bl-kernel/boot/rules/69.pages.php index 89bdd42b..9fd8bc0c 100644 --- a/bl-kernel/boot/rules/69.pages.php +++ b/bl-kernel/boot/rules/69.pages.php @@ -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'); } diff --git a/bl-kernel/boot/rules/99.paginator.php b/bl-kernel/boot/rules/99.paginator.php index d7665c2f..88440151 100644 --- a/bl-kernel/boot/rules/99.paginator.php +++ b/bl-kernel/boot/rules/99.paginator.php @@ -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 diff --git a/bl-kernel/dbcategories.class.php b/bl-kernel/categories.class.php similarity index 87% rename from bl-kernel/dbcategories.class.php rename to bl-kernel/categories.class.php index 8cc9a41a..81517dba 100644 --- a/bl-kernel/dbcategories.class.php +++ b/bl-kernel/categories.class.php @@ -1,7 +1,7 @@ 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']; diff --git a/bl-kernel/functions.php b/bl-kernel/functions.php index dd817b0f..9e60824a 100644 --- a/bl-kernel/functions.php +++ b/bl-kernel/functions.php @@ -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( diff --git a/bl-kernel/dblanguage.class.php b/bl-kernel/language.class.php similarity index 98% rename from bl-kernel/dblanguage.class.php rename to bl-kernel/language.class.php index e9b375cc..01541c7c 100644 --- a/bl-kernel/dblanguage.class.php +++ b/bl-kernel/language.class.php @@ -1,7 +1,6 @@ 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; diff --git a/bl-kernel/dbpages.class.php b/bl-kernel/pages.class.php similarity index 99% rename from bl-kernel/dbpages.class.php rename to bl-kernel/pages.class.php index 8f6acf25..0ee32068 100644 --- a/bl-kernel/dbpages.class.php +++ b/bl-kernel/pages.class.php @@ -1,6 +1,6 @@ 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); diff --git a/bl-kernel/dbsite.class.php b/bl-kernel/site.class.php similarity index 99% rename from bl-kernel/dbsite.class.php rename to bl-kernel/site.class.php index 296c1ac3..fc7de943 100644 --- a/bl-kernel/dbsite.class.php +++ b/bl-kernel/site.class.php @@ -1,7 +1,6 @@ 'I am Guybrush Threepwood, mighty developer', 'slogan'=> '', diff --git a/bl-kernel/dbsyslog.class.php b/bl-kernel/syslog.class.php similarity index 97% rename from bl-kernel/dbsyslog.class.php rename to bl-kernel/syslog.class.php index dcbc5540..92c89e63 100644 --- a/bl-kernel/dbsyslog.class.php +++ b/bl-kernel/syslog.class.php @@ -1,7 +1,7 @@ array('inFile'=>false, 'value'=>''), 'dictionaryKey'=> array('inFile'=>false, 'value'=>''), diff --git a/bl-kernel/dbtags.class.php b/bl-kernel/tags.class.php similarity index 88% rename from bl-kernel/dbtags.class.php rename to bl-kernel/tags.class.php index 04e934d3..a2259989 100644 --- a/bl-kernel/dbtags.class.php +++ b/bl-kernel/tags.class.php @@ -1,7 +1,7 @@ getPublishedDB(false); + $db = $pages->getPublishedDB(false); $tagsIndex = array(); diff --git a/bl-kernel/user.class.php b/bl-kernel/user.class.php index 4ee85c9a..b64b64c7 100644 --- a/bl-kernel/user.class.php +++ b/bl-kernel/user.class.php @@ -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) { diff --git a/bl-kernel/dbusers.class.php b/bl-kernel/users.class.php similarity index 98% rename from bl-kernel/dbusers.class.php rename to bl-kernel/users.class.php index 90e535a2..8bf6af4e 100644 --- a/bl-kernel/dbusers.class.php +++ b/bl-kernel/users.class.php @@ -1,6 +1,6 @@ '', @@ -208,7 +208,7 @@ class dbUsers extends dbJSON { return $this->save(); } - public function getAllUsernames() + public function keys() { return array_keys($this->db); } diff --git a/bl-plugins/api/plugin.php b/bl-plugins/api/plugin.php index 06f9ce96..523be426 100644 --- a/bl-plugins/api/plugin.php +++ b/bl-plugins/api/plugin.php @@ -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', diff --git a/bl-plugins/navigation/plugin.php b/bl-plugins/navigation/plugin.php index 457687c7..0300651e 100644 --- a/bl-plugins/navigation/plugin.php +++ b/bl-plugins/navigation/plugin.php @@ -52,7 +52,7 @@ class pluginNavigation extends Plugin { global $Language; global $url; global $site; - global $dbPages; + global $pages; // HTML for sidebar $html = '
'; @@ -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 { diff --git a/bl-plugins/rss/plugin.php b/bl-plugins/rss/plugin.php index 864ca870..e310364f 100644 --- a/bl-plugins/rss/plugin.php +++ b/bl-plugins/rss/plugin.php @@ -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 .= ''; diff --git a/bl-plugins/sitemap/plugin.php b/bl-plugins/sitemap/plugin.php index 7a3d42e0..44eeed09 100644 --- a/bl-plugins/sitemap/plugin.php +++ b/bl-plugins/sitemap/plugin.php @@ -23,7 +23,7 @@ class pluginSitemap extends Plugin { private function createXML() { global $site; - global $dbPages; + global $pages; $xml = ''; $xml .= ''; @@ -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 { diff --git a/bl-plugins/static-pages/plugin.php b/bl-plugins/static-pages/plugin.php index 7fcd3566..44adc3fe 100644 --- a/bl-plugins/static-pages/plugin.php +++ b/bl-plugins/static-pages/plugin.php @@ -44,7 +44,7 @@ class pluginStaticPages extends Plugin { global $Language; global $url; global $site; - global $dbPages; + global $pages; // HTML for sidebar $html = '
'; diff --git a/install.php b/install.php index 9e1bb672..d9e0e6cb 100644 --- a/install.php +++ b/install.php @@ -155,7 +155,7 @@ foreach ($languageFiles as $fname=>$native) { } } -$Language = new dbLanguage($finalLanguage); +$Language = new Language($finalLanguage); // Set locale setlocale(LC_ALL, $localeFromHTTP);