Change hidden to hide (Eloquent blocked keyword)

This commit is contained in:
slawkens 2024-01-27 16:54:48 +01:00
parent 3554b41172
commit d71bab648d
48 changed files with 143 additions and 122 deletions

View File

@ -73,7 +73,7 @@ if(!empty($action) && isRequestMethod('post'))
} }
} }
else if($action == 'hide') { else if($action == 'hide') {
if (Changelog::toggleHidden($id, $errors, $status)) { if (Changelog::toggleHide($id, $errors, $status)) {
success(($status == 1 ? 'Hide' : 'Show') . ' successful.'); success(($status == 1 ? 'Hide' : 'Show') . ' successful.');
} }
} }

View File

@ -88,7 +88,7 @@ if(!empty($action))
} }
} }
} else if ($action == 'hide') { } else if ($action == 'hide') {
if (News::toggleHidden($id, $errors, $status)) { if (News::toggleHide($id, $errors, $status)) {
success(($status == 1 ? 'Hide' : 'Show') . ' successful.'); success(($status == 1 ? 'Hide' : 'Show') . ' successful.');
} }
} }
@ -99,7 +99,7 @@ if(!empty($action))
} }
$categories = array(); $categories = array();
foreach($db->query('SELECT `id`, `name`, `icon_id` FROM `' . TABLE_PREFIX . 'news_categories` WHERE `hidden` != 1') as $cat) foreach($db->query('SELECT `id`, `name`, `icon_id` FROM `' . TABLE_PREFIX . 'news_categories` WHERE `hide` != 1') as $cat)
{ {
$categories[$cat['id']] = array( $categories[$cat['id']] = array(
'name' => $cat['name'], 'name' => $cat['name'],
@ -142,7 +142,7 @@ foreach ($query as $_news) {
$newses[$_news['type']][] = array( $newses[$_news['type']][] = array(
'id' => $_news['id'], 'id' => $_news['id'],
'hidden' => $_news['hidden'], 'hide' => $_news['hide'],
'archive_link' => getLink('news') . '/archive/' . $_news['id'], 'archive_link' => getLink('news') . '/archive/' . $_news['id'],
'title' => $_news['title'], 'title' => $_news['title'],
'date' => $_news['date'], 'date' => $_news['date'],

View File

@ -97,7 +97,7 @@ if (!empty($action) && isRequestMethod('post')) {
} }
} }
} else if ($action == 'hide') { } else if ($action == 'hide') {
if (Pages::toggleHidden($id, $errors, $status)) { if (Pages::toggleHide($id, $errors, $status)) {
success(($status == 0 ? 'Show' : 'Hide') . ' successful.'); success(($status == 0 ? 'Show' : 'Hide') . ' successful.');
} }
} }
@ -112,7 +112,7 @@ $pages = ModelsPages::all()->map(function ($e) {
'title' => substr($e->title, 0, 20), 'title' => substr($e->title, 0, 20),
'php' => $e->php == '1', 'php' => $e->php == '1',
'id' => $e->id, 'id' => $e->id,
'hidden' => $e->hidden 'hide' => $e->hide
]; ];
})->toArray(); })->toArray();

View File

