File photo.php
has 495 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
use Xmf\Request;
/**
Similar blocks of code found in 2 locations. Consider refactoring. Open
case 'add_photo':
/** @var Extgallery\PublicPhotoHandler $photoHandler */
$photoHandler = Extgallery\Helper::getInstance()->getHandler('PublicPhoto');
$result = $photoHandler->postPhotoTraitement('photo_file', false);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 171.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
if (0 == $cat->getVar('cat_nb_photo')) {
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('nleft', $cat->getVar('nleft'), '<'));
$criteria->add(new \Criteria('nright', $cat->getVar('nright'), '>'));
$catHandler->updateFieldValue('cat_nb_album', 'cat_nb_album + 1', $criteria);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 4 locations. Consider refactoring. Open
if (0 == $cat->getVar('cat_nb_photo')) {
$criteria = new \CriteriaCompo();
$criteria->add(new \Criteria('nleft', $cat->getVar('nleft'), '<'));
$criteria->add(new \Criteria('nright', $cat->getVar('nright'), '>'));
$catHandler->updateFieldValue('cat_nb_album', 'cat_nb_album + 1', $criteria);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
The CASE body must start on the line following the statement Open
case 'batchApprove':
- Exclude checks
The CASE body must start on the line following the statement Open
case 'default':
- Exclude checks
The CASE body must start on the line following the statement Open
case 'add_photo':
- Exclude checks
The CASE body must start on the line following the statement Open
case 'modify':
- Exclude checks
The CASE body must start on the line following the statement Open
case 'batchAdd':
- Exclude checks
The CASE body must start on the line following the statement Open
case 'default':
- Exclude checks
The CASE body must start on the line following the statement Open
case 'rebuildthumb':
- Exclude checks
The DEFAULT body must start on the line following the statement Open
default:
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$globalCatSelect = $catHandler->getLeafSelect('changeAllCat', false, $_GET['cat_id'], ' onChange="return changeAllCategory();"');
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
$scriptSelect .= $first ? '\'catId[' . $photo->getVar('photo_id') . ']\'' : ', \'catId[' . $photo->getVar('photo_id') . ']\'';
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
echo '<input type="submit" name="modify" value="' . _AM_EXTGALLERY_APPLY_CHANGE . '"> <input type="submit" name="delete" value="' . _DELETE . '">';
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTGALLERY_EDITDELETE_PHOTO . '</legend>';
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
//echo '<img src="../assets/images/on.png" style="vertical-align:middle;"> '._AM_EXTGALLERY_APPROVE_INFO.'<br>';
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
echo '<th><input type="checkbox" name="selectAllPhoto" id="selectAllPhoto" onClick="return checkAllPhoto();"></th>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
echo '<td>' . $catHandler->getLeafSelect('catId[' . $photo->getVar('photo_id') . ']', false, $_GET['cat_id']) . '</td>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
echo '<td><img src="' . XOOPS_URL . '/uploads/extgallery/public-photo/thumb/thumb_' . $photo->getVar('photo_name') . '"></td>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$script .= $first ? '\'photoId[' . $photo->getVar('photo_id') . ']\'' : ', \'photoId[' . $photo->getVar('photo_id') . ']\'';
- Exclude checks
Line exceeds 120 characters; contains 162 characters Open
echo '<input type="submit" name="approve" value="' . _AM_EXTGALLERY_APPROVE . '"> <input type="submit" name="delete" value="' . _DELETE . '">';
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTGALLERY_INFORMATION . '</legend>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 240 characters Open
echo '<td><input type="text" name="photoPoids[' . $photo->getVar('photo_id') . ']" id="photoPoids[' . $photo->getVar('photo_id') . ']" value="' . $photo->getVar('photo_weight') . '" size="3" maxlength="14"></td>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 168 characters Open
echo '<b>' . _AM_EXTGALLERY_BATCH_PATH . '</b> : ' . XOOPS_ROOT_PATH . '/modules/extgallery/batch/<br><br>' . sprintf(_AM_EXTGALLERY_ADD_BATCH_INFO, $nbPhotos);
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
redirect_header('photo.php', 3, _AM_EXTGALLERY_UPLOAD_ERROR . ' :<br>' . $photoHandler->photoUploader->getErrors());
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
$pageNav = new \XoopsPageNav($nbPhoto, $helper->getConfig('admin_nb_photo'), $start, 'start', 'op=modify&cat_id=' . $_GET['cat_id']);
- Exclude checks
Line exceeds 120 characters; contains 154 characters Open
echo '<td><img src="' . XOOPS_URL . '/uploads/extgallery/public-photo/thumb/thumb_' . $photo->getVar('photo_name') . '"></td>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
echo '<th><input type="checkbox" name="selectAllPhoto" id="selectAllPhoto" onClick="return checkAllPhoto();"></th>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$form->addElement(new \XoopsFormFile(_AM_EXTGALLERY_PHOTO, 'photo_file', $helper->getConfig('max_photosize')), false);
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
echo '<img src="../assets/images/edit.png" style="vertical-align:middle;"> ' . _AM_EXTGALLERY_EDIT_INFO . '<br>';
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
echo '<img src="../assets/images/delete.png" style="vertical-align:middle;"> ' . _AM_EXTGALLERY_DELETE_INFO;
- Exclude checks
Line exceeds 120 characters; contains 169 characters Open
echo '<a href="photo.php?op=delete&id=' . $photo->getVar('photo_id') . '"><img src="../assets/images/delete.png" style="vertical-align:middle;"></a>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 171 characters Open
echo '<td><input type="checkbox" name="photoId[' . $photo->getVar('photo_id') . '][]" id="photoId[' . $photo->getVar('photo_id') . '][]"></td>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
//echo '<a href="photo.php?op=approve&id='.$photo->getVar('photo_id').'"><img src="../assets/images/on.png" style="vertical-align:middle;"></a> '."\n";
- Exclude checks
Line exceeds 120 characters; contains 225 characters Open
echo '<textarea name="photoDesc[' . $photo->getVar('photo_id') . ']" id="photoDesc[' . $photo->getVar('photo_id') . ']" rows="1" cols="57">' . $photo->getVar('photo_desc', 'e') . '</textarea></td>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
$form->addElement(new \XoopsFormLabel(_AM_EXTGALLERY_ALBUMS, $catHandler->getLeafSelect('cat_id', false, 0, '', 'public_upload')));
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$editor = $utility::getWysiwygForm(_AM_EXTGALLERY_DESC, 'photo_desc', '', 15, 60, '100%', '350px', 'hometext_hidden');
- Exclude checks
Line exceeds 120 characters; contains 173 characters Open
echo '<a href="photo.php?op=modify&id=' . $photo->getVar('photo_id') . '"><img src="../assets/images/edit.png" style="vertical-align:middle;"></a> ' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$extraTags['X_ITEM_URL'] = XOOPS_URL . "/modules/{$moduleDirName}/public-album.php?id=" . $cat->getVar('cat_id');
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
$scriptCheckbox .= $first ? '\'photoId[' . $photo->getVar('photo_id') . '][]\'' : ', \'photoId[' . $photo->getVar('photo_id') . '][]\'';
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTGALLERY_APPROVE . '</legend>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
echo '<td><input type="checkbox" name="photoId[' . $photo->getVar('photo_id') . ']" id="photoId[' . $photo->getVar('photo_id') . ']"></td>' . "\n";
- Exclude checks
Line exceeds 120 characters; contains 271 characters Open
echo '<td style="text-align:left;"><input type="text" name="photoTitre[' . $photo->getVar('photo_id') . ']" id="photoTitre[' . $photo->getVar('photo_id') . ']" value="' . $photo->getVar('photo_title', 'e') . '" size="60" maxlength="150"><br>' . "\n";
- Exclude checks