$entry[fname] $entry[lname]"; return $contentvar; } function extAuthors($extAuthorsString) { if($extAuthorsString == null) return; $extAuthorsString = trim($extAuthorsString); if($extAuthorsString == null || $extAuthorsString == "") return null; preg_match_all("%((\!|\@)([0-9A-Za-z\ ]*)(\@|\!))%", $extAuthorsString, $answer, PREG_PATTERN_ORDER); for($i = 0; $i < count($answer[3]); $i++) { if(trim($answer[2][$i] == "@")) { $contentvar .= localAuthors($answer[3][$i]); } else { $contentvar .= trim($answer[3][$i]); } if($i == (count($answer[3]) - 1)) $contentvar .= "."; else $contentvar .= ", "; } return $contentvar; } function localGroups($groupsString) { if($groupsString == null) return; $groupsString = trim($groupsString); if($groupsString == null || $groupsString == "") return null; preg_match_all("%\!([0-9]*)\!%", $groupsString, $answer, PREG_PATTERN_ORDER); $ted = $answer[1][0]; $query = "SELECT * FROM groups WHERE groupID = $ted"; $result = mysql_query($query); if($result != null) { $entry = mysql_fetch_array($result); $contentvar .= "$entry[groupName]"; } return $contentvar; } mysql_connect('localhost', 'root'); //DO NOT RELEASE mysql_select_db('dept_coredb'); $query = "SELECT * from vitals"; $result = mysql_query($query); $entry = mysql_fetch_array($result); $deptName = $entry[deptName]; $deptAbbv = $entry[deptAbbv]; $deptLogo = $entry[deptLogo]; $address1 = $entry[address1]; $address2 = $entry[address2]; $city = $entry[city]; $state = $entry[state]; $zip = $entry[zip]; $phone = $entry[phone]; $groupName = "$deptAbbv Admin Tool"; if($_POST['myaction'] != '') { if($_POST['myaction'] === "deletePaper") { $paperID = $_POST['paperid']; mysql_query("DELETE FROM papers WHERE paperID = '$paperID' "); } if($_POST['myaction'] === "deletePerson") { $personID = $_POST['personid']; mysql_query("DELETE FROM people WHERE personID = '$personID' "); } if($_POST['myaction'] === "deleteGroup") { $groupID = $_POST['groupid']; mysql_query("DELETE FROM groups WHERE groupID = '$groupID' "); } if($_POST['myaction'] === "deleteProject") { $projectID = $_POST['projectid']; mysql_query("DELETE FROM projects WHERE projectID = '$projectID' "); } if($_POST['myaction'] === "Add Paper") { require("fileupload-class.php"); //UPLOAD SCRIPT BEGIN $path = "uploads/"; $upload_file_name = "userfile"; $default_extension = ""; $mode = 2; // Create a new instance of the class $my_uploader = new uploader; // OPTIONAL: set the max filesize of uploadable files in bytes $my_uploader->max_filesize(10000000); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions $my_uploader->max_image_size(400, 600); /* max_image_size($width, $height) */ // UPLOAD the file /* upload(file name[, acceptable mime types[, default extenstion]]) */ if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) { $success = $my_uploader->save_file($path, $mode); } if($_POST['author1'] != "none" && $_POST['author1'] != "line") { if($_POST['author1'] === "other") { $extAuthors .= "!".$_POST['otherauthor1']."!"; } else { $extAuthors .= "@".$_POST['author1']."@"; $localAuthors .= "!".$_POST['author1']."!"; } } if($_POST['author2'] != "none" && $_POST['author2'] != "line") { if($_POST['author2'] === "other") { $extAuthors .= "!".$_POST['otherauthor2']."!"; } else { $extAuthors .= "@".$_POST['author2']."@"; $localAuthors .= "!".$_POST['author2']."!"; } } if($_POST['author3'] != "none" && $_POST['author3'] != "line") { if($_POST['author3'] === "other") { $extAuthors .= "!".$_POST['otherauthor3']."!"; } else { $extAuthors .= "@".$_POST['author3']."@"; $localAuthors .= "!".$_POST['author3']."!"; } } if($_POST['author4'] != "none" && $_POST['author4'] != "line") { if($_POST['author4'] === "other") { $extAuthors .= "!".$_POST['otherauthor4']."!"; } else { $extAuthors .= "@".$_POST['author4']."@"; $localAuthors .= "!".$_POST['author4']."!"; } } if($_POST['author5'] != "none" && $_POST['author5'] != "line") { if($_POST['author5'] === "other") { $extAuthors .= "!".$_POST['otherauthor5']."!"; } else { $extAuthors .= "@".$_POST['author5']."@"; $localAuthors .= "!".$_POST['author5']."!"; } } $paperName = str_replace("\'", "\\'", $_POST['papername']); $paperGroup = str_replace("\'", "\\'", "!".$_POST['groupname']."!"); $journal = str_replace("\'", "\\'", $_POST['journalname']); $status = str_replace("\'", "\\'", $_POST['status']); $extAuthors = str_replace("\'", "\\'", $extAuthors); $year = $_POST['year']; if ($success) { $fileURL = $my_uploader->file['name']; } mysql_connect('localhost', 'root'); $query = "INSERT INTO papers (paperID, title, localAuthors, localGroups, extAuthors, journal, year, status, fileURL) VALUES('','$paperName', '$localAuthors', '$paperGroup', '$extAuthors', '$journal', '$year', '$status', '$fileURL');"; mysql_query($query); } if($_POST['myaction'] === "Add Person") { require("fileupload-class.php"); //UPLOAD SCRIPT BEGIN $path = "uploads/"; $upload_file_name = "userphoto"; $default_extension = ""; $mode = 2; // Create a new instance of the class $my_uploader = new uploader; // OPTIONAL: set the max filesize of uploadable files in bytes $my_uploader->max_filesize(1000000); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions $my_uploader->max_image_size(600, 600); /* max_image_size($width, $height) */ // UPLOAD the file /* upload(file name[, acceptable mime types[, default extenstion]]) */ if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) { $success = $my_uploader->save_file($path, $mode); } if($_POST['groupname'] != "none" && $_POST['groupname'] != "line") { $groupName2 = $_POST['groupname']; } if($_POST['typename'] != "none" && $_POST['typename'] != "line") { $groupName2 = $_POST['typename']; } $fname = str_replace("\'", "\\'", $_POST['fname']); $lname = str_replace("\'", "\\'", $_POST['lname']); $officeLoc = str_replace("\'", "\\'", $_POST['officeLoc']); $phone = str_replace("\'", "\\'", $_POST['phone']); $title = str_replace("\'", "\\'", $_POST['title']); $description = str_replace("\'", "\\'", $_POST['personDesc']); $description = str_replace("\r\n\r\n", "

", $description); $description = str_replace("\r\n", "
", $description); $group = str_replace("\'", "\\'", "!".$_POST['groupname']."!"); $type = str_replace("\'", "\\'", $_POST['typename']); if ($success) { $pictureURL = $my_uploader->file['name']; } mysql_connect('localhost', 'root'); $query = "INSERT INTO people (fname,lname,officeLoc,phone,title,type,description,pictureURL,papers,groups,personID) VALUES('$fname','$lname','($officeLoc)','$phone','$title','$type','$description','$pictureURL','', '$group', '');"; mysql_query($query); } if($_POST['myaction'] === "Add Group") { $groupName2 = str_replace("\'", "\\'", $_POST['groupName']); $groupDesc = str_replace("\r\n\r\n", "

", $_POST['groupDesc']); $groupDesc = str_replace("\r\n", "
", $groupDesc); $groupDesc = str_replace("\'", "\\'", $groupDesc); if($_POST['link1'] != '') { $links .= $_POST['link1'].":!:"; if($_POST['linkdest1'] != '') { $links .= $_POST['linkdest1'].":!:"; } else { $links .= "Other External Site:!:"; } } if($_POST['link2'] != '') { $links .= $_POST['link2'].":!:"; if($_POST['linkdest2'] != '') { $links .= $_POST['linkdest2'].":!:"; } else { $links .= "Other External Site:!:"; } } if($_POST['link3'] != '') { $links .= $_POST['link3'].":!:"; if($_POST['linkdest3'] != '') { $links .= $_POST['linkdest3'].":!:"; } else { $links .= "Other External Site:!:"; } } if($_POST['link4'] != '') { $links .= $_POST['link4'].":!:"; if($_POST['linkdest4'] != '') { $links .= $_POST['linkdest4'].":!:"; } else { $links .= "Other External Site:!:"; } } if($_POST['link5'] != '') { $links .= $_POST['link5'].":!:"; if($_POST['linkdest5'] != '') { $links .= $_POST['linkdest5'].":!:"; } else { $links .= "Other External Site:!:"; } } mysql_connect('localhost', 'root'); $query = "INSERT INTO groups (groupID, groupName, groupDesc, links) VALUES('','$groupName2','$groupDesc','$links');"; mysql_query($query); } if($_POST['myaction'] === "Add Project") { require("fileupload-class.php"); //UPLOAD SCRIPT BEGIN $path = "uploads/"; $upload_file_name = "projectpicture"; $default_extension = ""; $mode = 2; // Create a new instance of the class $my_uploader = new uploader; // OPTIONAL: set the max filesize of uploadable files in bytes $my_uploader->max_filesize(1000000); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions $my_uploader->max_image_size(600, 600); /* max_image_size($width, $height) */ // UPLOAD the file /* upload(file name[, acceptable mime types[, default extenstion]]) */ if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) { $success = $my_uploader->save_file($path, $mode); } $projectName = str_replace("\'", "\\'", $_POST['projectName']); $projectDesc = str_replace("\'", "\\'", $_POST['projectDesc']); $projectDesc = str_replace("\r\n\r\n", "

", $_POST['projectDesc']); $projectDesc = str_replace("\r\n", "
", $projectDesc); $relevantGroup = $_POST['relevantGroup']; if ($success) { $pictureURL = $my_uploader->file['name']; } mysql_connect('localhost', 'root'); $query = "INSERT INTO projects (projectID, highlighted, projectName, projectDesc, pictureURL, relevantGroup) VALUES('','0','$projectName','$projectDesc','$pictureURL','!$relevantGroup!');"; mysql_query($query); } if($_POST['myaction'] === "Make Changes") { mysql_connect('localhost', 'root'); require("fileupload-class.php"); //UPLOAD SCRIPT BEGIN $path = "uploads/"; $upload_file_name = "userfile"; $default_extension = ""; $mode = 2; // Create a new instance of the class $my_uploader = new uploader; // OPTIONAL: set the max filesize of uploadable files in bytes $my_uploader->max_filesize(1000000); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions $my_uploader->max_image_size(600, 600); /* max_image_size($width, $height) */ // UPLOAD the file /* upload(file name[, acceptable mime types[, default extenstion]]) */ if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) { $success = $my_uploader->save_file($path, $mode); } $entry = mysql_fetch_array(mysql_query("SELECT * FROM vitals")); if ($success) { $deptLogo = $my_uploader->file['name']; } else { $deptLogo = $entry[deptLogo]; } $deptName = str_replace("\'", "\\'", $_POST['deptName']); $deptAbbv = str_replace("\'", "\\'", $_POST['deptAbbv']); $deptSubhead = str_replace("\'", "\\'", $_POST['deptSubhead']); $address1 = str_replace("\'", "\\'", $_POST['address1']); $address2 = str_replace("\'", "\\'", $_POST['address2']); $city = str_replace("\'", "\\'", $_POST['city']); $state = str_replace("\'", "\\'", $_POST['state']); $zip = str_replace("\'", "\\'", $_POST['zip']); $phone = str_replace("\'", "\\'", $_POST['phone']); $deptDesc = str_replace("\r\n\r\n", "