@ -213,7 +213,7 @@ else if (isset($_REQUEST['search'])) {
} }
$deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true'); $deleted = (isset($_POST['deleted']) && $_POST['deleted'] == 'true');
$hidden = (isset($_POST['hidden']) && $_POST['hidden'] == 'true'); $hide = (isset($_POST['hide']) && $_POST['hide'] == 'true');
$created = strtotime($_POST['created']); $created = strtotime($_POST['created']);
verify_number($created, 'Created', 11); verify_number($created, 'Created', 11);
@ -290,7 +290,7 @@ else if (isset($_REQUEST['search'])) {
$player->setCustomField('deletion', $deleted ? '1' : '0'); $player->setCustomField('deletion', $deleted ? '1' : '0');
else else
$player->setCustomField('deleted', $deleted ? '1' : '0'); $player->setCustomField('deleted', $deleted ? '1' : '0');
$player->setCustomField('hidden', $hidden ? '1' : '0'); $player->setCustomField('hide', $hide ? '1' : '0');
$player->setCustomField('created', $created); $player->setCustomField('created', $created);
if (isset($comment)) if (isset($comment))
$player->setCustomField('comment', $comment); $player->setCustomField('comment', $comment);
@ -485,8 +485,8 @@ else if (isset($_REQUEST['search'])) {
</div> </div>
<div class="col-12 col-sm-12 col-lg-6"> <div class="col-12 col-sm-12 col-lg-6">
<div class="custom-control custom-switch custom-switch-on-success"> <div class="custom-control custom-switch custom-switch-on-success">
<input type="checkbox" class="custom-control-input" name="hidden" id="hidden" value="true" <?php echo($player->isHidden() ? ' checked' : ''); ?>> <input type="checkbox" class="custom-control-input" name="hide" id="hide" value="true" <?php echo($player->isHidden() ? ' checked' : ''); ?>>
<label class="custom-control-label" for="hidden">Hidden</label> <label class="custom-control-label" for="hide">Hidden</label>
</div> </div>
</div> </div>
</div> </div>

View File

@ -27,7 +27,7 @@ if (version_compare(phpversion(), '8.1', '<')) die('PHP version 8.1 or higher is
const MYAAC = true; const MYAAC = true;
const MYAAC_VERSION = '1.0-beta'; const MYAAC_VERSION = '1.0-beta';
const DATABASE_VERSION = 38; const DATABASE_VERSION = 39;
const TABLE_PREFIX = 'myaac_'; const TABLE_PREFIX = 'myaac_';
define('START_TIME', microtime(true)); define('START_TIME', microtime(true));
define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX')); define('MYAAC_OS', stripos(PHP_OS, 'WIN') === 0 ? 'WINDOWS' : (strtoupper(PHP_OS) === 'DARWIN' ? 'MAC' : 'LINUX'));

View File

@ -1,4 +1,4 @@
SET @myaac_database_version = 36; SET @myaac_database_version = 39;
CREATE TABLE `myaac_account_actions` CREATE TABLE `myaac_account_actions`
( (
@ -44,11 +44,11 @@ CREATE TABLE `myaac_changelog`
`where` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - server, 2 - site', `where` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '1 - server, 2 - site',
`date` INT(11) NOT NULL DEFAULT 0, `date` INT(11) NOT NULL DEFAULT 0,
`player_id` INT(11) NOT NULL DEFAULT 0, `player_id` INT(11) NOT NULL DEFAULT 0,
`hidden` TINYINT(1) NOT NULL DEFAULT 0, `hide` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
INSERT INTO `myaac_changelog` (`id`, `type`, `where`, `date`, `body`, `hidden`) VALUES (1, 3, 2, UNIX_TIMESTAMP(), 'MyAAC installed. (:', 0); INSERT INTO `myaac_changelog` (`id`, `type`, `where`, `date`, `body`, `hide`) VALUES (1, 3, 2, UNIX_TIMESTAMP(), 'MyAAC installed. (:', 0);
CREATE TABLE `myaac_config` CREATE TABLE `myaac_config`
( (
@ -67,7 +67,7 @@ CREATE TABLE `myaac_faq`
`question` VARCHAR(255) NOT NULL DEFAULT '', `question` VARCHAR(255) NOT NULL DEFAULT '',
`answer` VARCHAR(1020) NOT NULL DEFAULT '', `answer` VARCHAR(1020) NOT NULL DEFAULT '',
`ordering` INT(11) NOT NULL DEFAULT 0, `ordering` INT(11) NOT NULL DEFAULT 0,
`hidden` TINYINT(1) NOT NULL DEFAULT 0, `hide` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
@ -80,7 +80,7 @@ CREATE TABLE `myaac_forum_boards`
`guild` INT(11) NOT NULL DEFAULT 0, `guild` INT(11) NOT NULL DEFAULT 0,
`access` INT(11) NOT NULL DEFAULT 0, `access` INT(11) NOT NULL DEFAULT 0,
`closed` TINYINT(1) NOT NULL DEFAULT 0, `closed` TINYINT(1) NOT NULL DEFAULT 0,
`hidden` TINYINT(1) NOT NULL DEFAULT 0, `hide` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`, `closed`) VALUES (NULL, 'News', 'News commenting', 0, 1); INSERT INTO `myaac_forum_boards` (`id`, `name`, `description`, `ordering`, `closed`) VALUES (NULL, 'News', 'News commenting', 0, 1);
@ -129,7 +129,7 @@ CREATE TABLE `myaac_menu`
CREATE TABLE `myaac_monsters` ( CREATE TABLE `myaac_monsters` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`hidden` tinyint(1) NOT NULL default 0, `hide` tinyint(1) NOT NULL default 0,
`name` varchar(255) NOT NULL, `name` varchar(255) NOT NULL,
`mana` int(11) NOT NULL DEFAULT 0, `mana` int(11) NOT NULL DEFAULT 0,
`exp` int(11) NOT NULL, `exp` int(11) NOT NULL,
@ -174,7 +174,7 @@ CREATE TABLE `myaac_news`
`comments` VARCHAR(50) NOT NULL DEFAULT '', `comments` VARCHAR(50) NOT NULL DEFAULT '',
`article_text` VARCHAR(300) NOT NULL DEFAULT '', `article_text` VARCHAR(300) NOT NULL DEFAULT '',
`article_image` VARCHAR(100) NOT NULL DEFAULT '', `article_image` VARCHAR(100) NOT NULL DEFAULT '',
`hidden` TINYINT(1) NOT NULL DEFAULT 0, `hide` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
@ -184,7 +184,7 @@ CREATE TABLE `myaac_news_categories`
`name` VARCHAR(50) NOT NULL DEFAULT "", `name` VARCHAR(50) NOT NULL DEFAULT "",
`description` VARCHAR(50) NOT NULL DEFAULT "", `description` VARCHAR(50) NOT NULL DEFAULT "",
`icon_id` INT(2) NOT NULL DEFAULT 0, `icon_id` INT(2) NOT NULL DEFAULT 0,
`hidden` TINYINT(1) NOT NULL DEFAULT 0, `hide` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
@ -215,7 +215,7 @@ CREATE TABLE `myaac_pages`
`php` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '0 - plain html, 1 - php', `php` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '0 - plain html, 1 - php',
`enable_tinymce` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '1 - enabled, 0 - disabled', `enable_tinymce` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '1 - enabled, 0 - disabled',
`access` TINYINT(2) NOT NULL DEFAULT 0, `access` TINYINT(2) NOT NULL DEFAULT 0,
`hidden` TINYINT(1) NOT NULL DEFAULT 0, `hide` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE (`name`) UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
@ -228,7 +228,7 @@ CREATE TABLE `myaac_gallery`
`thumb` VARCHAR(255) NOT NULL, `thumb` VARCHAR(255) NOT NULL,
`author` VARCHAR(50) NOT NULL DEFAULT '', `author` VARCHAR(50) NOT NULL DEFAULT '',
`ordering` INT(11) NOT NULL DEFAULT 0, `ordering` INT(11) NOT NULL DEFAULT 0,
`hidden` TINYINT(1) NOT NULL DEFAULT 0, `hide` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;
@ -262,7 +262,7 @@ CREATE TABLE `myaac_spells`
`item_id` INT(11) NOT NULL DEFAULT 0, `item_id` INT(11) NOT NULL DEFAULT 0,
`premium` TINYINT(1) NOT NULL DEFAULT 0, `premium` TINYINT(1) NOT NULL DEFAULT 0,
`vocations` VARCHAR(100) NOT NULL DEFAULT '', `vocations` VARCHAR(100) NOT NULL DEFAULT '',
`hidden` TINYINT(1) NOT NULL DEFAULT 0, `hide` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE (`name`) UNIQUE (`name`)
) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8;

View File

@ -113,8 +113,8 @@ else {
$query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX ."news` WHERE `title` LIKE 'Hello!';"); $query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX ."news` WHERE `title` LIKE 'Hello!';");
if($query->rowCount() == 0) { if($query->rowCount() == 0) {
if(query("INSERT INTO `" . TABLE_PREFIX ."news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hidden`) VALUES (NULL, '1', UNIX_TIMESTAMP(), '2', 'Hello!', 'MyAAC is just READY to use!', " . $player_id . ", 'https://my-aac.org', '0'); if(query("INSERT INTO `" . TABLE_PREFIX ."news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hide`) VALUES (NULL, '1', UNIX_TIMESTAMP(), '2', 'Hello!', 'MyAAC is just READY to use!', " . $player_id . ", 'https://my-aac.org', '0');
INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hidden`) VALUES (NULL, '2', UNIX_TIMESTAMP(), '4', 'Hello tickets!', 'https://my-aac.org', " . $player_id . ", '', '0');")) { INSERT INTO `myaac_news` (`id`, `type`, `date`, `category`, `title`, `body`, `player_id`, `comments`, `hide`) VALUES (NULL, '2', UNIX_TIMESTAMP(), '4', 'Hello tickets!', 'https://my-aac.org', " . $player_id . ", '', '0');")) {
success($locale['step_database_created_news']); success($locale['step_database_created_news']);
} }
} }

View File

@ -180,17 +180,17 @@ if(!$db->hasColumn('players', 'deleted') && !$db->hasColumn('players', 'deletion
} }
if($db->hasColumn('players', 'hide_char')) { if($db->hasColumn('players', 'hide_char')) {
if(!$db->hasColumn('players', 'hidden')) { if(!$db->hasColumn('players', 'hide')) {
if(query("ALTER TABLE `players` CHANGE `hide_char` `hidden` TINYINT(1) NOT NULL DEFAULT 0;")) { if(query("ALTER TABLE `players` CHANGE `hide_char` `hide` TINYINT(1) NOT NULL DEFAULT 0;")) {
$tmp = str_replace('$FIELD$', 'players.hide_char', $locale['step_database_changing_field']); $tmp = str_replace('$FIELD$', 'players.hide_char', $locale['step_database_changing_field']);
$tmp = str_replace('$FIELD_NEW$', 'players.hidden', $tmp); $tmp = str_replace('$FIELD_NEW$', 'players.hide', $tmp);
success($tmp); success($tmp);
} }
} }
} }
else if(!$db->hasColumn('players', 'hidden')) { else if(!$db->hasColumn('players', 'hide')) {
if(query("ALTER TABLE `players` ADD `hidden` TINYINT(1) NOT NULL DEFAULT 0;")) if(query("ALTER TABLE `players` ADD `hide` TINYINT(1) NOT NULL DEFAULT 0;"))
success($locale['step_database_adding_field'] . ' players.hidden...'); success($locale['step_database_adding_field'] . ' players.hide...');
} }
if(!$db->hasColumn('players', 'comment')) { if(!$db->hasColumn('players', 'comment')) {

View File

@ -35,7 +35,7 @@ function insert_sample_if_not_exist($p) {
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote($p['name'])); $query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote($p['name']));
if($query->rowCount() == 0) { if($query->rowCount() == 0) {
if(!query("INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `lastlogout`, `balance`, `$deleted`, `created`, `hidden`, `comment`) VALUES (null, " . $db->quote($p['name']) . ", 1, " . getSession('account') . ", " . $p['level'] . ", " . $p['vocation_id'] . ", " . $p['health'] . ", " . $p['healthmax'] . ", " . $p['experience'] . ", 118, 114, 38, 57, " . $p['looktype'] . ", 0, " . $p['mana'] . ", " . $p['manamax'] . ", 0, " . $p['soul'] . ", 1, 1000, 1000, 7, '', " . $p['cap'] . ", 1, " . $time . ", 2130706433, 1, " . $time . ", 0, 0, " . $time . ", 1, '');")) if(!query("INSERT INTO `players` (`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `lastlogout`, `balance`, `$deleted`, `created`, `hide`, `comment`) VALUES (null, " . $db->quote($p['name']) . ", 1, " . getSession('account') . ", " . $p['level'] . ", " . $p['vocation_id'] . ", " . $p['health'] . ", " . $p['healthmax'] . ", " . $p['experience'] . ", 118, 114, 38, 57, " . $p['looktype'] . ", 0, " . $p['mana'] . ", " . $p['manamax'] . ", 0, " . $p['soul'] . ", 1, 1000, 1000, 7, '', " . $p['cap'] . ", 1, " . $time . ", 2130706433, 1, " . $time . ", 0, 0, " . $time . ", 1, '');"))
$success = false; $success = false;
} }
} }

View File

@ -257,7 +257,7 @@ function generateRandomString($length, $lowCase = true, $upCase = false, $numeri
function getForumBoards() function getForumBoards()
{ {
global $db, $canEdit; global $db, $canEdit;
$sections = $db->query('SELECT `id`, `name`, `description`, `closed`, `guild`, `access`' . ($canEdit ? ', `hidden`, `ordering`' : '') . ' FROM `' . TABLE_PREFIX . 'forum_boards` ' . (!$canEdit ? ' WHERE `hidden` != 1' : '') . $sections = $db->query('SELECT `id`, `name`, `description`, `closed`, `guild`, `access`' . ($canEdit ? ', `hide`, `ordering`' : '') . ' FROM `' . TABLE_PREFIX . 'forum_boards` ' . (!$canEdit ? ' WHERE `hide` != 1' : '') .
' ORDER BY `ordering`;'); ' ORDER BY `ordering`;');
if($sections) if($sections)
return $sections->fetchAll(); return $sections->fetchAll();

View File

@ -90,7 +90,7 @@ class OTS_Player extends OTS_Row_DAO
* @version 0.1.2 * @version 0.1.2
* @var array * @var array
*/ */
private $data = array('sex' => 0, 'vocation' => 0, 'experience' => 0, 'level' => 1, 'maglevel' => 0, 'health' => 100, 'healthmax' => 100, 'mana' => 100, 'manamax' => 100, 'manaspent' => 0, 'soul' => 0, 'lookbody' => 10, 'lookfeet' => 10, 'lookhead' => 10, 'looklegs' => 10, 'looktype' => 136, 'lookaddons' => 0, 'posx' => 0, 'posy' => 0, 'posz' => 0, 'cap' => 0, 'lastlogin' => 0, 'lastip' => 0, 'save' => true, 'skulltime' => 0, 'skull' => 0, 'balance' => 0, 'lastlogout' => 0, 'blessings' => 0, 'stamina' => 0, 'online' => 0, 'comment' => '', 'created' => 0, 'hidden' => 0); private $data = array('sex' => 0, 'vocation' => 0, 'experience' => 0, 'level' => 1, 'maglevel' => 0, 'health' => 100, 'healthmax' => 100, 'mana' => 100, 'manamax' => 100, 'manaspent' => 0, 'soul' => 0, 'lookbody' => 10, 'lookfeet' => 10, 'lookhead' => 10, 'looklegs' => 10, 'looktype' => 136, 'lookaddons' => 0, 'posx' => 0, 'posy' => 0, 'posz' => 0, 'cap' => 0, 'lastlogin' => 0, 'lastip' => 0, 'save' => true, 'skulltime' => 0, 'skull' => 0, 'balance' => 0, 'lastlogout' => 0, 'blessings' => 0, 'stamina' => 0, 'online' => 0, 'comment' => '', 'created' => 0, 'hide' => 0);
/** /**
* Player skills. * Player skills.
@ -231,7 +231,7 @@ class OTS_Player extends OTS_Row_DAO
} }
else { else {
// SELECT query on database // SELECT query on database
$this->data = $this->db->query('SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, `healthmax`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`' . ($this->db->hasColumn('players', 'lookaddons') ? ', `lookaddons`' : '') . ', `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `save`, `conditions`, `' . $__load['skull_time'] . '` as `skulltime`, `' . $__load['skull_type'] . '` as `skull`' . $__load['guild_info'] . ', `town_id`' . $__load['loss_experience'] . $__load['loss_items'] . ', `balance`' . ($__load['blessings'] ? ', `blessings`' : '') . ($__load['direction'] ? ', `direction`' : '') . ($__load['stamina'] ? ', `stamina`' : '') . ($__load['world_id'] ? ', `world_id`' : '') . ($__load['online'] ? ', `online`' : '') . ', `' . ($__load['deletion'] ? 'deletion' : 'deleted') . '`' . ($__load['promotion'] ? ', `promotion`' : '') . ($__load['marriage'] ? ', `marriage`' : '') . ', `comment`, `created`, `hidden` FROM `players` WHERE `id` = ' . (int)$id)->fetch(); $this->data = $this->db->query('SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, `healthmax`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`' . ($this->db->hasColumn('players', 'lookaddons') ? ', `lookaddons`' : '') . ', `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `save`, `conditions`, `' . $__load['skull_time'] . '` as `skulltime`, `' . $__load['skull_type'] . '` as `skull`' . $__load['guild_info'] . ', `town_id`' . $__load['loss_experience'] . $__load['loss_items'] . ', `balance`' . ($__load['blessings'] ? ', `blessings`' : '') . ($__load['direction'] ? ', `direction`' : '') . ($__load['stamina'] ? ', `stamina`' : '') . ($__load['world_id'] ? ', `world_id`' : '') . ($__load['online'] ? ', `online`' : '') . ', `' . ($__load['deletion'] ? 'deletion' : 'deleted') . '`' . ($__load['promotion'] ? ', `promotion`' : '') . ($__load['marriage'] ? ', `marriage`' : '') . ', `comment`, `created`, `hide` FROM `players` WHERE `id` = ' . (int)$id)->fetch();
} }
// loads skills // loads skills
@ -521,17 +521,17 @@ class OTS_Player extends OTS_Row_DAO
public function isHidden() public function isHidden()
{ {
if( !isset($this->data['hidden']) ) if( !isset($this->data['hide']) )
{ {
throw new E_OTS_NotLoaded(); throw new E_OTS_NotLoaded();
} }
return $this->data['hidden'] == 1; return $this->data['hide'] == 1;
} }
public function setHidden($hidden) public function setHidden($hidden)
{ {
$this->data['hidden'] = (int) $hidden; $this->data['hide'] = (int) $hidden;
} }
public function getMarriage() public function getMarriage()

View File

@ -2,7 +2,7 @@
$query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX . "pages` WHERE `name` LIKE " . $db->quote('downloads') . " LIMIT 1;"); $query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX . "pages` WHERE `name` LIKE " . $db->quote('downloads') . " LIMIT 1;");
if($query->rowCount() === 0) { if($query->rowCount() === 0) {
$db->exec("INSERT INTO `myaac_pages` (`id`, `name`, `title`, `body`, `date`, `player_id`, `php`, `access`, `hidden`) VALUES $db->exec("INSERT INTO `myaac_pages` (`id`, `name`, `title`, `body`, `date`, `player_id`, `php`, `access`, `hide`) VALUES
(null, 'downloads', 'Downloads', '<p>&nbsp;</p> (null, 'downloads', 'Downloads', '<p>&nbsp;</p>
<p>&nbsp;</p> <p>&nbsp;</p>
<div style=\"text-align: center;\">We''re using official Tibia Client <strong>{{ config.client / 100 }}</strong><br /> <div style=\"text-align: center;\">We''re using official Tibia Client <strong>{{ config.client / 100 }}</strong><br />
@ -13,7 +13,7 @@ if($query->rowCount() === 0) {
$query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX . "pages` WHERE `name` LIKE " . $db->quote('commands') . " LIMIT 1;"); $query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX . "pages` WHERE `name` LIKE " . $db->quote('commands') . " LIMIT 1;");
if($query->rowCount() === 0) { if($query->rowCount() === 0) {
$db->exec("INSERT INTO `myaac_pages` (`id`, `name`, `title`, `body`, `date`, `player_id`, `php`, `access`, `hidden`) VALUES $db->exec("INSERT INTO `myaac_pages` (`id`, `name`, `title`, `body`, `date`, `player_id`, `php`, `access`, `hide`) VALUES
(null, 'commands', 'Commands', '<table style=\"border-collapse: collapse; width: 87.8471%; height: 57px;\" border=\"1\"> (null, 'commands', 'Commands', '<table style=\"border-collapse: collapse; width: 87.8471%; height: 57px;\" border=\"1\">
<tbody> <tbody>
<tr style=\"height: 18px;\"> <tr style=\"height: 18px;\">

View File

@ -2,7 +2,7 @@
$query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX . "pages` WHERE `name` LIKE " . $db->quote('rules_on_the_page') . " LIMIT 1;"); $query = $db->query("SELECT `id` FROM `" . TABLE_PREFIX . "pages` WHERE `name` LIKE " . $db->quote('rules_on_the_page') . " LIMIT 1;");
if($query->rowCount() === 0) { if($query->rowCount() === 0) {
$db->exec("INSERT INTO `myaac_pages` (`id`, `name`, `title`, `body`, `date`, `player_id`, `php`, `enable_tinymce`, `access`, `hidden`) VALUES $db->exec("INSERT INTO `myaac_pages` (`id`, `name`, `title`, `body`, `date`, `player_id`, `php`, `enable_tinymce`, `access`, `hide`) VALUES
(null, 'rules_on_the_page', 'Rules', '1. Names (null, 'rules_on_the_page', 'Rules', '1. Names
a) Names which contain insulting (e.g. \"Bastard\"), racist (e.g. \"Nigger\"), extremely right-wing (e.g. \"Hitler\"), sexist (e.g. \"Bitch\") or offensive (e.g. \"Copkiller\") language. a) Names which contain insulting (e.g. \"Bastard\"), racist (e.g. \"Nigger\"), extremely right-wing (e.g. \"Hitler\"), sexist (e.g. \"Bitch\") or offensive (e.g. \"Copkiller\") language.
b) Names containing parts of sentences (e.g. \"Mike returns\"), nonsensical combinations of letters (e.g. \"Fgfshdsfg\") or invalid formattings (e.g. \"Thegreatknight\"). b) Names containing parts of sentences (e.g. \"Mike returns\"), nonsensical combinations of letters (e.g. \"Fgfshdsfg\") or invalid formattings (e.g. \"Thegreatknight\").

15
system/migrations/39.php Normal file
View File

@ -0,0 +1,15 @@
<?php
// 2024-01-27
// change hidden to hide (Eloquent model reserved keyword)
$db->exec("ALTER TABLE `players` CHANGE `hidden` `hide` TINYINT(1) NOT NULL DEFAULT 0;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "changelog` CHANGE `hidden` `hide` TINYINT(1) NOT NULL DEFAULT 0;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "faq` CHANGE `hidden` `hide` TINYINT(1) NOT NULL DEFAULT 0;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "forum_boards` CHANGE `hidden` `hide` TINYINT(1) NOT NULL DEFAULT 0;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "monsters` CHANGE `hidden` `hide` TINYINT(1) NOT NULL DEFAULT 0;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "news` CHANGE `hidden` `hide` TINYINT(1) NOT NULL DEFAULT 0;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "news_categories` CHANGE `hidden` `hide` TINYINT(1) NOT NULL DEFAULT 0;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "pages` CHANGE `hidden` `hide` TINYINT(1) NOT NULL DEFAULT 0;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "gallery` CHANGE `hidden` `hide` TINYINT(1) NOT NULL DEFAULT 0;");
$db->exec("ALTER TABLE `" . TABLE_PREFIX . "spells` CHANGE `hidden` `hide` TINYINT(1) NOT NULL DEFAULT 0;");

View File

@ -40,7 +40,7 @@ if($player_name != null) {
if (isset($_POST['changecommentsave']) && $_POST['changecommentsave'] == 1) { if (isset($_POST['changecommentsave']) && $_POST['changecommentsave'] == 1) {
if(empty($errors)) { if(empty($errors)) {
$player->hidden = $new_hideacc; $player->hide = $new_hideacc;
$player->comment = $new_comment; $player->comment = $new_comment;
$player->save(); $player->save();
$account_logged->logAction('Changed comment for character <b>' . $player->name . '</b>.'); $account_logged->logAction('Changed comment for character <b>' . $player->name . '</b>.');

View File

@ -342,8 +342,8 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
$signature_url = BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . urlencode($player->getName()) . '.png'; $signature_url = BASE_URL . (setting('core.friendly_urls') ? '' : 'index.php/') . urlencode($player->getName()) . '.png';
} }
$hidden = $player->isHidden(); $hide = $player->isHidden();
if(!$hidden) { if(!$hide) {
// check if account has been banned // check if account has been banned
$bannedUntil = ''; $bannedUntil = '';
$banned = array(); $banned = array();
@ -363,7 +363,7 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
$query = $db->query('SELECT `id` FROM `players` WHERE `account_id` = ' . $account->getId() . ' ORDER BY `name`')->fetchAll(); $query = $db->query('SELECT `id` FROM `players` WHERE `account_id` = ' . $account->getId() . ' ORDER BY `name`')->fetchAll();
foreach($query as $p) { foreach($query as $p) {
$_player = new OTS_Player(); $_player = new OTS_Player();
$fields = array('id', 'name', 'vocation', 'level', 'online', 'deleted', 'hidden'); $fields = array('id', 'name', 'vocation', 'level', 'online', 'deleted', 'hide');
$_player->load($p['id'], $fields, false); $_player->load($p['id'], $fields, false);
if($_player->isLoaded() && !$_player->isHidden()) { if($_player->isLoaded() && !$_player->isHidden()) {
$account_players[] = $_player; $account_players[] = $_player;
@ -404,7 +404,8 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil
'frags' => $frags, 'frags' => $frags,
'signature_url' => isset($signature_url) ? $signature_url : null, 'signature_url' => isset($signature_url) ? $signature_url : null,
'player_link' => getPlayerLink($player->getName(), false), 'player_link' => getPlayerLink($player->getName(), false),
'hidden' => $hidden, 'hide' => $hide,
'hidden' => $hide,
'bannedUntil' => isset($bannedUntil) ? $bannedUntil : null, 'bannedUntil' => isset($bannedUntil) ? $bannedUntil : null,
'account_players' => isset($account_players) ? $account_players : null, 'account_players' => isset($account_players) ? $account_players : null,
'search_form' => generate_search_form(), 'search_form' => generate_search_form(),

View File

@ -18,7 +18,7 @@ $title = 'Creatures';
if (empty($_REQUEST['name'])) { if (empty($_REQUEST['name'])) {
// display list of monsters // display list of monsters
$preview = setting('core.monsters_images_preview'); $preview = setting('core.monsters_images_preview');
$creatures = Monster::where('hidden', '!=', 1)->when(!empty($_REQUEST['boss']), function ($query) { $creatures = Monster::where('hide', '!=', 1)->when(!empty($_REQUEST['boss']), function ($query) {
$query->where('rewardboss', 1); $query->where('rewardboss', 1);
})->get()->toArray(); })->get()->toArray();
@ -39,7 +39,7 @@ if (empty($_REQUEST['name'])) {
// display monster // display monster
$creature_name = urldecode(stripslashes(ucwords(strtolower($_REQUEST['name'])))); $creature_name = urldecode(stripslashes(ucwords(strtolower($_REQUEST['name']))));
$creature = Monster::where('hidden', '!=', 1)->where('name', $creature_name)->first()->toArray(); $creature = Monster::where('hide', '!=', 1)->where('name', $creature_name)->first()->toArray();
if (isset($creature['name'])) { if (isset($creature['name'])) {
function sort_by_chance($a, $b) function sort_by_chance($a, $b)

View File

@ -49,7 +49,7 @@ if($canEdit)
} }
} }
else if($action == 'hide') { else if($action == 'hide') {
FAQ::toggleHidden($id, $errors); FAQ::toggleHide($id, $errors);
} }
else if($action == 'moveup') { else if($action == 'moveup') {
FAQ::move($id, -1, $errors); FAQ::move($id, -1, $errors);
@ -72,11 +72,11 @@ if($canEdit)
} }
$faqs = ModelsFAQ::select('id', 'question', 'answer')->when(!$canEdit, function ($query) { $faqs = ModelsFAQ::select('id', 'question', 'answer')->when(!$canEdit, function ($query) {
$query->where('hidden', '!=', 1); $query->where('hide', '!=', 1);
})->orderBy('ordering'); })->orderBy('ordering');
if ($canEdit) { if ($canEdit) {
$faqs->addSelect(['hidden', 'ordering']); $faqs->addSelect(['hide', 'ordering']);
} }
$faqs = $faqs->get()->toArray(); $faqs = $faqs->get()->toArray();
@ -146,15 +146,15 @@ class FAQ
return !count($errors); return !count($errors);
} }
static public function toggleHidden($id, &$errors) static public function toggleHide($id, &$errors)
{ {
if(isset($id)) if(isset($id))
{ {
$row = ModelsFAQ::find($id); $row = ModelsFAQ::find($id);
if ($row) { if ($row) {
$row->hidden = ($row->hidden == 1 ? 0 : 1); $row->hide = ($row->hide == 1 ? 0 : 1);
if (!$row->save()) { if (!$row->save()) {
$errors[] = 'Fail during toggle hidden FAQ.'; $errors[] = 'Fail during toggle hide FAQ.';
} }
} else { } else {
$errors[] = 'FAQ with id ' . $id . ' does not exists.'; $errors[] = 'FAQ with id ' . $id . ' does not exists.';

View File

@ -53,7 +53,7 @@ foreach($sections as $id => $section)
'link' => getForumBoardLink($id), 'link' => getForumBoardLink($id),
'name' => $section['name'], 'name' => $section['name'],
'description' => $section['description'], 'description' => $section['description'],
'hidden' => $section['hidden'], 'hide' => $section['hide'],
'posts' => isset($counters[$id]['posts']) ? $counters[$id]['posts'] : 0, 'posts' => isset($counters[$id]['posts']) ? $counters[$id]['posts'] : 0,
'threads' => isset($counters[$id]['threads']) ? $counters[$id]['threads'] : 0, 'threads' => isset($counters[$id]['threads']) ? $counters[$id]['threads'] : 0,
'last_post' => array( 'last_post' => array(

View File

@ -64,7 +64,7 @@ if($canEdit) {
} }
} }
else if($action == 'hide_board') { else if($action == 'hide_board') {
Forum::toggleHidden_board($id, $errors); Forum::toggleHide_board($id, $errors);
$action = ''; $action = '';
} }
else if($action == 'moveup_board') { else if($action == 'moveup_board') {

View File

@ -41,10 +41,10 @@ foreach(getForumBoards() as $section) {
); );
if($canEdit) { if($canEdit) {
$sections[$section['id']]['hidden'] = $section['hidden']; $sections[$section['id']]['hide'] = $section['hide'];
} }
else { else {
$sections[$section['id']]['hidden'] = 0; $sections[$section['id']]['hide'] = 0;
} }
} }

View File

@ -48,7 +48,7 @@ if($canEdit) {
$action = $comment = $image = $author = ''; $action = $comment = $image = $author = '';
} }
} else if ($action == 'hide') { } else if ($action == 'hide') {
Gallery::toggleHidden($id, $errors); Gallery::toggleHide($id, $errors);
} else if ($action == 'moveup') { } else if ($action == 'moveup') {
Gallery::move($id, -1, $errors); Gallery::move($id, -1, $errors);
} else if ($action == 'movedown') { } else if ($action == 'movedown') {
@ -107,9 +107,9 @@ if(isset($_GET['image']))
$images = Cache::remember('gallery_' . ($canEdit ? '1' : '0'), 60, function () use ($db, $canEdit) { $images = Cache::remember('gallery_' . ($canEdit ? '1' : '0'), 60, function () use ($db, $canEdit) {
return $db->query('SELECT `id`, `comment`, `image`, `author`, `thumb`' . return $db->query('SELECT `id`, `comment`, `image`, `author`, `thumb`' .
($canEdit ? ', `hidden`, `ordering`' : '') . ($canEdit ? ', `hide`, `ordering`' : '') .
' FROM `' . TABLE_PREFIX . 'gallery`' . ' FROM `' . TABLE_PREFIX . 'gallery`' .
(!$canEdit ? ' WHERE `hidden` != 1' : '') . (!$canEdit ? ' WHERE `hide` != 1' : '') .
' ORDER BY `ordering`;')->fetchAll(PDO::FETCH_ASSOC); ' ORDER BY `ordering`;')->fetchAll(PDO::FETCH_ASSOC);
}); });
@ -204,15 +204,15 @@ class Gallery
return !count($errors); return !count($errors);
} }
static public function toggleHidden($id, &$errors) static public function toggleHide($id, &$errors)
{ {
if(isset($id)) if(isset($id))
{ {
$row = ModelsGallery::find($id); $row = ModelsGallery::find($id);
if($row) { if($row) {
$row->hidden = $row->hidden == 1 ? 0 : 1; $row->hide = $row->hide == 1 ? 0 : 1;
if (!$row->save()) { if (!$row->save()) {
$errors[] = 'Fail during toggle hidden Gallery'; $errors[] = 'Fail during toggle hide Gallery';
} }
} else } else
$errors[] = 'Image with id ' . $id . ' does not exists.'; $errors[] = 'Image with id ' . $id . ' does not exists.';

View File

@ -20,7 +20,7 @@ if(isset($_GET['archive']))
$title = 'News Archive'; $title = 'News Archive';
$categories = array(); $categories = array();
foreach($db->query('SELECT id, name, icon_id FROM ' . TABLE_PREFIX . 'news_categories WHERE hidden != 1') as $cat) foreach($db->query('SELECT id, name, icon_id FROM ' . TABLE_PREFIX . 'news_categories WHERE hide != 1') as $cat)
{ {
$categories[$cat['id']] = array( $categories[$cat['id']] = array(
'name' => $cat['name'], 'name' => $cat['name'],
@ -37,7 +37,7 @@ if(isset($_GET['archive']))
if($id < 100000) if($id < 100000)
$field_name = 'id'; $field_name = 'id';
$news = $db->query('SELECT * FROM `'.TABLE_PREFIX . 'news` WHERE `hidden` != 1 AND `' . $field_name . '` = ' . $id . ''); $news = $db->query('SELECT * FROM `'.TABLE_PREFIX . 'news` WHERE `hide` != 1 AND `' . $field_name . '` = ' . $id . '');
if($news->rowCount() == 1) if($news->rowCount() == 1)
{ {
$news = $news->fetch(); $news = $news->fetch();
@ -61,7 +61,7 @@ if(isset($_GET['archive']))
$admin_options = ''; $admin_options = '';
if($canEdit) { if($canEdit) {
$admin_options = '<br/><br/>' . $twig->render('admin.links.html.twig', ['page' => 'news', 'id' => $news['id'], 'hidden' => $news['hidden']]); $admin_options = '<br/><br/>' . $twig->render('admin.links.html.twig', ['page' => 'news', 'id' => $news['id'], 'hide' => $news['hide']]);
} }
$twig->display('news.html.twig', array( $twig->display('news.html.twig', array(
@ -84,7 +84,7 @@ if(isset($_GET['archive']))
<?php <?php
$newses = array(); $newses = array();
$news_DB = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'news').' WHERE `type` = 1 AND `hidden` != 1 ORDER BY `date` DESC'); $news_DB = $db->query('SELECT * FROM '.$db->tableName(TABLE_PREFIX . 'news').' WHERE `type` = 1 AND `hide` != 1 ORDER BY `date` DESC');
foreach($news_DB as $news) foreach($news_DB as $news)
{ {
$newses[] = array( $newses[] = array(
@ -114,7 +114,7 @@ if($cache->enabled())
if(!$news_cached) if(!$news_cached)
{ {
$categories = array(); $categories = array();
foreach($db->query('SELECT `id`, `name`, `icon_id` FROM `' . TABLE_PREFIX . 'news_categories` WHERE `hidden` != 1') as $cat) foreach($db->query('SELECT `id`, `name`, `icon_id` FROM `' . TABLE_PREFIX . 'news_categories` WHERE `hide` != 1') as $cat)
{ {
$categories[$cat['id']] = array( $categories[$cat['id']] = array(
'name' => $cat['name'], 'name' => $cat['name'],
@ -122,7 +122,7 @@ if(!$news_cached)
); );
} }
$tickers_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . TICKER .($canEdit ? '' : ' AND `hidden` != 1') .' ORDER BY `date` DESC LIMIT ' . setting('core.news_ticker_limit')); $tickers_db = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . TICKER .($canEdit ? '' : ' AND `hide` != 1') .' ORDER BY `date` DESC LIMIT ' . setting('core.news_ticker_limit'));
$tickers_content = ''; $tickers_content = '';
if($tickers_db->rowCount() > 0) if($tickers_db->rowCount() > 0)
{ {
@ -130,6 +130,7 @@ if(!$news_cached)
foreach($tickers as &$ticker) { foreach($tickers as &$ticker) {
$ticker['icon'] = $categories[$ticker['category']]['icon_id']; $ticker['icon'] = $categories[$ticker['category']]['icon_id'];
$ticker['body_short'] = short_text(strip_tags($ticker['body']), 100); $ticker['body_short'] = short_text(strip_tags($ticker['body']), 100);
$ticker['hidden'] = $ticker['hide'];
} }
$tickers_content = $twig->render('news.tickers.html.twig', array( $tickers_content = $twig->render('news.tickers.html.twig', array(
@ -141,7 +142,7 @@ if(!$news_cached)
if($cache->enabled() && !$canEdit) if($cache->enabled() && !$canEdit)
$cache->set('news_' . $template_name . '_' . TICKER, $tickers_content, 60 * 60); $cache->set('news_' . $template_name . '_' . TICKER, $tickers_content, 60 * 60);
$featured_article_db =$db->query('SELECT `id`, `title`, `article_text`, `article_image`, `hidden` FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . ARTICLE . ($canEdit ? '' : ' AND `hidden` != 1') .' ORDER BY `date` DESC LIMIT 1'); $featured_article_db =$db->query('SELECT `id`, `title`, `article_text`, `article_image`, `hide` FROM `' . TABLE_PREFIX . 'news` WHERE `type` = ' . ARTICLE . ($canEdit ? '' : ' AND `hide` != 1') .' ORDER BY `date` DESC LIMIT 1');
$article = ''; $article = '';
if($featured_article_db->rowCount() > 0) { if($featured_article_db->rowCount() > 0) {
$article = $featured_article_db->fetch(); $article = $featured_article_db->fetch();
@ -154,7 +155,8 @@ if(!$news_cached)
'title' => $article['title'], 'title' => $article['title'],
'text' => $article['article_text'], 'text' => $article['article_text'],
'image' => $article['article_image'], 'image' => $article['article_image'],
'hidden' => $article['hidden'], 'hide' => $article['hide'],
'hidden' => $article['hide'],
'read_more'=> getLink('news/archive/') . $article['id'] 'read_more'=> getLink('news/archive/') . $article['id']
), ),
'canEdit' => $canEdit 'canEdit' => $canEdit
@ -173,7 +175,7 @@ else {
if(!$news_cached) if(!$news_cached)
{ {
ob_start(); ob_start();
$newses = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'news') . ' WHERE type = ' . NEWS . ($canEdit ? '' : ' AND hidden != 1') . ' ORDER BY date' . ' DESC LIMIT ' . setting('core.news_limit')); $newses = $db->query('SELECT * FROM ' . $db->tableName(TABLE_PREFIX . 'news') . ' WHERE type = ' . NEWS . ($canEdit ? '' : ' AND hide != 1') . ' ORDER BY date' . ' DESC LIMIT ' . setting('core.news_limit'));
if($newses->rowCount() > 0) if($newses->rowCount() > 0)
{ {
foreach($newses as $news) foreach($newses as $news)
@ -187,7 +189,7 @@ if(!$news_cached)
$admin_options = ''; $admin_options = '';
if($canEdit) { if($canEdit) {
$admin_options = '<br/><br/>' . $twig->render('admin.links.html.twig', ['page' => 'news', 'id' => $news['id'], 'hidden' => $news['hidden']]); $admin_options = '<br/><br/>' . $twig->render('admin.links.html.twig', ['page' => 'news', 'id' => $news['id'], 'hide' => $news['hide']]);
} }
$content_ = $news['body']; $content_ = $news['body'];
@ -209,7 +211,7 @@ if(!$news_cached)
'icon' => $categories[$news['category']]['icon_id'], 'icon' => $categories[$news['category']]['icon_id'],
'author' => setting('core.news_author') ? $author : '', 'author' => setting('core.news_author') ? $author : '',
'comments' => $news['comments'] != 0 ? getForumThreadLink($news['comments']) : null, 'comments' => $news['comments'] != 0 ? getForumThreadLink($news['comments']) : null,
'hidden'=> $news['hidden'] 'hide'=> $news['hide']
)); ));
} }
} }

View File

@ -37,7 +37,7 @@ else {
$order = 'name'; $order = 'name';
$spells = array(); $spells = array();
$spells_db = Spell::where('hidden', '!=', 1)->where('type', '<', 4)->orderBy($order)->get(); $spells_db = Spell::where('hide', '!=', 1)->where('type', '<', 4)->orderBy($order)->get();
if((string)$vocation_id != 'all') { if((string)$vocation_id != 'all') {
foreach($spells_db as $spell) { foreach($spells_db as $spell) {

View File

@ -221,7 +221,7 @@ else {
$content .= $tmp_content; $content .= $tmp_content;
if (hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) { if (hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) {
$pageInfo = getCustomPageInfo($pageName); $pageInfo = getCustomPageInfo($pageName);
$content = $twig->render('admin.links.html.twig', ['page' => 'pages', 'id' => $pageInfo !== null ? $pageInfo['id'] : 0, 'hidden' => $pageInfo !== null ? $pageInfo['hidden'] : '0'] $content = $twig->render('admin.links.html.twig', ['page' => 'pages', 'id' => $pageInfo !== null ? $pageInfo['id'] : 0, 'hide' => $pageInfo !== null ? $pageInfo['hide'] : '0']
) . $content; ) . $content;
} }

View File

@ -117,19 +117,19 @@ class Pages
return !count($errors); return !count($errors);
} }
static public function toggleHidden($id, &$errors, &$status) static public function toggleHide($id, &$errors, &$status)
{ {
if (isset($id)) { if (isset($id)) {
$row = ModelsPages::find($id); $row = ModelsPages::find($id);
if ($row) { if ($row) {
$row->hidden = $row->hidden == 1 ? 0 : 1; $row->hide = $row->hide == 1 ? 0 : 1;
if (!$row->save()) { if (!$row->save()) {
$errors[] = 'Fail during toggle hidden Page.'; $errors[] = 'Fail during toggle hide Page.';
} }
else { else {
clearRouteCache(); clearRouteCache();
} }
$status = $row->hidden; $status = $row->hide;
} }
else { else {
$errors[] = 'Page with id ' . $id . ' does not exists.'; $errors[] = 'Page with id ' . $id . ' does not exists.';

View File

@ -88,17 +88,17 @@ class Changelog
return true; return true;
} }
static public function toggleHidden($id, &$errors, &$status) static public function toggleHide($id, &$errors, &$status)
{ {
if(isset($id)) if(isset($id))
{ {
$row = ModelsChangelog::find($id); $row = ModelsChangelog::find($id);
if ($row) { if ($row) {
$row->hidden = $row->hidden == 1 ? 0 : 1; $row->hide = $row->hide == 1 ? 0 : 1;
if (!$row->save()) { if (!$row->save()) {
$errors[] = 'Fail during toggle hidden Changelog.'; $errors[] = 'Fail during toggle hide Changelog.';
} }
$status = $row->hidden; $status = $row->hide;
} else { } else {
$errors[] = 'Changelog with id ' . $id . ' does not exists.'; $errors[] = 'Changelog with id ' . $id . ' does not exists.';
} }

View File

@ -155,14 +155,14 @@ class Forum
return !count($errors); return !count($errors);
} }
public static function toggleHidden_board($id, &$errors) public static function toggleHide_board($id, &$errors)
{ {
global $db; global $db;
if(isset($id)) if(isset($id))
{ {
$query = self::get_board($id); $query = self::get_board($id);
if($query !== false) if($query !== false)
$db->update(TABLE_PREFIX . 'forum_boards', array('hidden' => ($query['hidden'] == 1 ? 0 : 1)), array('id' => $id)); $db->update(TABLE_PREFIX . 'forum_boards', array('hide' => ($query['hide'] == 1 ? 0 : 1)), array('id' => $id));
else else
$errors[] = 'Forum board with id ' . $id . ' does not exists.'; $errors[] = 'Forum board with id ' . $id . ' does not exists.';
} }

View File

@ -11,6 +11,6 @@ class Changelog extends Model {
public $timestamps = false; public $timestamps = false;
public function scopeIsPublic($query) { public function scopeIsPublic($query) {
$query->where('hidden', '!=', 1); $query->where('hide', '!=', 1);
} }
} }

View File

@ -10,5 +10,5 @@ class FAQ extends Model {
public $timestamps = false; public $timestamps = false;
protected $fillable = ['question', 'answer', 'ordering', 'hidden']; protected $fillable = ['question', 'answer', 'ordering', 'hide'];
} }

View File

@ -12,7 +12,7 @@ class News extends Model {
protected $fillable = [ protected $fillable = [
'title', 'body', 'type', 'date', 'category', 'player_id', 'title', 'body', 'type', 'date', 'category', 'player_id',
'last_modified_by', 'last_modified_date', 'comments', 'article_text', 'last_modified_by', 'last_modified_date', 'comments', 'article_text',
'article_image', 'hidden' 'article_image', 'hide'
]; ];
public function player() public function player()

View File

@ -9,13 +9,13 @@ class Pages extends Model {
public $timestamps = false; public $timestamps = false;
protected $fillable = ['name', 'title', 'body', 'date', 'player_id', 'php', 'enable_tinymce', 'access', 'hidden']; protected $fillable = ['name', 'title', 'body', 'date', 'player_id', 'php', 'enable_tinymce', 'access', 'hide'];
protected $casts = [ protected $casts = [
'player_id' => 'integer', 'player_id' => 'integer',
'enable_tinymce' => 'integer', 'enable_tinymce' => 'integer',
'access' => 'integer', 'access' => 'integer',
'hidden' => 'integer', 'hide' => 'integer',
]; ];
public function player() public function player()
@ -24,7 +24,7 @@ class Pages extends Model {
} }
public function scopeIsPublic($query) { public function scopeIsPublic($query) {
$query->where('hidden', '!=', 1); $query->where('hide', '!=', 1);
} }
} }

View File

@ -101,18 +101,18 @@ class News
return true; return true;
} }
static public function toggleHidden($id, &$errors, &$status) static public function toggleHide($id, &$errors, &$status)
{ {
if(isset($id)) if(isset($id))
{ {
$row = ModelsNews::find($id); $row = ModelsNews::find($id);
if($row) if($row)
{ {
$row->hidden = $row->hidden == 1 ? 0 : 1; $row->hide = $row->hide == 1 ? 0 : 1;
if (!$row->save()) { if (!$row->save()) {
$errors[] = 'Fail during toggle hidden News.'; $errors[] = 'Fail during toggle hide News.';
} }
$status = $row->hidden; $status = $row->hide;
} }
else else
$errors[] = 'News with id ' . $id . ' does not exists.'; $errors[] = 'News with id ' . $id . ' does not exists.';

View File

@ -81,7 +81,7 @@ class Spells {
'conjure_count' => $spell->getConjureCount(), 'conjure_count' => $spell->getConjureCount(),
'conjure_id' => $spell->getConjureId(), 'conjure_id' => $spell->getConjureId(),
'reagent' => $spell->getReagentId(), 'reagent' => $spell->getReagentId(),
'hidden' => $spell->isEnabled() ? 0 : 1 'hide' => $spell->isEnabled() ? 0 : 1
)); ));
if($show) { if($show) {
@ -121,7 +121,7 @@ class Spells {
'premium' => $spell->isPremium() ? 1 : 0, 'premium' => $spell->isPremium() ? 1 : 0,
'vocations' => json_encode($spell->getVocations()), 'vocations' => json_encode($spell->getVocations()),
'conjure_count' => 0, 'conjure_count' => 0,
'hidden' => $spell->isEnabled() ? 0 : 1 'hide' => $spell->isEnabled() ? 0 : 1
)); ));
if($show) { if($show) {
@ -159,7 +159,7 @@ class Spells {
'vocations' => json_encode($spell->getVocations()), 'vocations' => json_encode($spell->getVocations()),
'conjure_count' => 0, 'conjure_count' => 0,
'item_id' => $spell->getID(), 'item_id' => $spell->getID(),
'hidden' => $spell->isEnabled() ? 0 : 1 'hide' => $spell->isEnabled() ? 0 : 1
)); ));
if($show) { if($show) {

View File

@ -37,7 +37,7 @@ If you do not want to specify a certain field, just leave it blank.<br/><br/>
<td class="LabelV" >Hide Account:</td> <td class="LabelV" >Hide Account:</td>
<td> <td>
<input type="hidden" value="0" name="accountvisible"> <input type="hidden" value="0" name="accountvisible">
<input type="checkbox" name="accountvisible" id="accountvisible" value="1" {% if player.hidden %}checked="checked"{% endif %}> <input type="checkbox" name="accountvisible" id="accountvisible" value="1" {% if player.hide %}checked="checked"{% endif %}>
<label for="accountvisible"> check to hide your account information</label> <label for="accountvisible"> check to hide your account information</label>
{% if player.group_id > 1 %} (you will be also hidden on the Team page!){% endif %} {% if player.group_id > 1 %} (you will be also hidden on the Team page!){% endif %}
</td> </td>

View File

@ -51,7 +51,7 @@
{{ csrf() }} {{ csrf() }}
<input type="hidden" name="action" value="hide" /> <input type="hidden" name="action" value="hide" />
<input type="hidden" name="id" value="{{ log.id }}" /> <input type="hidden" name="id" value="{{ log.id }}" />
<button type="submit" class="btn btn-{{ (log.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if log.hidden != 1 %}Hide{% else %}Show{% endif %}"><i class="fas fa-eye{{ (log.hidden != 1) ? '' : '-slash' }}"></i></button> <button type="submit" class="btn btn-{{ (log.hide != 1) ? 'info' : 'default' }} btn-sm" title="{% if log.hide != 1 %}Hide{% else %}Show{% endif %}"><i class="fas fa-eye{{ (log.hide != 1) ? '' : '-slash' }}"></i></button>
</form> </form>
</div> </div>
</td> </td>

View File

@ -19,7 +19,7 @@
{{ csrf() }} {{ csrf() }}
<input type="hidden" name="action" value="hide" /> <input type="hidden" name="action" value="hide" />
<input type="hidden" name="id" value="{{ id }}" /> <input type="hidden" name="id" value="{{ id }}" />
<button type="submit" title="{% if hidden != 1 %}Hide{% else %}Show{% endif %}"><img src="images/{{ hidden != 1 ? 'success' : 'error' }}.png"/>{{ hidden != 1 ? 'Hide' : 'Show' }}</button> <button type="submit" title="{% if hide != 1 %}Hide{% else %}Show{% endif %}"><img src="images/{{ hide != 1 ? 'success' : 'error' }}.png"/>{{ hide != 1 ? 'Hide' : 'Show' }}</button>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -52,7 +52,7 @@
{{ csrf() }} {{ csrf() }}
<input type="hidden" name="action" value="hide" /> <input type="hidden" name="action" value="hide" />
<input type="hidden" name="id" value="{{ news.id }}" /> <input type="hidden" name="id" value="{{ news.id }}" />
<button type="submit" class="btn btn-{{ (news.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if news.hidden != 1 %}Hide{% else %}Show{% endif %}"><i class="fas fa-eye{{ (news.hidden != 1) ? '' : '-slash' }}"></i></button> <button type="submit" class="btn btn-{{ (news.hide != 1) ? 'info' : 'default' }} btn-sm" title="{% if news.hide != 1 %}Hide{% else %}Show{% endif %}"><i class="fas fa-eye{{ (news.hide != 1) ? '' : '-slash' }}"></i></button>
</form> </form>
</div> </div>
</td> </td>

View File

@ -44,7 +44,7 @@
{{ csrf() }} {{ csrf() }}
<input type="hidden" name="action" value="hide" /> <input type="hidden" name="action" value="hide" />
<input type="hidden" name="id" value="{{ page.id }}" /> <input type="hidden" name="id" value="{{ page.id }}" />
<button type="submit" class="btn btn-{{ (page.hidden != 1) ? 'info' : 'default' }} btn-sm" title="{% if page.hidden != 1 %}Hide{% else %}Show{% endif %}"><i class="fas fa-eye{{ (log.hidden != 1) ? '' : '-slash' }}"></i></button> <button type="submit" class="btn btn-{{ (page.hide != 1) ? 'info' : 'default' }} btn-sm" title="{% if page.hide != 1 %}Hide{% else %}Show{% endif %}"><i class="fas fa-eye{{ (log.hide != 1) ? '' : '-slash' }}"></i></button>
</form> </form>
</div> </div>
</td> </td>

View File

@ -25,7 +25,7 @@
<td>{{ log.body|nl2br}}</td> <td>{{ log.body|nl2br}}</td>
{% if canEdit %} {% if canEdit %}
<td> <td>
{{ include('admin.links.html.twig', {page: 'changelog', id: log.id, hidden: log.hidden }) }} {{ include('admin.links.html.twig', {page: 'changelog', id: log.id, hide: log.hide }) }}
</td> </td>
{% endif %} {% endif %}
</tr> </tr>

View File

@ -328,7 +328,7 @@
<!-- SIGNATURE_END --> <!-- SIGNATURE_END -->
{% endif %} {% endif %}
{{ hook(constant('HOOK_CHARACTERS_AFTER_SIGNATURE')) }} {{ hook(constant('HOOK_CHARACTERS_AFTER_SIGNATURE')) }}
{% if not hidden %} {% if not player.isHidden() %}
{% set rows = 0 %} {% set rows = 0 %}
<!-- ACCOUNT_INFORMATION --> <!-- ACCOUNT_INFORMATION -->
<br/><br/> <br/><br/>

View File

@ -20,8 +20,8 @@
<a id="delete" href="?subtopic=commands&action=delete&id={{ command.id }}" onclick="return confirm('Are you sure?');" title="Delete"> <a id="delete" href="?subtopic=commands&action=delete&id={{ command.id }}" onclick="return confirm('Are you sure?');" title="Delete">
<img src="images/del.png"/>Delete <img src="images/del.png"/>Delete
</a> </a>
<a href="?subtopic=commands&action=hide&id={{ command.id }}" title="{% if command.hidden != 1 %}Hide{% else %}Show{% endif %}"> <a href="?subtopic=commands&action=hide&id={{ command.id }}" title="{% if command.hide != 1 %}Hide{% else %}Show{% endif %}">
<img src="images/{% if command.hidden != 1 %}success{% else %}error{% endif %}.png"/>{% if command.hidden != 1 %}Hide{% else %}Show{% endif %} <img src="images/{% if command.hide != 1 %}success{% else %}error{% endif %}.png"/>{% if command.hide != 1 %}Hide{% else %}Show{% endif %}
</a> </a>
{% if i != 1 %} {% if i != 1 %}
<a href="?subtopic=commands&action=moveup&id={{ command.id }}" title="Move up"> <a href="?subtopic=commands&action=moveup&id={{ command.id }}" title="Move up">
@ -37,4 +37,4 @@
{% endif %} {% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -29,8 +29,8 @@
<a id="delete" href="?subtopic=faq&action=delete&id={{ faq.id }}" onclick="return confirm('Are you sure?');" title="Delete"> <a id="delete" href="?subtopic=faq&action=delete&id={{ faq.id }}" onclick="return confirm('Are you sure?');" title="Delete">
<img src="images/del.png"/>Delete <img src="images/del.png"/>Delete
</a> </a>
<a href="?subtopic=faq&action=hide&id={{ faq.id }}" title="{% if faq.hidden != 1 %}Hide{% else %}Show{% endif %}"> <a href="?subtopic=faq&action=hide&id={{ faq.id }}" title="{% if faq.hide != 1 %}Hide{% else %}Show{% endif %}">
<img src="images/{% if faq.hidden != 1 %}success{% else %}error{% endif %}.png"/>{% if faq.hidden != 1 %}Hide{% else %}Show{% endif %} <img src="images/{% if faq.hide != 1 %}success{% else %}error{% endif %}.png"/>{% if faq.hide != 1 %}Hide{% else %}Show{% endif %}
</a> </a>
{% if i != 1 %} {% if i != 1 %}
<a href="?subtopic=faq&action=moveup&id={{ faq.id }}" title="Move up"> <a href="?subtopic=faq&action=moveup&id={{ faq.id }}" title="Move up">
@ -67,4 +67,4 @@
expanded = !expanded; expanded = !expanded;
} }
</script> </script>

View File

@ -43,8 +43,8 @@
<a id="delete" href="?subtopic=forum&action=delete_board&id={{ board.id }}" onclick="return confirm('Are you sure?');" title="Delete"> <a id="delete" href="?subtopic=forum&action=delete_board&id={{ board.id }}" onclick="return confirm('Are you sure?');" title="Delete">
<img src="images/del.png"/>Delete <img src="images/del.png"/>Delete
</a> </a>
<a href="?subtopic=forum&action=hide_board&id={{ board.id }}" title="{% if board.hidden != 1 %}Hide{% else %}Show{% endif %}"> <a href="?subtopic=forum&action=hide_board&id={{ board.id }}" title="{% if board.hide != 1 %}Hide{% else %}Show{% endif %}">
<img src="images/{% if board.hidden != 1 %}success{% else %}error{% endif %}.png"/>{% if board.hidden != 1 %}Hide{% else %}Show{% endif %} <img src="images/{% if board.hide != 1 %}success{% else %}error{% endif %}.png"/>{% if board.hide != 1 %}Hide{% else %}Show{% endif %}
</a> </a>
{% if i != 1 %} {% if i != 1 %}
<a href="?subtopic=forum&action=moveup_board&id={{ board.id }}" title="Move up"> <a href="?subtopic=forum&action=moveup_board&id={{ board.id }}" title="Move up">
@ -60,4 +60,4 @@
{% endif %} {% endif %}
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -18,8 +18,8 @@ Click on the image to enlarge.<br/><br/>
<a id="delete" href="?subtopic=gallery&action=delete&id={{ image.id }}" onclick="return confirm('Are you sure?');" title="Delete"> <a id="delete" href="?subtopic=gallery&action=delete&id={{ image.id }}" onclick="return confirm('Are you sure?');" title="Delete">
<img src="images/del.png"/>Delete <img src="images/del.png"/>Delete
</a> </a>
<a href="?subtopic=gallery&action=hide&id={{ image.id }}" title="{% if image.hidden != 1 %}Hide{% else %}Show{% endif %}"> <a href="?subtopic=gallery&action=hide&id={{ image.id }}" title="{% if image.hide != 1 %}Hide{% else %}Show{% endif %}">
<img src="images/{% if image.hidden != 1 %}success{% else %}error{% endif %}.png"/>{% if image.hidden != 1 %}Hide{% else %}Show{% endif %} <img src="images/{% if image.hide != 1 %}success{% else %}error{% endif %}.png"/>{% if image.hide != 1 %}Hide{% else %}Show{% endif %}
</a> </a>
{% if i != 1 %} {% if i != 1 %}
<a href="?subtopic=gallery&action=moveup&id={{ image.id }}" title="Move up"> <a href="?subtopic=gallery&action=moveup&id={{ image.id }}" title="Move up">
@ -35,4 +35,4 @@ Click on the image to enlarge.<br/><br/>
{% endif %} {% endif %}
</tr> </tr>
</table> </table>
{% endfor %} {% endfor %}

View File

@ -20,7 +20,7 @@
<b> <b>
<p>{{ article.title|raw }} <p>{{ article.title|raw }}
{% if canEdit %} {% if canEdit %}
{{ include('admin.links.html.twig', {page: 'news', id: article.id, hidden: article.hidden }) }} {{ include('admin.links.html.twig', {page: 'news', id: article.id, hide: article.hide }) }}
{% endif %} {% endif %}
</p> </p>
</b> </b>

View File

@ -20,7 +20,7 @@
<div id="TickerEntry-{{ i }}-ShortText" class="NewsTickerShortText">{{ ticker.body_short|raw }}</div> <div id="TickerEntry-{{ i }}-ShortText" class="NewsTickerShortText">{{ ticker.body_short|raw }}</div>
<div id="TickerEntry-{{ i }}-FullText" class="NewsTickerFullText">{{ ticker.body|raw }} <div id="TickerEntry-{{ i }}-FullText" class="NewsTickerFullText">{{ ticker.body|raw }}
{% if canEdit %} {% if canEdit %}
{{ include('admin.links.html.twig', {page: 'news', id: ticker.id, hidden: ticker.hidden }) }} {{ include('admin.links.html.twig', {page: 'news', id: ticker.id, hide: ticker.hide }) }}
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -20,7 +20,7 @@ if(isset($_GET['title'], $_GET['body'], $_GET['player_id'], $_GET['category'], $
{ {
$categories = array(); $categories = array();
foreach($db->query( foreach($db->query(
'SELECT id, name, icon_id FROM ' . TABLE_PREFIX . 'news_categories WHERE hidden != 1') as $cat) 'SELECT id, name, icon_id FROM ' . TABLE_PREFIX . 'news_categories WHERE hide != 1') as $cat)
{ {
$categories[$cat['id']] = array( $categories[$cat['id']] = array(
'name' => $cat['name'], 'name' => $cat['name'],
@ -51,6 +51,7 @@ if(isset($_GET['title'], $_GET['body'], $_GET['player_id'], $_GET['category'], $
'title' => $_GET['title'], 'title' => $_GET['title'],
'text' => $_GET['article_text'], 'text' => $_GET['article_text'],
'image' => $_GET['article_image'], 'image' => $_GET['article_image'],
'hide' => 0,
'hidden' => 0, 'hidden' => 0,
'read_more'=> '#' 'read_more'=> '#'
), ),
@ -68,6 +69,7 @@ if(isset($_GET['title'], $_GET['body'], $_GET['player_id'], $_GET['category'], $
foreach($tickers as &$ticker) { foreach($tickers as &$ticker) {
$ticker['icon'] = $categories[$ticker['category']]['icon_id']; $ticker['icon'] = $categories[$ticker['category']]['icon_id'];
$ticker['body_short'] = short_text(strip_tags($ticker['body']), 100); $ticker['body_short'] = short_text(strip_tags($ticker['body']), 100);
$ticker['hidden'] = $ticker['hide'];
} }
$tickers_content = $twig->render('news.tickers.html.twig', array( $tickers_content = $twig->render('news.tickers.html.twig', array(
@ -88,7 +90,8 @@ if(isset($_GET['title'], $_GET['body'], $_GET['player_id'], $_GET['category'], $
'author' => setting('core.news_author') ? $author : '', 'author' => setting('core.news_author') ? $author : '',
'comments' => null, 'comments' => null,
'news_date_format' => setting('core.news_date_format'), 'news_date_format' => setting('core.news_date_format'),
'hidden'=> 0 'hide'=> 0,
'hidden' => 0,
))); )));
} }
} }