⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 在综合英文版XOOPS 2.09, 2.091, 2.092 的基础上正式发布XOOPS 2.09中文版 XOOPS 2.09x 版主要是PHP5升级、bug修正和安全补正: 1 全面兼容PHP 5.
💻 PHP
📖 第 1 页 / 共 2 页
字号:
        else
        {
            $opt_selected = "";
        }
        echo "<option value='" . $image . "' $opt_selected>" . $image . "</option>";
    }
    echo "</select><br />";
    echo "<b>" . _AM_PARENTTOPIC . "<b><br />\n";
    $xt -> makeTopicSelBox( 1, $xt -> topic_pid(), "topic_pid" );
    echo "\n<br /><br />";

    echo "<input type='hidden' name='topic_id' value='" . $xt -> topic_id() . "' />\n";
    echo "<input type='hidden' name='op' value='modTopicS' />";
    echo "<input type='submit' value='" . _AM_SAVECHANGE . "' />&nbsp;<input type='button' value='" . _AM_DEL . "' onclick='location=\"index.php?topic_pid=" . $xt -> topic_pid() . "&amp;topic_id=" . $xt -> topic_id() . "&amp;op=delTopic\"' />\n";
    echo "&nbsp;<input type='button' value='" . _AM_CANCEL . "' onclick='javascript:history.go(-1)' />\n";
    echo "</form>";
    echo"</td></tr></table>";
}
function modTopicS()
{
    global $xoopsDB;
    $xt = new XoopsTopic( $xoopsDB -> prefix( "topics" ), $_POST['topic_id'] );
    if ( $_POST['topic_pid'] == $_POST['topic_id'] )
    {
        echo "ERROR: Cannot select this topic for parent topic!";
        exit();
    }
    $xt -> setTopicPid( $_POST['topic_pid'] );
    if ( empty( $_POST['topic_title'] ) )
    {
        redirect_header( "index.php?op=topicsmanager", 2, _AM_ERRORTOPICNAME );
    }
    $xt -> setTopicTitle( $_POST['topic_title'] );
    if ( isset( $_POST['topic_imgurl'] ) && $_POST['topic_imgurl'] != "" )
    {
        $xt -> setTopicImgurl( $_POST['topic_imgurl'] );
    }
    $xt -> store();
    redirect_header( 'index.php?op=topicsmanager', 1, _AM_DBUPDATED );
    exit();
}
function delTopic()
{
    global $xoopsDB, $xoopsModule;
    if ( $_POST['ok'] != 1 )
    {
        xoops_cp_header();
        echo "<h4>" . _AM_CONFIG . "</h4>";
        xoops_confirm( array( 'op' => 'delTopic', 'topic_id' => intval( $_GET['topic_id'] ), 'ok' => 1 ), 'index.php', _AM_WAYSYWTDTTAL );
    }
    else
    {
        $xt = new XoopsTopic( $xoopsDB -> prefix( "topics" ), $_POST['topic_id'] );
        // get all subtopics under the specified topic
        $topic_arr = $xt -> getAllChildTopics();
        array_push( $topic_arr, $xt );
        foreach( $topic_arr as $eachtopic )
        {
            // get all stories in each topic
            $story_arr = NewsStory :: getByTopic( $eachtopic -> topic_id() );
            foreach( $story_arr as $eachstory )
            {
                if ( false != $eachstory -> delete() )
                {
                    xoops_comment_delete( $xoopsModule -> getVar( 'mid' ), $eachstory -> storyid() );
                    xoops_notification_deletebyitem( $xoopsModule -> getVar( 'mid' ), 'story', $eachstory -> storyid() );
                }
            }
            // all stories for each topic is deleted, now delete the topic data
            $eachtopic -> delete();
            xoops_notification_deletebyitem( $xoopsModule -> getVar( 'mid' ), 'category', $eachtopic -> topic_id );
        }
        redirect_header( 'index.php?op=topicsmanager', 1, _AM_DBUPDATED );
        exit();
    }
}

function addTopic()
{
    global $xoopsDB, $xoopsModule, $HTTP_POST_FILES, $xoopsModuleConfig;
    $topicpid = isset($_POST['topic_pid']) ? intval($_POST['topic_pid']) : 0;
    $xt = new XoopsTopic( $xoopsDB -> prefix( "topics" ) );
    if ( !$xt -> topicExists( $topicpid, $_POST['topic_title'] ) )
    {
        $xt -> setTopicPid($topicpid);
        if ( empty( $_POST['topic_title']) || trim($_POST['topic_title'])=='' )
        {
            redirect_header( "index.php?op=topicsmanager", 2, _AM_ERRORTOPICNAME );
        }
        $xt -> setTopicTitle( $_POST['topic_title'] );
        if ( isset( $_POST['topic_imgurl'] ) && $_POST['topic_imgurl'] != "" )
        {
            $xt -> setTopicImgurl( $_POST['topic_imgurl'] );
        }

		if(isset($_POST['xoops_upload_file'])) {
			$fldname = $HTTP_POST_FILES[$_POST['xoops_upload_file'][0]];
			$fldname = (get_magic_quotes_gpc()) ? stripslashes($fldname['name']) : $fldname['name'];
			if(trim($fldname!=''))
			{
				$sfiles = new sFiles();
				$dstpath = XOOPS_ROOT_PATH . "/modules/" . $xoopsModule -> dirname() . '/images/topics';
				$destname=$sfiles->createUploadName($dstpath ,$fldname, true);
				$permittedtypes=array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
				$uploader = new XoopsMediaUploader($dstpath, $permittedtypes, $xoopsModuleConfig['maxuploadsize']);
				$uploader->setTargetFileName($destname);
				if ($uploader->fetchMedia($_POST['xoops_upload_file'][0]))
				{
					if ($uploader->upload()) {
						$xt->setTopicImgurl(basename($destname));
					} else {
						echo _AM_UPLOAD_ERROR;
					}
				} else {
					echo $uploader->getErrors();
				}
			}
		}
		$xt -> store();
        $notification_handler = & xoops_gethandler( 'notification' );
        $tags = array();
        $tags['TOPIC_NAME'] = $_POST['topic_title'];
        $notification_handler -> triggerEvent( 'global', 0, 'new_category', $tags );
        redirect_header( 'index.php?op=topicsmanager', 1, _AM_DBUPDATED );
    }
    else
    {
        redirect_header( 'index.php?op=topicsmanager',2,"Topic exists!");
    }
    exit();
}

