Tech name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\""))) {
$nameunique = FALSE;
echo "
Tech name already exists.
";
} else {
$nameunique = TRUE;
}
// test for matching passwords
if ($pass == $passconf) {
$passmatch = TRUE;
$passhash = password_hash($pass, PASSWORD_DEFAULT);
} else {
$passmatch = FALSE;
echo "
The passwords you supplied don't match.
";
}
if ($namesuppld && $nameunique && $passmatch) {
// modify the table
$addqry = ("insert into techs(techname,admin,shift,techpass,status) values(\"$name\",\"$admin\",\"$shift\",\"$passhash\",\"$active\")");
mysqli_query($db, $addqry);
}
break;
case "shifts":
if ($active) $active = 1;
else $active = 0;
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Shift name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select shiftid from shifts where shiftname=\"$name\""))) {
$nameunique = FALSE;
echo "
Shift name already exists.
";
} else {
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
$addqry = ("insert into shifts(shiftname,status) values(\"$name\",\"$active\")");
mysqli_query($db, $addqry);
}
break;
case "subjects":
if ($active) $active = 1;
else $active = 0;
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Subject name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select subjectid from subjects where subjectname=\"$name\""))) {
$nameunique = FALSE;
echo "
Subject name already exists.
";
} else {
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
$addqry = ("insert into subjects(subjectname,status) values(\"$name\",\"$active\")");
mysqli_query($db, $addqry);
}
break;
case "links":
if ($active) $active = 1;
else $active = 0;
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Display text cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select linkid from links where displaytxt=\"$name\""))) {
$nameunique = FALSE;
echo "
Display text already exists.
";
} else {
$nameunique = TRUE;
}
// test for urltxt supplied
if (strlen(trim($url))) {
$urlsuppld = TRUE;
} else {
$urlsuppld = FALSE;
echo "
URL text cannot be blank.
";
}
if ($namesuppld && $nameunique && $urlsuppld) {
// bump entries with linkpriority higher than belowlink up by one if necessary
$mypriority = $belowlink + 1;
if (mysqli_num_rows(mysqli_query($db, "select linkpriority from links where linkpriority=\"$mypriority\""))) {
mysqli_query($db, "update links set linkpriority=linkpriority+1 where linkpriority>\"$belowlink\"");
}
// insert the link
mysqli_query($db, "insert into links(linkpriority,displaytxt,urltxt,status) values(\"$mypriority\",\"$name\",\"$url\",\"$active\")");
}
break;
case "flags":
if ($active) $active = 1;
else $active = 0;
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Flag name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagname=\"$name\""))) {
$nameunique = FALSE;
echo "
Flag name already exists.
";
} else {
$nameunique = TRUE;
}
// test for symbol supplied
if (strlen(trim($flagsym))) {
$symsuppld = TRUE;
} else {
$symsuppld = FALSE;
echo "
Flag symbol cannot be blank.
";
}
// test for symbol unique
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagsym=\"$flagsym\""))) {
$symunique = FALSE;
echo "
Flag symbol already exists.
";
} else {
$symunique = TRUE;
}
if ($namesuppld && $nameunique && $symsuppld && $symunique) {
// insert record in flags table
mysqli_query($db, "insert into flags(flagname,flagsym,flagcolor,status) values(\"$name\",\"$flagsym\",\"$flagcolor\",\"$active\")");
}
break;
case "logpartactions":
if ($active) $active = 1;
else $active = 0;
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Part Action name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select lpactionid from logpartactions where lpactionname=\"$name\""))) {
$nameunique = FALSE;
echo "
Part Action name already exists.
";
} else {
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
$addqry = ("insert into logpartactions(lpactionname,status) values(\"$name\",\"$active\")");
mysqli_query($db, $addqry);
}
break;
case "banners":
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Banner name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select bannerid from banners where bannername=\"$name\""))) {
$nameunique = FALSE;
echo "
Banner name already exists.
";
} else {
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
$addqry = ("insert into banners(bannername,bannercolor,textcolor) values(\"$name\",\"$bnrcolor\",\"$bnrtxtcolor\")");
mysqli_query($db, $addqry);
}
break;
default:
framework("begin", "$logname Administration", "Error", $print);
echo "unknown table";
framework("end", "", "", $print);
exit();
}
}
if ($edit) {
switch ($table) {
case "techs":
if ($admin) $admin = 1;
else $admin = 0;
if ($active) $active = 1;
else $active = 0;
if ($delete) {
// check for log notes by this tech
if (mysqli_num_rows(mysqli_query($db, "select lognoteid from lognotes where tech=\"$id\""))) {
$hasnotes = TRUE;
echo "
Tech has notes in logbook and cannot be deleted.
";
} else {
$hasnotes = FALSE;
}
// check for maintenance forms by this tech
if (mysqli_num_rows(mysqli_query($db, "select maintformid from maintforms where mftech=\"$id\""))) {
$hasmfs = TRUE;
echo "
Tech has maintenance forms and cannot be deleted.
";
} else {
$hasmfs = FALSE;
}
// check for maintenance actions by this tech
if (mysqli_num_rows(mysqli_query($db, "select maintactionid from maintactions where actiontech=\"$id\""))) {
$hasmas = TRUE;
echo "
Tech has maintenance actions and cannot be deleted.
";
} else {
$hasmas = FALSE;
}
if (!$hasnotes && !$hasmfs && !$hasmas) {
// delete entity
mysqli_query($db, "delete from techs where techid=\"$id\"");
}
}
if ($update) {
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Tech name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\" and techid!=\"$id\""))) {
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\""))) {
$nameunique = FALSE;
echo "
Tech name already exists.
";
} else {
$nameunique = TRUE;
}
} else {
$nameunique = TRUE;
}
// test for matching passwords
if ($pass != "password_is_unchanged") {
if ($pass == $passconf) {
$passmatch = TRUE;
$passhash = password_hash($pass, PASSWORD_DEFAULT);
$updqry = ("update techs set techname=\"$name\",admin=\"$admin\",shift=\"$shift\",techpass=\"$passhash\",status=\"$active\" where techid=\"$id\"");
} else {
$passmatch = FALSE;
echo "
The passwords you supplied don't match.
";
}
} else {
$passmatch = TRUE;
$updqry = "update techs set techname=\"$name\",admin=\"$admin\",shift=\"$shift\",status=\"$active\" where techid=\"$id\"";
}
if ($namesuppld && $nameunique && $passmatch) {
// modify the table
mysqli_query($db, $updqry);
}
}
break;
case "shifts":
if ($active) $active = 1;
else $active = 0;
if ($delete) {
// check for log notes with this shift
if (mysqli_num_rows(mysqli_query($db, "select lognoteid from lognotes where shift=\"$id\""))) {
$hasnotes = TRUE;
echo "
Shift has notes in logbook and cannot be deleted.
";
} else {
$hasnotes = FALSE;
}
if (!$hasnotes) {
// delete entity
mysqli_query($db, "delete from shifts where shiftid=\"$id\"");
}
}
if ($update) {
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Shift name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select shiftid from shifts where shiftname=\"$name\" and shiftid!=\"$id\""))) {
if (mysqli_num_rows(mysqli_query($db, "select shiftid from shifts where shiftname=\"$name\""))) {
$nameunique = FALSE;
echo "
Shift name already exists.
";
} else {
$nameunique = TRUE;
}
} else {
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
mysqli_query($db, "update shifts set shiftname=\"$name\",status=\"$active\" where shiftid=\"$id\"");
}
}
break;
case "subjects":
if ($active) $active = 1;
else $active = 0;
if ($delete) {
// check for log notes with this subject
if (mysqli_num_rows(mysqli_query($db, "select lognoteid from lognotes where subject=\"$id\""))) {
$hasnotes = TRUE;
echo "
Subject has notes in logbook and cannot be deleted.
";
} else {
$hasnotes = FALSE;
}
if (!$hasnotes) {
// delete entity
mysqli_query($db, "delete from subjects where subjectid=\"$id\"");
}
}
if ($update) {
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Subject name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select subjectid from subjects where subjectname=\"$name\" and subjectid!=\"$id\""))) {
if (mysqli_num_rows(mysqli_query($db, "select subjectid from subjects where subjectname=\"$name\""))) {
$nameunique = FALSE;
echo "
Subject name already exists.
";
} else {
$nameunique = TRUE;
}
} else {
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
mysqli_query($db, "update subjects set subjectname=\"$name\",status=\"$active\" where subjectid=\"$id\"");
}
}
break;
case "links":
if ($active) $active = 1;
else $active = 0;
if ($delete) {
mysqli_query($db, "delete from links where linkid=\"$id\"");
}
if ($update) {
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Display text cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select linkid from links where displaytxt=\"$name\" and linkid!=\"$id\""))) {
if (mysqli_num_rows(mysqli_query($db, "select linkid from links where displaytxt=\"$name\""))) {
$nameunique = FALSE;
echo "
Display text already exists.
";
} else {
$nameunique = TRUE;
}
} else {
$nameunique = TRUE;
}
// test for urltxt supplied
if (strlen(trim($url))) {
$urlsuppld = TRUE;
} else {
$urlsuppld = FALSE;
echo "
URL text cannot be blank.
";
}
if ($namesuppld && $nameunique && $urlsuppld) {
// bump entries with linkpriority higher than belowlink up by one if necessary
$mypriority = $belowlink + 1;
if (mysqli_num_rows(mysqli_query($db, "select linkpriority from links where linkpriority=\"$mypriority\""))) {
mysqli_query($db, "update links set linkpriority=linkpriority+1 where linkpriority>\"$belowlink\"");
}
// update the link
mysqli_query($db, "update links set linkpriority=\"$mypriority\",displaytxt=\"$name\",urltxt=\"$url\",status=\"$active\" where linkid=\"$id\"");
}
}
break;
case "flags":
if ($active) $active = 1;
else $active = 0;
if ($delete) {
// check for things using this flag
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$id\""))) {
$used = TRUE;
echo "
Flag is used by other tables and cannot be deleted.
";
} else {
$used = FALSE;
}
if (!$used) {
// delete entity
mysqli_query($db, "delete from flags where flagid=\"$id\"");
}
}
if ($update) {
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Flag name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagname=\"$name\" and flagid!=\"$id\""))) {
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagname=\"$name\""))) {
$nameunique = FALSE;
echo "
Flag name already exists.
";
} else {
$nameunique = TRUE;
}
} else {
$nameunique = TRUE;
}
// test for symbol supplied
if (strlen(trim($flagsym))) {
$symsuppld = TRUE;
} else {
$symsuppld = FALSE;
echo "
Flag symbol cannot be blank.
";
}
// test for symbol unique
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagsym=\"$flagsym\" and flagid!=\"$id\""))) {
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagsym=\"$flagsym\""))) {
$symunique = FALSE;
echo "
Flag symbol already exists.
";
} else {
$symunique = TRUE;
}
} else {
$symunique = TRUE;
}
if ($namesuppld && $nameunique && $symsuppld && $symunique) {
// modify the table
mysqli_query($db, "update flags set flagname=\"$name\",flagsym=\"$flagsym\",flagcolor=\"$flagcolor\",status=\"$active\" where flagid=\"$id\"");
}
}
break;
case "logpartactions":
if ($active) $active = 1;
else $active = 0;
if ($delete) {
// check for logparts with this part action
if (mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where action=\"$id\""))) {
$hasparts = TRUE;
echo "
Action is assigned to parts in logbook notes and cannot be deleted.
";
} else {
$hasparts = FALSE;
}
if (!$hasparts) {
// delete entity
mysqli_query($db, "delete from logpartactions where lpactionid=\"$id\"");
}
}
if ($update) {
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Part Action name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select lpactionid from logpartactions where lpactionname=\"$name\" and lpactionid!=\"$id\""))) {
if (mysqli_num_rows(mysqli_query($db, "select lpactionid from logpartactions where lpactionname=\"$name\""))) {
$nameunique = FALSE;
echo "
Part Action name already exists.
";
} else {
$nameunique = TRUE;
}
} else {
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
mysqli_query($db, "update logpartactions set lpactionname=\"$name\",status=\"$active\" where lpactionid=\"$id\"");
}
}
break;
case "banners":
if ($delete) {
// delete entity
mysqli_query($db, "delete from banners where bannerid=\"$id\"");
}
if ($update) {
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Banner name cannot be blank.
";
}
// test for name unique
if (mysqli_num_rows(mysqli_query($db, "select bannerid from banners where bannername=\"$name\" and bannerid!=\"$id\""))) {
if (mysqli_num_rows(mysqli_query($db, "select bannerid from banners where bannername=\"$name\""))) {
$nameunique = FALSE;
echo "
Banner name already exists.
";
} else {
$nameunique = TRUE;
}
} else {
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
mysqli_query($db, "update banners set bannername=\"$name\",bannercolor=\"$bnrcolor\",textcolor=\"$bnrtxtcolor\" where bannerid=\"$id\"");
}
}
break;
case "configs":
switch ($type) {
case "display":
if ($display_showts) $display_showts = 1;
else $display_showts = 0;
if ($display_techalpha == "a") $display_techalpha = 1;
else $display_techalpha = 0;
if ($display_subjalpha == "a") $display_subjalpha = 1;
else $display_subjalpha = 0;
// test for logname supplied
if (strlen(trim($display_logname))) {
$namesuppld = TRUE;
} else {
$namesuppld = FALSE;
echo "
Log name cannot be blank.
";
}
// test for urlchunk supplied
if (strlen(trim($display_urlchunk))) {
$chunksuppld = TRUE;
} else {
$chunksuppld = FALSE;
echo "
URL chunk size cannot be blank.
";
}
if ($namesuppld && $chunksuppld) {
mysqli_query($db, "update configs set confvalue=\"$display_logname\" where confname=\"log_name\"");
mysqli_query($db, "update configs set confvalue=\"$display_urlchunk\" where confname=\"url_chunk_size\"");
mysqli_query($db, "update configs set confvalue=\"$display_banner\" where confname=\"banner\"");
mysqli_query($db, "update configs set confvalue=\"$display_footer\" where confname=\"footer_message\"");
mysqli_query($db, "update configs set confvalue=\"$display_showts\" where confname=\"show_ts\"");
mysqli_query($db, "update configs set confvalue=\"$display_techalpha\" where confname=\"tech_alpha\"");
mysqli_query($db, "update configs set confvalue=\"$display_subjalpha\" where confname=\"subj_alpha\"");
mysqli_query($db, "update configs set confvalue=\"$display_logstyle\" where confname=\"log_style\"");
mysqli_query($db, "update configs set confvalue=\"$display_uidtext\" where confname=\"uid_text\"");
}
break;
case "color":
$hexcolor = "#" . ltrim($hexcolor);
mysqli_query($db, "update configs set confvalue=\"$hexcolor\" where confname=\"$modcolor\"");
break;
case "misc":
if ($misc_partfuncs) {
mysqli_query($db, "update configs set confvalue=\"1\" where confname=\"parts_functions\"");
} else {
mysqli_query($db, "update configs set confvalue=\"0\" where confname=\"parts_functions\"");
}
if ($misc_logoutall) {
if ($ostype == 'WIN') {
$sessfileloc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"win_server_session_dir\""))[0];
} else {
$sessfileloc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"unix_server_session_dir\""))[0];
}
foreach (glob($sessfileloc . "/*") as $sessfile) {
unlink($sessfile);
}
}
if ($misc_schedmaintfuncs) {
mysqli_query($db, "update configs set confvalue=\"1\" where confname=\"schedmaint_functions\"");
} else {
mysqli_query($db, "update configs set confvalue=\"0\" where confname=\"schedmaint_functions\"");
}
// test for sessttl supplied
if (strlen(trim($misc_sessttl))) {
$ttlsuppld = TRUE;
} else {
$ttlsuppld = FALSE;
echo "
Session expiration time cannot be blank.
";
}
// test for sessdir supplied
if (strlen(trim($misc_sessdir))) {
$dirsuppld = TRUE;
} else {
$dirsuppld = FALSE;
echo "
Server session file directory cannot be blank.
";
}
if ($ttlsuppld && $dirsuppld) {
mysqli_query($db, "update configs set confvalue=\"$misc_sessttl\" where confname=\"session_ttl_days\"");
if ($ostype == 'WIN') {
mysqli_query($db, "update configs set confvalue=\"$misc_sessdir\" where confname=\"win_server_session_dir\"");
} else {
mysqli_query($db, "update configs set confvalue=\"$misc_sessdir\" where confname=\"unix_server_session_dir\"");
}
}
break;
default:
echo "Unknown config type!";
break;
}
break;
default:
framework("begin", "$logname Administration", "Error", $print);
echo "unknown table";
framework("end", "", "", $print);
exit();
}
}
// ******** end database manipulation ********
}
// show help
echo "
Changes made here are global and affect all users. You must have admin privileges to make changes
to these settings. To set your personal preferences, you should use the My Profile page.
";
sidemenu();
pageblock("left", "end");
}
pageblock("right", "begin");
banner($print);
// show the menu of tables
echo "
";
switch ($table) {
case "techs":
if ($isadmin) {
// show the form
if ($edit) {
// set form options for editing
$sectiontitle = "Modify Tech
";
$formtag = "
";
}
// show the table of entities
$existingdata = mysqli_query($db, "select techid,techname,admin,shift,status from techs order by techid asc");
echo "
Existing Techs Click on the Tech ID to edit.
| Tech ID | Tech Name | Shift | Admin | Active |
";
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
if ($tablerow["admin"]) {
$admdef = "
";
} else {
$admdef = "
";
}
if ($tablerow["status"]) {
$statdef = "
";
} else {
$statdef = "
";
}
$shiftname = dblookup($db, "shifts", "shiftid", "shiftname", $tablerow["shift"]);
printf(
"
| %s |
%s |
%s |
%s |
%s |
",
$tablerow["techid"],
$tablerow["techid"],
$tablerow["techname"],
$shiftname,
$admdef,
$statdef
);
}
echo "
";
break;
case "shifts":
if ($isadmin) {
// show the form
if ($edit) {
// set form options for editing
$sectiontitle = "Modify Shift
";
$formtag = "
";
}
// show the table of entities
$existingdata = mysqli_query($db, "select shiftid,shiftname,status from shifts order by shiftid asc");
echo "
Existing Shifts Click on the Shift ID to edit.
| Shift ID | Shift Name | Active |
";
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
if ($tablerow["status"]) {
$statdef = "
";
} else {
$statdef = "
";
}
printf(
"
| %s |
%s |
%s |
",
$tablerow["shiftid"],
$tablerow["shiftid"],
$tablerow["shiftname"],
$statdef
);
}
echo "
";
break;
case "subjects":
if ($isadmin) {
// show the form
if ($edit) {
// set form options for editing
$sectiontitle = "Modify Subject
";
$formtag = "
";
}
// show the table of entities
$existingdata = mysqli_query($db, "select subjectid,subjectname,status from subjects order by subjectid asc");
echo "
Existing Subjects Click on the Subject ID to edit.
| Subject ID | Subject Name | Active |
";
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
if ($tablerow["status"]) {
$statdef = "
";
} else {
$statdef = "
";
}
printf(
"
| %s |
%s |
%s |
",
$tablerow["subjectid"],
$tablerow["subjectid"],
$tablerow["subjectname"],
$statdef
);
}
echo "
";
break;
case "links":
if ($isadmin) {
// show the form
if ($edit) {
// set form options for editing
$sectiontitle = "Modify Link
";
$formtag = "
";
}
// show the table of entities
$existingdata = mysqli_query($db, "select linkid,displaytxt,urltxt,status from links order by linkpriority asc");
echo "
Existing Links Click on the Link ID to edit.
| Link ID | Display Text | URL | Active |
";
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
if ($tablerow["status"]) {
$statdef = "
";
} else {
$statdef = "
";
}
printf(
"
| %s |
%s |
%s |
%s |
",
$tablerow["linkid"],
$tablerow["linkid"],
$tablerow["displaytxt"],
$tablerow["urltxt"],
$tablerow["urltxt"],
$statdef
);
}
echo "
";
break;
case "flags":
if ($isadmin) {
// show the form
if ($edit) {
// set form options for editing
$sectiontitle = "Modify Flag
";
$formtag = "
";
}
// show the table of entities
$existingdata = mysqli_query($db, "select * from flags order by flagid asc");
echo "
Existing Flags Click on the Flag ID to edit.
| Flag ID | Flag Name | Flag Symbol | Active |
";
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
if ($tablerow["status"]) {
$statdef = "
";
} else {
$statdef = "
";
}
printf(
"
| %s |
%s |
%s |
%s |
",
$tablerow["flagid"],
$tablerow["flagid"],
$tablerow["flagname"],
$tablerow["flagcolor"],
$tablerow["flagsym"],
$statdef
);
}
echo "
";
break;
case "logpartactions":
if ($isadmin) {
// show the form
if ($edit) {
// set form options for editing
$sectiontitle = "Modify Part Action
";
$formtag = "
";
}
// show the table of entities
$existingdata = mysqli_query($db, "select * from logpartactions order by lpactionid asc");
echo "
Existing Part Actions Click on the Action ID to edit.
| Part Action ID | Part Action Name | Active |
";
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
if ($tablerow["status"]) {
$statdef = "
";
} else {
$statdef = "
";
}
printf(
"
| %s |
%s |
%s |
",
$tablerow["lpactionid"],
$tablerow["lpactionid"],
$tablerow["lpactionname"],
$statdef
);
}
echo "
";
break;
case "banners":
if ($isadmin) {
// show the form
if ($edit) {
// set form options for editing
$sectiontitle = "Modify Banner
";
$formtag = "
";
}
// show the table of entities
$existingdata = mysqli_query($db, "select * from banners where bannerid!=1 order by bannerid asc");
echo "
Existing Banners Click on the Banner ID to edit.
| Banner ID | Banner |
";
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
printf(
"
| %s |
%s |
",
$tablerow["bannerid"],
$tablerow["bannerid"],
$tablerow["bannercolor"],
$tablerow["textcolor"],
$tablerow["bannername"]
);
}
echo "
";
break;
case "configs":
switch ($type) {
case "display":
$curlname = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"log_name\""))[0];
$curlchunk = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"url_chunk_size\""))[0];
$curbnr = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"banner\""))[0];
$curftr = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"footer_message\""))[0];
$curts = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"show_ts\""))[0];
$curtdo = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"tech_alpha\""))[0];
$cursdo = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"subj_alpha\""))[0];
$curlogstyle = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"log_style\""))[0];
$curuidtxt = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"uid_text\""))[0];
echo "
Display Configuration Parameters
";
break;
case "color":
$curbgc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"background_color\""))[0];
$cursbc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"sidebar_color\""))[0];
$curmbgc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"menubg_color\""))[0];
$curtc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"text_color\""))[0];
$curlc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"link_color\""))[0];
$curvlc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"vlink_color\""))[0];
$curhc = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"heading_color\""))[0];
switch ($modcolor) {
case "background_color":
echo "| Page background color | ";
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=background_color&hexcolor=");
echo " |
";
break;
case "sidebar_color":
echo "| Sidebar color | ";
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=sidebar_color&hexcolor=");
echo " |
";
break;
case "menubg_color":
echo "| Menu background color | ";
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=menubg_color&hexcolor=");
echo " |
";
break;
case "text_color":
echo "| Normal text color | ";
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=text_color&hexcolor=");
echo " |
";
break;
case "link_color":
echo "| Link color | ";
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=link_color&hexcolor=");
echo " |
";
break;
case "vlink_color":
echo "| Visited link color | ";
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=vlink_color&hexcolor=");
echo " |
";
break;
case "heading_color":
echo "| Heading color | ";
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=heading_color&hexcolor=");
echo " |
";
break;
}
echo "Color Configuration Parameters
Select the color you'd like to change
";
break;
case "misc":
$curttl = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"session_ttl_days\""))[0];
if ($ostype == 'WIN') {
$curssdir = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"win_server_session_dir\""))[0];
} else {
$curssdir = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"unix_server_session_dir\""))[0];
}
$currpartfuncs = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"parts_functions\""))[0];
$currschedmaintfuncs = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"schedmaint_functions\""))[0];
echo "
Miscellaneous Configuration Parameters
";
break;
default:
echo "Unknown config type!";
break;
}
break;
default:
echo "
Select one of the options above.";
break;
}
banner($print);
pageblock("right", "end");
pagetable("end");
framework("end", "", "", $print);