================================================================
插件:仿官方各版广告/后台控制 FOR 2.5
作者:SexuMAN/魔焰小男人
特点:结合魔焰小男人以前的仿4.0广告控制ad_setting.php另页控制
真正写入了后台。和操作编辑联盟论坛差不多...简单的死去活来。
演示..见...官方论坛
修正了一些笔误
技术支持: QQ:179803661, 论坛PM也行.. ...因为免费空间被删帐号了。个人论坛是上不了了。望大家见量
安装过有错误的人 来这检查...
================================================================
鉴于有些同志安装了我的仿4.0广告后台控制出误差之后
经过慎重考虑.我把自己代码全部拿出来。
有安装出错的朋友..可以借鉴一下。.
本来是为了方便大家.但是也带来不少麻烦.很是愧疚.
================================================================
请大家对照.我公布的代码.
第一..检查common.php代码 .如下
- <?php
- /*
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: [DISCUZ!] Crossday Discuz! Board ::
- :: (c) 2001-2005 Comsenz Technology Ltd (www.discuz.com) ::
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: Author: Crossday (tech@discuz.com) Cnteacher (cnteacher@discuz.com) ::
- :: Version: 2.5F 2004/10/01 05:15 ::
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- */
- error_reporting(E_ERROR | E_WARNING | E_PARSE);
- set_magic_quotes_runtime(0);
- define('IN_DISCUZ', TRUE);
- define('DISCUZ_ROOT', substr(dirname(__FILE__), 0, -7));
- $mtime = explode(' ', microtime());
- $discuz_starttime = $mtime[1] + $mtime[0];
- $magic_quotes_gpc = get_magic_quotes_gpc();
- $register_globals = @ini_get('register_globals');
- if ( @phpversion() < '4.1.0'){
- $_COOKIE =& $HTTP_COOKIE_VARS;
- $_SERVER =& $HTTP_SERVER_VARS;
- $_FILES =& $HTTP_POST_FILES;
- $_GET =& $HTTP_GET_VARS;
- $_POST =& $HTTP_POST_VARS;
- }
- if(!$register_globals || !$magic_quotes_gpc) {
- @extract(daddslashes($_POST), EXTR_OVERWRITE);
- @extract(daddslashes($_GET ), EXTR_OVERWRITE);
- if(!$magic_quotes_gpc) {
- $_SERVER = daddslashes($_SERVER);
- $_COOKIE = daddslashes($_COOKIE);
- }
- if(!$register_globals && is_array($_FILES) && count($_FILES)) {
- foreach(daddslashes($_FILES) as $key => $val) {
- $$key = $val['tmp_name'];
- ${$key.'_name'} = $val['name'];
- ${$key.'_size'} = $val['size'];
- ${$key.'_type'} = $val['type'];
- }
- }
- }
- require DISCUZ_ROOT.'./config.php';
- require DISCUZ_ROOT.'./include/global.php';
- require DISCUZ_ROOT.'./include/db_'.$database.'.php';
- $timestamp = time();
- $PHP_SELF = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
- $boardurl = 'http://'.$_SERVER['HTTP_HOST'].substr($PHP_SELF, 0, strrpos($PHP_SELF, '/') + 1);
- $discuz_root = DISCUZ_ROOT;
- $url_redirect = '';
- if(getenv('HTTP_CLIENT_IP')) {
- $onlineip = getenv('HTTP_CLIENT_IP');
- } elseif(getenv('HTTP_X_FORWARDED_FOR')) {
- list($onlineip) = explode(',', getenv('HTTP_X_FORWARDED_FOR'));
- } elseif(getenv('REMOTE_ADDR')) {
- $onlineip = getenv('REMOTE_ADDR');
- } else {
- $onlineip = $_SERVER['REMOTE_ADDR'];
- }
- $_DSESSION = $_DCACHE = array();
- $cachelost = (@include DISCUZ_ROOT.'./forumdata/cache/cache_settings.php') ? '' : 'settings';
- @extract($_DCACHE['settings'], EXTR_OVERWRITE);
- $tables = array('access', 'admingroups', 'adminsessions', 'attachments', 'attachtypes', 'announcements', 'banned', 'bbcodes', 'caches','failedlogins', 'favorites','forumlinks', 'forums', 'karmalog', 'members', 'onlinelist', 'polls', 'posts', 'ranks', 'searchindex', 'sessions', 'settings','smilies', 'stats', 'styles', 'stylevars', 'subscriptions', 'templates', 'threads', 'pms', 'usergroups', 'words', 'buddys','plugins','plugins_settings');
- if (count($plugins_table)) $tables = array_merge($plugins_table,$tables);
- foreach($tables as $tablename) {
- ${'table_'.$tablename} = $tablepre.$tablename;
- }
- unset($tablename, $plugins_table);
- if(defined('CURRSCRIPT') && in_array(CURRSCRIPT, array('index', 'forumdisplay', 'viewthread', 'post', 'pm'))) {
- $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/cache_'.CURRSCRIPT.'.php') ? '' : ' '.CURRSCRIPT;
- }
- $db = new dbstuff;
- $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
- $db->select_db($dbname);
- unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
- $sid = isset($_GET['sid']) ? $_GET['sid'] :(isset($_POST['sid']) ? $_POST['sid'] :$_COOKIE['sid']);
- $discuz_uid = $_COOKIE['_discuz_uid'];
- $discuz_pw = $_COOKIE['_discuz_pw'];
- $discuz_secques = $_COOKIE['_discuz_secques'];
- $newpm = $newpmexists = $sessionexists = $adminid = $adminglobal = $user_lastactivity = $is_sessionuser = 0;
- $userinfo="m.uid AS discuz_uid, m.username AS discuz_user, m.password AS discuz_pw, m.adminid, m.groupid, m.logintime, m.periodoftime, m.email, m.timeoffset, m.tpp, m.ppp, m.credit, m.prestige, m.timeformat, m.dateformat, m.signature, m.invisible, m.readpope, m.sinew, m.prestige, m.lastvisit, m.lastactivity as user_lastactivity, m.lastpost, m.newpm, m.accessmasks, m.regdate, m.money AS usermoney, m.bank AS userbank, m.bankstatus AS bankstatus";
- if($sid) {
- if($discuz_uid) {
- $query = $db->query("SELECT s.sid, s.styleid, s.groupid='6' AS ipbanned, $userinfo FROM $table_sessions s, $table_members m WHERE m.uid=s.uid AND s.sid='$sid' AND CONCAT_WS('.',s.ip1,s.ip2,s.ip3,s.ip4)='$onlineip' AND m.uid='$discuz_uid' AND m.password='$discuz_pw' AND m.secques='$discuz_secques'");
- } else {
- $query = $db->query("SELECT sid, uid AS sessionuid, groupid, groupid='6' AS ipbanned, styleid FROM $table_sessions WHERE sid='$sid' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='$onlineip'");
- }
- if($_DSESSION = $db->fetch_array($query)) {
- $sessionexists = 1;
- if(!empty($_DSESSION['sessionuid'])) {
- $query = $db->query("SELECT $userinfo FROM $table_members m WHERE uid='$_DSESSION[sessionuid]'");
- $_DSESSION = array_merge($_DSESSION, $db->fetch_array($query));
- $is_sessionuser = 1;
- }
- } else {
- $query = $db->query("SELECT sid, groupid, groupid='6' AS ipbanned, styleid FROM $table_sessions WHERE sid='$sid' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='$onlineip'");
- if($_DSESSION = $db->fetch_array($query)) {
- clearcookies();
- $sessionexists = 1;
- }
- }
- }
- if(!$sessionexists) {
- if($discuz_uid) {
- $query = $db->query("SELECT $userinfo ,m.styleid FROM $table_members m WHERE uid='$discuz_uid' AND password='$discuz_pw' AND secques='$discuz_secques'");
- if(!($_DSESSION = $db->fetch_array($query))) {
- clearcookies();
- }
- }
- if(ipbanned($onlineip)) {
- $_DSESSION['ipbanned'] = 1;
- }
- $sid = random(6);
- }
- @extract($_DSESSION, EXTR_OVERWRITE);
- $lastvisit = empty($lastvisit) ? $timestamp - 86400 : $lastvisit;
- if(empty($discuz_uid) || empty($discuz_user)) {
- $discuz_user = '';
- $discuz_uid = $adminid = $credit = $readpope = $sinew = $prestige =0;
- $groupid = $groupid != 6 ? 7 : 6;
- } else {
- $discuz_userss = $discuz_user;
- $discuz_user = addslashes($discuz_user);
- $credit = intval($credit);
- }
- define('FORMHASH', formhash());
- if($statstatus) {
- require DISCUZ_ROOT.'./include/counter.php';
- }
- if($sid != $_COOKIE['sid']) {
- setcookie('sid', $sid, $timestamp + 2592000, $cookiepath, $cookiedomain);
- }
- $tpp = empty($_DSESSION['tpp']) ? $topicperpage : $_DSESSION['tpp'];
- $ppp = empty($_DSESSION['ppp']) ? $postperpage : $_DSESSION['ppp'];
- if($discuz_uid && $accessmasks) {
- $accessadd1 = ', a.allowview, a.allowpost, a.allowreply, a.allowgetattach';
- $accessadd2 = "LEFT JOIN $table_access a ON a.uid='$discuz_uid' AND a.fid=f.fid";
- } else {
- $accessadd1 = $accessadd2 = '';
- }
- if(!empty($tid)){
- $query = $db->query("SELECT f.* $accessadd1 , t.* FROM $table_forums f, $table_threads t $accessadd2 WHERE t.tid='".intval($tid)."' AND f.fid=t.fid LIMIT 1");
- $forum = $db->fetch_array($query);
- $fid = $forum['fid'];
- }elseif(!empty($fid)) {
- $query = $db->query("SELECT f.* $accessadd1 FROM $table_forums f $accessadd2 WHERE f.fid='".intval($fid)."'", 'CACHE');
- $forum = $db->fetch_array($query);
- }
- $styleid = !empty($_GET['styleid']) ? $_GET['styleid'] :
- (!empty($_POST['styleid']) ? $_POST['styleid'] :
- (!empty($_DSESSION['styleid']) ? $_DSESSION['styleid'] :
- $_DCACHE['settings']['styleid']));
- if(@!include DISCUZ_ROOT.'./forumdata/cache/style_'.intval(!empty($forum['styleid']) ? $forum['styleid'] : $styleid).'.php') {
- $styleid = $_DCACHE['settings']['styleid'];
- $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/style_'.$styleid.'.php') ? '' : ' style_'.$styleid;
- }
- $groupid = $ipbanned ? 6 : (empty($groupid) ? 7 : $groupid);
- $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/usergroup_'.$groupid.'.php') ? '' : ' usergroup_'.$groupid;
- //adminidcheck
- if($adminid >0 && $adminid != $groupid) {
- $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/admingroup_'.$adminid.'.php') ? '' : ' admingroup_'.$groupid;
- } elseif($adminid<1) {
- $alloweditpost = $alloweditpoll = $allowdelpost = $allowmassprune = $allowcensorword = $allowviewip = $allowbanip = $allowedituser = $allowbanuser = $allowpostannounce = $allowviewlog = $disablepostctrl = 0;
- if(!$errorreport) error_reporting(0);
- }
- $isadmin = ($adminid == 1)? 1 : 0;
- if($cachelost) {
- require DISCUZ_ROOT.'./include/cache.php';
- updatecache();
- dexit('Cache List: '.$cachelost.'<br>Caches successfully created, please refresh.');
- }
- if($nocacheheaders) {
- @header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
- @header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
- @header('Cache-Control: no-store, no-cache, must-revalidate');
- @header('Cache-Control: post-check=0, pre-check=0', false);
- @header('Pragma: no-cache');
- }
- if($headercharset) {
- @header('Content-Type: text/html; charset='.CHARSET);
- }
- $gzipcompress ? ob_start('ob_gzhandler') : ob_start();
- if(isset($allowvisit) && $allowvisit == 0) {
- setcookie('_discuz_uid', $discuz_uid, $timestamp + 86400 * 365, $cookiepath, $cookiedomain);
- setcookie('_discuz_pw', $discuz_pw, $timestamp + 86400 * 365, $cookiepath, $cookiedomain);
- setcookie('_discuz_secques', $discuz_secques, $timestamp + 86400 * 365, $cookiepath, $cookiedomain);
- showmessage('user_banned', NULL, 'HALTED');
- } elseif($bbclosed && !((defined('CURRSCRIPT') && CURRSCRIPT == 'logging' && $action == 'login') || $adminid == 1)) {
- clearcookies();
- showmessage($closedreason ? $closedreason : 'board_closed');
- }
- function daddslashes(&$string, $force = 0) {
- if(!$GLOBALS['magic_quotes_gpc'] || $force) {
- if(is_array($string) && count($string)) {
- foreach($string as $key => $val) {
- $string[$key] = daddslashes($val, $force);
- }
- }elseif($string) {
- $string = addslashes($string);
- }else{
- $string = False;
- }
- }
- return $string;
- }
- //广告后台完美控制正式版FOR 2.5 by LEAGUE
- function ad_show() {
- global $db;
- $ad_count_rs = $db->query("SELECT COUNT(*) FROM cdb_forumadvs");
- $ad_count = $db->result($ad_count_rs,0);
- $ad_text_rs = $db->query("SELECT * FROM cdb_forumadvs");
- $text .= '<br><table cellspacing="1" cellpadding="' . TABLESPACE . '" width="' . TABLEWIDTH . '" align="center" class="tableborder">';
- if($ad_count == 0) {
- return '';
- } else if($ad_count == 1) {
- $ad_text = $db->fetch_array($ad_text_rs);
- $text .= '<tr align="center" class="altbg2">';
- $text .= '<td width="100%" height="24"> <a href="' . $ad_text['url'] . '" title="' . $ad_text['note'] . '" target="_blank">' . $ad_text['name'] . '</a></td>';
- $text .= '</tr>';
- } else if($ad_count == 2) {
- $text .= '<tr align="center" class="altbg2">';
- while($ad_text = $db->fetch_array($ad_text_rs)) {
- $text .= '<td width="50%" height="24"> <a href="' . $ad_text['url'] . '" title="' . $ad_text['note'] . '" target="_blank">' . $ad_text['name'] . '</a></td>';
- }
- $text .= '</tr>';
- } else if($ad_count == 3) {
- $text .= '<tr align="center" class="altbg2">';
- while($ad_text = $db->fetch_array($ad_text_rs)) {
- if($num == 3) {
- $text .= '<td width="34%" height="24"> <a href="' . $ad_text['url'] . '" title="' . $ad_text['note'] . '" target="_blank">' . $ad_text['name'] . '</a></td>';
- } else {
- $text .= '<td width="33%" height="24"> <a href="' . $ad_text['url'] . '" title="' . $ad_text['note'] . '" target="_blank">' . $ad_text['name'] . '</a></td>';
- }
- $num++;
- }
- $text .= '</tr>';
- } else if($ad_count == 4) {
- $text .= '<tr align="center" class="altbg2">';
- while($ad_text = $db->fetch_array($ad_text_rs)) {
- $text .= '<td width="25%" height="24"> <a href="' . $ad_text['url'] . '" title="' . $ad_text['note'] . '" target="_blank">' . $ad_text['name'] . '</a></td>';
- }
- $text .= '</tr>';
- } else if($ad_count > 4) {
- if(($ad_count % 4) == 0) {
- $hrnum = floor($ad_count / 4);
- } else {
- $hrnum = floor($ad_count / 4);
- $hrnum += 1;
- }
- while($ad_text = $db->fetch_array($ad_text_rs)) {
- if($num == 0) {
- $text .= '<tr align="center" class="altbg2">';
- $text .= '<td width="25%" height="24"> <a href="' . $ad_text['url'] . '" title="' . $ad_text['note'] . '" target="_blank">' . $ad_text['name'] . '</a></td>';
- $num++;
- } else if($num == 3) {
- $text .= '<td width="25%" height="24"> <a href="' . $ad_text['url'] . '" title="' . $ad_text['note'] . '" target="_blank">' . $ad_text['name'] . '</a></td>';
- $text .= '</tr>';
- $num = 0;
- } else {
- $text .= '<td width="25%" height="24"> <a href="' . $ad_text['url'] . '" title="' . $ad_text['note'] . '" target="_blank">' . $ad_text['name'] . '</a></td>';
- $num++;
- }
- }
- }
- if(substr($text,strlen($text) - 5,5) == '</tr>') {
- $text .= '</table>';
- } else {
- $text .= '</tr></table>';
- }
- return $text;
- }
- $ad = ad_show();
- //END
- //今日到访 by cnteacher 分时段详细列表 by DyNE
- list($thisyear,$thismonth,$thisday,$thishour) = explode(':',gmdate('Y:m:d:H',$timestamp + $timeoffset * 3600));
- $todaylogincheck =gmmktime(0,0,0,$thismonth,$thisday,$thisyear) - $timeoffset * 3600;
- if ($discuz_user) {
- $lasthour = gmdate('H',$logintime + $timeoffset * 3600);
- if ($logintime < $todaylogincheck) {
- $periodoftime = 1 << $thishour;
- $db->unbuffered_query("UPDATE $table_members SET logintime='".$timestamp."', periodoftime ='".$periodoftime."' WHERE username='$discuz_user'");
- } elseif ($thishour > $lasthour) {
- $periodoftime = $periodoftime | (1 << $thishour);
- $db->unbuffered_query("UPDATE $table_members SET logintime='".$timestamp."', periodoftime ='".$periodoftime."' WHERE username='$discuz_user'");
- }
- }
- //End
- //在线时间插件 by ninelife
- require DISCUZ_ROOT.'./plugins/onlinetimeupdate.php';
- //
- ?>
复制代码
第二.检查目录admin/misc.php文件...代码如下:
- <?php
- /*
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: [DISCUZ!] Crossday Discuz! Board ::
- :: (c) 2001-2005 Comsenz Technology Ltd (www.discuz.com) ::
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- :: Author: Crossday (tech@discuz.com) Cnteacher (cnteacher@discuz.com) ::
- :: Version: 2.5F 2004/10/01 05:15 ::
- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
- */
- if(!defined('IN_ADMINCP')) {
- exit('Access Denied');
- }
- cpheader();
- if($action == 'onlinelist') {
- if(!submitcheck('onlinesubmit')) {
- $listarray = array();
- $query = $db->query("SELECT * FROM $table_onlinelist");
- while($list = $db->fetch_array($query)) {
- $listarray[$list['groupid']] = $list;
- }
- $onlinelist = '';
- $query = $db->query("SELECT groupid, grouptitle FROM $table_usergroups WHERE groupid<>'7' AND type<>'member'");
- $group = array('groupid' => 0, 'grouptitle' => 'Member');
- do {
- $onlinelist .= "<tr align="center">\n".
- "<td bgcolor="".ALTBG1.""><input type="text" size="3" name="displayordernew[$group[groupid]]" value="{$listarray[$group[groupid]][displayorder]}"></td>\n".
- "<td bgcolor="".ALTBG2.""><input type="text" size="15" name="titlenew[$group[groupid]]" value="".($listarray[$group['groupid']]['title'] ? $listarray[$group['groupid']]['title'] : $group['grouptitle']).""></td>\n".
- "<td bgcolor="".ALTBG1.""><input type="text" size="20" name="urlnew[$group[groupid]]" value="{$listarray[$group[groupid]][url]}"></td></tr>\n";
- } while($group = $db->fetch_array($query));
- include CP_TPL.'misc_online.php';
- } else {
- if(is_array($urlnew)) {
- $db->query("DELETE FROM $table_onlinelist");
- foreach($urlnew as $id => $url) {
- $url = trim($url);
- if($id == 0 || $url) {
- $db->query("INSERT INTO $table_onlinelist (groupid, displayorder, title, url)
- VALUES ('$id', '$displayordernew[$id]', '$titlenew[$id]', '$url')");
- }
- }
- }
- updatecache('onlinelist');
- cpmsg('onlinelist_succeed', 'admincp.php?action=onlinelist');
- }
- } elseif($action == 'forumlinks') {
- if(!submitcheck('forumlinksubmit')) {
- $forumlinks = '';
- $query = $db->query("SELECT * FROM $table_forumlinks ORDER BY displayorder");
- while($forumlink = $db->fetch_array($query)) {
- $forumlinks .= "<tr bgcolor="".ALTBG2."" align="center">\n".
- "<td bgcolor="".ALTBG1.""><input type="checkbox" name="delete[]" value="$forumlink[id]"></td>\n".
- "<td bgcolor="".ALTBG2.""><input type="text" size="3" name="displayorder[$forumlink[id]]" value="$forumlink[displayorder]"></td>\n".
- "<td bgcolor="".ALTBG1.""><input type="text" size="15" name="name[$forumlink[id]]" value="$forumlink[name]"></td>\n".
- "<td bgcolor="".ALTBG2.""><input type="text" size="15" name="url[$forumlink[id]]" value="$forumlink[url]"></td>\n".
- "<td bgcolor="".ALTBG1.""><input type="text" size="15" name="note[$forumlink[id]]" value="$forumlink[note]"></td>\n".
- "<td bgcolor="".ALTBG2.""><input type="text" size="15" name="logo[$forumlink[id]]" value="$forumlink[logo]"></td></tr>\n";
- }
- include CP_TPL.'misc_forumlink.php';
- } else {
- if($ids = implode_ids( $delete )) {
- $db->query("DELETE FROM $table_forumlinks WHERE id IN ($ids)");
- }
- if(is_array($name)) {
- foreach($name as $id => $val) {
- $db->query("UPDATE $table_forumlinks SET displayorder='$displayorder[$id]', name='$name[$id]', url='$url[$id]', note='$note[$id]', logo='$logo[$id]' WHERE id='$id'");
- }
- }
- if($newname != '') {
- $db->query("INSERT INTO $table_forumlinks (displayorder, name, url, note, logo) VALUES ('$newdisplayorder', '$newname', '$newurl', '$newnote', '$newlogo')");
- }
- updatecache('forumlinks');
- cpmsg('forumlinks_succeed', 'admincp.php?action=forumlinks');
- }
- } elseif($action == 'forumadvs') {
- if(!submitcheck('forumadvsubmit')) {
- $forumadvs = '';
- $query = $db->query("SELECT * FROM cdb_forumadvs ORDER BY displayorder");
- while($forumadv = $db->fetch_array($query)) {
- $forumadvs .= "<tr bgcolor="".ALTBG2."" align="center">\n".
- "<td bgcolor="".ALTBG1.""><input type="checkbox" name="delete[]" value="$forumadv[id]"></td>\n".
- "<td bgcolor="".ALTBG2.""><input type="text" size="3" name="displayorder[$forumadv[id]]" value="$forumadv[displayorder]"></td>\n".
- "<td bgcolor="".ALTBG1.""><input type="text" size="15" name="name[$forumadv[id]]" value="$forumadv[name]"></td>\n".
- "<td bgcolor="".ALTBG2.""><input type="text" size="15" name="url[$forumadv[id]]" value="$forumadv[url]"></td>\n".
- "<td bgcolor="".ALTBG1.""><input type="text" size="15" name="note[$forumadv[id]]" value="$forumadv[note]"></td></tr>\n";
- }
- include CP_TPL.'misc_forumadv.php';
- } else {
- if($ids = implode_ids( $delete )) {
- $db->query("DELETE FROM cdb_forumadvs WHERE id IN ($ids)");
- }
- if(is_array($name)) {
- foreach($name as $id => $val) {
- $db->query("UPDATE cdb_forumadvs SET displayorder='$displayorder[$id]', name='$name[$id]', url='$url[$id]', note='$note[$id]' WHERE id='$id'");
- }
- }
- if($newname != '') {
- $db->query("INSERT INTO cdb_forumadvs (displayorder, name, url, note) VALUES ('$newdisplayorder', '$newname', '$newurl', '$newnote')");
- }
- updatecache('forumadvs');
- cpmsg('forumadvs_succeed', 'admincp.php?action=forumadvs');
- }
- } elseif($action == 'discuzcodes') {
- if(!submitcheck('bbcodessubmit') && !$edit) {
- $discuzcodes = '';
- $query = $db->query("SELECT * FROM $table_bbcodes");
- while($bbcode = $db->fetch_array($query)) {
- $discuzcodes .= "<tr bgcolor="".ALTBG2."" align="center">\n".
- "<td bgcolor="".ALTBG1.""><input type="checkbox" name="delete[]" value="$bbcode[id]"></td>\n".
- "<td bgcolor="".ALTBG2.""><input type="text" size="15" name="tagnew[$bbcode[id]]" value="$bbcode[tag]"></td>\n".
- "<td bgcolor="".ALTBG1.""><input type="checkbox" name="availablenew[$bbcode[id]]" value="1" ".($bbcode['available'] ? 'checked' : NULL)."></td>\n".
- "<td bgcolor="".ALTBG2.""><a href="admincp.php?action=discuzcodes&edit=$bbcode[id]">[$lang[detail]]</a></td></tr>\n";
- }
- include CP_TPL.'misc_bbcode.php';
- } elseif(submitcheck('bbcodessubmit')) {
- if(is_array($delete)) {
- $ids = '\''.implode('\',\'', $delete).'\'';
- $db->query("DELETE FROM $table_bbcodes WHERE id IN ($ids)");
- }
- if(is_array($tagnew)) {
- foreach($tagnew as $id => $val) {
- if(!preg_match("/^[0-9a-z]+$/i", $tagnew[$id])) {
- cpmsg('discuzcodes_edit_tag_invalid');
- }
- $db->query("UPDATE $table_bbcodes SET tag='$tagnew[$id]', available='$availablenew[$id]' WHERE id='$id'");
- }
- }
- if($newtag != '') {
- $db->query("INSERT INTO $table_bbcodes (tag, available, params, nest)
- VALUES ('$newtag', '0', '1', '1')");
- }
- updatecache('bbcodes');
- cpmsg('discuzcodes_edit_succeed', 'admincp.php?action=discuzcodes');
- } elseif($edit) {
- $query = $db->query("SELECT * FROM $table_bbcodes WHERE id='$edit'");
- if(!$bbcode = $db->fetch_array($query)) {
- cpmsg('undefined_action');
- }
- if(!submitcheck('editsubmit')) {
- echo "<form method="post" action="admincp.php?action=discuzcodes&edit=$edit&formhash=".FORMHASH."">\n";
- showtype($lang['discuzcodes_edit'].' - '.$bbcode['tag'], 'top');
- showsetting('discuzcodes_edit_tag', 'tagnew', $bbcode['tag'], 'text');
- showsetting('discuzcodes_edit_replacement', 'replacementnew', $bbcode['replacement'], 'textarea');
- showsetting('discuzcodes_edit_example', 'examplenew', $bbcode['example'], 'text');
- showsetting('discuzcodes_edit_explanation', 'explanationnew', $bbcode['explanation'], 'text');
- showsetting('discuzcodes_edit_params', 'paramsnew', $bbcode['params'], 'text');
- showsetting('discuzcodes_edit_nest', 'nestnew', $bbcode['nest'], 'text');
- showtype('', 'bottom');
- echo "<br><center><input type="submit" name="editsubmit" value="$lang[submit]"></center></form>";
- } else {
- $tagnew = trim($tagnew);
- if(!preg_match("/^[0-9a-z]+$/i", $tagnew)) {
- cpmsg('discuzcodes_edit_tag_invalid');
- } elseif($paramsnew < 1 || $paramsnew > 3 || $nestnew < 1 || $nestnew > 3) {
- cpmsg('discuzcodes_edit_range_invalid');
- }
- $db->query("UPDATE $table_bbcodes SET tag='$tagnew', replacement='$replacementnew', example='$examplenew', explanation='$explanationnew', params='$paramsnew', nest='$nestnew' WHERE id='$edit'");
- updatecache('bbcodes');
- cpmsg('discuzcodes_edit_succeed', 'admincp.php?action=discuzcodes');
- }
- }
- } elseif($action == 'censor') {
- if(!submitcheck('censorsubmit')) {
- $censorwords = '';
- $query = $db->query("SELECT * FROM $table_words");
- while($censor = $db->fetch_array($query)) {
- $disabled = $adminid != 1 && $censor['admin'] != $discuz_userss ? 'disabled' : NULL;
- $censorwords .= '<tr align="center"><td bgcolor="'.ALTBG1.'"><input type="checkbox" name="delete[]" value="'.$censor[id].'" '.$disabled."></td>\n".
- "<td bgcolor="".ALTBG2.""><input type="text" size="30" name="find[$censor[id]]" value="".dhtmlspecialchars($censor[find])."" $disabled></td>\n".
- "<td bgcolor="".ALTBG1.""><input type="text" size="30" name="replace[$censor[id]]" value="$censor[replacement]" $disabled></td>\n".
- "<td bgcolor="".ALTBG2."">$censor[admin]</td></tr>\n";
- }
- include CP_TPL.'misc_censor.php';
- } else {
- if($ids = implode_ids( $delete )) {
- $db->query("DELETE FROM $table_words WHERE id IN ($ids) AND ('$adminid'='1' OR admin='$discuz_user')");
- }
- if(is_array($find)) {
- foreach($find as $id => $val) {
- $db->query("UPDATE $table_words SET find='$find[$id]', replacement='$replace[$id]' WHERE id='$id' AND ('$adminid'='1' OR admin='$discuz_user')");
- }
- }
- if($newfind != '') {
- $db->query("INSERT INTO $table_words (admin, find, replacement) VALUES
- ('$discuz_user', '$newfind', '$newreplace')");
- }
- updatecache('censor');
- cpmsg('censor_succeed', 'admincp.php?action=censor');
- }
- } elseif($action == 'smilies' || $action=='icons') {
- if(!submitcheck('smiliesubmit')) {
- $sqlaction = $action == 'smilies' ? "type='smiley'" : "type='icon'";
- $smilies = $icons = '';
- $query = $db->query("SELECT * FROM $table_smilies where $sqlaction");
- while($smiley = $db->fetch_array($query)) {
- if($smiley['type'] == 'smiley') {
- $smilies .= "<tr align="center"><td bgcolor="".ALTBG1.""><input type="checkbox" name="delete[]" value="$smiley[id]"></td>\n".
- "<td bgcolor="".ALTBG2.""><input type="text" size="25" name="code[$smiley[id]]" value="$smiley[code]"></td>\n".
- "<td bgcolor="".ALTBG1.""><input type="text" size="25" name="url[$smiley[id]]" value="$smiley[url]"></td>\n".
- "<td bgcolor="".ALTBG2.""><img src="./".SMDIR."/$smiley[url]"></td></tr>\n";
- } elseif($smiley['type'] == 'icon') {
- $icons .= "<tr align="center"><td bgcolor="".ALTBG1.""><input type="checkbox" name="delete[]" value="$smiley[id]"></td>\n".
- "<td colspan="2" bgcolor="".ALTBG2.""><input type="text" size="35" name="url[$smiley[id]]" value="$smiley[url]"></td>\n".
- "<td bgcolor="".ALTBG1.""><img src="".SMDIR."/$smiley[url]"></td></tr>\n";
- }
- }
- if ($action == 'smilies'){
- include CP_TPL.'misc_smilies.php';
- } else {
- include CP_TPL.'misc_icons.php';
- }
- } else {
- if(is_array($delete)) {
- $ids = $comma = '';
- foreach($delete as $id) {
- $ids .= "$comma'$id'";
- $comma = ',';
- }
- $db->query("DELETE FROM $table_smilies WHERE id IN ($ids)");
- }
- if(is_array($url)) {
- foreach($url as $id => $val) {
- if ($action == 'smilies'){
- $db->query("UPDATE $table_smilies SET code='$code[$id]', url='$url[$id]' WHERE id='$id'");
- } else {
- $db->query("UPDATE $table_smilies SET url='$url[$id]' WHERE id='$id'");
- }
- }
- }
-
- $newcode = trim($newcode);
- $newurl1 = trim($newurl1);
- if($action =='smilies' && $newcode && $newurl1) {
- $query = $db->query("SELECT code FROM $table_smilies WHERE type='smiley' and (code='$newcode' or url='$newurl1')");
- if($db->result($query, 0)) {
- cpmsg('smilies_duplicate');
- }
- $query = $db->query("INSERT INTO $table_smilies (type, code, url)
- VALUES ('smiley', '$newcode', '$newurl1')");
- } elseif ( $action == 'icons' && $newurl1 ) {
- $query = $db->query("SELECT url FROM $table_smilies WHERE type='icon' and url='$newurl1'");
- if($db->result($query, 0)) {
- cpmsg('icons_duplicate');
- }
- $query = $db->query("INSERT INTO $table_smilies (type, code, url)
- VALUES ('icon', '', '$newurl1')");
- }
-
- if ($action == 'smilies'){
- updatecache('smilies');
- cpmsg('smilies_succeed', 'admincp.php?action=smilies');
- } else {
- updatecache('icons');
- cpmsg('icons_succeed', 'admincp.php?action=icons');
- }
- }
- } elseif($action == 'attachtypes') {
- if(!submitcheck('typesubmit')) {
- $attachtypes = '';
- $query = $db->query("SELECT * FROM $table_attachtypes");
- while($type = $db->fetch_array($query)) {
- $attachtypes .= "<tr align="center"><td bgcolor="".ALTBG1.""><input type="checkbox" name="delete[]" value="$type[id]"></td>\n".
- "<td bgcolor="".ALTBG2.""><input type="text" size="10" name="extension[$type[id]]" value="$type[extension]"></td>\n".
- "<td bgcolor="".ALTBG1.""><input type="text" size="15" name="maxsize[$type[id]]" value="$type[maxsize]"></td></tr>\n";
- }
- include CP_TPL.'misc_attachtypes.php';
- } else {
- if(is_array($delete)) {
- $ids = $comma = '';
- foreach($delete as $id) {
- $ids .= "$comma'$id'";
- $comma = ',';
- }
- $db->query("DELETE FROM $table_attachtypes WHERE id IN ($ids)");
- }
- if(is_array($extension)) {
- foreach($extension as $id => $val) {
- $db->query("UPDATE $table_attachtypes SET extension='$val', maxsize='$maxsize[$id]' WHERE id='$id'");
- }
- }
- $newextension = trim($newextension);
- if($newextension != '') {
- $query = $db->query("SELECT id FROM $table_attachtypes WHERE extension='$newextension'");
- if($db->result($query, 0)) {
- cpmsg('attachtypes_duplicate');
- }
- $db->query("INSERT INTO $table_attachtypes (extension, maxsize) VALUES
- ('$newextension', '$newmaxsize')");
- }
- cpmsg('attachtypes_succeed', 'admincp.php?action=attachtypes');
- }
- } elseif($action == 'updatecache') {
- updatecache();
- $tpl = dir(DISCUZ_ROOT.'./forumdata/templates');
- while($entry = $tpl->read()) {
- if (strpos($entry, '.tpl.php')) {
- @unlink(DISCUZ_ROOT.'./forumdata/templates/'.$entry);
- }
- }
- $tpl->close();
- $db->query("DELETE FROM $table_searchindex");
- $db->query("DELETE FROM $table_caches");
- cpmsg('update_cache_succeed');
- }elseif($action == 'logout') {
- $query = $db->query("DELETE FROM $table_adminsessions WHERE uid='$discuz_uid' OR dateline<$timestamp-3600", 'SILENT');
- cpmsg('logout_succeed');
- }
- ?>
复制代码
检查 目录admin/tpl/misc_forumadv.php 是否存在.
如果不存在的话。建立一个新的PHP文件。代码如下:
- <?php if(!defined('IN_ADMINCP')) exit('Access Denied'); ?>
- <table cellspacing="0" cellpadding="0" border="0" width="95%" align="center">
- <tr><td bgcolor="<?=BORDERCOLOR?>">
- <table border="0" cellspacing="<?=BORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="100%">
- <tr class="header"><td><?=$lang['tips']?></td></tr>
- <tr bgcolor="<?=ALTBG1?>"><td>
- <br><?=$lang['forumadvs_tips']?>
- </td></tr></table></td></tr></table>
- <br><form method="post" action="admincp.php?action=forumadvs">
- <input type="hidden" name="formhash" value="<?=FORMHASH?>">
- <table cellspacing="0" cellpadding="0" border="0" width="95%" align="center">
- <tr><td bgcolor="<?=BORDERCOLOR?>">
- <table border="0" cellspacing="<?=BORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="100%">
- <tr class="header"><td colspan="6"><?=$lang['forumadvs_edit']?></td></tr>
- <tr align="center" class="category">
- <td><input type="checkbox" name="chkall" class="category" onclick="checkall(this.form)"><?=$lang['del']?></td>
- <td><?=$lang['display_order']?></td><td><?=$lang['forumadvs_edit_name']?></td><td><?=$lang['forumadvs_edit_url']?></td><td><?=$lang['forumadvs_edit_note']?></td></tr>
- <?=$forumadvs?>
- <tr bgcolor="<?=ALTBG2?>"><td colspan="6" height="1"></td></tr>
- <tr bgcolor="<?=ALTBG1?>" align="center">
- <td><?=$lang['add_new']?></td>
- <td><input type="text" size="3" name="newdisplayorder"></td>
- <td><input type="text" size="15" name="newname"></td>
- <td><input type="text" size="15" name="newurl"></td>
- <td><input type="text" size="15" name="newnote"></td>
- </tr></table></td></tr></table><br>
- <center><input type="submit" name="forumadvsubmit" value="<?=$lang['submit']?>"></center></form></td></tr>
复制代码
接下来是检查一下 根目录下的admincp.php文件里是否添加以下代码
具体位置.应该是在
- }elseif($action == 'forumlinks' || $action == 'forumadvs' || $action == 'onlinelist' || $action == 'censor' || $action == 'discuzcodes' || $action == 'smilies' || $action == 'icons' || $action == 'attachtypes' || $action == 'updatecache' || $action == 'logout') {
- $cpscript = 'misc.php';
复制代码
请大家看好了。是否按我的步骤安装. 接下来应该是 admin/menu.php文件.
这个文件是后台框架左边的菜单显示文件。
注意看。检查以下地方。
-
- showmenu($lang['menu_misc'], array(array('name' => $lang['menu_misc_announces'], 'url' => 'admincp.php?action=announcements'),
- array('name' => $lang['menu_misc_onlinelist'], 'url' => 'admincp.php?action=onlinelist'),
- array('name' => $lang['menu_misc_links'], 'url' => 'admincp.php?action=forumlinks'),
- array('name' => $lang['menu_misc_advlist'], 'url' => 'admincp.php?action=forumadvs')));
复制代码
这是我已经改好的代码.注意检查跟你没装的时候有什么区别!!!!!
因为添加了代码。如下. ..注意前面的逗号 !!!!!!!!!!!!!,,,,,,,,,号!!!!!!!!!
- ,
- array('name' => $lang['menu_misc_advlist'], 'url' => 'admincp.php?action=forumadvs')
复制代码
至于语言控制包...修改admincp.lang.php 文件
在
- 'forumlinks_edit' => '联盟论坛编辑',
- 'forumlinks_edit_name' => '论坛名称',
- 'forumlinks_edit_url' => '论坛 URL',
- 'forumlinks_edit_note' => '文字说明',
- 'forumlinks_edit_logo' => 'logo 地址(可选)',
复制代码
下加上
- 'forumadvs_edit' => '论坛广告编辑',
- 'forumadvs_edit_name' => '广告名称',
- 'forumadvs_edit_url' => '广告 URL',
- 'forumadvs_edit_note' => '文字说明',
复制代码
找到
- 'menu_misc_links' => '联盟论坛',
复制代码
下面加
- 'menu_misc_advlist' => '论坛广告',
复制代码
找到
- 'forumlinks_succeed' => '联盟论坛成功更新。',
复制代码
在下面加上
- 'forumadvs_succeed' => '论坛广告成功更新。',
复制代码
找到
- 'forumlinks_tips' => '<ul><li>如果您不想在首页显示联盟论坛,请把已有各项删除即可。</ul><ul><li>未填写文字说明的项目将以紧凑型显示。</ul>',
复制代码
在下面添加
- 'forumadvs_tips' => '<ul><li>如果您不想显示论坛广告,请把已有各项删除即可。</ul><ul><li>填写文字说明的项目将注释广告内容。</ul>',
复制代码
CSS.HTM 弄出来也给那些安装成功 .但是没有边框的朋友
- <style type="text/css">
- a:link,a:visited { text-decoration: none; color: {LINK} }
- a:hover { text-decoration: underline }
- body { scrollbar-base-color: {ALTBG1}; scrollbar-arrow-color: {BORDERCOLOR}; font-size: {FONTSIZE}; {BGCODE} }
- table { font-family: {FONT}; color: {TABLETEXT}; font-size: {FONTSIZE} }
- textarea,input,object { font-family: {FONT}; font-size: {FONTSIZE}; color: {TABLETEXT}; font-weight: normal; background-color: {ALTBG1} }
- select { font-family: {SMFONT}; font-size: {SMFONTSIZE}; color: {TABLETEXT}; font-weight: normal; background-color: {ALTBG1} }
- .nav { font-family: {FONT}; font-size: {FONTSIZE}; font-weight: {BOLD} }
- .header { font-family: {FONT}; font-size: {FONTSIZE}; color: {HEADERTEXT}; font-weight: {BOLD}; {HEADERBGCODE} }
- .category { font-family: {SMFONT}; font-size: {FONTSIZE}; color: {CATTEXT}; {CATBGCODE} }
- .tableborder { background: #D6E0EF; border: 1px solid #698CC3 }
- .BORDERCOLOR { background: #D6E0EF;}
- .multi { font-family: {SMFONT}; font-size: {SMFONTSIZE}; color: {LINK}; }
- .smalltxt { font-family: {SMFONT}; font-size: {SMFONTSIZE} }
- .smalltxts { font: 9pt Tahoma, Verdana }
- .mediumtxt { font-family: {FONT}; font-size: {FONTSIZE}; color: {TEXT} }
- .bold { font-weight: {BOLD} }
- .altbg1 { background: {ALTBG1} }
- .altbg2 { background: {ALTBG2} }
- .menuskin {
- filter: Alpha(Opacity=80);
- BORDER: #666666 1px solid; VISIBILITY: hidden; FONT: 12px Verdana;
- POSITION: absolute;
- BACKGROUND-COLOR:#FFFFFF;
- background-repeat : repeat-y;
- }
- .menuskin A {
- PADDING-RIGHT: 9px; PADDING-LEFT: 7px; COLOR: black; TEXT-DECORATION: none; behavior:url(inc/noline.htc);
- }
- #mouseoverstyle {
- BACKGROUND-COLOR: #F2F5FB; margin:2px; padding:0px; border:#8396C3 1px solid;
- }
- #mouseoverstyle A {
- COLOR: black
- }
- .menuitems{
- margin:2px;padding:1px;word-break:keep-all;
- }
- </style>
复制代码
最后升级数据库,输入:
- CREATE TABLE `cdb_forumadvs` (
- `id` smallint(6) unsigned NOT NULL auto_increment,
- `displayorder` tinyint(3) NOT NULL default '0',
- `name` varchar(255) NOT NULL default '',
- `url` varchar(255) NOT NULL default '',
- `note` varchar(255) NOT NULL default '',
- PRIMARY KEY (`id`)
- ) TYPE=MyISAM AUTO_INCREMENT=7 ;
复制代码
修改模板文件index.htm,以便广告能在首页显示。
找:
-
- <!--{if !empty($newpmexists)}-->
- {template pmprompt}
- <!--{/if}-->
-
复制代码
在上面加上:
修改模板文件forumdisplay.htm,以便广告能在浏览板块时显示。
找:
-
- <!--{if !empty($newpmexists)}-->
- {template pmprompt}
- <!--{/if}-->
复制代码
在上面加上:
修改模板文件viewthread.htm,以便广告能在浏览帖子时显示。
找:
-
- <!--{if $newpmexists}-->
- {template pmprompt}
- <!--{/if}-->
-
复制代码
在上面加上:
反安装数据库代码
- DROP TABLE IF EXISTS `cdb_forumadvs`;
复制代码
[ 本帖最后由 Magic.factory 于 2005-11-22 10:54 编辑 ] |