logInfo('[site] Site view start. "'.blogn_CleanHtml($_SERVER['REMOTE_HOST']).'", "'.blogn_CleanHtml($_SERVER['HTTP_USER_AGENT']).'"'); //-------------------------------------------------------------------- アクセス禁止処理 if (!blogn_mod_db_ip_check($_SERVER["REMOTE_ADDR"])) { header("HTTP/1.0 404 Not Found"); exit; } $accessLog->logDebug('[site] blogn_mod_db_ip_check clear in '.__FILE__.' on line '.__LINE__); /* ===== セッションスタート ===== */ session_set_cookie_params(BLOGN_SESSION_TIME, BLOGN_REQUESTDIR); session_start(); $accessLog->logDebug('[site] Session start in '.__FILE__.' on line '.__LINE__); //-------------------------------------------------------------------- ログイン処理 /* ===== 認証 ===== */ $blogn_login_error = ""; if (isset($_POST["blogn_login"])) { if (preg_match("/Logout/", $_POST["blogn_login"])) { $objBlognPlus = new classBlognPlusObject(); $objBlognPlus->logout(); }elseif (preg_match("/Login/", $_POST["blogn_login"])) { $objBlognPlus = new classBlognPlusObject(); if (!$objBlognPlus->is_login) $blogn_login_error = "ERROR"; } }else{ $objBlognPlus = new classBlognPlusObject(); } if ($objBlognPlus->is_login) { $blogn_user = true; }else{ $blogn_user = false; } $accessLog->logDebug('[site] login check clear in '.__FILE__.' on line '.__LINE__); //-------------------------------------------------------------------- 携帯投稿処理 /* 携帯投稿用デバッグ処理 */ $blogn_mobile_debug = ""; $mobile_users = blogn_mod_db_mobile_access(); if ($mobile_users[0]) { $accessLog->logDebug('[site] connect mobile post mail in '.__FILE__.' on line '.__LINE__); blogn_mobile_blog_new($mobile_users[1]); }else{ $accessLog->logDebug('[site] waiting mobile post mail in '.__FILE__.' on line '.__LINE__); } //-------------------------------------------------------------------- URLリクエスト function blogn_mod_rewrite() { if(isset($_SERVER['PATH_INFO'])) { $url = substr($_SERVER['PATH_INFO'],1); $url = explode('/',$url); foreach ($url as $key =>$value) { if ($value) { list($id, $val) = explode('_',$value); $querystring[] = $id.'='.$val; $_GET[$id] = $val; } } $_SERVER['QUERY_STRING'] = implode("&",$querystring); $_SERVER['PHP_SELF'] = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '.php') + 4); $_SERVER['REQUEST_URI'] = $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; } } if (BLOGN_REWRITE) blogn_mod_rewrite(); //-------------------------------------------------------------------- 入力チェック $blogn_get_s = isset($_GET['s']) ? htmlspecialchars(strip_tags($_GET['s'])) : ''; $blogn_get_e = is_numeric(@$_GET['e']) ? $_GET['e'] : ''; $blogn_get_m = is_numeric(@$_GET['m']) ? $_GET['m'] : ''; $blogn_get_d = is_numeric(@$_GET['d']) ? $_GET['d'] : ''; $blogn_get_p = is_numeric(@$_GET['p']) ? $_GET['p'] : ''; $blogn_get_u = is_numeric(@$_GET['u']) ? $_GET['u'] : ''; $blogn_get_c = isset($_GET['c']) ? htmlspecialchars(strip_tags($_GET['c'])) : ''; $blogn_get_page = is_numeric(@$_GET['page']) ? $_GET['page'] : ''; $blogn_get_token = isset($_POST['blogn_token']) ? htmlspecialchars(strip_tags($_POST['blogn_token'])) : ''; $blogn_get_mode = isset($_GET['mode']) ? htmlspecialchars(strip_tags($_GET['mode'])) : ''; $blogn_post_mode = isset($_POST['mode']) ? htmlspecialchars(strip_tags($_POST["mode"])) : ''; if (isset($_POST['blogn_cid'])) { $blogn_post_cid = is_numeric(@$_POST['blogn_cid'])? $_POST['blogn_cid'] : ""; }elseif (isset($_POST['c_eid'])) { $blogn_post_cid = is_numeric(@$_POST['c_eid']) ? $_POST['c_eid'] : ""; }else{ $blogn_post_cid = ""; } if (isset($_POST['blogn_cname'])) { $blogn_post_cname = htmlspecialchars(strip_tags($_POST['blogn_cname'])); // コメントエラー時に名前を保持できるようにする $_SESSION['cmtname'] = $blogn_post_cname; }elseif (isset($_POST['c_name'])) { $blogn_post_cname = htmlspecialchars(strip_tags($_POST['c_name'])); // コメントエラー時に名前を保持できるようにする $_SESSION['cmtname'] = $blogn_post_cname; }else{ $blogn_post_cname = ""; } if (isset($_POST['blogn_cemail'])) { $blogn_post_cemail = htmlspecialchars(strip_tags($_POST['blogn_cemail'])); // コメントエラー時にメールアドレスを保持できるようにする $_SESSION['cmtemail'] = $blogn_post_cemail; }elseif (isset($_POST['c_email'])) { $blogn_post_cemail = htmlspecialchars(strip_tags($_POST['c_email'])); // コメントエラー時にメールアドレスを保持できるようにする $_SESSION['cmtemail'] = $blogn_post_cemail; }else{ $blogn_post_cemail = ""; } if (isset($_POST['blogn_curl'])) { $blogn_post_curl = htmlspecialchars(strip_tags($_POST['blogn_curl'])); // コメントエラー時にURLを保持できるようにする $_SESSION['cmturl'] = $blogn_post_curl; }elseif (isset($_POST['c_url'])) { $blogn_post_curl = htmlspecialchars(strip_tags($_POST['c_url'])); // コメントエラー時にURLを保持できるようにする $_SESSION['cmturl'] = $blogn_post_curl; }else{ $blogn_post_curl = ""; } if (isset($_POST['blogn_cmes'])) { $blogn_post_cmes = htmlspecialchars(strip_tags($_POST['blogn_cmes'])); // コメントエラー時にコメント内容を保持できるようにする $_SESSION['cmtmes'] = $blogn_post_cmes; }elseif (isset($_POST['c_mes'])) { $blogn_post_cmes = htmlspecialchars(strip_tags($_POST['c_mes'])); // コメントエラー時にコメント内容を保持できるようにする $_SESSION['cmtmes'] = $blogn_post_cmes; }else{ $blogn_post_cmes = ""; } $blogn_post_set_cookie = isset($_POST['set_cookie']) ? htmlspecialchars(strip_tags($_POST['set_cookie'])) : ''; $blogn_server_remode_addr = htmlspecialchars(strip_tags($_SERVER["REMOTE_ADDR"])); $blogn_server_http_user_agent = htmlspecialchars(strip_tags($_SERVER["HTTP_USER_AGENT"])); $blogn_server_http_referer = htmlspecialchars(strip_tags($_SERVER["HTTP_REFERER"])); //-------------------------------------------------------------------- URLリクエスト if ($blogn_post_mode == "comment") { $blogn_view_mode = "mode"; }else{ $blogn_view_mode = $blogn_qry_data = ''; if ($blogn_qry = strip_tags($_SERVER['QUERY_STRING'])) { list($blogn_view_mode, $blogn_qry_data,) = explode("=", $blogn_qry, 2); } } //-------------------------------------------------------------------- スキン選択処理 $blogn_entry_flag = $blogn_date_flag = $blogn_user_flag = $blogn_category_flag = ''; if ($blogn_get_e != "") $blogn_entry_flag = $blogn_get_e; if ($blogn_get_m != "") $blogn_date_flag = $blogn_get_m; if ($blogn_get_d != "") $blogn_date_flag = $blogn_get_d; if ($blogn_get_p != "") $blogn_user_flag = $blogn_get_p; if ($blogn_get_u != "") $blogn_user_flag = $blogn_get_u; if ($blogn_get_c != "") { if (preg_match("/-/", $blogn_get_c)) { $blogn_category_flag = str_replace("-", "|", $blogn_get_c); }else{ $blogn_category_flag = $blogn_get_c."|"; } } $blogn_skin = blogn_skin_selector($blogn_view_mode, $blogn_entry_flag, $blogn_date_flag, $blogn_user_flag, $blogn_category_flag, $blogn_server_http_user_agent); $accessLog->logDebug('[site] blogn skin select clear in '.__FILE__.' on line '.__LINE__); if (!$blogn_skin) { $error = "表示するスキンが登録されていません。"; header("Content-Type: text/html; charset=UTF-8"); echo $error; exit; } //-------------------------------------------------------------------- モジュール処理 $blogn_loaded_modules = blogn_mod_db_module_load(); // インストール済モジュールの読み込み $blogn_modules = blogn_module_load(); // moduleディレクトリにあるモジュール全て読み込み if ($blogn_loaded_modules[0]) { reset($blogn_loaded_modules[1]); while(list($key, $val) = each($blogn_loaded_modules[1])) { if (BLOGN_MOBILE_KEY == 0) { // pc if ($val["pc"]) { $blogn_function_load = true; }else{ $blogn_function_load = false; } }elseif (BLOGN_MOBILE_KEY == 1) { // mobile if ($val["mobile"]) { $blogn_function_load = true; }else{ $blogn_function_load = false; } } if ($blogn_function_load) { if ($blogn_modules[1][$key]["index_function"]) { include(BLOGN_MODDIR.$key."/".$blogn_modules[1][$key]["index_function"]); } } } reset($blogn_loaded_modules[1]); while(list($key, $val) = each($blogn_loaded_modules[1])) { if (BLOGN_MOBILE_KEY == 0) { // pc if ($val["pc"]) { $blogn_function_load = true; }else{ $blogn_function_load = false; } }elseif (BLOGN_MOBILE_KEY == 1) { // mobile if ($val["mobile"]) { $blogn_function_load = true; }else{ $blogn_function_load = false; } } if ($blogn_function_load) { if ($blogn_modules[1][$key]["viewer"]) { include(BLOGN_MODDIR.$key."/".$blogn_modules[1][$key]["viewer"]); } } } } //-------------------------------------------------------------------- 表示処理 $blogn_skin = preg_replace ("/\{HOMELINK\}/", BLOGN_HOMELINK , $blogn_skin); $blogn_skin = preg_replace ("/\{SITENAME\}/", BLOGN_SITENAME , $blogn_skin); $blogn_skin = preg_replace ("/\{SITEDESC\}/", BLOGN_SITEDESC , $blogn_skin); $blogn_skin = preg_replace ("/\{VERSION\}/", BLOGN_VERSION , $blogn_skin); if ($blogn_user) { $blogn_skin = preg_replace ("/\{LOGMODE\}/", "Logout" , $blogn_skin); }else{ $blogn_skin = preg_replace ("/\{LOGMODE\}/", "Login" , $blogn_skin); } if ($blogn_user) { $blogn_skin = preg_replace("/\{LOGINUSER\}/", "ログインモード", $blogn_skin); }else{ $blogn_skin = preg_replace("/\{LOGINUSER\}/", "ゲストモード", $blogn_skin); } $blogn_skin = preg_replace("/\{LOGINERROR\}/", $blogn_login_error, $blogn_skin); if ($blogn_get_page != "") { $blogn_qry_page = $blogn_get_page; }else{ $blogn_qry_page = 1; } /* メイン表示 */ switch ($blogn_view_mode) { case "s": $blogn_qry_search = $blogn_get_s; $blogn_skin = str_replace ("{SITETITLE}", "サイト内検索結果::".BLOGN_SITENAME , $blogn_skin); $blogn_skin = preg_replace("/\{PROFILES\}[\w\W]+?\{\/PROFILES\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{LOG\}[\w\W]+?\{\/LOG\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{NEXTPAGE[\w\W]*?\}[\w\W]+?\{\/NEXTPAGE\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{BACKPAGE[\w\W]*?\}[\w\W]+?\{\/BACKPAGE\}/", "", $blogn_skin); $blogn_skin = blogn_search_log($blogn_user, $blogn_skin, $blogn_qry_search); break; case "p": $blogn_user_name = blogn_mod_db_user_profile_load($blogn_get_p); $blogn_skin = str_replace ("{SITETITLE}", $blogn_user_name["name"]."のプロフィール::".BLOGN_SITENAME , $blogn_skin); $blogn_skin = preg_replace("/\{SEARCH\}[\w\W]+?\{\/SEARCH\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{LOG\}[\w\W]+?\{\/LOG\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{NEXTPAGE[\w\W]*?\}[\w\W]+?\{\/NEXTPAGE\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{BACKPAGE[\w\W]*?\}[\w\W]+?\{\/BACKPAGE\}/", "", $blogn_skin); $blogn_skin = blogn_profile_log($blogn_skin, $blogn_get_p); break; case "m": $blogn_month = $blogn_get_m; $blogn_skin = str_replace ("{SITETITLE}", substr($blogn_get_m,0,4)."年".substr($blogn_get_m,4,2)."月::".BLOGN_SITENAME , $blogn_skin); $blogn_skin = preg_replace("/\{SEARCH\}[\w\W]+?\{\/SEARCH\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{PROFILES\}[\w\W]+?\{\/PROFILES\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{COMMENT\}[\w\W]+?\{\/COMMENT\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{TRACKBACK\}[\w\W]+?\{\/TRACKBACK\}/", "", $blogn_skin); $blogn_skin = blogn_view($blogn_user, $blogn_skin, $blogn_qry_page, "month", $blogn_month); break; case "d": $blogn_day = $blogn_get_d; $blogn_skin = str_replace ("{SITETITLE}", substr($blogn_get_d,0,4)."年".substr($blogn_get_d,4,2)."月".substr($blogn_get_d,6,2)."日::".BLOGN_SITENAME , $blogn_skin); $blogn_skin = preg_replace("/\{SEARCH\}[\w\W]+?\{\/SEARCH\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{PROFILES\}[\w\W]+?\{\/PROFILES\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{COMMENT\}[\w\W]+?\{\/COMMENT\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{TRACKBACK\}[\w\W]+?\{\/TRACKBACK\}/", "", $blogn_skin); $blogn_skin = blogn_view($blogn_user, $blogn_skin, $blogn_qry_page, "day", $blogn_day); break; case "c": $blogn_category = $blogn_get_c; $blogn_skin = preg_replace("/\{SEARCH\}[\w\W]+?\{\/SEARCH\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{PROFILES\}[\w\W]+?\{\/PROFILES\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{COMMENT\}[\w\W]+?\{\/COMMENT\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{TRACKBACK\}[\w\W]+?\{\/TRACKBACK\}/", "", $blogn_skin); $blogn_skin = blogn_view($blogn_user, $blogn_skin, $blogn_qry_page, "category", $blogn_category); break; case "u": $blogn_user_id = $blogn_get_u; $blogn_skin = preg_replace("/\{SEARCH\}[\w\W]+?\{\/SEARCH\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{PROFILES\}[\w\W]+?\{\/PROFILES\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{COMMENT\}[\w\W]+?\{\/COMMENT\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{TRACKBACK\}[\w\W]+?\{\/TRACKBACK\}/", "", $blogn_skin); $blogn_skin = blogn_view($blogn_user, $blogn_skin, $blogn_qry_page, "user", $blogn_user_id); break; case "e": $blogn_entry_id = $blogn_get_e; $blogn_skin = preg_replace("/\{SEARCH\}[\w\W]+?\{\/SEARCH\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{PROFILES\}[\w\W]+?\{\/PROFILES\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{COMMENTLIST\}[\w\W]+?\{\/COMMENTLIST\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{COMMENTNEW\}[\w\W]+?\{\/COMMENTNEW\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{TRACKBACKLIST\}[\w\W]+?\{\/TRACKBACKLIST\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{TRACKBACKNEW\}[\w\W]+?\{\/TRACKBACKNEW\}/", "", $blogn_skin); $blogn_skin = blogn_entry_view($blogn_user, $blogn_skin, $blogn_entry_id); break; case "mode": if ($blogn_get_mode == "comment" || $blogn_post_mode == "comment") { blogn_input_comment($blogn_user, $blogn_post_cid, $blogn_post_cname, $blogn_post_cemail, $blogn_post_curl, $blogn_post_cmes, $blogn_post_set_cookie, $blogn_server_remode_addr, $blogn_server_http_user_agent, $blogn_server_http_referer, $blogn_get_token); exit; }elseif ($blogn_get_mode == "rss") { header("Content-Type: application/xml; charset=UTF-8"); blogn_rss_view($blogn_user); exit; }else{ exit; } break; default: $blogn_skin = str_replace ("{SITETITLE}", BLOGN_SITENAME, $blogn_skin); $blogn_skin = preg_replace("/\{SEARCH\}[\w\W]+?\{\/SEARCH\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{PROFILES\}[\w\W]+?\{\/PROFILES\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{COMMENT\}[\w\W]+?\{\/COMMENT\}/", "", $blogn_skin); $blogn_skin = preg_replace("/\{TRACKBACK\}[\w\W]+?\{\/TRACKBACK\}/", "", $blogn_skin); $blogn_skin = blogn_view($blogn_user, $blogn_skin, $blogn_qry_page, "normal", ""); break; } $blogn_token = blogn_make_token('blogn_index_token'); $blogn_skin = str_replace ("{TOKEN}", $blogn_token, $blogn_skin); //-------------------------------------------------------------------- HTML出力処理 $blogn_timeend = explode(" ",microtime()); $blogn_times = ($blogn_timeend[0] - $blogn_timestart[0]) + ($blogn_timeend[1] - $blogn_timestart[1]); $blogn_timeattack = "処理時間 ".$blogn_times."秒"; $blogn_skin = preg_replace ("/\{TIMEATTACK\}/", $blogn_timeattack, $blogn_skin); $blogn_skin = preg_replace("/
/i", "
", $blogn_skin); // brタグの後ろに改行コードを入れる $blogn_skin = preg_replace("/
/i", "
\n", $blogn_skin); if (BLOGN_MOBILE_KEY == 0) { switch (BLOGN_CHARSET) { case "0": // Shift_JIS表示 $blogn_skin = preg_replace ("/\{CHARSET\}/", "Shift_JIS" , $blogn_skin); $blogn_skin = blogn_mbConv($blogn_skin,4,2); break; case "1": // EUC-JP表示 $blogn_skin = preg_replace ("/\{CHARSET\}/", "EUC-JP" , $blogn_skin); $blogn_skin = blogn_mbConv($blogn_skin,4,1); break; case "2": // UFT-8表示 $blogn_skin = preg_replace ("/\{CHARSET\}/", "UTF-8" , $blogn_skin); break; } }else{ $blogn_skin = blogn_mbConv($blogn_skin, 4, 2); } if (BLOGN_REWRITE) { // ▼静的生成変換。ここから▼▼------------------------------------ $blogn_skin = preg_replace("/\"index\.php\?c=([0-9-]+)&page=([0-9]+)/","\"".BLOGN_HOMELINK."index.php/c_\\1/page_\\2/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?m=([0-9]+)&page=([0-9]+)/","\"".BLOGN_HOMELINK."index.php/m_\\1/page\\2/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?d=([0-9]+)&page=([0-9]+)/","\"".BLOGN_HOMELINK."index.php/d_\\1/page_\\2/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?u=([0-9]+)&page=([0-9]+)/","\"".BLOGN_HOMELINK."index.php/u_\\1/page_\\2/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?e=([0-9]+)/","\"".BLOGN_HOMELINK."index.php/e_\\1/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?c=([0-9-]+)/","\"".BLOGN_HOMELINK."index.php/c_\\1/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?m=([0-9]+)/","\"".BLOGN_HOMELINK."index.php/m_\\1/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?d=([0-9]+)/","\"".BLOGN_HOMELINK."index.php/d_\\1/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?p=([0-9]+)/","\"".BLOGN_HOMELINK."index.php/p_\\1/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?u=([0-9]+)/","\"".BLOGN_HOMELINK."index.php/u_\\1/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?page=([0-9]+)/","\"".BLOGN_HOMELINK."index.php/page_\\1/",$blogn_skin); $blogn_skin = preg_replace("/\"index\.php\?mode=comment/","\"".BLOGN_HOMELINK."index.php/mode_comment/",$blogn_skin); $blogn_skin = preg_replace("/\"[\.]+[\/]+index\.php/","\"".BLOGN_HOMELINK."index.php",$blogn_skin); $blogn_skin = str_replace("\"images/", "\"".BLOGN_HOMELINK."images/", $blogn_skin); // ▲静的生成変換。ここまで▲▲------------------------------------ } blogn_get_skin_php($blogn_skin); $accessLog->logDebug('[site] Site view end.'); exit; //-------------------------------------------------------------------- // メインルーチン終わり //-------------------------------------------------------------------- function blogn_mobile_picture_change($log) { if (BLOGN_MOBILE_KEY != 0) { $log = preg_replace_callback('/]+?>]*?src=\"([\w\W]+?)\"[^>]*?><\/a>/i', 'blogn_im_callback', $log); $log = preg_replace_callback('/]*?src=\"([\w\W]+?)\"[^>]*?>/i', 'blogn_im_callback', $log); } return $log; } //-------------------------------------------------------------------- コメント入力処理 function blogn_input_comment($user, $entry_id, $name, $email = "", $url = "", $mes, $set_cookie, $ip, $agent, $referer, $token) { $errflg = false; $utf_name = blogn_mbConv($name, 0, 4); $utf_email = blogn_mbConv($email, 0, 4); $utf_url = blogn_mbConv($url, 0, 4); $utf_mes = blogn_mbConv($mes, 0, 4); $blogn_entry_url = BLOGN_HOMELINK."index.php?e=".$entry_id; if (!$entry_id || !$utf_name || !$utf_mes || !blogn_check_token($token, 'blogn_index_token')) { $link_url = $blogn_entry_url."#comments"; $info = 'コメント投稿エラー[未記入の箇所があるか、不正な投稿です。]

