XoopsModules25x /
xoopstube
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Module: XoopsTube |
||
| 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 | * PHP version 5 |
||
| 10 | * |
||
| 11 | * @category Module |
||
| 12 | * @package Xoopstube |
||
| 13 | * @author XOOPS Development Team |
||
| 14 | * @copyright 2001-2016 XOOPS Project (http://xoops.org) |
||
| 15 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
| 16 | * @link http://xoops.org/ |
||
| 17 | * @since 1.0.6 |
||
| 18 | */ |
||
| 19 | |||
| 20 | require_once __DIR__ . '/admin_header.php'; |
||
| 21 | |||
| 22 | //xoopstubeUtility::prepareFolder(XOOPSTUBE_UPLOAD_PATH); |
||
| 23 | //xoopstubeUtility::prepareFolder(XOOPSTUBE_ATTACHED_FILES_PATH); |
||
| 24 | //xoopstubeUtility::prepareFolder(XOOPSTUBE_PICTURES_PATH); |
||
| 25 | //xoopstubeUtility::prepareFolder(XOOPSTUBE_CSV_PATH); |
||
| 26 | //xoopstubeUtility::prepareFolder(XOOPSTUBE_CACHE_PATH); |
||
| 27 | //xoopstubeUtility::prepareFolder(XOOPSTUBE_TEXT_PATH); |
||
| 28 | |||
| 29 | $op = $op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); //xtubeCleanRequestVars($_REQUEST, 'op', ''); |
||
| 30 | //$cid = xtubeCleanRequestVars( $_REQUEST, 'cid', 0 ); |
||
| 31 | |||
| 32 | switch (strtolower($op)) { |
||
| 33 | case 'save': |
||
| 34 | $indexheading = XoopsRequest::getString('indexheading', '', 'POST'); //$xtubemyts->addslashes(xoops_trim($_REQUEST['indexheading'])); |
||
| 35 | $indexheader = XoopsRequest::getText('indexheader', '', 'POST'); //$xtubemyts->addslashes(xoops_trim($_REQUEST['indexheader'])); |
||
| 36 | $indexfooter = XoopsRequest::getText('indexfooter', '', 'POST'); //$xtubemyts->addslashes(xoops_trim($_REQUEST['indexfooter'])); |
||
| 37 | $indeximage = XoopsRequest::getString('indeximage', '', 'POST'); //$xtubemyts->addslashes($_REQUEST['indeximage']); |
||
| 38 | |||
| 39 | $nohtml = XoopsRequest::getInt('nohtml', 0, 'POST'); //isset($_REQUEST['nohtml']) ? 1 : 0; |
||
| 40 | $nosmiley = XoopsRequest::getInt('nosmiley', 0, 'POST'); //isset($_REQUEST['nosmiley']) ? 1 : 0; |
||
| 41 | $noxcodes = XoopsRequest::getInt('noxcodes', 0, 'POST'); //isset($_REQUEST['noxcodes']) ? 1 : 0; |
||
| 42 | $noimages = XoopsRequest::getInt('noimages', 0, 'POST'); //isset($_REQUEST['noimages']) ? 1 : 0; |
||
| 43 | $nobreak = XoopsRequest::getInt('nobreak', 0, 'POST'); //isset($_REQUEST['nobreak']) ? 1 : 0; |
||
| 44 | |||
| 45 | $indexheaderalign = XoopsRequest::getString('indexheaderalign', '', 'POST'); //$xtubemyts->addslashes($_REQUEST['indexheaderalign']); |
||
| 46 | $indexfooteralign = XoopsRequest::getString('indexfooteralign', '', 'POST'); //$xtubemyts->addslashes($_REQUEST['indexfooteralign']); |
||
| 47 | $lastvideosyn = XoopsRequest::getInt('lastvideosyn', 0, 'POST'); //$_REQUEST['lastvideosyn']; |
||
| 48 | $lastvideostotal = XoopsRequest::getString('lastvideostotal', '', 'POST'); //$xtubemyts->addslashes($_REQUEST['lastvideostotal']); |
||
| 49 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('xoopstube_indexpage') |
||
| 50 | . " SET indexheading='$indexheading', indexheader='$indexheader', indexfooter='$indexfooter', indeximage='$indeximage', indexheaderalign='$indexheaderalign', indexfooteralign='$indexfooteralign', nohtml='$nohtml', nosmiley='$nosmiley', noxcodes='$noxcodes', noimages='$noimages', nobreak='$nobreak', lastvideosyn='$lastvideosyn', lastvideostotal='$lastvideostotal'"; |
||
| 51 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||
| 52 | XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||
| 53 | |||
| 54 | return false; |
||
| 55 | } |
||
| 56 | redirect_header('index.php', 1, _AM_XOOPSTUBE_IPAGE_UPDATED); |
||
| 57 | break; |
||
| 58 | |||
| 59 | default: |
||
| 60 | $sql = 'SELECT indeximage, indexheading, indexheader, indexfooter, nohtml, nosmiley, noxcodes, noimages, nobreak, indexheaderalign, indexfooteralign, lastvideosyn, lastvideostotal FROM ' |
||
| 61 | . $GLOBALS['xoopsDB']->prefix('xoopstube_indexpage'); |
||
| 62 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||
| 63 | XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||
| 64 | |||
| 65 | return false; |
||
| 66 | } |
||
| 67 | list($indeximage, $indexheading, $indexheader, $indexfooter, $nohtml, $nosmiley, $noxcodes, $noimages, $nobreak, $indexheaderalign, $indexfooteralign, $lastvideosyn, $lastvideostotal) = $GLOBALS['xoopsDB']->fetchrow($result); |
||
| 68 | |||
| 69 | xoops_cp_header(); |
||
| 70 | //xtubeRenderAdminMenu( _AM_XOOPSTUBE_INDEXPAGE ); |
||
| 71 | $adminObject = \Xmf\Module\Admin::getInstance(); |
||
| 72 | $adminObject->displayNavigation(basename(__FILE__)); |
||
| 73 | |||
| 74 | echo ' |
||
| 75 | <fieldset style="border: #e8e8e8 1px solid;"> |
||
| 76 | <legend style="display: inline; font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_IPAGE_INFORMATION . '</legend> |
||
| 77 | <div style="padding: 8px;"> |
||
| 78 | <img src="' . XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icon/indexpage.png" alt="" style="float: left; padding-right: 10px;" /> |
||
| 79 | ' . _AM_XOOPSTUBE_MINDEX_PAGEINFOTXT . '</div> |
||
| 80 | </fieldset><br>'; |
||
| 81 | |||
| 82 | $sform = new XoopsThemeForm(_AM_XOOPSTUBE_IPAGE_MODIFY, 'op', xoops_getenv('PHP_SELF')); |
||
| 83 | $sform->addElement(new XoopsFormText(_AM_XOOPSTUBE_IPAGE_CTITLE, 'indexheading', 60, 60, $indexheading), false); |
||
| 84 | $graph_array = &XoopstubeLists:: getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $GLOBALS['xoopsModuleConfig']['mainimagedir'], $type = 'images'); |
||
| 85 | $indexImageSelect = new XoopsFormSelect('', 'indeximage', $indeximage); |
||
| 86 | $indexImageSelect->addOptionArray($graph_array); |
||
| 87 | $indexImageSelect->setExtra("onchange='showImgSelected(\"image\", \"indeximage\", \"" . $GLOBALS['xoopsModuleConfig']['mainimagedir'] . "\", \"\", \"" . XOOPS_URL . "\")'"); |
||
| 88 | $indeximage_tray = new XoopsFormElementTray(_AM_XOOPSTUBE_IPAGE_CIMAGE, ' '); |
||
| 89 | $indeximage_tray->addElement($indexImageSelect); |
||
| 90 | View Code Duplication | if (!empty($indeximage)) { |
|
|
0 ignored issues
–
show
|
|||
| 91 | $indeximage_tray->addElement(new XoopsFormLabel('', '<br><br><img src="' |
||
| 92 | . XOOPS_URL |
||
| 93 | . '/' |
||
| 94 | . $GLOBALS['xoopsModuleConfig']['mainimagedir'] |
||
| 95 | . '/' |
||
| 96 | . $indeximage |
||
| 97 | . '" name="image" id="image" alt="" />')); |
||
| 98 | } else { |
||
| 99 | $indeximage_tray->addElement(new XoopsFormLabel('', '<br><br><img src="' . XOOPS_URL . '/uploads/blank.gif" name="image" id="image" alt="" />')); |
||
| 100 | } |
||
| 101 | $sform->addElement($indeximage_tray); |
||
| 102 | |||
| 103 | // $editor = xtube_getWysiwygForm(_AM_XOOPSTUBE_IPAGE_CHEADING, 'indexheader', $indexheader, 15, 60, ''); |
||
| 104 | // $sform->addElement($editor, false); |
||
| 105 | |||
| 106 | $optionsTrayNote = new XoopsFormElementTray(_AM_XOOPSTUBE_IPAGE_CHEADING, '<br>'); |
||
| 107 | View Code Duplication | if (class_exists('XoopsFormEditor')) { |
|
| 108 | $options['name'] = 'indexheader'; |
||
| 109 | $options['value'] = $indexheader; |
||
| 110 | $options['rows'] = 5; |
||
| 111 | $options['cols'] = '100%'; |
||
| 112 | $options['width'] = '100%'; |
||
| 113 | $options['height'] = '200px'; |
||
| 114 | $editor = new XoopsFormEditor('', $GLOBALS['xoopsModuleConfig']['form_optionsuser'], $options, $nohtml = false, $onfailure = 'textarea'); |
||
| 115 | $optionsTrayNote->addElement($editor); |
||
| 116 | } else { |
||
| 117 | $editor = new XoopsFormDhtmlTextArea('', 'indexheader', $item->getVar('indexheader', 'e'), '100%', '100%'); |
||
| 118 | $optionsTrayNote->addElement($editor); |
||
| 119 | } |
||
| 120 | |||
| 121 | $sform->addElement($optionsTrayNote, false); |
||
| 122 | |||
| 123 | $headeralign_select = new XoopsFormSelect(_AM_XOOPSTUBE_IPAGE_CHEADINGA, 'indexheaderalign', $indexheaderalign); |
||
| 124 | $headeralign_select->addOptionArray(array( |
||
| 125 | 'left' => _AM_XOOPSTUBE_IPAGE_CLEFT, |
||
| 126 | 'right' => _AM_XOOPSTUBE_IPAGE_CRIGHT, |
||
| 127 | 'center' => _AM_XOOPSTUBE_IPAGE_CCENTER |
||
| 128 | )); |
||
| 129 | $sform->addElement($headeralign_select); |
||
| 130 | $sform->addElement(new XoopsFormTextArea(_AM_XOOPSTUBE_IPAGE_CFOOTER, 'indexfooter', $indexfooter, 10, 60)); |
||
| 131 | $footeralign_select = new XoopsFormSelect(_AM_XOOPSTUBE_IPAGE_CFOOTERA, 'indexfooteralign', $indexfooteralign); |
||
| 132 | $footeralign_select->addOptionArray(array( |
||
| 133 | 'left' => _AM_XOOPSTUBE_IPAGE_CLEFT, |
||
| 134 | 'right' => _AM_XOOPSTUBE_IPAGE_CRIGHT, |
||
| 135 | 'center' => _AM_XOOPSTUBE_IPAGE_CCENTER |
||
| 136 | )); |
||
| 137 | $sform->addElement($footeralign_select); |
||
| 138 | |||
| 139 | $options_tray = new XoopsFormElementTray(_AM_XOOPSTUBE_TEXTOPTIONS, '<br>'); |
||
| 140 | //html option |
||
| 141 | $html_checkbox = new XoopsFormCheckBox('', 'nohtml', $nohtml); |
||
| 142 | $html_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEHTML); |
||
| 143 | $options_tray->addElement($html_checkbox); |
||
| 144 | //smiley option |
||
| 145 | $smiley_checkbox = new XoopsFormCheckBox('', 'nosmiley', $nosmiley); |
||
| 146 | $smiley_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLESMILEY); |
||
| 147 | $options_tray->addElement($smiley_checkbox); |
||
| 148 | //xcodes option |
||
| 149 | $xcodes_checkbox = new XoopsFormCheckBox('', 'noxcodes', $noxcodes); |
||
| 150 | $xcodes_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEXCODE); |
||
| 151 | $options_tray->addElement($xcodes_checkbox); |
||
| 152 | //noimages option |
||
| 153 | $noimages_checkbox = new XoopsFormCheckBox('', 'noimages', $noimages); |
||
| 154 | $noimages_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEIMAGES); |
||
| 155 | $options_tray->addElement($noimages_checkbox); |
||
| 156 | //breaks option |
||
| 157 | $breaks_checkbox = new XoopsFormCheckBox('', 'nobreak', $nobreak); |
||
| 158 | $breaks_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEBREAK); |
||
| 159 | $options_tray->addElement($breaks_checkbox); |
||
| 160 | $sform->addElement($options_tray); |
||
| 161 | |||
| 162 | $sform->addElement(new XoopsFormRadioYN(_AM_XOOPSTUBE_IPAGE_SHOWLATEST, 'lastvideosyn', $lastvideosyn, ' ' . _YES . '', ' ' . _NO . '')); |
||
| 163 | |||
| 164 | $lastvideostotalform = new XoopsFormText(_AM_XOOPSTUBE_IPAGE_LATESTTOTAL, 'lastvideostotal', 2, 2, $lastvideostotal); |
||
| 165 | $lastvideostotalform->setDescription('<span style="font-size: small;">' . _AM_XOOPSTUBE_IPAGE_LATESTTOTAL_DSC . '</span>'); |
||
| 166 | $sform->addElement($lastvideostotalform, false); |
||
| 167 | |||
| 168 | $button_tray = new XoopsFormElementTray('', ''); |
||
| 169 | $hidden = new XoopsFormHidden('op', 'save'); |
||
| 170 | $button_tray->addElement($hidden); |
||
| 171 | $button_tray->addElement(new XoopsFormButton('', 'post', _AM_XOOPSTUBE_BSAVE, 'submit')); |
||
| 172 | $sform->addElement($button_tray); |
||
| 173 | $sform->display(); |
||
| 174 | break; |
||
| 175 | } |
||
| 176 | require_once __DIR__ . '/admin_footer.php'; |
||
| 177 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.