function rightTrim($str, $needle, $caseSensitive = false) { $strPosFunction = $caseSensitive ? "strpos" : "stripos"; if ($strPosFunction($str, $needle, strlen($str) - strlen($needle)) !== false) { $str = substr($str, 0, -strlen($needle)); } return $str; } $null = "NULL"; // Check for valid page input $page = $_GET['page']; $page = str_replace('"', '', $page); if ($page==NULL) {$page=0;} if (!preg_match("/^([0-2]|1[0-2]|2[0-5]|4[0-3]|6[0-1]|10[0-3])$/", $page)) die("Invalid page number. Requested page is either missing or does not exist."); // Check for valid PID input $PID = $_GET['PID']; $PID = str_replace('"', '', $PID); if ($PID==NULL) {$PID="placeholder99";} if (!preg_match("/^[a-z]*[0-9]{2}[a-z]*$/", $PID)) die("Invalid PID. Requested paper is either missing or does not exist."); if ($PID=="placeholder99") {$PID=$null;} // Check for valid loc input $loc = $_GET['loc']; $loc = str_replace('"', '', $loc); if (!preg_match("/^[a-zA-Z0-9_-]*$/", $loc)) die("Invalid loc. Requested folder is either missing or does not exist."); if ($loc=="") { $locout = ""; $loc = "/"; } else { $locout = "&loc=".$loc; $loc = $loc."/"; } // Check for valid pdf input $pdf = $_GET['pdf']; $pdf = str_replace('"', '', $pdf); if (!preg_match("/^[\.a-zA-Z0-9_-]*$/", $pdf)) die("Invalid pdf. Requested file is either missing or does not exist."); $pdfout=""; if ($pdf!="") {$pdfout="&pdf=".$pdf;} // Cycle banners by day $file = "images/banners.txt"; $data = @file($file) or die('Could not read file!'); $ctr=0; foreach ($data as $line) { if ($ctr==0) { $banners = explode('@&@', $line);} } $lb = count($banners); $date = getdate(); $day = $date['yday']; $setban = FALSE; $banner = $_GET['banner']; $banner = str_replace('"', '', $banner); if ($banner==NULL) { $cday = $day%$lb; } else { if (!preg_match("/^([0-8])$/", $banner)) die("Invalid banner value."); $setban = TRUE; $cday = $banner; } $bnum = trim($banners[$cday]); $advban = $_GET['nextbanner']; $advban = str_replace('"', '', $advban); if ($advban==NULL) { $advban=FALSE; } else { if (!preg_match("/^(TRUE|true|True|1)$/", $advban)) die("Invalid nextbanner value."); } if ($advban) { $cday = ($cday + 1)%$lb; $bnum = trim($banners[$cday]); $setban = TRUE; } if ($setban) { $banout = '&banner='.$cday; } else { $banout = ""; } // Make banner-specific color styles $file = "images/boxes.txt"; $data = @file($file) or die('Could not read file!'); $ctr = 0; foreach ($data as $line) { if ($ctr==0) { $boxes = explode('@&@', $line);} } $boxes = trim($boxes[$cday]); echo ''; // Get banner-specific CSSS logos $file = "images/csss.txt"; $data = @file($file) or die('Could not read file!'); $ctr = 0; foreach ($data as $line) { if ($ctr==0) { $csssImg = explode('@&@', $line);} } $csssImg = trim($csssImg[$cday]); // Check OS variable $os = $_GET['os']; $os = str_replace('"', '', $os); if ($os==NULL) { $os="none"; $osout = ""; } else { $osout = '&os='.$os; } if (!preg_match("/^(mac|pc|unix|none)$/", $os)) die("Invalid OS variable. Requested page is either missing or does not exist."); // Check Panel class variable $pan = $_GET['pan']; $pan = str_replace('"', '', $pan); if (!($pan==NULL || $pan=="essex" || $pan=="uw")) die("Invalid pan input. Requested page is either missing or does not exist."); if ($page==23 || $page==24 || $pan==NULL) { if ($page==23) { $pan="essex"; $panout = '&pan='.$pan; } else { if ($page==24) { $pan="uw"; $panout = '&pan='.$pan; } else { $pan="none"; $panout = ""; } } } else { $panout = '&pan='.$pan; } // Cycle photo by day $file = "images/portraits.txt"; $data = @file($file) or die('Could not read file!'); $ctr=0; foreach ($data as $line) { if ($ctr==0) { $portraits = explode('@&@', $line);} } $lp = count($portraits); $date = getdate(); $day = $date['yday']; $setpor = FALSE; $photo = $_GET['photo']; if ($photo==NULL) { $pday = $day%$lp; } else { if (!preg_match("/^([0-9])$/", $photo)) die("Invalid photo value."); $setpor = TRUE; $pday = $photo; } $pnum = trim($portraits[$pday]); $advpor = $_GET['nextphoto']; if ($advpor==NULL) { $advpor=FALSE; } else { if (!preg_match("/^(TRUE|true|True|1)$/", $advpor)) die("Invalid nextphoto value."); } if ($advpor) { $pday = ($pday + 1)%$lp; $pnum = trim($portraits[$pday]); $setpor = TRUE; } if ($setpor) { $porout = '&photo='.$pday; } else { $porout = ""; } // Cycle UW photo by day $file = "images/uwphotos.txt"; $data = @file($file) or die('Could not read file!'); $ctr=0; foreach ($data as $line) { if ($ctr==0) { $uwphotos = explode('@&@', $line);} if ($ctr==1) { $uwphtheights = explode('@&@', $line);} $ctr = $ctr + 1; } $lpht = count($uwphotos); $setpht = FALSE; $uwphoto = $_GET['uwphoto']; if ($uwphoto==NULL) { $phtday = $day%$lpht; } else { if (!preg_match("/^([0-9])$/", $uwphoto)) die("Invalid photo value."); $setpht = TRUE; $phtday = $uwphoto; } $phtnum = trim($uwphotos[$phtday]); //echo $uwphotos[$phtday]; $phtheight = trim($uwphtheights[$phtday]); $advpht = $_GET['nextuwphoto']; if ($advpht==NULL) { $advpht=FALSE; } else { if (!preg_match("/^(TRUE|true|True|1)$/", $advpht)) die("Invalid nextuwphoto value."); } if ($advpht) { $phtday = ($phtday + 1)%$lpht; $phtnum = trim($uwphotos[$phtday]); $phtheight = trim($uwphtheights[$phtday]); $setpht = TRUE; } if ($setpht) { $phtout = '&uwphoto='.$phtday; } else { $phtout = ""; } // Make sidebar $title = "none"; if ($page==10) $title = 'Books'; if ($page==11) $title = 'Articles'; if ($page==12) $title = 'Papers'; if ($page==20) $title = '503'; if ($page==21) $title = 'MLE'; if ($page==22) $title = 'Visual'; if ($page==23) $title = 'Panel @Essex'; if ($page==24) $title = 'Panel @UW'; if ($page==25) $title = 'VMIR'; if ($page==40) $title = '205'; if ($page==41) $title = '221'; if ($page==42) $title = '321'; if ($page==43) $title = '409'; if ($page==60) $title = 'Software'; if ($page==61) $title = 'Data'; if ($page==101) $title = $loc.$pdf.'.pdf'; if ($page==102) $title = $loc.$pdf.'.pdf'; if ($page==103) $title = $loc.$pdf.'.pdf'; if ($title=="none"){ echo '
';
echo ' ';
echo ' | ';
echo '';
echo ' ';
echo ' | ';
echo '
';
echo '
| ';
}
// PDF viewer pages
// Paper viewer
if ($page=="101") {
echo '||||||||||||||||||||||||||||
| ';
echo ' '.$bio[0].' '; echo 'Substantive Interests '; echo ''.$bio[1].' '; echo 'Methodological interests '; echo ''.$bio[2].' '; echo 'Other activities '; echo ''.$bio[3].' '; echo 'COVID-19 State Policy Project '; echo ''.$bio[5].' '; echo ' | ';
echo '';
echo '';
if ($page==0) {
echo '';
// class="img"> ';
// echo '
| ';
echo '
| ';
$ctr = 0;
foreach ($data as $line) {
$ctr = $ctr + 1;
$news = explode('@&@', $line);
$publish = 1;
if ($ctr<$lower) {$publish = 0;}
if ($ctr>$upper) {$publish = 0;}
$limit = min($upper,$totpost);
if ($publish==1) {
if ($ctr<$limit) {
echo ' '.trim($news[0]).'. '.trim($news[1]).' '; } else { echo ''.trim($news[0]).'. '.trim($news[1]).' '; } } } echo ' | ';
echo '
| ';
if ($grad==2) {
echo ' '.$course[1].' '; } else { echo ''.$course[1].' '; } echo ''.$course[0].' '; echo ''.$course[3].' '; echo ''; if (trim($course[13])!=$null) { echo ''; } //echo ''; if (trim($course[15])!=$null) { echo ''; } echo ' | ';
echo '';
echo '';
echo ' '.$course[5].' '; echo 'Class meets: '; echo $course[6].''; echo $course[7].' '; if (trim($course[8])!=$null) { echo '
Section meets: '; echo $course[11].''; echo $course[12].' '; } echo ' | ';
echo '
Lectures Click on lecture titles to view slides or the buttons to download them as PDFs.
'; $ctr = 0; foreach ($data as $line) { $ctr = $ctr + 1; $lecture = explode('@&@', $line); if ($grad==1) { if ($ctr>1) { echo ''; echo ''.$lecture[0].'
'; } else { echo ''.$lecture[0].'
'; } if (trim($lecture[2])!=$null) { if (trim($lecture[2])!=trim($lecture[3])) { echo ''; } else { //echo preg_replace('/string$/', '', $str); rightTrim(trim($lecture[2]), ".pdf"); echo ''; } } else { echo ''.$lecture[1].'
'; } if (trim($lecture[4]) != $null) { echo ''.$lecture[4].'
'; } } else { if ($ctr>1) { echo ''.$lecture[0].'
'; } else { echo ''.$lecture[0].'
'; } if (preg_match("/^(day|covid)[a-zA-Z0-9]*$/", rightTrim(trim($lecture[2]), ".pdf"))) {$viewType="101";} else {$viewType="102";} echo ''; if (trim($lecture[3]) != $null) { echo ''.$lecture[3].'
'; } } } // Assignments info $file = $dir."/ps".$dir.".txt"; $data = @file($file) or die('Could not read file!'); echo ''; echo 'Student Assignments
'; $ctr = 0; foreach ($data as $line) { $ctr = $ctr + 1; if ($ctr>1) {echo '';} $probset = explode('@&@', $line); if (trim($probset[2])!=$null) { echo ''; } else { echo ''.$probset[0].'
'; } echo ''.$probset[1].'
'; if (trim($probset[3])!=$null) { if (trim($probset[2])!=$null) { $probset[3] = ''.$probset[3]; } echo ''.$probset[3].'
'; } } // Lab info (draws from TA's website) $file = $dir."/laburl".$dir.".txt"; //echo $file; $TAurl = @file_get_contents($file) or die('Could not read file!'); //echo $TAurl; if (trim($TAurl)!=$null) { $file = trim($TAurl)."/lab".$dir.".txt"; $read = 1; $data = @file($file) or $read=0; if ($read==1) { echo ''; echo 'Labs
'; $ctr = 0; foreach ($data as $line) { $ctr = $ctr + 1; $lab = explode('@&@', $line); if ($ctr>1) { echo ''; echo ''.$lab[0].'
'; } else { echo ''.$lab[0].'
'; } if (trim($lab[2]) != $null) { //echo ''; echo ''; } else { echo ''.$lab[1].'
'; } if (trim($lab[3])!="NULL") { if (trim($lab[2])!="NULL") { //$lab[3] = 'Supplementary material:'.$lab[3]; } echo ''.$lab[3].'
'; } } } } } $dir = $null; if ($page==10) {$dir = 'books'; $art=0;} if ($page==11) {$dir = 'articles'; $art=1;} if ($page==12) {$dir = 'papers'; $art=1;} if ($dir!=$null) { for ($i = 1; $i <= 2; $i++) { $file = $dir."/".$dir.$i.".txt"; $havedata = 1; $data = @file($file) or $havedata=0; if ($havedata) { // Check for PID in this group of publications $PIDinlist=FALSE; foreach ($data as $line) { $papers = explode('@&@', $line); if (trim($papers[0])==$PID) { $PIDinlist=TRUE; } } if ($page==10) { if ($i==1) { //echo 'Books
'; echo ''; } else { echo 'Manuscripts
'; } } if ($page==11) { if ($PID==$null) { if ($i==1) { echo 'Journal Articles
'; } else { echo 'Other Publications
'; } } else { if ($i==1) { if ($PIDinlist==TRUE) { echo ' '; } } else { if ($PIDinlist==TRUE) { echo ' '; } } } } if ($page==12) { if ($PID==$null) { if ($i==1) { echo 'Working Papers
'; } else { echo 'Reports and Unpublished Papers
'; } } else { if ($i==1) { if ($PIDinlist==TRUE) { echo ' '; } } else { if ($PIDinlist==TRUE) { echo '← Reports and unpublished papers
'; } } } } foreach ($data as $line) { $papers = explode('@&@', $line); // Abbreviated paper list if (($PID == $null) and ($page!=10)) { echo '| ';
$titletemp = $papers[1];
$titletemp = ''.$titletemp.'';
if (trim($papers[6])!="NULL") {
$titletemp = $titletemp.' '.$titletemp.' '; echo $titletemp; $stitletemp = preg_replace('/(\d{4}),.*$/', '$1.', $papers[2]); $stitletemp = ''; echo $stitletemp; if (trim($papers[3]) != $null) { echo ''.$papers[3].' '; } if (trim($papers[8]) != $null) { echo ' | '; echo ''; echo ' |
'; //460
}
if ($page==11) {
echo '
| '; echo ''; echo ' |
'.$papers[4].'
'; } if (trim($papers[14]) != $null) { if ($page==10) { $abstemp = ''.$papers[14].'
'; echo $abstemp; } else { $abstemp = ''.$papers[14].'
'; //echo ''; //echo 'Replication Data: '.$papers[7].'
'; } else { $reptemp = 'Replication: '.$papers[7].'
'; } echo $reptemp; } // Add endorsements & media discussion if ($page==10) { if (trim($papers[15]) != $null) { $blurbfile = $dir."/".trim($papers[15]).".txt"; $haveblurbdata = 1; $blurbdata = @file($blurbfile) or $haveblurbdata=0; if ($haveblurbdata) { echo '| ';
foreach ($blurbdata as $blurbline) {
$blurbs = explode('@&@', $blurbline);
if (trim($blurbs[5]) == 0) {
$blbtemp = '“'.trim($blurbs[0]).'”';
if (trim($mentions[4]) != $null) {
$blbtemp = $blbtemp.''.trim($blurbs[1]).', ';
} else {
$blbtemp = $blbtemp.trim($blurbs[1]).', ';
}
if (trim($blurbs[2]) != $null) {
$blbtemp = $blbtemp.trim($blurbs[2]);
}
echo ' '.$blbtemp.' '; } } echo ' | ';
foreach ($blurbdata as $blurbline) {
$blurbs = explode('@&@', $blurbline);
if (trim($blurbs[5]) == 1) {
$blbtemp = '“'.trim($blurbs[0]).'”';
if (trim($mentions[4]) != $null) {
$blbtemp = $blbtemp.''.trim($blurbs[1]).', ';
} else {
$blbtemp = $blbtemp.trim($blurbs[1]).', ';
}
if (trim($blurbs[2]) != $null) {
$blbtemp = $blbtemp.trim($blurbs[2]);
}
echo ' '.$blbtemp.' '; } } echo ' |
Reviews
'; $mediafile = $dir."/".trim($papers[17]).".txt"; $havemediadata = 1; $mediadata = @file($mediafile) or $havemediadata=0; if ($havemediadata) { foreach ($mediadata as $medialine) { $mentions = explode('@&@', $medialine); $mentemp = ''; if (trim($mentions[0]) != $null) { $mentemp = trim($mentions[0]).', '.$mentemp; } if (trim($mentions[1]) != $null) { $mentemp = $mentemp.'“'.trim($mentions[1]).',” '; $mentemp = $mentemp.''.trim($mentions[2]).', '; } else { $mentemp = $mentemp.''.trim($mentions[2]).', '; } $mentemp = $mentemp.trim($mentions[3]).'.'; $mentemp = ''.$mentemp.'
'; echo $mentemp; } } } if (trim($papers[16]) != $null) { echo 'Media
'; $mediafile = $dir."/".trim($papers[16]).".txt"; $havemediadata = 1; $mediadata = @file($mediafile) or $havemediadata=0; if ($havemediadata) { foreach ($mediadata as $medialine) { $secondhalf = 0; $mentions = explode('@&@', $medialine); $mentemp = '“'.trim($mentions[1]); if (trim($mentions[0]) != $null) { $mentemp = trim($mentions[0]).', '.$mentemp; } if (trim($mentions[2]) != $null) { $secondhalf = 1; $mentemp2 = trim($mentions[2]); } if (trim($mentions[3]) != $null) { if ($secondhalf) { $mentemp2 = ''.$mentemp2.', '.trim($mentions[3]); } else { $mentemp2 = trim($mentions[3]); } $secondhalf = 1; } if ($secondhalf) { $mentemp = $mentemp.',” '.$mentemp2.'.'; } else { $mentemp = $mentemp.'.”'; }; $mentemp = ''.$mentemp.'
'; echo $mentemp; } } } } echo ''; if ($page==11) { echo ''; } } } } } } $dir = $null; if ($page==60) {$dir = 'software';} if ($dir!=$null) { $file = $dir."/".$dir."1.txt"; $data = @file($file) or die('Could not read file!'); echo 'R Packages
'; foreach ($data as $line) { $rpack = explode('@&@', $line); echo ''.$rpack[0].'
'; echo ''.$rpack[1].'
'; echo ''; echo ''.$rpack[6].'
'; if (trim($rpack[5]) !=$null) { echo 'Dependencies:'.$rpack[5].'
'; } if (trim($rpack[7]) != $null) { echo 'Demonstration scripts:'.$rpack[7].'
'; } if (trim($rpack[8]) != $null) { echo 'Development: '.$rpack[8].'
'; } } $file = $dir."/".$dir."2.txt"; $data = @file($file) or die('Could not read file!'); echo 'Typesetting Resources
'; foreach ($data as $line) { $rpack = explode('@&@', $line); echo ''.$rpack[0].'
'; echo ''.$rpack[1].'
'; if ($rpack[2]==1) { echo ''; } if ($rpack[2]==2) { echo ''; } if ($rpack[2]==3) { echo ''; } if ($rpack[2]==4) { echo ''; } echo ''.$rpack[5].'
'; if (trim($rpack[4]) !=$null) { echo 'Dependencies:'.$rpack[4].'
'; } if (trim($rpack[6]) != $null) { echo 'Demonstration scripts:'.$rpack[6].'
'; } } $file = $dir."/".$dir."3.txt"; $data = @file($file) or die('Could not read file!'); echo 'Other Code Snippets
'; foreach ($data as $line) { $rpack = explode('@&@', $line); echo ''.$rpack[0].'
'; echo ''.$rpack[1].'
'; if ($rpack[2]==1) { echo ''; } if ($rpack[2]==2) { echo ''; } if ($rpack[2]==3) { echo ''; } if ($rpack[2]==4) { echo ''; } echo ''.$rpack[5].'
'; if (trim($rpack[4]) !=$null) { echo 'Dependencies:'.$rpack[4].'
'; } if (trim($rpack[6]) != $null) { echo 'Demonstration scripts:'.$rpack[6].'
'; } } echo ''; } $dir = $null; if ($page==61) {$dir = 'data';} if ($dir!=$null) { for ($i = 1; $i <= 2; $i++) { $file = $dir."/".$dir.$i.".txt"; $havedata = 1; $data = @file($file) or $havedata=0; if ($havedata) { if ($i==1) { echo 'Replication Data *Corresponding author.
'; } else { echo 'Stand-alone Data *Corresponding author.
'; } foreach ($data as $line) { $papers = explode('@&@', $line); echo ''.$papers[0].'
'; echo ''.$papers[1].'
'; if (trim($papers[4]) == 1) { echo ''; } if (trim($papers[4]) == 2) { echo ''; } if (trim($papers[2]) != $null) { echo ''.$papers[2].'
'; } if (trim($papers[3]) != $null) { echo ''.$papers[3].'
'; } if (trim($papers[6]) != $null) { echo ''.$papers[6].'
'; } echo ''; } } } } echo ''; echo ''; echo ''; echo ''; echo ''; $file = "images/footer.txt"; $data = @file($file) or die('Could not read file!'); $ctr = 0; foreach ($data as $line) { if ($ctr==0) { $colors = explode('@&@', $line);} } $fcol = trim($colors[$cday]); echo '| '; echo ' | '; echo ''; echo ''; echo ' | '; echo ''; // 405
echo '';
//echo ' '; //echo 'Center for Statistics //and the Social Sciences'; //echo ' '; echo ' | ';
echo '';
echo ' '; echo 'Designed byChris Adolph & Erika Steiskal'; echo 'Copyright 2011–2025'; echo 'Privacy · Terms of Use'; echo ' '; echo ' | ';
echo '';
echo ' ';
echo ' | ';
echo '