Skip to content

Commit

Permalink
update codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanashi committed Oct 19, 2024
1 parent 02e13c7 commit 67a9385
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,36 +1,50 @@
<?php

namespace wcf\system\event\listener;

use wcf\system\request\LinkHandler;
use wcf\system\WCF;
use wcf\util\HeaderUtil;

class HaModeratedUserGroupListPageListener implements IParameterizedEventListener {
public function execute($eventObj, $className, $eventName, array &$parameters) {
class HaModeratedUserGroupListPageListener implements IParameterizedEventListener
{
public function execute($eventObj, $className, $eventName, array &$parameters)
{
if ($eventName == 'afterInitObjectList') {
if (isset($_POST['haGroupName'])) {
$eventObj->objectList->getConditionBuilder()->add('user_group.groupName LIKE ?', ['%'.$_POST['haGroupName'].'%']);
$eventObj->objectList->getConditionBuilder()->add(
'user_group.groupName LIKE ?',
['%' . $_POST['haGroupName'] . '%']
);

WCF::getSession()->register('haGroupName', $_POST['haGroupName']);

WCF::getTpl()->assign([
'haGroupName' => $_POST['haGroupName']
'haGroupName' => $_POST['haGroupName'],
]);
} else if (!empty(WCF::getSession()->getVar('haGroupName'))) {
} elseif (!empty(WCF::getSession()->getVar('haGroupName'))) {
$haGroupName = WCF::getSession()->getVar('haGroupName');

$eventObj->objectList->getConditionBuilder()->add('user_group.groupName LIKE ?', ['%'.$haGroupName.'%']);
$eventObj->objectList->getConditionBuilder()->add(
'user_group.groupName LIKE ?',
['%' . $haGroupName . '%']
);

WCF::getTpl()->assign([
'haGroupName' => $haGroupName
'haGroupName' => $haGroupName,
]);
}
} else if ($eventName == 'countItems') {
} elseif ($eventName == 'countItems') {
if ($eventObj->objectList->countObjects() == 0 && !empty(WCF::getSession()->getVar('haGroupName'))) {
WCF::getSession()->unregister('haGroupName');

HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink('ModeratedUserGroupList'), WCF::getLanguage()->getDynamicVariable('wcf.moderated.hanashi.noResult'));
exit;
HeaderUtil::delayedRedirect(
LinkHandler::getInstance()->getLink('ModeratedUserGroupList'),
WCF::getLanguage()->getDynamicVariable('wcf.moderated.hanashi.noResult')
);

exit;
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,36 +1,50 @@
<?php

namespace wcf\system\event\listener;

use wcf\system\request\LinkHandler;
use wcf\system\WCF;
use wcf\util\HeaderUtil;

class HaUserGroupListPageListener implements IParameterizedEventListener {
public function execute($eventObj, $className, $eventName, array &$parameters) {
class HaUserGroupListPageListener implements IParameterizedEventListener
{
public function execute($eventObj, $className, $eventName, array &$parameters)
{
if ($eventName == 'afterInitObjectList') {
if (isset($_POST['haUserGroupName'])) {
$eventObj->objectList->getConditionBuilder()->add('user_group.groupName LIKE ?', ['%'.$_POST['haUserGroupName'].'%']);
$eventObj->objectList->getConditionBuilder()->add(
'user_group.groupName LIKE ?',
['%' . $_POST['haUserGroupName'] . '%']
);

WCF::getSession()->register('haUserGroupName', $_POST['haUserGroupName']);

WCF::getTpl()->assign([
'haUserGroupName' => $_POST['haUserGroupName']
'haUserGroupName' => $_POST['haUserGroupName'],
]);
} else if (!empty(WCF::getSession()->getVar('haUserGroupName'))) {
} elseif (!empty(WCF::getSession()->getVar('haUserGroupName'))) {
$haUserGroupName = WCF::getSession()->getVar('haUserGroupName');

$eventObj->objectList->getConditionBuilder()->add('user_group.groupName LIKE ?', ['%'.$haUserGroupName.'%']);
$eventObj->objectList->getConditionBuilder()->add(
'user_group.groupName LIKE ?',
['%' . $haUserGroupName . '%']
);

WCF::getTpl()->assign([
'haUserGroupName' => $haUserGroupName
'haUserGroupName' => $haUserGroupName,
]);
}
} else if ($eventName == 'countItems') {
} elseif ($eventName == 'countItems') {
if ($eventObj->objectList->countObjects() == 0 && !empty(WCF::getSession()->getVar('haUserGroupName'))) {
WCF::getSession()->unregister('haUserGroupName');

HeaderUtil::delayedRedirect(LinkHandler::getInstance()->getLink('UserGroupList'), WCF::getLanguage()->getDynamicVariable('wcf.moderated.hanashi.noResult'));
HeaderUtil::delayedRedirect(
LinkHandler::getInstance()->getLink('UserGroupList'),
WCF::getLanguage()->getDynamicVariable('wcf.moderated.hanashi.noResult')
);

exit;
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
<?php

namespace wcf\system\event\listener;

use wcf\system\WCF;

class HaUserGroupManageMemberListPageListener implements IParameterizedEventListener {
public function execute($eventObj, $className, $eventName, array &$parameters) {
class HaUserGroupManageMemberListPageListener implements IParameterizedEventListener
{
public function execute($eventObj, $className, $eventName, array &$parameters)
{
if (isset($_POST['haMemberName'])) {
$eventObj->objectList->getConditionBuilder()->add('user_table.username LIKE ?', ['%'.$_POST['haMemberName'].'%']);
$eventObj->objectList->getConditionBuilder()->add(
'user_table.username LIKE ?',
['%' . $_POST['haMemberName'] . '%']
);

WCF::getSession()->register('haMemberName', $_POST['haMemberName']);

WCF::getTpl()->assign([
'haMemberName' => $_POST['haMemberName']
'haMemberName' => $_POST['haMemberName'],
]);
} else if (!empty(WCF::getSession()->getVar('haMemberName'))) {
} elseif (!empty(WCF::getSession()->getVar('haMemberName'))) {
$haMemberName = WCF::getSession()->getVar('haMemberName');

$eventObj->objectList->getConditionBuilder()->add('user_table.username LIKE ?', ['%'.$haMemberName.'%']);
$eventObj->objectList->getConditionBuilder()->add(
'user_table.username LIKE ?',
['%' . $haMemberName . '%']
);

WCF::getTpl()->assign([
'haMemberName' => $haMemberName
'haMemberName' => $haMemberName,
]);
}
}
}
}

0 comments on commit 67a9385

Please sign in to comment.