241 lines
7.5 KiB
PHP
241 lines
7.5 KiB
PHP
<?php
|
|
|
|
/*
|
|
+--------------------------------------------------------------------------
|
|
| Invision Power Board 2.1.7
|
|
| =============================================
|
|
| by Matthew Mecham
|
|
| (c) 2001 - 2005 Invision Power Services, Inc.
|
|
| http://www.invisionpower.com
|
|
| =============================================
|
|
| Web: http://www.invisionboard.com
|
|
| http://www.ibresource.ru/products/invisionpowerboard/
|
|
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
|
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
|
| Licence Info: http://www.invisionboard.com/?license
|
|
| http://www.ibresource.ru/license
|
|
+---------------------------------------------------------------------------
|
|
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
|
+---------------------------------------------------------------------------
|
|
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
|
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
|
+---------------------------------------------------------------------------
|
|
| > $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 "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
|
|
exit();
|
|
}
|
|
|
|
class ad_xmlout
|
|
{
|
|
# Classes
|
|
var $ipsclass;
|
|
var $search;
|
|
|
|
var $xml_output;
|
|
var $xml_header;
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Constructor
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function xmlout()
|
|
{
|
|
$this->xml_header = '<?xml version="1.0" encoding="WINDOWS-1251"?'.'>';
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// 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<errors>\r\n";
|
|
$this->xml_output .= "<error><message>Âû äîëæíû áûòü àâòîðèçîâàíû, ÷òîáû ïîëó÷èòü äîñòóï</message></error>\r\n";
|
|
$this->xml_output .= "</errors>";
|
|
print $this->xml_output;
|
|
exit();
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Return NOTHING :o
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function return_null($val=0)
|
|
{
|
|
@header( "Content-type: text/xml" );
|
|
print $this->xml_header."\r\n<null>{$val}</null>"; exit();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|