Skip to content

Commit

Permalink
Merge pull request #157 from mambax7/master
Browse files Browse the repository at this point in the history
cleanup
  • Loading branch information
mambax7 committed May 3, 2020
2 parents bdf7ae6 + e23cdb3 commit 702889c
Show file tree
Hide file tree
Showing 25 changed files with 96 additions and 90 deletions.
1 change: 1 addition & 0 deletions activate.php
@@ -1,5 +1,6 @@
<?php

declare(strict_types=1);
/**
* Extended User Profile
*
Expand Down
2 changes: 1 addition & 1 deletion admin/blocksadmin.php
Expand Up @@ -410,6 +410,7 @@ function isBlockCloned(
* @param bool $visible
* @param string $side
* @param int $bcachetime
* @param $bmodule
*/
function setOrder(
$bid,
Expand All @@ -420,7 +421,6 @@ function setOrder(
$bcachetime,
$bmodule
) {
/** @var \XoopsBlock $myblock */
$myblock = new XoopsBlock($bid);
$myblock->setVar('title', $title);
$myblock->setVar('weight', $weight);
Expand Down
2 changes: 2 additions & 0 deletions admin/fieldscategory.php
@@ -1,4 +1,6 @@
<?php

declare(strict_types=1);
/*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
Expand Down
4 changes: 4 additions & 0 deletions admin/fieldslist.php
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

/**
* Extended User Profile
*
Expand Down Expand Up @@ -316,6 +319,7 @@
/**
* @param $field_id
* @param $field_required
* @param $helper
*/
function suico_visible_toggle($field_id, $field_required, $helper)
{
Expand Down
1 change: 1 addition & 0 deletions admin/fieldspermissions.php
@@ -1,5 +1,6 @@
<?php

declare(strict_types=1);
/**
* Extended User Profile
*
Expand Down
1 change: 1 addition & 0 deletions admin/fieldsvisibility.php
@@ -1,5 +1,6 @@
<?php

declare(strict_types=1);
/**
* Extended User Profile
*
Expand Down
3 changes: 3 additions & 0 deletions admin/registrationstep.php
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

/**
* Extended User Profile
*
Expand Down
8 changes: 6 additions & 2 deletions admin/user.php
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

/**
* Extended User Profile
*
Expand All @@ -18,6 +21,7 @@
*/

use Xmf\Request;
use XoopsModules\Suico;
use XoopsModules\Suico\Form\UserForm;

include_once __DIR__ . '/admin_header.php';
Expand All @@ -29,7 +33,7 @@
if ('editordelete' === $op) {
$op = isset($_REQUEST['delete']) ? 'delete' : 'edit';
}
/* @var XoopsMemberHandler $handler */
/* @var \XoopsMemberHandler $handler */
$handler = xoops_getHandler('member');
switch ($op) {
default:
Expand Down Expand Up @@ -75,7 +79,7 @@
$fields = $profileHandler->loadFields();
$userfields = $profileHandler->getUserVars();
// Get ids of fields that can be edited
/* @var XoopsGroupPermHandler $grouppermHandler */
/* @var \XoopsGroupPermHandler $grouppermHandler */
$grouppermHandler = xoops_getHandler('groupperm');
$editable_fields = $grouppermHandler->getItemIds('profile_edit', $GLOBALS['xoopsUser']->getGroups(), $GLOBALS['xoopsModule']->getVar('mid'));
$uid = empty($_POST['uid']) ? 0 : (int)$_POST['uid'];
Expand Down
3 changes: 3 additions & 0 deletions changemail.php
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

/**
* Extended User Profile
*
Expand Down
3 changes: 3 additions & 0 deletions changepass.php
@@ -1,4 +1,7 @@
<?php

declare(strict_types=1);

/**
* Extended User Profile
*
Expand Down
1 change: 1 addition & 0 deletions class/AudioHandler.php
Expand Up @@ -310,6 +310,7 @@ public function deleteAll(
* @param string $path_upload The path to where the file should be uploaded
* @param string $author the author of the music or audio file
* @param $maxfilebytes
* @param $description
* @return bool FALSE if upload fails or database fails
*/
public function receiveAudio(
Expand Down
4 changes: 4 additions & 0 deletions class/Common/FilesManagement.php
Expand Up @@ -28,6 +28,10 @@
use Throwable;
use XoopsUser;

/**
* Trait FilesManagement
* @package XoopsModules\Suico\Common
*/
trait FilesManagement
{
/**
Expand Down
9 changes: 7 additions & 2 deletions class/Field.php
Expand Up @@ -28,8 +28,13 @@
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
*/

use XoopsModules\Suico;
use XoopsModules\Suico\Profile;

/**
* Class Field
* @package XoopsModules\Suico
*/
class Field extends \XoopsObject
{
public function __construct()
Expand Down Expand Up @@ -231,7 +236,7 @@ public function getOutputValue($user, $profile)
$value = \is_array($value) ? $value[0] : $value;
$options = $this->getVar('field_options');
if (isset($options[$value])) {
$value = \htmlspecialchars(\defined($options[$value]) ? \constant($options[$value]) : $options[$value]);
$value = \htmlspecialchars(\defined($options[$value]) ? \constant($options[$value]) : $options[$value], ENT_QUOTES | ENT_HTML5);
} else {
$value = '';
}
Expand All @@ -244,7 +249,7 @@ public function getOutputValue($user, $profile)
if (\count($options) > 0) {
foreach (\array_keys($options) as $key) {
if (\in_array($key, $value)) {
$ret[$key] = \htmlspecialchars(\defined($options[$key]) ? \constant($options[$key]) : $options[$key]);
$ret[$key] = \htmlspecialchars(\defined($options[$key]) ? \constant($options[$key]) : $options[$key], ENT_QUOTES | ENT_HTML5);
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions class/FieldHandler.php
Expand Up @@ -26,6 +26,9 @@
* @package kernel
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
*/

use XoopsModules\Suico;

class FieldHandler extends \XoopsPersistableObjectHandler
{
/**
Expand Down
8 changes: 7 additions & 1 deletion class/Form/FieldForm.php
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace XoopsModules\Suico\Form;

use XoopsModules\Suico;
Expand All @@ -13,13 +15,17 @@
use XoopsFormLabel;
use XoopsFormTextDateSelect;

/**
* Class FieldForm
* @package XoopsModules\Suico\Form
*/
class FieldForm extends XoopsThemeForm
{
/**
* @param Suico\Field $field {@link Suico\Field} object to get edit form for
* @param mixed $action URL to submit to - or false for $_SERVER['REQUEST_URI']
*/
function __construct(Suico\Field $field, $action = false)
public function __construct(Suico\Field $field, $action = false)
{
if (!$action) {
$action = $_SERVER['REQUEST_URI'];
Expand Down
10 changes: 9 additions & 1 deletion class/Form/RegisterForm.php
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace XoopsModules\Suico\Form;

use XoopsModules\Suico;
Expand All @@ -20,7 +22,13 @@
*/
class RegisterForm extends XoopsThemeForm
{
function __construct(\XoopsUser $user, $profile, $step = null)
/**
* RegisterForm constructor.
* @param \XoopsUser $user
* @param $profile
* @param null $step
*/
public function __construct(\XoopsUser $user, $profile, $step = null)
{
global $opkey; // should be set in register.php
if (empty($opkey)) {
Expand Down
9 changes: 8 additions & 1 deletion class/Form/StepForm.php
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace XoopsModules\Suico\Form;

use XoopsModules\Suico;
Expand All @@ -17,7 +19,12 @@
*/
class StepForm extends XoopsThemeForm
{
function __construct(Regstep $step = null, $action = false)
/**
* StepForm constructor.
* @param \XoopsModules\Suico\Regstep|null $step
* @param bool $action
*/
public function __construct(Regstep $step = null, $action = false)
{
if (!$action) {
$action = $_SERVER['REQUEST_URI'];
Expand Down
10 changes: 9 additions & 1 deletion class/Form/UserForm.php
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace XoopsModules\Suico\Form;

use XoopsModules\Suico;
Expand All @@ -21,7 +23,13 @@
*/
class UserForm extends XoopsThemeForm
{
function __construct(\XoopsUser $user, Profile $profile = null, $action = false)
/**
* UserForm constructor.
* @param \XoopsUser $user
* @param \XoopsModules\Suico\Profile|null $profile
* @param bool $action
*/
public function __construct(\XoopsUser $user, Profile $profile = null, $action = false)
{
$helper = \XoopsModules\Suico\Helper::getInstance();
if (!$action) {
Expand Down
14 changes: 13 additions & 1 deletion class/GroupsHandler.php
Expand Up @@ -542,6 +542,10 @@ public function receiveGroup(
return true;
}

/**
* @param $owner_id
* @return mixed
*/
public function isGroupMember($owner_id)
{
$query = 'SELECT COUNT(rel_id) AS grouptotalmembers FROM ' . $GLOBALS['xoopsDB']->prefix('suico_relgroupuser') . ' WHERE rel_group_id=' . $group_id . '';
Expand All @@ -551,17 +555,25 @@ public function isGroupMember($owner_id)
return $group_total_members;
}

/**
* @param $group_id
* @return mixed
*/
public function getComment($group_id)
{
$moduleSuico = Helper::getInstance()->getModule();
$sql = "SELECT count(com_id) FROM " . $GLOBALS['xoopsDB']->prefix('xoopscomments') . " WHERE com_modid = '" . $moduleSuico->getVar('mid') . "' AND com_itemid = '" . $group_id . "'";
$sql = 'SELECT count(com_id) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopscomments') . " WHERE com_modid = '" . $moduleSuico->getVar('mid') . "' AND com_itemid = '" . $group_id . "'";
$result = $GLOBALS['xoopsDB']->query($sql);
while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) {
$group_total_comments = $row['count(com_id)'];
}
return $group_total_comments;
}

/**
* @param $group_id
* @return mixed
*/
public function getGroupTotalMembers($group_id)
{
$query = 'SELECT COUNT(rel_id) AS grouptotalmembers FROM ' . $GLOBALS['xoopsDB']->prefix('suico_relgroupuser') . ' WHERE rel_group_id=' . $group_id . '';
Expand Down
2 changes: 1 addition & 1 deletion class/ProfileHandler.php
Expand Up @@ -40,7 +40,7 @@ class ProfileHandler extends \XoopsPersistableObjectHandler
*/
public $_fHandler;
/**
* Array of {@link XoopsSuico\Field} objects
* Array of {@link Suico\Field} objects
* @var array
*/
public $_fields = [];
Expand Down
1 change: 1 addition & 0 deletions class/SuicoController.php
Expand Up @@ -70,6 +70,7 @@ class SuicoController extends \XoopsObject
*
* @param \XoopsDatabase $xoopsDatabase
* @param $user
* @param null $xoopsModule
*/
public function __construct(\XoopsDatabase $xoopsDatabase, $user, $xoopsModule = null)
{
Expand Down
1 change: 1 addition & 0 deletions class/VideoHandler.php
Expand Up @@ -335,6 +335,7 @@ public function renderFormSubmit(
/**
* Render a form to edit the description of the pictures
*
* @param $title
* @param string $caption The description of the picture
* @param int $video_id the id of the image in database
* @param string $filename the url to the thumb of the image so it can be displayed
Expand Down

0 comments on commit 702889c

Please sign in to comment.