# Находим в тексте URL на приаттаченные картинки и меняем на те
# имена, под которыми мы их сохранили.
#
# Находим в тексте URL на приаттаченные картинки и меняем на те
# имена, под которыми мы их сохранили.
#
#
$newmsg = $newmsg->clone;
savetree($path_translated,$tree,$lockfd);
#
$newmsg = $newmsg->clone;
savetree($path_translated,$tree,$lockfd);
record_statistics($forum,"message"),
update_topic_list($forum,$path_translated,$msgcount,$posted);
forum_redirect($cgi,$forum,$cgi->path_info."#$id");
}
sub fix_image_links {
record_statistics($forum,"message"),
update_topic_list($forum,$path_translated,$msgcount,$posted);
forum_redirect($cgi,$forum,$cgi->path_info."#$id");
}
sub fix_image_links {
for my $image ($txtree->find_by_tag_name("img")) {
my $file=lc($image->attr("src"));
if ( exists $attached->{$file}) {
for my $image ($txtree->find_by_tag_name("img")) {
my $file=lc($image->attr("src"));
if ( exists $attached->{$file}) {
my ($width,$height) = imgsize($dir ."/".$attached->{$file});
$image->attr("width" =>$width);
$image->attr("height" => $height);
my ($width,$height) = imgsize($dir ."/".$attached->{$file});
$image->attr("width" =>$width);
$image->attr("height" => $height);
substinfo($block,[class=>"msgcount"],_content=>$count);
substinfo($block,[class=>"last-updated"],_content=>$date);
# и если мы парсили дерево, то мы его и сохраняем
substinfo($block,[class=>"msgcount"],_content=>$count);
substinfo($block,[class=>"last-updated"],_content=>$date);
# и если мы парсили дерево, то мы его и сохраняем
my ($tree,$lockfd) = gettree($forum->{forumroot}."/recent.html");
my $msglist = $tree->look_down("class"=>"messagelist");
if ($msglist) {
my ($tree,$lockfd) = gettree($forum->{forumroot}."/recent.html");
my $msglist = $tree->look_down("class"=>"messagelist");
if ($msglist) {
my $style = $msglist->attr("style");
if ($style && $style =~ s/display: none;//) {
$msglist->attr("style",$style);
my $style = $msglist->attr("style");
if ($style && $style =~ s/display: none;//) {
$msglist->attr("style",$style);
form_error($form,$cgi,$forum,"Некорректные символы в urlname.
Допустимы только латинские буквы, цифры и минус") unless $urlname;
}
form_error($form,$cgi,$forum,"Некорректные символы в urlname.
Допустимы только латинские буквы, цифры и минус") unless $urlname;
}
my $tree = gettemplate($forum,"topic",$url);
# Заполнить название и аннотацию
my $abstract = input2tree($cgi,$forum,"abstract");
my $tree = gettemplate($forum,"topic",$url);
# Заполнить название и аннотацию
my $abstract = input2tree($cgi,$forum,"abstract");
- substinfo($tree,[_tag=>"meta","name"=>"description"],content=>$abstract->as_trimmed_text);
+ substinfo($tree,[_tag=>"meta","name"=>"description"],content=>$abstract->as_trimmed_text) if $abstract;
substinfo($tree,[_tag=>"title"],_content=>$cgi->param("title"));
my $subtree = $tree->look_down("class"=>"topic");
my $creation_time=strftime("%d.%m.%Y %H:%M",localtime());
substinfo($tree,[_tag=>"title"],_content=>$cgi->param("title"));
my $subtree = $tree->look_down("class"=>"topic");
my $creation_time=strftime("%d.%m.%Y %H:%M",localtime());
_content=>$creation_time);
# Вставляем в страницу КОПИЮ аннотации, поскольку аннотация
# нам еще понадобится в списке тем.
_content=>$creation_time);
# Вставляем в страницу КОПИЮ аннотации, поскольку аннотация
# нам еще понадобится в списке тем.
substitute_user_info($subtree,$forum);
} else {
substinfo($tree,["class"=>"title"],
substitute_user_info($subtree,$forum);
} else {
substinfo($tree,["class"=>"title"],
form_error($form,$cgi,$forum,"Некорректные символы в urlname.
Допустимы только латинские буквы, цифры и минус") unless $urlname;
}
form_error($form,$cgi,$forum,"Некорректные символы в urlname.
Допустимы только латинские буквы, цифры и минус") unless $urlname;
}
}
# Заполнить название и аннотацию
my $abstract = input2tree($cgi,$forum,"abstract");
}
# Заполнить название и аннотацию
my $abstract = input2tree($cgi,$forum,"abstract");
- substinfo($tree,[_tag=>"meta","name"=>"description"],content=>$abstract->as_trimmed_text);
+ substinfo($tree,[_tag=>"meta","name"=>"description"],content=>$abstract->as_trimmed_text) if $abstract;
substinfo($tree,[_tag=>"title"],_content=>$cgi->param("title"));
my $subtree = $tree->look_down("class"=>"annotation")
or show_error($forum,"В шаблоне форума отсутствует класс annotation");
substinfo($tree,[_tag=>"title"],_content=>$cgi->param("title"));
my $subtree = $tree->look_down("class"=>"annotation")
or show_error($forum,"В шаблоне форума отсутствует класс annotation");
_content=>$creation_time);
# Вставляем в страницу КОПИЮ аннотации, поскольку аннотация
# нам еще понадобится в списке тем.
_content=>$creation_time);
# Вставляем в страницу КОПИЮ аннотации, поскольку аннотация
# нам еще понадобится в списке тем.
substitute_user_info($subtree,$forum);
substinfo($subtree,[_tag=>"img","class"=>"logo"],
src=> $logo_name, width=>$logo_width, height=>$logo_height);
substitute_user_info($subtree,$forum);
substinfo($subtree,[_tag=>"img","class"=>"logo"],
src=> $logo_name, width=>$logo_width, height=>$logo_height);
# Преобразуем текст в html
my $txtree = input2tree($cgi,$forum,"text");
# Преобразуем текст в html
my $txtree = input2tree($cgi,$forum,"text");
my $edited = strftime("%d.%m.%Y %H:%M",localtime());
substinfo($msg,[class=>"subject"],_content=>$cgi->param("subject"));
substinfo($msg,[class=>"editdate"],_content=>$edited);
my $edited = strftime("%d.%m.%Y %H:%M",localtime());
substinfo($msg,[class=>"subject"],_content=>$cgi->param("subject"));
substinfo($msg,[class=>"editdate"],_content=>$edited);
my @msgs = $tree->look_down(class=>"message");
my $msgcount=@msgs;
savetree($path_translated,$tree,$lockfd);
my @msgs = $tree->look_down(class=>"message");
my $msgcount=@msgs;
savetree($path_translated,$tree,$lockfd);
update_topic_list($forum,$path_translated,$msgcount,$edited);
forum_redirect($cgi,$forum,$cgi->url(-base=>1).$cgi->path_info()."#$id");
}
update_topic_list($forum,$path_translated,$msgcount,$edited);
forum_redirect($cgi,$forum,$cgi->url(-base=>1).$cgi->path_info()."#$id");
}
_content=>$cgi->param("title"));
# Вставляем в страницу КОПИЮ аннотации, поскольку аннотация
# нам еще понадобится в списке тем.
_content=>$cgi->param("title"));
# Вставляем в страницу КОПИЮ аннотации, поскольку аннотация
# нам еще понадобится в списке тем.
} else {
substinfo($tree,["class"=>"title"],
_content=>$cgi->param("title"));
} else {
substinfo($tree,["class"=>"title"],
_content=>$cgi->param("title"));
}
my ($tree,$lockfd) = gettree($path_translated . "/".$forum->{indexfile});
my $abstract = input2tree($cgi,$forum,"abstract");
}
my ($tree,$lockfd) = gettree($path_translated . "/".$forum->{indexfile});
my $abstract = input2tree($cgi,$forum,"abstract");
- substinfo($tree,[_tag=>"meta","name"=>"description"],content=>$abstract->as_trimmed_text);
+ substinfo($tree,[_tag=>"meta","name"=>"description"],content=>$abstract->as_trimmed_text) if $abstract;
substinfo($tree,[_tag=>"title"],_content=>$cgi->param("title"));
my $subtree = $tree->look_down("class"=>"annotation");
substinfo($subtree,["class"=>"title"],
_content=>$cgi->param("title"));
# Вставляем в страницу КОПИЮ аннотации, поскольку аннотация
# нам еще понадобится в списке тем.
substinfo($tree,[_tag=>"title"],_content=>$cgi->param("title"));
my $subtree = $tree->look_down("class"=>"annotation");
substinfo($subtree,["class"=>"title"],
_content=>$cgi->param("title"));
# Вставляем в страницу КОПИЮ аннотации, поскольку аннотация
# нам еще понадобится в списке тем.
substinfo($subtree,[_tag=>"img","class"=>"logo"],
src=> $logo_name, width=>$logo_width, height=>$logo_height)
if defined($logo_name);
substinfo($subtree,[_tag=>"img","class"=>"logo"],
src=> $logo_name, width=>$logo_width, height=>$logo_height)
if defined($logo_name);