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

📄 index.php

📁 在综合英文版XOOPS 2.09, 2.091, 2.092 的基础上正式发布XOOPS 2.09中文版 XOOPS 2.09x 版主要是PHP5升级、bug修正和安全补正: 1 全面兼容PHP 5.
💻 PHP
📖 第 1 页 / 共 3 页
字号:
	$sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_votedata"), $_GET['lid']);	$xoopsDB->query($sql) or $eh->show("0013");	// delete comments	xoops_comment_delete($xoopsModule->getVar('mid'), $_GET['lid']);	// delete notifications	xoops_notification_deletebyitem ($xoopsModule->getVar('mid'), 'link', $_GET['lid']);    redirect_header("index.php",1,_MD_LINKDELETED);	exit();}function modCat(){	global $xoopsDB, $_POST, $myts, $eh, $mytree;    $cid = $_POST["cid"];	xoops_cp_header();	echo "<h4>"._MD_WEBLINKSCONF."</h4>";	echo"<table width='100%' border='0' cellspacing='1' class='outer'>"	."<tr class=\"odd\"><td>";    echo "<h4>"._MD_MODCAT."</h4><br />";	$result=$xoopsDB->query("select pid, title, imgurl from ".$xoopsDB->prefix("mylinks_cat")." where cid=$cid");	list($pid,$title,$imgurl) = $xoopsDB->fetchRow($result);	$title = $myts->makeTboxData4Edit($title);	$imgurl = $myts->makeTboxData4Edit($imgurl);	echo "<form action=index.php method=post>"._MD_TITLEC."<input type=text name=title value=\"$title\" size=51 maxlength=50><br /><br />"._MD_IMGURLMAIN."<br /><input type=text name=imgurl value=\"$imgurl\" size=100 maxlength=150><br /><br />";	echo _MD_PARENT."&nbsp;";	$mytree->makeMySelBox("title", "title", $pid, 1, "pid");	//	<input type=hidden name=pid value=\"$pid\">	echo "<br /><input type=\"hidden\" name=\"cid\" value=\"".$cid."\">	<input type=\"hidden\" name=\"op\" value=\"modCatS\"><br />	<input type=\"submit\" value=\""._MD_SAVE."\">	<input type=\"button\" value=\""._MD_DELETE."\" onClick=\"location='index.php?pid=$pid&amp;cid=$cid&amp;op=delCat'\">";	echo "&nbsp;<input type=\"button\" value=\""._MD_CANCEL."\" onclick=\"javascript:history.go(-1)\ /\">";	echo "</form>";	echo"</td></tr></table>";	xoops_cp_footer();}function modCatS(){   	global $xoopsDB, $_POST, $myts, $eh;   	$cid =  $_POST['cid'];   	$pid =  $_POST['pid'];   	$title =  $myts->makeTboxData4Save($_POST['title']);	if (empty($title)) {		redirect_header("index.php", 2, _MD_ERRORTITLE);	}	if ( ($_POST["imgurl"]) || ($_POST["imgurl"]!="") ) {		$imgurl = $myts->makeTboxData4Save($_POST["imgurl"]);	}	$xoopsDB->query("update ".$xoopsDB->prefix("mylinks_cat")." set pid=$pid, title='$title', imgurl='$imgurl' where cid=$cid") or $eh->show("0013");    redirect_header("index.php",1,_MD_DBUPDATED);}function delCat(){   	global $xoopsDB, $_GET, $_POST, $eh, $mytree, $xoopsModule;   	$cid =  isset($_POST['cid']) ? intval($_POST['cid']) : intval($_GET['cid']);	$ok =  isset($_POST['ok']) ? intval($_POST['ok']) : 0;    if ( $ok == 1 ) {		//get all subcategories under the specified category		$arr=$mytree->getAllChildId($cid);		$dcount=count($arr);		for ( $i=0;$i<$dcount;$i++ ) {			//get all links in each subcategory			$result=$xoopsDB->query("select lid from ".$xoopsDB->prefix("mylinks_links")." where cid=".$arr[$i]."") or $eh->show("0013");			//now for each link, delete the text data and vote ata associated with the link			while ( list($lid)=$xoopsDB->fetchRow($result) ) {				$sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_text"), $lid);				$xoopsDB->query($sql) or $eh->show("0013");				$sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_votedata"), $lid);				$xoopsDB->query($sql) or $eh->show("0013");				$sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_links"), $lid);				$xoopsDB->query($sql) or $eh->show("0013");				xoops_comment_delete($xoopsModule->getVar('mid'), $lid);				xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'link', $lid);			}			xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $arr[$i]);			//all links for each subcategory is deleted, now delete the subcategory data			$sql = sprintf("DELETE FROM %s WHERE cid = %u", $xoopsDB->prefix("mylinks_cat"), $arr[$i]);			$xoopsDB->query($sql) or $eh->show("0013");		}		//all subcategory and associated data are deleted, now delete category data and its associated data		$result=$xoopsDB->query("select lid from ".$xoopsDB->prefix("mylinks_links")." where cid=".$cid."") or $eh->show("0013");		while ( list($lid)=$xoopsDB->fetchRow($result) ) {			$sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_links"), $lid);			$xoopsDB->query($sql) or $eh->show("0013");			$sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_text"), $lid);			$xoopsDB->query($sql) or $eh->show("0013");			$sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_votedata"), $lid);			$xoopsDB->query($sql) or $eh->show("0013");			// delete comments			xoops_comment_delete($xoopsModule->getVar('mid'), $lid);			// delete notifications			xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'link', $lid);		}		$sql = sprintf("DELETE FROM %s WHERE cid = %u", $xoopsDB->prefix("mylinks_cat"), $cid);	    $xoopsDB->query($sql) or $eh->show("0013");		xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $cid);        redirect_header("index.php",1,_MD_CATDELETED);		exit();    } else {		xoops_cp_header();		xoops_confirm(array('op' => 'delCat', 'cid' => $cid, 'ok' => 1), 'index.php', _MD_WARNING);		xoops_cp_footer();    }}function delNewLink(){	global $xoopsDB, $_GET, $eh, $xoopsModule;	$sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_links"), $_GET['lid']);    $xoopsDB->query($sql) or $eh->show("0013");	$sql = sprintf("DELETE FROM %s WHERE lid = %u", $xoopsDB->prefix("mylinks_text"), $_GET['lid']);    $xoopsDB->query($sql) or $eh->show("0013");	// delete comments	xoops_comment_delete($xoopsModule->getVar('mid'), $_GET['lid']);	// delete notifications	xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'link', $_GET['lid']);	redirect_header("index.php",1,_MD_LINKDELETED);}function addCat(){	global $xoopsDB, $_POST, $myts, $eh;    $pid = $_POST["cid"];    $title = $myts->makeTboxData4Save($_POST["title"]);	if (empty($title)) {		redirect_header("index.php",2,_MD_ERRORTITLE);		exit();	}    if ( ($_POST["imgurl"]) || ($_POST["imgurl"]!="") ) {		//		$imgurl = $myts->formatURL($_POST["imgurl"]);		//		$imgurl = urlencode($imgurl);		$imgurl = $myts->makeTboxData4Save($_POST["imgurl"]);	}	$newid = $xoopsDB->genId($xoopsDB->prefix("mylinks_cat")."_cid_seq");	$sql = sprintf("INSERT INTO %s (cid, pid, title, imgurl) VALUES (%u, %u, '%s', '%s')", $xoopsDB->prefix("mylinks_cat"), $newid, $pid, $title, $imgurl);	$xoopsDB->query($sql) or $eh->show("0013");	if ($newid == 0) {		$newid = $xoopsDB->getInsertId();	}	global $xoopsModule;	$tags = array();	$tags['CATEGORY_NAME'] = $title;	$tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $newid;	$notification_handler =& xoops_gethandler('notification');	$notification_handler->triggerEvent('global', 0, 'new_category', $tags);	redirect_header("index.php",1,_MD_NEWCATADDED);}function addLink(){	global $xoopsConfig, $xoopsDB, $myts, $xoopsUser, $xoopsModule, $eh, $_POST;	if ( ($_POST["url"]) || ($_POST["url"]!="") ) {		//	$url=$myts->formatURL($_POST["url"]);		//		$url = urlencode($url);		$url = $myts->makeTboxData4Save($_POST["url"]);	}	$logourl = $myts->makeTboxData4Save($_POST["logourl"]);    $title = $myts->makeTboxData4Save($_POST["title"]);    $description = $myts->makeTareaData4Save($_POST["description"]);    $submitter = $xoopsUser->uid();    $result = $xoopsDB->query("select count(*) from ".$xoopsDB->prefix("mylinks_links")." where url='$url'");    list($numrows) = $xoopsDB->fetchRow($result);	$errormsg = "";	$error = 0;    if ( $numrows > 0 ) {		$errormsg .= "<h4 style='color: #ff0000'>";		$errormsg .= _MD_ERROREXIST."</h4>";		$error = 1;    }	// Check if Title exist    if ( $title == "" ) {		$errormsg .= "<h4 style='color: #ff0000'>";		$errormsg .= _MD_ERRORTITLE."</h4>";    	$error =1;    }	// Check if Description exist    if ( $description == "" ) {		$errormsg .= "<h4 style='color: #ff0000'>";		$errormsg .= _MD_ERRORDESC."</h4>";    	$error =1;    }    if ( $error == 1 ) {		xoops_cp_header();		echo $errormsg;		xoops_cp_footer();		exit();    }    if ( !empty($_POST['cid']) ) {		$cid = $_POST['cid'];	} else {		$cid = 0;	}	$newid = $xoopsDB->genId($xoopsDB->prefix("mylinks_links")."_lid_seq");	$sql = sprintf("INSERT INTO %s (lid, cid, title, url, logourl, submitter, status, date, hits, rating, votes, comments) VALUES (%u, %u, '%s', '%s', '%s', %u, %u, %u, %u, %u, %u, %u)", $xoopsDB->prefix("mylinks_links"), $newid, $cid, $title, $url, $logourl, $submitter, 1, time(), 0, 0, 0, 0);	$xoopsDB->query($sql) or $eh->show("0013");	if ( $newid == 0 ) {		$newid = $xoopsDB->getInsertId();	}	$sql = sprintf("INSERT INTO %s (lid, description) VALUES (%u, '%s')", $xoopsDB->prefix("mylinks_text"), $newid, $description);	$xoopsDB->query($sql) or $eh->show("0013");	$tags = array();    $tags['LINK_NAME'] = $title;    $tags['LINK_URL'] = XOOPS_URL . '/modules/'. $xoopsModule->getVar('dirname') . '/singlelink.php?cid=' . $cid . '&amp;lid=' . $newid;    $sql = "SELECT title FROM " . $xoopsDB->prefix("mylinks_cat") . " WHERE cid=" . $cid;    $result = $xoopsDB->query($sql);    $row = $xoopsDB->fetchArray($result);    $tags['CATEGORY_NAME'] = $row['title'];    $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;	$notification_handler =& xoops_gethandler('notification');	$notification_handler->triggerEvent('global', 0, 'new_link', $tags);	$notification_handler->triggerEvent('category', $cid, 'new_link', $tags);    redirect_header("index.php?op=linksConfigMenu",1,_MD_NEWLINKADDED);}function approve(){	global $xoopsConfig, $xoopsDB, $_POST, $myts, $eh;	$lid = $_POST['lid'];	$title = $_POST['title'];	$cid = $_POST['cid'];	if ( empty($cid) ) {		$cid = 0;	}	$description = $_POST['description'];	if (($_POST["url"]) || ($_POST["url"]!="")) {		//		$url=$myts->formatURL($_POST["url"]);		//		$url = urlencode($url);		$url = $myts->makeTboxData4Save($_POST["url"]);	}	$logourl = $myts->makeTboxData4Save($_POST["logourl"]);	$title = $myts->makeTboxData4Save($title);	$description = $myts->makeTareaData4Save($description);	$query = "update ".$xoopsDB->prefix("mylinks_links")." set cid='$cid', title='$title', url='$url', logourl='$logourl', status=1, date=".time()." where lid=".$lid."";	$xoopsDB->query($query) or $eh->show("0013");	$query = "update ".$xoopsDB->prefix("mylinks_text")." set description='$description' where lid=".$lid."";	$xoopsDB->query($query) or $eh->show("0013");	global $xoopsModule;	$tags=array();    $tags['LINK_NAME'] = $title;    $tags['LINK_URL'] = XOOPS_URL . '/modules/'. $xoopsModule->getVar('dirname') . '/singlelink.php?cid=' . $cid . '&amp;lid=' . $lid;	$sql = "SELECT title FROM " . $xoopsDB->prefix("mylinks_cat") . " WHERE cid=" . $cid;    $result = $xoopsDB->query($sql);    $row = $xoopsDB->fetchArray($result);    $tags['CATEGORY_NAME'] = $row['title'];    $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;	$notification_handler =& xoops_gethandler('notification');	$notification_handler->triggerEvent('global', 0, 'new_link', $tags);	$notification_handler->triggerEvent('category', $cid, 'new_link', $tags);	$notification_handler->triggerEvent('link', $lid, 'approve', $tags);    redirect_header("index.php",1,_MD_NEWLINKADDED);}if(!isset($_POST['op'])) {	$op = isset($_GET['op']) ? $_GET['op'] : 'main';} else {	$op = $_POST['op'];}switch ($op) {case "delNewLink":	delNewLink();	break;case "approve":	approve();	break;case "addCat":	addCat();	break;case "addLink":	addLink();	break;case "listBrokenLinks":	listBrokenLinks();	break;case "delBrokenLinks":	delBrokenLinks();	break;case "ignoreBrokenLinks":	ignoreBrokenLinks();	break;case "listModReq":	listModReq();	break;case "changeModReq":	changeModReq();	break;case "ignoreModReq":	ignoreModReq();	break;case "delCat":	delCat();	break;case "modCat":	modCat();	break;case "modCatS":	modCatS();	break;case "modLink":	modLink();	break;case "modLinkS":	modLinkS();	break;case "delLink":	delLink();	break;case "delVote":	delVote();	break;case "linksConfigMenu":	linksConfigMenu();	break;case "listNewLinks":	listNewLinks();	break;case 'main':default:	mylinks();	break;}?>

⌨️ 快捷键说明

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