#! /usr/local/bin/perl #-------------------------------------------------------------------------------------------------- # 設計基: @TOWN ニュース 出力のスクリプト # By:Okawa-DAISENSEI #----------------------------------------------------------------------------------1234567890123456 # 02/01/18 日付順にソート。 # 01/10/25 NNで動かないバグを修正。文字表示を一定でカットするルーチンを追加。 #use KCatch; use Pg; use Time::Local; use Encode; use utf8; require '../cgi-lib217.pl'; require '../inp_area/getsize.pl'; require "../../townguide/config/common.ini"; # townguide地区の設定 require '../inp_area/lib_logio.pl'; # セッション認証及び引継のためのライブラリ require '../inp_area/lib_sql.pl'; # SQL接続のためのライブラリ require '../inp_area/lib_io.pl'; # ファイルの入出力に関するライブラリ require '../inp_area/lib_sys.pl'; # プログラム内部での変換・判定に関するライブラリ require '../inp_area/pge_print.pl'; # ページの共通生成プログラム $prog = "/cgi-local/news/news.cgi"; $Server_Name = $ENV{'SERVER_NAME'}; $newsregistmax = 300; $PKU_MAX = 32; $Server_Name =~ s/^www\.//; @val = &domain_chk($Server_Name); $subdomain = $val[0]; $Server_Name = $val[1]; $area = &get_area($Server_Name); # townguide地区の設定 #------------------------------------------------------------ # デコード処理 &ReadParse; $convert="euc"; while(($name, $value) = each %in) { #画像ファイルpic*以外の文字コードを置換する next if($name =~ /_upload$/i); my $myDeName = Encode::is_utf8($name) ? $name : decode_utf8($name); my $myDeValue = Encode::is_utf8($value) ? $value : decode_utf8($value); $myDeValue =~ s//>/g; $myDeValue =~ s/"/"/g; $myDeValue =~ s/\r\n/\n/g; $myDeValue =~ s/\r|\n/
/g; $myDeValue =~ s/\,//g; $in{$myDeName} = $myDeValue; } $act = $in{'act'}; # 地区フォルダアドレス指定の正規化(念のため) $area =~ s/('|"|\.|`|\/)//g; $in{userid} = int($in{userid}); $in{id} = int($in{id}); if(($area eq '')||(length($area) > 16)) { print "Content-type: text/html\n\n"; &error("異常な投稿が行われました。"); } if($in{userid} == 0) { print "Content-type: text/html\n\n"; &error("該当ページが見つかりません"); } $userimage = "../../townguide/userimage/$area/"; # データベース接続 eval { $conn = &pg_connect(%port_input); }; if($@) { print "Content-type: text/html\n\n"; &error("接続エラー" . $@); } # SQLの実行(共通-主にアイコンの読み出し) my($sql01) = "select * from $table_area{db01} where id=$in{userid};"; eval { $result01 = &pg_exec($conn,$sql01); }; if($@) { print "Content-type: text/html\n\n"; &error("SQL文エラー($sql01)".$@); } local (%db01) = &result_to_array($result01,0); my $url_str = &getURL(); if ($db01{public_type} eq '403') { print "Location: ${url_str}\n\n"; exit(0); } my($sql_db01_2) = "select * from $table_area{db01_2} where id=$in{userid};"; eval { $result_db01_2 = &pg_exec($conn,$sql_db01_2); }; if($@) { print "Content-type: text/html\n\n"; &error("SQL文エラー($sql_db01_2)".$@); } my(%db01_2) = &result_to_array($result_db01_2,0); %db01 = (%db01, %db01_2); { my $server_name = $ENV{'SERVER_NAME'}; $server_name =~ s/^www\.//; my $area_domain = &get_area_domain($server_name); my $user_domain = $db01{username}. '.'. $area_domain; my $url_str = &getURL(); # 一つのユーザをドキュメントルートとして使用している場合 if (&check_top_user($db01{username})) { $user_domain = $area_domain; } if ($user_domain ne $server_name) { my $jump = $url_str. $ENV{REQUEST_URI}; print "Location: ${jump}\n\n"; exit(0); } } # SQLの実行(表紙) my($sql02) = "select * from $table_area{db02} where id=$in{userid};"; eval { $result02 = &pg_exec($conn,$sql02); }; if($@) { &error("SQL文エラー($sql02)".$@); } local (%db02) = &result_to_array($result02,0); if(int($in{id}) != 0) {&Display;} else {&all;} exit; sub Display{ # 記事の詳細 my ($n_min,$n_hour,$n_mday, $n_mon, $n_year) = (localtime(time))[1,2,3,4,5]; my $now_time = int(timelocal(59,$n_min,$n_hour,$n_mday,$n_mon,$n_year)); #my($sql10) = "select * from $table_area{db10} where id=$in{id} and userid=$in{userid};"; my($sql10) = "select * from $table_area{db10} where id=$in{id} and userid=$in{userid} and time <= $now_time;"; eval { $result10 = &pg_exec($conn,$sql10); }; if($@) { &error("SQL文エラー($sql10)".$@); } $n = $result10->ntuples; if($n == 0) { &error("該当する記事はありません。"); } local (%db10) = &result_to_array($result10,0); my $ccaption_css_ex = 0; my $ccaption_sub_css_ex = 0; my $ccaption_sub_min_css_ex = 0; if (int($db02{news_master_icon_sub_custom_mode}) == 0 && int($db01{master_icon_sub_custom_mode} == 0)) { $master_fix = "master_"; $icon_sub_custom_css_ex = $master_fix."icon_sub_custom_css_ex"; if ($db01{$icon_sub_custom_css_ex} ne "") { $ccaption_sub_css_ex = 1; } } if (int($db02{news_master_icon_sub_min_custom_mode}) == 0 && int($db01{master_icon_sub_min_custom_mode} == 0)) { $master_fix = "master_"; $icon_sub_min_custom_css_ex = $master_fix."icon_sub_min_custom_css_ex"; if ($db01{$icon_sub_min_custom_css_ex} ne "") { $ccaption_sub_min_css_ex = 1; } } # my $class_name = "ccaption"; # if (int($db01{master_icon_custom_mode}) == 1 && $db01{"master_icon_custom_css_ex"} ne "") { # $ccaption_css_ex = 1; # $class_name = "master_ccaption ccaption"; # } my $sub_class_name = "ccaption_sub"; if ($ccaption_sub_css_ex == 1) { $sub_class_name = "master_ccaption_sub ccaption_sub"; } my $sub_min_class_name = "ccaption_sub_min"; if ($ccaption_sub_min_css_ex == 1) { $sub_min_class_name = "master_ccaption_sub_min ccaption_sub_min"; } my $out = "news"; my $css_file = "/cgi-local/news/news_css.cgi?uid=$in{userid}&nid=$in{id}"; my ($time_title) = ""; if (int($db02{news_time_type}) == 0) { $time_title = &getdate($db10{time},4); } elsif (int($db02{news_time_type}) == 1) { $time_title = &getdate($db10{time},5); } elsif (int($db02{news_time_type}) == 2) { $time_title = &getdate($db10{time},8); } else { $time_title = &getdate($db10{time},7); } if ($db10{news_category_select} != 0) { my $cate_disp_day_tmp = "news_category$db10{news_category_select}_disp_day"; my $disp_after_day = int($db02{$cate_disp_day_tmp}); if (&getNewsDispCheck($db10{time},$disp_after_day) == 0) { $cate_name_tmp = "news_category$db10{news_category_select}_name"; $news_category_select = "$db02{$cate_name_tmp}"; $time_title .= " " . $news_category_select; } } my ($news_str) = ""; $title_news = "news_title"; $comment_news = "news_comment"; $uploadfld_news = "news_upload"; $delpicfld_news = "news_upload_del"; $layout_news = "news_layout"; $alt_text = "news_alt_text"; $img_link = "news_img_link"; $img_auto_size = "news_img_auto_size"; $exfile_news = "$userimage$db10{$uploadfld_news}"; if(-f $exfile_news) { if ($db10{$alt_text} ne "") { $imgtag_news = qq|$db10{$alt_text}|; } else { $imgtag_news = qq||; } if ($db10{$img_link} ne "") { $imgtag_news = qq|$imgtag_news|; } } $news_title = $db10{$title_news}; $news_title =~ s/&/&/g; $news_title =~ s/"/"/g; $news_title =~ s/>/>/g; $news_title =~ s/<//
/ig; $news_cmt = $db10{$comment_news}; $news_cmt =~ s/&/&/g; $news_cmt =~ s/"/"/g; $news_cmt =~ s/>/>/g; $news_cmt =~ s/<//
/ig; $disp_tag = &sub_layout($db10{$layout_news},$imgtag_news,$news_cmt,$db10{$img_auto_size}); if (int($news_icon_sub_custom_noimage_tmp) > 0) { $news_title = "$news_title"; } $news_str .= <<_HTML_;

$news_title

$disp_tag
_HTML_ if (!$db02{news_css}) { $db02{news_css} = "background-color: #ddffdd;"; } if ($subdomain == 1) { $toplink = "/index.html"; } else { # 一つのユーザをドキュメントルートとして使用している場合 if (&check_top_user($db01{username})) { $toplink = "../../index.html"; } else { $toplink = "../../$db01{username}/index.html"; } } #2010_06_02ニュースバーのカスタマイズ画像を可能とする修正ここから↓ my ($whats_custom,$extfile_bar); $news_rss_imgname = "/image/rss/rss-0.gif"; $news_img_width = 36; $news_img_height = 14; if($db02{news_rss_imgname} ne "" && int($db02{news_rss_imgnum}) != 0) { $news_rss_imgname = "/image/rss/$db02{news_rss_imgname}"; $news_img_width = 18; $news_img_height = 18; } $rss_link = qq|rss|; if (int($db02{"news_rss_flg"}) == 1) { $rss_link = ""; $rss_link_onbar = qq|
rss
|; } $whats_custom = "/image/whats/$db02{cover_news_select}"; $extfile_bar = "$userimage$db02{cover_news_select_custom}"; $newsbar1_img_height = 21; if ($db02{'cover_news_is_custom'} eq '1' && -f $extfile_bar) { $whats_custom = "/userimage/$db02{cover_news_select_custom}"; &getsize("$extfile_bar"); $newsbar1_img_height = $PICINFO{'height'}; } $extfile_list_bar = "$userimage$db02{cover_news_list_select_custom}"; if ($db02{'cover_news_list_is_custom'} eq '1' && -f $extfile_list_bar) { $whats_custom = "/userimage/$db02{cover_news_list_select_custom}"; &getsize("$extfile_list_bar"); $newsbar1_img_height = $PICINFO{'height'}; } $extfile_cover_news_midashi = "$userimage$db10{cover_news_midashi_upload}"; if ($extfile_cover_news_midashi ne "" && -f $extfile_cover_news_midashi) { $whats_custom = "/userimage/$db10{cover_news_midashi_upload}"; &getsize("$extfile_cover_news_midashi"); $newsbar2_img_height = $PICINFO{'height'}; } $cover_news_midashi_title = "ニュース"; if ($db10{news_submenu_title} ne "") { $cover_news_midashi_title = $db10{news_submenu_title}; } my $url_str = &getURL(); my $protcol_str = &getProtcol(); # ニュースリンク作成 #$newsprog_html = "/news/news_i$db10{id}_u$db10{userid}.html";#### サムネイルファイル指定 $newsprog_html = "/news/news-i$db10{id}-u$db10{userid}.html";#### サムネイルファイル指定 my $sp_type = "/phone/news/news_i$db10{id}_u$db10{userid}.html"; if ($db10{news_filename} ne "") { $newsprog_html = "/news/$db10{news_filename}"; $sp_type = "/phone/news/$db10{news_filename}"; } # ソーシャルネットワークボタンのOn/Off my ($social_str) = ""; if (int($db01{"news_twitter_flg"}) == 1) { $social_str .= qq|ツイート|; } if (int($db01{"news_facebook_flg"}) == 1) { $social_str .= qq||; } if (int($db01{"news_google_flg"}) == 1) { $social_str .= qq||; $paste_str{"java_script"} = qq||; } if ($social_str ne "") { $social_str = <<_HTML_;
$social_str
_HTML_ } my $sql_news_item_data = "select * from $table_area{news_item_data} where news_id=$in{id} and userid = $in{userid} order by sort_num;"; eval { $result_news_item_data = &pg_exec($conn,$sql_news_item_data); }; if($@) { &error("SQL文エラー($sql_news_item_data)".$@); } $n_news_item_data = $result_news_item_data->ntuples; my ($icon_upload_check); if ($db01{'icon_upload'} ne '') { $icon_upload_check = "/userimage/$db01{'icon_upload'}"; } else { $icon_upload_check = "/image/icon/$db01{'menu_icon'}"; } my $add_html = ""; if ($n_news_item_data != 0) { my $contents_num = 1; for (my $i = 1; $i <= $n_news_item_data; $i++) { my $db_no = $i - 1; %news_item_data_db = &result_to_array($result_news_item_data,$db_no); my $add_img_tag = ""; my $ext_filepath = ""; if ($news_item_data_db{cuscom_upload} ne "") { if ($news_item_data_db{cuscom_alt_text} ne "") { $add_img_tag = "\"$news_item_data_db{cuscom_alt_text}\""; } else { $add_img_tag = ""; } if ($news_item_data_db{cuscom_img_link} ne "") { $add_img_tag = qq|$add_img_tag|; } } $news_cuscom_cmt = $news_item_data_db{cuscom_comment}; $news_cuscom_cmt =~ s/&/&/g; $news_cuscom_cmt =~ s/"/"/g; $news_cuscom_cmt =~ s/>/>/g; $news_cuscom_cmt =~ s/<//
/ig; if ($news_item_data_db{cuscom_type} == 2 || $news_item_data_db{cuscom_type} == 3) { my $fre_pku_html = ""; my $fre_pku_cnt = 1; my $pku_horizontal_num_name = "pku_horizontal_num"; my $pku_tablet_horizontal_num_name = "pku_tablet_horizontal_num"; my $pku_phone_horizontal_num_name = "pku_phone_horizontal_num"; my $pku_text_pos_name = "pku_text_pos"; my $pku_border_color_name = "pku_border_color"; my $pku_bg_color_name = "pku_bg_color"; my $pku_img_width_name = "pku_img_width"; my $pku_contents_text_name = "pku_contents_text"; my $pku_scroll_anime_name = "pku_scroll_anime"; my $pku_item_title_disp_type_name = "pku_item_title_disp_type"; my $pku_item_title_align_name = "pku_item_title_align"; my $pku_item_title_hover_left_name = "pku_item_title_hover_left"; my $pku_item_title_hover_top_name = "pku_item_title_hover_top"; my $pku_item_title_hover_right_name = "pku_item_title_hover_right"; for (my $pku_no = 1; $pku_no <= $PKU_MAX; $pku_no++) { my $t_pku_item_title = "pku_item_title".$pku_no; my $t_pku_alt = "pku_alt".$pku_no; my $t_pku_link = "pku_link".$pku_no; my $t_pku_img_upload = "pku_img_upload".$pku_no; my $t_pku_text = "pku_text".$pku_no; $news_item_data_db{$t_pku_item_title} = &normal_tag_data($news_item_data_db{$t_pku_item_title}); $news_item_data_db{$t_pku_text} = &normal_tag_data($news_item_data_db{$t_pku_text}); if ($news_item_data_db{$t_pku_img_upload} eq "" && $news_item_data_db{$t_pku_text} eq "") { next; } my $pku_tmp = ""; my $pku_img_tmp = ""; if ($news_item_data_db{$t_pku_img_upload} ne "") { if ($news_item_data_db{$t_pku_alt} ne "") { $pku_img_tmp = qq|$news_item_data_db{$t_pku_alt}|; } else { $pku_img_tmp = qq|$news_item_data_db{cuscom_title}:画像${pku_no}|; } #if ($news_item_data_db{$t_pku_link} ne "") { # $pku_img_tmp = qq|$pku_img_tmp|; #} } my $fre_pku_item_html = ""; if ($news_item_data_db{"pku_text_pos"} eq "up" || $news_item_data_db{"pku_text_pos"} eq "bottom") { # 題名か画像があれば、リンク設定を実施 my $pku_link_flg = 0; if($news_item_data_db{$t_pku_link} ne "") { $pku_link_flg = 1; $fre_pku_item_html .= qq||; } if ($news_item_data_db{$t_pku_item_title} ne "") { if ($news_item_data_db{disp_mode} == 1) { $fre_pku_item_html .= qq|

$news_item_data_db{$t_pku_item_title}

\n|; } else { $fre_pku_item_html .= qq|

$news_item_data_db{$t_pku_item_title}

\n|; } } my $fre_pku_image = ""; if ($pku_img_tmp ne "") { if ($news_item_data_db{"pku_text_pos"} ne "up") { if ($news_item_data_db{$t_pku_item_title} eq "") { if ($news_item_data_db{disp_mode} == 1) { $fre_pku_image = qq|

$pku_img_tmp

|; } else { $fre_pku_image = qq|

$pku_img_tmp

|; } } else { $fre_pku_image = qq|
$pku_img_tmp
|; } } else { $fre_pku_image = qq|
$pku_img_tmp
|; } if($news_item_data_db{$t_pku_link} ne "" && ($news_item_data_db{"pku_text_pos"} eq "left" || $news_item_data_db{"pku_text_pos"} eq "right")) { $fre_pku_image = qq|
${fre_pku_image}|; } $fre_pku_item_html .= $fre_pku_image; } if ($pku_link_flg == 1) { $fre_pku_item_html .= qq||; } my $fre_pku_comment = ""; if ($news_item_data_db{$t_pku_text} ne "") { if ($news_item_data_db{"pku_text_pos"} eq "up" && $fre_pku_image ne "") { if ($news_item_data_db{disp_mode} == 1) { $fre_pku_comment = qq|

$news_item_data_db{$t_pku_text}

|; } else { $fre_pku_comment = qq|

$news_item_data_db{$t_pku_text}

|; } } else { $fre_pku_comment = qq|
$news_item_data_db{$t_pku_text}
|; } $fre_pku_item_html .= $fre_pku_comment; } } elsif ($news_item_data_db{"pku_text_pos"} eq "left" || $news_item_data_db{"pku_text_pos"} eq "right") { if ($news_item_data_db{$t_pku_item_title} ne "") { if ($news_item_data_db{disp_mode} == 1) { $fre_pku_item_html .= qq|

$news_item_data_db{$t_pku_item_title}

\n|; } else { $fre_pku_item_html .= qq|

$news_item_data_db{$t_pku_item_title}

\n|; } } my $fre_pku_image = ""; if ($pku_img_tmp ne "") { #$pku_img_tmp = qq|
$pku_img_tmp
|; if ($news_item_data_db{$t_pku_item_title} eq "") { if ($news_item_data_db{disp_mode} == 1) { #$fre_pku_image = qq|

$pku_img_tmp

|; $fre_pku_image = qq|

$pku_img_tmp

|; } else { #$fre_pku_image = qq|

$pku_img_tmp

|; $fre_pku_image = qq|

$pku_img_tmp

|; } } else { $fre_pku_image = qq|
$pku_img_tmp
|; } if($news_item_data_db{$t_pku_link} ne "") { $fre_pku_image = qq|${fre_pku_image}|; } $fre_pku_item_html .= $fre_pku_image; } my $fre_pku_comment = ""; if ($news_item_data_db{$t_pku_text} ne "") { $fre_pku_comment = qq|
$news_item_data_db{$t_pku_text}
|; $fre_pku_item_html .= $fre_pku_comment; } } $pku_tmp = <<_HTML_;
$fre_pku_item_html
_HTML_ if ($pku_tmp ne "") { my $phone_class_str = ""; my $tab_class_str = ""; my $pc_class_str = ""; if ($fre_pku_cnt % $news_item_data_db{pku_phone_horizontal_num} == 0) { $phone_class_str = " fre-pku-sm-rtn "; } if ($fre_pku_cnt % $news_item_data_db{pku_tablet_horizontal_num} == 0) { $tab_class_str = " fre-pku-mm-rtn "; } if ($fre_pku_cnt % $news_item_data_db{pku_horizontal_num} == 0) { $pc_class_str = " fre-pku-wm-rtn "; } $fre_pku_html .= qq|
  • $pku_tmp
  • |; $fre_pku_cnt++; } } my $fre_pku_head = ""; if ($news_item_data_db{cuscom_title} ne "") { if ($news_item_data_db{disp_mode} != 0) { $fre_pku_head = qq|

    $news_item_data_db{cuscom_title}

    |; } else { $fre_pku_head = qq|

    $news_item_data_db{cuscom_title}

    |; } } my $fre_pku_contents = ""; $news_item_data_db{pku_contents_text} = &normal_tag_data($news_item_data_db{pku_contents_text}); if ($news_item_data_db{pku_contents_text} ne "") { $fre_pku_contents = qq|
    $news_item_data_db{pku_contents_text}
    |; } my $scroll_anime_val = int($news_item_data_db{$pku_scroll_anime_name}); my $scroll_anime_class_name = ""; if ($scroll_anime_val == 1) { $scroll_anime_class_name = " pku_anime01 "; } elsif ($scroll_anime_val == 2) { $scroll_anime_class_name = " pku_anime01_ex "; } elsif ($scroll_anime_val == 3) { $scroll_anime_class_name = " pku_anime02 "; } elsif ($scroll_anime_val == 4) { $scroll_anime_class_name = " pku_anime02_ex "; } elsif ($scroll_anime_val == 5) { $scroll_anime_class_name = " pku_anime03 "; } elsif ($scroll_anime_val == 6) { $scroll_anime_class_name = " pku_anime03_ex "; } if ($fre_pku_html ne "") { $sub_contents_data = <<_HTML_; $fre_pku_head $fre_pku_contents
      $fre_pku_html
    _HTML_ if ($db01{"plan"} == 24) { $sub_contents_data = qq|
    $sub_contents_data
    |; } } } else { $sub_contents_data = &sub_contents_disp_ex($db01{plan},$contents_num,$icon_upload_check,$news_item_data_db{cuscom_layout},$news_item_data_db{cuscom_title},$news_cuscom_cmt,$add_img_tag,1,"","","","",$ccaption_sub_css_ex); if ($news_item_data_db{disp_mode} != 0) { $sub_contents_data =~ s/.*<\/span>/

    $news_item_data_db{cuscom_title}<\/h3>/; if ($ccaption_sub_min_css_ex == 1) { $sub_contents_data =~ s/class="ccaption_sub([^"]*)"/class="master_ccaption_sub_min ccaption_sub_min$1"/; $sub_contents_data =~ s/class="master_ccaption_sub ccaption_sub([^"]*)"/class="master_ccaption_sub_min ccaption_sub_min$1"/; } else { $sub_contents_data =~ s/class="ccaption_sub([^"]*)"/class="ccaption_sub_min$1"/; } } else { $sub_contents_data =~ s/.*<\/span>/

    $news_item_data_db{cuscom_title}<\/h2>/; } } $add_html .= $sub_contents_data; $contents_num++; } } $paste_str{"BODY"} = <<_HTML_;

    \"$cover_news_midashi_title\"

    $rss_link

    $social_str
    $time_title
    $news_str $add_html
    _HTML_ #2010_06_03ニュースバーのカスタマイズ画像を可能とする修正ここまで↑ $meta_desc = "ニュース|".$db01{meta_desc}; $meta_kwd = "ニュース,".$db01{meta_kwd}; if ($db10{news_meta_desc} ne "") { $meta_desc = $db10{news_meta_desc}; } if ($db10{news_meta_kwd} ne "") { $meta_kwd = $db10{news_meta_kwd}; } $meta_desc = &normal_metadesc($meta_desc); $meta_kwd = &normal_metakey($meta_kwd); $paste_str{"meta_desc_tmp"} = $meta_desc; $paste_str{'meta'} = <<_HTML_; _HTML_ $pge_title = $db01{"title"}. '|ニュース'; if ($db10{news_pge_title} ne "") { $pge_title = $db10{news_pge_title}; } elsif ($db10{news_title} ne "") { $pge_title = $db10{news_title}; } $qrexfile = "../../townguide/userimage/${area}/$in{userid}\_1\_0\.png"; if( (int($db01{"basehtmlfile"}) > 0) && (-f $qrexfile) ) { $paste_str{"qrcode_image"} = <<_HTML_; QR-Code _HTML_ } if ($subdomain == 1) { $link_url = ""; } else { if (&check_top_user($db01{username})) { $link_url = ""; } else { $link_url = "../../$db01{username}"; } } if ($db01{plan} == 24) { if (int($db10{"news_master_layout"}) == 0) { $paste_str{"BODY"} = qq|
    $paste_str{"BODY"}
    |; } $paste_str{"BODY"} = qq|
    $paste_str{"BODY"}
    |; } $paste_str{"h1_disp_title_comment"} = "___h1_title_none___"; $paste_str{"h1_disp_title"} = ""; print "Content-type: text/html\n\n"; &write_cmn00( conn=>$conn,id=>$in{userid},table=>$table_area{db01},param=>"paste_str",link_url=>$link_url,sp_type=>$sp_type,type=>'cgi:'.$out,title=>$pge_title,type_css=>$css_file); exit; } sub all { # 記事全体の表示 my @sortdata,$time_title,$news_title; local ($id) = $in{userid}; my $out = "news"; my $css_file = "/cgi-local/news/news_css.cgi?uid=$in{userid}&act=list"; $total_width = 690; $total_width = &get_document_width($db01{"plan"}, $db01{"do_top_free_rmenuarea_all"}, $db01{"do_top_free_menuarea_dist"}); if ($db01{plan} == 20) { $total_width = &get_custom_plan_document_width($db01{custom_plan_document},$db01{custom_plan_document_width},$db01{custom_plan_menu_width},$db01{custom_plan_document_margin_size},$db01{custom_plan_document_side_margin_size},$db01{custom_plan_menu_position},$db01{custom_plan_menu_disp_mode}); } ($omit_num,$omit_num2,$omit_num3,$total_width_tmp) = &omit_check($total_width,int($db01{"plan"}),int($db01{news_disp_type})); if (int($db02{news_title_length}) != 0) { $omit_num = int($db02{news_title_length}) +1; } if (int($db02{news_comment_length}) != 0) { $omit_num2 = int($db02{news_comment_length}) +1; $omit_num3 = int($db02{news_comment_length}) +1; } # ulの余白分をマイナスする。 $total_width -= 35; my ($n_year) = (localtime(time))[5]; $n_year += 1900; my ($pasttime) = 0; my $filename = "../../contents/$area/$db01{username}/.htaccess"; my $lastmodified = (stat $filename)[9]; my $update_time = int(timelocal(0,15,17,3,1,115)); my $title_sub = ""; if ($in{year} != 0) { $title_sub = "|$in{year}年"; if ($in{year} < (1900) || $in{year} >= ($n_year+1)) { &error2("該当する記事はありません。"); } } my ($n_min,$n_hour,$n_mday, $n_mon, $n_year) = (localtime(time))[1,2,3,4,5]; my $now_time = int(timelocal(59,$n_min,$n_hour,$n_mday,$n_mon,$n_year)); my($sql10) = ""; $and_ssl = ""; if (int($in{category}) != 0) { $and_ssl = " and news_category_select = $in{category} "; } if (int($in{year}) > 1900 && int($in{year}) < 2037) { $search_year = int($in{year}) - 1900; $search_min_time = int(timelocal(0,0,0,1,0,$search_year)); $next_year = $search_year + 1; $search_max_time = int(timelocal(0,0,0,1,0,$next_year)); #$sql10 ="select * from $table_area{db10} where userid=$id and fr_id = 0 and time >= $search_min_time and time < $search_max_time and time <= $now_time " . $and_ssl . " order by time DESC limit $newsregistmax;"; $sql10 ="select * from $table_area{db10} where userid=$id and time >= $search_min_time and time < $search_max_time and time <= $now_time " . $and_ssl . " order by time DESC limit $newsregistmax;"; } else { #SQLの実行 #$sql10 ="select * from $table_area{db10} where userid=$id and fr_id = 0 and time <= $now_time " . $and_ssl ." order by time DESC limit $newsregistmax;"; $sql10 ="select * from $table_area{db10} where userid=$id and time <= $now_time " . $and_ssl ." order by time DESC limit $newsregistmax;"; } #SQLの実行 eval { $result10 = &pg_exec($conn,$sql10); }; if($@) { &error("SQL文エラー($sql10)".$@); } $n = $result10->ntuples; $sel_cnt = 0; for ($i = 1; $i <= 10; $i++) { $name_tmp = "news_category${i}_name"; if ($db02{$name_tmp} ne "") { $sel_cnt++; } } if ($sel_cnt == 0) { $year_category_html = qq|"; } else { $year_category_html = qq|"; } if ($lastmodified < $update_time) { # htaccessが最新版になっていない場合、年代別絞込は無し。 $year_category_html = ""; } #2010_06_02ニュースバーのカスタマイズ画像を可能とする修正ここから↓ my ($whats_custom,$extfile_bar); $news_rss_imgname = "/image/rss/rss-0.gif"; $news_img_width = 36; $news_img_height = 14; if($db02{news_rss_imgname} ne "" && int($db02{news_rss_imgnum}) != 0) { $news_rss_imgname = "/image/rss/$db02{news_rss_imgname}"; $news_img_width = 18; $news_img_height = 18; } $rss_link = qq|rss|; if (int($db02{"news_rss_flg"}) == 1) { $rss_link = ""; $rss_link_onbar = qq|
    rss
    |; } $whats_custom = "/image/whats/$db02{cover_news_select}"; $extfile_bar = "$userimage$db02{cover_news_select_custom}"; $newsbar1_img_height = 21; if ($db02{'cover_news_is_custom'} eq '1' && -f $extfile_bar) { $whats_custom = "/userimage/$db02{cover_news_select_custom}"; &getsize("$extfile_bar"); $newsbar1_img_height = $PICINFO{'height'}; } $extfile_list_bar = "$userimage$db02{cover_news_list_select_custom}"; if ($db02{'cover_news_list_is_custom'} eq '1' && -f $extfile_list_bar) { $whats_custom = "/userimage/$db02{cover_news_list_select_custom}"; &getsize("$extfile_list_bar"); $newsbar1_img_height = $PICINFO{'height'}; } $paste_str{"BODY"} = <<_HTML_;

    \"ニュース\"

    $rss_link
    一覧表示
    ${year_category_html}

      _HTML_ #2010_06_03ニュースバーのカスタマイズ画像を可能とする修正ここまで↑ my $newsprog_html = ""; for($i=0;$i<$n;$i++){ %ss = &result_to_array($result10,$i); $coment_parts_tmp =$ss{news_comment}; $time_title = ""; if (int($db02{news_time_type}) == 0) { $time_title = &getdate($ss{time},4); } elsif (int($db02{news_time_type}) == 1) { $time_title = &getdate($ss{time},5); } elsif (int($db02{news_time_type}) == 2) { $time_title = &getdate($ss{time},8); } else { $time_title = &getdate($ss{time},7); } if ($ss{news_category_select} != 0) { my $cate_disp_day_tmp = "news_category$ss{news_category_select}_disp_day"; my $disp_after_day = int($db02{$cate_disp_day_tmp}); if (&getNewsDispCheck($ss{time},$disp_after_day) == 0) { $cate_name_tmp = "news_category$ss{news_category_select}_name"; $news_category_select = "$db02{$cate_name_tmp}"; $time_title .= " " . $news_category_select; } } #$news_title = &auto_cut($ss{news_title},$omit_num); $news_title = $ss{news_title}; $news_title =~ s/\\,/,/g; $news_title =~ s/\\\\/\\/g; $coment_parts=&normal_tag_data($coment_parts_tmp); $coment_parts=~ s/\\\,/,/g; $coment_parts=~ s/<br>//g; $coment_parts=~ s/\n//g; $coment_parts =~ s///g; $coment_parts =~ s/<.*?>//g; if(($ss{news_view_thumb} ne "") && ($ss{news_layout} ne "noimg")){ $coment_parts2 = &auto_cut($coment_parts,$omit_num2); } else { $coment_parts2 = &auto_cut($coment_parts,$omit_num3); } if ($coment_parts2 eq "") { $coment_parts2 = " "; } # ニュースリンク作成 #$newsprog_html = "/news/news_i$ss{id}_u$ss{userid}.html";#### サムネイルファイル指定 $newsprog_html = "/news/news-i$ss{id}-u$ss{userid}.html";#### サムネイルファイル指定 if ($ss{news_filename} ne "") { $newsprog_html = "/news/$ss{news_filename}"; } my $icon_type_class = ""; if ($db02{news_icon_disp_type} == 0) { if ($db01{master_icon_custom_type} == 0) { $icon_type_class = " class='at-icon-disc' "; } elsif ($db01{master_icon_custom_type} == 1) { $icon_type_class = " class='at-icon-arrow' "; } elsif ($db01{master_icon_custom_type} == 2) { $icon_type_class = " class='at-icon-arrow2' "; } } elsif ($db02{news_icon_disp_type} == 2) { if ($db02{news_icon_custom_type} == 0) { $icon_type_class = " class='at-icon-disc' "; } elsif ($db02{news_icon_custom_type} == 1) { $icon_type_class = " class='at-icon-arrow' "; } elsif ($db02{news_icon_custom_type} == 2) { $icon_type_class = " class='at-icon-arrow2' "; } } else { $icon_type_class = " class='at-icon-none' "; } #### サムネイルファイル指定 #if (int($db01{news_disp_type}) ==1){ if (int($db01{news_disp_type}) >= 1 && int($db01{news_disp_type}) != 7 && int($db01{news_disp_type}) != 8 && int($db01{news_disp_type}) != 9 && int($db01{news_disp_type}) != 10){ $coment_parts3 = <<_HTML_;
      $coment_parts2
      _HTML_ if(($ss{news_view_thumb} ne "") && ($ss{news_layout} ne "noimg")){ $alt_text = ""; if ($ss{news_alt_text} ne "") { $alt_text = " alt=\"$ss{news_alt_text}\" "; } $paste_str{"BODY"} .= <<_HTML_;
    • $coment_parts3

    • _HTML_ }else{ $paste_str{"BODY"} .= <<_HTML_;
    • $coment_parts3

    • _HTML_ } }else{ if (int($db01{news_disp_type} == 7) || int($db01{news_disp_type} == 8) || int($db01{news_disp_type} == 9) || int($db01{news_disp_type} == 10)) { $coment_parts3 = ""; if (int($db01{news_disp_type}) == 9 || int($db01{news_disp_type}) == 10) { $coment_parts3 = <<_HTML_;
      $coment_parts2
      _HTML_ } if(($ss{news_view_thumb} ne "") && ($ss{news_layout} ne "noimg")){ $alt_text = ""; if ($ss{news_alt_text} ne "") { $alt_text = " alt=\"$ss{news_alt_text}\" "; } $paste_str{"BODY"} .= <<_HTML_;
    • $time_title
      $coment_parts3

    • _HTML_ }else{ $paste_str{"BODY"} .= <<_HTML_;
    • $time_title
      $coment_parts3

    • _HTML_ _HTML_ } } else { #旧タイプ $paste_str{"BODY"} .= "
    • \n"; } } } if ($subdomain == 1) { $toplink = "/index.html"; } else { # 一つのユーザをドキュメントルートとして使用している場合 if (&check_top_user($db01{username})) { $toplink = "../../index.html"; } else { $toplink = "../../$db01{username}/index.html"; } } if ($n == 0) { $paste_str{"BODY"} .= "記事はありません。"; } $paste_str{"BODY"} .= <<_HTML_;
    _HTML_ #$width_css = ""; #if ((int($db01{"plan"}) >= 7)) { # $width_css = "width:${total_width}px;"; #} $meta_desc = "ニュース一覧|".$db01{meta_desc}; $meta_kwd = "ニュース一覧,".$db01{meta_kwd}; $meta_desc = &normal_metadesc($meta_desc); $meta_kwd = &normal_metakey($meta_kwd); $paste_str{'meta'} = <<_HTML_; _HTML_ $qrexfile = "../../townguide/userimage/${area}/$in{userid}\_1\_0\.png"; if( (int($db01{"basehtmlfile"}) > 0) && (-f $qrexfile) ) { $paste_str{"qrcode_image"} = <<_HTML_; QR-Code _HTML_ } if ($subdomain == 1) { $link_url = ""; } else { # 一つのユーザをドキュメントルートとして使用している場合 if (&check_top_user($db01{username})) { $link_url = ""; } else { $link_url = "../../$db01{username}"; } } if ($db01{plan} == 24) { if (int($db02{"news_area_layout"}) == 0 && int($db02{"news_area_max_width"}) != 0) { $paste_str{"BODY"} = qq|
    $paste_str{"BODY"}
    |; } else { $paste_str{"BODY"} = qq|
    $paste_str{"BODY"}
    |; } } $paste_str{"h1_disp_title_comment"} = "___h1_title_none___"; $paste_str{"h1_disp_title"} = ""; print "Content-type: text/html\n\n"; &write_cmn00( conn=>$conn,id=>$id,table=>$table_area{db01},param=>"paste_str",link_url=>$link_url,type=>'cgi:'.$out,title=>$db01{"title"}. $title_sub. '|ニュース一覧',type_css=>$css_file); exit; } sub error { $error = $_[0]; my $printstr = <<"_HTML_"; エラー

    エラー


    $error

    ブラウザの戻るボタンで前の画面に戻ってください。


    _HTML_ my $myEnStr = encode_utf8($printstr); print "Status: 404 Not Found\n"; print "Content-type: text/html\n\n"; print $myEnStr; exit; } sub error2 { $error = $_[0]; if ($subdomain == 1) { $toplink = "/index.html"; } else { # 一つのユーザをドキュメントルートとして使用している場合 if (&check_top_user($db01{username})) { $toplink = "../../index.html"; } else { $toplink = "../../$db01{username}/index.html"; } } $paste_str{"BODY"} = <<_HTML_;


    $error
    _HTML_ $paste_str{'meta'}=""; $paste_str{"style_sheet"} = <<_HTML_; ul.news { line-height:1.5em; padding:2px 5px; margin:2px 5px 2px 20px; list-style-image:URL(/image/icon/$db01{menu_icon}) } div.cvlay { text-align:center; padding-top:1em; padding-bottom:1em; } _HTML_ $qrexfile = "../../townguide/userimage/${area}/$in{userid}\_1\_0\.png"; if( (int($db01{"basehtmlfile"}) > 0) && (-f $qrexfile) ) { $paste_str{"qrcode_image"} = <<_HTML_; QR-Code _HTML_ } if ($subdomain == 1) { $link_url = ""; } else { # 一つのユーザをドキュメントルートとして使用している場合 if (&check_top_user($db01{username})) { $link_url = ""; } else { $link_url = "../../$db01{username}"; } } if ($db01{plan} == 24) { $paste_str{"BODY"} = qq|
    $paste_str{"BODY"}
    |; } print "Content-type: text/html\n\n"; &write_cmn00( conn=>$conn,id=>$in{userid},table=>$table_area{db01},param=>"paste_str",link_url=>$link_url,type=>'print',title=>$db01{"title"}. '|ニュース'); exit; }