$Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $ | > $Revision: 23 $ | > $Author: matt $ +--------------------------------------------------------------------------- | | > 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 "

Неверный вход

У Вас нет доступа к директиве этого файла. Если Вы проводили обновления, убедитесь, что не забыли обновить 'admin.php'."; exit(); } class ad_xmlout { # Classes var $ipsclass; var $search; var $xml_output; var $xml_header; /*-------------------------------------------------------------------------*/ // Constructor /*-------------------------------------------------------------------------*/ function xmlout() { $this->xml_header = ''; } /*-------------------------------------------------------------------------*/ // 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-template-names': $this->get_template_names(); break; case 'get-member-names': $this->get_member_names(); break; } } /*-------------------------------------------------------------------------*/ // Get new posts /*-------------------------------------------------------------------------*/ function get_member_names() { //----------------------------------------- // INIT //----------------------------------------- $name = $this->ipsclass->parse_clean_value( rawurldecode( $_REQUEST['name'] ) ); //-------------------------------------------- // Load extra db cache file //-------------------------------------------- $this->ipsclass->DB->load_cache_file( ROOT_PATH.'sources/sql/'.SQL_DRIVER.'_extra_queries.php', 'sql_extra_queries' ); //----------------------------------------- // Check length //----------------------------------------- if ( strlen( $name ) < 3 ) { $this->return_null(); } //----------------------------------------- // Try query... //----------------------------------------- $this->ipsclass->DB->cache_add_query( 'member_display_name_lookup', array( 'name' => $name, 'field' => 'members_display_name' ), 'sql_extra_queries' ); $this->ipsclass->DB->cache_exec_query(); //----------------------------------------- // Got any results? //----------------------------------------- if ( ! $this->ipsclass->DB->get_num_rows() ) { $this->return_null(); } $names = array(); $ids = array(); while( $r = $this->ipsclass->DB->fetch_row() ) { $names[] = '"'.$r['members_display_name'].'"'; $ids[] = intval($r['id']); } print "returnSearch( '".str_replace( "'", "", $name )."', new Array(".implode( ",", $names )."), new Array(".implode( ",", $ids ).") );"; exit(); } /*-------------------------------------------------------------------------*/ // Get template names /*-------------------------------------------------------------------------*/ function get_template_names() { //----------------------------------------- // INIT //----------------------------------------- $name = $this->ipsclass->parse_clean_value( urldecode( $_REQUEST['name'] ) ); $id = intval( $_REQUEST['id'] ); //----------------------------------------- // Get $skin_names stuff //----------------------------------------- require_once( ROOT_PATH.'sources/lib/skin_info.php' ); //----------------------------------------- // Check length //----------------------------------------- if ( strlen( $name ) < 3 ) { $this->return_null(); } //----------------------------------------- // Try query... //----------------------------------------- $this->ipsclass->DB->build_query( array( 'select' => "suid,set_id,group_name,func_name", 'from' => 'skin_templates', 'where' => "set_id=1 AND LOWER(func_name) LIKE '{$name}%'", 'order' => 'LENGTH(func_name) ASC', 'limit' => array( 0,20 ) ) ); $this->ipsclass->DB->exec_query(); $names = array(); $ids = array(); while( $r = $this->ipsclass->DB->fetch_row() ) { $names[] = '"'.$r['func_name'].' ('.$r['group_name'].')"'; $ids[] = intval($r['suid']); } print "returnSearch( '".str_replace( "'", "", $name )."', new Array(".implode( ",", $names )."), new Array(".implode( ",", $ids ).") );"; exit(); } /*-------------------------------------------------------------------------*/ // make string XML safe /*-------------------------------------------------------------------------*/ function _make_safe_for_xml( $t ) { return str_replace( '&#39;', ''', htmlspecialchars( $t ) ); } /*-------------------------------------------------------------------------*/ // Error handler /*-------------------------------------------------------------------------*/ function error_handler() { @header( "Content-type: text/xml" ); $this->xml_output = $this->xml_header."\r\n\r\n"; $this->xml_output .= "Вы должны быть авторизованы, чтобы получить доступ\r\n"; $this->xml_output .= ""; print $this->xml_output; exit(); } /*-------------------------------------------------------------------------*/ // Return NOTHING :o /*-------------------------------------------------------------------------*/ function return_null($val=0) { @header( "Content-type: text/xml" ); print $this->xml_header."\r\n{$val}"; exit(); } } ?>