Fix settings statuses of groups in admin groups page

This commit is contained in:
DariusIII
2017-04-13 09:44:06 +02:00
parent fe62ff0de9
commit ccc7d3012b
6 changed files with 25 additions and 24 deletions
+1
View File
@@ -1,4 +1,5 @@
2017-04-13 DariusIII
* Fix: Fix settings statuses of groups in admin groups page
* Chg: Update forum and forumpost related tpl's and pages
2017-04-12 DariusIII
* Chg: Update dariusiii/rarinfo package
+1 -1
View File
@@ -576,7 +576,7 @@ class Groups
WHERE id = {$id}"
);
return "Group {$id}: {$column} has been " . (($status == 0) ? 'deactivated' : 'activated') . '.';
return "Group {$id}: {$column} has been " . (($status === 0) ? 'deactivated' : 'activated') . '.';
}
/**
+9 -9
View File
@@ -45,12 +45,12 @@ switch($_GET['action']) {
case 'group_edit_purge_all':
session_write_close();
(new Groups($settings))->purge();
print "All groups purged.";
print 'All groups purged.';
break;
case 'group_edit_reset_all':
(new Groups($settings))->resetall();
print "All groups reset.";
print 'All groups reset.';
break;
case 'group_edit_purge_single':
@@ -88,17 +88,17 @@ switch($_GET['action']) {
case 'sharing_toggle_status':
$admin->settings->queryExec(sprintf('UPDATE sharing_sites SET enabled = %d WHERE id = %d', $_GET['site_status'], $_GET['site_id']));
print ($_GET['site_status'] == 1 ? 'Activated' : 'Deactivated') . ' site ' . $_GET['site_id'];
print ($_GET['site_status'] === 1 ? 'Activated' : 'Deactivated') . ' site ' . $_GET['site_id'];
break;
case 'sharing_toggle_enabled':
$admin->settings->queryExec(sprintf('UPDATE sharing SET enabled = %d', $_GET['enabled_status']));
print ($_GET['enabled_status'] == 1 ? 'Enabled' : 'Disabled') . ' sharing!';
print ($_GET['enabled_status'] === 1 ? 'Enabled' : 'Disabled') . ' sharing!';
break;
case 'sharing_start_position':
$admin->settings->queryExec(sprintf('UPDATE sharing SET start_position = %d', $_GET['start_position']));
print ($_GET['start_position'] == 1 ? 'Enabled' : 'Disabled') . ' fetching from start of group!';
print ($_GET['start_position'] === 1 ? 'Enabled' : 'Disabled') . ' fetching from start of group!';
break;
case 'sharing_reset_settings':
@@ -128,22 +128,22 @@ switch($_GET['action']) {
case 'sharing_toggle_posting':
$admin->settings->queryExec(sprintf('UPDATE sharing SET posting = %d', $_GET['posting_status']));
print ($_GET['posting_status'] == 1 ? 'Enabled' : 'Disabled') . ' posting!';
print ($_GET['posting_status'] === 1 ? 'Enabled' : 'Disabled') . ' posting!';
break;
case 'sharing_toggle_fetching':
$admin->settings->queryExec(sprintf('UPDATE sharing SET fetching = %d', $_GET['fetching_status']));
print ($_GET['fetching_status'] == 1 ? 'Enabled' : 'Disabled') . ' fetching!';
print ($_GET['fetching_status'] === 1 ? 'Enabled' : 'Disabled') . ' fetching!';
break;
case 'sharing_toggle_site_auto_enabling';
$admin->settings->queryExec(sprintf('UPDATE sharing SET auto_enable = %d', $_GET['auto_status']));
print ($_GET['auto_status'] == 1 ? 'Enabled' : 'Disabled') . ' automatic site enabling!';
print ($_GET['auto_status'] === 1 ? 'Enabled' : 'Disabled') . ' automatic site enabling!';
break;
case 'sharing_toggle_hide_users':
$admin->settings->queryExec(sprintf('UPDATE sharing SET hide_users = %d', $_GET['hide_status']));
print ($_GET['hide_status'] == 1? 'Enabled' : 'Disabled') . ' hiding of user names!';
print ($_GET['hide_status'] === 1? 'Enabled' : 'Disabled') . ' hiding of user names!';
break;
case 'sharing_toggle_all_sites':
+2 -2
View File
@@ -35,11 +35,11 @@ if (isset($_GET['action']) && $_GET['action'] === 2) {
$id = (int)$_GET['group_id'];
if(isset($_GET['group_status'])) {
$status = isset($_GET['group_status']) ? (int)$_GET['group_status'] : 0;
print $group->updateGroupStatus($id, $status);
print $group->updateGroupStatus($id, 'active', $status);
}
if(isset($_GET['backfill_status'])) {
$status = isset($_GET['backfill_status']) ? (int)$_GET['backfill_status'] : 0;
print $group->updateGroupStatus($id, $status);
print $group->updateGroupStatus($id, 'backfill', $status);
}
}
}
+9 -9
View File
@@ -10,31 +10,31 @@ $groups = new Groups(['Settings' => $page->settings]);
$id = 0;
// Set the current action.
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view';
$action = $_REQUEST['action'] ?? 'view';
switch($action) {
case 'submit':
if ($_POST["id"] == "") {
if ($_POST['id'] === '') {
// Add a new group.
$_POST["name"] = $groups->isValidGroup($_POST["name"]);
if ($_POST["name"] !== false) {
$_POST['name'] = $groups->isValidGroup($_POST['name']);
if ($_POST['name'] !== false) {
$groups->add($_POST);
}
} else {
// Update an existing group.
$groups->update($_POST);
}
header("Location:".WWW_TOP."/group-list.php");
header('Location:' . WWW_TOP . '/group-list.php');
break;
case 'view':
default:
if (isset($_GET["id"])) {
$page->title = "Newsgroup Edit";
$id = $_GET["id"];
if (isset($_GET['id'])) {
$page->title = 'Newsgroup Edit';
$id = $_GET['id'];
$group = $groups->getByID($id);
} else {
$page->title = "Newsgroup Add";
$page->title = 'Newsgroup Add';
$group = [
'id' => '',
'name' => '',
+3 -3
View File
@@ -6,8 +6,8 @@ use nntmux\Groups;
$page = new AdminPage();
$groups = new Groups(['Settings' => $page->settings]);
$groupName = (isset($_REQUEST['groupname']) && !empty($_REQUEST['groupname']) ? $_REQUEST['groupname'] : '');
$offset = (isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0);
$groupName = $_REQUEST['groupname'] ?? '';
$offset = $_REQUEST['offset'] ?? 0;
$page->smarty->assign(
[
@@ -16,7 +16,7 @@ $page->smarty->assign(
'pageroffset' => $offset,
'pageritemsperpage' => ITEMS_PER_PAGE,
'pagerquerybase' =>
WWW_TOP . "/group-list.php?" . (($groupName != '') ? "groupname=$groupName&" : '') . 'offset=',
WWW_TOP . '/group-list.php?' . (($groupName !== '') ? "groupname=$groupName" : '') . '&offset=',
'pagerquerysuffix' => '',
'grouplist' => $groups->getRange($offset, ITEMS_PER_PAGE, $groupName, -1)
]