commit - 7d857ac3595ab2b09c1c059bbd37af40bdcdb385
commit + 84a99e0a598b2a59d1e9986e946790d1abf6c246
blob - 5914f9633318bcda0449817c28d065b4d0e48120
blob + 87afbf67d9fdc5d50eb363b7dcb8dacf3aca17b1
--- module/Securitx/config/module.config.php
+++ module/Securitx/config/module.config.php
'securitx/securitx/send' => __DIR__ . '/../view/securitx/send/send.phtml',
'securitx/securitx/invite' => __DIR__ . '/../view/securitx/invite/invite.phtml',
'securitx/securitx/companies' => __DIR__ . '/../view/securitx/companies/companies.phtml',
- 'securitx/securitx/user' => __DIR__ . '/../view/securitx/user/user.phtml',
+ 'securitx/securitx/members' => __DIR__ . '/../view/securitx/members/members.phtml',
'securitx/securitx/twofa' => __DIR__ . '/../view/securitx/twofa/twofa.phtml',
'securitx/securitx/forgot' => __DIR__ . '/../view/securitx/forgot/forgot.phtml',
'securitx/securitx/blockdomain' => __DIR__ . '/../view/securitx/blockdomain/blockdomain.phtml',
blob - 02dea4aff9e78d05134b78436235f0a944d09e53
blob + b3c4f62a173855a2df9cbd61813adab980ce0822
--- module/Securitx/src/Controller/SecuritxController.php
+++ module/Securitx/src/Controller/SecuritxController.php
use Securitx\Form\SendForm;
use Securitx\Form\TwofaForm;
use Securitx\Form\BlockDomainForm;
+use Securitx\Form\BlockMemberForm;
use Laminas\Mvc\InjectApplicationEventInterface;
use Laminas\Mvc\Controller\AbstractActionController;
} catch (\InvalidArgumentException $ex) {
return $this->redirect()->toRoute('securitx');
}
- if (!$member || !$member->verified)
+ if (!$member || !$member->verified || $member->blocked)
return $this->redirect()->toRoute('securitx');
if ((time() - $member->moddate) > 60 * 60 * 24) {
if ((time() - $member->twofa_moddate) > 60 * 10 ||
'first' => $admin->first,
]);
}
- public function userAction() {
+ public function membersAction() {
if (!$this->checkAnyAdmin())
return $this->redirect()->toRoute('securitx');
$member = $this->getMember();
- return new ViewModel();
+ $members = $this->member_table->fetchAll();
+ if (!$members)
+ goto ret;
+
+ if ($_GET) {
+ if (array_key_exists('block', $_GET)) {
+ $form = new BlockMemberForm();
+ $action = "block";
+ } else
+ goto ret;
+ $request = $this->getRequest();
+ if (!$request->isPost()) {
+ return new ViewModel([
+ 'members' => $members,
+ 'member' => $member,
+ 'action' => $action,
+ 'form' => $form,
+ 'completed' => false,
+ ]);
+ }
+
+ $form->setData($request->getPost());
+ if (!$form->isValid()) {
+ return new ViewModel([
+ 'members' => $members,
+ 'member' => $member,
+ 'action' => $action,
+ 'form' => $form,
+ 'completed' => false,
+ ]);
+ }
+ $data = $form->getData();
+ $dm = new Member();
+ $dm = $this->member_table->getMember($data['member_id']);
+ $dm->blocked = 1;
+ $this->member_table->saveMember($dm);
+ return new ViewModel([
+ 'member' => $member,
+ 'action' => $action,
+ 'completed' => true,
+ ]);
+ } else {
+ return $this->redirect()->toRoute('securitx',
+ array(
+ 'action' => 'home',
+ 'id' => $member->u_key,
+ )
+ );
+ }
+ret:
+ return $this->redirect()->toRoute('securitx',
+ array(
+ 'action' => 'home',
+ 'id' => $member->u_key,
+ )
+ );
}
public function cdownloadAction() {
if (!$this->checkAnyAdmin())
blob - /dev/null
blob + 263a5dda805b35c0be87544a3f7062f53c4d0a90 (mode 644)
--- /dev/null
+++ module/Securitx/src/Form/BlockMemberForm.php
+<?php
+namespace Securitx\Form;
+
+use Laminas\Captcha;
+use Laminas\Form\Form;
+use Laminas\Form\Element;
+
+class BlockMemberForm extends Form {
+ public function __construct() {
+ parent::__construct();
+
+ $this->add([
+ 'name' => 'member_id',
+ 'type' => 'select',
+ 'options' => [
+ 'label' => 'Select Member',
+ 'disable_inarray_validator' => true,
+ ],
+ ]);
+ $this->add([
+ 'name' => 'submit',
+ 'type' => 'submit',
+ 'attributes' => [
+ 'value' => 'Block Member',
+ 'id' => 'submitbutton',
+ ],
+ ]);
+ }
+}
blob - 65b538b27fd49c2daeac3835a2f9d94b915beaa5
blob + a917e47070dfa377d2677f3faba1ca47fa331cb8
--- module/Securitx/src/Model/Member.php
+++ module/Securitx/src/Model/Member.php
public $twofa;
public $twofa_moddate;
public $phone;
+ public $blocked;
private $inputFilter;
private $val;
$this->twofa = !empty($data['twofa']) ? $data['twofa'] : null;
$this->twofa_moddate = !empty($data['twofa_moddate']) ? $data['twofa_moddate'] : null;
$this->phone = !empty($data['phone']) ? $data['phone'] : null;
+ $this->blocked = !empty($data['blocked']) ? $data['blocked'] : null;
}
public function setInputFilter(InputFilterInterface $inputFilter) {
blob - e745f192a812b751ffef79c828bd4f2f09b97306
blob + a344bbf800d3403b9770f1a9666208d27c5831ff
--- module/Securitx/src/Model/MemberTable.php
+++ module/Securitx/src/Model/MemberTable.php
'twofa' => intval($member->twofa),
'twofa_moddate' => intval($member->twofa_moddate),
'phone' => intval($member->phone),
+ 'blocked' => intval($member->blocked),
];
$id = (int)$member->id;
blob - 8d2546413c98228f0ab4d9ba86b2e941a4fd22f4
blob + 7e6c5bb81c840c08cc4b74bc6b1b8ba35a3f3cfa
--- module/Securitx/view/securitx/home/home.phtml
+++ module/Securitx/view/securitx/home/home.phtml
echo "<hr class='my-4' \>";
?>
<p><a class="btn btn-secondary btn-lg" href="/securitx/blockdomain/<?= $member->u_key ?>">Block a domain »</a></p>
+ <p><a class="btn btn-secondary btn-lg" href="/securitx/members/<?= $member->u_key ?>?block">Block a member »</a></p>
<?php
echo "<hr class='my-4' \>";
}
blob - /dev/null
blob + 1092d7eefbb0b7312dedd854ee1edf9f3faa79f5 (mode 644)
--- /dev/null
+++ module/Securitx/view/securitx/members/members.phtml
+<?php
+ $this->headTitle('SecuritX: Manage Users');
+?>
+<div class="jumbotron">
+ <h1 class="display-4">Manage Users</h1>
+
+<?php if ($completed) { ?>
+ <p>Hello, <?= $member->first ?>.<br />The member has been <?= $action ?>.</p>
+
+ <hr class="my-4" \>
+
+
+<?php
+ goto done;
+ }
+?>
+ <p>Hello, <?= $member->first ?>.<br />
+ Here you can <?= $action ?> a member.</p>
+
+ <hr class="my-4" \>
+<?php
+ if ($action == "block") {
+ $m_opts = array();
+ $m_count = 0;
+ $cnt = 0;
+ foreach ($members as $member) {
+ /* we'll never delete the primary user */
+ if ($member->blocked)
+ continue;
+ if ($cnt) {
+ $m_opt = [
+ 'value' => $member->id,
+ 'label' => $this->escapeHtml("
+ $member->first $member->last, $member->email,
+ $member->office
+ "),
+ ];
+ array_push($m_opts, $m_opt);
+ $m_count++;
+ }
+ $cnt = 1;
+ }
+ if (!$m_count) {
+ echo "There are currently no SecuritX members for you to block.<br />";
+ echo "<br /><p><a class=\"a a-pad\" href=\"/securitx/home/$member->u_key\">Go home</a></p>";
+ return;
+ }
+ sort($m_opts);
+ $submit = $form->get('submit');
+ $submit->setAttribute('class', 'btn btn-primary');
+
+ $form->prepare();
+
+ $member_id = $form->get('member_id');
+ $member_id->setAttribute('class', 'form-control');
+ $member_id->setAttribute('placeholder', 'Select Member To Receive Documents (Name, Email, Office)');
+ $member_id->setValueOptions($m_opts);
+
+ echo $this->form()->openTag($form);
+?>
+ <div class="form-group">
+ <?= $this->formLabel($member_id) ?>
+ <?= $this->formElement($member_id) ?>
+ <?= $this->formElementErrors()->render($member_id,
+ ['class' => 'help-block']) ?>
+ </div>
+ <?= $this->formSubmit($form->get('submit')) ?>
+ <div id="progress" class="help-block">
+ <p> </p>
+ </div>
+<?php
+ $this->form()->closeTag();
+ }
+done:
+?>
+ <br /><p><a class="a a-pad" href="/securitx/home/<?= $member->u_key ?>">Go home</a></p>
+</div>
blob - 3bb8e3412cb2a45c9a75d85f29b1447461d9a0bb (mode 644)
blob + /dev/null
--- module/Securitx/view/securitx/user/user.phtml
+++ /dev/null
-<?php
- $this->headTitle('SecuritX: Manage Users');
-?>
-<div class="jumbotron">
- <h1 class="display-4">Manage Users</h1>
-
- <p>Congratulations! You've reached your SecuritX user editor!</p>
-
- <hr class="my-4" \>
-</div>
blob - dd542470914e92f054146b2e8417776a7499f635
blob + fd2d4ae5c9b1761c67932a88185bc8f77cab42d3
--- scripts/process_cleanup.php
+++ scripts/process_cleanup.php
rm_dir($downloads_path . $result['u_key']);
$query = "delete from members where verified = 1 and is_admin = 0 and " .
- "is_editor = 0 and moddate <= $thirty";
+ "is_editor = 0 and blocked != 1 and moddate <= $thirty";
$conn->exec($query);
function rm_dir($dir) {