Completed
Push — master ( 3024c9...954431 )
by Michael
04:21
created

admin/indexpage.php (15 issues)

Upgrade to new PHP Analysis Engine

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
include_once __DIR__ . '/admin_header.php';
21
22
//xoopstubeUtilities::prepareFolder(XOOPSTUBE_UPLOAD_PATH);
0 ignored issues
show
Unused Code Comprehensibility introduced by
52% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
23
//xoopstubeUtilities::prepareFolder(XOOPSTUBE_ATTACHED_FILES_PATH);
24
//xoopstubeUtilities::prepareFolder(XOOPSTUBE_PICTURES_PATH);
25
//xoopstubeUtilities::prepareFolder(XOOPSTUBE_CSV_PATH);
26
//xoopstubeUtilities::prepareFolder(XOOPSTUBE_CACHE_PATH);
27
//xoopstubeUtilities::prepareFolder(XOOPSTUBE_TEXT_PATH);
28
29
$op = $op = XoopsRequest::getCmd('op', XoopsRequest::getCmd('op', '', 'POST'), 'GET'); //xtubeCleanRequestVars($_REQUEST, 'op', '');
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
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']));
0 ignored issues
show
Unused Code Comprehensibility introduced by
85% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
35
        $indexheader  = XoopsRequest::getText('indexheader', '', 'POST'); //$xtubemyts->addslashes(xoops_trim($_REQUEST['indexheader']));
0 ignored issues
show
Unused Code Comprehensibility introduced by
85% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
36
        $indexfooter  = XoopsRequest::getText('indexfooter', '', 'POST'); //$xtubemyts->addslashes(xoops_trim($_REQUEST['indexfooter']));
0 ignored issues
show
Unused Code Comprehensibility introduced by
85% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
37
        $indeximage   = XoopsRequest::getString('indeximage', '', 'POST'); //$xtubemyts->addslashes($_REQUEST['indeximage']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
90% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
38
39
        $nohtml   = XoopsRequest::getInt('nohtml', 0, 'POST'); //isset($_REQUEST['nohtml']) ? 1 : 0;
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
40
        $nosmiley = XoopsRequest::getInt('nosmiley', 0, 'POST'); //isset($_REQUEST['nosmiley']) ? 1 : 0;
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
41
        $noxcodes = XoopsRequest::getInt('noxcodes', 0, 'POST'); //isset($_REQUEST['noxcodes']) ? 1 : 0;
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
42
        $noimages = XoopsRequest::getInt('noimages', 0, 'POST'); //isset($_REQUEST['noimages']) ? 1 : 0;
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
43
        $nobreak  = XoopsRequest::getInt('nobreak', 0, 'POST'); //isset($_REQUEST['nobreak']) ? 1 : 0;
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
44
45
        $indexheaderalign = XoopsRequest::getString('indexheaderalign', '', 'POST'); //$xtubemyts->addslashes($_REQUEST['indexheaderalign']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
90% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
46
        $indexfooteralign = XoopsRequest::getString('indexfooteralign', '', 'POST'); //$xtubemyts->addslashes($_REQUEST['indexfooteralign']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
90% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
47
        $lastvideosyn     = XoopsRequest::getInt('lastvideosyn', 0, 'POST'); //$_REQUEST['lastvideosyn'];
48
        $lastvideostotal  = XoopsRequest::getString('lastvideostotal', '', 'POST'); //$xtubemyts->addslashes($_REQUEST['lastvideostotal']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
90% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
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) =
68
            $GLOBALS['xoopsDB']->fetchrow($result);
69
70
        xoops_cp_header();
71
        //xtubeRenderAdminMenu( _AM_XOOPSTUBE_INDEXPAGE );
72
        $aboutAdmin = new ModuleAdmin();
73
        echo $aboutAdmin->addNavigation(basename(__FILE__));
74
75
        echo '
76
         <fieldset style="border: #e8e8e8 1px solid;">
77
         <legend style="display: inline; font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_IPAGE_INFORMATION . '</legend>
78
         <div style="padding: 8px;">
79
         <img src="' . XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icon/indexpage.png" alt="" style="float: left; padding-right: 10px;" />
80
         ' . _AM_XOOPSTUBE_MINDEX_PAGEINFOTXT . '</div>
81
         </fieldset><br>';
82
83
        $sform = new XoopsThemeForm(_AM_XOOPSTUBE_IPAGE_MODIFY, 'op', xoops_getenv('PHP_SELF'));
84
        $sform->addElement(new XoopsFormText(_AM_XOOPSTUBE_IPAGE_CTITLE, 'indexheading', 60, 60, $indexheading), false);
85
        $graph_array      = &XoopstubeLists:: getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $GLOBALS['xoopsModuleConfig']['mainimagedir'], $type = 'images');
86
        $indexImageSelect = new XoopsFormSelect('', 'indeximage', $indeximage);
87
        $indexImageSelect->addOptionArray($graph_array);
88
        $indexImageSelect->setExtra("onchange='showImgSelected(\"image\", \"indeximage\", \"" . $GLOBALS['xoopsModuleConfig']['mainimagedir'] . "\", \"\", \"" . XOOPS_URL . "\")'");
89
        $indeximage_tray = new XoopsFormElementTray(_AM_XOOPSTUBE_IPAGE_CIMAGE, '&nbsp;');
90
        $indeximage_tray->addElement($indexImageSelect);