画面が自動的に切り替わらない場合は
こちらをクリックしてください。'; $errflg = true; } if (!$errflg) { $logdata = blogn_mod_db_log_load_for_editor($entry_id); $diffdays = blogn_date_diff($logdata[1]["date"]); if ((BLOGN_LIMIT_COMMENT && BLOGN_LIMIT_COMMENT < $diffdays) || $logdata[1]["comment_ok"] != 1) { //HTTPヘッダ送信 $link_url = $blogn_entry_url."#comments"; $info = 'コメント投稿エラー[コメント投稿制限がかかっています。]

画面が自動的に切り替わらない場合は
こちらをクリックしてください。'; $errflg = true; }else{ if (strlen($utf_mes) > BLOGN_COMMENT_SIZE && BLOGN_COMMENT_SIZE != 0) $utf_mes = blogn_mbtrim($utf_mes,BLOGN_COMMENT_SIZE); if ($user) { $comment = blogn_mod_db_comment_load_for_new(1, 0, 10); }else{ $comment = blogn_mod_db_comment_load_for_new(0, 0, 10); } // 重複投稿チェック if ($comment[0]) { while (list($key, $val) = each($comment[1])) { if ($val["name"] == $utf_name && $val["comment"] == blogn_mod_db_rn2br($utf_mes)) { $link_url = $blogn_entry_url."#comments"; $info = 'コメント投稿エラー[重複した記事を投稿しようとしています。]

画面が自動的に切り替わらない場合は
こちらをクリックしてください。'; $errflg = true; break; } } } } $date = _gmdate("YmdHis",time() + BLOGN_TIMEZONE); $error = blogn_mod_db_comment_add($entry_id, $logdata[1]["secret"], $date, blogn_html_tag_convert($utf_name), blogn_html_tag_convert($utf_email), blogn_html_tag_convert($utf_url), blogn_html_tag_convert($utf_mes), $ip, $agent); } if ($error[0]) { $link_url = $blogn_entry_url."#cmt".$error[2]; $info = 'コメントを投稿しました。

