Various reformats. Changed boolean variables from 1/0 to TRUE/FALSE in multiple files.

This commit is contained in:
2026-02-19 14:08:40 -05:00
parent 9122040863
commit 01fd47814b
22 changed files with 3502 additions and 3150 deletions

3
BUGS
View File

@@ -1,4 +1,5 @@
BUGS
1. Adding a reference to a note using the magnifying glass icon is possible even if not logged in. This results in a blank tech and shift.
SOMEWHAT FIXED. If not logged in and the partview argument is not 1, redirects to login page. (This is not the optimal solution. There needs to be a specific view only state.)
SOMEWHAT FIXED. If not logged in and the partview argument is not 1, redirects to login page. (This is not the optimal solution. There
needs to be a specific view only state.)

View File

@@ -1,15 +1,15 @@
TODO.txt
1. Create a weblink hot button on the add logbook entry page to insert a weblink. DONE
2. Allow admins to create global templates.
2. Allow admins to create global templates. DONE
3. Create a way to restore the global page colors. (db change reqd)
4. Pick a logbook subject to associate with a scheduled task to populate for the logbook entry. (db change reqd)
5. Add info messages to scheduled task page edits.
6. Allow scheduled tasks to be completed as a group instead of having to complete each member.
7. Implement popup calendars for date entry fields. DONE
8. Improve template management interface. It can be confusing. It needs its own page.
9. Remove refs from templates. (db change reqd)
10. Replace dynamic flag_ table creation with a flagassignment table. (db change reqd)
8. Improve template management interface. It can be confusing. It needs its own page. DONE
9. Remove refs from templates. (db change reqd) DONE
10. Replace dynamic flag_ table creation with a flagassignment table. (db change reqd) DONE
11. allow partids to be autogenerated if user doesn't supply one (db change reqd)
12. If there are no flags, don't offer to set them on reference chain
13. make some flags immutable so they won't be synced on reference chain.

View File

