XoopsModules25x /
suico
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | /* |
||
| 5 | You may not change or alter any portion of this comment or credits |
||
| 6 | of supporting developers from this source code or any supporting source code |
||
| 7 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, |
||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 12 | */ |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @category Module |
||
| 16 | * @package suico |
||
| 17 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 18 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 19 | * @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||
| 20 | */ |
||
| 21 | |||
| 22 | use Xmf\Request; |
||
| 23 | use XoopsModules\Suico; |
||
| 24 | |||
| 25 | require __DIR__ . '/header.php'; |
||
| 26 | if (!$xoopsUser) { |
||
| 27 | redirect_header('index.php'); |
||
| 28 | } |
||
| 29 | $friendshipFactory = new Suico\FriendshipHandler($xoopsDB); |
||
| 30 | $friend2_uid = Request::getInt('friend_uid', 0, 'POST'); |
||
| 31 | $marker = Request::getInt('marker', 0, 'POST'); |
||
| 32 | $friend = new XoopsUser($friend2_uid); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 33 | if (1 === $marker) { |
||
| 34 | $level = $_POST['level']; |
||
| 35 | $cool = $_POST['cool']; |
||
| 36 | $friendly = $_POST['hot']; |
||
| 37 | $funny = $_POST['trust']; |
||
| 38 | $fan = $_POST['fan']; |
||
| 39 | $friendship_id = Request::getInt('friendship_id', 0, 'POST'); |
||
| 40 | $criteria = new Criteria('friendship_id', $friendship_id); |
||
| 41 | $friendships = $friendshipFactory->getObjects($criteria); |
||
| 42 | $friendship = $friendships[0]; |
||
| 43 | $friendship->setVar('level', $level); |
||
| 44 | $friendship->setVar('cool', $cool); |
||
| 45 | $friendship->setVar('hot', $friendly); |
||
| 46 | $friendship->setVar('trust', $funny); |
||
| 47 | $friendship->setVar('fan', $fan); |
||
| 48 | $friend2_uid = (int)$friendship->getVar('friend2_uid'); |
||
| 49 | $friendship->unsetNew(); |
||
| 50 | $friendshipFactory->insert2($friendship); |
||
| 51 | redirect_header('friends.php', 2, _MD_SUICO_FRIENDSHIP_UPDATED); |
||
| 52 | } else { |
||
| 53 | $friendshipFactory->renderFormSubmit($friend); |
||
| 54 | } |
||
| 55 | require dirname(dirname(__DIR__)) . '/footer.php'; |
||
| 56 |