📄 index.php
字号:
<?php
// $Id: index.php,v 1.12 2004/05/25 10:53:08 mithyt2 Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <http://www.xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
include_once '../../../include/cp_header.php';
include_once XOOPS_ROOT_PATH . "/class/xoopstopic.php";
include_once XOOPS_ROOT_PATH . "/class/xoopslists.php";
include_once XOOPS_ROOT_PATH . "/modules/news/class/class.newsstory.php";
include_once XOOPS_ROOT_PATH . "/modules/news/class/class.sfiles.php";
include_once XOOPS_ROOT_PATH . '/class/uploader.php';
include_once "functions.php";
$op = 'default';
if ( isset( $_POST ) )
{
foreach ( $_POST as $k => $v )
{
${$k} = $v;
}
}
if ( isset( $_GET['op'] ) )
{
$op = $_GET['op'];
if ( isset( $_GET['storyid'] ) )
{
$storyid = intval( $_GET['storyid'] );
}
}
/*
* Show new submissions
*/
function newSubmissions()
{
$storyarray = NewsStory :: getAllSubmitted();
if ( count( $storyarray ) > 0 )
{
echo"<table width='100%' border='0' cellspacing='1'><tr><td class=\"odd\">";
echo "<div style='text-align: center;'><b>" . _AM_NEWSUB . "</b><br /><table width='100%' border='1' class='outer'><tr class='bg3'><td align='center'>" . _AM_TITLE . "</td><td align='center'>" . _AM_POSTED . "</td><td align='center'>" . _AM_POSTER . "</td><td align='center'>" . _AM_ACTION . "</td></tr>\n";
foreach( $storyarray as $newstory )
{
echo "<tr><td align='left'>\n";
$title = $newstory->title();
if ( !isset( $title ) || ( $title == "" ) )
{
echo "<a href='index.php?op=edit&storyid=" . $newstory -> storyid() . "'>" . _AD_NOSUBJECT . "</a>\n";
}
else
{
echo " <a href='../submit.php?op=edit&storyid=" . $newstory -> storyid() . "'>" . $title . "</a>\n";
}
echo "</td><td align='center' class='nw'>" . formatTimestamp( $newstory -> created() ) . "</td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $newstory -> uid() . "'>" . $newstory -> uname() . "</a></td><td align='right'><a href='index.php?op=delete&storyid=" . $newstory -> storyid() . "'>" . _AM_DELETE . "</a></td></tr>\n";
}
echo "</table></div>\n";
echo"</td></tr></table>";
echo "<br />";
}
}
/*
* Shows automated stories
*/
function autoStories()
{
global $xoopsModule;
$storyarray = NewsStory :: getAllAutoStory();
if ( count( $storyarray ) > 0 )
{
echo"<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">";
echo "<div style='text-align: center;'><b>" . _AM_AUTOARTICLES . "</b><br />\n";
echo "<table border='1' width='100%'><tr class='bg2'><td align='center'>" . _AM_STORYID . "</td><td align='center'>" . _AM_TITLE . "</td><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _AM_POSTER . "</td><td align='center' class='nw'>" . _AM_PROGRAMMED . "</td><td align='center' class='nw'>" . _AM_EXPIRED . "</td><td align='center'>" . _AM_ACTION . "</td></tr>";
foreach( $storyarray as $autostory )
{
$topic = $autostory -> topic();
$expire = ( $autostory -> expired() > 0 ) ? formatTimestamp( $autostory -> expired() ) : '';
echo "
<tr><td align='center'><b>" . $autostory -> storyid() . "</b>
</td><td align='left'><a href='" . XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/article.php?storyid=" . $autostory -> storyid() . "'>" . $autostory -> title() . "</a>
</td><td align='center'>" . $topic -> topic_title() . "
</td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $autostory -> uid() . "'>" . $autostory -> uname() . "</a></td><td align='center' class='nw'>" . formatTimestamp( $autostory -> published() ) . "</td><td align='center'>" . $expire . "</td><td align='center'><a href='../submit.php?op=edit&storyid=" . $autostory -> storyid() . "'>" . _AM_EDIT . "</a>-<a href='index.php?op=delete&storyid=" . $autostory -> storyid() . "'>" . _AM_DELETE . "</a>";
echo "</td></tr>\n";
}
echo "</table>";
echo "</div>";
echo"</td></tr></table>";
echo "<br />";
}
}
/*
* Shows last 10 published stories
*/
function lastStories()
{
global $xoopsModule, $xoopsModuleConfig;
echo"<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">";
echo "<div style='text-align: center;'><b>" . sprintf(_AM_LAST10ARTS,$xoopsModuleConfig['storycountadmin']) . "</b><br />";
$storyarray = NewsStory :: getAllPublished($xoopsModuleConfig['storycountadmin'], 0, false, 0, 1 );
echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AM_STORYID . "</td><td align='center'>" . _AM_TITLE . "</td><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _AM_POSTER . "</td><td align='center' class='nw'>" . _AM_PUBLISHED . "</td><td align='center' class='nw'>" . _AM_EXPIRED . "</td><td align='center'>" . _AM_ACTION . "</td></tr>";
foreach( $storyarray as $eachstory )
{
$published = formatTimestamp( $eachstory -> published() );
$expired = ( $eachstory -> expired() > 0 ) ? formatTimestamp( $eachstory -> expired() ) : '---';
$topic = $eachstory -> topic();
echo "
<tr><td align='center'><b>" . $eachstory -> storyid() . "</b>
</td><td align='left'><a href='" . XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/article.php?storyid=" . $eachstory -> storyid() . "'>" . $eachstory -> title() . "</a>
</td><td align='center'>" . $topic -> topic_title() . "
</td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $eachstory -> uid() . "'>" . $eachstory -> uname() . "</a></td><td align='center' class='nw'>" . $published . "</td><td align='center'>" . $expired . "</td><td align='center'><a href='../submit.php?op=edit&storyid=" . $eachstory -> storyid() . "'>" . _AM_EDIT . "</a>-<a href='index.php?op=delete&storyid=" . $eachstory -> storyid() . "'>" . _AM_DELETE . "</a>";
echo "</td></tr>\n";
}
echo "</table><br />";
echo "<form action='index.php' method='post'>" . _AM_STORYID . " <input type='text' name='storyid' size='10' />
<select name='op'>
<option value='edit' selected='selected'>" . _AM_EDIT . "</option>
<option value='delete'>" . _AM_DELETE . "</option>
</select>
<input type='submit' value='" . _AM_GO . "' />
</form>
</div>";
echo"</td></tr></table>";
}
// Added function to display expired stories
function expStories()
{
global $xoopsModule;
echo"<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">";
echo "<div style='text-align: center;'><b>" . _AM_EXPARTS . "</b><br />";
$storyarray = NewsStory :: getAllExpired( 10, 0, 0, 1 );
echo "<table border='1' width='100%'><tr class='bg3'><td align='center'>" . _AM_STORYID . "</td><td align='center'>" . _AM_TITLE . "</td><td align='center'>" . _AM_TOPIC . "</td><td align='center'>" . _AM_POSTER . "</td><td align='center' class='nw'>" . _AM_PUBLISHED . "</td><td align='center' class='nw'>" . _AM_EXPIRED . "</td><td align='center'>" . _AM_ACTION . "</td></tr>";
foreach( $storyarray as $eachstory )
{
$published = formatTimestamp( $eachstory -> published() );
$expired = formatTimestamp( $eachstory -> expired() );
$topic = $eachstory -> topic();
// added exired value field to table
echo "
<tr><td align='center'><b>" . $eachstory -> storyid() . "</b>
</td><td align='left'><a href='" . XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/article.php?storyid=" . $eachstory -> storyid() . "'>" . $eachstory -> title() . "</a>
</td><td align='center'>" . $topic -> topic_title() . "
</td><td align='center'><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $eachstory -> uid() . "'>" . $eachstory -> uname() . "</a></td><td align='center' class='nw'>" . $published . "</td><td align='center' class='nw'>" . $expired . "</td><td align='center'><a href='../submit.php?op=edit&storyid=" . $eachstory -> storyid() . "'>" . _AM_EDIT . "</a>-<a href='index.php?op=delete&storyid=" . $eachstory -> storyid() . "'>" . _AM_DELETE . "</a>";
echo "</td></tr>\n";
}
echo "</table><br />";
echo "<form action='index.php' method='post'>
" . _AM_STORYID . " <input type='text' name='storyid' size='10' />
<select name='op'>
<option value='edit' selected='selected'>" . _AM_EDIT . "</option>
<option value='delete'>" . _AM_DELETE . "</option>
</select>
<input type='submit' value='" . _AM_GO . "' />
</form>
</div>
";
echo"</td></tr></table>";
}
function topicsmanager()
{
global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
xoops_cp_header();
adminmenu(0);
$uploadfolder=sprintf(_AM_UPLOAD_WARNING,XOOPS_URL . "/modules/" . $xoopsModule -> dirname().'/images/topics');
echo "<h4>" . _AM_CONFIG . "</h4>";
$xt = new XoopsTopic( $xoopsDB -> prefix( "topics" ) );
$topics_array = XoopsLists :: getImgListAsArray( XOOPS_ROOT_PATH . "/modules/news/images/topics/" );
// $xoopsModule->printAdminMenu();
// echo "<br />";
// Add a New Main Topic
echo"<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">";
echo "<form method='post' action='index.php' enctype='multipart/form-data'>\n";
echo "<h4>" . _AM_ADDMTOPIC . "</h4><br />";
echo "<b>" . _AM_TOPICNAME . "</b> " . _AM_MAX40CHAR . "<br /><input type='text' name='topic_title' size='30' maxlength='40' /><br />";
echo "<b>" . _AM_TOPICIMG . "</b> (" . sprintf( _AM_IMGNAEXLOC, "modules/" . $xoopsModule -> dirname() . "/images/topics/" ) . ")<br />" . _AM_FEXAMPLE . "<br />";
echo "<select size='1' name='topic_imgurl'>";
echo "<option value=' '>------</option>";
foreach( $topics_array as $image )
{
echo "<option value='" . $image . "'>" . $image . "</option>";
}
echo "</select><br />";
echo "<b>" . _AM_TOPIC_PICTURE . "</b> <input type='hidden' name='MAX_FILE_SIZE' value='".$xoopsModuleConfig['maxuploadsize']."' />";
echo "<input type='file' name='attachedfile' id='attachedfile' /><input type='hidden' name='xoops_upload_file[]' id='xoops_upload_file[]' value='attachedfile' /><br /> $uploadfolder";
echo "<br /><br />";
echo "<input type='hidden' name='topic_pid' value='0' />\n";
echo "<input type='hidden' name='op' value='addTopic' />";
echo "<input type='submit' value='" . _AM_ADD . "' /><br /></form>";
echo"</td></tr></table>";
echo "<br />";
// Add a New Sub-Topic
$result = $xoopsDB -> query( "select count(*) from " . $xoopsDB -> prefix( "topics" ) . "" );
list( $numrows ) = $xoopsDB -> fetchRow( $result );
if ( $numrows > 0 )
{
echo"<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">";
echo "<form method='post' action='index.php' enctype='multipart/form-data'>";
echo "<h4>" . _AM_ADDSUBTOPIC . "</h4><br />";
echo "<b>" . _AM_TOPICNAME . "</b> " . _AM_MAX40CHAR . "<br /><input type='text' name='topic_title' size='30' maxlength='40' /> " . _AM_IN . " ";
$xt -> makeTopicSelBox( 0, 0, "topic_pid" );
echo "<br />";
echo "<b>" . _AM_TOPICIMG . "</b> (" . sprintf( _AM_IMGNAEXLOC, "modules/" . $xoopsModule -> dirname() . "/images/topics/" ) . ")<br />" . _AM_FEXAMPLE . "<br />";
echo "<select size='1' name='topic_imgurl'>";
echo "<option value=' '>------</option>";
foreach( $topics_array as $image )
{
echo "<option value='" . $image . "'>" . $image . "</option>";
}
echo "</select><br />";
echo "<b>" . _AM_TOPIC_PICTURE . "</b> <input type='hidden' name='MAX_FILE_SIZE' value='".$xoopsModuleConfig['maxuploadsize']."' />";
echo "<input type='file' name='attachedfile' id='attachedfile' /><input type='hidden' name='xoops_upload_file[]' id='xoops_upload_file[]' value='attachedfile' /><br /> $uploadfolder";
echo "<br /><br />";
echo "<input type='hidden' name='op' value='addTopic' />";
echo "<input type='submit' value='" . _AM_ADD . "' /><br /></form>";
echo"</td></tr></table>";
echo "<br />";
// Modify Topic
echo"<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">";
echo "
<form method='post' action='index.php'>
<h4>" . _AM_MODIFYTOPIC . "</h4><br />";
echo "<b>" . _AM_TOPIC . "</b><br />";
$xt -> makeTopicSelBox();
echo "<br /><br />\n";
echo "<input type='hidden' name='op' value='modTopic' />\n";
echo "<input type='submit' value='" . _AM_MODIFY . "' />\n";
echo "</form>";
echo"</td></tr></table>";
}
}
function modTopic()
{
global $xoopsDB;
global $xoopsModule;
$xt = new XoopsTopic( $xoopsDB -> prefix( "topics" ), $_POST['topic_id'] );
$topics_array = XoopsLists :: getImgListAsArray( XOOPS_ROOT_PATH . "/modules/news/images/topics/" );
xoops_cp_header();
echo "<h4>" . _AM_CONFIG . "</h4>";
// $xoopsModule->printAdminMenu();
// echo "<br />";
echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">";
echo "<h4>" . _AM_MODIFYTOPIC . "</h4><br />";
if ( $xt -> topic_imgurl() )
{
echo "<div style='text-align: right;'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule -> dirname() . "/images/topics/" . $xt -> topic_imgurl() . "'></div>";
}
echo "<form action='index.php' method='post'>";
echo "<b>" . _AM_TOPICNAME . "</b> " . _AM_MAX40CHAR . "<br /><input type='text' name='topic_title' size='20' maxlength='40' value='" . $xt -> topic_title('E') . "' /><br />";
echo "<b>" . _AM_TOPICIMG . "</b> (" . sprintf( _AM_IMGNAEXLOC, "modules/" . $xoopsModule -> dirname() . "/images/topics/" ) . ")<br />" . _AM_FEXAMPLE . "<br />";
// echo "<input type='text' name='topic_imgurl' size='20' maxlength='20' value='".$xt->topic_imgurl()."' /><br />\n";
echo "<select size='1' name='topic_imgurl'>";
echo "<option value=' '>------</option>";
foreach( $topics_array as $image )
{
if ( $image == $xt -> topic_imgurl() )
{
$opt_selected = "selected='selected'";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -