本帖最后由 yue308 于 2010-01-18 15:31 编辑
测试通过无误,无乱码,测试地址
测试地址: http://www.yue308.cn
修改方法:
涉及到修改文件:cp.php space_blog_view.htm space_thread_view.htm 新增加 cp_relation.php cp_relation.htm
在数据里执行:- ALTER TABLE `uch_thread` ADD `oper` CHAR( 15 ) NOT NULL ,
- ADD `blogid` MEDIUMINT( 8 ) UNSIGNED NOT NULL ;
复制代码 cp.php 文件 :查找- 'userapp', 'task', 'credit', 'password', 'domain', 'event', 'topic',
复制代码 在后面添加space_blog_view.htm 文件 查找- <a href="cp.php?ac=topic&op=join&id=$blog[blogid]&idtype=blogid" id="a_topicjoin_$blog[blogid]" onclick="ajaxmenu(event, this.id)">凑热闹</a><span class="pipe">|</span>
复制代码 后面添加- <a href="cp.php?ac=relation&op=join&uid=$blog[uid]&blogid=$blog[blogid]" id="a_relationjoin_$blog[blogid]" onclick="ajaxmenu(event, this.id)">关联群组</a><span class="pipe">|</span>
复制代码 space_thread_view.htm 文件
查找- <div id="click_div">
- <!--{template space_click}-->
- </div>
复制代码 在其上添加- <!--{if !empty($thread[blogid])}-->
- <div style="width:400px;padding-top:10px; margin:0 auto;">
- <P align="center"><B>该话题由<span style="color: red;">
- <!--{$thread[oper]}--></span> 从 <span style="color: red;">
- <!--{if $thread[oper]!=$thread[username]}-->
- <!--{$thread[username]}-->
- <!--{else}-->
- <!--{eval echo "自己的";}-->
- <!--{/if}-->
- </span> 日志里关联过来</B></P>
- </div>
- <!--{/if}-->
复制代码 cp_relation.php 文件内容- <?php
- /*
- [UCenter Home] (C) 2007-2008 Comsenz Inc.
- $Id: cp_topic.php 12436 2009-06-25 09:07:38Z liguode $
- */
- if(!defined('IN_UCHOME')) {
- exit('Access Denied');
- }
- //检查信息
- $tagid= empty($_POST['tagid'])?0:intval($_POST['tagid']);
- $blogid = empty($_GET['blogid'])?0:intval($_GET['blogid']);
- $op = empty($_GET['op'])?'':$_GET['op'];
- $uid=empty($_GET['uid'])?0:intval($_GET['uid']);
- if($_GET['op'] != 'join' || $_SGLOBAL['supe_uid'] != $uid && !checkperm('managename') && $_SGLOBAL[member][groupid] != 2) //增加信息管理员有关联权限
- {
- ckspacelog();
- showmessage('no_privilege');
- }
- $relation=array();
- if($blogid) {
- $query = $_SGLOBAL['db']->query("SELECT bf.*, b.* FROM ".tname('blog')." b LEFT JOIN ".tname('blogfield')." bf ON bf.blogid=b.blogid WHERE b.blogid='$blogid'");
- $relation = $_SGLOBAL['db']->fetch_array($query);
-
- }
- if($_SGLOBAL['supe_uid'] != $relation['uid'] && !checkperm('managename') && $_SGLOBAL[member][groupid] != 2) //增加信息管理员有关联权限
-
- { showmessage('no_privilege'); }
- else{
- //添加日志到群组--关联群组
- $mtags = array();
- if(!$eventid || $event['uid']==$_SGLOBAL['supe_uid']) {
- $query = $_SGLOBAL['db']->query("SELECT mtag.* FROM ".tname("tagspace")." st LEFT JOIN ".tname("mtag")." mtag ON st.tagid=mtag.tagid WHERE st.uid='$_SGLOBAL[supe_uid]' ");
- while($value=$_SGLOBAL['db']->fetch_array($query)) {
- $mtags[] = $value;
- }
- }
- //添加日志到群组--关联群组
- }
- if(submitcheck('joinsubmit')){
- if ($tagid) {
-
- $ckblogid=array();
- $query = $_SGLOBAL['db']->query("SELECT blogid FROM ".tname('thread')." WHERE blogid='$blogid'");
- $ckblogid = $_SGLOBAL['db']->fetch_array($query);
- if (empty($ckblogid)) {
- $tsetarr = array(
- 'tagid' => $tagid,
- 'uid' => $relation['uid'],
- 'username' => $relation['username'],
- 'dateline' => $_SGLOBAL['timestamp'],
- 'subject' => $relation['subject'],
- 'lastpost' => $_SGLOBAL['timestamp'],
- 'lastauthor' => $relation['username'],
- 'lastauthorid' => $relation['uid'],
- 'blogid' => $blogid,
- 'oper' => $_SGLOBAL['supe_username'],
- 'topicid' => $relation['topicid']
- );
-
- $tid = inserttable('thread', $tsetarr, 1);
-
- $psetarr = array(
- 'tagid' => $tagid,
- 'tid' => $tid,
- 'uid' => $relation['uid'],
- 'username' => $relation['username'],
- 'ip' => getonlineip(),
- 'dateline' => $_SGLOBAL['timestamp'],
- 'message' => $relation['message'],
- 'isthread' => 1
- );
- //添加
- inserttable('post', $psetarr);
-
- //更新群组统计
- $_SGLOBAL['db']->query("UPDATE ".tname("mtag")." SET threadnum=threadnum+1 WHERE tagid='$tagid'");
-
- //统计
- updatestat('thread');
-
- //更新用户统计
- if(empty($space['threadnum'])) {
- $space['threadnum'] = getcount('thread', array('uid'=>$space['uid']));
- $threadnumsql = "threadnum=".$space['threadnum'];
- } else {
- $threadnumsql = 'threadnum=threadnum+1';
- }
- //积分
- $reward = getreward('publishthread', 0);
- $_SGLOBAL['db']->query("UPDATE ".tname('space')." SET {$threadnumsql}, lastpost='$_SGLOBAL[timestamp]', updatetime='$_SGLOBAL[timestamp]', credit=credit+$reward[credit], experience=experience+$reward[experience] WHERE uid='$relation[uid]'");
- showmessage('do_success', $_POST['refer'], 0);
-
- }
- else { showmessage('该日志已经关联组啦,请勿重复提交关联!'); }
-
- }
- else
- { showmessage('您没有选择群组'); }
- }
- include_once template("cp_relation");
- ?>
复制代码 cp_relation.htm 文件内容- <!--{template header}-->
- <!--{if $_GET['op'] == 'join'}-->
-
- <h1>添加到群组</h1>
- <a href="javascript:hideMenu();" class="float_del" title="关闭">关闭</a>
- <div class="popupmenu_inner" id="__relationjoinform">
- <form id="relationjoinform" name="relationjoinform" method="post" action="cp.php?ac=relation&op=join&uid=$_GET[uid]&blogid=$_GET[blogid]">
- <p>
- 选择个群组:<br>
- <select name="tagid">
- <option value="">选择群组</option>
- <!--{loop $mtags $value}-->
- <option value="$value[tagid]" <!--{if $value[tagid]==$event[tagid]}-->selected<!--{/if}--> >$value[tagname]</option>
- <!--{/loop}-->
- </select>
- </p>
- <p class="btn_line">
- <input type="hidden" name="refer" value="$_SGLOBAL[refer]" />
- <input type="submit" name="joinsubmit" value="确定" class="submit" />
- </p>
- <input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
- </form>
- </div>
- <!--{/if}-->
- <!--{template footer}-->
复制代码 上传文件就OK了
注意新增的两个文件路径是:source/cp_relation.php template/default/cp_relation.htm
原作者帖子:http://www.gyuan.cc/space.php?uid=1&do=thread&id=29 |