", $_POST['deptDesc']); $deptDesc = str_replace("\r\n", "
", $deptDesc); $deptDesc = str_replace("\'", "\\'", $deptDesc); if($_POST['link1'] != '') { $links .= $_POST['link1'].":!:"; if($_POST['linkdest1'] != '') { $links .= $_POST['linkdest1'].":!:"; } else { $links .= "Other External Site:!:"; } } if($_POST['link2'] != '') { $links .= $_POST['link2'].":!:"; if($_POST['linkdest2'] != '') { $links .= $_POST['linkdest2'].":!:"; } else { $links .= "Other External Site:!:"; } } if($_POST['link3'] != '') { $links .= $_POST['link3'].":!:"; if($_POST['linkdest3'] != '') { $links .= $_POST['linkdest3'].":!:"; } else { $links .= "Other External Site:!:"; } } if($_POST['link4'] != '') { $links .= $_POST['link4'].":!:"; if($_POST['linkdest4'] != '') { $links .= $_POST['linkdest4'].":!:"; } else { $links .= "Other External Site:!:"; } } if($_POST['link5'] != '') { $links .= $_POST['link5'].":!:"; if($_POST['linkdest5'] != '') { $links .= $_POST['linkdest5'].":!:"; } else { $links .= "Other External Site:!:"; } } $query2 = "UPDATE vitals SET deptName='$deptName',deptAbbv='$deptAbbv',deptLogo='$deptLogo',deptSubhead='$deptSubhead',deptDesc='$deptDesc', address1='$address1',address2='$address2',city='$city',state='$state',zip='$zip',phone='$phone', links='$links'"; mysql_query($query2); $query = "SELECT * FROM projects ORDER BY projectName"; $result = mysql_query($query); for ($i = 0; $i < mysql_num_rows($result); $i++) { $entry = mysql_fetch_array($result); $projectFormName = "project_$entry[projectID]"; $checkValue = $_POST["$projectFormName"]; $projectID = $entry[projectID]; if($checkValue != "") { $query2 = "UPDATE projects SET highlighted = '1' WHERE projectID = '$projectID' LIMIT 1"; mysql_query($query2); } else { $query2 = "UPDATE projects SET highlighted = '0' WHERE projectID = '$projectID' LIMIT 1"; mysql_query($query2); } } } } if($_GET['page'] != '') { $page = $_GET['page']; if($page == 0) { $pageName = "Main Admin"; $content .="$deptAbbv Main Site Administration

"; $query = "SELECT * FROM vitals"; $result = mysql_query($query); $entry = mysql_fetch_array($result); $deptDesc = str_replace("