@@ -4,24 +4,36 @@
-- ------------------------------------------------------
-- Server version 10.6.18-MariaDB-0ubuntu0.22.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */
;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */
;
/*!40101 SET NAMES utf8mb4 */
;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */
;
/*!40103 SET TIME_ZONE='+00:00' */
;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */
;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */
;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */
;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */
;
--
-- Table structure for table `banners`
--
DROP TABLE IF EXISTS `banners`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `banners` (
`bannerid` int(11) NOT NULL AUTO_INCREMENT,
`bannername` tinytext DEFAULT NULL,
@@ -29,21 +41,50 @@ CREATE TABLE `banners` (
`textcolor` tinytext DEFAULT NULL,
PRIMARY KEY (`bannerid`)
) ENGINE = InnoDB AUTO_INCREMENT = 6 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `banners`
--
LOCK TABLES `banners` WRITE;
/*!40000 ALTER TABLE `banners` DISABLE KEYS */;
INSERT INTO `banners` VALUES
(1,'no banner','#000000','#000000'),
(2,'UNCLASSIFIED','#009900','#FFFFFF'),
(3,'CONFIDENTIAL','#000099','#FFFFFF'),
(4,'SECRET','#990000','#FFFFFF'),
(5,'TOP SECRET','#FF6600','#FFFFFF');
/*!40000 ALTER TABLE `banners` ENABLE KEYS */;
/*!40000 ALTER TABLE `banners` DISABLE KEYS */
;
INSERT INTO
`banners`
VALUES (
1,
'no banner',
'#000000',
'#000000'
),
(
2,
'UNCLASSIFIED',
'#009900',
'#FFFFFF'
),
(
3,
'CONFIDENTIAL',
'#000099',
'#FFFFFF'
),
(
4,
'SECRET',
'#990000',
'#FFFFFF'
),
(
5,
'TOP SECRET',
'#FF6600',
'#FFFFFF'
);
/*!40000 ALTER TABLE `banners` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -51,8 +92,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `configs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `configs` (
`confid` int(11) NOT NULL AUTO_INCREMENT,
`confname` text DEFAULT NULL,
@@ -60,46 +103,98 @@ CREATE TABLE `configs` (
PRIMARY KEY (`confid`),
UNIQUE (`confname`)
) ENGINE = InnoDB AUTO_INCREMENT = 33 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `configs`
--
LOCK TABLES `configs` WRITE;
/*!40000 ALTER TABLE `configs` DISABLE KEYS */;
INSERT INTO `configs` VALUES
(1,'ol_version','5.2.4'),
/*!40000 ALTER TABLE `configs` DISABLE KEYS */
;
INSERT INTO
`configs`
VALUES (1, 'ol_version', '5.2.4'),
(2, 'log_name', 'OpenLog'),
(3, 'banner', '1'),
(4,'background_color','#003333'),
(5,'p_background_color','#FFFFFF'),
(
4,
'background_color',
'#003333'
),
(
5,
'p_background_color',
'#FFFFFF'
),
(6, 'sidebar_color', '#336666'),
(7,'p_sidebar_color','#FFFFFF'),
(
7,
'p_sidebar_color',
'#FFFFFF'
),
(8, 'menubg_color', '#000000'),
(9,'p_menubg_color','#FFFFFF'),
(
9,
'p_menubg_color',
'#FFFFFF'
),
(10, 'text_color', '#FFFFFF'),
(11, 'p_text_color', '#000000'),
(12, 'link_color', '#00FF00'),
(13, 'p_link_color', '#000000'),
(14, 'vlink_color', '#00FF00'),
(15,'p_vlink_color','#000000'),
(16,'heading_color','#00FFFF'),
(17,'p_heading_color','#000000'),
(18,'footer_message','Please report bugs to software@thermionic.net.'),
(
15,
'p_vlink_color',
'#000000'
),
(
16,
'heading_color',
'#00FFFF'
),
(
17,
'p_heading_color',
'#000000'
),
(
18,
'footer_message',
'Please report bugs to software@thermionic.net.'
),
(19, 'show_ts', '1'),
(20, 'url_chunk_size', '70'),
(21, 'tech_alpha', '1'),
(22, 'subj_alpha', '1'),
(23,'unix_server_session_dir','/tmp/openlog/openlog/sessions'),
(24,'win_server_session_dir','c:\\Windows\\Temp\\openlog\\\\openlog\\sessions'),
(
23,
'unix_server_session_dir',
'/tmp/openlog/openlog/sessions'
),
(
24,
'win_server_session_dir',
'c:\\Windows\\Temp\\openlog\\\\openlog\\sessions'
),
(25, 'session_ttl_days', '30'),
(26, 'log_style', '1'),
(27,'uid_text','Part ID Number'),
(
27,
'uid_text',
'Part ID Number'
),
(28, 'parts_functions', '1'),
(29,'schedmaint_functions','1'),
(
29,
'schedmaint_functions',
'1'
),
(30, 'log_errors', '0');
/*!40000 ALTER TABLE `configs` ENABLE KEYS */;
/*!40000 ALTER TABLE `configs` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -107,8 +202,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `customs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `customs` (
`customid` int(11) NOT NULL AUTO_INCREMENT,
`customtech` int(11) DEFAULT NULL,
@@ -116,15 +213,18 @@ CREATE TABLE `customs` (
`customconfvalue` text DEFAULT NULL,
PRIMARY KEY (`customid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `customs`
--
LOCK TABLES `customs` WRITE;
/*!40000 ALTER TABLE `customs` DISABLE KEYS */;
/*!40000 ALTER TABLE `customs` ENABLE KEYS */;
/*!40000 ALTER TABLE `customs` DISABLE KEYS */
;
/*!40000 ALTER TABLE `customs` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -132,23 +232,28 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `devicegroups`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `devicegroups` (
`groupid` int(11) NOT NULL AUTO_INCREMENT,
`groupdevice` int(11) DEFAULT NULL,
`memberdevice` int(11) DEFAULT NULL,
PRIMARY KEY (`groupid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `devicegroups`
--
LOCK TABLES `devicegroups` WRITE;
/*!40000 ALTER TABLE `devicegroups` DISABLE KEYS */;
/*!40000 ALTER TABLE `devicegroups` ENABLE KEYS */;
/*!40000 ALTER TABLE `devicegroups` DISABLE KEYS */
;
/*!40000 ALTER TABLE `devicegroups` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -156,8 +261,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `devices`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `devices` (
`deviceid` int(11) NOT NULL AUTO_INCREMENT,
`devicename` tinytext DEFAULT NULL,
@@ -166,15 +273,18 @@ CREATE TABLE `devices` (
`active_flag` int(11) DEFAULT NULL,
PRIMARY KEY (`deviceid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `devices`
--
LOCK TABLES `devices` WRITE;
/*!40000 ALTER TABLE `devices` DISABLE KEYS */;
/*!40000 ALTER TABLE `devices` ENABLE KEYS */;
/*!40000 ALTER TABLE `devices` DISABLE KEYS */
;
/*!40000 ALTER TABLE `devices` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -182,8 +292,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `events`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `events` (
`eventid` int(11) NOT NULL AUTO_INCREMENT,
`task` int(11) DEFAULT NULL,
@@ -195,15 +307,18 @@ CREATE TABLE `events` (
`active_flag` int(11) DEFAULT NULL,
PRIMARY KEY (`eventid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `events`
--
LOCK TABLES `events` WRITE;
/*!40000 ALTER TABLE `events` DISABLE KEYS */;
/*!40000 ALTER TABLE `events` ENABLE KEYS */;
/*!40000 ALTER TABLE `events` DISABLE KEYS */
;
/*!40000 ALTER TABLE `events` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -211,8 +326,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `flags`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `flags` (
`flagid` int(11) NOT NULL AUTO_INCREMENT,
`flagname` tinytext DEFAULT NULL,
@@ -221,15 +338,18 @@ CREATE TABLE `flags` (
`status` int(11) NOT NULL,
PRIMARY KEY (`flagid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `flags`
--
LOCK TABLES `flags` WRITE;
/*!40000 ALTER TABLE `flags` DISABLE KEYS */;
/*!40000 ALTER TABLE `flags` ENABLE KEYS */;
/*!40000 ALTER TABLE `flags` DISABLE KEYS */
;
/*!40000 ALTER TABLE `flags` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -237,8 +357,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `flagmap`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `flagmap` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`flagid` int(11) NOT NULL,
@@ -247,15 +369,18 @@ CREATE TABLE `flagmap` (
`notetemplateid` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `flagmap`
--
LOCK TABLES `flagmap` WRITE;
/*!40000 ALTER TABLE `flagmap` DISABLE KEYS */;
/*!40000 ALTER TABLE `flagmap` ENABLE KEYS */;
/*!40000 ALTER TABLE `flagmap` DISABLE KEYS */
;
/*!40000 ALTER TABLE `flagmap` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -263,8 +388,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `links`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `links` (
`linkid` int(11) NOT NULL AUTO_INCREMENT,
`linkpriority` int(11) NOT NULL,
@@ -273,15 +400,18 @@ CREATE TABLE `links` (
`status` int(11) NOT NULL,
PRIMARY KEY (`linkid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `links`
--
LOCK TABLES `links` WRITE;
/*!40000 ALTER TABLE `links` DISABLE KEYS */;
/*!40000 ALTER TABLE `links` ENABLE KEYS */;
/*!40000 ALTER TABLE `links` DISABLE KEYS */
;
/*!40000 ALTER TABLE `links` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -289,8 +419,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `lognotes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `lognotes` (
`lognoteid` int(11) NOT NULL AUTO_INCREMENT,
`date` date DEFAULT NULL,
@@ -301,15 +433,18 @@ CREATE TABLE `lognotes` (
`lognote` text DEFAULT NULL,
PRIMARY KEY (`lognoteid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `lognotes`
--
LOCK TABLES `lognotes` WRITE;
/*!40000 ALTER TABLE `lognotes` DISABLE KEYS */;
/*!40000 ALTER TABLE `lognotes` ENABLE KEYS */;
/*!40000 ALTER TABLE `lognotes` DISABLE KEYS */
;
/*!40000 ALTER TABLE `lognotes` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -317,8 +452,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `reflinks`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `reflinks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`noteid` int(11) DEFAULT NULL,
@@ -326,15 +463,18 @@ CREATE TABLE `reflinks` (
`target` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `reflinks`
--
LOCK TABLES `reflinks` WRITE;
/*!40000 ALTER TABLE `reflinks` DISABLE KEYS */;
/*!40000 ALTER TABLE `reflinks` ENABLE KEYS */;
/*!40000 ALTER TABLE `reflinks` DISABLE KEYS */
;
/*!40000 ALTER TABLE `reflinks` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -342,30 +482,36 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `logpartactions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `logpartactions` (
`lpactionid` int(11) NOT NULL AUTO_INCREMENT,
`lpactionname` tinytext DEFAULT NULL,
`status` int(11) DEFAULT NULL,
PRIMARY KEY (`lpactionid`)
) ENGINE = InnoDB AUTO_INCREMENT = 7 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `logpartactions`
--
LOCK TABLES `logpartactions` WRITE;
/*!40000 ALTER TABLE `logpartactions` DISABLE KEYS */;
INSERT INTO `logpartactions` VALUES
(1,'removed',1),
/*!40000 ALTER TABLE `logpartactions` DISABLE KEYS */
;
INSERT INTO
`logpartactions`
VALUES (1, 'removed', 1),
(2, 'installed', 1),
(3, 'repaired', 1),
(4, 'replaced', 1),
(5, 'incoming', 1),
(6, 'outgoing', 1);
/*!40000 ALTER TABLE `logpartactions` ENABLE KEYS */;
/*!40000 ALTER TABLE `logpartactions` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -373,8 +519,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `logparts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `logparts` (
`logpartid` int(11) NOT NULL AUTO_INCREMENT,
`lognoteid` int(11) DEFAULT NULL,
@@ -382,15 +530,18 @@ CREATE TABLE `logparts` (
`action` int(11) DEFAULT NULL,
PRIMARY KEY (`logpartid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `logparts`
--
LOCK TABLES `logparts` WRITE;
/*!40000 ALTER TABLE `logparts` DISABLE KEYS */;
/*!40000 ALTER TABLE `logparts` ENABLE KEYS */;
/*!40000 ALTER TABLE `logparts` DISABLE KEYS */
;
/*!40000 ALTER TABLE `logparts` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -398,8 +549,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `maintactions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `maintactions` (
`maintactionid` int(11) NOT NULL AUTO_INCREMENT,
`actiondate` date DEFAULT NULL,
@@ -409,15 +562,18 @@ CREATE TABLE `maintactions` (
`action` text DEFAULT NULL,
PRIMARY KEY (`maintactionid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `maintactions`
--
LOCK TABLES `maintactions` WRITE;
/*!40000 ALTER TABLE `maintactions` DISABLE KEYS */;
/*!40000 ALTER TABLE `maintactions` ENABLE KEYS */;
/*!40000 ALTER TABLE `maintactions` DISABLE KEYS */
;
/*!40000 ALTER TABLE `maintactions` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -425,8 +581,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `maintforms`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `maintforms` (
`maintformid` int(11) NOT NULL AUTO_INCREMENT,
`mfdate` date DEFAULT NULL,
@@ -441,15 +599,18 @@ CREATE TABLE `maintforms` (
`pending` int(11) DEFAULT NULL,
PRIMARY KEY (`maintformid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `maintforms`
--
LOCK TABLES `maintforms` WRITE;
/*!40000 ALTER TABLE `maintforms` DISABLE KEYS */;
/*!40000 ALTER TABLE `maintforms` ENABLE KEYS */;
/*!40000 ALTER TABLE `maintforms` DISABLE KEYS */
;
/*!40000 ALTER TABLE `maintforms` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -457,8 +618,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `notetemplates`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `notetemplates` (
`templateid` int(11) NOT NULL AUTO_INCREMENT,
`templatename` tinytext DEFAULT NULL,
@@ -469,15 +632,18 @@ CREATE TABLE `notetemplates` (
`refs` tinytext DEFAULT NULL,
PRIMARY KEY (`templateid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `notetemplates`
--
LOCK TABLES `notetemplates` WRITE;
/*!40000 ALTER TABLE `notetemplates` DISABLE KEYS */;
/*!40000 ALTER TABLE `notetemplates` ENABLE KEYS */;
/*!40000 ALTER TABLE `notetemplates` DISABLE KEYS */
;
/*!40000 ALTER TABLE `notetemplates` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -485,8 +651,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `parts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `parts` (
`partid` int(11) NOT NULL AUTO_INCREMENT,
`uid` tinytext DEFAULT NULL,
@@ -495,15 +663,18 @@ CREATE TABLE `parts` (
`partname` tinytext DEFAULT NULL,
PRIMARY KEY (`partid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `parts`
--
LOCK TABLES `parts` WRITE;
/*!40000 ALTER TABLE `parts` DISABLE KEYS */;
/*!40000 ALTER TABLE `parts` ENABLE KEYS */;
/*!40000 ALTER TABLE `parts` DISABLE KEYS */
;
/*!40000 ALTER TABLE `parts` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -511,25 +682,29 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `shifts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `shifts` (
`shiftid` int(11) NOT NULL AUTO_INCREMENT,
`shiftname` tinytext DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`shiftid`)
) ENGINE = InnoDB AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `shifts`
--
LOCK TABLES `shifts` WRITE;
/*!40000 ALTER TABLE `shifts` DISABLE KEYS */;
INSERT INTO `shifts` VALUES
(1,'First Shift',1);
/*!40000 ALTER TABLE `shifts` ENABLE KEYS */;
/*!40000 ALTER TABLE `shifts` DISABLE KEYS */
;
INSERT INTO `shifts` VALUES (1, 'First Shift', 1);
/*!40000 ALTER TABLE `shifts` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -537,26 +712,32 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `styles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `styles` (
`styleid` int(11) NOT NULL AUTO_INCREMENT,
`styletype` tinytext DEFAULT NULL,
`stylename` tinytext DEFAULT NULL,
PRIMARY KEY (`styleid`)
) ENGINE = InnoDB AUTO_INCREMENT = 3 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `styles`
--
LOCK TABLES `styles` WRITE;
/*!40000 ALTER TABLE `styles` DISABLE KEYS */;
INSERT INTO `styles` VALUES
(1,'logdisplay','classic'),
/*!40000 ALTER TABLE `styles` DISABLE KEYS */
;
INSERT INTO
`styles`
VALUES (1, 'logdisplay', 'classic'),
(2, 'logdisplay', 'clean');
/*!40000 ALTER TABLE `styles` ENABLE KEYS */;
/*!40000 ALTER TABLE `styles` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -564,25 +745,29 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `subjects`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `subjects` (
`subjectid` int(11) NOT NULL AUTO_INCREMENT,
`subjectname` tinytext DEFAULT NULL,
`status` int(11) NOT NULL,
PRIMARY KEY (`subjectid`)
) ENGINE = InnoDB AUTO_INCREMENT = 2 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `subjects`
--
LOCK TABLES `subjects` WRITE;
/*!40000 ALTER TABLE `subjects` DISABLE KEYS */;
INSERT INTO `subjects` VALUES
(1,'Miscellaneous',1);
/*!40000 ALTER TABLE `subjects` ENABLE KEYS */;
/*!40000 ALTER TABLE `subjects` DISABLE KEYS */
;
INSERT INTO `subjects` VALUES (1, 'Miscellaneous', 1);
/*!40000 ALTER TABLE `subjects` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -590,8 +775,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `tasks`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `tasks` (
`taskid` int(11) NOT NULL AUTO_INCREMENT,
`taskname` tinytext DEFAULT NULL,
@@ -605,15 +792,18 @@ CREATE TABLE `tasks` (
`active_flag` int(11) DEFAULT NULL,
PRIMARY KEY (`taskid`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `tasks`
--
LOCK TABLES `tasks` WRITE;
/*!40000 ALTER TABLE `tasks` DISABLE KEYS */;
/*!40000 ALTER TABLE `tasks` ENABLE KEYS */;
/*!40000 ALTER TABLE `tasks` DISABLE KEYS */
;
/*!40000 ALTER TABLE `tasks` ENABLE KEYS */
;
UNLOCK TABLES;
--
@@ -621,8 +811,10 @@ UNLOCK TABLES;
--
DROP TABLE IF EXISTS `techs`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
/*!40101 SET @saved_cs_client = @@character_set_client */
;
/*!40101 SET character_set_client = utf8 */
;
CREATE TABLE `techs` (
`techid` int(11) NOT NULL AUTO_INCREMENT,
`techname` tinytext DEFAULT NULL,
@@ -632,26 +824,45 @@ CREATE TABLE `techs` (
`status` int(11) NOT NULL,
PRIMARY KEY (`techid`)
) ENGINE = InnoDB AUTO_INCREMENT = 3 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET character_set_client = @saved_cs_client */
;
--
-- Dumping data for table `techs`
--
LOCK TABLES `techs` WRITE;
/*!40000 ALTER TABLE `techs` DISABLE KEYS */;
INSERT INTO `techs` VALUES
(1,'OpenLogAdmin',1,1,'$2y$10$6eCxUFNzoAkycMJpZ.zvaOfoByYhqi0YicQbut3XGc/TRxyxiUwcm',1);
/*!40000 ALTER TABLE `techs` ENABLE KEYS */;
/*!40000 ALTER TABLE `techs` DISABLE KEYS */
;
INSERT INTO
`techs`
VALUES (
1,
'OpenLogAdmin',
1,
1,
'$2y$10$6eCxUFNzoAkycMJpZ.zvaOfoByYhqi0YicQbut3XGc/TRxyxiUwcm',
1
);
/*!40000 ALTER TABLE `techs` ENABLE KEYS */
;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */
;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */
;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */
;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */
;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */
;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */
;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */
;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */
;
-- Dump completed on 2024-07-09 14:36:00

View File

@@ -6,11 +6,15 @@ ALTER TABLE configs ADD UNIQUE(confname);
-- Delete db name, user, and password configs
DELETE FROM configs where confname = "ol_dbname";
DELETE FROM configs where confname = "ol_dbuser";
DELETE FROM configs where confname = "ol_dbpass";
-- Add config option for server side error logging
INSERT IGNORE INTO configs(confname,confvalue) values('log_errors','0')
INSERT IGNORE INTO
configs (confname, confvalue)
values ('log_errors', '0')
-- Update version number
UPDATE configs SET confvalue = "5.2.1" WHERE confname = "ol_version";

View File

@@ -92,5 +92,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -76,29 +76,31 @@ if(!$print){
if ($add) {
switch ($table) {
case "techs":
if ($admin) $admin=1; else $admin=0;
if ($active) $active=1; else $active=0;
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;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
// test for matching passwords
if ($pass == $passconf) {
$passmatch=1;
$passmatch = TRUE;
$passhash = password_hash($pass, PASSWORD_DEFAULT);
} else {
$passmatch=0;
$passmatch = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;The passwords you supplied don't match.<br>";
}
if ($namesuppld && $nameunique && $passmatch) {
@@ -108,21 +110,22 @@ if(!$print){
}
break;
case "shifts":
if ($active) $active=1; else $active=0;
if ($active) $active = 1;
else $active = 0;
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Shift name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
@@ -131,21 +134,22 @@ if(!$print){
}
break;
case "subjects":
if ($active) $active=1; else $active=0;
if ($active) $active = 1;
else $active = 0;
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Subject name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
@@ -154,27 +158,28 @@ if(!$print){
}
break;
case "links":
if ($active) $active=1; else $active=0;
if ($active) $active = 1;
else $active = 0;
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Display text already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
// test for urltxt supplied
if (strlen(trim($url))) {
$urlsuppld=1;
$urlsuppld = TRUE;
} else {
$urlsuppld=0;
$urlsuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;URL text cannot be blank.<br>";
}
if ($namesuppld && $nameunique && $urlsuppld) {
@@ -188,60 +193,59 @@ if(!$print){
}
break;
case "flags":
if ($active) $active=1; else $active=0;
if ($active) $active = 1;
else $active = 0;
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Flag name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
// test for symbol supplied
if (strlen(trim($flagsym))) {
$symsuppld=1;
$symsuppld = TRUE;
} else {
$symsuppld=0;
$symsuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$symunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Flag symbol already exists.<br>";
} else {
$symunique=1;
$symunique = TRUE;
}
if ($namesuppld && $nameunique && $symsuppld && $symunique) {
// insert record in links table
// insert record in flags 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;
if ($active) $active = 1;
else $active = 0;
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Part Action name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
@@ -253,17 +257,17 @@ if(!$print){
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Banner name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
@@ -281,29 +285,31 @@ if(!$print){
if ($edit) {
switch ($table) {
case "techs":
if ($admin) $admin=1; else $admin=0;
if ($active) $active=1; else $active=0;
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;
$hasnotes = TRUE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech has notes in logbook and cannot be deleted.<br>";
} else {
$hasnotes=0;
$hasnotes = FALSE;
}
// check for maintenance forms by this tech
if (mysqli_num_rows(mysqli_query($db, "select maintformid from maintforms where mftech=\"$id\""))) {
$hasmfs=1;
$hasmfs = TRUE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech has maintenance forms and cannot be deleted.<br>";
} else {
$hasmfs=0;
$hasmfs = FALSE;
}
// check for maintenance actions by this tech
if (mysqli_num_rows(mysqli_query($db, "select maintactionid from maintactions where actiontech=\"$id\""))) {
$hasmas=1;
$hasmas = TRUE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech has maintenance actions and cannot be deleted.<br>";
} else {
$hasmas=0;
$hasmas = FALSE;
}
if (!$hasnotes && !$hasmfs && !$hasmas) {
// delete entity
@@ -314,34 +320,34 @@ if(!$print){
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
} else {
$nameunique=1;
$nameunique = TRUE;
}
// test for matching passwords
if ($pass != "password_is_unchanged") {
if ($pass == $passconf) {
$passmatch=1;
$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=0;
$passmatch = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;The passwords you supplied don't match.<br>";
}
} else {
$passmatch=1;
$passmatch = TRUE;
$updqry = "update techs set techname=\"$name\",admin=\"$admin\",shift=\"$shift\",status=\"$active\" where techid=\"$id\"";
}
if ($namesuppld && $nameunique && $passmatch) {
@@ -351,14 +357,15 @@ if(!$print){
}
break;
case "shifts":
if ($active) $active=1; else $active=0;
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;
$hasnotes = TRUE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Shift has notes in logbook and cannot be deleted.<br>";
} else {
$hasnotes=0;
$hasnotes = FALSE;
}
if (!$hasnotes) {
// delete entity
@@ -369,21 +376,21 @@ if(!$print){
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Shift name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
} else {
$nameunique=1;
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
@@ -392,14 +399,15 @@ if(!$print){
}
break;
case "subjects":
if ($active) $active=1; else $active=0;
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;
$hasnotes = TRUE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Subject has notes in logbook and cannot be deleted.<br>";
} else {
$hasnotes=0;
$hasnotes = FALSE;
}
if (!$hasnotes) {
// delete entity
@@ -410,21 +418,21 @@ if(!$print){
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Subject name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
} else {
$nameunique=1;
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
@@ -433,7 +441,8 @@ if(!$print){
}
break;
case "links":
if ($active) $active=1; else $active=0;
if ($active) $active = 1;
else $active = 0;
if ($delete) {
mysqli_query($db, "delete from links where linkid=\"$id\"");
}
@@ -441,27 +450,27 @@ if(!$print){
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Display text already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
} else {
$nameunique=1;
$nameunique = TRUE;
}
// test for urltxt supplied
if (strlen(trim($url))) {
$urlsuppld=1;
$urlsuppld = TRUE;
} else {
$urlsuppld=0;
$urlsuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;URL text cannot be blank.<br>";
}
if ($namesuppld && $nameunique && $urlsuppld) {
@@ -476,58 +485,58 @@ if(!$print){
}
break;
case "flags":
if ($active) $active=1; else $active=0;
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;
if (mysqli_num_rows(mysqli_query($db, "select id from flagmap where flagid=\"$id\""))) {
$used = TRUE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Flag is used by other tables and cannot be deleted.<br>";
} else {
$used=0;
$used = FALSE;
}
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;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Flag name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
} else {
$nameunique=1;
$nameunique = TRUE;
}
// test for symbol supplied
if (strlen(trim($flagsym))) {
$symsuppld=1;
$symsuppld = TRUE;
} else {
$symsuppld=0;
$symsuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$symunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Flag symbol already exists.<br>";
} else {
$symunique=1;
$symunique = TRUE;
}
} else {
$symunique=1;
$symunique = TRUE;
}
if ($namesuppld && $nameunique && $symsuppld && $symunique) {
// modify the table
@@ -536,14 +545,15 @@ if(!$print){
}
break;
case "logpartactions":
if ($active) $active=1; else $active=0;
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;
$hasparts = TRUE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Action is assigned to parts in logbook notes and cannot be deleted.<br>";
} else {
$hasparts=0;
$hasparts = FALSE;
}
if (!$hasparts) {
// delete entity
@@ -554,21 +564,21 @@ if(!$print){
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Part Action name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
} else {
$nameunique=1;
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
@@ -585,21 +595,21 @@ if(!$print){
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Banner name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
} else {
$nameunique=1;
$nameunique = TRUE;
}
if ($namesuppld && $nameunique) {
// modify the table
@@ -610,21 +620,24 @@ if(!$print){
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;
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;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Log name cannot be blank.<br>";
}
// test for urlchunk supplied
if (strlen(trim($display_urlchunk))) {
$chunksuppld=1;
$chunksuppld = TRUE;
} else {
$chunksuppld=0;
$chunksuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;URL chunk size cannot be blank.<br>";
}
if ($namesuppld && $chunksuppld) {
@@ -666,16 +679,16 @@ if(!$print){
}
// test for sessttl supplied
if (strlen(trim($misc_sessttl))) {
$ttlsuppld=1;
$ttlsuppld = TRUE;
} else {
$ttlsuppld=0;
$ttlsuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Session expiration time cannot be blank.<br>";
}
// test for sessdir supplied
if (strlen(trim($misc_sessdir))) {
$dirsuppld=1;
$dirsuppld = TRUE;
} else {
$dirsuppld=0;
$dirsuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Server session file directory cannot be blank.<br>";
}
if ($ttlsuppld && $dirsuppld) {
@@ -831,7 +844,8 @@ switch($table) {
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
$shiftname = dblookup($db, "shifts", "shiftid", "shiftname", $tablerow["shift"]);
printf("
printf(
"
<tr>
<td><a href=\"admin.php?table=$table&edit=1&id=%s\">%s</a></td>
<td>%s</td>
@@ -839,11 +853,13 @@ switch($table) {
<td align=\"center\">%s</td>
<td align=\"center\">%s</td>
</tr>",
$tablerow["techid"],$tablerow["techid"],
$tablerow["techid"],
$tablerow["techid"],
$tablerow["techname"],
$shiftname,
$admdef,
$statdef);
$statdef
);
}
echo "</table>";
break;
@@ -906,15 +922,18 @@ switch($table) {
} else {
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
printf("
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["shiftid"],
$tablerow["shiftid"],
$tablerow["shiftname"],
$statdef);
$statdef
);
}
echo "</table>";
break;
@@ -977,15 +996,18 @@ switch($table) {
} else {
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
printf("
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["subjectid"],
$tablerow["subjectid"],
$tablerow["subjectname"],
$statdef);
$statdef
);
}
echo "</table>";
break;
@@ -1090,17 +1112,21 @@ switch($table) {
} else {
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
printf("
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["linkid"],
$tablerow["linkid"],
$tablerow["displaytxt"],
$tablerow["urltxt"],$tablerow["urltxt"],
$statdef);
$tablerow["urltxt"],
$tablerow["urltxt"],
$statdef
);
}
echo "</table>";
break;
@@ -1187,17 +1213,21 @@ switch($table) {
} else {
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
printf("
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["flagid"],
$tablerow["flagid"],
$tablerow["flagname"],
$tablerow["flagcolor"],$tablerow["flagsym"],
$statdef);
$tablerow["flagcolor"],
$tablerow["flagsym"],
$statdef
);
}
echo "</table>";
break;
@@ -1260,15 +1290,18 @@ switch($table) {
} else {
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
printf("
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["lpactionid"],
$tablerow["lpactionid"],
$tablerow["lpactionname"],
$statdef);
$statdef
);
}
echo "</table>";
break;
@@ -1363,13 +1396,18 @@ switch($table) {
<tr><th>Banner ID</th><th>Banner</th></tr>
";
while ($tablerow = mysqli_fetch_assoc($existingdata)) {
printf("
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"]);
$tablerow["bannerid"],
$tablerow["bannerid"],
$tablerow["bannercolor"],
$tablerow["textcolor"],
$tablerow["bannername"]
);
}
echo "</table>";
break;
@@ -1586,5 +1624,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -45,11 +45,13 @@ $basic_colors=array(
"Blue" => "#0000FF",
"Navy" => "#000080",
"Fuchsia" => "#FF00FF",
"Purple" => "#800080");
"Purple" => "#800080"
);
// Generic functions
function framework($option,$htmltitle,$pagetitle,$print) {
function framework($option, $htmltitle, $pagetitle, $print)
{
// generates html code for the beginning and end of all pages
if ($option == "begin") {
// generates everything down to the first horiz rule inclusive
@@ -221,7 +223,8 @@ function framework($option,$htmltitle,$pagetitle,$print) {
}
}
function pagetable($option) {
function pagetable($option)
{
if ($option == "begin") {
echo "
<br>
@@ -240,7 +243,8 @@ function pagetable($option) {
}
}
function pageblock($block,$option) {
function pageblock($block, $option)
{
global $sbcolor;
if ($block == "left") {
if ($option == "begin") {
@@ -280,7 +284,8 @@ function pageblock($block,$option) {
}
}
function sidemenu($noprint=false) {
function sidemenu($noprint = false)
{
// Displays sidebar menu
global $db, $mbgcolor, $noprint;
$doparts = PARTS_FUNCTIONS;
@@ -359,7 +364,8 @@ function sidemenu($noprint=false) {
";
}
function banner($print) {
function banner($print)
{
// displays a banner
global $db;
$bannerid = BANNER;
@@ -385,7 +391,8 @@ function banner($print) {
}
}
function dblookup($dbhandle,$table,$in_field,$out_field,$in_data) {
function dblookup($dbhandle, $table, $in_field, $out_field, $in_data)
{
// look up a single field in a database given a value for a single field
$dbqry = mysqli_query($dbhandle, "select $out_field from $table where $in_field=\"$in_data\"");
if (mysqli_num_rows($dbqry)) {
@@ -396,7 +403,8 @@ function dblookup($dbhandle,$table,$in_field,$out_field,$in_data) {
return ($out_data);
}
function calendar($year,$month,$day,$link_url) {
function calendar($year, $month, $day, $link_url)
{
// takes a numeric year, month, day, and the basic url for the day links as arguments
// Shows a calendar with clickable dates.
// Based on an embeddable calendar by Yves Glodt.
@@ -512,7 +520,8 @@ EOT;
print "</table>\n";
}
function colorpicker($baseurl) {
function colorpicker($baseurl)
{
// takes a standard url and tacks the color number on to the end of it
// giving a palette of links
echo "
@@ -595,7 +604,8 @@ function colorpicker($baseurl) {
// Project functions
function getsetting($setting_name,$tech_id) {
function getsetting($setting_name, $tech_id)
{
// get the value of a setting for a tech
global $db;
$confinfo = mysqli_fetch_assoc(mysqli_query($db, "select confid,confvalue from configs where confname=\"$setting_name\""));
@@ -617,7 +627,8 @@ function getsetting($setting_name,$tech_id) {
return $result;
}
function putsetting($setting_name,$setting_value,$tech_id) {
function putsetting($setting_name, $setting_value, $tech_id)
{
// set the value of a setting for a tech
global $db;
$confinfo = mysqli_fetch_assoc(mysqli_query($db, "select confid,confvalue from configs where confname=\"$setting_name\""));
@@ -637,7 +648,8 @@ function putsetting($setting_name,$setting_value,$tech_id) {
}
}
function islink($il_note) {
function islink($il_note)
{
// takes a noteid number as an argument
// determines if the argument is a link in a reference chain
// returns 1 if note is a link, 0 if not
@@ -651,7 +663,8 @@ function islink($il_note) {
}
function generate_chain($chainlink) {
function generate_chain($chainlink)
{
// generate a reference chain
// takes a single parameter, a noteid
// finds all notes that are members of a chain containing the supplied noteid
@@ -693,7 +706,8 @@ function generate_chain($chainlink) {
return ($chainarray);
}
function convertweblinks($rawstring) {
function convertweblinks($rawstring)
{
// takes a string, finds urls, and returns the string with urls converted to clickable links
$urlchunksize = URL_CHUNK_SIZE;
// define regex pattern for urls
@@ -712,7 +726,8 @@ function convertweblinks($rawstring) {
return $rawstring;
}
function showlinklist($print) {
function showlinklist($print)
{
global $db;
$linkresult = mysqli_query($db, "select linkid from links where status=\"1\"");
if (mysqli_num_rows($linkresult) && !$print) {
@@ -726,7 +741,8 @@ function showlinklist($print) {
}
}
function nag($tech_id) {
function nag($tech_id)
{
// nags the user if something is pending
global $db, $today;
// maintenance forms
@@ -751,7 +767,8 @@ function nag($tech_id) {
}
}
function get_part_data($partinputdata) {
function get_part_data($partinputdata)
{
// given an associative array of partid, uid, partnum, sernum,
// return an associative array of
// partid, uid, partnum, sernum, partname, result
@@ -821,7 +838,8 @@ function get_part_data($partinputdata) {
return $partdata;
}
function get_upcoming_events() {
function get_upcoming_events()
{
// build array of upcoming events
// takes no arguments
// returns an array containing arrays of upcoming event data
@@ -910,7 +928,8 @@ function get_upcoming_events() {
return $ucevents;
}
function format_message($msgtype,$msgtxt) {
function format_message($msgtype, $msgtxt)
{
// displays a formatted message
// $msgtype is 0 for success or anything else for failure
// $msgtxt is the string to display
@@ -930,7 +949,8 @@ function format_message($msgtype,$msgtxt) {
";
}
function templateselect($techid,$operation) {
function templateselect($techid, $operation)
{
// Displays a line enabling selection of a user or global template
// $techid is the id number of the current tech
// $operation is one of "add" "edit" "delete"
@@ -980,4 +1000,3 @@ function templateselect($techid,$operation) {
</form>
";
}
?>

View File

@@ -380,5 +380,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -239,7 +239,6 @@ if ($add) {
if ($mfreqs[$plidx] == "on") {
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$newnoteid\")");
}
} else {
// no part info was entered
}
@@ -401,7 +400,6 @@ if ($edit) {
if ($mfreqs[$plidx] == "on") {
mysqli_query($db, "insert into maintforms(mfdate,mftech,mfpart,pending,lognoteid) values(\"$date\",\"$techid\",\"$lpid\",1,\"$noteid\")");
}
} else {
// no part info was entered
;
@@ -520,7 +518,8 @@ if ($isadmin) {
<td><b>Tech: </b>&nbsp;
<select name=\"efftechid\">
";
if ($techalpha) $torder="techname"; else $torder="techid";
if ($techalpha) $torder = "techname";
else $torder = "techid";
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
while ($techitem = mysqli_fetch_assoc($techrow)) {
if ($techitem["status"] == 1) {
@@ -563,7 +562,8 @@ echo "
<td colspan=\"2\"><b>Subject: </b>&nbsp;
<select name=\"subject\">
";
if ($subjalpha) $sorder="subjectname"; else $sorder="subjectid";
if ($subjalpha) $sorder = "subjectname";
else $sorder = "subjectid";
$subjrow = mysqli_query($db, "select * from subjects order by $sorder asc");
while ($subjitem = mysqli_fetch_assoc($subjrow)) {
if ($subjitem["status"] == 1) {
@@ -618,13 +618,23 @@ $flagcount=1;
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
if (in_array($flagcheckbox["flagid"], $theseflags)) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
printf(
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],
$flagcheckbox["flagcolor"],
$flagcheckbox["flagname"],
$flagcheckbox["flagsym"]
);
} else {
$flagid = $flagcheckbox["flagid"];
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
printf(
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],
$flagcheckbox["flagcolor"],
$flagcheckbox["flagname"],
$flagcheckbox["flagsym"]
);
}
}
if ($flagcount < $flagsperline) {
@@ -786,5 +796,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -58,7 +58,6 @@ if ($login) {
while ($admintech = mysqli_fetch_row($adminqry)[0]) {
echo "$admintech <br>";
}
}
} else if ($cancel) {
echo "
@@ -72,7 +71,8 @@ if ($login) {
<b>Tech: </b>&nbsp;
<select name=\"tech\">
";
if ($techalpha) $torder="techname"; else $torder="techid";
if ($techalpha) $torder = "techname";
else $torder = "techid";
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
while ($techitem = mysqli_fetch_assoc($techrow)) {
if ($techitem["status"] == 1) {
@@ -98,5 +98,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -32,7 +32,8 @@ if ($print) {
if ($tgt_date == "") $tgt_date = $today;
// define shifttable_classic function
function shifttable_classic($shift, $tgt_date, $db) {
function shifttable_classic($shift, $tgt_date, $db)
{
// convert the shift number to a name for display
$doparts = PARTS_FUNCTIONS;
$showtime = SHOW_TS;
@@ -89,7 +90,9 @@ function shifttable_classic($shift, $tgt_date, $db) {
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],$tablerow["time"],
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tablerow["time"],
$tname,
$subjname,
$fmtnote,
@@ -104,7 +107,8 @@ function shifttable_classic($shift, $tgt_date, $db) {
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tname,
$subjname,
$fmtnote,
@@ -121,7 +125,8 @@ function shifttable_classic($shift, $tgt_date, $db) {
}
// define the shifttable_clean function
function shifttable_clean($shift, $tgt_date, $db) {
function shifttable_clean($shift, $tgt_date, $db)
{
// convert the shift number to a name for display
$doparts = PARTS_FUNCTIONS;
$showtime = SHOW_TS;
@@ -177,7 +182,8 @@ function shifttable_clean($shift, $tgt_date, $db) {
%s</b>
<br>%s<br>
<hr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tablerow["time"],
$tname,
$subjname,
@@ -192,7 +198,8 @@ function shifttable_clean($shift, $tgt_date, $db) {
%s</b>
<br>%s<br>
<hr>\n",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tname,
$subjname,
$refs,
@@ -249,5 +256,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -29,7 +29,8 @@ if ($print) {
}
// define pendtable function
function pendtable($tech_id, $db) {
function pendtable($tech_id, $db)
{
$uidtext = UID_TEXT;
// print section header
if ($tech_id) {
@@ -89,14 +90,16 @@ function pendtable($tech_id, $db) {
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">$notetag</td>
</tr>",
$pendrow["maintformid"],$pendrow["maintformid"],
$pendrow["maintformid"],
$pendrow["maintformid"],
$pendrow["mfdate"],
$tname,
$uid,
$partno,
$serno,
$partname,
$noteidval,$noteidval
$noteidval,
$noteidval
);
} else {
printf(
@@ -109,13 +112,15 @@ function pendtable($tech_id, $db) {
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">$notetag</td>
</tr>",
$pendrow["maintformid"],$pendrow["maintformid"],
$pendrow["maintformid"],
$pendrow["maintformid"],
$pendrow["mfdate"],
$uid,
$partno,
$serno,
$partname,
$noteidval,$noteidval
$noteidval,
$noteidval
);
}
}
@@ -125,7 +130,8 @@ function pendtable($tech_id, $db) {
}
// define histtable function
function histtable($hist_days,$db) {
function histtable($hist_days, $db)
{
$uidtext = UID_TEXT;
$dayopts = array(30, 90, 180, 365);
// print section header
@@ -187,14 +193,16 @@ function histtable($hist_days,$db) {
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">$notetag</td>
</tr>",
$histrow["maintformid"],$histrow["maintformid"],
$histrow["maintformid"],
$histrow["maintformid"],
$histrow["mfdate"],
$tname,
$uid,
$partno,
$serno,
$partname,
$noteidval,$noteidval
$noteidval,
$noteidval
);
}
echo "
@@ -227,5 +235,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -17,14 +17,16 @@ if (!$_SESSION['login'] && ($_REQUEST['mfadd'] || $_REQUEST['actionadd'])) {
$loggedinas = $_SESSION['login'];
$isadmin = dblookup($db, "techs", "techid", "admin", $loggedinas);
function getmfdata($maintformid) {
function getmfdata($maintformid)
{
// pull maintenance form data from maintforms table
global $db;
$mfdata = mysqli_fetch_assoc(mysqli_query($db, "select * from maintforms where maintformid=\"$maintformid\""));
return $mfdata;
}
function getactiondata($maintactionid) {
function getactiondata($maintactionid)
{
// pull maintenance action data from maintactions table
global $db;
$actiondata = mysqli_fetch_assoc(mysqli_query($db, "select * from maintactions where maintactionid=\"$maintactionid\""));
@@ -314,7 +316,8 @@ if (($mfedit || $actionadd || $actionedit) && ! ($mfsubmit || $actionaddsubmit |
$sernum = $partinfo['sernum'];
$partname = $partinfo['partname'];
$pluresult = $partinfo['result'];
if ($pluresult==2) $pdatamismatch=TRUE; else $pdatamismatch=FALSE;
if ($pluresult == 2) $pdatamismatch = TRUE;
else $pdatamismatch = FALSE;
}
$techname = dblookup($db, "techs", "techid", "techname", $mftech);
@@ -481,13 +484,23 @@ if ($printfmt) {
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
//if ($theseflags[0]=="") $theseflags=[];
if (in_array($flagcheckbox["flagid"], $theseflags)) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
printf(
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],
$flagcheckbox["flagcolor"],
$flagcheckbox["flagname"],
$flagcheckbox["flagsym"]
);
} else {
$flagid = $flagcheckbox["flagid"];
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
printf(
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],
$flagcheckbox["flagcolor"],
$flagcheckbox["flagname"],
$flagcheckbox["flagsym"]
);
}
}
if ($flagcount < $flagsperline) {
@@ -649,5 +662,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -172,5 +172,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -10,9 +10,9 @@
include("functions.php");
if (isset($_SESSION['login'])) {
$loggedin=1;
$loggedin = TRUE;
} else {
unset($loggedin);
$loggedin = FALSE;
}
$print = $_REQUEST['print'] ?? NULL;
@@ -79,7 +79,8 @@ while ($partline=mysqli_fetch_assoc($partqry)) {
$pluidtxt = $partline['uid'];
}
if ($loggedin) {
printf("
printf(
"
<tr>
<td>
<a href=\"partentry.php?edit=1&partid=%s\" title=\"Edit this part\">%s</a>
@@ -87,13 +88,15 @@ while ($partline=mysqli_fetch_assoc($partqry)) {
<td>%s</td>
<td>%s</td>
<td>%s</td>",
$partline['partid'],$pluidtxt,
$partline['partid'],
$pluidtxt,
$partline['partnum'],
$partline['sernum'],
$partline['partname']
);
} else {
printf("
printf(
"
<tr>
<td>%s</td>
<td>%s</td>
@@ -119,5 +122,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -54,34 +54,34 @@ if(!$print){
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld=1;
$namesuppld = TRUE;
} else {
$namesuppld=0;
$namesuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;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!=\"$techid\""))) {
if (mysqli_num_rows(mysqli_query($db, "select techid from techs where techname=\"$name\""))) {
$nameunique=0;
$nameunique = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech name already exists.<br>";
} else {
$nameunique=1;
$nameunique = TRUE;
}
} else {
$nameunique=1;
$nameunique = TRUE;
}
// test for matching passwords
if ($pass != "password_is_unchanged") {
if ($pass == $passconf) {
$passmatch=1;
$passmatch = TRUE;
$passhash = password_hash($pass, PASSWORD_DEFAULT);
$namepassupdqry = ("update techs set techname=\"$name\",techpass=\"$passhash\" where techid=\"$techid\"");
} else {
$passmatch=0;
$passmatch = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;The passwords you supplied don't match.<br>";
}
} else {
$passmatch=1;
$passmatch = TRUE;
$namepassupdqry = "update techs set techname=\"$name\" where techid=\"$techid\"";
}
if ($namesuppld && $nameunique && $passmatch) {
@@ -91,14 +91,17 @@ if(!$print){
}
if ($updatedisplay) {
// display settings
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;
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 urlchunk supplied
if (strlen(trim($display_urlchunk))) {
$chunksuppld=1;
$chunksuppld = TRUE;
} else {
$chunksuppld=0;
$chunksuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;URL chunk size cannot be blank.<br>";
}
if ($chunksuppld) {
@@ -294,5 +297,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -10,7 +10,7 @@
include("functions.php");
$print = $_REQUEST['print'] ?? "";
$chainnote=$_REQUEST['chainnote'];
$chainnote = $_REQUEST['chainnote'] ?? NULL;
$logname = LOG_NAME;
@@ -71,7 +71,8 @@ while($mptr<count($master)) {
}
if ($flagstring) $fmtnote = $fmtnote . "<br>" . $flagstring;
printf("
printf(
"
<tr>
<td><a href=\"logentry.php?edit=1&noteid=%s\">%s</a></td>
<td>%s &#47; %s</td>
@@ -81,13 +82,16 @@ while($mptr<count($master)) {
<td>%s</td>
<td>%s</td>
</tr>",
$tablerow["lognoteid"],$tablerow["lognoteid"],
$tablerow["date"],$tablerow["time"],
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tablerow["date"],
$tablerow["time"],
$shname,
$tname,
$subjname,
$fmtnote,
$refs);
$refs
);
} else {
printf("<tr><td colspan=\"7\"><font color=\"red\">Note Id <b> %s</b> has been deleted and cannot be displayed.</font></td></tr>\n", $master[$mptr]);
}
@@ -99,5 +103,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -509,7 +509,8 @@ if ($action) {
} else {
$tasktitle = "Repeat every $taskdata_frequency $taskdata_period";
}
printf("
printf(
"
<tr>
<td><a href=\"schedmaint.php?schedule=1&edit=1&id=%s\">%s</a></td>
<td title=\"%s\">%s</td>
@@ -520,14 +521,17 @@ if ($action) {
<td>%s</td>
<td align=\"center\">%s</td>
</tr>",
$eventid,$eventid,
$tasktitle,$taskdata_taskname,
$eventid,
$eventid,
$tasktitle,
$taskdata_taskname,
$devicedata_devicename,
$start_date,
$last_date,
$deferredflag,
$deferred_date,
$statdef);
$statdef
);
}
echo "</table>";
} else if ($tasks) {
@@ -650,7 +654,8 @@ if ($action) {
} else {
$wdoflag = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
printf("
printf(
"
<tr>
<td><a href=\"schedmaint.php?tasks=1&edit=1&id=%s\">%s</a></td>
<td>%s</td>
@@ -660,16 +665,17 @@ if ($action) {
<td>%s</td>
<td align=\"center\">%s</td>
</tr>",
$taskid,$taskname,
$taskid,
$taskname,
$taskdesc,
$rptstrg,
$duecalc,
$wdoflag,
$refstrg,
$statdef);
$statdef
);
}
echo "</table>";
} else if ($devices) {
// manage devices
if ($edit) {
@@ -735,7 +741,8 @@ if ($action) {
} else {
$memberdef = "<input type=\"checkbox\" name=\"members[]\" value=\"$gtbl_deviceid\">";
}
printf("
printf(
"
<tr>
<td>%s</td>
<td>%s</td>
@@ -743,7 +750,8 @@ if ($action) {
</tr>",
$gtbl_devicename,
$gtbl_devicedesc,
$memberdef);
$memberdef
);
}
echo "</table><br>";
}
@@ -774,7 +782,8 @@ if ($action) {
} else {
$statdef = "<img src=\"icons/cross.png\" title=\"inactive\" alt=\"inactive\">";
}
printf("
printf(
"
<tr>
<td><a href=\"schedmaint.php?devices=1&edit=1&id=%s\">%s</a></td>
<td>%s</td>
@@ -782,18 +791,23 @@ if ($action) {
<td align=\"center\">%s</td>
<td align=\"center\">%s</td>
</tr>",
$deviceid,$deviceid,
$deviceid,
$deviceid,
$devicename,
$devicedesc,
$groupdef,
$statdef);
$statdef
);
}
echo "</table>";
} else {
$ucevents = get_upcoming_events();
// sort the upcoming events
function uc_cmp($a,$b) { return strcmp($a["duedate"], $b["duedate"]); }
function uc_cmp($a, $b)
{
return strcmp($a["duedate"], $b["duedate"]);
}
uasort($ucevents, 'uc_cmp');
// show upcoming events table
@@ -806,16 +820,20 @@ if ($action) {
";
foreach ($ucevents as $ucline) {
extract($ucline);
printf("
printf(
"
<tr>
<td><a href=\"schedmaint.php?action=1&id=%s\" title=\"Click to complete or defer this scheduled maintenance event\">%s</a></td>
<td><font title=\"%s\">%s</font></td>
<td><font title=\"%s\">%s</font></td>
<td>%s</td>
</tr>",
$eventdata_eventid,$duedatestrg,
$devicedata_devicedesc,$devicedata_devicename,
$taskdata_taskdesc,$taskdata_taskname,
$eventdata_eventid,
$duedatestrg,
$devicedata_devicedesc,
$devicedata_devicename,
$taskdata_taskdesc,
$taskdata_taskname,
$lastdatestrg
);
}
@@ -865,16 +883,20 @@ if ($action) {
";
foreach ($defevents as $defline) {
extract($defline);
printf("
printf(
"
<tr>
<td><a href=\"schedmaint.php?action=1&id=%s\" title=\"Click to complete or defer this scheduled maintenance event\"><font color=\"#FFA500\">%s</font></a></td>
<td><font title=\"%s\">%s</font></td>
<td><font title=\"%s\">%s</font></td>
<td>%s</td>
</tr>",
$def_eventid,$def_deferred_date,
$devicedata_devicedesc,$devicedata_devicename,
$taskdata_taskdesc,$taskdata_taskname,
$def_eventid,
$def_deferred_date,
$devicedata_devicedesc,
$devicedata_devicename,
$taskdata_taskdesc,
$taskdata_taskname,
$lastdatestrg
);
}
@@ -890,5 +912,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -9,12 +9,12 @@
include("functions.php");
$noprint=1;
$noprint = TRUE;
if (isset($_SESSION['login'])) {
$loggedin=1;
$loggedin = TRUE;
} else {
unset($loggedin);
$loggedin = FALSE;
}
$print = $_REQUEST['print'] ?? NULL;
@@ -390,21 +390,36 @@ if(!$print){
pageblock("right", "begin");
banner($print);
// display the form
if ($srchnoteid) $noteidval=$srchnoteid; else $noteidval="any";
if ($srchmfid) $mfidval=$srchmfid; else $mfidval="any";
if ($srchbdate) $bdateval=$srchbdate; else $bdateval=$mindate;
if ($srchedate) $edateval=$srchedate; else $edateval=$maxdate;
if ($srchshift) $shiftval=$srchshift; else $shiftval=0;
if ($srchtech) $techval=$srchtech; else $techval=0;
if ($srchsubj) $subjval=$srchsubj; else $subjval=0;
if ($srchtext) $textval=$srchtext; else $textval="";
if ($srchuid) $uidval=$srchuid; else $uidval="any";
if ($srchpn) $pnval=$srchpn; else $pnval="any";
if ($srchsn) $snval=$srchsn; else $snval="any";
if ($srchpname) $pnameval=$srchpname; else $pnameval="any";
if ($srchploc) $plocval=$srchploc; else $plocval="any";
if ($srchnha) $nhaval=$srchnha; else $nhaval="any";
if ($srchrepord) $repordval=$srchrepord; else $repordval="any";
if ($srchnoteid) $noteidval = $srchnoteid;
else $noteidval = "any";
if ($srchmfid) $mfidval = $srchmfid;
else $mfidval = "any";
if ($srchbdate) $bdateval = $srchbdate;
else $bdateval = $mindate;
if ($srchedate) $edateval = $srchedate;
else $edateval = $maxdate;
if ($srchshift) $shiftval = $srchshift;
else $shiftval = 0;
if ($srchtech) $techval = $srchtech;
else $techval = 0;
if ($srchsubj) $subjval = $srchsubj;
else $subjval = 0;
if ($srchtext) $textval = $srchtext;
else $textval = "";
if ($srchuid) $uidval = $srchuid;
else $uidval = "any";
if ($srchpn) $pnval = $srchpn;
else $pnval = "any";
if ($srchsn) $snval = $srchsn;
else $snval = "any";
if ($srchpname) $pnameval = $srchpname;
else $pnameval = "any";
if ($srchploc) $plocval = $srchploc;
else $plocval = "any";
if ($srchnha) $nhaval = $srchnha;
else $nhaval = "any";
if ($srchrepord) $repordval = $srchrepord;
else $repordval = "any";
if (!$print) {
echo "
@@ -439,7 +454,8 @@ if (!$print) {
} else {
echo "<option value=\"0\">any</option>";
}
if ($techalpha) $torder="techname"; else $torder="techid";
if ($techalpha) $torder = "techname";
else $torder = "techid";
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
while ($techitem = mysqli_fetch_assoc($techrow)) {
if ($techitem['techid'] == $techval) {
@@ -457,7 +473,8 @@ if (!$print) {
} else {
echo "<option value=\"0\">any</option>";
}
if ($subjalpha) $sorder="subjectname"; else $sorder="subjectid";
if ($subjalpha) $sorder = "subjectname";
else $sorder = "subjectid";
$subjrow = mysqli_query($db, "select * from subjects order by $sorder asc");
while ($subjitem = mysqli_fetch_assoc($subjrow)) {
if ($subjitem['subjectid'] == $subjval) {
@@ -632,8 +649,11 @@ if (!$print) {
if ($srchflags) {
if ($srchflags[0] == "") $srchflags = [];
if (in_array($flagcheckbox["flagid"], $srchflags)) {
printf("<font color=\"%s\">%s</font>",
$flagcheckbox["flagcolor"],$flagcheckbox["flagsym"]);
printf(
"<font color=\"%s\">%s</font>",
$flagcheckbox["flagcolor"],
$flagcheckbox["flagsym"]
);
}
}
if ($flagcount < $flagsperline) {
@@ -711,7 +731,8 @@ if ($search) {
$logfmtnote = $logfmtnote . "<br>";
}
printf("<tr>
printf(
"<tr>
<td valign=\"top\"><a href=logentry.php?edit=1&noteid=%s>%s</a></td>
<td valign=\"top\">%s&nbsp;&#047;&nbsp;%s</td>
<td valign=\"top\">%s</td>
@@ -720,13 +741,16 @@ if ($search) {
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>",
$logtablerow['lognoteid'],$logtablerow['lognoteid'],
$logtablerow['date'],$logtablerow['time'],
$logtablerow['lognoteid'],
$logtablerow['lognoteid'],
$logtablerow['date'],
$logtablerow['time'],
$logshname,
$logtname,
$logsubjname,
$logfmtnote,
$logrefs);
$logrefs
);
}
echo "</table><br><hr>";
} else {
@@ -782,14 +806,16 @@ if ($search) {
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">$mfnotetag</td>
</tr>",
$mfrow["maintformid"],$mfrow["maintformid"],
$mfrow["maintformid"],
$mfrow["maintformid"],
$mfrow["mfdate"],
$mftname,
$mfuid,
$mfpartno,
$mfserno,
$mfpartname,
$mfnoteidval,$mfnoteidval
$mfnoteidval,
$mfnoteidval
);
}
echo "</table><br><hr>";
@@ -815,7 +841,8 @@ if ($search) {
";
while ($partrow = mysqli_fetch_assoc($prowqry)) {
if ($loggedin) {
printf("
printf(
"
<tr>
<td>
<a href=\"partentry.php?edit=1&partid=%s\"><img src=\"icons/notebook--pencil.png\" border=\"0\" title=\"Edit this part\" alt=\"Edit this part\"></a>
@@ -831,7 +858,8 @@ if ($search) {
$partrow['partname']
);
} else {
printf("
printf(
"
<tr>
<td>
<img src=\"icons/notebook--pencil.png\" border=\"0\" title=\"You must be logged in to edit a part\" alt=\"You must be logged in to edit a part\">
@@ -864,5 +892,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -61,5 +61,3 @@ if ($logerrors==1) {
} else {
error_reporting(0);
}
?>

View File

@@ -58,7 +58,8 @@ if ($isadmin) {
// var_dump($_REQUEST);
function templatetable($db,$techid,$user) {
function templatetable($db, $techid, $user)
{
// Show template table
$isadmin = dblookup($db, "techs", "techid", "admin", $techid);
$templatequery = mysqli_query($db, "select * from notetemplates where tech=\"$user\" order by templatename asc");
@@ -393,7 +394,8 @@ if ($operation=="delete") {
} else {
echo "<option value=\"0\">--Global Template--</option>";
}
if ($techalpha) $torder="techname"; else $torder="techid";
if ($techalpha) $torder = "techname";
else $torder = "techid";
$techrow = mysqli_query($db, "select * from techs order by $torder asc");
while ($techitem = mysqli_fetch_assoc($techrow)) {
if ($techitem["techid"] == $filltech) {
@@ -431,7 +433,8 @@ if ($operation=="delete") {
<td><b>Subject: </b>&nbsp;
<select name=\"subject\">
";
if ($subjalpha) $sorder="subjectname"; else $sorder="subjectid";
if ($subjalpha) $sorder = "subjectname";
else $sorder = "subjectid";
$subjrow = mysqli_query($db, "select * from subjects order by $sorder asc");
while ($subjitem = mysqli_fetch_assoc($subjrow)) {
if ($subjitem["status"] == 1) {
@@ -474,13 +477,23 @@ if ($operation=="delete") {
// display checkboxes for all the flags, selecting the ones that are set for this template
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
if ($operation == "edit" && in_array($flagcheckbox["flagid"], $theseflags)) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
printf(
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\" checked><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],
$flagcheckbox["flagcolor"],
$flagcheckbox["flagname"],
$flagcheckbox["flagsym"]
);
} else {
$flagid = $flagcheckbox["flagid"];
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
printf("<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
printf(
"<input type=\"checkbox\" name=\"flags[]\" value=\"%s\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],
$flagcheckbox["flagcolor"],
$flagcheckbox["flagname"],
$flagcheckbox["flagsym"]
);
}
}
if ($flagcount < $flagsperline) {
@@ -550,5 +563,3 @@ pageblock("right","end");
pagetable("end");
framework("end", "", "", $print);
?>

View File

@@ -2,7 +2,7 @@
# install.sh
# OpenLog Online Logbook
# Copyright (C) 2025 Rod Wright
# Copyright (C) 2026 Rod Wright
# SPDX-License-Identifier: GPL-2.0