switch ($op)
{
    case "newarticle":
        xoops_cp_header();
        adminmenu(1);
        echo "<h4>" . _AM_CONFIG . "</h4>";
        include_once XOOPS_ROOT_PATH . "/class/module.textsanitizer.php";
        // $xoopsModule->printAdminMenu();
        // echo "<br />";
        newSubmissions();
        autoStories();
        lastStories();
        expStories();
        echo "<br />";
        echo"<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">";
        echo "<h4>" . _AM_POSTNEWARTICLE . "</h4>";
        $type = "admin";
        $title = "";
        $topicdisplay = 0;
        $topicalign = 'R';
        $ihome = 1;
        $hometext = '';
        $bodytext = '';
        $notifypub = 1;
        $nohtml = 0;
        $approve = 0;
        $nosmiley = 0;
	    $autodate = '';
	    $expired = '';
	    $topicid = 0;
	    $published = time();
        if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/main.php')) {
            include_once '../language/'.$xoopsConfig['language'].'/main.php';
        }
        else {
            include_once '../language/english/main.php';
        }
        $approveprivilege = 1;
        include_once "../include/storyform.inc.php";
        echo"</td></tr></table>";
        break;

    case "edit":
    	xoops_cp_header();
        if (file_exists(XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/language/'.$xoopsConfig['language'].'/main.php')) {
            include_once '../language/'.$xoopsConfig['language'].'/main.php';
        }
        else {
            include_once '../language/english/main.php';
        }
        $approveprivilege = 1;
        $story = new NewsStory($_POST['storyid']);
        $title = $story->title("Edit");
        $hometext = $story->hometext("Edit");
        $bodytext = $story->bodytext("Edit");
        $nohtml = $story ->nohtml();
        $nosmiley = $story->nosmiley();
        $ihome = $story->ihome();
        $notifypub = 0;
        $topicid = $story->topicid();
        $approve = 0;
        $published = $story->published();
        if (isset($published) && $published > 0) {
            $approve = 1;
        }
        if ($story -> published() != 0) {
            $published = $story -> published();
        }
		if ( $story -> expired() != 0) {
            $expired = $story -> expired();
        } else {
            $expired = 0;
        }
		$type = $story -> type();
        $topicdisplay = $story -> topicdisplay();
        $topicalign = $story -> topicalign( false );
    	include_once "../include/storyform.inc.php";
    	break;

    case "delete":
        if (!empty($ok))
        {
            if (empty($storyid))
            {
                redirect_header( 'index.php?op=newarticle', 2, _AM_EMPTYNODELETE );
                exit();
            }
            $story = new NewsStory( $storyid );
            $story -> delete();
			$sfiles = new sFiles();
			$filesarr=Array();
			$filesarr=$sfiles->getAllbyStory($storyid);
			if(count($filesarr)>0)
			{
				foreach ($filesarr as $onefile)
				{
					$onefile->delete();
				}
			}
            xoops_comment_delete( $xoopsModule -> getVar( 'mid' ), $storyid );
            xoops_notification_deletebyitem( $xoopsModule -> getVar( 'mid' ), 'story', $storyid );
            redirect_header( 'index.php?op=newarticle', 1, _AM_DBUPDATED );
            exit();
        }
        else
        {
            xoops_cp_header();
            echo "<h4>" . _AM_CONFIG . "</h4>";
            xoops_confirm( array( 'op' => 'delete', 'storyid' => $storyid, 'ok' => 1 ), 'index.php', _AM_RUSUREDEL );
        }
        break;
    case "topicsmanager":
        topicsmanager();
        break;

    case "addTopic":
        addTopic();
        break;

    case "delTopic":
        delTopic();
        break;
    case "modTopic":
        modTopic();
        break;
    case "modTopicS":
        modTopicS();
        break;

    case "default":
    default:
        xoops_cp_header();
        adminmenu(0);
        echo "<h4>" . _AM_CONFIG . "</h4>";
        echo"<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class=\"odd\">";
        echo " - <b><a href='index.php?op=topicsmanager'>" . _AM_TOPICSMNGR . "</a></b>";
        echo "<br /><br />\n";
        echo " - <b><a href='index.php?op=newarticle'>" . _AM_PEARTICLES . "</a></b>\n";
        echo "<br /><br />\n";
        echo " - <b><a href='groupperms.php'>" . _AM_GROUPPERM . "</a></b>\n";
        echo "<br /><br />\n";
        echo " - <b><a href='" . XOOPS_URL . '/modules/system/admin.php?fct=preferences&amp;op=showmod&amp;mod=' . $xoopsModule -> getVar( 'mid' ) . "'>" . _AM_GENERALCONF . "</a></b>";
        echo"</td></tr></table>";
        break;
}

xoops_cp_footer();

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -