XoopsModules25x /
xoopstube
| 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 (https://xoops.org) |
||
| 15 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 16 | * @link https://xoops.org/ |
||
| 17 | * @since 1.0.6 |
||
| 18 | */ |
||
| 19 | |||
| 20 | use Xmf\Module\Admin; |
||
| 21 | use Xmf\Request; |
||
| 22 | use Xmf\Yaml; |
||
| 23 | use XoopsModules\Xoopstube\{ |
||
| 24 | Utility |
||
| 25 | }; |
||
| 26 | |||
| 27 | require_once __DIR__ . '/admin_header.php'; |
||
| 28 | xoops_cp_header(); |
||
| 29 | |||
| 30 | $adminObject = Admin::getInstance(); |
||
| 31 | |||
| 32 | $start = Request::getInt('start', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start', 0); |
||
| 33 | $start1 = Request::getInt('start1', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start1', 0); |
||
| 34 | $start2 = Request::getInt('start2', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start2', 0); |
||
| 35 | $start3 = Request::getInt('start3', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start3', 0); |
||
| 36 | $start4 = Request::getInt('start4', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start4', 0); |
||
| 37 | $start5 = Request::getInt('start5', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start5', 0); |
||
| 38 | $totalcats = Utility::getTotalCategoryCount(); |
||
| 39 | |||
| 40 | $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_broken')); |
||
| 41 | [$totalbrokenvideos] = $GLOBALS['xoopsDB']->fetchRow($result); |
||
| 42 | $result2 = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod')); |
||
| 43 | [$totalmodrequests] = $GLOBALS['xoopsDB']->fetchRow($result2); |
||
| 44 | $result3 = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published = 0'); |
||
| 45 | [$totalnewvideos] = $GLOBALS['xoopsDB']->fetchRow($result3); |
||
| 46 | $result4 = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0'); |
||
| 47 | [$totalvideos] = $GLOBALS['xoopsDB']->fetchRow($result4); |
||
| 48 | |||
| 49 | //$xxx='<a href="brokenvideo.php">' . _AM_XOOPSTUBE_SBROKENSUBMIT . '</a><b>'; |
||
| 50 | |||
| 51 | $adminObject->addInfoBox(_AM_XOOPSTUBE_MINDEX_VIDEOSUMMARY); |
||
| 52 | if ($totalcats > 0) { |
||
| 53 | $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="category.php">' . _AM_XOOPSTUBE_SCATEGORY . '</a><b>' . '</infolabel>', $totalcats), '', 'Green'); |
||
| 54 | } else { |
||
| 55 | $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_XOOPSTUBE_SCATEGORY . '</infolabel>', $totalcats), '', 'Green'); |
||
| 56 | } |
||
| 57 | |||
| 58 | if ($totalvideos > 0) { |
||
| 59 | $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="main.php">' . _AM_XOOPSTUBE_SFILES . '</a><b>' . '</infolabel>', $totalvideos), '', 'Green'); |
||
| 60 | } else { |
||
| 61 | $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_XOOPSTUBE_SFILES . '</infolabel>', $totalvideos), '', 'Green'); |
||
| 62 | } |
||
| 63 | |||
| 64 | if ($totalnewvideos > 0) { |
||
| 65 | $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="newvideos.php">' . _AM_XOOPSTUBE_SNEWFILESVAL . '</a><b>' . '</infolabel>', $totalnewvideos), '', 'Red'); |
||
| 66 | } else { |
||
| 67 | $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_XOOPSTUBE_SNEWFILESVAL . '</infolabel>', $totalnewvideos), '', 'Red'); |
||
| 68 | } |
||
| 69 | if ($totalmodrequests > 0) { |
||
| 70 | $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="modifications.php">' . _AM_XOOPSTUBE_SMODREQUEST . '</a><b>' . '</infolabel>', $totalmodrequests), '', 'Red'); |
||
| 71 | } else { |
||
| 72 | $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_XOOPSTUBE_SMODREQUEST . '</infolabel>', $totalmodrequests), '', 'Red'); |
||
| 73 | } |
||
| 74 | |||
| 75 | if ($totalbrokenvideos > 0) { |
||
| 76 | $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="brokenvideo.php">' . _AM_XOOPSTUBE_SBROKENSUBMIT . '</a><b>' . '</infolabel><infotext>', $totalbrokenvideos . '</infotext>'), '', 'Red'); |
||
| 77 | } else { |
||
| 78 | $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_XOOPSTUBE_SBROKENSUBMIT . '</infolabel><infotext>', $totalbrokenvideos . '</infotext>'), '', 'Red'); |
||
| 79 | } |
||
| 80 | |||
| 81 | //------ create directories --------------- |
||
| 82 | /* |
||
| 83 | $folderMode = $GLOBALS['xoopsModuleConfig']['dirmode']; |
||
| 84 | // require_once dirname(__DIR__) . '/class/Utility.php'; |
||
| 85 | foreach (array_keys($uploadFolders) as $i) { |
||
| 86 | Utility::prepareFolder($uploadFolders[$i], $folderMode); |
||
| 87 | $adminObject->addConfigBoxLine($uploadFolders[$i], 'folder'); |
||
| 88 | // $adminObject->addConfigBoxLine(array($uploadFolders[$i], $folderMode), 'chmod'); |
||
| 89 | } |
||
| 90 | */ |
||
| 91 | |||
| 92 | //require_once dirname(__DIR__) . '/testdata/index.php'; |
||
| 93 | //$adminObject->addItemButton(_AM_XOOPSTUBE_ADD_SAMPLEDATA, './../testdata/index.php?op=load', 'add'); |
||
| 94 | |||
| 95 | $adminObject->displayNavigation(basename(__FILE__)); |
||
| 96 | |||
| 97 | //check for latest release |
||
| 98 | //$newRelease = $utility::checkVerModule($helper); |
||
| 99 | //if (!empty($newRelease)) { |
||
| 100 | // $adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"'); |
||
| 101 | //} |
||
| 102 | |||
| 103 | //------------- Test Data ---------------------------- |
||
| 104 | |||
| 105 | if ($helper->getConfig('displaySampleButton')) { |
||
| 106 | $yamlFile = dirname(__DIR__) . '/config/admin.yml'; |
||
| 107 | $config = loadAdminConfig($yamlFile); |
||
| 108 | $displaySampleButton = $config['displaySampleButton']; |
||
| 109 | |||
| 110 | if (1 == $displaySampleButton) { |
||
| 111 | xoops_loadLanguage('admin/modulesadmin', 'system'); |
||
| 112 | require_once dirname(__DIR__) . '/testdata/index.php'; |
||
| 113 | |||
| 114 | $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add'); |
||
| 115 | $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add'); |
||
| 116 | // $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), '__DIR__ . /../../testdata/index.php?op=exportschema', 'add'); |
||
| 117 | $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete'); |
||
| 118 | } else { |
||
| 119 | $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add'); |
||
| 120 | $displaySampleButton = $config['displaySampleButton']; |
||
| 121 | } |
||
| 122 | $adminObject->displayButton('left', ''); |
||
| 123 | } |
||
| 124 | |||
| 125 | //------------- End Test Data ---------------------------- |
||
| 126 | |||
| 127 | $adminObject->displayIndex(); |
||
| 128 | |||
| 129 | /* |
||
| 130 | //------ check directories --------------- |
||
| 131 | require_once dirname(__DIR__) . '/include/directorychecker.php'; |
||
| 132 | |||
| 133 | $adminObject->addConfigBoxLine(''); |
||
| 134 | $redirectFile = $_SERVER['SCRIPT_NAME']; |
||
| 135 | |||
| 136 | $languageConstants = array( |
||
| 137 | _AM_XOOPSTUBE_AVAILABLE, |
||
| 138 | _AM_XOOPSTUBE_NOTAVAILABLE, |
||
| 139 | _AM_XOOPSTUBE_CREATETHEDIR, |
||
| 140 | _AM_XOOPSTUBE_NOTWRITABLE, |
||
| 141 | _AM_XOOPSTUBE_SETMPERM, |
||
| 142 | _AM_XOOPSTUBE_DIRCREATED, |
||
| 143 | _AM_XOOPSTUBE_DIRNOTCREATED, |
||
| 144 | _AM_XOOPSTUBE_PERMSET, |
||
| 145 | _AM_XOOPSTUBE_PERMNOTSET |
||
| 146 | ); |
||
| 147 | |||
| 148 | $path = $GLOBALS['xoopsModuleConfig']['uploaddir'] . '/'; |
||
| 149 | $adminObject->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($path, 0777, $languageConstants, $redirectFile)); |
||
| 150 | |||
| 151 | $path = XOOPS_ROOT_PATH . '/' . $GLOBALS['xoopsModuleConfig']['screenshots'] . '/'; |
||
| 152 | $adminObject->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($path, 0777, $languageConstants, $redirectFile)); |
||
| 153 | |||
| 154 | $path = XOOPS_ROOT_PATH . '/' . $GLOBALS['xoopsModuleConfig']['catimage'] . '/'; |
||
| 155 | $adminObject->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($path, 0777, $languageConstants, $redirectFile)); |
||
| 156 | |||
| 157 | $path = XOOPS_ROOT_PATH . '/' . $GLOBALS['xoopsModuleConfig']['mainimagedir'] . '/'; |
||
| 158 | $adminObject->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($path, 0777, $languageConstants, $redirectFile)); |
||
| 159 | |||
| 160 | //$adminObject->displayNavigation(basename(__FILE__)); |
||
| 161 | //$adminObject->displayIndex(); |
||
| 162 | //echo wfd_serverstats(); |
||
| 163 | //--------------------------- |
||
| 164 | |||
| 165 | fileChecks(); |
||
| 166 | |||
| 167 | */ |
||
| 168 | |||
| 169 | |||
| 170 | /** |
||
| 171 | * @param $yamlFile |
||
| 172 | * @return array|bool |
||
| 173 | */ |
||
| 174 | function loadAdminConfig($yamlFile) |
||
| 175 | { |
||
| 176 | $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps |
||
| 177 | return $config; |
||
| 178 | } |
||
| 179 | |||
| 180 | /** |
||
| 181 | * @param $yamlFile |
||
| 182 | */ |
||
| 183 | function hideButtons($yamlFile) |
||
| 184 | { |
||
| 185 | $app['displaySampleButton'] = 0; |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 186 | Yaml::save($app, $yamlFile); |
||
| 187 | redirect_header('index.php', 0, ''); |
||
| 188 | } |
||
| 189 | |||
| 190 | /** |
||
| 191 | * @param $yamlFile |
||
| 192 | */ |
||
| 193 | function showButtons($yamlFile) |
||
| 194 | { |
||
| 195 | $app['displaySampleButton'] = 1; |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 196 | Yaml::save($app, $yamlFile); |
||
| 197 | redirect_header('index.php', 0, ''); |
||
| 198 | } |
||
| 199 | |||
| 200 | $op = Request::getString('op', 0, 'GET'); |
||
| 201 | |||
| 202 | switch ($op) { |
||
| 203 | case 'hide_buttons': |
||
| 204 | hideButtons($yamlFile); |
||
| 205 | break; |
||
| 206 | case 'show_buttons': |
||
| 207 | showButtons($yamlFile); |
||
| 208 | break; |
||
| 209 | } |
||
| 210 | |||
| 211 | echo $utility::getServerStats(); |
||
| 212 | |||
| 213 | require __DIR__ . '/admin_footer.php'; |
||
| 214 |