画面が自動的に切り替わらない場合は
こちらをクリックしてください。'; $userlist = blogn_mod_db_user_load(); // コメントが正しく投稿された場合はセッション情報をクリアする $_SESSION['cmtname'] = ""; $_SESSION['cmtemail'] = ""; $_SESSION['cmturl'] = ""; $_SESSION['cmtmes'] = ""; $logdata = blogn_mod_db_log_load_for_editor($entry_id); $sub = "コメントを受信しました"; $sub = blogn_mbConv($sub, 4, 3); $sub = "=?iso-2022-jp?B?".base64_encode($sub)."?="; $mes = "件名:".$logdata[1]["title"]."\n"; $mes .= "投稿者名:".$utf_name."\n"; $mes .= "URL:".$blogn_entry_url."#cmt".$error[2]."\n"; $mes .= "※このメールアドレスには返信しないでください。"; $mes = blogn_mbConv($mes, 4, 3); $from = BLOGN_SITENAME; $from = blogn_mbConv($from, 4, 3); $from = "=?iso-2022-jp?B?".base64_encode($from)."?="; $from = "From: $from \nContent-Type: text/plain; charset=\"iso-2022-jp\""; while (list($key, $val) = each($userlist)) { if ($val['admin'] == "1" || $logdata[1]['user_id'] == $key) { if ($val["information_comment"]) @mail($val["information_mail_address"], $sub, $mes, $from); } } } $errdata = file("./template/info.html"); $errdata = implode("",$errdata); if (BLOGN_CHARSET == 0 || BLOGN_MOBILE_KEY == 1) { $charset = "Shift_JIS"; $outkey = 2; }elseif (BLOGN_CHARSET == 1) { $charset = "EUC-JP"; $outkey = 1; }elseif (BLOGN_CHARSET == 2) { $charset = "UTF-8"; $outkey = 4; } $errdata = str_replace("{META_LINK}", "", $errdata); $errdata = str_replace("{CHARSET}", $charset, $errdata); $errdata = str_replace("{INFO}", $info, $errdata); if ($set_cookie == "on") { setcookie("name", blogn_mbConv($name, 0, 4), time() + BLOGN_TIMEZONE + 604800); setcookie("email", blogn_mbConv($email, 0, 4), time() + BLOGN_TIMEZONE + 604800); setcookie("url", blogn_mbConv($url, 0, 4), time() + BLOGN_TIMEZONE + 604800); } if (BLOGN_REWRITE) $errdata = preg_replace("/index\.php\?e=([0-9]+)/","index.php/e_\\1/",$errdata); header("Content-Type: text/html; charset=$charset"); if ($outkey != 4) $errdata = blogn_mbConv($errdata, 4, $outkey); if ($outkey == 2) $errdata = blogn_magic_quotes($errdata); echo $errdata; exit; } //-------------------------------------------------------------------- 全文検索処理 function blogn_search_log($user, $skin, $search_key) { if (BLOGN_CHARSET != 2) $search_key = blogn_mbConv($search_key, 0, 4); // 全ログデータ検索 if (trim($search_key) != "") { $loglist = blogn_mod_db_log_load_for_viewer($user, 0, 0); preg_match("/\{SEARCHLOOP\}([\w\W]+?)\{\/SEARCHLOOP\}/", $skin, $reg); $search_all = ""; if ($loglist[0]) { while (list($key, $val) = each($loglist[1])) { $tmpbuf = $reg[0]; $tmpbuf = str_replace ("{SEARCHLOOP}", "", $tmpbuf); $tmpbuf = str_replace ("{/SEARCHLOOP}", "", $tmpbuf); $date = _date("Y/m/d H:i:s", mktime(substr($val["date"],8,2),substr($val["date"],10,2),substr($val["date"],12,2),substr($val["date"],4,2), substr($val["date"],6,2), substr($val["date"],0,4))); $search_data = $date.",".$val["title"].",".$val["mes"].",".$val["more"]; if (stristr($search_data, $search_key)) { $foundurl = ''.$val["title"].'('.$date.')'; $tmpbuf = str_replace ("{SEARCHLIST}", $foundurl, $tmpbuf); $search_all .= $tmpbuf; } $cmtlist = blogn_mod_db_comment_load_for_list($val["id"], 0, 0); if ($cmtlist[0]) { while (list($cmtkey, $cmtval) = each($cmtlist[1])) { $tmpbuf = $reg[0]; $tmpbuf = str_replace ("{SEARCHLOOP}", "", $tmpbuf); $tmpbuf = str_replace ("{/SEARCHLOOP}", "", $tmpbuf); $cmtdate = _date("Y/m/d H:i:s", mktime(substr($cmtval["date"],8,2),substr($cmtval["date"],10,2),substr($cmtval["date"],12,2),substr($cmtval["date"],4,2), substr($cmtval["date"],6,2), substr($cmtval["date"],0,4))); $search_data = $cmtdate.",".$cmtval["name"].",".$cmtval["comment"]; if (stristr($search_data, $search_key)) { $foundurl = ''.$val["title"].' ⇒ '.$cmtval["name"].'('.$cmtdate.')'; $tmpbuf = str_replace ("{SEARCHLIST}", $foundurl, $tmpbuf); $search_all .= $tmpbuf; } } } $trklist = blogn_mod_db_trackback_load_for_list($val["id"], 0, 0); if ($trklist[0]) { while (list($trkkey, $trkval) = each($trklist[1])) { $tmpbuf = $reg[0]; $tmpbuf = str_replace ("{SEARCHLOOP}", "", $tmpbuf); $tmpbuf = str_replace ("{/SEARCHLOOP}", "", $tmpbuf); $trkdate = _date("Y/m/d H:i:s", mktime(substr($trkval["date"],8,2),substr($trkval["date"],10,2),substr($trkval["date"],12,2),substr($trkval["date"],4,2), substr($trkval["date"],6,2), substr($trkval["date"],0,4))); $search_data = $trkdate.",".$trkval["name"].",".$trkval["title"].",".$trkval["mes"]; if (stristr($search_data, $search_key)) { $foundurl = ''.$val["title"].' ⇒ '.$trkval["title"].'('.$trkdate.')'; $tmpbuf = str_replace ("{SEARCHLIST}", $foundurl, $tmpbuf); $search_all .= $tmpbuf; } } } } $skin = preg_replace("/\{SEARCHLOOP\}[\w\W]+?\{\/SEARCHLOOP\}/", $search_all, $skin); }else{ $skin = preg_replace("/\{SEARCHLOOP\}[\w\W]+?\{\/SEARCHLOOP\}/", "", $skin); } $skin = preg_replace ("/\{SEARCH\}/", "", $skin); $skin = preg_replace ("/\{\/SEARCH\}/", "", $skin); }else{ $skin = preg_replace("/\{SEARCHLOOP\}[\w\W]+?\{\/SEARCHLOOP\}/", "", $skin); $skin = preg_replace ("/\{SEARCH\}/", "", $skin); $skin = preg_replace ("/\{\/SEARCH\}/", "", $skin); } return $skin; } //-------------------------------------------------------------------- プロフィール表示処理 function blogn_profile_log($skin, $profile_id) { $userdata = blogn_mod_db_user_profile_load($profile_id); preg_match("/\{PROFILES\}([\w\W]+?)\{\/PROFILES\}/", $skin, $reg); $name = get_magic_quotes_gpc() ? stripslashes($userdata["name"]) : $userdata["name"]; //¥を削除 $profile = get_magic_quotes_gpc() ? stripslashes($userdata["profile"]) : $userdata["profile"]; //¥を削除 $profile = blogn_IconStr($profile); $tmpbuf = $reg[0]; $tmpbuf = str_replace ("{PROFILENAME}", $name, $tmpbuf); // br_change チェック if (!$userdata["br_change"]) { $profile = blogn_rntag2rn($profile); $profile = blogn_mobile_picture_change($profile); } $tmpbuf = str_replace ("{PROFILEMES}", $profile, $tmpbuf); $skin = preg_replace("/\{PROFILES\}[\w\W]+?\{\/PROFILES\}/", $tmpbuf, $skin); $skin = preg_replace ("/\{PROFILES\}/", "", $skin); $skin = preg_replace ("/\{\/PROFILES\}/", "", $skin); return $skin; } //-------------------------------------------------------------------- 表示処理(指定ID) function blogn_entry_view($user, $skin, $entry_id) { $skin = preg_replace("/\{LOG\}/", "", $skin); $skin = preg_replace("/\{LOG[ ]+([\w\W]+?)\}/", "", $skin); $skin = preg_replace("/\{\/LOG\}/", "", $skin); $nextbackurl = blogn_mod_db_log_nextback_url($user, $entry_id); if ($nextbackurl[0]) { if ($nextbackurl[1] != -1) { $skin = preg_replace("/\{NEXTPAGE([\w\W]*?)\}([\w\W]+?)\{\/NEXTPAGE\}/", "\\2", $skin); }else{ $skin = preg_replace("/\{NEXTPAGE[\w\W]*?\}[\w\W]+?\{\/NEXTPAGE\}/", "", $skin); } if ($nextbackurl[2] != -1) { $skin = preg_replace("/\{BACKPAGE([\w\W]*?)\}([\w\W]+?)\{\/BACKPAGE\}/", "\\2", $skin); }else{ $skin = preg_replace("/\{BACKPAGE[\w\W]*?\}[\w\W]+?\{\/BACKPAGE\}/", "", $skin); } }else{ $skin = preg_replace("/\{NEXTPAGE[\w\W]*?\}[\w\W]+?\{\/NEXTPAGE\}/", "", $skin); $skin = preg_replace("/\{BACKPAGE[\w\W]*?\}[\w\W]+?\{\/BACKPAGE\}/", "", $skin); } $userlist = blogn_mod_db_user_load(); $category1 = blogn_mod_db_category1_load(); $category2 = blogn_mod_db_category2_load(); $logdata = blogn_mod_db_log_load_for_entory($user, $entry_id); $nowdate = _gmdate("YmdHis",time() + BLOGN_TIMEZONE); preg_match("/\{LOGLOOP\}([\w\W]+?)\{\/LOGLOOP\}/", $skin, $reg); $log_all = ""; if ($logdata[0]) { if (!$logdata[1]["reserve"] || $logdata[1]["reserve"] && $nowdate > $logdata[1]["date"]) { $tmpbuf = $reg[0]; $tmpbuf = str_replace ("{LOGLOOP}", "", $tmpbuf); $tmpbuf = str_replace ("{/LOGLOOP}", "", $tmpbuf); $tmpbuf = blogn_log_list_skin_replace($tmpbuf, $logdata[1]["id"], $logdata[1], $userlist, $category1[1], $category2[1], 0); // 携帯閲覧時はコメント、トラックバックの表示数を新着5件に制限する $vcnt = BLOGN_MOBILE_KEY == 0 ? $vcnt = 0 : $vcnt = 5; // 携帯処理 $vtype = "all"; if ($logdata[1]["comment_ok"]) { $tmpbuf = blogn_comment_new_skin_replace($tmpbuf, $logdata[1]["id"], $vcnt, $vtype, $logdata[1]["date"]); }else{ $tmpbuf = preg_replace("/\{COMMENT\}[\w\W]+?\{\/COMMENT\}/", "", $tmpbuf); } if ($logdata[1]["trackback_ok"]) { $tmpbuf = blogn_trackback_new_skin_replace($tmpbuf, $logdata[1]["id"], $vcnt, $vtype, $logdata[1]["date"]); }else{ $tmpbuf = preg_replace("/\{TRACKBACK\}[\w\W]+?\{\/TRACKBACK\}/", "", $tmpbuf); } $log_all .= $tmpbuf; } $skin = preg_replace("/\{LOGLOOP\}[\w\W]+?\{\/LOGLOOP\}/", $log_all, $skin); $skin = str_replace ("{SITETITLE}", $logdata[1]["title"]."::".BLOGN_SITENAME , $skin); }else{ $skin = preg_replace("/\{LOGLOOP\}[\w\W]+?\{\/LOGLOOP\}/", "", $skin); $skin = str_replace ("{SITETITLE}", "指定した記事は存在しません::".BLOGN_SITENAME , $skin); } return $skin; } //-------------------------------------------------------------------- 表示処理(月/日/カテゴリー/ユーザー) function blogn_view($user, $skin, $qry_page, $mode, $key_id){ $totalentry = blogn_mod_db_log_count_load($user, $mode, $key_id); if (!$totalentry) { $skin = preg_replace("/\{NEXTPAGE[\w\W]*?\}[\w\W]+?\{\/NEXTPAGE\}/", "", $skin); $skin = preg_replace("/\{BACKPAGE[\w\W]*?\}[\w\W]+?\{\/BACKPAGE\}/", "", $skin); $skin = preg_replace("/\{LOG\}[\w\W]+?\{\/LOG\}/", "", $skin); return $skin; } $skin = preg_replace("/\{LOG\}/", "", $skin); $skin = preg_replace("/\{\/LOG\}/", "", $skin); /* 指定記事表示処理 */ if (preg_match ("/\{LOG[ ]+([\w\W]+?)\}/", $skin, $regs)) { $skin = preg_replace("/\{LOG[ ]+([\w\W]+?)\}/", "", $skin); $select_log = explode(",",$regs[1]); }else{ $select_log = ""; } $userlist = blogn_mod_db_user_load(); $category1 = blogn_mod_db_category1_load(); $category2 = blogn_mod_db_category2_load(); if (BLOGN_MOBILE_KEY == 0) { $start_key = BLOGN_LOG_VIEW_COUNT * ($qry_page - 1); $count = BLOGN_LOG_VIEW_COUNT; $maxpage = ceil($totalentry / BLOGN_LOG_VIEW_COUNT); }else{ $start_key = BLOGN_MOBILE_VIEW_COUNT * ($qry_page - 1); $count = BLOGN_MOBILE_VIEW_COUNT; $maxpage = ceil($totalentry / BLOGN_MOBILE_VIEW_COUNT); } $nextpage = $qry_page - 1; $backpage = $qry_page + 1; switch ($mode) { case "month": $url = "?m=".$key_id."&"; $loglist = blogn_mod_db_log_load_for_month($user, $start_key, $count, $key_id, BLOGN_MONTHLY_VIEW_MODE); break; case "day": $url = "?d=".$key_id."&"; $loglist = blogn_mod_db_log_load_for_day($user, $start_key, $count, $key_id); break; case "category": $url = "?c=".$key_id."&"; $loglist = blogn_mod_db_log_load_for_category($user, $start_key, $count, $key_id, BLOGN_CATEGORY_VIEW_MODE); reset($loglist[1]); $logdata = current($loglist[1]); list($c1, $c2) = explode("-", $key_id); $category = $category1[1][$c1]["name"]; if ($c2) $category .= "::".$category2[1][$c2]["name"]; $skin = str_replace ("{SITETITLE}", $category."::".BLOGN_SITENAME , $skin); break; case "user": $url = "?u=".$key_id."&"; $loglist = blogn_mod_db_log_load_for_user($user, $start_key, $count, $key_id); reset($loglist[1]); $logdata = current($loglist[1]); $skin = str_replace ("{SITETITLE}", $userlist[$logdata["user_id"]]["name"]."::".BLOGN_SITENAME , $skin); break; default: $url = "?"; if (!$select_log) { $loglist = blogn_mod_db_log_load_for_viewer($user, $start_key, $count); }else{ $loglist = array(); $i = 0; while(list($key, $val) = each($select_log)) { $newlog = blogn_mod_db_log_load_for_entory($user, $val); $loglist[0] = true; $loglist[1][$i]["id"] = $newlog[1]["id"]; $loglist[1][$i]["date"] = $newlog[1]["date"]; $loglist[1][$i]["reserve"] = $newlog[1]["reserve"]; $loglist[1][$i]["secret"] = $newlog[1]["secret"]; $loglist[1][$i]["user_id"] = $newlog[1]["user_id"]; $loglist[1][$i]["category"] = $newlog[1]["category"]; $loglist[1][$i]["comment_ok"] = $newlog[1]["comment_ok"]; $loglist[1][$i]["trackback_ok"] = $newlog[1]["trackback_ok"]; $loglist[1][$i]["title"] = $newlog[1]["title"]; $loglist[1][$i]["mes"] = $newlog[1]["mes"]; $loglist[1][$i]["more"] = $newlog[1]["more"]; $loglist[1][$i]["br_change"] = $newlog[1]["br_change"]; $i++; } } break; } if ($qry_page == 1 || $select_log) { $skin = preg_replace("/\{NEXTPAGE[\w\W]*?\}[\w\W]+?\{\/NEXTPAGE\}/", "", $skin); }else{ $skin = preg_replace("/\{NEXTPAGE([\w\W]*?)\}([\w\W]+?)\{\/NEXTPAGE\}/", "\\2", $skin); } if ($maxpage < $backpage || $select_log) { $skin = preg_replace("/\{BACKPAGE[\w\W]*?\}[\w\W]+?\{\/BACKPAGE\}/", "", $skin); }else{ $skin = preg_replace("/\{BACKPAGE([\w\W]*?)\}([\w\W]+?)\{\/BACKPAGE\}/", "\\2", $skin); } preg_match("/\{LOGLOOP\}([\w\W]+?)\{\/LOGLOOP\}/", $skin, $reg); $log_all = ""; if ($loglist[0]) { reset($loglist[1]); while (list($key, $val) = each($loglist[1])) { $tmpbuf = $reg[0]; $tmpbuf = str_replace ("{LOGLOOP}", "", $tmpbuf); $tmpbuf = str_replace ("{/LOGLOOP}", "", $tmpbuf); $tmpbuf = blogn_log_list_skin_replace($tmpbuf, $key, $val, $userlist, $category1[1], $category2[1], 1); switch (BLOGN_COMMENT_LIST_TOPVIEW_ON) { case "0": // 件数表示 // 処理無し $tmpbuf = preg_replace("/\{COMMENTLIST\}[\w\W]+?\{\/COMMENTLIST\}/", "", $tmpbuf); $tmpbuf = preg_replace("/\{COMMENTNEW\}[\w\W]+?\{\/COMMENTNEW\}/", "", $tmpbuf); break; case "1": // 一覧表示 $tmpbuf = preg_replace("/\{COMMENTNEW\}[\w\W]+?\{\/COMMENTNEW\}/", "", $tmpbuf); $tmpbuf = blogn_comment_list_skin_replace($tmpbuf, $val["id"]); break; case "2": // 最新5件表示 $tmpbuf = preg_replace("/\{COMMENTLIST\}[\w\W]+?\{\/COMMENTLIST\}/", "", $tmpbuf); // 携帯処理 $vtype = "5"; $tmpbuf = blogn_comment_new_skin_replace($tmpbuf, $val["id"], 5, $vtype, ""); break; } switch (BLOGN_TRACKBACK_LIST_TOPVIEW_ON) { case "0": // 件数表示 // 処理無し $tmpbuf = preg_replace("/\{TRACKBACKLIST\}[\w\W]+?\{\/TRACKBACKLIST\}/", "", $tmpbuf); $tmpbuf = preg_replace("/\{TRACKBACKNEW\}[\w\W]+?\{\/TRACKBACKNEW\}/", "", $tmpbuf); break; case "1": // 一覧表示 $tmpbuf = preg_replace("/\{TRACKBACKNEW\}[\w\W]+?\{\/TRACKBACKNEW\}/", "", $tmpbuf); $tmpbuf = blogn_trackback_list_skin_replace($tmpbuf, $val["id"]); break; case "2": // 最新5件表示 $tmpbuf = preg_replace("/\{TRACKBACKLIST\}[\w\W]+?\{\/TRACKBACKLIST\}/", "", $tmpbuf); // 携帯処理 $vtype = "5"; $tmpbuf = blogn_trackback_new_skin_replace($tmpbuf, $val["id"], 5, $vtype, ""); break; } $log_all .= $tmpbuf; } $skin = preg_replace("/\{LOGLOOP\}[\w\W]+?\{\/LOGLOOP\}/", $log_all, $skin); }else{ $skin = preg_replace("/\{LOGLOOP\}[\w\W]+?\{\/LOGLOOP\}/", "", $skin); } return $skin; } /* ----- ログリスト用スキン変換 ----- */ function blogn_log_list_skin_replace($tmpbuf, $key, $val, $userlist, $category1, $category2, $mode) { $linkurl = ''.$val["title"].''; $tmpbuf = str_replace("{LOGTITLE}", $linkurl, $tmpbuf); $logurl = BLOGN_HOMELINK.'index.php?e='.$val["id"]; $tmpbuf = str_replace ("{LOGURL}", $logurl, $tmpbuf); if ($val["secret"]) { $tmpbuf = preg_replace ("/\{LOGMODE \"(.*?)\"\,\"(.*?)\"\}/", "\\2", $tmpbuf); }else{ $tmpbuf = preg_replace ("/\{LOGMODE \"(.*?)\"\,\"(.*?)\"\}/", "\\1", $tmpbuf); } if (preg_match("/\{LOGYMD\}([\w\W]+?)\{\/LOGYMD\}/",$tmpbuf, $tmpreg)) { $tmpreg[0] = preg_replace ("/\{LOGYMD\}/", "", $tmpreg[0]); $tmpreg[0] = preg_replace ("/\{\/LOGYMD\}/", "", $tmpreg[0]); $tmpdate = _date($tmpreg[0], mktime(substr($val["date"],8,2),substr($val["date"],10,2),substr($val["date"],12,2),substr($val["date"],4,2), substr($val["date"],6,2), substr($val["date"],0,4))); $tmpbuf = preg_replace ("/\{LOGYMD\}[\w\W]+?\{\/LOGYMD\}/", $tmpdate, $tmpbuf); } $author = ''.$userlist[$val["user_id"]]["name"].''; $tmpbuf = preg_replace("/\{LOGAUTHOR\}/", $author, $tmpbuf); list($c1, $c2) = explode("|", $val["category"]); $category = get_magic_quotes_gpc() ? stripslashes($category1[$c1]["name"]) : $category1[$c1]["name"]; //¥を削除 if ($c2) { $category .= "::"; $category .= get_magic_quotes_gpc() ? stripslashes($category2[$c2]["name"]) : $category2[$c2]["name"]; //¥を削除 } $categorylink = ''.$category.''; $tmpbuf = str_replace ("{LOGCATEGORY}", $categorylink , $tmpbuf); // $mes = addslashes($val["mes"]); // $mes = str_replace("\\", "¥" , $val["mes"]); // $mes = str_replace("\\", "\" , $val["mes"]); $mes = str_replace("\\", "\\\\" , $val["mes"]); $mes = str_replace('$', '\$' , $mes); $mes = blogn_html_tag_restore($mes); $mes = blogn_IconStr($mes); $mes = blogn_permit_html_tag_restore($mes); // br_change チェック if (!$val["br_change"]) { $mes = blogn_rntag2rn($mes); } $mes = blogn_mobile_picture_change($mes); $tmpbuf = str_replace("{LOGBODY}", $mes, $tmpbuf); if ($mode) { $tmpbuf = str_replace("{LOGMORE}", "", $tmpbuf); if (trim($val["more"]) != "") { $cont = ''; $tmpbuf = str_replace("{MOREMARK}", $cont, $tmpbuf); $tmpbuf = str_replace("{/MOREMARK}", "", $tmpbuf); }else{ $tmpbuf = preg_replace("/\{MOREMARK\}[\w\W]+?\{\/MOREMARK\}/", "", $tmpbuf); } }else{ // $more = addslashes($val["more"]); // $more = str_replace("\\", "¥" , $val["more"]); // $more = str_replace("\\", "\" , $val["more"]); $more = str_replace("\\", "\\\\" , $val["more"]); $more = str_replace('$', '\$' , $more); $more = blogn_html_tag_restore($more); $more = blogn_IconStr($more); $more = blogn_permit_html_tag_restore($more); $more = blogn_mobile_picture_change($more); $more = ''.$more; // br_change チェック if (!$val["br_change"]) { $more = blogn_rntag2rn($more); } $tmpbuf = str_replace("{LOGMORE}", $more, $tmpbuf); $tmpbuf = preg_replace("/\{MOREMARK\}[\w\W]+?\{\/MOREMARK\}/", "", $tmpbuf); } if (preg_match("/\{LOGHMS\}([\w\W]+?)\{\/LOGHMS\}/",$tmpbuf, $tmpreg)) { $tmpreg[0] = preg_replace ("/\{LOGHMS\}/", "", $tmpreg[0]); $tmpreg[0] = preg_replace ("/\{\/LOGHMS\}/", "", $tmpreg[0]); $tmpdate = _date($tmpreg[0], mktime(substr($val["date"],8,2),substr($val["date"],10,2),substr($val["date"],12,2),substr($val["date"],4,2), substr($val["date"],6,2), substr($val["date"],0,4))); $tmpbuf = preg_replace ("/\{LOGHMS\}[\w\W]+?\{\/LOGHMS\}/", $tmpdate, $tmpbuf); } if (BLOGN_MOBILE_KEY == 1) { $c = "C"; }else{ $c = "comments "; } if ($val["comment_ok"] == "1") { $comment_cnt = blogn_mod_db_comment_count_load($val["id"]); if ($comment_cnt[0]) $logcomment = ''.$c.'('.$comment_cnt[1].')'; }else{ $logcomment = $c.'(x)'; } $tmpbuf = str_replace ("{LOGCOMMENT}", $logcomment, $tmpbuf); if (BLOGN_MOBILE_KEY == 1) { $t = "T"; }else{ $t = "trackback "; } if ($val["trackback_ok"] == "1") { $trackback_cnt = blogn_mod_db_trackback_count_load($val["id"]); if ($trackback_cnt[0]) $logtrackback = ''.$t.'('.$trackback_cnt[1].')'; }else{ $logtrackback = $t.'(x)'; } $tmpbuf = str_replace ("{LOGTRACKBACK}", $logtrackback, $tmpbuf); if ($val["trackback_ok"] == "1") { $about = BLOGN_HOMELINK."index.php?e=".$val["id"]; $identifier = $about; $rss_tzd = _date("O", mktime(substr($val["date"],8,2),substr($val["date"],10,2),substr($val["date"],12,2),substr($val["date"],4,2), substr($val["date"],6,2), substr($val["date"],0,4))); $rss_tzd = substr($rss_tzd,0,3).":".substr($rss_tzd,3,2); $date = _date("Y-m-d", mktime(substr($val["date"],8,2),substr($val["date"],10,2),substr($val["date"],12,2),substr($val["date"],4,2), substr($val["date"],6,2), substr($val["date"],0,4)))."T"._date("H:i:s", mktime(substr($val["date"],8,2),substr($val["date"],10,2),substr($val["date"],12,2),substr($val["date"],4,2), substr($val["date"],6,2), substr($val["date"],0,4))).$rss_tzd; if (BLOGN_TRACKBACK_SLASH_TYPE != 1) { $trackbackurl = BLOGN_TRACKBACKADDR."/".$val["id"]; }else{ $trackbackurl = BLOGN_TRACKBACKADDR."?".$val["id"]; } if (BLOGN_MOBILE_KEY != 1) $tmpbuf .= blogn_rdf_make($about, $identifier, $val["title"], $val["mes"], $category, $userlist[$val["user_id"]]["name"], $date, $trackbackurl); } return $tmpbuf; } /* ----- コメントリスト用スキン変換 ----- */ function blogn_comment_list_skin_replace($tmpbuf, $id) { $cmtlist = blogn_mod_db_comment_load_for_list($id, 0, 0); $cmt_all = ""; if ($cmtlist[0]) { preg_match("/\{COMMENTLIST\}([\w\W]+?)\{\/COMMENTLIST\}/", $tmpbuf, $reg); $cmt_buf = $reg[0]; $cmt_buf = str_replace ("{COMMENTLIST}", "", $cmt_buf); $cmt_buf = str_replace ("{/COMMENTLIST}", "", $cmt_buf); if (preg_match("/\{COMMENTLISTLOOP\}/", $cmt_buf)) { preg_match("/\{COMMENTLISTLOOP\}([\w\W]+?)\{\/COMMENTLISTLOOP\}/", $cmt_buf, $cmtreg); $cmtasc = false; }elseif (preg_match("/\{COMMENTLISTLOOPASC\}/", $cmt_buf)) { preg_match("/\{COMMENTLISTLOOPASC\}([\w\W]+?)\{\/COMMENTLISTLOOPASC\}/", $cmt_buf, $cmtreg); $cmtasc = true; $cmtlist[1] = array_reverse($cmtlist[1]); } while(list($cmtkey, $cmtval) = each($cmtlist[1])) { $cmt_tmp_buf = $cmtreg[0]; if ($cmtasc) { $cmt_tmp_buf = str_replace ("{COMMENTLISTLOOPASC}", "", $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTLISTLOOPASC}", "", $cmt_tmp_buf); }else{ $cmt_tmp_buf = str_replace ("{COMMENTLISTLOOP}", "", $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTLISTLOOP}", "", $cmt_tmp_buf); } if (!$cmtval["email"]) { $cmt_tmp_buf = str_replace ("{COMMENTEMAIL}", "", $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTEMAIL}", "", $cmt_tmp_buf); }else{ $commentemail = ''; $commentemaile = ''; $cmt_tmp_buf = str_replace ("{COMMENTEMAIL}", $commentemail, $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTEMAIL}", $commentemaile, $cmt_tmp_buf); } if (!$cmtval["url"]) { $cmt_tmp_buf = str_replace ("{COMMENTURL}", "", $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTURL}", "", $cmt_tmp_buf); }else{ $commenturl = ''; $commenturle = ''; $cmt_tmp_buf = str_replace ("{COMMENTURL}", $commenturl, $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTURL}", $commenturle, $cmt_tmp_buf); } $name = get_magic_quotes_gpc() ? stripslashes($cmtval["name"]) : $cmtval["name"]; //¥を削除 $cmt_tmp_buf = str_replace ("{COMMENTUSER}", $name, $cmt_tmp_buf); if (preg_match("/\{COMMENTYMD\}([\w\W]+?)\{\/COMMENTYMD\}/",$cmt_tmp_buf, $cmttmpreg)) { $cmttmpreg[0] = preg_replace ("/\{COMMENTYMD\}/", "", $cmttmpreg[0]); $cmttmpreg[0] = preg_replace ("/\{\/COMMENTYMD\}/", "", $cmttmpreg[0]); $cmttmpdate = _date($cmttmpreg[0], mktime(substr($cmtval["date"],8,2),substr($cmtval["date"],10,2),substr($cmtval["date"],12,2),substr($cmtval["date"],4,2), substr($cmtval["date"],6,2), substr($cmtval["date"],0,4))); $cmt_tmp_buf = preg_replace ("/\{COMMENTYMD\}[\w\W]+?\{\/COMMENTYMD\}/", $cmttmpdate, $cmt_tmp_buf); } if (preg_match("/\{COMMENTHMS\}([\w\W]+?)\{\/COMMENTHMS\}/",$cmt_tmp_buf, $cmttmpreg)) { $cmttmpreg[0] = preg_replace ("/\{COMMENTHMS\}/", "", $cmttmpreg[0]); $cmttmpreg[0] = preg_replace ("/\{\/COMMENTHMS\}/", "", $cmttmpreg[0]); $cmttmpdate = _date($cmttmpreg[0], mktime(substr($cmtval["date"],8,2),substr($cmtval["date"],10,2),substr($cmtval["date"],12,2),substr($cmtval["date"],4,2), substr($cmtval["date"],6,2), substr($cmtval["date"],0,4))); $cmt_tmp_buf = preg_replace ("/\{COMMENTHMS\}[\w\W]+?\{\/COMMENTHMS\}/", $cmttmpdate, $cmt_tmp_buf); } $commentid = blogn_crypt_key($cmtval["ip"]); $cmt_tmp_buf = str_replace ("{COMMENTID}", $commentid, $cmt_tmp_buf); $cmt_all .= $cmt_tmp_buf; } } if ($cmtasc) { $cmt_buf = preg_replace("/\{COMMENTLISTLOOPASC\}[\w\W]+?\{\/COMMENTLISTLOOPASC\}/", $cmt_all, $cmt_buf); }else{ $cmt_buf = preg_replace("/\{COMMENTLISTLOOP\}[\w\W]+?\{\/COMMENTLISTLOOP\}/", $cmt_all, $cmt_buf); } $tmpbuf = preg_replace("/\{COMMENTLIST\}[\w\W]+?\{\/COMMENTLIST\}/", $cmt_buf, $tmpbuf); return $tmpbuf; } /* ----- コメント表示用スキン変換 ----- */ function blogn_comment_new_skin_replace($tmpbuf, $id, $count, $type, $log_date) { $cmtlist = blogn_mod_db_comment_load_for_list($id, 0, $count); $tmpbuf = str_replace ("{CEID}", $id, $tmpbuf); $cmt_all = ""; if ($type == "all") { preg_match("/\{COMMENT\}([\w\W]+?)\{\/COMMENT\}/", $tmpbuf, $tmpreg); $cmt_buf = $tmpreg[0]; $cmt_buf = str_replace ("{COMMENT}", "", $cmt_buf); $cmt_buf = str_replace ("{/COMMENT}", "", $cmt_buf); if (preg_match("/\{COMMENTLOOP\}/", $cmt_buf)) { preg_match("/\{COMMENTLOOP\}([\w\W]+?)\{\/COMMENTLOOP\}/", $cmt_buf, $cmtreg); $cmtasc = false; }elseif (preg_match("/\{COMMENTLOOPASC\}/", $cmt_buf)) { preg_match("/\{COMMENTLOOPASC\}([\w\W]+?)\{\/COMMENTLOOPASC\}/", $cmt_buf, $cmtreg); $cmtasc = true; if ($cmtlist[0]) $cmtlist[1] = array_reverse($cmtlist[1]); } }else{ preg_match("/\{COMMENTNEW\}([\w\W]+?)\{\/COMMENTNEW\}/", $tmpbuf, $tmpreg); $cmt_buf = $tmpreg[0]; $cmt_buf = str_replace ("{COMMENTNEW}", "", $cmt_buf); $cmt_buf = str_replace ("{/COMMENTNEW}", "", $cmt_buf); if (preg_match("/\{COMMENTNEWLOOP\}/", $cmt_buf)) { preg_match("/\{COMMENTNEWLOOP\}([\w\W]+?)\{\/COMMENTNEWLOOP\}/", $cmt_buf, $cmtreg); $cmtasc = false; }elseif (preg_match("/\{COMMENTNEWLOOPASC\}/", $cmt_buf)) { preg_match("/\{COMMENTNEWLOOPASC\}([\w\W]+?)\{\/COMMENTNEWLOOPASC\}/", $cmt_buf, $cmtreg); $cmtasc = true; if ($cmtlist[0]) $cmtlist[1] = array_reverse($cmtlist[1]); } } if ($cmtlist[0]) { while(list($cmtkey, $cmtval) = each($cmtlist[1])) { $cmt_tmp_buf = $cmtreg[0]; if ($type == "all") { if ($cmtasc) { $cmt_tmp_buf = str_replace ("{COMMENTLOOPASC}", "", $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTLOOPASC}", "", $cmt_tmp_buf); }else{ $cmt_tmp_buf = str_replace ("{COMMENTLOOP}", "", $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTLOOP}", "", $cmt_tmp_buf); } }else{ if ($cmtasc) { $cmt_tmp_buf = str_replace ("{COMMENTNEWLOOPASC}", "", $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTNEWLOOPASC}", "", $cmt_tmp_buf); }else{ $cmt_tmp_buf = str_replace ("{COMMENTNEWLOOP}", "", $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTNEWLOOP}", "", $cmt_tmp_buf); } } $cmt_tmp_buf = ''.$cmt_tmp_buf; if (!$cmtval["email"]) { $cmt_tmp_buf = str_replace ("{COMMENTEMAIL}", "", $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTEMAIL}", "", $cmt_tmp_buf); }else{ $commentemail = ''; $commentemaile = ''; $cmt_tmp_buf = str_replace ("{COMMENTEMAIL}", $commentemail, $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTEMAIL}", $commentemaile, $cmt_tmp_buf); } if (!$cmtval["url"]) { $cmt_tmp_buf = str_replace ("{COMMENTURL}", "", $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTURL}", "", $cmt_tmp_buf); }else{ $cmturl = preg_replace("/^http:\/\//", "", $cmtval["url"]); $commenturl = ''; $commenturle = ''; $cmt_tmp_buf = str_replace ("{COMMENTURL}", $commenturl, $cmt_tmp_buf); $cmt_tmp_buf = str_replace ("{/COMMENTURL}", $commenturle, $cmt_tmp_buf); } $name = get_magic_quotes_gpc() ? stripslashes($cmtval["name"]) : $cmtval["name"]; //¥を削除 $name = str_replace('$', '$' , $name); $name = str_replace("\\", "¥" , $name); $cmt_tmp_buf = str_replace ("{COMMENTUSER}", $name, $cmt_tmp_buf); if (preg_match("/\{COMMENTYMD\}([\w\W]+?)\{\/COMMENTYMD\}/",$cmt_tmp_buf, $cmttmpreg)) { $cmttmpreg[0] = preg_replace ("/\{COMMENTYMD\}/", "", $cmttmpreg[0]); $cmttmpreg[0] = preg_replace ("/\{\/COMMENTYMD\}/", "", $cmttmpreg[0]); $cmttmpdate = _date($cmttmpreg[0], mktime(substr($cmtval["date"],8,2),substr($cmtval["date"],10,2),substr($cmtval["date"],12,2),substr($cmtval["date"],4,2), substr($cmtval["date"],6,2), substr($cmtval["date"],0,4))); $cmt_tmp_buf = preg_replace ("/\{COMMENTYMD\}[\w\W]+?\{\/COMMENTYMD\}/", $cmttmpdate, $cmt_tmp_buf); } if (preg_match("/\{COMMENTHMS\}([\w\W]+?)\{\/COMMENTHMS\}/",$cmt_tmp_buf, $cmttmpreg)) { $cmttmpreg[0] = preg_replace ("/\{COMMENTHMS\}/", "", $cmttmpreg[0]); $cmttmpreg[0] = preg_replace ("/\{\/COMMENTHMS\}/", "", $cmttmpreg[0]); $cmttmpdate = _date($cmttmpreg[0], mktime(substr($cmtval["date"],8,2),substr($cmtval["date"],10,2),substr($cmtval["date"],12,2),substr($cmtval["date"],4,2), substr($cmtval["date"],6,2), substr($cmtval["date"],0,4))); $cmt_tmp_buf = preg_replace ("/\{COMMENTHMS\}[\w\W]+?\{\/COMMENTHMS\}/", $cmttmpdate, $cmt_tmp_buf); } $commentid = blogn_crypt_key($cmtval["ip"]); $cmt_tmp_buf = str_replace ("{COMMENTID}", $commentid, $cmt_tmp_buf); $comment = get_magic_quotes_gpc() ? stripslashes($cmtval["comment"]) : $cmtval["comment"]; //¥を削除 $comment = preg_replace("/<(br)>/i", "
", $comment); $comment = preg_replace("/<(br)([ ]+[\w\W]+?)>/i", "", $comment); $comment = preg_replace("/&quot;/i", """, $comment); $comment = str_replace("\\", "¥" , $comment); $comment = str_replace('$', '$' , $comment); $cmt_tmp_buf = str_replace ("{COMMENTBODY}", $comment, $cmt_tmp_buf); $cmt_all .= $cmt_tmp_buf; } } if ($type == "all") { if ($cmtasc) { $cmt_buf = preg_replace("/\{COMMENTLOOPASC\}[\w\W]+?\{\/COMMENTLOOPASC\}/", $cmt_all, $cmt_buf); }else{ $cmt_buf = preg_replace("/\{COMMENTLOOP\}[\w\W]+?\{\/COMMENTLOOP\}/", $cmt_all, $cmt_buf); } $tmpbuf = preg_replace("/\{COMMENT\}[\w\W]+?\{\/COMMENT\}/", $cmt_buf, $tmpbuf); }else{ if ($cmtasc) { $cmt_buf = preg_replace("/\{COMMENTNEWLOOPASC\}[\w\W]+?\{\/COMMENTNEWLOOPASC\}/", $cmt_all, $cmt_buf); }else{ $cmt_buf = preg_replace("/\{COMMENTNEWLOOP\}[\w\W]+?\{\/COMMENTNEWLOOP\}/", $cmt_all, $cmt_buf); } $tmpbuf = preg_replace("/\{COMMENTNEW\}[\w\W]+?\{\/COMMENTNEW\}/", $cmt_buf, $tmpbuf); } $diffdays = blogn_date_diff($log_date); if (BLOGN_LIMIT_COMMENT && BLOGN_LIMIT_COMMENT < $diffdays) { $tmpbuf = str_replace ("{COMMENTNOINPUT}", "", $tmpbuf); $tmpbuf = str_replace ("{/COMMENTNOINPUT}", "", $tmpbuf); $tmpbuf = preg_replace ("/\{COMMENTINPUT\}[\w\W]+?\{\/COMMENTINPUT\}/", "", $tmpbuf); }else{ $tmpbuf = str_replace ("{COMMENTINPUT}", "", $tmpbuf); $tmpbuf = str_replace ("{/COMMENTINPUT}", "", $tmpbuf); $tmpbuf = preg_replace ("/\{COMMENTNOINPUT\}[\w\W]+?\{\/COMMENTNOINPUT\}/", "", $tmpbuf); } if ($_COOKIE["name"]) { $tmpbuf = str_replace ("{CNAME}", strip_tags($_COOKIE["name"]), $tmpbuf); }else{ // コメント投稿失敗時に名前を再表示する $_SESSION["cmtname"] = str_replace('$', '$' , $_SESSION["cmtname"]); $tmpbuf = str_replace ("{CNAME}", strip_tags($_SESSION["cmtname"]), $tmpbuf); } if ($_COOKIE["email"]) { $tmpbuf = str_replace ("{CEMAIL}", strip_tags($_COOKIE["email"]), $tmpbuf); }else{ // コメント投稿失敗時にメールアドレスを再表示する $tmpbuf = str_replace ("{CEMAIL}", strip_tags($_SESSION["cmtemail"]), $tmpbuf); } if ($_COOKIE["url"]) { $tmpbuf = str_replace ("{CURL}", strip_tags($_COOKIE["url"]), $tmpbuf); }else{ // コメント投稿失敗時にURLを再表示する $tmpbuf = str_replace ("{CURL}", strip_tags($_SESSION["cmturl"]), $tmpbuf); } // コメント投稿失敗時にコメント内容を再表示する $_SESSION["cmtmes"] = str_replace('$', '$' , $_SESSION["cmtmes"]); $tmpbuf = str_replace ("{CMES}", strip_tags($_SESSION['cmtmes']), $tmpbuf); $tmpbuf = str_replace("¥", "\\\\" , $tmpbuf); return $tmpbuf; } /* ----- トラックバックリスト用スキン変換 ----- */ function blogn_trackback_list_skin_replace($tmpbuf, $id) { $trklist = blogn_mod_db_trackback_load_for_list($id, 0, 0); $trk_all = ""; if ($trklist[0]) { if (BLOGN_TRACKBACK_SLASH_TYPE != 1) { $trackbackurl = BLOGN_TRACKBACKADDR."/".$id; }else{ $trackbackurl = BLOGN_TRACKBACKADDR."?".$id; } $tmpbuf = str_replace ("{TRACKBACKURL}", $trackbackurl, $tmpbuf); preg_match("/\{TRACKBACKLIST\}([\w\W]+?)\{\/TRACKBACKLIST\}/", $tmpbuf, $tmpreg); $trk_buf = $tmpreg[0]; $trk_buf = str_replace ("{TRACKBACKLIST}", "", $trk_buf); $trk_buf = str_replace ("{/TRACKBACKLIST}", "", $trk_buf); if (preg_match("/\{TRACKBACKLISTLOOP\}/", $trk_buf)) { preg_match("/\{TRACKBACKLISTLOOP\}([\w\W]+?)\{\/TRACKBACKLISTLOOP\}/", $trk_buf, $trkreg); $trkasc = false; }elseif (preg_match("/\{TRACKBACKLISTLOOPASC\}/", $trk_buf)) { preg_match("/\{TRACKBACKLISTLOOPASC\}([\w\W]+?)\{\/TRACKBACKLISTLOOPASC\}/", $trk_buf, $trkreg); $trkasc = true; $trklist[1] = array_reverse($trklist[1]); } while(list($trkkey, $trkval) = each($trklist[1])) { $trk_tmp_buf = $trkreg[0]; if ($trkasc) { $trk_tmp_buf = str_replace ("{TRACKBACKLISTLOOPASC}", "", $trk_tmp_buf); $trk_tmp_buf = str_replace ("{/TRACKBACKLISTLOOPASC}", "", $trk_tmp_buf); }else{ $trk_tmp_buf = str_replace ("{TRACKBACKLISTLOOP}", "", $trk_tmp_buf); $trk_tmp_buf = str_replace ("{/TRACKBACKLISTLOOP}", "", $trk_tmp_buf); } $title = get_magic_quotes_gpc() ? stripslashes($trkval["title"]) : $trkval["title"]; //¥を削除 $trackbactitle = ''.$title.''; $trk_tmp_buf = str_replace ("{TRACKBACKTITLE}", $trackbactitle, $trk_tmp_buf); $name = get_magic_quotes_gpc() ? stripslashes($trkval["name"]) : $trkval["name"]; //¥を削除 $trk_tmp_buf = str_replace ("{TRACKBACKUSER}", blogn_html_tag_convert($name), $trk_tmp_buf); if (preg_match("/\{TRACKBACKYMD\}([\w\W]+?)\{\/TRACKBACKYMD\}/",$trk_tmp_buf, $trktmpreg)) { $trktmpreg[0] = preg_replace ("/\{TRACKBACKYMD\}/", "", $trktmpreg[0]); $trktmpreg[0] = preg_replace ("/\{\/TRACKBACKYMD\}/", "", $trktmpreg[0]); $trktmpdate = _date($trktmpreg[0], mktime(substr($trkval["date"],8,2),substr($trkval["date"],10,2),substr($trkval["date"],12,2),substr($trkval["date"],4,2), substr($trkval["date"],6,2), substr($trkval["date"],0,4))); $trk_tmp_buf = preg_replace ("/\{TRACKBACKYMD\}[\w\W]+?\{\/TRACKBACKYMD\}/", $trktmpdate, $trk_tmp_buf); } if (preg_match("/\{TRACKBACKHMS\}([\w\W]+?)\{\/TRACKBACKHMS\}/",$trk_tmp_buf, $trktmpreg)) { $trktmpreg[0] = preg_replace ("/\{TRACKBACKHMS\}/", "", $trktmpreg[0]); $trktmpreg[0] = preg_replace ("/\{\/TRACKBACKHMS\}/", "", $trktmpreg[0]); $trktmpdate = _date($trktmpreg[0], mktime(substr($trkval["date"],8,2),substr($trkval["date"],10,2),substr($trkval["date"],12,2),substr($trkval["date"],4,2), substr($trkval["date"],6,2), substr($trkval["date"],0,4))); $trk_tmp_buf = preg_replace ("/\{TRACKBACKHMS\}[\w\W]+?\{\/TRACKBACKHMS\}/", $trktmpdate, $trk_tmp_buf); } $trk_all .= $trk_tmp_buf; } } if ($trkasc) { $trk_buf = preg_replace("/\{TRACKBACKLISTLOOPASC\}[\w\W]+?\{\/TRACKBACKLISTLOOPASC\}/", $trk_all, $trk_buf); }else{ $trk_buf = preg_replace("/\{TRACKBACKLISTLOOP\}[\w\W]+?\{\/TRACKBACKLISTLOOP\}/", $trk_all, $trk_buf); } $tmpbuf = preg_replace("/\{TRACKBACKLIST\}[\w\W]+?\{\/TRACKBACKLIST\}/", $trk_buf, $tmpbuf); return $tmpbuf; } /* ----- トラックバック表示用スキン変換 ----- */ function blogn_trackback_new_skin_replace($tmpbuf, $id, $count, $type, $log_date) { $trklist = blogn_mod_db_trackback_load_for_list($id, 0, $count); if (BLOGN_TRACKBACK_SLASH_TYPE != 1) { $trackbackurl = BLOGN_TRACKBACKADDR."/".$id; }else{ $trackbackurl = BLOGN_TRACKBACKADDR."?".$id; } $tmpbuf = str_replace ("{TRACKBACKURL}", $trackbackurl, $tmpbuf); $trk_all = ""; if ($type == "all") { preg_match("/\{TRACKBACK\}([\w\W]+?)\{\/TRACKBACK\}/", $tmpbuf, $tmpreg); $trk_buf = $tmpreg[0]; $trk_buf = str_replace ("{TRACKBACK}", "", $trk_buf); $trk_buf = str_replace ("{/TRACKBACK}", "", $trk_buf); if (preg_match("/\{TRACKBACKLOOP\}/", $trk_buf)) { preg_match("/\{TRACKBACKLOOP\}([\w\W]+?)\{\/TRACKBACKLOOP\}/", $trk_buf, $trkreg); $trkasc = false; }elseif (preg_match("/\{TRACKBACKLOOPASC\}/", $trk_buf)) { preg_match("/\{TRACKBACKLOOPASC\}([\w\W]+?)\{\/TRACKBACKLOOPASC\}/", $trk_buf, $trkreg); $trkasc = true; if ($trklist[0]) $trklist[1] = array_reverse($trklist[1]); } }else{ preg_match("/\{TRACKBACKNEW\}([\w\W]+?)\{\/TRACKBACKNEW\}/", $tmpbuf, $tmpreg); $trk_buf = $tmpreg[0]; $trk_buf = str_replace ("{TRACKBACKNEW}", "", $trk_buf); $trk_buf = str_replace ("{/TRACKBACKNEW}", "", $trk_buf); if (preg_match("/\{TRACKBACKNEWLOOP\}/", $trk_buf)) { preg_match("/\{TRACKBACKNEWLOOP\}([\w\W]+?)\{\/TRACKBACKNEWLOOP\}/", $trk_buf, $trkreg); $trkasc = false; }elseif (preg_match("/\{TRACKBACKNEWLOOPASC\}/", $trk_buf)) { preg_match("/\{TRACKBACKNEWLOOPASC\}([\w\W]+?)\{\/TRACKBACKLISTNEWASC\}/", $trk_buf, $trkreg); $trkasc = true; if ($trklist[0]) $trklist[1] = array_reverse($trklist[1]); } } if ($trklist[0]) { while(list($trkkey, $trkval) = each($trklist[1])) { $trk_tmp_buf = $trkreg[0]; if ($type == "all") { if ($trkasc) { $trk_tmp_buf = str_replace ("{TRACKBACKLOOPASC}", "", $trk_tmp_buf); $trk_tmp_buf = str_replace ("{/TRACKBACKLOOPASC}", "", $trk_tmp_buf); }else{ $trk_tmp_buf = str_replace ("{TRACKBACKLOOP}", "", $trk_tmp_buf); $trk_tmp_buf = str_replace ("{/TRACKBACKLOOP}", "", $trk_tmp_buf); } }else{ if ($trkasc) { $trk_tmp_buf = str_replace ("{TRACKBACKNEWLOOPASC}", "", $trk_tmp_buf); $trk_tmp_buf = str_replace ("{/TRACKBACKNEWLOOPASC}", "", $trk_tmp_buf); }else{ $trk_tmp_buf = str_replace ("{TRACKBACKNEWLOOP}", "", $trk_tmp_buf); $trk_tmp_buf = str_replace ("{/TRACKBACKNEWLOOP}", "", $trk_tmp_buf); } } $trk_tmp_buf = ''.$trk_tmp_buf; $title = get_magic_quotes_gpc() ? stripslashes($trkval["title"]) : $trkval["title"]; //¥を削除 $trackbactitle = ''.$title.''; $trk_tmp_buf = str_replace ("{TRACKBACKTITLE}", $trackbactitle, $trk_tmp_buf); $name = get_magic_quotes_gpc() ? stripslashes($trkval["name"]) : $trkval["name"]; //¥を削除 $trk_tmp_buf = str_replace ("{TRACKBACKUSER}", blogn_html_tag_convert($name), $trk_tmp_buf); if (preg_match("/\{TRACKBACKYMD\}([\w\W]+?)\{\/TRACKBACKYMD\}/",$trk_tmp_buf, $trktmpreg)) { $trktmpreg[0] = preg_replace ("/\{TRACKBACKYMD\}/", "", $trktmpreg[0]); $trktmpreg[0] = preg_replace ("/\{\/TRACKBACKYMD\}/", "", $trktmpreg[0]); $trktmpdate = _date($trktmpreg[0], mktime(substr($trkval["date"],8,2),substr($trkval["date"],10,2),substr($trkval["date"],12,2),substr($trkval["date"],4,2), substr($trkval["date"],6,2), substr($trkval["date"],0,4))); $trk_tmp_buf = preg_replace ("/\{TRACKBACKYMD\}[\w\W]+?\{\/TRACKBACKYMD\}/", $trktmpdate, $trk_tmp_buf); } if (preg_match("/\{TRACKBACKHMS\}([\w\W]+?)\{\/TRACKBACKHMS\}/",$trk_tmp_buf, $trktmpreg)) { $trktmpreg[0] = preg_replace ("/\{TRACKBACKHMS\}/", "", $trktmpreg[0]); $trktmpreg[0] = preg_replace ("/\{\/TRACKBACKHMS\}/", "", $trktmpreg[0]); $trktmpdate = _date($trktmpreg[0], mktime(substr($trkval["date"],8,2),substr($trkval["date"],10,2),substr($trkval["date"],12,2),substr($trkval["date"],4,2), substr($trkval["date"],6,2), substr($trkval["date"],0,4))); $trk_tmp_buf = preg_replace ("/\{TRACKBACKHMS\}[\w\W]+?\{\/TRACKBACKHMS\}/", $trktmpdate, $trk_tmp_buf); } $trackback = get_magic_quotes_gpc() ? stripslashes($trkval["mes"]) : $trkval["mes"]; //¥を削除 $trackback = preg_replace("/<(br)>/i", "
", $trackback); $trackback = preg_replace("/<(br)([ ]+[\w\W]+?)>/i", "", $trackback); $trk_tmp_buf = str_replace ("{TRACKBACKBODY}", $trackback, $trk_tmp_buf); $trk_all .= $trk_tmp_buf; } } if ($type == "all") { if ($trkasc) { $trk_buf = preg_replace("/\{TRACKBACKLOOPASC\}[\w\W]+?\{\/TRACKBACKLOOPASC\}/", $trk_all, $trk_buf); }else{ $trk_buf = preg_replace("/\{TRACKBACKLOOP\}[\w\W]+?\{\/TRACKBACKLOOP\}/", $trk_all, $trk_buf); } $tmpbuf = preg_replace("/\{TRACKBACK\}[\w\W]+?\{\/TRACKBACK\}/", $trk_buf, $tmpbuf); }else{ if ($trkasc) { $trk_buf = preg_replace("/\{TRACKBACKNEWLOOPASC\}[\w\W]+?\{\/TRACKBACKNEWLOOPASC\}/", $trk_all, $trk_buf); }else{ $trk_buf = preg_replace("/\{TRACKBACKNEWLOOP\}[\w\W]+?\{\/TRACKBACKNEWLOOP\}/", $trk_all, $trk_buf); } $tmpbuf = preg_replace("/\{TRACKBACKNEW\}[\w\W]+?\{\/TRACKBACKNEW\}/", $trk_buf, $tmpbuf); } $diffdays = blogn_date_diff($log_date); if (BLOGN_LIMIT_TRACKBACK && BLOGN_LIMIT_TRACKBACK < $diffdays) { $tmpbuf = str_replace ("{TRACKBACKNOINPUT}", "", $tmpbuf); $tmpbuf = str_replace ("{/TRACKBACKNOINPUT}", "", $tmpbuf); $tmpbuf = preg_replace ("/\{TRACKBACKINPUT\}[\w\W]+?\{\/TRACKBACKINPUT\}/", "", $tmpbuf); }else{ $tmpbuf = str_replace ("{TRACKBACKINPUT}", "", $tmpbuf); $tmpbuf = str_replace ("{/TRACKBACKINPUT}", "", $tmpbuf); $tmpbuf = preg_replace ("/\{TRACKBACKNOINPUT\}[\w\W]+?\{\/TRACKBACKNOINPUT\}/", "", $tmpbuf); } return $tmpbuf; } /* ----- criptによるキー生成 ----- */ function blogn_crypt_key($ip_addr) { if ($ip_addr == "") { $return_key = ""; }else{ list($key1, $key2, $key3) = explode(".", $ip_addr); $key1 = substr(sprintf("%03d", $key1), 1, 2); $key2 = substr(sprintf("%03d", $key2), 1, 2); $key3 = substr(sprintf("%03d", $key3), 1, 2); $key = $key1.$key2.$key3; $cryptkey = crypt($key, "jd"); $return_key = substr($cryptkey, -8); } return $return_key; } /* ----- RSS生成 ----- */ function blogn_rss_view($user){ // session_unset(); $filelist = blogn_mod_db_log_load_for_viewer($user, 0, BLOGN_LOG_VIEW_COUNT); if ($filelist[0]) { $rssdata = ' '.htmlspecialchars(BLOGN_SITENAME).' '.BLOGN_HOMELINK.' '.htmlspecialchars(BLOGN_SITEDESC).' ja '; while (list($key, $val) = each($filelist[1])) { $rssdata .= ''; } $rssdata .= ' '; $category1 = blogn_mod_db_category1_load(); $category2 = blogn_mod_db_category2_load(); reset($filelist[1]); while (list($key, $val) = each($filelist[1])) { $rss_tzd = _date("O", mktime(substr($val["date"],8,2),substr($val["date"],10,2),substr($val["date"],12,2),substr($val["date"],4,2), substr($val["date"],6,2), substr($val["date"],0,4))); $rss_tzd = substr($rss_tzd,0,3).":".substr($rss_tzd,3,2); $date = _date("Y-m-d", mktime(substr($val["date"],8,2),substr($val["date"],10,2),substr($val["date"],12,2),substr($val["date"],4,2), substr($val["date"],6,2), substr($val["date"],0,4)))."T"._date("H:i:s", mktime(substr($val["date"],8,2),substr($val["date"],10,2),substr($val["date"],12,2),substr($val["date"],4,2), substr($val["date"],6,2), substr($val["date"],0,4))).$rss_tzd; $d_mes = preg_replace_callback("/(]+[[:alnum:]\/\"^ .-]+\")(>)/i", blogn_change_url, $val["mes"]); $d_mes = preg_replace_callback("/(]+[[:alnum:]\/\"^ .-]+\")(>)/i", blogn_change_url, $d_mes); $d_mes = blogn_rntag2rn($d_mes); $d_mes = str_replace( "\r\n", "\n", $d_mes); // 改行を統一する $desc = blogn_mbtrim($d_mes,500); $desc = blogn_CleanHtml($desc); $desc = htmlspecialchars($desc); $desc = str_replace('&', '&', $desc); $d_title = $val["title"]; $d_title = blogn_mbtrim($d_title,100); $d_title = blogn_CleanHtml($d_title); $d_title = htmlspecialchars($d_title); $d_title = str_replace('&', '&', $d_title); $profile = blogn_mod_db_user_profile_load($val["user_id"]); list($c1, $c2) = explode("|", $val["category"]); $c_name = $category1[1][$c1]["name"]; if ($c2) $c_name .= "::".$category2[1][$c2]["name"]; $rssdata .= ' '.BLOGN_HOMELINK.'index.php?e='.$val["id"].' '.$d_title.' '.$desc.' '.$c_name.' '.$date.' '.$profile["name"].' BlognPlus '.$profile["name"].' '; } $rssdata .= ''; $rssdata = preg_replace("/
/i", "
", $rssdata); echo $rssdata; } } /* 相対パス → 絶対パス変換 */ function blogn_change_url($matches) { if ($matches[1] == "
", $description); $description = str_replace(""", "\"", $description); // ”にもどす $description = preg_replace_callback("/(]+[[:alnum:]\/\"^ .-]+\")(>)/i", 'blogn_change_url', $description); $description = preg_replace_callback("/(]+[[:alnum:]\/\"^ .-]+\")(>)/i", 'blogn_change_url', $description); $description = blogn_rntag2rn($description); $description = blogn_CleanHtml($description); $description = htmlspecialchars($description); $description = blogn_mbtrim($description, 500); $rdffile = ''; return $rdffile; } //-------------------------------------------------------------------- 携帯閲覧時の処理 function blogn_im_callback($matches) { $fileDir = str_replace(BLOGN_HOMELINK, BLOGN_ABSOLUTE_SYSTEMDIR, $matches[1]); if ($fsize = @round(@filesize($fileDir) / 1024, 1)) { if ($fsize < 0.4) { $result = ''; }else{ $result = '[PIC]'; } }else{ $result = ''; } return $result; } //-------------------------------------------------------------------- セパレーター function blogn_word_sepa($key1, $key2, $val) { list($newval[0],$buf) = explode($key1, $val, 2); list($newval[1], $newval[2]) = explode($key2, $buf, 2); return $newval; } //-------------------------------------------------------------------- 外部PHPスクリプト処理 function blogn_get_skin_php ($skin) { if (BLOGN_MOBILE_KEY == 0) { if (BLOGN_CHARSET == 0) { header("Content-Type: text/html; charset=Shift_JIS"); }elseif (BLOGN_CHARSET == 1) { header("Content-Type: text/html; charset=EUC-JP"); }elseif (BLOGN_CHARSET == 2) { header("Content-Type: text/html; charset=UTF-8"); } }else{ header("Content-Type: text/html; charset=Shift_JIS"); } echo $skin; } //-------------------------------------------------------------------- スキン選択処理 function blogn_skin_selector($mode, $entry_id, $date, $user_id, $category, $ua) { $skinlist = blogn_mod_db_skin_load(); if (!$skinlist[0]) { // 未設定時はエラー return false; } $mobilelist = blogn_mod_db_mobile_viewskin_load(); // $mobilelistにマッチするUserAgentをチェック $match = false; if ($mobilelist[0]) { reset($mobilelist[1]); while(list($key, $val) = each($mobilelist[1])) { if (preg_match("/".quotemeta($val["mobile_useragent"])."/i", $ua)) { // スキンファイル読み込み $skin = file(BLOGN_SKINDIR.$skinlist[1][$val["skin_id"]]["html_name"]); $skin = implode("",$skin); $skin = blogn_mbConv($skin, 0, 4); $match = true; define("BLOGN_MOBILE_KEY", 1); if ($val["gif"]) { define("BLOGN_GIF_KEY", 1); }else{ define("BLOGN_GIF_KEY", 0); } if ($val["png"]) { define("BLOGN_PNG_KEY", 1); }else{ define("BLOGN_PNG_KEY", 0); } if ($val["jpg"]) { define("BLOGN_JPG_KEY", 1); }else{ define("BLOGN_JPG_KEY", 0); } break; } } } if (!$mobilelist[0] || !$match) { define("BLOGN_MOBILE_KEY", 0); define("BLOGN_GIF_KEY", 1); define("BLOGN_PNG_KEY", 1); define("BLOGN_JPG_KEY", 1); // スキンファイル読み込み $skinview = blogn_mod_db_viewskin_load(); if (!$skinview[0]) { // 未設定時はエラー return false; } if ($skinview[1][0]["view_type"] == 0) { // ノーマル表示 $skin = file(BLOGN_SKINDIR.$skinlist[1][$skinview[1][0]["skin_id"]]["html_name"]); $skin = implode("",$skin); $skin = blogn_mbConv($skin,0,4); $skin = preg_replace ("/\{CSSNAME\}/", BLOGN_HOMELINK."skin/".$skinlist[1][$skinview[1][0]["skin_id"]]["css_name"], $skin); }elseif ($skinview[1][0]["view_type"] == 1) { // ランダム表示 list($mses, $sec) = explode(" ", microtime()); mt_srand($sec*100000); $m = count($skinview[1]) - 1; $r = mt_rand(0,$m); $skin = file(BLOGN_SKINDIR.$skinlist[1][$skinview[1][$r]["skin_id"]]["html_name"]); $skin = implode("",$skin); $skin = blogn_mbConv($skin,0,4); $skin = preg_replace ("/\{CSSNAME\}/", BLOGN_HOMELINK."skin/".$skinlist[1][$skinview[1][$r]["skin_id"]]["css_name"], $skin); }elseif ($skinview[1][0]["view_type"] == 2) { // ジャンル別表示 $findflg = false; switch ($mode) { case "": //初期表示画面 @reset($skinview[1]); while(list($key, $val) = each($skinview[1])) { if ($val["category_id"] == "1" && $val["section_id"] == "1") { $findflg = $key; break; } } break; case "s": //サーチ画面 @reset($skinview[1]); while(list($key, $val) = each($skinview[1])) { if ($val["category_id"] == "1" && $val["section_id"] == "2") { $findflg = $key; break; } } break; case "m": //月別画面 case "d": //日別画面(月指定スキンを使用) $mkey = (int)substr($date,4,2); @reset($skinview[1]); while(list($key, $val) = each($skinview[1])) { if ($val["category_id"] == "2" && $val["section_id"] == $mkey) { $findflg = $key; break; } } break; case "p": //プロフィール画面(ユーザー別) case "u": //ユーザー別画面 @reset($skinview[1]); while(list($key, $val) = each($skinview[1])) { if ($val["category_id"] == "3" && $val["section_id"] == $user_id) { $findflg = $key; break; } } break; case "e": //指定記事画面(記事カテゴリーに依存) $logdata = blogn_mod_db_log_load_for_editor($entry_id); $category = $logdata[1]["category"]; case "c": //カテゴリ別画面 @reset($skinview[1]); while(list($key, $val) = each($skinview[1])) { if ($val["category_id"] == "4" && $val["section_id"] == $category) { $findflg = $key; break; } } break; } if ($findflg) { $skin = file(BLOGN_SKINDIR.$skinlist[1][$skinview[1][$findflg]["skin_id"]]["html_name"]); $skin = implode("",$skin); $skin = blogn_mbConv($skin,0,4); $skin = preg_replace ("/\{CSSNAME\}/", BLOGN_HOMELINK."skin/".$skinlist[1][$skinview[1][$findflg]["skin_id"]]["css_name"], $skin); }else{ $skin = file(BLOGN_SKINDIR.$skinlist[1][$skinview[1][0]["skin_id"]]["html_name"]); $skin = implode("",$skin); $skin = blogn_mbConv($skin,0,4); $skin = preg_replace ("/\{CSSNAME\}/", BLOGN_HOMELINK."skin/".$skinlist[1][$skinview[1][0]["skin_id"]]["css_name"], $skin); } } } return $skin; } /* ----- 携帯投稿 変更版 ----- */ class mailpost { var $con = ''; var $errmsg = ''; var $buf = ''; var $mailcnt = 0; var $mailsize = 0; var $tmpdata = ''; var $data = array(); function mailpost($pop) { if ($fp = @fsockopen ($pop, 110, $errno, $errstr, 30)) { $this->con = $fp; $this->buf = @fgets($fp, 512); if(substr($this->buf, 0, 3) == '+OK') { return true; }else{ $this->con = false; $errmsg = "connect error"; return false; } }else{ $this->con = false; $this->errmsg = "[{$errno}] {$errstr}"; return false; } } function send_cmd($cmd) { @fputs($this->con, $cmd."\r\n"); $this->buf = @fgets($this->con, 512); if(substr($this->buf, 0, 3) == '+OK') { return $this->buf; }else{ return false; } } function login($loginid, $loginpass, $apop) { if($apop == 1) { $arraybuf = explode(" ", trim($this->buf)); $md5pass = md5($arraybuf[count($arraybuf) - 1].$loginpass); $this->buf = $this->send_cmd("APOP $loginid $md5pass"); } else { $this->buf = $this->send_cmd("USER $loginid"); $this->buf = $this->send_cmd("PASS $loginpass"); } if ($this->buf) { return true; }else{ return false; } } function stat() { $this->buf = $this->send_cmd("STAT"); // +OK $num $size sscanf($this->buf, '+OK %d %d', $this->mailcnt, $this->mailsize); } function quit() { $this->buf = $this->send_cmd("QUIT"); fclose($this->con); } function get_data($no) { $line = $this->send_cmd("RETR $no"); while (!preg_match("/^\.\r\n/",$line)) { if ($line = @fgets($this->con, 512)) { $this->tmpdata .= $line; }else{ break; } } $tmpdata = $this->split_mime($this->tmpdata); $this->tmpheader = preg_replace("/\r\n\t/", " ", $tmpdata['head']); $this->tmpbody = $tmpdata['body']; } function del_data($no) { $this->buf = $this->send_cmd("DELE {$no}"); } function split_mime($str) { list($mailArray['head'], $mailArray['body']) = explode("\r\n\r\n", $str, 2); $mailArray['body'] = preg_replace("/\r\n[\t ]+/", " ", $mailArray['body']); return $mailArray; } function get_headeritem_tmpdata($item) { if(preg_match("/\n{$item}:[ \t]*([^\r\n]+)/i", $this->tmpheader, $regs)) { return $regs[1]; }else{ return false; } } function get_headeritem($item, $header) { if(preg_match("/\n{$item}:[ \t]*([^\r\n]+)/i", $header, $regs)) { return $regs[1]; }else{ return false; } } function get_boundary_tmpdata($header) { if (preg_match('/content-type:[ \t]*[^\r\n]+;[ \t\r\n]*?boundary=[ "\t]*?([^"\r\n]+)["]*?/i', $header, $regs)) { return $regs[1]; }else{ return false; } } function memory() { global $accessLog; $this->data['full'][] = $this->tmpdata; $this->data['head'][] = $this->tmpheader; // date取得 $tmpdate = $this->get_headeritem_tmpdata('Date'); /* タイムゾーンの取得と加減算 */ if (($timestamp = strtotime($tmpdate)) === -1) { $this->data['date'][] = _gmdate("YmdHis",time() + BLOGN_TIMEZONE); }else{ $this->data['date'][] = _date("YmdHis",$timestamp); } // サブジェクトの取得 $subject = $this->get_headeritem_tmpdata('Subject'); if (preg_match("/(.*?)=\?(.*?)\?(.*?)\?([^\?]+)\?=(.*)/i",$subject,$regs)) { if ($regs[3] == "B") { $subject = base64_decode($regs[4]); }elseif ($regs[3] == "Q") { $subject = $regs[1].quoted_printable_decode($regs[4]).$regs[5]; } if (preg_match("/iso-2022-jp/i", $regs[2])) { $subject = blogn_mbConv($subject,0,4); } } $this->data['subject'][] = htmlspecialchars($subject); $contentType = $this->get_headeritem_tmpdata('Content-Type'); $this->data['contentType'][] = $contentType; $tmpArray = array(); if (!preg_match("/multipart/i", $contentType)) { $accessLog->logDebug('[site] multipart check [plain]'); $tmpArray['head'][] = $this->tmpheader; $tmpArray['body'][] = $this->tmpbody; // plain }else{ $accessLog->logDebug('[site] multipart check [multi]'); // multipart $boundary = $this->get_boundary_tmpdata($this->tmpheader); $accessLog->logDebug('[site] mail header '.$this->tmpheader); $boundary_data = explode("--{$boundary}", $this->tmpbody); foreach($boundary_data as $i=> $bdata) { $boundary = $this->get_boundary_tmpdata($bdata); if ($boundary) { $boundary_data2 = explode("--{$boundary}", $bdata); $accessLog->logDebug('[site] mail boundary data '.$boundary_data2[0]); if (preg_match('/Content-Type:.*?multipart\/alternative;/i', $boundary_data2[0])) { $accessLog->logDebug('[site] mail multipart alternative '); list($tmpheader, $tmpbody) = explode("\r\n\r\n", $boundary_data2[1], 2); $tmpbody = preg_replace("/\r\n[\t ]+/", " ", $tmpbody); $tmpArray['head'][] = $tmpheader; $tmpArray['body'][] = $tmpbody; $accessLog->logDebug('[site] mail head '.$tmpheader); }else{ $accessLog->logDebug('[site] mail multipart mixed'); foreach($boundary_data2 as $i=> $bdata2) { if (preg_match('/Content-Type/i', $bdata2)) { list($tmpheader, $tmpbody) = explode("\r\n\r\n", $bdata2, 2); $tmpbody = preg_replace("/\r\n[\t ]+/", " ", $tmpbody); $tmpArray['head'][] = $tmpheader; $tmpArray['body'][] = $tmpbody; $accessLog->logDebug('[site] mail head '.$tmpheader); } } } }else{ if (preg_match('/Content-Type/i', $bdata)) { list($tmpheader, $tmpbody) = explode("\r\n\r\n", $bdata, 2); $tmpbody = preg_replace("/\r\n[\t ]+/", " ", $tmpbody); $tmpArray['head'][] = $tmpheader; $tmpArray['body'][] = $tmpbody; $accessLog->logDebug('[site] mail head '.$tmpheader); } } } } $this->data['body'][] = $tmpArray; } function body_decode($head, $body) { global $accessLog; $accessLog->logDebug('[site] mail head : '.$head); $accessLog->logDebug('[site] mail body : '.$body); if (preg_match("/Content-Transfer-Encoding:.*?base64/i", $head)) { $body = base64_decode($body); $accessLog->logDebug('[site] mail body : base64'); }elseif (preg_match("/Content-Transfer-Encoding:.*?quoted-printable/i", $head)) { $body = quoted_printable_decode($body); $accessLog->logDebug('[site] mail body : quoted_printable'); } if (preg_match("/Content-Type:.*?text\/plain;.*?charset=(.*)/i", $head, $regs)) { $accessLog->logDebug('[site] mail body : charset = '.$regs[1]); if (!preg_match("/utf-8/i", $regs[1])) { $body = mb_convert_encoding($body,"UTF-8", trim($regs[1], " \t\r\n\"';")); $accessLog->logDebug('[site] mail body : charset encode'); } }elseif (preg_match("/Content-Type:.*?text\/html;.*?charset=(.*)/i", $head, $regs)){ return ''; }elseif (preg_match("/Content-Type:.*?multipart\/alternative;.*?boundary=(.*?)\n/i", $head)){ } return $body; } function tmp_clear() { $this->tmpdata = ''; $this->tmpheader = ''; $this->tmpbody = ''; } } function blogn_mobile_blog_new($m_users) { global $accessLog; $debugcnt = 0; while (list($key, $val) = each($m_users)) { $debugcnt++; $accessLog->logDebug('[site] check mobile post. user data ['.$debugcnt.'] in '.__FILE__.' on line '.__LINE__); // $key : $user_id $receive_addr = $val["receive_mail_address"]; $pop = $val["receive_mail_pop3"]; $apop = $val["receive_mail_apop"]; $loginid = $val["receive_mail_user_id"]; $loginpass = $val["receive_mail_user_pw"]; $send_addr = $val["send_mail_address"]; $mobile_category = $val["mobile_category"]; $mobile_cok = $val["mobile_comment_ok"]; $mobile_tok = $val["mobile_trackback_ok"]; if (!strlen($receive_addr) || !strlen($send_addr) || !strlen($pop) || !strlen($loginid) || !strlen($loginpass) || !strlen($apop)) { $accessLog->logNotice('[site] check mobile post. error check data in '.__FILE__.' on line '.__LINE__); }else{ $accessLog->logDebug('[site] check mobile post. clear check data in '.__FILE__.' on line '.__LINE__); if (!$maillog = new mailpost($pop)) { $accessLog->logNotice('[site] check mobile post. connect error mail server in '.__FILE__.' on line '.__LINE__); }else{ $accessLog->logDebug('[site] check mobile post. connect mail server in '.__FILE__.' on line '.__LINE__); if (!$login = $maillog->login($loginid, $loginpass, $apop)) { $accessLog->logNotice('[site] check mobile post. login error in '.__FILE__.' on line '.__LINE__); }else{ $accessLog->logDebug('[site] check mobile post. login in '.__FILE__.' on line '.__LINE__); $maillog->stat(); if ($maillog->mailcnt == 0) { $accessLog->logDebug('[site] check mobile post. empty mail in '.__FILE__.' on line '.__LINE__); $maillog->quit(); }else{ $tmpdata = array(); $matchcnt = 0; for($i = 1 ; $i <= $maillog->mailcnt ; $i++ ) { $accessLog->logDebug('[site] check mobile post. get mail data ['.$i.'] in '.__FILE__.' on line '.__LINE__); $maillog->get_data($i); if (preg_match("/{$send_addr}/i", $maillog->get_headeritem_tmpdata('from')) || preg_match("/{$send_addr}/i", $maillog->get_headeritem_tmpdata('Reply-To')) || preg_match("/{$send_addr}/i", $maillog->get_headeritem_tmpdata('Return-Path'))) { $matchcnt ++; $debug .="match!: {$matchcnt}件目\n"; $accessLog->logDebug('[site] check mobile post. mail data match ['.$matchcnt.'] in '.__FILE__.' on line '.__LINE__); $maillog->memory(); $buf = $maillog->del_data($i); $accessLog->logDebug('[site] check mobile post. delete mail data in '.__FILE__.' on line '.__LINE__); } $maillog->tmp_clear(); } $maillog->quit(); // メール取得完了 ここからメール内容処理 if ($matchcnt) { blogn_mobile_mail_check($maillog, $key, $mobile_category, $mobile_cok, $mobile_tok); } } } } } } } function blogn_mobile_mail_check(&$maillog, $userid, $mobile_category, $mobile_cok, $mobile_tok) { global $accessLog; if (!count($maillog->data['body'])) return ''; foreach($maillog->data['body'] as $no => $data) { $body = ''; $subject = $maillog->data['subject'][$no]; $now = $maillog->data['date'][$no]; foreach($data['head'] as $dno => $head) { $decodebody = $maillog->body_decode($head, $data['body'][$dno]); $decodebody = preg_replace("/\.[\r\n]*?$/", "", $decodebody); // attach file if (preg_match('/name=[ \t"]*([^"\r\n]+)["]*/i', $head, $regs)) { $filename = strtolower($regs[1]); $pathname = pathinfo($filename); $check_ext = str_replace(",", "|", BLOGN_PERMIT_FILE_TYPE); // ファイルタイプの許可チェック(ファイルタイプを登録しているか) if (!$check_ext) { $tmpbody = "[{$filename}]このファイルの種類はアップロードを許可されていません。"; }else{ // ファイルタイプの許可チェック(一致する許可タイプがあるか) if (!preg_match("/$check_ext/i", $pathname['extension'])) { $tmpbody = "[{$filename}]このファイルの種類はアップロードを許可されていません。"; }else{ // ファイルサイズチェック $size = (int)(strlen(rtrim($data['body'][$dno], '=')) * 3 / 4); if ($size > BLOGN_MAX_FILESIZE * 1024) { $tmpbody = ''; }else{ // マルチバイト文字の場合、ファイル名変更 if (preg_match("/[\xA1-\xFE]/", blogn_mbConv($filename, 4, 1))) { $filename = "m{$userid}_{$now}.".strtolower($pathname["extension"]); } // 同名ファイルがある場合はファイル名_1.jpgなど、後ろにナンバリングがつく $i=1; while (file_exists(BLOGN_FILEDIR.$filename)) { $filename = $pathname['filename']."_{$i}.".strtolower($pathname["extension"]); $i++; } $oldmask = umask(); umask(000); $fp = fopen(BLOGN_FILEDIR.$filename, "w"); @fputs($fp, $decodebody); fclose($fp); umask($oldmask); blogn_mod_db_file_add($userid, $filename, $filename); // ユーザーID, ファイル名, コメント if (preg_match("/image\//", $head)) { $dest = BLOGN_FILEDIR.$filename; $size = @getimagesize($dest); if ($size[0] > BLOGN_MAXWIDTH || $size[1] > BLOGN_MAXHEIGHT) { $ratio1 = BLOGN_MAXWIDTH / $size[0]; $ratio2 = BLOGN_MAXHEIGHT / $size[1]; if ($ratio1 < $ratio2) { $ratio = $ratio1; }else{ $ratio = $ratio2; } $width = round($size[0] * $ratio); $height = round($size[1] * $ratio); $tmpbody = '
'; }else{ $tmpbody = '
'; } }elseif (preg_match("/video\//", $head)) { if (preg_match("/quicktime/", $head) || preg_match("/3gpp/", $head)) { $tmpbody = ' <a href="'.BLOGN_FILEURL.$filename.'" target="_blank">'.BLOGN_FILEURL.$filename.'</a>'; }else{ $tmpbody = ''.BLOGN_FILEURL.$filename.''; } }elseif (preg_match("audio\//", $head)) { $tmpbody = ''.BLOGN_FILEURL.$filename.''; } } } } $body .= $tmpbody; }else{ $decodebody = preg_replace("/([[:digit:]]{11})|([[:digit:]\-]{13})/", "", $decodebody); // 電話番号削除 $decodebody = preg_replace("/[_]{25,}/", "", $decodebody); // 下線削除 $decodebody = preg_replace("/Content-type: multipart\/appledouble;[[:space:]]boundary=(.*)/","",$decodebody); // mac削除 $decodebody = nl2br($decodebody); //
挿入 $decodebody = str_replace("\r\n", "", $decodebody); // 改行コード削除 $decodebody = str_replace("\n", "", $decodebody); // 改行コード削除 $body .= $decodebody; } $accessLog->logDebug('[site] check mobile post. clear in '.__FILE__.' on line '.__LINE__); } // 携帯用独自タグ処理 if (preg_match("/\{cmtok\}/",$body)) { $body = preg_replace("/\{cmtok\}/", "", $body); $mobile_cok = true; } if (preg_match("/\{cmtng\}/",$body)) { $body = preg_replace("/\{cmtng\}/", "", $body); $mobile_cok = false; } if (preg_match("/\{trkok\}/",$body)) { $body = preg_replace("/\{trkok\}/", "", $body); $mobile_tok = true; } if (preg_match("/\{trkng\}/",$body)) { $body = preg_replace("/\{trkng\}/", "", $body); $mobile_tok = false; } if (preg_match("/\{secret\}/",$body)) { $body = preg_replace("/\{secret\}/", "", $body); $mobile_secret = true; }else{ $mobile_secret = false; } if (preg_match("/\{category([\w\W]+?)\}/i", $body, $cat)) { list($key_cat1, $key_cat2) = explode("-", trim($cat[1])); $body = preg_replace("/\{category([\w\W]+?)\}/i", "", $body); $category1 = blogn_mod_db_category1_load(); $category2 = blogn_mod_db_category2_load(); if (@$category1[1][$key_cat1]["name"] && @$category2[1][$key_cat2]["name"]) { $mobile_category = $key_cat1."|".$key_cat2; }elseif (@$category1[1][$key_cat1]["name"]) { $mobile_category = $key_cat1."|"; } } if (preg_match("/\{reserve([\w\W]+?)\}/i", $body, $res)) { list($key_res_date, $key_res_time) = explode(" ", trim($res[1])); list($key_res_year, $key_res_month, $key_res_day) = explode("/", $key_res_date); $body = preg_replace("/\{reserve([\w\W]+?)\}/i", "", $body); if (checkdate($key_res_month, $key_res_day, $key_res_year)) { if (trim($key_res_time) != "") { list($key_res_hour, $key_res_minutes, $key_res_second) = explode(":", trim($key_res_time)); $key_res = $key_res_year.$key_res_month.$key_res_day.$key_res_hour.$key_res_minutes.$key_res_second; }else{ $key_res = $key_res_year.$key_res_month.$key_res_day."000000"; } if ($key_res > $now) { $mobile_reserve = true; }else{ $mobile_reserve = false; } $now = $key_res; }else{ // 日付が判別できない場合、非公開にする $mobile_reserve = false; $mobile_secret = true; } } if (preg_match("/\{more\}/",$body)) { list($body, $more) = explode("{more}", $body); }else{ $more = ""; } $error = blogn_mod_db_log_add($userid, $now, $mobile_reserve, $mobile_secret, $mobile_cok, $mobile_tok, $mobile_category, $subject, $body, $more, 1); $accessLog->logDebug('[site] check mobile post. ['.$error[1].'] in '.__FILE__.' on line '.__LINE__); } } /* ----- 携帯投稿 ----- */ function blogn_mobile_blog_old($m_users) { $debugcnt = 0; while (list($key, $val) = each($m_users)) { $debugcnt++; $debug .= "--------\nユーザーデータ:$debugcnt件目\n"; // $key : $user_id $receive_addr = $val["receive_mail_address"]; $pop = $val["receive_mail_pop3"]; $apop = $val["receive_mail_apop"]; $loginid = $val["receive_mail_user_id"]; $loginpass = $val["receive_mail_user_pw"]; $send_addr = $val["send_mail_address"]; $mobile_category = $val["mobile_category"]; $mobile_cok = $val["mobile_comment_ok"]; $mobile_tok = $val["mobile_trackback_ok"]; $debug .= "ログイン情報(受信アドレス):"; if (strlen($receive_addr)) { $debug .= "OK\n"; }else{ $debug .= "NG\n"; } $debug .= "ログイン情報(POPサーバー):"; if (strlen($pop)) { $debug .= "OK\n"; }else{ $debug .= "NG\n"; } $debug .= "ログイン情報(APOP):"; if (strlen($apop)) { $debug .= "OK\n"; }else{ $debug .= "NG\n"; } $debug .= "ログイン情報(ログインID):"; if (strlen($loginid)) { $debug .= "OK\n"; }else{ $debug .= "NG\n"; } $debug .= "ログイン情報(ログインPASS):"; if (strlen($loginpass)) { $debug .= "OK\n"; }else{ $debug .= "NG\n"; } $debug .= "ログイン情報(送信先アドレス):"; if (strlen($send_addr)) { $debug .= "OK\n"; }else{ $debug .= "NG\n"; } if (strlen($receive_addr) && strlen($send_addr) && strlen($pop) && strlen($loginid) && strlen($loginpass) && strlen($apop)) { $debug .= "データチェック:OK\n"; if ($fp = @fsockopen ($pop, 110, $errno, $errstr, 30)) { $debug .= "メールサーバー接続:OK\n"; $buf = @fgets($fp, 512); if(substr($buf, 0, 3) == '+OK') { $debug .= "+OKメッセージ:OK\n"; if($apop == 1) { $arraybuf = explode(" ", trim($buf)); $md5pass = md5($arraybuf[count($arraybuf) - 1].$loginpass); $buf = blogn_send_cmd($fp, "APOP $loginid $md5pass"); } else { $buf = blogn_send_cmd($fp, "USER $loginid"); $buf = blogn_send_cmd($fp, "PASS $loginpass"); } if ($buf) { $debug .= "ログイン処理:OK\n"; }else{ $debug .= "ログイン処理:NG\n"; } $buf = blogn_send_cmd($fp, "STAT"); // +OK $num $size sscanf($buf, '+OK %d %d', $num, $size); $cnt = 0; if ($num == "0") { $debug .= "メール取得:0件\n"; $buf = blogn_send_cmd($fp, "QUIT"); fclose($fp); }else{ //メールデータ取得 $debug .= "メール取得:".$num."件\n"; $tmpdata = array(); for($i = 1 ; $i <= $num ; $i++ ) { $debug .= "-----\nメールデータ取得:".$i."件目\n"; $line = blogn_send_cmd($fp, "RETR $i"); while (!preg_match("/^\.\r\n/",$line)) { if ($line = @fgets($fp, 512)) { $tmpdata[$i] .= $line; }else{ break; } } list($head, $body) = explode("\r\n\r\n", $tmpdata[$i], 2); $body = preg_replace("/\r\n[\t ]+/", " ", $body); // 送信者アドレスの抽出 $sendaddresscheck = false; $freg = array(); if (preg_match("/Return-Path:[ \t]*([^\r\n]+)/", $head, $freg)) { $sendaddresscheck = true; $from1 = $freg[1]; $debug .= "送信者アドレス取得(Return-Path):OK\n"; } $freg = array(); if (preg_match("/Reply-To:[ \t]*([^\r\n]+)/", $head, $freg)) { $sendaddresscheck = true; $from2 = $freg[1]; $debug .= "送信者アドレス取得(Reply-To):OK\n"; } $freg = array(); if (preg_match("/From:[ \t]*([^\r\n]+)/", $head, $freg)) { $sendaddresscheck = true; $from3 = $freg[1]; $debug .= "送信者アドレス取得(From):OK\n"; } if (!$sendaddresscheck) { $debug .= "送信者アドレス取得:NG\n"; } $debug .= "取得送信者アドレス名(Return-Path):".$from1."\n"; $debug .= "取得送信者アドレス名(Reply-To):".$from2."\n"; $debug .= "取得送信者アドレス名(From):".$from3."\n"; if (preg_match("/=\?iso-2022-jp\?B\?([^\?]+)\?=[\r\n]*(.*)/",$freg[1],$from1)) { $from4 = blogn_mbConv(base64_decode($from1[1]),0,4); }elseif (preg_match("/=\?iso-2022-jp\?Q\?([^\?]+)\?=[\r\n]*(.*)/",$freg[1],$from1)) { $from4 = blogn_mbConv(quoted_printable_decode($from1[1]),0,4); } $debug .= "取得送信者アドレス名(その他):".$from4."\n"; // 送信者アドレスが登録アドレスの場合 if (preg_match("/$send_addr/", $from1) || preg_match("/$send_addr/", $from2) || preg_match("/$send_addr/", $from3) || preg_match("/$send_addr/", $from4)) { $debug .= "送信者アドレスマッチ:OK\n"; $cnt++; $receive_data[$cnt] = $tmpdata[$i]; $buf = blogn_send_cmd($fp, "DELE $i"); }else{ $debug .= "送信者アドレスマッチ:NG\n"; } } $buf = blogn_send_cmd($fp, "QUIT"); fclose($fp); // 取得データ処理 for ($i = 1 ; $i <= $cnt ; $i++ ) { $subject = $from = $text = $atta = $part = $attach = $pic = ""; list($head, $body) = explode("\r\n\r\n", $receive_data[$i], 2); $body = preg_replace("/\r\n[\t ]+/", " ", $body); // 日付の取得 preg_match("/Date:[ \t]*([^\r\n]+)/", $head, $tmp_date); // タイムゾーンの取得と加減算 if (($timestamp = strtotime($tmp_date[1])) === -1) { $now = _gmdate("YmdHis",time() + BLOGN_TIMEZONE); }else{ $now = _date("YmdHis",$timestamp); } $head = preg_replace("/\r\n? /", "", $head); // サブジェクトの取得 if (preg_match("/\nSubject:[ \t]*([^\r\n]+)/", $head, $tmp_sub)) { $subject = $tmp_sub[1]; while (preg_match("/(.*)=\?iso-2022-jp\?B\?([^\?]+)\?=(.*)/",$subject,$regs)) { $subject = $regs[1].base64_decode($regs[2]).$regs[3]; } while (preg_match("/(.*)=\?iso-2022-jp\?Q\?([^\?]+)\?=(.*)/",$subject,$regs)) { $subject = $regs[1].quoted_printable_decode($regs[2]).$regs[3]; } $subject = htmlspecialchars(blogn_mbConv($subject,0,4)); } if (preg_match("/\nContent-type:.*multipart\//",$head)) { preg_match('/boundary="([^"]+)"/', $head, $boureg); $body = str_replace($boureg[1], urlencode($boureg[1]), $body); $part = explode("\r\n--".urlencode($boureg[1])."-?-?",$body); if (preg_match('/boundary="([^"]+)"/', $body, $boureg2)) { $body = str_replace($boureg2[1], urlencode($boureg2[1]), $body); $body = preg_replace("/\r\n--/".urlencode($boureg[1])."-?-?\r\n","",$body); $part = explode("\r\n--".urlencode($boureg2[1])."-?-?",$body); } } else { $part[0] = $receive_data[$i]; } // 添付ファイルの処理ループ foreach ($part as $pic_cnt => $multi) { list($m_head, $m_body) = explode("\r\n\r\n", $multi, 2); $m_body = preg_replace("/\r\n[\t ]+/", " ", $m_body); $m_body = preg_replace("/\r\n\.\r\n$/", "", $m_body); if (!preg_match("/Content-type: *([^;\n]+)/", $m_head, $type)) continue; list($main, $sub) = explode("/", $type[1]); // 本文をデコード if (strtolower($main) == "text") { if (preg_match("/Content-Transfer-Encoding:.*base64/", $m_head)) $m_body = base64_decode($m_body); if (preg_match("/Content-Transfer-Encoding:.*quoted-printable/", $m_head)) $m_body = quoted_printable_decode($m_body); $text = blogn_mbConv($m_body,0,4); if ($sub == "html") $text = strip_tags($text); // 電話番号削除 $text = preg_replace("/([[:digit:]]{11})|([[:digit:]\-]{13})/", "", $text); // 下線削除 $text = preg_replace("/[_]{25,}/", "", $text); // mac削除 $text = preg_replace("/Content-type: multipart\/appledouble;[[:space:]]boundary=(.*)/","",$text); $text = str_replace("\r\n", "\r",$text); $text = str_replace("\r", "\n",$text); $text = preg_replace("/\n{2,}/", "\n\n", $text); $text = str_replace("\n", "
", $text); } // 添付データがある場合 if (preg_match("/name=\"?([^\"\n]+)\"?/",$m_head, $filereg)) { $filename = preg_replace("/[\t\r\n]/", "", $filereg[1]); $finfo = pathinfo($filename); $upfile_name = "m".$key.$i.$pic_cnt.$now.".".strtolower($finfo["extension"]); } $subtype = "gif|jpe?g|png"; if (preg_match("/Content-Transfer-Encoding:.*base64/", $m_head) && preg_match("/$subtype/", $finfo["extension"])) { $upfile = base64_decode($m_body); $oldmask = umask(); umask(000); $fp = fopen(BLOGN_FILEDIR.$upfile_name, "w"); @fputs($fp, $upfile); fclose($fp); umask($oldmask); blogn_mod_db_file_add($key, $upfile_name, $filename); } if ($upfile_name != "") { $dest = BLOGN_FILEDIR.$upfile_name; $size = @getimagesize($dest); if ($size[0] > BLOGN_MAXWIDTH || $size[1] > BLOGN_MAXHEIGHT) { $ratio1 = BLOGN_MAXWIDTH / $size[0]; $ratio2 = BLOGN_MAXHEIGHT / $size[1]; if ($ratio1 < $ratio2) { $ratio = $ratio1; }else{ $ratio = $ratio2; } $width = round($size[0] * $ratio); $height = round($size[1] * $ratio); $text .= '
'; }else{ $text .= '
'; } } } // 携帯用独自タグ処理 if (preg_match("/\{cmtok\}/",$text)) { $text = preg_replace("/\{cmtok\}/", "", $text); $mobile_cok = true; } if (preg_match("/\{cmtng\}/",$text)) { $text = preg_replace("/\{cmtng\}/", "", $text); $mobile_cok = false; } if (preg_match("/\{trkok\}/",$text)) { $text = preg_replace("/\{trkok\}/", "", $text); $mobile_tok = true; } if (preg_match("/\{trkng\}/",$text)) { $text = preg_replace("/\{trkng\}/", "", $text); $mobile_tok = false; } if (preg_match("/\{secret\}/",$text)) { $text = preg_replace("/\{secret\}/", "", $text); $mobile_secret = true; }else{ $mobile_secret = false; } if (preg_match("/\{category([\w\W]+?)\}/i", $text, $cat)) { list($key_cat1, $key_cat2) = explode("-", trim($cat[1])); $text = preg_replace("/\{category([\w\W]+?)\}/i", "", $text); $category1 = blogn_mod_db_category1_load(); $category2 = blogn_mod_db_category2_load(); if (@$category1[1][$key_cat1]["name"] && @$category2[1][$key_cat2]["name"]) { $mobile_category = $key_cat1."|".$key_cat2; }elseif (@$category1[1][$key_cat1]["name"]) { $mobile_category = $key_cat1."|"; } } if (preg_match("/\{reserve([\w\W]+?)\}/i", $text, $res)) { list($key_res_date, $key_res_time) = explode(" ", trim($res[1])); list($key_res_year, $key_res_month, $key_res_day) = explode("/", $key_res_date); $text = preg_replace("/\{reserve([\w\W]+?)\}/i", "", $text); if (checkdate($key_res_month, $key_res_day, $key_res_year)) { if (trim($key_res_time) != "") { list($key_res_hour, $key_res_minutes, $key_res_second) = explode(":", trim($key_res_time)); $key_res = $key_res_year.$key_res_month.$key_res_day.$key_res_hour.$key_res_minutes.$key_res_second; }else{ $key_res = $key_res_year.$key_res_month.$key_res_day."000000"; } if ($key_res > $now) { $mobile_reserve = true; }else{ $mobile_reserve = false; } $now = $key_res; }else{ // 日付が判別できない場合、非公開にする $mobile_reserve = false; $mobile_secret = true; } } if (preg_match("/\{more\}/",$text)) { list($text, $more) = explode("{more}", $text); }else{ $more = ""; } blogn_mod_db_log_add($key, $now, $mobile_reserve, $mobile_secret, $mobile_cok, $mobile_tok, $mobile_category, $subject, $text, $more, 1); } } }else{ $debug .= "+OKメッセージ:NG\n"; } }else{ $debug .= "メールサーバー接続:NG\n"; } }else{ $debug .= "データチェック:NG\n"; } } return $debug; } /* ----- コマンド送信 ----- */ function blogn_send_cmd($fp, $cmd) { @fputs($fp, $cmd."\r\n"); $buf = @fgets($fp, 512); if(substr($buf, 0, 3) == '+OK') { return $buf; } return false; } ?>