📄 index.php
字号:
<?php// ------------------------------------------------------------------------- //// XOOPS - PHP Content Management System //// <http://www.xoops.org/> //// ------------------------------------------------------------------------- //// Based on: //// myPHPNUKE Web Portal System - http://myphpnuke.com/ //// PHP-NUKE Web Portal System - http://phpnuke.org/ //// Thatware - http://thatware.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. //// //// 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 '../../../include/cp_header.php';if ( file_exists("../language/".$xoopsConfig['language']."/main.php") ) { include "../language/".$xoopsConfig['language']."/main.php";} else { include "../language/english/main.php";}include '../include/functions.php';include_once XOOPS_ROOT_PATH.'/class/xoopstree.php';include_once XOOPS_ROOT_PATH."/class/xoopslists.php";include_once XOOPS_ROOT_PATH."/include/xoopscodes.php";include_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php';$myts =& MyTextSanitizer::getInstance();$eh = new ErrorHandler;$mytree = new XoopsTree($xoopsDB->prefix("mylinks_cat"),"cid","pid");function mylinks(){ global $xoopsDB, $xoopsModule; xoops_cp_header(); echo "<h4>"._MD_WEBLINKSCONF."</h4>"; echo"<table width='100%' border='0' cellspacing='1' class='outer'>" ."<tr class=\"odd\"><td>"; // Temporarily 'homeless' links (to be revised in admin.php breakup) $result = $xoopsDB->query("select count(*) from ".$xoopsDB->prefix("mylinks_broken").""); list($totalbrokenlinks) = $xoopsDB->fetchRow($result); if($totalbrokenlinks>0){ $totalbrokenlinks = "<span style='color: #ff0000; font-weight: bold'>$totalbrokenlinks</span>"; } $result2 = $xoopsDB->query("select count(*) from ".$xoopsDB->prefix("mylinks_mod").""); list($totalmodrequests) = $xoopsDB->fetchRow($result2); if($totalmodrequests>0){ $totalmodrequests = "<span style='color: #ff0000; font-weight: bold'>$totalmodrequests</span>"; } $result3 = $xoopsDB->query("select count(*) from ".$xoopsDB->prefix("mylinks_links")." where status=0"); list($totalnewlinks) = $xoopsDB->fetchRow($result3); if($totalnewlinks>0){ $totalnewlinks = "<span style='color: #ff0000; font-weight: bold'>$totalnewlinks</span>"; } echo " - <a href='".XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule->getVar('mid')."'>"._MD_GENERALSET."</a>"; echo "<br /><br />"; echo " - <a href=index.php?op=linksConfigMenu>"._MD_ADDMODDELETE."</a>"; echo "<br /><br />"; echo " - <a href=index.php?op=listNewLinks>"._MD_LINKSWAITING." ($totalnewlinks)</a>"; echo "<br /><br />"; echo " - <a href=index.php?op=listBrokenLinks>"._MD_BROKENREPORTS." ($totalbrokenlinks)</a>"; echo "<br /><br />"; echo " - <a href=index.php?op=listModReq>"._MD_MODREQUESTS." ($totalmodrequests)</a>"; $result=$xoopsDB->query("select count(*) from ".$xoopsDB->prefix("mylinks_links")." where status>0"); list($numrows) = $xoopsDB->fetchRow($result); echo "<br /><br /><div>"; printf(_MD_THEREARE,$numrows); echo "</div>"; echo"</td></tr></table>"; xoops_cp_footer();}function listNewLinks(){ global $xoopsDB, $xoopsConfig, $myts, $eh, $mytree; // List links waiting for validation $linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/modules/mylinks/images/shots/"); $result = $xoopsDB->query("select lid, cid, title, url, logourl, submitter from ".$xoopsDB->prefix("mylinks_links")." where status=0 order by date DESC"); $numrows = $xoopsDB->getRowsNum($result); 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_LINKSWAITING." ($numrows)</h4><br />"; if ( $numrows > 0 ) { while(list($lid, $cid, $title, $url, $logourl, $submitterid) = $xoopsDB->fetchRow($result)) { $result2 = $xoopsDB->query("select description from ".$xoopsDB->prefix("mylinks_text")." where lid=$lid"); list($description) = $xoopsDB->fetchRow($result2); $title = $myts->makeTboxData4Edit($title); $url = $myts->makeTboxData4Edit($url); // $url = urldecode($url); // $logourl = $myts->makeTboxData4Edit($logourl); // $logourl = urldecode($logourl); $description = $myts->makeTareaData4Edit($description); $submitter = XoopsUser::getUnameFromId($submitterid); echo "<form action=\"index.php\" method=post>\n"; echo "<table width=\"80%\">"; echo "<tr><td align=\"right\" nowrap>"._MD_SUBMITTER."</td><td>\n"; echo "<a href=\"".XOOPS_URL."/userinfo.php?uid=".$submitterid."\">$submitter</a>"; echo "</td></tr>\n"; echo "<tr><td align=\"right\" nowrap>"._MD_SITETITLE."</td><td>"; echo "<input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\" value=\"$title\">"; echo "</td></tr><tr><td align=\"right\" nowrap>"._MD_SITEURL."</td><td>"; echo "<input type=\"text\" name=\"url\" size=\"50\" maxlength=\"250\" value=\"$url\">"; echo " [ <a href=\"".preg_replace("/javascript:/si", 'java script:', $url)."\" target=\"_blank\">"._MD_VISIT."</a> ]"; echo "</td></tr>"; echo "<tr><td align=\"right\" nowrap>"._MD_CATEGORYC."</td><td>"; $mytree->makeMySelBox("title", "title", $cid); echo "</td></tr>\n"; echo "<tr><td align=\"right\" valign=\"top\" nowrap>"._MD_DESCRIPTIONC."</td><td>\n"; echo "<textarea name=description cols=\"60\" rows=\"5\">$description</textarea>\n"; echo "</td></tr>\n"; echo "<tr><td align=\"right\" nowrap>"._MD_SHOTIMAGE."</td><td>\n"; //echo "<input type=\"text\" name=\"logourl\" size=\"50\" maxlength=\"60\">\n"; echo "<select size='1' name='logourl'>"; echo "<option value=' '>------</option>"; foreach($linkimg_array as $image){ echo "<option value='".$image."'>".$image."</option>"; } echo "</select>"; echo "</td></tr><tr><td></td><td>"; $shotdir = "<b>".XOOPS_URL."/modules/mylinks/images/shots/</b>"; printf(_MD_SHOTMUST,$shotdir); echo "</td></tr>\n"; echo "</table>\n"; echo "<br /><input type=\"hidden\" name=\"op\" value=\"approve\"></input>"; echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\"></input>"; echo "<input type=\"submit\" value=\""._MD_APPROVE."\"></form>\n"; echo myTextForm("index.php?op=delNewLink&lid=$lid",_MD_DELETE); echo "<br /><br />"; } } else { echo ""._MD_NOSUBMITTED.""; } echo"</td></tr></table>"; xoops_cp_footer();}function linksConfigMenu(){ global $xoopsDB,$xoopsConfig, $myts, $eh, $mytree; // Add a New Main Category xoops_cp_header(); $linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/modules/mylinks/images/shots/"); echo "<h4>"._MD_WEBLINKSCONF."</h4>"; echo "<table width='100%' border='0' cellspacing='1' class='outer'>" ."<tr class=\"odd\"><td>"; echo "<form method=post action=index.php>\n"; echo "<h4>"._MD_ADDMAIN."</h4><br />"._MD_TITLEC."<input type=text name=title size=30 maxlength=50><br />"; echo ""._MD_IMGURL."<br /><input type=\"text\" name=\"imgurl\" size=\"100\" maxlength=\"150\" value=\"http://\"><br /><br />"; echo "<input type=hidden name=cid value=0>\n"; echo "<input type=hidden name=op value=addCat>"; echo "<input type=submit value="._MD_ADD."><br /></form>"; echo"</td></tr></table>"; echo "<br />"; // Add a New Sub-Category $result=$xoopsDB->query("select count(*) from ".$xoopsDB->prefix("mylinks_cat").""); list($numrows)=$xoopsDB->fetchRow($result); if ( $numrows > 0 ) { echo"<table width='100%' border='0' cellspacing='1' class='outer'>" ."<tr class=\"odd\"><td>"; echo "<form method=post action=index.php>"; echo "<h4>"._MD_ADDSUB."</h4><br />"._MD_TITLEC."<input type=text name=title size=30 maxlength=50> "._MD_IN." "; $mytree->makeMySelBox("title", "title"); # echo "<br />"._MD_IMGURL."<br /><input type=\"text\" name=\"imgurl\" size=\"100\" maxlength=\"150\">\n"; echo "<input type=hidden name=op value=addCat><br /><br />"; echo "<input type=submit value="._MD_ADD."><br /></form>"; echo"</td></tr></table>"; echo "<br />"; // If there is a category, add a New Link echo"<table width='100%' border='0' cellspacing='1' class='outer'>" ."<tr class=\"odd\"><td>"; echo "<form method=post action=index.php>\n"; echo "<h4>"._MD_ADDNEWLINK."</h4><br />\n"; echo "<table width=\"80%\"><tr>\n"; echo "<td align=\"right\">"._MD_SITETITLE."</td><td>"; echo "<input type=text name=title size=50 maxlength=100>"; echo "</td></tr><tr><td align=\"right\" nowrap>"._MD_SITEURL."</td><td>"; echo "<input type=text name=url size=50 maxlength=250 value=\"http://\">"; echo "</td></tr>"; echo "<tr><td align=\"right\" nowrap>"._MD_CATEGORYC."</td><td>"; $mytree->makeMySelBox("title", "title"); echo "<tr><td align=\"right\" valign=\"top\" nowrap>"._MD_DESCRIPTIONC."</td><td>\n"; xoopsCodeTarea("description",60,8); xoopsSmilies("description"); //echo "<textarea name=description cols=60 rows=5></textarea>\n"; echo "</td></tr>\n"; echo "<tr><td align=\"right\"nowrap>"._MD_SHOTIMAGE."</td><td>\n"; //echo "<input type=\"text\" name=\"logourl\" size=\"50\" maxlength=\"60\">"; echo "<select size='1' name='logourl'>"; echo "<option value=' '>------</option>"; foreach($linkimg_array as $image){ echo "<option value='".$image."'>".$image."</option>"; } echo "</select>"; echo "</td></tr>\n"; $shotdir = "<b>".XOOPS_URL."/modules/mylinks/images/shots/</b>"; echo "<tr><td></td><td>"; printf(_MD_SHOTMUST,$shotdir); echo "</td></tr>\n"; echo "</table>\n<br />"; echo "<input type=\"hidden\" name=\"op\" value=\"addLink\"></input>"; echo "<input type=\"submit\" class=\"button\" value=\""._MD_ADD."\"></input>\n"; echo "</form>"; echo"</td></tr></table>"; echo "<br />"; // Modify Category echo"<table width='100%' border='0' cellspacing='1' class='outer'>" ."<tr class=\"odd\"><td>"; echo " </center><form method=post action=index.php> <h4>"._MD_MODCAT."</h4><br />"; echo _MD_CATEGORYC; $mytree->makeMySelBox("title", "title"); echo "<br /><br />\n"; echo "<input type=hidden name=op value=modCat>\n"; echo "<input type=submit value="._MD_MODIFY.">\n"; echo "</form>"; echo"</td></tr></table>"; echo "<br />"; } // Modify Link $result2 = $xoopsDB->query("select count(*) from ".$xoopsDB->prefix("mylinks_links").""); list($numrows2) = $xoopsDB->fetchRow($result2); if ( $numrows2 > 0 ) { echo"<table width='100%' border='0' cellspacing='1' class='outer'>" ."<tr class=\"odd\"><td>"; echo "<form method=get action=\"index.php\">\n"; echo "<h4>"._MD_MODLINK."</h4><br />\n"; echo _MD_LINKID."<input type=text name=lid size=12 maxlength=11>\n"; echo "<input type=hidden name=fct value=mylinks>\n"; echo "<input type=hidden name=op value=modLink><br /><br />\n"; echo "<input type=submit value="._MD_MODIFY."></form>\n"; echo"</td></tr></table>"; } xoops_cp_footer();}function modLink(){ global $xoopsDB, $_GET, $myts, $eh, $mytree, $xoopsConfig; $linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/modules/mylinks/images/shots/"); $lid = $_GET['lid']; xoops_cp_header(); echo "<h4>"._MD_WEBLINKSCONF."</h4>"; echo"<table width='100%' border='0' cellspacing='1' class='outer'>" ."<tr class=\"odd\"><td>"; $result = $xoopsDB->query("select cid, title, url, logourl from ".$xoopsDB->prefix("mylinks_links")." where lid=$lid") or $eh->show("0013"); echo "<h4>"._MD_MODLINK."</h4><br />"; list($cid, $title, $url, $logourl) = $xoopsDB->fetchRow($result); $title = $myts->makeTboxData4Edit($title); $url = $myts->makeTboxData4Edit($url); // $url = urldecode($url); $logourl = $myts->makeTboxData4Edit($logourl); // $logourl = urldecode($logourl); $result2 = $xoopsDB->query("select description from ".$xoopsDB->prefix("mylinks_text")." where lid=$lid"); list($description)=$xoopsDB->fetchRow($result2); $GLOBALS['description'] = $myts->makeTareaData4Edit($description); echo "<table>"; echo "<form method=post action=index.php>"; echo "<tr><td>"._MD_LINKID."</td><td><b>$lid</b></td></tr>"; echo "<tr><td>"._MD_SITETITLE."</td><td><input type=text name=title value=\"$title\" size=50 maxlength=100></input></td></tr>\n"; echo "<tr><td>"._MD_SITEURL."</td><td><input type=text name=url value=\"$url\" size=50 maxlength=250></input></td></tr>\n"; echo "<tr><td valign=\"top\">"._MD_DESCRIPTIONC."</td><td>"; xoopsCodeTarea("description",60,8); xoopsSmilies("description"); //echo "<textarea name=description cols=60 rows=5>$description</textarea>"; echo "</td></tr>"; echo "<tr><td>"._MD_CATEGORYC."</td><td>"; $mytree->makeMySelBox("title", "title", $cid); echo "</td></tr>\n"; echo "<tr><td>"._MD_SHOTIMAGE."</td><td>"; //echo "<input type=text name=logourl value=\"$logourl\" size=\"50\" maxlength=\"60\"></input> echo "<select size='1' name='logourl'>"; echo "<option value=' '>------</option>"; foreach($linkimg_array as $image){ if ( $image == $logourl ) { $opt_selected = "selected='selected'"; }else{ $opt_selected = ""; } echo "<option value='".$image."' $opt_selected>".$image."</option>"; } echo "</select>"; echo "</td></tr>\n"; $shotdir = "<b>".XOOPS_URL."/modules/mylinks/images/shots/</b>"; echo "<tr><td></td><td>"; printf(_MD_SHOTMUST,$shotdir); echo "</td></tr>\n"; echo "</table>"; echo "<br /><br /><input type=hidden name=lid value=$lid></input>\n"; echo "<input type=hidden name=op value=modLinkS><input type=submit value="._MD_MODIFY.">"; // echo " <input type=button value="._MD_DELETE." onclick=\"javascript:location='index.php?op=delLink&lid=".$lid."'\">"; //echo " <input type=button value="._MD_CANCEL." onclick=\"javascript:history.go(-1)\">"; echo "</form>\n"; echo "<table><tr><td>\n"; echo myTextForm("index.php?op=delLink&lid=".$lid , _MD_DELETE); echo "</td><td>\n"; echo myTextForm("index.php?op=linksConfigMenu", _MD_CANCEL); echo "</td></tr></table>\n"; echo "<hr>"; $result5=$xoopsDB->query("SELECT count(*) FROM ".$xoopsDB->prefix("mylinks_votedata")." WHERE lid = $lid"); list($totalvotes) = $xoopsDB->fetchRow($result5); echo "<table width=100%>\n"; echo "<tr><td colspan=7><b>"; printf(_MD_TOTALVOTES,$totalvotes); echo "</b><br /><br /></td></tr>\n"; // Show Registered Users Votes $result5=$xoopsDB->query("SELECT ratingid, ratinguser, rating, ratinghostname, ratingtimestamp FROM ".$xoopsDB->prefix("mylinks_votedata")." WHERE lid = $lid AND ratinguser >0 ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo "<tr><td colspan=7><br /><br /><b>"; printf(_MD_USERTOTALVOTES,$votes); echo "</b><br /><br /></td></tr>\n"; echo "<tr><td><b>" ._MD_USER." </b></td><td><b>" ._MD_IP." </b></td><td><b>" ._MD_RATING." </b></td><td><b>" ._MD_USERAVG." </b></td><td><b>" ._MD_TOTALRATE." </b></td><td><b>" ._MD_DATE." </b></td><td align=\"center\"><b>" ._MD_DELETE."</b></td></tr>\n"; if ($votes == 0){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -