예제 #1
0
function second_try($found, $post_title_param, $destination_title, $destination_dates)
{
    echo "\nfound             : [{$found}]";
    echo "\npost_title        : [{$post_title_param}]";
    echo "\ndestination_title : [{$destination_title}]\n";
    $post_titles = get_post_titles();
    // $post_titles = array("\(Biodiversity\)"); //debug
    $post_titles = array_diff($post_titles, array($post_title_param));
    //exclude the $post_title_param
    foreach ($post_titles as $post_title) {
        $title = $destination_title . "_" . $post_title;
        if ($wiki_path = get_wiki_text($title)) {
            $title_dates = get_dates($wiki_path);
            if ($destination_dates == $title_dates) {
                //start saving...
                $temp_write_file = $GLOBALS['doc_root'] . "/eoearth/Custom/temp/write.wiki";
                $handle = fopen($temp_write_file, "w");
                fwrite($handle, "#REDIRECT [[" . str_replace("\\", "", $found) . "]]");
                fclose($handle);
                echo "\n saving redirect on title: [{$title}]\n";
                shell_exec("php " . $GLOBALS['doc_root'] . "/eoearth/maintenance/edit.php -m " . $title . " < {$temp_write_file}");
            }
        }
    }
}
 case 'redir':
     $url = ereg_replace(";ampchar;", "&", $_GET['url']);
     $echostring .= '<center>' . $blogname . '<br />Ktai edition</center><hr />';
     $echostring .= '<p>当サイトの外にリンクしています。場合によっては、携帯端末では表示できない可能性があります。</p>';
     $echostring .= '<a href="' . $url . '">GO!</a>';
     $do_redir = false;
     $hidefooter = true;
     break;
 case "list":
     $start = intval($_REQUEST["start"]);
     //投稿一覧表示
     if ($ListPerPage > 6) {
         $ListPerPage = 6;
     }
     $echostring .= '<center>' . $blogname . '<br />Ktai edition</center><hr />';
     $title_lists = get_post_titles($start, $ListPerPage);
     $line_count = 0;
     foreach ($title_lists as $title) {
         if (trim($title->post_title) == "") {
             $title->post_title = _WP_POST_NOTITLE;
         }
         $ackey = $line_count + 1;
         $num = $start + $line_count;
         $date = mysql2date('m/d H:i', $title->post_date);
         $echostring .= $ackeychar[$ackey] . '.<a href="' . $myurl . '?view=content&num=' . $num . '&p=' . $title->ID . '&start=0' . $ses_param . '" accesskey="' . $ackey . '">' . $title->post_title . '</a>(' . $date . ')';
         $echostring .= '<font color="#FF00FF">[' . get_number_of_comments($title->ID) . ']</font><br />';
         $line_count++;
     }
     $echostring .= '<hr />';
     $nextstart = $start + $ListPerPage;
     if (find_post($nextstart)) {
$echostring .= '<title>' . $blogname . ' Ktai edition</title>';
$echostring .= '<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />';
$echostring .= '</head>';
$echostring .= '<body bgcolor=' . $BgColor . ' text=' . $TextColor . ' link=' . $LinkColor . '>';
if (!isset($_REQUEST["view"])) {
    $_REQUEST["view"] = "list";
    $_REQUEST["start"] = "0";
}
switch ($_REQUEST["view"]) {
    case "list":
        //投稿一覧表示
        if ($ListPerPage > 6) {
            $ListPerPage = 6;
        }
        $echostring .= '<center>' . $blogname . '<br />Ktai edition</center><hr />';
        $title_lists = get_post_titles($_REQUEST["start"], $ListPerPage);
        $line_count = 0;
        foreach ($title_lists as $title) {
            $ackey = $line_count + 1;
            $num = $_REQUEST["start"] + $line_count;
            $tmp = substr($title->post_date, 5, 2) . '/' . substr($title->post_date, 8, 2) . substr($title->post_date, 10, 6);
            $echostring .= $ackeychar[$ackey] . '.<a href="' . $HTTP_SERVER_VARS["PHP_SELF"] . '?view=content&num=' . $num . '&start=0" accesskey="' . $ackey . '">' . $title->post_title . '</a>(' . $tmp . ')';
            $echostring .= '<font color="#FF00FF">[' . get_number_of_comments($title->ID) . ']</font><br />';
            $line_count++;
        }
        $echostring .= '<hr />';
        $nextstart = $_REQUEST["start"] + $ListPerPage;
        if (find_post($nextstart)) {
            $echostring .= $ackeychar[9] . '<a href="' . $HTTP_SERVER_VARS["PHP_SELF"] . '?view=list&start=' . $nextstart . '" accesskey="9">次の' . $ListPerPage . '件 &gt;</a><br/>';
        }
        $prevstart = $_REQUEST["start"] - $ListPerPage;