Skip to content

Commit

Permalink
Move placeholders StaffCP pages to minecraft section
Browse files Browse the repository at this point in the history
  • Loading branch information
tadhgboyle committed May 15, 2021
1 parent d54c7dc commit 3a0b125
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 26 deletions.
2 changes: 1 addition & 1 deletion core/classes/Placeholders.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function __construct() {
$data->leaderboard = $placeholder->leaderboard;
$data->leaderboard_title = isset($placeholder->leaderboard_title) ? $placeholder->leaderboard_title : $data->friendly_name;
$data->leaderboard_sort = $sort;
$data->leaderboard_settings_url = URL::build('/panel/core/placeholders', 'leaderboard=' . $data->safe_name . '&server_id=' . $data->server_id);
$data->leaderboard_settings_url = URL::build('/panel/minecraft/placeholders', 'leaderboard=' . $data->safe_name . '&server_id=' . $data->server_id);
$placeholders[] = $data;
}

Expand Down
2 changes: 1 addition & 1 deletion core/classes/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Session {
* Check to see if a session exists.
*
* @param string $name Session variable name to check for.
* @return void
* @return bool
*/
public static function exists($name) {
return isset($_SESSION[$name]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@
</td>
</tr>
{/if}
{if isset($PLACEHOLDERS)}
<tr>
<td>
<a href="{$PLACEHOLDERS_LINK}">{$PLACEHOLDERS}</a>
</td>
</tr>
{/if}
</table>
</div>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
<h1 class="h3 mb-0 text-gray-800">{$PLACEHOLDERS}</h1>
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{$PANEL_INDEX}">{$DASHBOARD}</a></li>
<li class="breadcrumb-item active">{$CONFIGURATION}</li>
<li class="breadcrumb-item active">{$PLACEHOLDERS}</li>
<li class="breadcrumb-item active">{$INTEGRATIONS}</li>
<li class="breadcrumb-item"><a href="{$MINECRAFT_LINK}">{$MINECRAFT}</a></li>
<li class="breadcrumb-item active">{$PLACEHOLDERS}</li>
</ol>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
<h1 class="h3 mb-0 text-gray-800">{$PLACEHOLDER_LEADERBOARD_SETTINGS}</h1>
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{$PANEL_INDEX}">{$DASHBOARD}</a></li>
<li class="breadcrumb-item active">{$CONFIGURATION}</li>
<li class="breadcrumb-item active">{$INTEGRATIONS}</li>
<li class="breadcrumb-item"><a href="{$MINECRAFT_LINK}">{$MINECRAFT}</a></li>
<li class="breadcrumb-item active">{$PLACEHOLDERS}</li>
</ol>
</div>
Expand Down
2 changes: 1 addition & 1 deletion custom/panel_templates/Default/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public function onPageLoad() {
case 'reactions':
case 'social_media':
case 'widgets':
case 'placeholders':
case 'minecraft':
$this->addJSScript('
var elems = Array.prototype.slice.call(document.querySelectorAll(\'.js-switch\'));
Expand Down
12 changes: 1 addition & 11 deletions modules/Core/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function __construct($language, $pages, $user, $queries, $navigation, $ca
$pages->add('Core', '/panel/core/modules', 'pages/panel/modules.php');
$pages->add('Core', '/panel/core/pages', 'pages/panel/pages.php');
$pages->add('Core', '/panel/core/hooks', 'pages/panel/hooks.php');
$pages->add('Core', '/panel/core/placeholders', 'pages/panel/placeholders.php');
$pages->add('Core', '/panel/minecraft/placeholders', 'pages/panel/placeholders.php');
$pages->add('Core', '/panel/minecraft', 'pages/panel/minecraft.php');
$pages->add('Core', '/panel/minecraft/authme', 'pages/panel/minecraft_authme.php');
$pages->add('Core', '/panel/minecraft/account_verification', 'pages/panel/minecraft_account_verification.php');
Expand Down Expand Up @@ -882,16 +882,6 @@ public function onPageLoad($user, $pages, $cache, $smarty, $navs, $widgets, $tem

$navs[2]->addItemToDropdown('core_configuration', 'hooks', $language->get('admin', 'hooks'), URL::build('/panel/core/hooks'), 'top', null, $icon, $order);
}

if ($user->hasPermission('admincp.core.placeholders')) {
if (!$cache->isCached('placeholders_icon')) {
$icon = '<i class="nav-icon fas fa-sticky-note"></i>';
$cache->store('placeholders_icon', $icon);
} else
$icon = $cache->retrieve('placeholders_icon');

$navs[2]->addItemToDropdown('core_configuration', 'placeholders', $language->get('admin', 'placeholders'), URL::build('/panel/core/placeholders'), 'top', null, $icon, $order);
}
}

if($user->hasPermission('admincp.groups')){
Expand Down
7 changes: 7 additions & 0 deletions modules/Core/pages/panel/minecraft.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@
'BANNERS_LINK' => URL::build('/panel/minecraft/banners')
));
}

if ($user->hasPermission('admincp.core.placeholders')) {
$smarty->assign(array(
'PLACEHOLDERS' => $language->get('admin', 'placeholders'),
'PLACEHOLDERS_LINK' => URL::build('/panel/minecraft/placeholders')
));
}
}

$page_load = microtime(true) - $start;
Expand Down
25 changes: 16 additions & 9 deletions modules/Core/pages/panel/placeholders.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
}

define('PAGE', 'panel');
define('PARENT_PAGE', 'core_configuration');
define('PANEL_PAGE', 'placeholders');
define('PARENT_PAGE', 'integrations');
define('PANEL_PAGE', 'minecraft');
define('MINECRAFT_PAGE', 'placeholders');
$page_title = $language->get('admin', 'placeholders');
require_once(ROOT_PATH . '/core/templates/backend_init.php');
$queries = new Queries();

$all_placeholders = Placeholders::getInstance()->getAllPlaceholders();

$template_file = 'core/placeholders.tpl';
$template_file = 'integrations/minecraft/placeholders.tpl';

if (isset($_GET['leaderboard'])) {

Expand All @@ -33,7 +34,7 @@

if ($placeholder != null) {

$template_file = 'core/placeholders_leaderboard.tpl';
$template_file = 'integrations/minecraft/placeholders_leaderboard.tpl';

if (Input::exists()) {

Expand All @@ -54,7 +55,7 @@

Session::flash('placeholders_success', $language->get('admin', 'placeholder_leaderboard_updated'));

Redirect::to(URL::build('/panel/core/placeholders'));
Redirect::to(URL::build('/panel/minecraft/placeholders'));

} else {
$errors[] = $language->get('general', 'invalid_token');
Expand All @@ -71,18 +72,21 @@
'ENABLED_INFO' => $language->get('admin', 'placeholder_leaderboard_enable_info'),
'SUBMIT' => $language->get('general', 'submit'),
'BACK' => $language->get('general', 'back'),
'BACK_LINK' => URL::build('/panel/core/placeholders'),
'BACK_LINK' => URL::build('/panel/minecraft/placeholders'),
'PLACEHOLDERS' => $language->get('admin', 'placeholders'),
'PLACEHOLDER_LEADERBOARD_SETTINGS' => $language->get('admin', 'placeholder_leaderboard_settings'),
'PLACEHOLDER_LEADERBOARD_INFO' => $language->get('admin', 'placeholder_leaderboard_info'),
'PLACEHOLDER' => $placeholder,
'LEADERBOARD_ENABLED' => $language->get('admin', 'placeholder_leaderboard_enabled'),
'LEADERBOARD_TITLE' => $language->get('admin', 'placeholder_leaderboard_title'),
'LEADERBOARD_SORT' => $language->get('admin', 'placeholder_leaderboard_sort')
'LEADERBOARD_SORT' => $language->get('admin', 'placeholder_leaderboard_sort'),
'INTEGRATIONS' => $language->get('admin', 'integrations'),
'MINECRAFT' => $language->get('admin', 'minecraft'),
'MINECRAFT_LINK' => URL::build('/panel/minecraft')
));

} else {
Redirect::to(URL::build('/panel/core/placeholders'));
Redirect::to(URL::build('/panel/minecraft/placeholders'));
die();
}

Expand Down Expand Up @@ -110,7 +114,7 @@

Session::flash('placeholders_success', $language->get('admin', 'updated_placeholder_settings'));

Redirect::to(URL::build('/panel/core/placeholders'));
Redirect::to(URL::build('/panel/minecraft/placeholders'));
} else {
$errors[] = $language->get('general', 'invalid_token');
}
Expand Down Expand Up @@ -138,6 +142,9 @@
'SHOW_ON_FORUM_INFO' => $language->get('admin', 'placeholders_show_on_forum_info'),
'LEADERBOARD_ENABLED' => $language->get('admin', 'placeholder_leaderboard_enabled'),
'LEADERBOARD_SETTINGS' => $language->get('admin', 'leaderboard_settings'),
'INTEGRATIONS' => $language->get('admin', 'integrations'),
'MINECRAFT' => $language->get('admin', 'minecraft'),
'MINECRAFT_LINK' => URL::build('/panel/minecraft')
));
}

Expand Down

0 comments on commit 3a0b125

Please sign in to comment.