| 1 | <?php
|
|---|
| 2 | // $Id: admin.php,v 1.4 2005/08/03 12:39:11 onokazu Exp $
|
|---|
| 3 | // ------------------------------------------------------------------------ //
|
|---|
| 4 | // XOOPS - PHP Content Management System //
|
|---|
| 5 | // Copyright (c) 2000 XOOPS.org //
|
|---|
| 6 | // <http://www.xoops.org/> //
|
|---|
| 7 | // ------------------------------------------------------------------------ //
|
|---|
| 8 | // This program is free software; you can redistribute it and/or modify //
|
|---|
| 9 | // it under the terms of the GNU General Public License as published by //
|
|---|
| 10 | // the Free Software Foundation; either version 2 of the License, or //
|
|---|
| 11 | // (at your option) any later version. //
|
|---|
| 12 | // //
|
|---|
| 13 | // You may not change or alter any portion of this comment or credits //
|
|---|
| 14 | // of supporting developers from this source code or any supporting //
|
|---|
| 15 | // source code which is considered copyrighted (c) material of the //
|
|---|
| 16 | // original comment or credit authors. //
|
|---|
| 17 | // //
|
|---|
| 18 | // This program is distributed in the hope that it will be useful, //
|
|---|
| 19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|---|
| 20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|---|
| 21 | // GNU General Public License for more details. //
|
|---|
| 22 | // //
|
|---|
| 23 | // You should have received a copy of the GNU General Public License //
|
|---|
| 24 | // along with this program; if not, write to the Free Software //
|
|---|
| 25 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
|
|---|
| 26 | // ------------------------------------------------------------------------ //
|
|---|
| 27 |
|
|---|
| 28 | $xoopsOption['pagetype'] = "admin";
|
|---|
| 29 | include "mainfile.php";
|
|---|
| 30 | include XOOPS_ROOT_PATH."/include/cp_functions.php";
|
|---|
| 31 | /*********************************************************/
|
|---|
| 32 | /* Admin Authentication */
|
|---|
| 33 | /*********************************************************/
|
|---|
| 34 |
|
|---|
| 35 | if ( $xoopsUser ) {
|
|---|
| 36 | if ( !$xoopsUser->isAdmin(-1) ) {
|
|---|
| 37 | redirect_header("index.php",2,_AD_NORIGHT);
|
|---|
| 38 | exit();
|
|---|
| 39 | }
|
|---|
| 40 | } else {
|
|---|
| 41 | redirect_header("index.php",2,_AD_NORIGHT);
|
|---|
| 42 | exit();
|
|---|
| 43 | }
|
|---|
| 44 | $op = "list";
|
|---|
| 45 |
|
|---|
| 46 | if ( !empty($_GET['op']) ) {
|
|---|
| 47 | $op = $_GET['op'];
|
|---|
| 48 | }
|
|---|
| 49 |
|
|---|
| 50 | if ( !empty($_POST['op']) ) {
|
|---|
| 51 | $op = $_POST['op'];
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | if (!file_exists(XOOPS_CACHE_PATH.'/adminmenu.php') && $op != 'generate') {
|
|---|
| 55 | xoops_header();
|
|---|
| 56 | xoops_token_confirm(array('op' => 'generate'), 'admin.php', _AD_PRESSGEN);
|
|---|
| 57 | xoops_footer();
|
|---|
| 58 | exit();
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | switch ($op) {
|
|---|
| 62 | case "list":
|
|---|
| 63 | xoops_cp_header();
|
|---|
| 64 | // ###### Output warn messages for security ######
|
|---|
| 65 | if (is_dir(XOOPS_ROOT_PATH."/install/" )) {
|
|---|
| 66 | xoops_error(sprintf(_WARNINSTALL2,XOOPS_ROOT_PATH.'/install/'));
|
|---|
| 67 | echo '<br />';
|
|---|
| 68 | }
|
|---|
| 69 | if ( is_writable(XOOPS_ROOT_PATH."/mainfile.php" ) ) {
|
|---|
| 70 | xoops_error(sprintf(_WARNINWRITEABLE,XOOPS_ROOT_PATH.'/mainfile.php'));
|
|---|
| 71 | echo '<br />';
|
|---|
| 72 | }
|
|---|
| 73 | /* if (function_exists('mb_convert_encoding') && !empty($_GET['xoopsorgnews'])) {
|
|---|
| 74 | $rssurl = 'http://jp.xoops.org/backend.php';
|
|---|
| 75 | $rssfile = XOOPS_CACHE_PATH.'/adminnews.xml';
|
|---|
| 76 | $rssdata = '';
|
|---|
| 77 | if (!file_exists($rssfile) || filemtime($rssfile) < time() - 86400) {
|
|---|
| 78 | require_once XOOPS_ROOT_PATH.'/class/snoopy.php';
|
|---|
| 79 | $snoopy = new Snoopy;
|
|---|
| 80 | if ($snoopy->fetch($rssurl)) {
|
|---|
| 81 | $rssdata = $snoopy->results;
|
|---|
| 82 | if (false !== $fp = fopen($rssfile, 'w')) {
|
|---|
| 83 | fwrite($fp, $rssdata);
|
|---|
| 84 | }
|
|---|
| 85 | fclose($fp);
|
|---|
| 86 | }
|
|---|
| 87 | } else {
|
|---|
| 88 | if (false !== $fp = fopen($rssfile, 'r')) {
|
|---|
| 89 | while (!feof ($fp)) {
|
|---|
| 90 | $rssdata .= fgets($fp, 4096);
|
|---|
| 91 | }
|
|---|
| 92 | fclose($fp);
|
|---|
| 93 | }
|
|---|
| 94 | }
|
|---|
| 95 | if ($rssdata != '') {
|
|---|
| 96 | include_once XOOPS_ROOT_PATH.'/class/xml/rss/xmlrss2parser.php';
|
|---|
| 97 | $rss2parser = new XoopsXmlRss2Parser($rssdata);
|
|---|
| 98 | if (false != $rss2parser->parse()) {
|
|---|
| 99 | echo '<table class="outer" width="100%">';
|
|---|
| 100 | $items =& $rss2parser->getItems();
|
|---|
| 101 | $count = count($items);
|
|---|
| 102 | for ($i = 0; $i < $count; $i++) {
|
|---|
| 103 | echo '<tr class="head"><td><a href="'.htmlspecialchars($items[$i]['link']).'" target="_blank">';
|
|---|
| 104 | echo htmlspecialchars(mb_convert_encoding($items[$i]['title'], _CHARSET, 'auto')).'</a> ('.htmlspecialchars($items[$i]['pubdate']).')</td></tr>';
|
|---|
| 105 | if ($items[$i]['description'] != "") {
|
|---|
| 106 | echo '<tr><td class="odd">'.mb_convert_encoding($items[$i]['description'], _CHARSET, 'auto');
|
|---|
| 107 | if ($items[$i]['guid'] != "") {
|
|---|
| 108 | echo ' <a href="'.htmlspecialchars($items[$i]['guid']).'" target="_blank">'._MORE.'</a>';
|
|---|
| 109 | }
|
|---|
| 110 | echo '</td></tr>';
|
|---|
| 111 | } elseif ($items[$i]['guid'] != "") {
|
|---|
| 112 | echo '<tr><td class="even" valign="top"></td><td colspan="2" class="odd"><a href="'.htmlspecialchars($items[$i]['guid']).'" target="_blank">'._MORE.'</a></td></tr>';
|
|---|
| 113 | }
|
|---|
| 114 | }
|
|---|
| 115 | echo '</table>';
|
|---|
| 116 | } else {
|
|---|
| 117 | echo $rss2parser->getErrors();
|
|---|
| 118 | }
|
|---|
| 119 | }
|
|---|
| 120 | }*/
|
|---|
| 121 | xoops_cp_footer();
|
|---|
| 122 | break;
|
|---|
| 123 | case 'generate':
|
|---|
| 124 | if (xoops_confirm_validate()) {
|
|---|
| 125 | xoops_module_write_admin_menu(xoops_module_get_admin_menu());
|
|---|
| 126 | }
|
|---|
| 127 | redirect_header('admin.php', 1, _AD_LOGINADMIN);
|
|---|
| 128 | break;
|
|---|
| 129 | default:
|
|---|
| 130 | break;
|
|---|
| 131 | }
|
|---|
| 132 | ?> |
|---|