txmodxoops /
tdmcreate
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||||||
| 2 | /* |
||||||
| 3 | You may not change or alter any portion of this comment or credits |
||||||
| 4 | of supporting developers from this source code or any supporting source code |
||||||
| 5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||||||
| 6 | |||||||
| 7 | This program is distributed in the hope that it will be useful, |
||||||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||||
| 10 | */ |
||||||
| 11 | |||||||
| 12 | /** |
||||||
| 13 | * My Module 3 module for xoops |
||||||
| 14 | * |
||||||
| 15 | * @copyright 2020 XOOPS Project (https://xooops.org) |
||||||
| 16 | * @license GPL 2.0 or later |
||||||
| 17 | * @package mymodule3 |
||||||
| 18 | * @since 1.0 |
||||||
| 19 | * @min_xoops 2.5.9 |
||||||
| 20 | * @author TDM XOOPS - Email:<[email protected]> - Website:<http://xoops.org> |
||||||
| 21 | */ |
||||||
| 22 | |||||||
| 23 | use XoopsModules\Mymodule3; |
||||||
| 24 | use XoopsModules\Mymodule3\Helper; |
||||||
| 25 | use XoopsModules\Mymodule3\Constants; |
||||||
| 26 | |||||||
| 27 | include_once XOOPS_ROOT_PATH . '/modules/mymodule3/include/common.php'; |
||||||
| 28 | |||||||
| 29 | /** |
||||||
| 30 | * Function show block |
||||||
| 31 | * @param $options |
||||||
| 32 | * @return array |
||||||
| 33 | */ |
||||||
| 34 | function b_mymodule3_testfields_show($options) |
||||||
| 35 | { |
||||||
| 36 | include_once XOOPS_ROOT_PATH . '/modules/mymodule3/class/testfields.php'; |
||||||
| 37 | $myts = MyTextSanitizer::getInstance(); |
||||||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||||||
| 38 | $GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); |
||||||
| 39 | $block = []; |
||||||
| 40 | $typeBlock = $options[0]; |
||||||
| 41 | $limit = $options[1]; |
||||||
| 42 | $lenghtTitle = $options[2]; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 43 | $helper = Helper::getInstance(); |
||||||
| 44 | $testfieldsHandler = $helper->getHandler('testfields'); |
||||||
| 45 | $crTestfields = new \CriteriaCompo(); |
||||||
| 46 | array_shift($options); |
||||||
| 47 | array_shift($options); |
||||||
| 48 | array_shift($options); |
||||||
| 49 | |||||||
| 50 | switch($typeBlock) { |
||||||
| 51 | case 'last': |
||||||
| 52 | default: |
||||||
| 53 | // For the block: testfields last |
||||||
| 54 | $crTestfields->add( new \Criteria( 'tf_status', Constants::PERM_GLOBAL_VIEW ) ); |
||||||
| 55 | $crTestfields->setSort( 'tf_date' ); |
||||||
| 56 | $crTestfields->setOrder( 'DESC' ); |
||||||
| 57 | break; |
||||||
| 58 | case 'new': |
||||||
| 59 | // For the block: testfields new |
||||||
| 60 | $crTestfields->add( new \Criteria( 'tf_status', Constants::PERM_GLOBAL_VIEW ) ); |
||||||
| 61 | $crTestfields->add( new \Criteria( 'tf_date', strtotime(date(_SHORTDATESTRING)), '>=' ) ); |
||||||
| 62 | $crTestfields->add( new \Criteria( 'tf_date', strtotime(date(_SHORTDATESTRING))+86400, '<=' ) ); |
||||||
| 63 | $crTestfields->setSort( 'tf_date' ); |
||||||
| 64 | $crTestfields->setOrder( 'ASC' ); |
||||||
| 65 | break; |
||||||
| 66 | case 'hits': |
||||||
| 67 | // For the block: testfields hits |
||||||
| 68 | $crTestfields->add( new \Criteria( 'tf_status', Constants::PERM_GLOBAL_VIEW ) ); |
||||||
| 69 | $crTestfields->setSort( 'tf_hits' ); |
||||||
| 70 | $crTestfields->setOrder( 'DESC' ); |
||||||
| 71 | break; |
||||||
| 72 | case 'top': |
||||||
| 73 | // For the block: testfields top |
||||||
| 74 | $crTestfields->add( new \Criteria( 'tf_status', Constants::PERM_GLOBAL_VIEW ) ); |
||||||
| 75 | $crTestfields->add( new \Criteria( 'tf_date', strtotime(date(_SHORTDATESTRING))+86400, '<=' ) ); |
||||||
| 76 | $crTestfields->setSort( 'tf_top' ); |
||||||
| 77 | $crTestfields->setOrder( 'ASC' ); |
||||||
| 78 | break; |
||||||
| 79 | case 'random': |
||||||
| 80 | // For the block: testfields random |
||||||
| 81 | $crTestfields->add( new \Criteria( 'tf_status', Constants::PERM_GLOBAL_VIEW ) ); |
||||||
| 82 | $crTestfields->add( new \Criteria( 'tf_date', strtotime(date(_SHORTDATESTRING))+86400, '<=' ) ); |
||||||
| 83 | $crTestfields->setSort( 'RAND()' ); |
||||||
| 84 | break; |
||||||
| 85 | } |
||||||
| 86 | |||||||
| 87 | $crTestfields->setLimit( $limit ); |
||||||
| 88 | $testfieldsAll = $testfieldsHandler->getAll($crTestfields); |
||||||
|
0 ignored issues
–
show
The method
getAll() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoUserHandler or XoopsPersistableObjectHandler.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 89 | unset($crTestfields); |
||||||
| 90 | if (count($testfieldsAll) > 0) { |
||||||
| 91 | foreach(array_keys($testfieldsAll) as $i) { |
||||||
| 92 | } |
||||||
| 93 | } |
||||||
| 94 | |||||||
| 95 | return $block; |
||||||
| 96 | |||||||
| 97 | } |
||||||
| 98 | |||||||
| 99 | /** |
||||||
| 100 | * Function edit block |
||||||
| 101 | * @param $options |
||||||
| 102 | * @return string |
||||||
| 103 | */ |
||||||
| 104 | function b_mymodule3_testfields_edit($options) |
||||||
| 105 | { |
||||||
| 106 | include_once XOOPS_ROOT_PATH . '/modules/mymodule3/class/testfields.php'; |
||||||
| 107 | $helper = Helper::getInstance(); |
||||||
| 108 | $testfieldsHandler = $helper->getHandler('testfields'); |
||||||
| 109 | $GLOBALS['xoopsTpl']->assign('mymodule3_upload_url', MYMODULE3_UPLOAD_URL); |
||||||
| 110 | $form = _MB_MYMODULE3_DISPLAY; |
||||||
| 111 | $form .= "<input type='hidden' name='options[0]' value='".$options[0]."' />"; |
||||||
| 112 | $form .= "<input type='text' name='options[1]' size='5' maxlength='255' value='" . $options[1] . "' /> <br>"; |
||||||
| 113 | $form .= _MB_MYMODULE3_TITLE_LENGTH . " : <input type='text' name='options[2]' size='5' maxlength='255' value='" . $options[2] . "' /><br><br>"; |
||||||
| 114 | array_shift($options); |
||||||
| 115 | array_shift($options); |
||||||
| 116 | array_shift($options); |
||||||
| 117 | |||||||
| 118 | $crTestfields = new \CriteriaCompo(); |
||||||
| 119 | $crTestfields->add( new \Criteria( 'tf_id', 0, '!=' ) ); |
||||||
| 120 | $crTestfields->setSort( 'tf_id' ); |
||||||
| 121 | $crTestfields->setOrder( 'ASC' ); |
||||||
| 122 | $testfieldsAll = $testfieldsHandler->getAll($crTestfields); |
||||||
| 123 | unset($crTestfields); |
||||||
| 124 | $form .= _MB_MYMODULE3_TESTFIELDS_TO_DISPLAY . "<br><select name='options[]' multiple='multiple' size='5'>"; |
||||||
| 125 | $form .= "<option value='0' " . (in_array(0, $options) == false ? '' : "selected='selected'") . '>' . _MB_MYMODULE3_ALL_TESTFIELDS . '</option>'; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 126 | foreach(array_keys($testfieldsAll) as $i) { |
||||||
| 127 | $tf_id = $testfieldsAll[$i]->getVar('tf_id'); |
||||||
| 128 | $form .= "<option value='" . $tf_id . "' " . (in_array($tf_id, $options) == false ? '' : "selected='selected'") . '>' . $testfieldsAll[$i]->getVar('tf_text') . '</option>'; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 129 | } |
||||||
| 130 | $form .= '</select>'; |
||||||
| 131 | |||||||
| 132 | return $form; |
||||||
| 133 | |||||||
| 134 | } |
||||||
| 135 |