mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-30 01:38:54 +00:00
Fix some more references to old Users class
This commit is contained in:
+8
-7
@@ -2,17 +2,18 @@
|
||||
|
||||
namespace nntmux;
|
||||
|
||||
use App\Models\User;
|
||||
use nntmux\db\DB;
|
||||
use App\Models\Content;
|
||||
|
||||
class Contents
|
||||
{
|
||||
const TYPEUSEFUL = 1;
|
||||
const TYPEARTICLE = 2;
|
||||
const TYPEINDEX = 3;
|
||||
protected const TYPEUSEFUL = 1;
|
||||
protected const TYPEARTICLE = 2;
|
||||
protected const TYPEINDEX = 3;
|
||||
|
||||
/**
|
||||
* @var DB
|
||||
* @var \nntmux\db\DB
|
||||
*/
|
||||
public $pdo;
|
||||
|
||||
@@ -165,7 +166,7 @@ class Contents
|
||||
$content->url = '/'.$content->url;
|
||||
}
|
||||
|
||||
if (substr($content->url, strlen($content->url) - 1) !== '/') {
|
||||
if (substr($content->url, \strlen($content->url) - 1) !== '/') {
|
||||
$content->url .= '/';
|
||||
}
|
||||
|
||||
@@ -331,7 +332,7 @@ class Contents
|
||||
*/
|
||||
public function data_getByID($id, $role)
|
||||
{
|
||||
if ($role === Users::ROLE_ADMIN) {
|
||||
if ($role === User::ROLE_ADMIN) {
|
||||
$role = '';
|
||||
} else {
|
||||
$role = sprintf('AND (role = %d OR role = 0)', $role);
|
||||
@@ -378,7 +379,7 @@ class Contents
|
||||
*/
|
||||
public function data_getForMenuByTypeAndRole($id, $role): array
|
||||
{
|
||||
if ($role === Users::ROLE_ADMIN) {
|
||||
if ($role === User::ROLE_ADMIN) {
|
||||
$role = '';
|
||||
} else {
|
||||
$role = sprintf('AND (role = %d OR role = 0)', $role);
|
||||
|
||||
+5
-4
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace nntmux;
|
||||
|
||||
use App\Models\User;
|
||||
use nntmux\db\DB;
|
||||
|
||||
/**
|
||||
@@ -31,12 +32,12 @@ class Menu
|
||||
public function get($role, $serverurl)
|
||||
{
|
||||
$guest = '';
|
||||
if ($role !== Users::ROLE_GUEST) {
|
||||
$guest = sprintf(' AND role != %d ', Users::ROLE_GUEST);
|
||||
if ($role !== User::ROLE_GUEST) {
|
||||
$guest = sprintf(' AND role != %d ', User::ROLE_GUEST);
|
||||
}
|
||||
|
||||
if ($role !== Users::ROLE_ADMIN) {
|
||||
$guest .= sprintf(' AND role != %d ', Users::ROLE_ADMIN);
|
||||
if ($role !== User::ROLE_ADMIN) {
|
||||
$guest .= sprintf(' AND role != %d ', User::ROLE_ADMIN);
|
||||
}
|
||||
|
||||
$data = $this->pdo->query(sprintf('SELECT * FROM menu WHERE role <= %d %s ORDER BY ordinal', $role, $guest));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'smarty.php';
|
||||
|
||||
use App\Models\User;
|
||||
use nntmux\Users;
|
||||
use nntmux\Contents;
|
||||
|
||||
@@ -53,7 +54,7 @@ switch ($action) {
|
||||
$page->title = 'Content Edit';
|
||||
$id = $_GET['id'];
|
||||
|
||||
$content = $contents->getByID($id, Users::ROLE_ADMIN);
|
||||
$content = $contents->getByID($id, User::ROLE_ADMIN);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use nntmux\Users;
|
||||
use App\Models\User;
|
||||
use nntmux\Category;
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ class AdminPage extends BasePage
|
||||
]
|
||||
);
|
||||
|
||||
if (! isset($this->userdata['user_roles_id']) || (int) $this->userdata['user_roles_id'] !== Users::ROLE_ADMIN || ! $this->users->isLoggedIn()) {
|
||||
if (! isset($this->userdata['user_roles_id']) || (int) $this->userdata['user_roles_id'] !== User::ROLE_ADMIN || ! $this->users->isLoggedIn()) {
|
||||
$this->show403(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user