Files
IPB/upload/sources/handlers/han_editor.php
T
2025-12-19 00:21:15 -08:00

213 lines
6.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
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $
| > $Revision: 23 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > Post Handler
| > Module written by Matt Mecham
| > Date started: Wednesday 9th March 2005 (15:23)
|
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
exit();
}
class han_editor
{
# Global
var $ipsclass;
var $class_editor;
# Method
var $method;
# Skin method
var $skin_function;
# Html handler
var $html;
# Pass width
var $ed_width = '650px';
# Pass height
var $ed_height = 250;
/*-------------------------------------------------------------------------*/
// INIT
/*-------------------------------------------------------------------------*/
function init()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$class = "";
if ( ! $this->ipsclass->vars['posting_allow_rte'] )
{
$this->ipsclass->member['members_editor_choice'] = 'std';
}
if ( ! $this->method )
{
$this->method = $this->ipsclass->member['members_editor_choice'];
}
//-----------------------------------------
// Fix width
//-----------------------------------------
$this->ed_width = $this->ipsclass->vars['rte_width'] ? $this->ipsclass->vars['rte_width'] : $this->ed_width;
//-----------------------------------------
// Make sure we haven't had any messin'
//-----------------------------------------
if ( intval($_POST['rte_used']) )
{
$this->method = 'rte';
}
//-----------------------------------------
// Force STD editor (fast reply, etc)
//-----------------------------------------
if ( intval($_POST['std_used']) )
{
$this->method = 'std';
}
//-----------------------------------------
// Sneaky Opera or Safari
//-----------------------------------------
if ( $this->method == 'rte' )
{
if ( $this->ipsclass->browser['browser'] == 'opera' AND $this->browser['version'] < 9.0 ) # Okay... this is for future compat.
{
$this->method = 'std';
$this->ipsclass->force_editor_change = 1;
}
else if ( $this->ipsclass->browser['browser'] == 'safari' AND $this->ipsclass->browser['version'] < 1000 ) # Okay... this is for future compat.
{
$this->method = 'std';
$this->ipsclass->force_editor_change = 1;
}
else if ( $this->ipsclass->browser['browser'] == 'konqueror' )
{
$this->method = 'std';
$this->ipsclass->force_editor_change = 1;
}
}
//$this->method = "rte";
//-----------------------------------------
// Which class
//-----------------------------------------
switch( $this->method )
{
case 'rte':
$class = 'class_editor_rte.php';
$this->skin_function = 'editor_rte';
break;
case 'std':
$class = 'class_editor_std.php';
$this->skin_function = 'editor_std';
break;
default:
$class = 'class_editor_std.php';
$this->skin_function = 'editor_std';
}
//-----------------------------------------
// Load classes
//-----------------------------------------
require_once( ROOT_PATH . 'sources/classes/editor/class_editor.php' );
require_once( ROOT_PATH . 'sources/classes/editor/'.$class );
$this->class_editor = new class_editor_module();
$this->class_editor->ipsclass =& $this->ipsclass;
$this->class_editor->allow_unicode = $this->ipsclass->allow_unicode;
$this->class_editor->get_magic_quotes = $this->ipsclass->get_magic_quotes;
//-----------------------------------------
// Init class
//-----------------------------------------
$this->class_editor->main_init();
}
/*-------------------------------------------------------------------------*/
// Mode: Show editor
// Takes raw text with BBCode *NOT* converted BBCode
/*-------------------------------------------------------------------------*/
function show_editor( $text, $form_field='post_content' )
{
//-----------------------------------------
// Load skin and language
//-----------------------------------------
if ( ! $this->ipsclass->compiled_templates['skin_editors'] )
{
$this->ipsclass->load_template( 'skin_editors' );
}
$this->ipsclass->load_language( 'lang_editors' );
//-----------------------------------------
// Pre parse...
//-----------------------------------------
$text = $this->class_editor->process_before_form( $text );
$func = $this->skin_function;
return $this->ipsclass->compiled_templates['skin_editors']->$func( $text, $form_field, $this->ed_width, $this->ed_height );
}
/*-------------------------------------------------------------------------*/
// Mode: Process text
/*-------------------------------------------------------------------------*/
function process_raw_post( $form_field )
{
return $this->class_editor->process_after_form( $form_field );
}
}
?>