Jump to content

Проблема с хуком Хайд для ipb 3.3.4

Featured Replies

Posted
comment_38726

Проблема  с 

 

При вводи опций 

msg-10339-0-00209100-1375826474.png

Появляются непонятные знаки с каким хайд не работает 

msg-10339-0-66550500-1375826481_thumb.pn

 

Может ошибаюсь, но я так понял, что проблема с этим файлом "ritsu_hide_text.php" 

 

 


class bbcode_hide extends bbcode_parent_class implements bbcodePlugin
{

/**
* Constructor
*
* @access public
* @param object Registry object
* @return void
*/
public function __construct( ipsRegistry $registry )
{
$this->currentBbcode = 'hide';

parent::__construct( $registry );

}

public function preDbParse( $txt )
{
return parent::preDbParse( $txt );
}

public function preDisplayParse( $txt )
{
return parent::preDisplayParse( $txt );
}

/**
* Do the actual replacement
*
* @access protected
* @param string $txt Parsed text from database to be edited
* @return string BBCode content, ready for editing
*/
protected function _replaceText( $txt )
{
$_tags = $this->_retrieveTags();

foreach( $_tags as $_tag )
{

$open_tag = '[' . $_tag;
$close_tag = '[/' . $_tag . ']';

while( ( $this->end_pos = stripos( $txt, $close_tag, $this->end_pos ) ) !== false )
{

$this->cur_pos = $this->end_pos;

while( $this->cur_pos > 0 )
{

$this->cur_pos = $this->cur_pos - 1;

if( $this->cur_pos < 0 )
{
break;
}

if( stripos( $txt, $open_tag, $this->cur_pos ) === $this->cur_pos )
{

$open_length = strlen($open_tag);

$_option = '';
$quoteOptions = array();

if( substr( $txt, $this->cur_pos + strlen($open_tag), 1 ) == ' ' )
{
$open_length += 1;
$_option = substr( $txt, $this->cur_pos + $open_length, (strpos( $txt, ']', $this->cur_pos ) - ($this->cur_pos + $open_length)) );
$quoteOptions = $this->_extractSurgicallyTehOptions( $_option );
}

else if( (strpos( $txt, ']', $this->cur_pos ) - ( $this->cur_pos + $open_length )) !== 0 )
{
continue;
}

$_content = substr( $txt, ($this->cur_pos + $open_length + strlen($_option) + 1), (stripos( $txt, $close_tag, $this->cur_pos ) - ($this->cur_pos + $open_length + strlen($_option) + 1)) );

$_content = IPSText::br2nl( $_content );
$_content = trim( $_content );
$_content = nl2br( $_content );

$txt = substr_replace( $txt, $this->_buildOutput( $_content, $quoteOptions ? $quoteOptions : '' ), $this->cur_pos, (stripos( $txt, $close_tag, $this->cur_pos ) + strlen($close_tag) - $this->cur_pos) );

break;
}
}

$this->end_pos += 1;

if( $this->end_pos > strlen($txt) )
{
$this->end_pos = 0;
break;
}
}
}

return $txt;
}


/**
* Raw options string
*
* @access private
* @param string $string The options submitted with the post as a string
* @return array Key => value Option pairs
*/
private function _extractSurgicallyTehOptions( $options='' )
{
if( !$options )
{
return array();
}

/**
* Strip tags removes any added tags
* @see __community.invisionpower.com/tracker/issue-19960-problem-when-tags-is-put-inside-quote-starter-tag/
*/
$options = str_replace( ''', "'", strip_tags($options) );
$options = str_replace( '"', '"', $options );

$finalOpts = array();

// Need to push through string, pulling out keys/options

$pos = 0;
$options = trim($options);
$key = '';
$value = '';
$inKey = true;
$inValue = false;

while( $pos < strlen($options) )
{
if( $options{$pos} == ' ' AND !$inKey AND !$inValue )
{
$key = '';
$value = '';
$inKey = true;
}
else if( $options{$pos} == "'" OR $options{$pos} == '"' )
{
if( $inKey )
{
$inKey = false;
$inValue = true;
}
else
{
$inValue = false;

$finalOpts[ trim($key) ] = $value;
}
}
else
{
if( $inKey )
{
if( $options{$pos} != '=' )
{
$key .= $options{$pos};
}
}
else if( $inValue )
{
$value .= $options{$pos};
}
}

$pos++;
}

return $finalOpts;
}

/**
* Build the actual output to show
*
* @access private
* @param integer $option Font size
* @param string $content Text
* @return string Content to replace bbcode with
*/
private function _buildOutput( $content, $options=array() )
{
//-----------------------------------------
// Strip the optional quote delimiters
//-----------------------------------------

$condition = array (
'auth' => '1',
'thank' => '0',
'rep' => '0',
'reply' => '0',
'posts' => '0',
'group' => array('any'),
'nick' => array('any')
);

if(is_array($options))

while(list($key, $val) = each($condition))
{
if(array_key_exists($key, $options))
{
switch($key)
{
case 'auth': case 'thank': case 'reply':

$condition[$key] = ($options[$key] == "1") ? "1": "0";

break;

case 'rep': case 'posts':

$val = intval($options[$key]);

if($val > 0 && $val < 1000000) $condition[$key] = $val;

break;

case 'nick':

$in = explode(",", $options[$key]);

while(list($key, $val) = each($in)) $in[$key] = $this->DB->addSlashes( strtolower( $in[$key] ) );

$out = array( );

if(sizeof($in) > 0)

{

$this->DB->build( array(
'select' => "m.member_id",
'from' => array('members' => 'm'),
'where' => 'lower(name) IN("'.implode('", "', $in).'")'
) );

$query = $this->DB->execute();

while($member = $this->DB->fetch($query))
{

$out[] = $member["member_id"];

}

}

if(sizeof($out) > 0)

$condition['nick'] = $out;

break;


case 'group':


$in = explode(",", $options[$key]);

while(list($key, $val) = each($in)) $in[$key] = $this->DB->addSlashes( strtolower( $in[$key] ) );

$out = array( );

if(sizeof($in) > 0)

{

$this->DB->build( array(
'select' => "g.g_id",
'from' => array('groups' => 'g'),
'where' => 'lower(g.g_title) IN("'.implode('", "', $in).'")'
) );

$query = $this->DB->execute();

while($group = $this->DB->fetch($query))
{

$out[] = $group["g_id"];

}

}

if(sizeof($out) > 0)

$condition['group'] = $out;

break;

}
}
}

$condition_serialized = serialize( $condition );

$hash = md5($content.$condition_serialized);

$this->DB->build( array(
'select' => "r.*",
'from' => array('ritsu_hide_text' => 'r'),
'where' => 'r.key = "'.$hash.'"'
) );

$query = $this->DB->execute();

$exists = false;

while($block = $this->DB->fetch($query))
{

if( ( $block["condition"] == $condition_serialized ) && ( $block["data"] == $content ) )
{

$key = $block["key"];

$exists = true;

}

}

if(!$exists)
{

$key = $hash;

$block = array(
'key' => $hash,
'condition' => $condition_serialized,
'data' => $content
);

$this->DB->insert( 'ritsu_hide_text', $block );

}



return "
Загрузка...

";

}
}

 

Помогите убрать ошибку 

Hide.rar

Guest
This topic is now closed to further replies.

Последние посетители 0

  • No registered users viewing this page.