本帖最后由 hotllus 于 2009-11-6 10:57 编辑
29# fbean
Have Problem Or Not??
- if ( $_REQUEST['mod'] == "Gift" && $_REQUEST['act'] == "getGift" )
- {
- $message = $_SGLOBAL['db']->result( $_SGLOBAL['db']->query( "SELECT message FROM ".tname( "plug_newfarm" )." where uid=".intval( $_REQUEST['ownerId'] ) ), 0 );
- $message = json_decode( $message );
- foreach ( $message->e as $key => $value )
- {
- if ( $value->status == 2 )
- {
- if ( 3000 < $value->formulaId )
- {
- $type = 3;
- }
- else if ( 2000 < $value->formulaId && $value->formulaId < 3000 )
- {
- $type = 2;
- }
- else
- {
- $type = 1;
- }
- $result[] = """.$value->id."":{"id":".$value->id.","formulaId":".$value->formulaId.","type":".$type.","friendId":"".$value->friendId."","fName":"".$value->fName."","charm":".$value->charm.","msg":"".$value->msg."","show":1,"x":".$value->x.","y":".$value->y.","z":".$value->z."}";
- }
- if ( $value->status == 1 )
- {
- if ( 3000 < $value->formulaId )
- {
- $type = 3;
- }
- else if ( 2000 < $value->formulaId && $value->formulaId < 3000 )
- {
- $type = 2;
- }
- else
- {
- $type = 1;
- }
- $result[] = """.$value->id."":{"id":".$value->id.","formulaId":".$value->formulaId.","type":".$type.","friendId":"".$value->friendId."","fName":"".$value->fName."","charm":".$value->charm.","msg":"".$value->msg."","show":1,"x":0,"y":0,"z":0}";
- }
- }
- $result = json_encode( $result );
- $result = str_replace( "["", "", $result );
- $result = str_replace( ""]", "", $result );
- $result = str_replace( ","\\"", ",\\"", $result );
- $result = str_replace( "\\u", "\\\\u", $result );
- $result = str_replace( "}"", "}", $result );
- $result = "{".$result."}";
- echo stripslashes( str_ireplace( "{null}", "[]", $result ) );
- exit( );
复制代码
- if ( $_REQUEST['mod'] == "Gift" && $_REQUEST['act'] == "deleteGift" )
- {
- $message = $_SGLOBAL['db']->result( $_SGLOBAL['db']->query( "SELECT message FROM ".tname( "plug_newfarm" )." where uid=".$_SGLOBAL['supe_uid'] ), 0 );
- $message = json_decode( $message );
- foreach ( $message->e as $key => $value )
- {
- if ( $value->id == $_REQUEST['id'] )
- {
- //unset( $message->$this->e[$key] );
- unset( $message->e[$key] );
- }
- }
- $message = json_encode( $message );
- $message = preg_replace( "'"[0-9]+":{'", "{", $message );
- $message = str_ireplace( ""e":{{", ""e":[{", $message );
- $message = str_ireplace( "}}}", "}]}", $message );
- $message = str_replace( "\\u", "\\\\u", $message );
- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set message='".$message."' where uid=".$_SGLOBAL['supe_uid'] );
- echo "{"code":1}";
- exit( );
- }
- if ( $_REQUEST['mod'] == "message" && $_REQUEST['act'] == "sendMessage" && $_REQUEST['type'] == "5" )
- {
- $nosegay = $_SGLOBAL['db']->result( $_SGLOBAL['db']->query( "SELECT nosegay FROM ".tname( "plug_newfarm" )." where uid=".$_SGLOBAL['supe_uid'] ), 0 );
- $nosegay = json_decode( $nosegay );
- if ( $nosegay->$_REQUEST['id'] < 1 )
- {
- exit( );
- }
- $nosegay->$_REQUEST['id'] = $nosegay->$_REQUEST['id'] - 1;
- $message = $_SGLOBAL['db']->result( $_SGLOBAL['db']->query( "SELECT message FROM ".tname( "plug_newfarm" )." where uid=".intval( $_REQUEST['toId'] ) ), 0 );
- $message = json_decode( $message );
- if ( empty( $space[name] ) )
- {
- $space[name] = $space[username];
- }
- $space[name] = unicode_encodegb( $space[name] );
- $duixiang = "{"id":".$_SGLOBAL['timestamp'].","formulaId":".$_REQUEST['id'].","friendId":"".$_SGLOBAL['supe_uid']."","fName":"".$space[name]."","charm":".$makenosegay[$_REQUEST['id']][charm].","validTime":0,"msg":"".$_REQUEST['msg']."","sendTime":".$_SGLOBAL['timestamp'].","status":0,"x":50,"y":150,"z":3}";
- $duixiang = json_decode( $duixiang );
- $message->e[] = $duixiang;
- $message = json_encode( $message );
- $message = str_replace( "\\u", "\\\\u", $message );
- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set message='".$message."' where uid=".intval( $_REQUEST['toId'] ) );
- $nosegay = json_encode( $nosegay );
- $_SGLOBAL['db']->query( "UPDATE ".tname( "plug_newfarm" )." set nosegay='".$nosegay."' where uid=".$_SGLOBAL['supe_uid'] );
- echo "{"code":1,"type":5,"id":".$_REQUEST['id']."}";
- include_once( S_ROOT."./source/function_cp.php" );
- $icon = "farm";
- $title_template = "{actor} 赠送给 {touser} 一个神秘的礼物。去 <a href="newfarm.php">精灵农场</a> 看看吧!";
- $touserspace = getspace( intval( $_REQUEST['toId'] ) );
- if ( empty( $touserspace[name] ) )
- {
- $touserspace[name] = $touserspace[username];
- }
- $title_data = array(
- "touser" => "<a href="space.php?uid=".intval( $_REQUEST['toId'] )."">".$touserspace[name]."</a>"
- );
- $body_general = "什么时候还能收到礼物啊,呜呜呜~~~!";
- feed_add( $icon, $title_template, $title_data, NULL, NULL, NULL );
- exit( );
- }
复制代码 |