91 View Code Duplication
        if (!empty($indeximage)) {
92
            $indeximage_tray->addElement(new XoopsFormLabel('', '<br><br><img src="' . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['mainimagedir'] . '/' . $indeximage
93
                                                                . '" name="image" id="image" alt="" />'));
94
        } else {
95
            $indeximage_tray->addElement(new XoopsFormLabel('', '<br><br><img src="' . XOOPS_URL . '/uploads/blank.gif" name="image" id="image" alt="" />'));
96
        }
97
        $sform->addElement($indeximage_tray);
98
99
        //        $editor = xtube_getWysiwygForm(_AM_XOOPSTUBE_IPAGE_CHEADING, 'indexheader', $indexheader, 15, 60, '');
100
        //        $sform->addElement($editor, false);
0 ignored issues
show
Unused Code Comprehensibility introduced by
73% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
101
102
        $optionsTrayNote = new XoopsFormElementTray(_AM_XOOPSTUBE_IPAGE_CHEADING, '<br>');
103 View Code Duplication
        if (class_exists('XoopsFormEditor')) {
104
            $options['name']   = 'indexheader';
105
            $options['value']  = $indexheader;
106
            $options['rows']   = 5;
107
            $options['cols']   = '100%';
108
            $options['width']  = '100%';
109
            $options['height'] = '200px';
110
            $editor            = new XoopsFormEditor('', $GLOBALS['xoopsModuleConfig']['form_optionsuser'], $options, $nohtml = false, $onfailure = 'textarea');
111
            $optionsTrayNote->addElement($editor);
112
        } else {
113
            $editor = new XoopsFormDhtmlTextArea('', 'indexheader', $item->getVar('indexheader', 'e'), '100%', '100%');
114
            $optionsTrayNote->addElement($editor);
115
        }
116
117
        $sform->addElement($optionsTrayNote, false);
118
119
        $headeralign_select = new XoopsFormSelect(_AM_XOOPSTUBE_IPAGE_CHEADINGA, 'indexheaderalign', $indexheaderalign);
120
        $headeralign_select->addOptionArray(array(
121
                                                'left'   => _AM_XOOPSTUBE_IPAGE_CLEFT,
122
                                                'right'  => _AM_XOOPSTUBE_IPAGE_CRIGHT,
123
                                                'center' => _AM_XOOPSTUBE_IPAGE_CCENTER
124
                                            ));
125
        $sform->addElement($headeralign_select);
126
        $sform->addElement(new XoopsFormTextArea(_AM_XOOPSTUBE_IPAGE_CFOOTER, 'indexfooter', $indexfooter, 10, 60));
127
        $footeralign_select = new XoopsFormSelect(_AM_XOOPSTUBE_IPAGE_CFOOTERA, 'indexfooteralign', $indexfooteralign);
128
        $footeralign_select->addOptionArray(array(
129
                                                'left'   => _AM_XOOPSTUBE_IPAGE_CLEFT,
130
                                                'right'  => _AM_XOOPSTUBE_IPAGE_CRIGHT,
131
                                                'center' => _AM_XOOPSTUBE_IPAGE_CCENTER
132
                                            ));
133
        $sform->addElement($footeralign_select);
134
135
        $options_tray = new XoopsFormElementTray(_AM_XOOPSTUBE_TEXTOPTIONS, '<br>');
136
        //html option
137
        $html_checkbox = new XoopsFormCheckBox('', 'nohtml', $nohtml);
138
        $html_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEHTML);
139
        $options_tray->addElement($html_checkbox);
140
        //smiley option
141
        $smiley_checkbox = new XoopsFormCheckBox('', 'nosmiley', $nosmiley);
142
        $smiley_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLESMILEY);
143
        $options_tray->addElement($smiley_checkbox);
144
        //xcodes option
145
        $xcodes_checkbox = new XoopsFormCheckBox('', 'noxcodes', $noxcodes);
146
        $xcodes_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEXCODE);
147
        $options_tray->addElement($xcodes_checkbox);
148
        //noimages option
149
        $noimages_checkbox = new XoopsFormCheckBox('', 'noimages', $noimages);
150
        $noimages_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEIMAGES);
151
        $options_tray->addElement($noimages_checkbox);
152
        //breaks option
153
        $breaks_checkbox = new XoopsFormCheckBox('', 'nobreak', $nobreak);
154
        $breaks_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEBREAK);
155
        $options_tray->addElement($breaks_checkbox);
156
        $sform->addElement($options_tray);
157
158
        $sform->addElement(new XoopsFormRadioYN(_AM_XOOPSTUBE_IPAGE_SHOWLATEST, 'lastvideosyn', $lastvideosyn, ' ' . _YES . '', ' ' . _NO . ''));
159
160
        $lastvideostotalform = new XoopsFormText(_AM_XOOPSTUBE_IPAGE_LATESTTOTAL, 'lastvideostotal', 2, 2, $lastvideostotal);
161
        $lastvideostotalform->setDescription('<span style="font-size: small;">' . _AM_XOOPSTUBE_IPAGE_LATESTTOTAL_DSC . '</span>');
162
        $sform->addElement($lastvideostotalform, false);
163
164
        $button_tray = new XoopsFormElementTray('', '');
165
        $hidden      = new XoopsFormHidden('op', 'save');
166
        $button_tray->addElement($hidden);
167
        $button_tray->addElement(new XoopsFormButton('', 'post', _AM_XOOPSTUBE_BSAVE, 'submit'));
168
        $sform->addElement($button_tray);
169
        $sform->display();
170
        break;
171
}
172
include_once __DIR__ . '/admin_footer.php';
173