", "\r\n\r\n", $entry['deptDesc']); $personDesc = str_replace("
", "\r\n", $deptDesc); $content .= "

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Full Department Name
Department Abbreviation
(or short name)
Department Subheading
(i.e. \"Department of Physics, University of Colorado\")
Department Description
(for front page)
Address Line 1
Address Line 2
City
State
Zip
Primary Telephone Number
Upload Department Logo
"; $query = "SELECT * FROM projects ORDER BY projectName"; $result = mysql_query($query); $content .= "

 

Please select the projects to be highlighted on the $deptAbbv front page:

\n"; $content .= ""; for ($i = 0; $i < mysql_num_rows($result); $i++) { $entry = mysql_fetch_array($result); if($entry[highlighted] == 0) { $checkvalue = ""; } else { $checkvalue = "checked"; } $groupName2 = localGroups($entry[relevantGroup]); $content .= "\n\n"; } $query = "SELECT * FROM vitals"; $result = mysql_query($query); $entry = mysql_fetch_array($result); $answer = array(); $answer = localLinks($entry[links]); $link1 = $answer[1][0]; $link2 = $answer[1][2]; $link3 = $answer[1][4]; $link4 = $answer[1][6]; $link5 = $answer[1][8]; $linkdest1 = $answer[1][1]; $linkdest2 = $answer[1][3]; $linkdest3 = $answer[1][5]; $linkdest4 = $answer[1][7]; $linkdest5 = $answer[1][9]; $content .="
Highlight?Project
"; $content .= "$entry[projectName] - $groupName2

 

Enter some links for the Relevant Links section on the front page:

\n \n \n \n \n \n \n
Site TitleURL

 

"; } else if($page == 1) { $pageName = "Papers"; $content .="Current Papers

"; $query = "SELECT * FROM papers"; $result = mysql_query($query); $content .= "

\n"; $content .= ""; for ($i = 0; $i < mysql_num_rows($result); $i++) { $entry = mysql_fetch_array($result); $content .= "\n\n"; $content .= ""; $content .= ""; $content .= ""; } $authorList .= ""; $query = "SELECT * FROM people WHERE type = 'researcher'"; $result = mysql_query($query); for ($i = 0; $i < mysql_num_rows($result); $i++) { $entry = mysql_fetch_array($result); $authorList .= "\n"; } $groupList .= ""; $query = "SELECT * FROM groups"; $result = mysql_query($query); for ($i = 0; $i < mysql_num_rows($result); $i++) { $entry = mysql_fetch_array($result); $groupList .= "\n"; } $content .="
"; $content .= extAuthors($entry[extAuthors]); $content .= "$entry[title]$entry[journal], $entry[status].editdelete

 

\nAdd A Paper:

\n

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Paper Title
Authors

(Will be placed into the database in this order)

\n \n \n \n \n \n \n
Relevant Group
Journal
Year Published
Paper Status
(submitted, in review, etc.)
Upload File

Note: Depending on the file size and the speed of your connection, this upload may take a few minutes after pressing 'Add Paper'. Please be patient.

"; } else if($page == 2) { $pageName = "People"; $content .="Current $deptAbbv Members

"; $query = "SELECT * FROM people ORDER BY lname"; $result = mysql_query($query); $content .= "

\n"; $content .= ""; for ($i = 0; $i < mysql_num_rows($result); $i++) { $entry = mysql_fetch_array($result); $groupsList = localGroups($entry[groups]); $content .= "\n\n"; $content .= ""; $content .= ""; $content .= ""; } $groupList .= ""; $query = "SELECT * FROM groups"; $result = mysql_query($query); for ($i = 0; $i < mysql_num_rows($result); $i++) { $entry = mysql_fetch_array($result); $groupList .= "\n"; } $typeList .= ""; $typeList .= " \n"; $content .="
"; $content .= "$entry[lname], $entry[fname]$entry[title], $groupsList.editdelete

 

\nAdd A Person:

\n

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
First Name
Last Name
Title
Office Location
Phone Number
Description
(HTML OK)/td> \n
Group
Type
Upload Photo

Note: Depending on the file size and the speed of your connection, this upload may take a few minutes after pressing 'Add Person'. Please be patient.

"; } else if($page == 3) { $pageName = "Groups"; $content .="Current $deptAbbv Groups

"; $query = "SELECT * FROM groups ORDER BY groupName"; $result = mysql_query($query); $content .= "

\n"; $content .= ""; for ($i = 0; $i < mysql_num_rows($result); $i++) { $entry = mysql_fetch_array($result); $content .= "\n\n"; $content .= ""; $content .= ""; } $content .="
"; $content .= "$entry[groupName]editdelete

 

\nAdd A Group:

\n

\n \n \n \n \n \n \n \n \n
Group Name
Description
(HTML OK)
Relevant Links

(Will be placed into the database in this order)

\n \n \n \n \n \n \n \n
Site TitleURL

"; } else if($page == 4) { $pageName = "Projects"; $content .="Current $deptAbbv Projects

"; $groupList .= ""; $query = "SELECT * FROM groups"; $result = mysql_query($query); for ($i = 0; $i < mysql_num_rows($result); $i++) { $entry = mysql_fetch_array($result); $groupList .= "\n"; } $query = "SELECT * FROM projects ORDER BY projectName"; $result = mysql_query($query); $content .= "

\n"; $content .= ""; for ($i = 0; $i < mysql_num_rows($result); $i++) { $entry = mysql_fetch_array($result); $groupName2 = localGroups($entry[relevantGroup]); $content .= "\n\n"; $content .= ""; $content .= ""; } $content .="
"; $content .= "$entry[projectName] - $groupName2editdelete

 

\nAdd A Project:

\n

\n \n \n \n \n \n \n \n \n \n \n
Project Name
Description
(HTML OK)
Relevant Group \n \n
Upload Picture

"; } } else { $content .= "Please select a management task.

 

Main Site Administration

Add/Delete/Edit Groups

Add/Delete/Edit People

Add/Delete/Edit Papers

Add/Delete/Edit Projects"; } ?> <?php print $deptName ?>
> Administration >
- - , -