Example #1
0
if ($dh = opendir($dir)) {
    while (($file = readdir($dh)) !== false) {
        if (preg_match("/" . $conf->user . "_plan_(....)(..)(..)\\.txt/", $file, $matches)) {
            $year = $matches[1];
            $month = $matches[2];
            $day = $matches[3];
            $plans_yr[$year][] = $file;
        }
    }
    closedir($dh);
}
// List by year
foreach ($plans_yr as $key => $list) {
    $output_file = "../pdf/plan_" . $key . ".tex";
    $fp = fopen($output_file, "w");
    $head = starttex(".plan {$key}", "", "\\rightmark", "");
    $head .= "\\begin{document}\n" . title2tex(".plan ({$key})");
    $body = "";
    $last_month = "";
    $titles_by_month = array();
    // Sort by date
    asort($list);
    foreach ($list as $file) {
        // Read the file in, extract date
        $fp_plan = fopen($dir . $file, "r");
        $data_plan = ltrim(fread($fp_plan, filesize($dir . $file)));
        fclose($fp_plan);
        $date_from_file = substr($file, 11, 8);
        $month = substr($date_from_file, 4, 2);
        $date = date_to_string($date_from_file);
        if ($date_from_file < "19960701") {
Example #2
0
    while (($file = readdir($dh)) !== false) {
        //                 0123456789012345 67890123 456 789
        if (preg_match("/" . $conf->user . "_interview_(........)_(..)\\.txt/", $file, $matches)) {
            $key = $matches[1];
            $idx = $matches[2];
            $interview_list[$key . $idx] = $dir . $file;
        }
    }
    closedir($dh);
}
/*
	MAIN PAGE
*/
$output_file = "../pdf/interviews.tex";
$fp = fopen($output_file, "w");
$head = starttex("Interviews", "", "\\leftmark", "");
$head .= "\\begin{document}\n" . title2tex("Interviews");
$body = "";
ksort($interview_list);
foreach ($interview_list as $date_key => $file) {
    $fp_in = fopen($file, "r");
    $url_in = rtrim(fgets($fp_in, 1024));
    $title_in = rtrim(fgets($fp_in, 1024));
    $synopsis_in = rtrim(fgets($fp_in, 1024));
    $organization_in = rtrim(fgets($fp_in, 1024));
    $interviewer_in = rtrim(fgets($fp_in, 1024));
    $text_in = fread($fp_in, filesize($file));
    /*
    	MAIN PAGE
    */
    $body .= "\\chapter{" . html2tex($title_in) . "}\n";