1591 lines
82 KiB
PHP
1591 lines
82 KiB
PHP
<?php
|
|
/*
|
|
admin.php
|
|
OpenLog Online Logbook
|
|
Copyright (C) 2026 Rod Wright
|
|
|
|
SPDX-License-Identifier: GPL-2.0
|
|
*/
|
|
|
|
include("functions.php");
|
|
|
|
if (!isset($_SESSION['login'])) {
|
|
header ("Location: login.php");
|
|
}
|
|
|
|
// get user's admin status
|
|
$loginid=$_SESSION['login'] ?? NULL;
|
|
$isadmin=dblookup($db,"techs","techid","admin",$loginid);
|
|
$print=$_REQUEST['print'] ?? NULL;
|
|
$table=$_REQUEST['table'] ?? NULL;
|
|
$edit=$_REQUEST['edit'] ?? NULL;
|
|
$add=$_REQUEST['add'] ?? NULL;
|
|
$update=$_REQUEST['update'] ?? NULL;
|
|
$delete=$_REQUEST['delete'] ?? NULL;
|
|
$id=$_REQUEST['id'] ?? NULL;
|
|
$name=$_REQUEST['name'] ?? NULL;
|
|
$admin=$_REQUEST['admin'] ?? NULL;
|
|
$shift=$_REQUEST['shift'] ?? NULL;
|
|
$pass=$_REQUEST['pass'] ?? NULL;
|
|
$passconf=$_REQUEST['passconf'] ?? NULL;
|
|
$belowlink=$_REQUEST['belowlink'] ?? NULL;
|
|
$url=$_REQUEST['url'] ?? NULL;
|
|
$flagsym=$_REQUEST['flagsym'] ?? NULL;
|
|
$flagcolor=$_REQUEST['flagcolor'] ?? NULL;
|
|
$bnrcolor=$_REQUEST['bnrcolor'] ?? NULL;
|
|
$bnrtxtcolor=$_REQUEST['bnrtxtcolor'] ?? NULL;
|
|
$active=$_REQUEST['active'] ?? NULL;
|
|
$type=$_REQUEST['type'] ?? NULL;
|
|
$display_logname=$_REQUEST['display_logname'] ?? NULL;
|
|
$display_urlchunk=$_REQUEST['display_urlchunk'] ?? NULL;
|
|
$display_banner=$_REQUEST['display_banner'] ?? NULL;
|
|
$display_footer=$_REQUEST['display_footer'] ?? NULL;
|
|
$display_showts=$_REQUEST['display_showts'] ?? NULL;
|
|
$display_techalpha=$_REQUEST['display_techalpha'] ?? NULL;
|
|
$display_subjalpha=$_REQUEST['display_subjalpha'] ?? NULL;
|
|
$display_logstyle=$_REQUEST['display_logstyle'] ?? NULL;
|
|
$display_uidtext=$_REQUEST['display_uidtext'] ?? NULL;
|
|
$modcolor=$_REQUEST['modcolor'] ?? NULL;
|
|
$hexcolor=$_REQUEST['hexcolor'] ?? NULL;
|
|
$db_dbname=$_REQUEST['db_dbname'] ?? NULL;
|
|
$misc_sessttl=$_REQUEST['misc_sessttl'] ?? NULL;
|
|
$misc_sessdir=$_REQUEST['misc_sessdir'] ?? NULL;
|
|
$misc_logoutall=$_REQUEST['misc_logoutall'] ?? NULL;
|
|
$misc_partfuncs=$_REQUEST['misc_partfuncs'] ?? NULL;
|
|
$misc_schedmaintfuncs=$_REQUEST['misc_schedmaintfuncs'] ?? NULL;
|
|
|
|
$logname=LOG_NAME;
|
|
|
|
if ($print) {
|
|
$sbcolor=P_SIDEBAR_COLOR;
|
|
$mbgcolor=P_MENUBG_COLOR;
|
|
} else {
|
|
$sbcolor=SIDEBAR_COLOR;
|
|
$mbgcolor=MENUBG_COLOR;
|
|
}
|
|
|
|
framework("begin","$logname","Administration",$print);
|
|
|
|
//var_dump($_REQUEST);
|
|
|
|
pagetable("begin");
|
|
if(!$print){
|
|
pageblock("left","begin");
|
|
if ($isadmin) {
|
|
// ******** begin database manipulation ********
|
|
if ($add) {
|
|
switch($table) {
|
|
case "techs":
|
|
if ($admin) $admin=1; else $admin=0;
|
|
if ($active) $active=1; else $active=0;
|
|
// do error checking
|
|
// test for name supplied
|
|
if (strlen(trim($name))) {
|
|
$namesuppld=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name cannot be blank.<br>";
|
|
}
|
|
// test for name unique
|
|
if (mysqli_num_rows(mysqli_query($db,"select techid from techs where techname=\"$name\""))) {
|
|
$nameunique=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
// test for matching passwords
|
|
if ($pass==$passconf) {
|
|
$passmatch=1;
|
|
$passhash=password_hash($pass,PASSWORD_DEFAULT);
|
|
} else {
|
|
$passmatch=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> The passwords you supplied don't match.<br>";
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Shift name cannot be blank.<br>";
|
|
}
|
|
// test for name unique
|
|
if (mysqli_num_rows(mysqli_query($db,"select shiftid from shifts where shiftname=\"$name\""))) {
|
|
$nameunique=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Shift name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Subject name cannot be blank.<br>";
|
|
}
|
|
// test for name unique
|
|
if (mysqli_num_rows(mysqli_query($db,"select subjectid from subjects where subjectname=\"$name\""))) {
|
|
$nameunique=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Subject name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Display text cannot be blank.<br>";
|
|
}
|
|
// test for name unique
|
|
if (mysqli_num_rows(mysqli_query($db,"select linkid from links where displaytxt=\"$name\""))) {
|
|
$nameunique=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Display text already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
// test for urltxt supplied
|
|
if (strlen(trim($url))) {
|
|
$urlsuppld=1;
|
|
} else {
|
|
$urlsuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> URL text cannot be blank.<br>";
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag name cannot be blank.<br>";
|
|
}
|
|
// test for name unique
|
|
if (mysqli_num_rows(mysqli_query($db,"select flagid from flags where flagname=\"$name\""))) {
|
|
$nameunique=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
// test for symbol supplied
|
|
if (strlen(trim($flagsym))) {
|
|
$symsuppld=1;
|
|
} else {
|
|
$symsuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag symbol cannot be blank.<br>";
|
|
}
|
|
// test for symbol unique
|
|
if (mysqli_num_rows(mysqli_query($db,"select flagid from flags where flagsym=\"$flagsym\""))) {
|
|
$symunique=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag symbol already exists.<br>";
|
|
} else {
|
|
$symunique=1;
|
|
}
|
|
if ($namesuppld && $nameunique && $symsuppld && $symunique) {
|
|
// insert record in links table
|
|
mysqli_query($db,"insert into flags(flagname,flagsym,flagcolor,status) values(\"$name\",\"$flagsym\",\"$flagcolor\",\"$active\")");
|
|
// create sub tables for this link
|
|
$lastflagid=mysqli_insert_id($db);
|
|
mysqli_query($db,"create table flag_$lastflagid(target tinytext,id int not null)");
|
|
}
|
|
break;
|
|
case "logpartactions":
|
|
if ($active) $active=1; else $active=0;
|
|
// do error checking
|
|
// test for name supplied
|
|
if (strlen(trim($name))) {
|
|
$namesuppld=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Part Action name cannot be blank.<br>";
|
|
}
|
|
// test for name unique
|
|
if (mysqli_num_rows(mysqli_query($db,"select lpactionid from logpartactions where lpactionname=\"$name\""))) {
|
|
$nameunique=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Part Action name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Banner name cannot be blank.<br>";
|
|
}
|
|
// test for name unique
|
|
if (mysqli_num_rows(mysqli_query($db,"select bannerid from banners where bannername=\"$name\""))) {
|
|
$nameunique=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Banner name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
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=1;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech has notes in logbook and cannot be deleted.<br>";
|
|
} else {
|
|
$hasnotes=0;
|
|
}
|
|
// check for maintenance forms by this tech
|
|
if (mysqli_num_rows(mysqli_query($db,"select maintformid from maintforms where mftech=\"$id\""))) {
|
|
$hasmfs=1;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech has maintenance forms and cannot be deleted.<br>";
|
|
} else {
|
|
$hasmfs=0;
|
|
}
|
|
// check for maintenance actions by this tech
|
|
if (mysqli_num_rows(mysqli_query($db,"select maintactionid from maintactions where actiontech=\"$id\""))) {
|
|
$hasmas=1;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech has maintenance actions and cannot be deleted.<br>";
|
|
} else {
|
|
$hasmas=0;
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name cannot be blank.<br>";
|
|
}
|
|
// 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=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Tech name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
// test for matching passwords
|
|
if ($pass!="password_is_unchanged") {
|
|
if ($pass==$passconf) {
|
|
$passmatch=1;
|
|
$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=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> The passwords you supplied don't match.<br>";
|
|
}
|
|
} else {
|
|
$passmatch=1;
|
|
$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=1;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Shift has notes in logbook and cannot be deleted.<br>";
|
|
} else {
|
|
$hasnotes=0;
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Shift name cannot be blank.<br>";
|
|
}
|
|
// 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=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Shift name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
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=1;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Subject has notes in logbook and cannot be deleted.<br>";
|
|
} else {
|
|
$hasnotes=0;
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Subject name cannot be blank.<br>";
|
|
}
|
|
// 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=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Subject name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Display text cannot be blank.<br>";
|
|
}
|
|
// 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=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Display text already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
// test for urltxt supplied
|
|
if (strlen(trim($url))) {
|
|
$urlsuppld=1;
|
|
} else {
|
|
$urlsuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> URL text cannot be blank.<br>";
|
|
}
|
|
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 * from flag_$id"))) {
|
|
$used=1;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag is used by other tables and cannot be deleted.<br>";
|
|
} else {
|
|
$used=0;
|
|
}
|
|
if (!$used) {
|
|
// delete entity
|
|
mysqli_query($db,"delete from flags where flagid=\"$id\"");
|
|
mysqli_query($db,"drop table flag_$id");
|
|
}
|
|
}
|
|
if ($update) {
|
|
// do error checking
|
|
// test for name supplied
|
|
if (strlen(trim($name))) {
|
|
$namesuppld=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag name cannot be blank.<br>";
|
|
}
|
|
// 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=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
// test for symbol supplied
|
|
if (strlen(trim($flagsym))) {
|
|
$symsuppld=1;
|
|
} else {
|
|
$symsuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag symbol cannot be blank.<br>";
|
|
}
|
|
// 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=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Flag symbol already exists.<br>";
|
|
} else {
|
|
$symunique=1;
|
|
}
|
|
} else {
|
|
$symunique=1;
|
|
}
|
|
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=1;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Action is assigned to parts in logbook notes and cannot be deleted.<br>";
|
|
} else {
|
|
$hasparts=0;
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Part Action name cannot be blank.<br>";
|
|
}
|
|
// 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=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Part Action name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Banner name cannot be blank.<br>";
|
|
}
|
|
// 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=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Banner name already exists.<br>";
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
} else {
|
|
$nameunique=1;
|
|
}
|
|
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=1;
|
|
} else {
|
|
$namesuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Log name cannot be blank.<br>";
|
|
}
|
|
// test for urlchunk supplied
|
|
if (strlen(trim($display_urlchunk))) {
|
|
$chunksuppld=1;
|
|
} else {
|
|
$chunksuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> URL chunk size cannot be blank.<br>";
|
|
}
|
|
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=1;
|
|
} else {
|
|
$ttlsuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Session expiration time cannot be blank.<br>";
|
|
}
|
|
// test for sessdir supplied
|
|
if (strlen(trim($misc_sessdir))) {
|
|
$dirsuppld=1;
|
|
} else {
|
|
$dirsuppld=0;
|
|
echo "<img src=\"icons/exclamation-red.png\" border=\"0\"> Server session file directory cannot be blank.<br>";
|
|
}
|
|
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 "
|
|
<hr>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 <a href=\"profile.php\">My Profile</a> page.
|
|
";
|
|
|
|
sidemenu();
|
|
pageblock("left","end");
|
|
}
|
|
|
|
pageblock("right","begin");
|
|
banner($print);
|
|
// show the menu of tables
|
|
echo "
|
|
<table width=\"100%\" border=\"0\" cellpadding=\"10\">
|
|
<tr>
|
|
<td align=\"center\"><a href=\"admin.php?table=techs\">Techs</a></td>
|
|
<td align=\"center\"><a href=\"admin.php?table=shifts\">Shifts</a></td>
|
|
<td align=\"center\"><a href=\"admin.php?table=subjects\">Subjects</a></td>
|
|
<td align=\"center\"><a href=\"admin.php?table=links\">Links</a></td>
|
|
<td align=\"center\"><a href=\"admin.php?table=flags\">Flags</a></td>
|
|
<td align=\"center\"><a href=\"admin.php?table=logpartactions\">Part Actions</a></td></tr>
|
|
</table>
|
|
<table width=\"100%\" border=\"0\" cellpadding=\"10\">
|
|
<tr>
|
|
<td align=\"center\"><a href=\"admin.php?table=banners\">Banners</a></td>
|
|
<td align=\"center\"><a href=\"admin.php?table=configs&type=display\">Display Options</a></td>
|
|
<td align=\"center\"><a href=\"admin.php?table=configs&type=color\">Page Colors</a></td>
|
|
<td align=\"center\"><a href=\"admin.php?table=configs&type=misc\">Miscellaneous Options</a></td>
|
|
</tr>
|
|
</table>
|
|
<hr>
|
|
";
|
|
switch($table) {
|
|
case "techs" :
|
|
if ($isadmin) {
|
|
// show the form
|
|
if ($edit) {
|
|
// set form options for editing
|
|
$sectiontitle="<b>Modify Tech</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table&edit=1\">";
|
|
$buttontags="
|
|
<input type=\"hidden\" name=\"id\" value=\"$id\">
|
|
<input type=\"submit\" name=\"update\" value=\"Update Tech\">
|
|
<input type=\"submit\" name=\"delete\" value=\"Delete Tech\">
|
|
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
|
|
";
|
|
// pull current values from database
|
|
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from techs where techid=$id"));
|
|
$name=$currentvalues["techname"];
|
|
$pass=$passconf="password_is_unchanged";
|
|
$shift=$currentvalues["shift"];
|
|
if ($currentvalues["admin"]==1) {
|
|
$admintag="<input type=\"checkbox\" name=\"admin\" checked>";
|
|
} else {
|
|
$admintag="<input type=\"checkbox\" name=\"admin\">";
|
|
}
|
|
if ($currentvalues["status"]==1) {
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
} else {
|
|
$activetag="<input type=\"checkbox\" name=\"active\">";
|
|
}
|
|
} else {
|
|
// set form options for add
|
|
$sectiontitle="<b>Add New Tech</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table\">";
|
|
$buttontags="
|
|
<input type=\"submit\" name=\"add\" value=\"Add Tech\">
|
|
";
|
|
// set default values
|
|
$admintag="<input type=\"checkbox\" name=\"admin\">";
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
}
|
|
|
|
echo "
|
|
$sectiontitle
|
|
$formtag
|
|
<table border=\"0\">
|
|
<tr><td>
|
|
Tech Name (first and last name): <input type=\"text\" name=\"name\" size=\"40\" value=\"$name\"><br><br>
|
|
Password: <input type=\"password\" name=\"pass\" size=\"40\" value=\"$pass\"><br><br>
|
|
Repeat Password: <input type=\"password\" name=\"passconf\" size=\"40\" value=\"$passconf\"><br><br>
|
|
<font size=\"-1\">Need a random password? </font>
|
|
";
|
|
$rpw=substr(str_shuffle(password_hash(microtime(),PASSWORD_DEFAULT)), 10, 12);
|
|
echo " $rpw<br><br>
|
|
<b>Shift: </b>
|
|
<select name=\"shift\">
|
|
";
|
|
$shiftrow=mysqli_query($db,"select * from shifts");
|
|
while ($shiftitem=mysqli_fetch_assoc($shiftrow)) {
|
|
if ($shiftitem["status"] == 1) {
|
|
if ($shiftitem["shiftid"]==$shift) {
|
|
printf("<option value=\"%s\" selected>%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
|
|
} else {
|
|
printf("<option value=\"%s\">%s</option>",$shiftitem["shiftid"],$shiftitem["shiftname"]);
|
|
}
|
|
}
|
|
}
|
|
echo "
|
|
</select><br><br>
|
|
Admin: $admintag
|
|
Active: $activetag <br><br>
|
|
</td></tr>
|
|
</table>
|
|
$buttontags
|
|
</form>
|
|
<br><hr>
|
|
";
|
|
}
|
|
// show the table of entities
|
|
$existingdata=mysqli_query($db,"select techid,techname,admin,shift,status from techs order by techid asc");
|
|
echo "
|
|
<b>Existing Techs</b> <font size=\"-1\">Click on the Tech ID to edit.</font><br><br>
|
|
<table border=\"1\">
|
|
<tr><th>Tech ID</th><th>Tech Name</th><th>Shift</th><th>Admin</th><th>Active</th></tr>
|
|
";
|
|
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
|
|
if ($tablerow["admin"]) {
|
|
$admdef="<img src=\"icons/tick.png\" title=\"admin\" alt=\"admin\">";
|
|
} else {
|
|
$admdef="<img src=\"icons/cross.png\" title=\"not admin\" alt=\"not admin\">";
|
|
}
|
|
if ($tablerow["status"]) {
|
|
$statdef="<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
|
|
} else {
|
|
$statdef="<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
|
}
|
|
$shiftname=dblookup($db,"shifts","shiftid","shiftname",$tablerow["shift"]);
|
|
printf("
|
|
<tr>
|
|
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
|
<td>%s</td>
|
|
<td>%s</td>
|
|
<td align=\"center\">%s</td>
|
|
<td align=\"center\">%s</td>
|
|
</tr>",
|
|
$tablerow["techid"],$tablerow["techid"],
|
|
$tablerow["techname"],
|
|
$shiftname,
|
|
$admdef,
|
|
$statdef);
|
|
}
|
|
echo "</table>";
|
|
break;
|
|
case "shifts" :
|
|
if ($isadmin) {
|
|
// show the form
|
|
if ($edit) {
|
|
// set form options for editing
|
|
$sectiontitle="<b>Modify Shift</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table&edit=1\">";
|
|
$buttontags="
|
|
<input type=\"hidden\" name=\"id\" value=\"$id\">
|
|
<input type=\"submit\" name=\"update\" value=\"Update Shift\">
|
|
<input type=\"submit\" name=\"delete\" value=\"Delete Shift\">
|
|
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
|
|
";
|
|
// pull current values from database
|
|
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from shifts where shiftid=$id"));
|
|
$name=$currentvalues["shiftname"];
|
|
if ($currentvalues["status"]==1) {
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
} else {
|
|
$activetag="<input type=\"checkbox\" name=\"active\">";
|
|
}
|
|
} else {
|
|
// set form options for add
|
|
$sectiontitle="<b>Add New Shift</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table\">";
|
|
$buttontags="
|
|
<input type=\"submit\" name=\"add\" value=\"Add Shift\">
|
|
";
|
|
// set default values
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
}
|
|
|
|
echo "
|
|
$sectiontitle
|
|
$formtag
|
|
<table border=\"0\">
|
|
<tr><td>
|
|
Shift Name (may contain spaces): <input type=\"text\" name=\"name\" size=\"40\" value=\"$name\"><br><br>
|
|
Active: $activetag <br><br>
|
|
</td></tr>
|
|
</table>
|
|
$buttontags
|
|
</form>
|
|
<br><hr>
|
|
";
|
|
}
|
|
// show the table of entities
|
|
$existingdata=mysqli_query($db,"select shiftid,shiftname,status from shifts order by shiftid asc");
|
|
echo "
|
|
<b>Existing Shifts</b> <font size=\"-1\">Click on the Shift ID to edit.</font><br><br>
|
|
<table border=\"1\">
|
|
<tr><th>Shift ID</th><th>Shift Name</th><th>Active</th></tr>
|
|
";
|
|
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
|
|
if ($tablerow["status"]) {
|
|
$statdef="<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
|
|
} else {
|
|
$statdef="<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
|
}
|
|
printf("
|
|
<tr>
|
|
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
|
<td>%s</td>
|
|
<td align=\"center\">%s</td>
|
|
</tr>",
|
|
$tablerow["shiftid"],$tablerow["shiftid"],
|
|
$tablerow["shiftname"],
|
|
$statdef);
|
|
}
|
|
echo "</table>";
|
|
break;
|
|
case "subjects" :
|
|
if ($isadmin) {
|
|
// show the form
|
|
if ($edit) {
|
|
// set form options for editing
|
|
$sectiontitle="<b>Modify Subject</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table&edit=1\">";
|
|
$buttontags="
|
|
<input type=\"hidden\" name=\"id\" value=\"$id\">
|
|
<input type=\"submit\" name=\"update\" value=\"Update Subject\">
|
|
<input type=\"submit\" name=\"delete\" value=\"Delete Subject\">
|
|
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
|
|
";
|
|
// pull current values from database
|
|
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from subjects where subjectid=$id"));
|
|
$name=$currentvalues["subjectname"];
|
|
if ($currentvalues["status"]==1) {
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
} else {
|
|
$activetag="<input type=\"checkbox\" name=\"active\">";
|
|
}
|
|
} else {
|
|
// set form options for add
|
|
$sectiontitle="<b>Add New Subject</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table\">";
|
|
$buttontags="
|
|
<input type=\"submit\" name=\"add\" value=\"Add Subject\">
|
|
";
|
|
// set default values
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
}
|
|
|
|
echo "
|
|
$sectiontitle
|
|
$formtag
|
|
<table border=\"0\">
|
|
<tr><td>
|
|
Subject Name (may contain spaces): <input type=\"text\" name=\"name\" size=\"40\" value=\"$name\"><br><br>
|
|
Active: $activetag<br><br>
|
|
</td></tr>
|
|
</table>
|
|
$buttontags
|
|
</form>
|
|
<br><hr>
|
|
";
|
|
}
|
|
// show the table of entities
|
|
$existingdata=mysqli_query($db,"select subjectid,subjectname,status from subjects order by subjectid asc");
|
|
echo "
|
|
<b>Existing Subjects</b> <font size=\"-1\">Click on the Subject ID to edit.</font><br><br>
|
|
<table border=\"1\">
|
|
<tr><th>Subject ID</th><th>Subject Name</th><th>Active</th></tr>
|
|
";
|
|
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
|
|
if ($tablerow["status"]) {
|
|
$statdef="<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
|
|
} else {
|
|
$statdef="<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
|
}
|
|
printf("
|
|
<tr>
|
|
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
|
<td>%s</td>
|
|
<td align=\"center\">%s</td>
|
|
</tr>",
|
|
$tablerow["subjectid"],$tablerow["subjectid"],
|
|
$tablerow["subjectname"],
|
|
$statdef);
|
|
}
|
|
echo "</table>";
|
|
break;
|
|
case "links" :
|
|
if ($isadmin) {
|
|
// show the form
|
|
if ($edit) {
|
|
// set form options for editing
|
|
$sectiontitle="<b>Modify Link</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table&edit=1\">";
|
|
$buttontags="
|
|
<input type=\"hidden\" name=\"id\" value=\"$id\">
|
|
<input type=\"submit\" name=\"update\" value=\"Update Link\">
|
|
<input type=\"submit\" name=\"delete\" value=\"Delete Link\">
|
|
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
|
|
";
|
|
// pull current values from database
|
|
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from links where linkid=$id"));
|
|
$name=$currentvalues["displaytxt"];
|
|
$priority=$currentvalues["linkpriority"];
|
|
$url=$currentvalues["urltxt"];
|
|
if ($currentvalues["status"]==1) {
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
} else {
|
|
$activetag="<input type=\"checkbox\" name=\"active\">";
|
|
}
|
|
// determine where we are in the priority stack
|
|
$prow=mysqli_fetch_assoc(mysqli_query($db,"select min(linkpriority) as highest from links"));
|
|
if ($prow["highest"]==$priority) {
|
|
$belowselection=0;
|
|
} else {
|
|
$abovelink=mysqli_fetch_row(mysqli_query($db,"select max(linkpriority) from links where linkpriority<\"$priority\""));
|
|
$belowselection=$abovelink[0];
|
|
}
|
|
$priorselect="<select name=\"belowlink\">";
|
|
if ($belowselection==0) {
|
|
$priorselect=$priorselect . "<option value=\"0\" selected>nothing (top of list)</option>";
|
|
} else {
|
|
$priorselect=$priorselect . "<option value=\"0\">nothing (top of list)</option>";
|
|
}
|
|
$linkrow=mysqli_query($db,"select linkpriority,displaytxt from links order by linkpriority asc");
|
|
while ($linkitem=mysqli_fetch_assoc($linkrow)) {
|
|
if ($belowselection==$linkitem["linkpriority"]) {
|
|
$priorselect=$priorselect . "<option value=\"" . $linkitem["linkpriority"] . "\" selected>" . $linkitem["displaytxt"] . "</option>\n";
|
|
} else {
|
|
$priorselect=$priorselect . "<option value=\"" . $linkitem["linkpriority"] . "\">" . $linkitem["displaytxt"] . "</option>\n";
|
|
}
|
|
}
|
|
$priorselect=$priorselect . "</select>";
|
|
} else {
|
|
// set form options for add
|
|
$sectiontitle="<b>Add New Link</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table\">";
|
|
$buttontags="
|
|
<input type=\"submit\" name=\"add\" value=\"Add Link\">
|
|
";
|
|
// set default values
|
|
$abovelink=mysqli_fetch_row(mysqli_query($db,"select max(linkpriority) from links"));
|
|
$belowselection=$abovelink[0];
|
|
$priorselect="<select name=\"belowlink\">";
|
|
$priorselect=$priorselect . "<option value=\"0\">nothing (top of list)</option>";
|
|
$linkrow=mysqli_query($db,"select linkpriority,displaytxt from links order by linkpriority asc");
|
|
while ($linkitem=mysqli_fetch_assoc($linkrow)) {
|
|
if ($belowselection==$linkitem["linkpriority"]) {
|
|
$priorselect=$priorselect . "<option value=\"" . $linkitem["linkpriority"] . "\" selected>" . $linkitem["displaytxt"] . "</option>\n";
|
|
} else {
|
|
$priorselect=$priorselect . "<option value=\"" . $linkitem["linkpriority"] . "\">" . $linkitem["displaytxt"] . "</option>\n";
|
|
}
|
|
}
|
|
$priorselect=$priorselect . "</select>";
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
}
|
|
|
|
echo "
|
|
$sectiontitle
|
|
$formtag
|
|
<table border=\"0\">
|
|
<tr><td>
|
|
Link Name (what the user will click on): <input type=\"text\" name=\"name\" size=\"40\" value=\"$name\"><br><br>
|
|
URL (page the link takes you to. Must be a valid URL.): <input type=\"text\" name=\"url\" size=\"60\" value=\"$url\"><br><br>
|
|
Insert Link Below:
|
|
$priorselect
|
|
<br><br>
|
|
Active: $activetag<br><br>
|
|
</td></tr>
|
|
</table>
|
|
$buttontags
|
|
</form>
|
|
<br><hr>
|
|
";
|
|
}
|
|
// show the table of entities
|
|
$existingdata=mysqli_query($db,"select linkid,displaytxt,urltxt,status from links order by linkpriority asc");
|
|
echo "
|
|
<b>Existing Links</b> <font size=\"-1\">Click on the Link ID to edit.</font><br><br>
|
|
<table border=\"1\">
|
|
<tr><th>Link ID</th><th>Display Text</th><th>URL</th><th>Active</th></tr>
|
|
";
|
|
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
|
|
if ($tablerow["status"]) {
|
|
$statdef="<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
|
|
} else {
|
|
$statdef="<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
|
}
|
|
printf("
|
|
<tr>
|
|
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
|
<td>%s</td>
|
|
<td><a href=\"%s\">%s</a></td>
|
|
<td align=\"center\">%s</td>
|
|
</tr>",
|
|
$tablerow["linkid"],$tablerow["linkid"],
|
|
$tablerow["displaytxt"],
|
|
$tablerow["urltxt"],$tablerow["urltxt"],
|
|
$statdef);
|
|
}
|
|
echo "</table>";
|
|
break;
|
|
case "flags" :
|
|
if ($isadmin) {
|
|
// show the form
|
|
if ($edit) {
|
|
// set form options for editing
|
|
$sectiontitle="<b>Modify Flag</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table&edit=1\">";
|
|
$buttontags="
|
|
<input type=\"hidden\" name=\"id\" value=\"$id\">
|
|
<input type=\"submit\" name=\"update\" value=\"Update Flag\">
|
|
<input type=\"submit\" name=\"delete\" value=\"Delete Flag\">
|
|
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
|
|
";
|
|
// pull current values from database
|
|
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=$id"));
|
|
$name=$currentvalues["flagname"];
|
|
$flagsym=$currentvalues["flagsym"];
|
|
$flagcolor=$currentvalues["flagcolor"];
|
|
$flagcoloropts="";
|
|
foreach($basic_colors as $cname => $chex) {
|
|
if ($chex==$flagcolor) {
|
|
$flagcoloropts=$flagcoloropts . "<option value=\"$chex\" selected>$cname</option>";
|
|
} else {
|
|
$flagcoloropts=$flagcoloropts . "<option value=\"$chex\">$cname</option>";
|
|
}
|
|
}
|
|
if ($currentvalues["status"]==1) {
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
} else {
|
|
$activetag="<input type=\"checkbox\" name=\"active\">";
|
|
}
|
|
} else {
|
|
// set form options for add
|
|
$sectiontitle="<b>Add New Flag</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table\">";
|
|
$buttontags="
|
|
<input type=\"submit\" name=\"add\" value=\"Add Flag\">
|
|
";
|
|
// set default values
|
|
$flagcolor="#FFFFFF";
|
|
$flagcoloropts="";
|
|
foreach($basic_colors as $cname => $chex) {
|
|
if ($chex==$flagcolor) {
|
|
$flagcoloropts=$flagcoloropts . "<option value=\"$chex\" selected>$cname</option>";
|
|
} else {
|
|
$flagcoloropts=$flagcoloropts . "<option value=\"$chex\">$cname</option>";
|
|
}
|
|
}
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
}
|
|
|
|
echo "
|
|
$sectiontitle
|
|
$formtag
|
|
<table border=\"0\">
|
|
<tr><td>
|
|
Flag Name (may contain spaces): <input type=\"text\" name=\"name\" size=\"40\" value=\"$name\"><br><br>
|
|
Flag Symbol (one, two, three, or four letter mnemonic to be shown in tables and lists): <input type=\"text\" name=\"flagsym\" size=\"4\" maxlength=\"4\" value=\"$flagsym\"><br><br>
|
|
Flag Color (symbol will be shown in this color):
|
|
<select name=\"flagcolor\">
|
|
$flagcoloropts
|
|
</select><br><br>
|
|
Active: $activetag<br><br>
|
|
</td></tr>
|
|
</table>
|
|
$buttontags
|
|
</form>
|
|
<br><hr>
|
|
";
|
|
}
|
|
// show the table of entities
|
|
$existingdata=mysqli_query($db,"select * from flags order by flagid asc");
|
|
echo "
|
|
<b>Existing Flags</b> <font size=\"-1\">Click on the Flag ID to edit.</font><br><br>
|
|
<table border=\"1\">
|
|
<tr><th>Flag ID</th><th>Flag Name</th><th>Flag Symbol</th><th>Active</th></tr>
|
|
";
|
|
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
|
|
if ($tablerow["status"]) {
|
|
$statdef="<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
|
|
} else {
|
|
$statdef="<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
|
}
|
|
printf("
|
|
<tr>
|
|
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
|
<td>%s</td>
|
|
<td align=\"center\"><font color=\"%s\">%s</font></td>
|
|
<td align=\"center\">%s</td>
|
|
</tr>",
|
|
$tablerow["flagid"],$tablerow["flagid"],
|
|
$tablerow["flagname"],
|
|
$tablerow["flagcolor"],$tablerow["flagsym"],
|
|
$statdef);
|
|
}
|
|
echo "</table>";
|
|
break;
|
|
case "logpartactions" :
|
|
if ($isadmin) {
|
|
// show the form
|
|
if ($edit) {
|
|
// set form options for editing
|
|
$sectiontitle="<b>Modify Part Action</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table&edit=1\">";
|
|
$buttontags="
|
|
<input type=\"hidden\" name=\"id\" value=\"$id\">
|
|
<input type=\"submit\" name=\"update\" value=\"Update Action\">
|
|
<input type=\"submit\" name=\"delete\" value=\"Delete Action\">
|
|
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
|
|
";
|
|
// pull current values from database
|
|
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from logpartactions where lpactionid=$id"));
|
|
$name=$currentvalues["lpactionname"];
|
|
if ($currentvalues["status"]==1) {
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
} else {
|
|
$activetag="<input type=\"checkbox\" name=\"active\">";
|
|
}
|
|
} else {
|
|
// set form options for add
|
|
$sectiontitle="<b>Add New Part Action</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table\">";
|
|
$buttontags="
|
|
<input type=\"submit\" name=\"add\" value=\"Add Action\">
|
|
";
|
|
// set default values
|
|
$activetag="<input type=\"checkbox\" name=\"active\" checked>";
|
|
}
|
|
|
|
echo "
|
|
$sectiontitle
|
|
$formtag
|
|
<table border=\"0\">
|
|
<tr><td>
|
|
Part Action Name (may contain spaces): <input type=\"text\" name=\"name\" size=\"40\" value=\"$name\"><br><br>
|
|
Active: $activetag<br><br>
|
|
</td></tr>
|
|
</table>
|
|
$buttontags
|
|
</form>
|
|
<br><hr>
|
|
";
|
|
}
|
|
// show the table of entities
|
|
$existingdata=mysqli_query($db,"select * from logpartactions order by lpactionid asc");
|
|
echo "
|
|
<b>Existing Part Actions</b> <font size=\"-1\">Click on the Action ID to edit.</font><br><br>
|
|
<table border=\"1\">
|
|
<tr><th>Part Action ID</th><th>Part Action Name</th><th>Active</th></tr>
|
|
";
|
|
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
|
|
if ($tablerow["status"]) {
|
|
$statdef="<img src=\"icons/tick.png\" title=\"active\" alt=\"active\">";
|
|
} else {
|
|
$statdef="<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
|
|
}
|
|
printf("
|
|
<tr>
|
|
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
|
<td>%s</td>
|
|
<td align=\"center\">%s</td>
|
|
</tr>",
|
|
$tablerow["lpactionid"],$tablerow["lpactionid"],
|
|
$tablerow["lpactionname"],
|
|
$statdef);
|
|
}
|
|
echo "</table>";
|
|
break;
|
|
case "banners" :
|
|
if ($isadmin) {
|
|
// show the form
|
|
if ($edit) {
|
|
// set form options for editing
|
|
$sectiontitle="<b>Modify Banner</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table&edit=1\">";
|
|
$buttontags="
|
|
<input type=\"hidden\" name=\"id\" value=\"$id\">
|
|
<input type=\"submit\" name=\"update\" value=\"Update Banner\">
|
|
<input type=\"submit\" name=\"delete\" value=\"Delete Banner\">
|
|
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
|
|
";
|
|
// pull current values from database
|
|
$currentvalues=mysqli_fetch_assoc(mysqli_query($db,"select * from banners where bannerid=$id"));
|
|
$name=$currentvalues["bannername"];
|
|
$bnrcolor=$currentvalues["bannercolor"];
|
|
$bnrtextcolor=$currentvalues["textcolor"];
|
|
$bnrcoloropts="";
|
|
foreach($basic_colors as $cname => $chex) {
|
|
if ($chex==$bnrcolor) {
|
|
$bnrcoloropts=$bnrcoloropts . "<option value=\"$chex\" selected>$cname</option>";
|
|
} else {
|
|
$bnrcoloropts=$bnrcoloropts . "<option value=\"$chex\">$cname</option>";
|
|
}
|
|
}
|
|
$bnrtextcoloropts="";
|
|
foreach($basic_colors as $cname => $chex) {
|
|
if ($chex==$bnrtextcolor) {
|
|
$bnrtextcoloropts=$bnrtextcoloropts . "<option value=\"$chex\" selected>$cname</option>";
|
|
} else {
|
|
$bnrtextcoloropts=$bnrtextcoloropts . "<option value=\"$chex\">$cname</option>";
|
|
}
|
|
}
|
|
} else {
|
|
// set form options for add
|
|
$sectiontitle="<b>Add New Banner</b><br><br>";
|
|
$formtag="<form method=\"post\" action=\"admin.php?table=$table\">";
|
|
$buttontags="
|
|
<input type=\"submit\" name=\"add\" value=\"Add Banner\">
|
|
";
|
|
// set default values
|
|
$bnrcolor="#000000";
|
|
$bnrtextcolor="#FFFFFF";
|
|
$bnrcoloropts="";
|
|
foreach($basic_colors as $cname => $chex) {
|
|
if ($chex==$bnrcolor) {
|
|
$bnrcoloropts=$bnrcoloropts . "<option value=\"$chex\" selected>$cname</option>";
|
|
} else {
|
|
$bnrcoloropts=$bnrcoloropts . "<option value=\"$chex\">$cname</option>";
|
|
}
|
|
}
|
|
$bnrtextcoloropts="";
|
|
foreach($basic_colors as $cname => $chex) {
|
|
if ($chex==$bnrtextcolor) {
|
|
$bnrtextcoloropts=$bnrtextcoloropts . "<option value=\"$chex\" selected>$cname</option>";
|
|
} else {
|
|
$bnrtextcoloropts=$bnrtextcoloropts . "<option value=\"$chex\">$cname</option>";
|
|
}
|
|
}
|
|
}
|
|
|
|
echo "
|
|
$sectiontitle
|
|
$formtag
|
|
<table border=\"0\">
|
|
<tr><td>
|
|
Banner Name (text displayed in the banner): <input type=\"text\" name=\"name\" size=\"40\" value=\"$name\"><br><br>
|
|
Banner Color (background color of the banner):
|
|
<select name=\"bnrcolor\">
|
|
$bnrcoloropts
|
|
</select><br><br>
|
|
Banner Text Color (text color of the banner, different than banner color):
|
|
<select name=\"bnrtxtcolor\">
|
|
$bnrtextcoloropts
|
|
</select><br><br>
|
|
</td></tr>
|
|
</table>
|
|
$buttontags
|
|
</form>
|
|
<br><hr>
|
|
";
|
|
}
|
|
// show the table of entities
|
|
$existingdata=mysqli_query($db,"select * from banners where bannerid!=1 order by bannerid asc");
|
|
echo "
|
|
<b>Existing Banners</b> <font size=\"-1\">Click on the Banner ID to edit.</font><br><br>
|
|
<table border=\"1\">
|
|
<tr><th>Banner ID</th><th>Banner</th></tr>
|
|
";
|
|
while ($tablerow=mysqli_fetch_assoc($existingdata)) {
|
|
printf("
|
|
<tr>
|
|
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
|
|
<td align=\"center\" bgcolor=\"%s\"><font color=\"%s\">%s</font></td>
|
|
</tr>",
|
|
$tablerow["bannerid"],$tablerow["bannerid"],
|
|
$tablerow["bannercolor"],$tablerow["textcolor"],$tablerow["bannername"]);
|
|
}
|
|
echo "</table>";
|
|
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 "
|
|
<center><b><u>Display Configuration Parameters</u></b></center><br><br>
|
|
<form method=\"post\" action=\"admin.php?table=$table&type=$type&edit=1\">
|
|
Log Name (will appear at the top of pages and in the titlebar): <input type=\"text\" name=\"display_logname\" size=\"40\" value=\"$curlname\"><br><br>
|
|
Banner (will appear at the top and bottom of pages): <select name=\"display_banner\">
|
|
";
|
|
$bannerqry=mysqli_query($db,"select * from banners");
|
|
while ($bannerrow=mysqli_fetch_assoc($bannerqry)) {
|
|
if ($bannerrow["bannerid"]==$curbnr) {
|
|
printf("<option value=\"%s\" selected>%s</option>",$bannerrow["bannerid"],$bannerrow["bannername"]);
|
|
} else {
|
|
printf("<option value=\"%s\">%s</option>",$bannerrow["bannerid"],$bannerrow["bannername"]);
|
|
}
|
|
}
|
|
echo "
|
|
</select><br><br>
|
|
Footer Message (will appear at the bottom of pages):<br>
|
|
<input type=\"text\" name=\"display_footer\" size=\"80\" value=\"$curftr\"><br><br>
|
|
UID text (what you'd like to call the Unique Part ID):<br>
|
|
<input type=\"text\" name=\"display_uidtext\" size=\"12\" value=\"$curuidtxt\"><br><br>
|
|
Log style (the look of the log notes display): <select name=\"display_logstyle\">
|
|
";
|
|
$logstyleqry=mysqli_query($db,"select styleid,stylename from styles where styletype=\"logdisplay\"");
|
|
while ($logstylerow=mysqli_fetch_assoc($logstyleqry)) {
|
|
if ($logstylerow["styleid"]==$curlogstyle) {
|
|
printf("<option value=\"%s\" selected>%s</option>",$logstylerow["styleid"],$logstylerow["stylename"]);
|
|
} else {
|
|
printf("<option value=\"%s\">%s</option>",$logstylerow["styleid"],$logstylerow["stylename"]);
|
|
}
|
|
}
|
|
echo "
|
|
</select><br><br>
|
|
URL Chunk Size (long URLs will be linewrapped at this many characters):
|
|
<input type=\"text\" name=\"display_urlchunk\" size=\"3\" value=\"$curlchunk\"><br><br>
|
|
Show timestamps in log notes:
|
|
";
|
|
if ($curts) {
|
|
echo "<input type=\"checkbox\" name=\"display_showts\" checked>";
|
|
} else {
|
|
echo "<input type=\"checkbox\" name=\"display_showts\">";
|
|
}
|
|
echo "
|
|
<br><br>
|
|
Techs display order:
|
|
";
|
|
if ($curtdo) {
|
|
echo "
|
|
<input type=\"radio\" name=\"display_techalpha\" value=\"a\" checked>Alphabetical order
|
|
|
|
<input type=\"radio\" name=\"display_techalpha\" value=\"d\">Database order
|
|
";
|
|
} else {
|
|
echo "
|
|
<input type=\"radio\" name=\"display_techalpha\" value=\"a\">Alphabetical order
|
|
|
|
<input type=\"radio\" name=\"display_techalpha\" value=\"d\" checked>Database order
|
|
";
|
|
}
|
|
echo "
|
|
<br><br>
|
|
Subjects display order:
|
|
";
|
|
if ($cursdo) {
|
|
echo "
|
|
<input type=\"radio\" name=\"display_subjalpha\" value=\"a\" checked>Alphabetical order
|
|
|
|
<input type=\"radio\" name=\"display_subjalpha\" value=\"d\">Database order
|
|
";
|
|
} else {
|
|
echo "
|
|
<input type=\"radio\" name=\"display_subjalpha\" value=\"a\">Alphabetical order
|
|
|
|
<input type=\"radio\" name=\"display_subjalpha\" value=\"d\" checked>Database order
|
|
";
|
|
}
|
|
echo "
|
|
<br><br><br>
|
|
";
|
|
if ($isadmin) {
|
|
echo "
|
|
<input type=\"submit\" name=\"update\" value=\"Update Options\">
|
|
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
|
|
";
|
|
}
|
|
echo "
|
|
</form>
|
|
<br><hr>
|
|
";
|
|
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 "<table border=\"0\"><tr><td>Page background color</td><td>";
|
|
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=background_color&hexcolor=");
|
|
echo "</td></tr></table><hr>";
|
|
break;
|
|
case "sidebar_color":
|
|
echo "<table border=\"0\"><tr><td>Sidebar color</td><td>";
|
|
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=sidebar_color&hexcolor=");
|
|
echo "</td></tr></table><hr>";
|
|
break;
|
|
case "menubg_color":
|
|
echo "<table border=\"0\"><tr><td>Menu background color</td><td>";
|
|
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=menubg_color&hexcolor=");
|
|
echo "</td></tr></table><hr>";
|
|
break;
|
|
case "text_color":
|
|
echo "<table border=\"0\"><tr><td>Normal text color</td><td>";
|
|
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=text_color&hexcolor=");
|
|
echo "</td></tr></table><hr>";
|
|
break;
|
|
case "link_color":
|
|
echo "<table border=\"0\"><tr><td>Link color</td><td>";
|
|
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=link_color&hexcolor=");
|
|
echo "</td></tr></table><hr>";
|
|
break;
|
|
case "vlink_color":
|
|
echo "<table border=\"0\"><tr><td>Visited link color</td><td>";
|
|
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=vlink_color&hexcolor=");
|
|
echo "</td></tr></table><hr>";
|
|
break;
|
|
case "heading_color":
|
|
echo "<table border=\"0\"><tr><td>Heading color</td><td>";
|
|
colorpicker("admin.php?table=configs&type=color&edit=1&modcolor=heading_color&hexcolor=");
|
|
echo "</td></tr></table><hr>";
|
|
break;
|
|
}
|
|
|
|
echo "<center><b><u>Color Configuration Parameters</u></b></center><br><br>
|
|
<b>Select the color you'd like to change</b><br><br>
|
|
<table border=\"1\" cellpadding=\"10\">
|
|
<tr><td><a href=\"admin.php?table=configs&type=color&modcolor=background_color\">Page background color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curtc\">$curbgc</font></td></tr>
|
|
<tr><td><a href=\"admin.php?table=configs&type=color&modcolor=sidebar_color\">Sidebar color</a></td><td bgcolor=\"$cursbc\"><font color=\"$curtc\">$cursbc</font></td></tr>
|
|
<tr><td><a href=\"admin.php?table=configs&type=color&modcolor=menubg_color\">Menu background color</a></td><td bgcolor=\"$curmbgc\"><font color=\"$curlc\">$curmbgc</font></td></tr>
|
|
<tr><td><a href=\"admin.php?table=configs&type=color&modcolor=text_color\">Normal text color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curtc\">$curtc</font></td></tr>
|
|
<tr><td><a href=\"admin.php?table=configs&type=color&modcolor=link_color\">Link color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curlc\">$curlc</font></td></tr>
|
|
<tr><td><a href=\"admin.php?table=configs&type=color&modcolor=vlink_color\">Visited link color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curvlc\">$curvlc</font></td></tr>
|
|
<tr><td><a href=\"admin.php?table=configs&type=color&modcolor=heading_color\">Heading color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curhc\">$curhc</font></td></tr>
|
|
</table>
|
|
";
|
|
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 "
|
|
<center><b><u>Miscellaneous Configuration Parameters</u></b></center><br><br>
|
|
<form method=\"post\" action=\"admin.php?table=$table&type=$type&edit=1\">
|
|
Session expiration time (users will have to log in again after this long) : <input type=\"text\" name=\"misc_sessttl\" size=\"3\" value=\"$curttl\"> days<br><br>
|
|
Server session file directory (must be writable by the web server process) : <br><input type=\"text\" name=\"misc_sessdir\" size=\"40\" value=\"$curssdir\"><br><br>
|
|
Force logout of all users <input type=\"checkbox\" name=\"misc_logoutall\"><br><br>
|
|
Enable Parts Functionality <input type=\"checkbox\" name=\"misc_partfuncs\"
|
|
";
|
|
if ($currpartfuncs) echo " checked";
|
|
echo "
|
|
><br><br>
|
|
Enable Scheduled Maintenance Functionality <input type=\"checkbox\" name=\"misc_schedmaintfuncs\"
|
|
";
|
|
if ($currschedmaintfuncs) echo " checked";
|
|
echo "
|
|
><br><br>
|
|
<br>
|
|
";
|
|
if ($isadmin) {
|
|
echo "
|
|
<input type=\"submit\" name=\"update\" value=\"Update Options\">
|
|
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
|
|
";
|
|
}
|
|
echo "
|
|
</form>
|
|
<hr>
|
|
";
|
|
break;
|
|
default :
|
|
echo "Unknown config type!";
|
|
break;
|
|
}
|
|
break;
|
|
default :
|
|
echo "<br><br><center><b>Select one of the options above.</b></center>";
|
|
break;
|
|
}
|
|
|
|
banner($print);
|
|
pageblock("right","end");
|
|
pagetable("end");
|
|
|
|
framework("end","","",$print);
|
|
|
|
?>
|