public function __construct($state = null) { parent::__construct('forgotPasswordForm', 'Reset password'); if ($state == null) { $this->state = Sanitizer::getInstance()->filterUint('state'); } else { $this->state = $state; } $this->addElement(new ElementHidden('state', null, $this->state)); switch ($this->state) { case self::STATE_USER_PROVIDE_EMAIL: $this->constructUserProvideEmail(); break; case self::STATE_USER_PROVIDE_SECRET: $this->constructUserProvideSecret(); break; default: throw new InvalidArgumentException('Unknown form state: ' . $this->state); } $this->addButtons(Form::BTN_SUBMIT); }
/** * @covers Xoops\Core\Text\Sanitizer::getInstance */ public function testGetInstance() { $actual = Sanitizer::getInstance(); $this->assertInstanceOf('\\Xoops\\Core\\Text\\Sanitizer', $actual); $this->assertSame($this->object, $actual); }
<?php require_once 'includes/widgets/header.php'; $groupId = Sanitizer::getInstance()->filterUint('id'); $sql = 'SELECT g.id, g.title FROM groups g WHERE g.id = :id'; $stmt = DatabaseFactory::getInstance()->prepare($sql); $stmt->bindValue(':id', $groupId); $stmt->execute(); $tpl->assign('itemGroup', $stmt->fetchRow()); $sql = 'SELECT u.id, "secondary" as source, u.username FROM group_memberships m LEFT JOIN users u ON m.user = u.id WHERE m.group = :id1 UNION SELECT u.id, "primary" as source, u.username FROM users u WHERE u.group = :id2'; $stmt = DatabaseFactory::getInstance()->prepare($sql); $stmt->bindValue(':id1', $groupId); $stmt->bindValue(':id2', $groupId); $stmt->execute(); $tpl->assign('listMembers', $stmt->fetchAll()); $sql = 'SELECT p.`key`, p.description FROM privileges_g gp LEFT JOIN permissions p ON gp.permission = p.id WHERE gp.group = :gid'; $stmt = DatabaseFactory::getInstance()->prepare($sql); $stmt->bindValue(':gid', $groupId); $stmt->execute(); $tpl->assign('listPrivileges', $stmt->fetchAll()); $tpl->display('viewGroup.tpl'); require_once 'includes/widgets/footer.php';