不知道有没人修复过这个问题,如果有了请原谅,不过这个部分确实本人所写……
用途:修复开心农场——>牧场留言问题
方法:
第一步:修改数据库,用数据库管理工具执行以下语句- ALTER TABLE `uchome_plug_newfarm` ADD COLUMN `mc_chat` TEXT NOT NULL
复制代码 如果是root用户登陆,包含多个数据库请带上数据库名,格式如下- ALTER TABLE `youdatabaseName`.`uchome_plug_newfarm` ADD COLUMN `mc_chat` TEXT NOT NULL
复制代码 第二步修改newfarm/newmc.php
修改部分:
查找- if ( $_REQUEST['mmod'] == "chat" && $_REQUEST['mod'] == "common" && $_REQUEST['act'] == "getChat" )
复制代码 将里面如下代码全部删除- echo "{"chat":[{"fromId":"273040633","fromName":"\\u519c\\u573a\\u7ba1\\u7406\\u5458","toId":"273040633","toName":null,"time":1251184450,"msg":"\\u6B22\\u8FCE\\u5927\\u5BB6\\u6765\\u4E00\\u8D77\\u73A9\\u7267\\u573A\\uFF01\\uFF01","isReply":true}]}";
复制代码 并替换为- if ( empty( $space[name] ) )
- {
- $space[name] = $space[username];
- }
- $space[name] = unicode_encodegb( $space[name] );
- $tempecho="";
- $chat = $_SGLOBAL['db']->result( $_SGLOBAL['db']->query( "SELECT mc_chat FROM ".tname( "plug_newfarm" )." where uid=".intval( $_REQUEST['uId'] ) ), 0 );
- $chat = json_decode( $chat );
- $tempChat=$chat->c;
- foreach($tempChat as $val){
- $tempecho=json_encode($val).",".$tempecho;
- }
- $tempecho=substr($tempecho,0,-1);
- echo "{"chat":[".$tempecho."]}";
复制代码 新增部分:
在最后的?>前面加入如下代码- if ( $_REQUEST['mmod'] == "chat" && $_REQUEST['mod'] == "common" && $_REQUEST['act'] == "sendChat" )
- {
- $chat = $_SGLOBAL['db']->result( $_SGLOBAL['db']->query( "SELECT mc_chat FROM ".tname( "plug_newfarm" )." where uid=".intval( $_REQUEST['toId'] ) ), 0 );
- $chat = json_decode( $chat );
- if ( empty( $space[name] ) )
- {
- $space[name] = $space[username];
- }
- $space[name] = unicode_encodegb( $space[name] );
- $uidspace = getspace( $_REQUEST['toId'] );
- if ( empty( $uidspace[name] ) )
- {
- $uidspace[name] = $uidspace[username];
- }
- $uidspace[name] = unicode_encodegb( $uidspace[name] );
- $chat->c[] = "{"fromId":"".$_SGLOBAL['supe_uid']."","fromName":"".$space[name]."","toId":"".intval($_REQUEST['toId'])."","toName":"".$uidspace[name]."","time":".$_SGLOBAL['timestamp'].","msg":"".$_REQUEST['msg']."","isReply":".$_REQUEST['isReply']."}";
- $chat = json_encode( $chat );
- $chat = str_replace( ""{", "{", $chat );
- $chat = str_replace( "}"", "}", $chat );
- $chat = str_replace( "\\u", "\\\\u", $chat );
- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set mc_chat='".$chat."' where uid=".intval( $_REQUEST['toId'] ) );
- $tempecho="";
- $chat = $_SGLOBAL['db']->result( $_SGLOBAL['db']->query( "SELECT mc_chat FROM ".tname( "plug_newfarm" )." where uid=".intval( $_REQUEST['toId'] ) ), 0 );
- $chat = json_decode( $chat );
- $tempChat=$chat->c;
- foreach($tempChat as $val){
- $tempecho=json_encode($val).",".$tempecho;
- }
- $tempecho=substr($tempecho,0,-1);
- echo "{"chat":[".$tempecho."]}";
- exit( );
- }
复制代码 修改完毕,去试试看看是否好用,代码合用,但不是尽善尽美,希望高手发现不妥之处帮忙修改!
懒得修改的下载附件去覆盖吧,记得先备份……我也不太记得这个文件我改过些啥
附原创《【开心农场】安装后页面白屏解决方案(添加空方法无效者可看)》
各位兄弟,有钱的捧个钱场,没钱的捧个人场 |