⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 event.php3

📁 Event Calendar是一个在线事件日程
💻 PHP3
📖 第 1 页 / 共 4 页
字号:
		?>>PM<BR>		<B>Ending time:</B>		<INPUT TYPE=text SIZE=2 MAXLENGTH=2 NAME="end_month"<?			if( $this->end_time )				echo( " VALUE=\"" . date( "m", $this->end_time ) .					"\"" );		?>> /		<INPUT TYPE=text SIZE=2 MAXLENGTH=2 NAME="end_date"<?			if( $this->end_time )				echo( " VALUE=\"" . date( "j", $this->end_time ) .					"\"" );		?>> /		<INPUT TYPE=text SIZE=4 MAXLENGTH=4 NAME="end_year"<?			if( $this->end_time )				echo( " VALUE=\"" . date( "Y", $this->end_time ) .					"\"" );		?>> at		<INPUT TYPE=text SIZE=2 MAXLENGTH=2 NAME="end_hour"<?			if( $this->end_time )				echo( " VALUE=\"" . date( "h", $this->end_time ) .					"\"" );		?>> :		<INPUT TYPE=text SIZE=2 MAXLENGTH=2 NAME="end_minute"<?			if( $this->end_time )				echo( " VALUE=\"" . date( "i", $this->end_time ) .					"\"" );		?>>		<INPUT TYPE=checkbox NAME="end_pm" VALUE="yup"<?			if( $this->end_time &&					(date( "H", $this->end_time ) > 11) ) {				echo( " CHECKED" );			}		?>>PM<BR>If a long event only occurs on certain days of the week, check the appropriatedays:<BR>		<?php		if( $error = outputCheckboxFromTable( $my_conn, "srcWeekday",				"day", "name", "weekday", 3, 0, -1, 0,				$this->weekday_id )) {			$this->error = $error;		}		?><BR>		<B>Description:</B><BR>		<TEXTAREA NAME="description" ROWS=5 COLS=30 WRAP=soft><?		if( $this->description ) {			echo( stripSlashes( $this->description ) );		}		?></TEXTAREA><BR>		<?php		echo( "<B>Location:</B> <I>(make sure it's cleared with "			. "the proper people)</I>\n" );		if( $error = outputPulldownFromTable( $my_conn, "srcLocation",				"location_id", "name", "location",				$this->location_id )) {			$this->error = $error;		}		echo( "<BR>\n" );		echo( "<B>Category:</B> (check those that apply, or none for &quot;general&quot;)<BR>\n" );		if( $error = outputCheckboxFromTable( $my_conn,				"srcCategory", "category_id", "name",				"category", 3, 0, 0, 1, $this->category_id )) {			$this->error = $error;		}						echo( "<BR>\n" );		echo( "<B>Audience:</B> (check all that apply, or none for &quot;all&quot;)<BR>\n" );		if( $error = outputCheckboxFromTable( $my_conn,				"srcAudience", "audience_id", "name",				"audience", 3, 0, 0, 1, $this->audience_id )) {			$this->error = $error;		}						echo( "<BR>\n" );		echo( "<B>Contact E-Mail:</B> (optional)\n" );		echo( "<INPUT TYPE=text NAME=\"info_email\"" );		if( $this->info_email )			echo( " VALUE=\"" . $this->info_email . "\"" );		echo( "><BR>\n" );		echo( "<B>URL for further info:</B> (optional, please include " .			"&quot;http://&quot)\n" );		echo( "<INPUT TYPE=text NAME=\"info_url\"" );		if( $this->info_url )			echo( " VALUE=\"" . $this->info_url . "\"" );		echo( "><BR>\n" );		echo( "<INPUT TYPE=checkbox NAME=\"hide_oc\" VALUE=\"yup\"");		if( $this->hide_oc ) {			echo( " CHECKED" );		}		echo( ">\n" .			"Check this box to keep the event hidden from off-campus browsers.<BR>\n" );		if( $GLOBALS["session"]->permissions &				$GLOBALS["pApproveOwn"] ) {			echo( "<INPUT TYPE=checkbox NAME=\"preapproved\" VALUE=\"whee\"" );			if( $this->approver_id &&					($this->approver_id == $this->submitter_id) ) {				echo( " CHECKED" );			}			echo( ">\n" . "Preapprove this event.<BR>\n" );		}		if( $this->approver_id ) {			echo( "<INPUT TYPE=hidden NAME=\"approver_id\" VALUE=\""				. $this->approver_id . "\">\n" );		}		echo( "<BR>\n" );			}	function verifyAction( $action ) {// check permissions and make sure this person can do what they're trying to		if( !isSet( $GLOBALS["SRCSessionKey"] ) ) {			return 0;		}		$session = new SRCSession();		$session->loadSession( $GLOBALS["SRCSessionKey"] );		$perms_list = $session->permissions_list;		if( (($temp = $perms_list["-1"]) > 0)			&& ( (($temp & $GLOBALS["p". $action ."Own"]) &&			($this->submitter_id == $session->user_id)) ||			(($temp & $GLOBALS["p". $action ."Other"]) &&			($this->submitter_id != $session->user_id)) )		) {			return 1;		}		if( (($temp = $perms_list[$this->location_id]) > 0)			&& ( (($temp & $GLOBALS["p". $action ."Own"]) &&			($this->submitter_id == $session->user_id)) ||			(($temp & $GLOBALS["p". $action ."Other"]) &&			($this->submitter_id != $session->user_id)) )		) {			return 1;		}	}}// this is a subclass which can be initialized from the hash that//  pg_fetch_array returnsclass SRCEventFromArray extends SRCEvent {	function SRCEventFromArray( $array ) {		$this->initFromArray( $array );	}	function initFromArray( $array ) {		$this->event_id = $array["event_id"];		$this->submitter_id = $array["submitter_id"];		$this->title = $array["title"];		$this->description = $array["description"];		$this->location_id = $array["location_id"];		$this->audience_id = $array["audience_id"];		$this->category_id = $array["category_id"];		$this->start_time = $array["start_time"];		$this->end_time = $array["end_time"];		$this->submitted_time = $array["submitted_time"];		$this->info_url = $array["info_url"];		$this->info_email = $array["info_email"];		$this->approver_id = $array["approver_id"];				$this->hide_oc = $array["hide_oc"];		$this->weekday_id = $array["weekday_id"];		$this->modify_id = $array["modify_id"];	}}// this subclass is initiallized with an event_id, which it uses to search//  the database and fetch the required informationclass SRCEventFromEventID extends SRCEventFromArray {	function SRCEventFromEventID( $new_id ) {		$this->initFromEventID( $new_id );	}	function initFromEventID( $new_id ) {		$db_conn = connectROToCalendar();		$query = "SELECT * FROM srcEvent WHERE event_id = " . $new_id;		$result_id = @pg_exec( $db_conn, $query );		$this->initFromArray( @pg_fetch_array( $result_id, 0 ) );		$query = "SELECT audience_id FROM srcAudienceList WHERE " .			"event_id = " . $new_id;		$result_id = @pg_exec( $db_conn, $query );		$num_rows = pg_numrows( $result_id );		for( $i = 0; $i < $num_rows; $i++ ) {			$stuff = @pg_fetch_array( $result_id, $i );			$this->audience_id[$i] = $stuff["audience_id"];		}		$query = "SELECT category_id FROM srcCategoryList WHERE " .			"event_id = " . $new_id;		$result_id = @pg_exec( $db_conn, $query );		$num_rows = pg_numrows( $result_id );		for( $i = 0; $i < $num_rows; $i++ ) {			$stuff = @pg_fetch_array( $result_id, $i );			$this->category_id[$i] = $stuff["category_id"];		}		$query = "SELECT day FROM srcWeekdaylist WHERE " .			"event_id = " . $new_id;		$result_id = @pg_exec( $db_conn, $query );		$num_rows = pg_numrows( $result_id );		for( $i = 0; $i < $num_rows; $i++ ) {			$stuff = @pg_fetch_array( $result_id, $i );			$this->weekday_id[$i] = $stuff["day"];		}	}}// this subclass also fetches the string name that goes with each IDclass SRCEventWithStringsFromEventID extends SRCEventFromEventID {	function SRCEventWithStringsFromEventID( $new_id ) {		$this->initFromEventID( $new_id );		$this->getStringsForIDs();	}}// this gives us an empty event, suitable for outputting an empty edittable eventclass SRCEmptyEvent extends SRCEvent {	function SRCEmptyEvent() {		$this->event_id = $this->title = $this->description =		$this->location_id = $this->audience_id = $this->category_id =		$this->start_time = $this->end_time = $this->submitted_time =		$this->submitter_id = $this->approver_id = $this->info_url =		$this->info_email = $this->error = $this->location =		$this->audience = $this->category = $this->submitter =		$this->approver = $this->hide_oc = $this->weekday_id =		$this->weekday = $this->modify_id = "";	}}// this class works for grabbing values from a form that was just submittedclass SRCEventFromGlobals extends SRCEvent {	function SRCEventFromGlobals( $session_var = "" ) {		$this->initFromGlobals( $session_var );	}	function initFromGlobals( $session_var = "session" ) {		global $start_month, $start_date, $start_year, $end_month,			$end_date, $end_year, $start_hour, $start_minute,			$end_hour, $end_minute, $title, $description,			$info_url, $info_email, $start_pm, $end_pm, $hide_oc,			$preapproved, $approver_id, $modify_id;// We can check to make sure the date is valid, but the validate function will// validate the rest of it		if( !isSet( $start_hour ) )			$start_hour = 0;		if( isSet( $start_pm ) ) {			if( $start_hour <= 11 )				$start_hour += 12;		} elseif ( $start_hour == 12 ) {			$start_hour = 0;		}		if( $start_hour > 23 ) {			$this->start_time = -1;			$this->error = "The starting hour is invalid.";		} else {			if( !isSet( $start_minute ) )				$start_minute = 0;			elseif( $start_minute > 59 ) {				$this->start_time = -1;				$this->error = "The starting minute is invalid.";			}		}// We have to validate the date before-hand because otherwise the mktime()// function will roll over into the next month or year, and still create a//  valid timestamp		if( !checkDate( $start_month, $start_date, $start_year ) ||			$this->start_time == -1 ) {			$this->start_time = -1;			$this->error = "The starting date is invalid.";		} else {			$this->start_time = mktime( $start_hour, $start_minute,				0, $start_month, $start_date, $start_year );		}		if( $end_hour || $end_minute || $end_month ||				$end_date || $end_year ) {			if ( ! $end_month )				$end_month = $start_month;			if( ! $end_date )				$end_date = $start_date;			if( ! $end_year )				$end_year = $start_year;			if( ! $end_hour )				$end_hour = 0;			if( isSet( $end_pm ) ) {				if( $end_hour <= 11 )					$end_hour += 12;			} elseif ( $end_hour == 12 ) {				$end_hour = 0;			}			if( $end_hour > 23 ) {				$this->end_time = -1;				$this->error = "The ending hour is invalid.";			}			if( ! $end_minute )				$end_minute = 0;			elseif( $end_minute > 59 ) {				$this->end_time = -1;				$this->error = "The ending minute is invalid.";			}			if( !checkDate( $end_month, $end_date, $end_year ) ) {				$this->end_time = -1;				$this->error = "The ending date is invalid.";			} else {				$this->end_time = mktime( $end_hour, $end_minute,					0, $end_month, $end_date, $end_year );			}		} else {			$this->end_time = 0;		}		$this->location_id = parsePulldown( "location" );		$new_audience_id = parseCheckbox( "audience" );		if( !is_array( $new_audience_id ) )			$this->audience_id[0] = $new_audience_id;		else			$this->audience_id = $new_audience_id;		$new_category_id = parseCheckbox( "category" );		if( !is_array( $new_category_id ) )			$this->category_id[0] = $new_category_id;		else			$this->category_id = $new_category_id;		$new_weekday_id = parseCheckbox( "weekday", -1 );		if( !is_array( $new_weekday_id ) )			$this->weekday_id[0] = $new_weekday_id;		else			$this->weekday_id = $new_weekday_id;		$this->submitter_id = $GLOBALS[$session_var]->user_id;		$this->title = $title;		$this->description = $description;		$this->info_url = $info_url;		$this->info_email = $info_email;		$this->approver_id =			( $preapproved && $this->verifyAction( "Approve" ) ?				$this->submitter_id : 0 );		if( isSet( $approver_id ) )			$this->approver_id = $approver_id;		$this->hide_oc = ( $hide_oc ? 1 : 0 );		$this->submitted_time = mktime();		if( isSet( $GLOBALS["event_id"] ) ) {			$this->event_id = $GLOBALS["event_id"];		}				$this->modify_id = $modify_id;	}}} //if included?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -