xmlout.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 1,314 行 · 第 1/3 页
PHP
1,314 行
<?php/*+--------------------------------------------------------------------------| Invision Power Board v2.1.3| =============================================| by Matthew Mecham| (c) 2001 - 2005 Invision Power Services, Inc.| | =============================================| Web: | Time: Thu, 03 Nov 2005 15:03:42 GMT| Release: d8ad5efdfd3ea4b4a4da55e068b15429| Licence Info: +---------------------------------------------------------------------------| > $Date: 2006-01-11 22:47:48 +0000 (Wed, 11 Jan 2006) $| > $Revision: 122 $| > $Author: bfarber $+---------------------------------------------------------------------------|| > XML OUT Functions for XmlHttpRequest functions| > Module written by Matt Mecham| > Date started: Friday 18th March 2005|| > Module Version Number: 1.1.0+--------------------------------------------------------------------------*/if ( ! defined( 'IN_IPB' ) ){ print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files."; exit();}class xmlout{ # Classes var $ipsclass; var $search; var $xml_output; var $xml_header; var $post_init = 0; /** * Post object * * @var object */ var $post; var $decode_charsets = array( 'iso-8859-1' => 'ISO-8859-1', 'iso8859-1' => 'ISO-8859-1', 'iso-8859-15' => 'ISO-8859-15', 'iso8859-15' => 'ISO-8859-15', 'utf-8' => 'UTF-8', 'cp866' => 'cp866', 'ibm866' => 'cp866', 'cp1251' => 'windows-1251', 'windows-1251' => 'windows-1251', 'win-1251' => 'windows-1251', 'cp1252' => 'windows-1252', 'windows-1252' => 'windows-1252', 'koi8-r' => 'KOI8-R', 'koi8-ru' => 'KOI8-R', 'koi8r' => 'KOI8-R', 'big5' => 'BIG5', 'gb2312' => 'GB2312', 'big5-hkscs' => 'BIG5-HKSCS', 'shift_jis' => 'Shift_JIS', 'sjis' => 'Shift_JIS', 'euc-jp' => 'EUC-JP', 'eucjp' => 'EUC-JP' ); /*-------------------------------------------------------------------------*/ // Constructor /*-------------------------------------------------------------------------*/ function xmlout() { $this->xml_header = "<?xml version=\"1.0\" encoding=\"{$this->ipsclass->vars['gb_char_set']}\"?".'>'; } /*-------------------------------------------------------------------------*/ // Auto run /*-------------------------------------------------------------------------*/ function auto_run() { //----------------------------------------- // INIT //----------------------------------------- if ( $this->ipsclass->input['j_do'] ) { $this->ipsclass->input['do'] = $this->ipsclass->input['j_do']; } //----------------------------------------- // What shall we do? //----------------------------------------- switch( $this->ipsclass->input['do'] ) { case 'get-new-posts': $this->get_new_posts(); break; case 'get-new-msgs': $this->get_new_messages(); break; case 'mark-forum': $this->mark_forum_as_read(); break; case 'get-member-names': $this->get_member_names(); break; case 'get-msg-preview': $this->get_msg_preview(); break; case 'save-topic': $this->save_topic(); break; case 'dst-autocorrection': $this->dst_autocorrection(); break; case 'check-display-name': $this->check_display_name('members_display_name'); break; case 'check-user-name': $this->check_display_name('name'); break; case 'check-email-address': $this->check_email_address(); break; case 'post-edit-show': $this->post_edit_show(); break; case 'post-edit-save': $this->post_edit_save(); break; } } /*-------------------------------------------------------------------------*/ // Check email address /*-------------------------------------------------------------------------*/ function check_email_address() { //----------------------------------------- // INIT //----------------------------------------- $email = $this->ipsclass->parse_clean_value( rawurldecode( $_REQUEST['email'] ) ); //----------------------------------------- // Try query... //----------------------------------------- $this->ipsclass->DB->build_query( array( 'select' => "email,id", 'from' => 'members', 'where' => "LOWER(email)='{$email}'", 'limit' => array( 0,1 ) ) ); $this->ipsclass->DB->exec_query(); //----------------------------------------- // Got any results? //----------------------------------------- if ( ! $this->ipsclass->DB->get_num_rows() ) { //----------------------------------------- // Load ban filters //----------------------------------------- $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'banfilters' ) ); $this->ipsclass->DB->simple_exec(); while( $r = $this->ipsclass->DB->fetch_row() ) { $banfilters[ $r['ban_type'] ][] = $r['ban_content']; } //----------------------------------------- // Are they banned [EMAIL]? //----------------------------------------- if ( is_array( $banfilters['email'] ) and count( $banfilters['email'] ) ) { foreach ( $banfilters['email'] as $memail ) { $memail = str_replace( "\*", '.*' , preg_quote($memail, "/") ); if ( preg_match( "/$memail/", $email ) ) { $this->return_string('banned'); break; } } } $this->return_string('notfound'); } else { $this->return_string('found'); } } /*-------------------------------------------------------------------------*/ // Check display name /*-------------------------------------------------------------------------*/ function check_display_name( $field='members_display_name' ) { //----------------------------------------- // INIT //----------------------------------------- $name = strtolower( $this->ipsclass->parse_clean_value( trim( rawurldecode( $_REQUEST['name'] ) ) ) ); $id = intval( $_REQUEST['id'] ); # Set member ID $id = $this->ipsclass->member['id'] ? $this->ipsclass->member['id'] : $id; //----------------------------------------- // Remove 'sneaky' spaces //----------------------------------------- if ( $this->ipsclass->vars['strip_space_chr'] ) { // Use hexdec to convert between '0xAD' and chr $name = str_replace( chr(160), ' ', $name ); $name = str_replace( chr(173), ' ', $name ); $name = trim($name); } //----------------------------------------- // Not allowed to select another's log in name //----------------------------------------- if ( $field == 'members_display_name' AND $this->ipsclass->vars['auth_dnames_nologinname'] ) { $check_name = $this->ipsclass->DB->build_and_exec_query( array( 'select' => "{$field}, id", 'from' => 'members', 'where' => "LOWER(name)='{$name}'", 'limit' => array( 0,1 ) ) ); if ( $this->ipsclass->DB->get_num_rows() ) { if ( $id AND $check_name['id'] == $id ) { $this->return_string('notfound'); break; } else { $this->return_string('found'); break; } } } //----------------------------------------- // Not allowed to select another's name //----------------------------------------- $check_name = $this->ipsclass->DB->build_and_exec_query( array( 'select' => "{$field}, id", 'from' => 'members', 'where' => "LOWER({$field})='{$name}'", 'limit' => array( 0,1 ) ) ); if ( $this->ipsclass->DB->get_num_rows() ) { if ( $id AND $check_name['id'] == $id ) { $this->return_string('notfound'); break; } else { $this->return_string('found'); break; } } //----------------------------------------- // Didn't get a result from the DB //----------------------------------------- else { //----------------------------------------- // Load ban filters //----------------------------------------- $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'banfilters' ) ); $this->ipsclass->DB->simple_exec(); while( $r = $this->ipsclass->DB->fetch_row() ) { $banfilters[ $r['ban_type'] ][] = $r['ban_content']; } //----------------------------------------- // Are they banned [NAMES]? //----------------------------------------- if ( is_array( $banfilters['name'] ) and count( $banfilters['name'] ) ) { foreach ( $banfilters['name'] as $n ) { if ( $n == "" ) { continue; } $n = preg_replace( "/\*/", '.*' , preg_quote($n, "/") ); if ( preg_match( "/$n/i", $name ) ) { $this->return_string('found'); break; } } } $this->return_string('notfound'); } } /*-------------------------------------------------------------------------*/ // Post Edit Save /*-------------------------------------------------------------------------*/ function post_edit_save() { //print utf8_encode($_POST['Post']);exit; //----------------------------------------- // INIT //----------------------------------------- $pid = intval( $_REQUEST['p'] ); $fid = intval( $_REQUEST['f'] ); $tid = intval( $_REQUEST['t'] ); $md5_check = substr( $this->ipsclass->parse_clean_value( rawurldecode( $_REQUEST['md5check'] ) ), 0, 32 ); $attach_pids = array(); $_POST['Post'] = $this->convert_unicode( $_POST['Post'] ); if( strtolower($this->ipsclass->vars['gb_char_set']) != 'iso-8859-1' && strtolower($this->ipsclass->vars['gb_char_set']) != 'utf-8' ) { if ( array_key_exists( strtolower($this->ipsclass->vars['gb_char_set']), $this->decode_charsets ) ) { $this->ipsclass->vars['gb_char_set'] = $this->decode_charsets[strtolower($this->ipsclass->vars['gb_char_set'])]; $_POST['Post'] = html_entity_decode( $_POST['Post'], ENT_NOQUOTES, $this->ipsclass->vars['gb_char_set'] ); } } //----------------------------------------- // Set things right //----------------------------------------- $_POST['std_used'] = 1; $this->ipsclass->input['Post'] = $this->ipsclass->parse_clean_value( $_POST['Post'] ); //----------------------------------------- // Check MD5 //----------------------------------------- if ( $md5_check != $this->ipsclass->return_md5_check() ) { @header( "Content-type: text/plain" ); $this->print_nocache_headers(); print 'error'; exit(); } //----------------------------------------- // Check P|T|FID //----------------------------------------- if ( ! $pid OR ! $tid OR ! $fid ) { @header( "Content-type: text/plain" ); $this->print_nocache_headers(); print 'error'; exit(); } //----------------------------------------- // Get classes //----------------------------------------- if ( ! $this->post_init ) { require_once( ROOT_PATH."sources/classes/post/class_post.php" ); require_once( ROOT_PATH."sources/classes/post/class_post_edit.php" ); $this->post = new post_functions(); $this->post->ipsclass =& $this->ipsclass; $this->post->forum = $this->ipsclass->forums->forum_by_id[ $fid ]; $this->post->main_init(); $this->post_init = 1; } //----------------------------------------- // Make sure smilies are parsed //----------------------------------------- $this->ipsclass->input['enableemo'] = $this->post->orig_post['use_emo'] ? 'yes' : ''; $this->ipsclass->input['enablesig'] = $this->post->orig_post['use_sig'] ? 'yes' : ''; $this->ipsclass->input['post_htmlstatus'] = $this->post->orig_post['post_htmlstate']; $this->ipsclass->input['add_edit'] = $this->post->orig_post['append_edit']; $this->ipsclass->input['iconid'] = $this->post->orig_post['icon_id']; $this->ipsclass->input['add_edit'] = ( $this->post->orig_post['append_edit'] OR !$this->ipsclass->member['g_append_edit'] ) ? 1 : 0; //----------------------------------------- // check //----------------------------------------- if ( ! $this->post->orig_post['post'] ) { @header( "Content-type: text/plain" ); $this->print_nocache_headers(); print 'error'; exit(); } //----------------------------------------- // PARSE //-----------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?