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

📄 wiki_cp.php

📁 uch百科插件。跟互动百科类似。大家可以看看哦
💻 PHP
字号:
<?php

/*
	百科全书插件 for UCH 1.5
	版权所有: www.carqi.com 卡奇网——最互动、最娱乐的车友会
	作者:Cody	 service@carqi.com
	QQ:779626052
*/


$op = $_GET['op'];
if (empty($op)) {
	showmessage('未定义的方法');
}

if ('post' == $op) {	
	$title = trim($_POST['title']);
	if (empty($title) || empty($_POST['content'])) {
		showmessage("标题或内容不能为空");
	}
	$post_wiki_id = intval($_POST['wiki_id']);
	//修改
	if ($post_wiki_id > 0) {
		$data = array(
			'title' => shtmlspecialchars($title),
			'content' => trim($_POST['content']),
			'typeid' =>  intval($_POST['typeid'])
		 );
		//更新编辑数
		$sql = "UPDATE ".tname("app_wiki")." SET edit_count =edit_count + 1 WHERE id = ".$post_wiki_id;
		$_SGLOBAL['db']->query( $sql );

		 updatetable("app_wiki", $data, "id = {$post_wiki_id}");
		 showmessage("修改成功!", "wiki.php?do=wiki&ac=view&id={$post_wiki_id}");



	}
	

	$data = array(
		'uid' => $_SGLOBAL['supe_uid'],
		'username' => $_SGLOBAL['supe_username'],
		'title' => shtmlspecialchars($title),
		'content' => trim($_POST['content']),
		'typeid' =>  intval($_POST['typeid']),
		'dateline' => $_SGLOBAL['timestamp'],
	 );
	//返回在数据库中创建的ID
	$wiki_id = inserttable('app_wiki', $data, 1);


	//事件feed
	$fs = array();
	$fs['icon'] = 'wiki';
    $fs['title_template'] = "{actor} 在《汽车百科》中创建了新的词条 <b>{subject}</b>";
	
	$fs['title_data'] = array(
		'subject' => "<a href=\"wiki.php?do=wiki&ac=view&id={$wiki_id}\">{$title}</a>",
	);
	$fs['body_template'] = '';
	$fs['body_data'] = array();
	
	include_once(S_ROOT.'./source/function_cp.php');
	feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general'],$fs['images'], $fs['image_links'], $fs['target_ids'], $fs['friend']);

	updatecredit($_SGLOBAL['supe_uid'], 1, '+');
	showmessage("信息发布成功。您的积分已增加了1分。感谢您对《汽车百科》做出的贡献!", "wiki.php?do=wiki&ac=view&id={$wiki_id}");

}




elseif ('delete' == $op)
{
	$wiki_id = intval($_GET['id']);
	if (empty($wiki_id)) {
		showmessage("参数错误");
	}
	$sql = " select * from ".tname('app_wiki')." where id = ".$wiki_id." ";
	$query = $_SGLOBAL['db']->query( $sql );
	$info = $_SGLOBAL['db']->fetch_array( $query );
	if (empty($info))
	{
		showmessage("信息不存在或者已经被删除", 'wiki.php?do=wiki');
	}
	if ( $_SGLOBAL['supe_uid'] != $info['uid'] &&  $_SGLOBAL['supe_uid'] != ADMIN_ID ) {
		showmessage("您没有删除此问答的权限", 'wiki.php?do=wiki');
	}

	$sql = "DELETE FROM ".tname('app_wiki')." WHERE id = {$wiki_id} ";
	$query = $_SGLOBAL['db']->query($sql);
	showmessage("删除成功!", "wiki.php?do=ask", 0);
}

?>

⌨️ 快捷键说明

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