1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-01 05:55:02 +03:00

fix анонса у топика

This commit is contained in:
Mzhelskiy Maxim 2009-05-09 19:41:52 +00:00
parent 4a76b40ae2
commit e3de1ab8f8

View file

@ -383,28 +383,24 @@ class ActionTopic extends Action {
* Парсим на предмет ХТМЛ тегов * Парсим на предмет ХТМЛ тегов
*/ */
$sText=$this->Text_Parser(getRequest('topic_text')); $sText=$this->Text_Parser(getRequest('topic_text'));
/** $sTextShort=$sText;
* Создаёт анонс топика(обрезаем по тег <cut>) $sTextNew=$sText;
*/ $sTextTemp=str_replace("\r\n",'[<rn>]',getRequest('topic_text'));
$sTestShort=$sText;
$sTestNew=$sText;
$sTextTemp=str_replace("\r\n",'[<rn>]',$sText);
$sTextTemp=str_replace("\n",'[<n>]',$sTextTemp); $sTextTemp=str_replace("\n",'[<n>]',$sTextTemp);
if (preg_match("/^(.*)<cut(.*)>(.*)$/Ui",$sTextTemp,$aMatch)) { if (preg_match("/^(.*)<cut(.*)>(.*)$/Ui",$sTextTemp,$aMatch)) {
$sTestShort=$aMatch[1]; $aMatch[1]=str_replace('[<rn>]',"\r\n",$aMatch[1]);
$sTestShort=str_replace('[<rn>]',"\r\n",$sTestShort); $aMatch[1]=str_replace('[<n>]',"\r\n",$aMatch[1]);
$sTestShort=str_replace('[<n>]',"\r\n",$sTestShort); $aMatch[3]=str_replace('[<rn>]',"\r\n",$aMatch[3]);
$sTestShort=$this->Text_Parser($sTestShort); $aMatch[3]=str_replace('[<n>]',"\r\n",$aMatch[3]);
$sTestNew=$aMatch[1].' '.$aMatch[3]; $sTextShort=$this->Text_Parser($aMatch[1]);
$sTextNew=$this->Text_Parser($aMatch[1].' '.$aMatch[3]);
if (preg_match('/^\s*name\s*=\s*"(.+)"\s*\/?$/Ui',$aMatch[2],$aMatchCut)) { if (preg_match('/^\s*name\s*=\s*"(.+)"\s*\/?$/Ui',$aMatch[2],$aMatchCut)) {
$oTopic->setCutText(trim($aMatchCut[1])); $oTopic->setCutText(trim($aMatchCut[1]));
} }
} }
$sTestNew=str_replace('[<rn>]',"\r\n",$sTestNew);
$sTestNew=str_replace('[<n>]',"\r\n",$sTestNew);
$oTopic->setText($sTestNew); $oTopic->setText($sTextNew);
$oTopic->setTextShort($sTestShort); $oTopic->setTextShort($sTextShort);
$oTopic->setTextSource(getRequest('topic_text')); $oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags')); $oTopic->setTags(getRequest('topic_tags'));
$oTopic->setDateAdd(date("Y-m-d H:i:s")); $oTopic->setDateAdd(date("Y-m-d H:i:s"));
@ -537,25 +533,24 @@ class ActionTopic extends Action {
* Парсим на предмет ХТМЛ тегов * Парсим на предмет ХТМЛ тегов
*/ */
$sText=$this->Text_Parser(getRequest('topic_text')); $sText=$this->Text_Parser(getRequest('topic_text'));
$sTestShort=$sText; $sTextShort=$sText;
$sTestNew=$sText; $sTextNew=$sText;
$sTextTemp=str_replace("\r\n",'[<rn>]',$sText); $sTextTemp=str_replace("\r\n",'[<rn>]',getRequest('topic_text'));
$sTextTemp=str_replace("\n",'[<n>]',$sTextTemp); $sTextTemp=str_replace("\n",'[<n>]',$sTextTemp);
if (preg_match("/^(.*)<cut(.*)>(.*)$/Ui",$sTextTemp,$aMatch)) { if (preg_match("/^(.*)<cut(.*)>(.*)$/Ui",$sTextTemp,$aMatch)) {
$sTestShort=$aMatch[1]; $aMatch[1]=str_replace('[<rn>]',"\r\n",$aMatch[1]);
$sTestShort=str_replace('[<rn>]',"\r\n",$sTestShort); $aMatch[1]=str_replace('[<n>]',"\r\n",$aMatch[1]);
$sTestShort=str_replace('[<n>]',"\r\n",$sTestShort); $aMatch[3]=str_replace('[<rn>]',"\r\n",$aMatch[3]);
$sTestShort=$this->Text_Parser($sTestShort); $aMatch[3]=str_replace('[<n>]',"\r\n",$aMatch[3]);
$sTestNew=$aMatch[1].' '.$aMatch[3]; $sTextShort=$this->Text_Parser($aMatch[1]);
$sTextNew=$this->Text_Parser($aMatch[1].' '.$aMatch[3]);
if (preg_match('/^\s*name\s*=\s*"(.+)"\s*\/?$/Ui',$aMatch[2],$aMatchCut)) { if (preg_match('/^\s*name\s*=\s*"(.+)"\s*\/?$/Ui',$aMatch[2],$aMatchCut)) {
$oTopic->setCutText(trim($aMatchCut[1])); $oTopic->setCutText(trim($aMatchCut[1]));
} }
} }
$sTestNew=str_replace('[<rn>]',"\r\n",$sTestNew);
$sTestNew=str_replace('[<n>]',"\r\n",$sTestNew);
$oTopic->setText($sTestNew); $oTopic->setText($sTextNew);
$oTopic->setTextShort($sTestShort); $oTopic->setTextShort($sTextShort);
$oTopic->setTextSource(getRequest('topic_text')); $oTopic->setTextSource(getRequest('topic_text'));
$oTopic->setTags(getRequest('topic_tags')); $oTopic->setTags(getRequest('topic_tags'));
$oTopic->setUserIp(func_getIp()); $oTopic->setUserIp(func_getIp());