6 Commits

131 changed files with 44534 additions and 1890 deletions

294
distfiles-old/CHANGELOG Normal file
View File

@@ -0,0 +1,294 @@
CHANGELOG
OpenLog Online Logbook
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
1.0 - 2000-??-??
- Initial release.
2.0 - 2001-??-??
- Added referencing capability
- Various bugfixes
2.2 - 2002-??-??
- Added day navigation links at top of screen to replace forward and
back buttons.
- Added printer friendly functionality.
- Various bugfixes.
3.0 - 2005-03-12
- Total redesign of pages.
- Replaced day navigation links with clickable calendar.
- Improved search page by putting the search criteria and results on
the same page.
- Made various notices and error messages consistent.
- Simplified reference chain display on main page by removing
referenced note numbers and adding a magnifying glass icon
that takes you to the reference chain page. Referenced note
numbers still available on reference chain page.
- Added a plus sign icon to the note on the main page and reference
chain page so that you don't have to go to the edit page to
add a note referencing the current note.
- Many, many, many code cleanups.
- Now works with standard php configuration. No longer requires
register_globals to be turned on.
- simplified the printer friendly functionality.
- Added link management functionality.
3.1 - 2005-03-28
- Fixed bug where the footer message was not being displayed.
- Fixed bug that caused the contents of some fields in tables to be
halfway down the field (and possibly off-screen and not
visible) when the contents of other fields were very long.
- Fixed bug where links show up on the printer friendly main page.
3.2 - 2005-03-30
- Fixed inconsistent prompt text on search page.
- Fixed problem of whitespace characters at beginning and end of
search text being included in the where clause resulting in
no results returned.
- Fixed incorrect version number on about page.
- Moved openlog.sql into the utilities directory with all the other
one-time use stuff. Updated docs accordingly.
3.3 - 2005-06-02
- Fixed printer friendly pages so they do not show the navigation and
forms. This prevents the note column from being compressed to
just a few characters wide when printed.
3.4 - 2007-01-04
- Fixed bug where items in dropdown lists were displayed in some
random order. Now they are shown in the order they were added
on the administration page.
- Fixed bug where the reference links on the reference chain page
didn't work. They took you to the search page, which was
redundant and produced "no notes match criteria" message.
Links in references column now take you to the edit page
for the linked note.
- Added a security classification banner function that displays an
appropriately colored and labeled banner at the top and
bottom of all pages that display anything from the database.
Banner is controlled in the config.php file.
3.5 - 2008-01-02
- Added a time field to the database. It works like the date, i.e.,
it automatically fills with the current time of the database
server, but may be changed on the add entry and edit pages if
desired. YOU MUST RUN THE dbupdate-3.5.sql UTILITY AS
DESCRIBED IN THE UPGRADE FILE OR YOUR
PAGES WILL NOT DISPLAY CORRECTLY! Your database will not be
damaged if you omit this step, but the logbook will not be
much use. If you are installing OpenLog for the first time,
you will not need to run the update utility, since the initial
database creation takes care of it.
3.6 - 2008-01-30
- The timestamp field added in version 3.5 was not universally popular.
Added an option to the config file to select whether to show it
on the main page (it will still be inserted into the database
and remain editable).
- Added a configurable logbook name. You can now set the name of the
logbook in the config file so if you are running multiple
logbooks, you'll know which one you're looking at.
- Added options in the config file to determine the displayed order
of employee names and subject names.
4.0 - 2008-02-20
- Moved all configuration from a file (config.php) to a table in the
database. Added a configuration page so that all configuration
can be done in the web browser.
- Techs can now tell OpenLog to remember who they are using a browser
cookie. Techs can set their current shift, and the Add Entry
page will preselect the tech and shift. Also added a
customization page so that each tech can have their own color
scheme, etc.
- Created an installation shell script that automates the task of
getting the distribution in the right place in the filesystem
with the correct file ownership.
- Created a php installation/upgrade routine that detects whether the
distribution has been configured and prompts for the database
name/logbook name etc. OpenLog either sets up a new
installation or upgrades an existing configuration without the
user having to deal with command prompt stuff.
4.1 - 2008-02-26
- Fixed copyright dates in all files.
- Fixed bug where backslashes appeared in notes on systems where
magic_quotes_gpc was turned on.
- Fixed bug where custom tech name was inserted on new or edited
notes even when another tech name was selected.
- Fixed install.sh script to not show hostname in url in final
instructions since it was not reliable.
- Fixed bug where timestamps for notes entered for past or future
dates were set to the time the note was entered. This made
notes entered last night appear after notes made this morning
on the main page.
- Trimmed all text files (including this one;-) to 80 columns so they
wouldn't produce wierd line spacing on terminal displays.
4.2 - 2008-03-08
- Fixed About page to accurately describe configuration changes.
- URLs entered as http://domain.com are automatically converted to
clickable links in the note text.
- Added configuration setting to control the size of chunks to break
long url strings into, preventing a long url from distorting
the page.
- Reversed the chronological order of the CHANGELOG file so the
newest stuff is at the top.
4.3 - 2013-03-15
- Fixed install.sh script to make it detect the httpd process name
and user instead of using hardcoded values.
5.0 - 2015-08-10
- Reworked install.sh script to remove web server version specific
defaults.
- Added install.bat script to handle installation on Windows servers.
- Added PHP sessions to enable tech logins and privilege separation.
- Added maintenance form and parts tracking functionality.
- Added the ability to set flags for notes and maintenance forms.
- Improved search capability.
5.1 - 2015-11-17
- Added scheduled maintenance functionality.
5.1.1 - 2016-01-28
- Various bugfixes
5.2.0 - 2016-10-18
- Use jquery-ui for calendaring functions
- Replaced deprecated php functions split() and ereg*() with
explode() and preg*() functions to make OpenLog compatible
with php 7.
- Added a field to the logentry page to allow the user to insert a
properly formatted URL into a note.
5.2.1 - 2024-07-09
- Removed install.php and moved installation/upgrade process to
install.sh shell script with default database files and a db.php
template file.
- Various compatibility fixes to make OpenLog work with php-8.x.
5.2.2 - 2025-02-26
- Removed corrupt line from the beginning of database-initial.sql
that caused the population of the database to fail during
install. Upgrades not affected.
- Changed functions.php so that the application uses a sans-serif
font by default.
5.2.3 - 2025-12-01
- In lognotes.php, get today's data from the database instead of the
php date() function, since that had returned tomorrow's date in
some instances.
- In logentry.php, only run parts code if parts functionality is
enabled. This prevents a fatal php error that occurred when
trying to get the max value of an empty array.
- In settings.php, the LOG_ERRORS constant was not being read
properly. Assigned its value to a variable to be used in the if
statement.
5.2.4 - 2025-12-02
- In logentry.php, the parts bug from 5.2.2 was only partially
fixed. Made the corrections to the edit code as well as the
new entry.
- In logentry.php, the default times for notes entered using dates
other than today's date contained a trailing coln that mysql
didn't like. Removed trailing colons.
- Cleaned up the REQUEST importation in multiple files to default to
NULL values for parameters not supplied to prevent warning
messages in the logs.
- In the install.sh script, removed the prompts for optional package
installation. Code is still there, just turned off by default.
5.2.4.1 - 2025-12-10
- Fixed bug in search.php where "Print search results" link on the
search results page resulted in the printable page not showing
any results. This was due to a php fatal error caused by passing
a non-array as the second argument of the php in_array()
function.
5.2.4.2 - 2025-12-11
- Fixed other bugs caused by passing a non-array as the second
argument of the php in_array() function in various files.
5.2.4.3 - 2025-12-16
- Various problems were noted resulting from php's use of UTC as the
default timezone. Now, on installation or upgrade, the installer
gets the correct timezone from the system and sets it as a php
option in a .htaccess file in the install location. This solves
multiple problems and allows today's date and the current time
to be determined from the php date() function as part of the
settings.php once per page load instead of having to query the
database multiple times per page load. Also added the option to
allow apache to read the .htaccess file to the <Directory>
section of the application's conf file in
/etc/apache2/conf-available
- Renamed the installer's db.php_update.sh script to files-update.sh
to reflect that it now can do more than just modify the db.php
file. For this version, it's used to modify the apache conf file
mentioned earlier.
- Completely removed the optional package prompting/installation
code from install.sh. This is best done using separate
installers.
5.2.4.4 - 2025-12-19
- Fixed bugs that caused crashes on the Scheduled Maintenance page
that were caused by more strict behavior of php regarding mysql
queries.
- Fixed bug where some functions defined in functions.php were not
treating the $today variable as global.
- In install.php, if a previous installation was found, make upgrade
the default choice.
5.2.5 - 2026-02-10
This is just a version number bump to get on a major-minor-patch
scheme. There are no code changes for this release.
5.3.0 - 2026-02-20
- Moved the template Create/Copy/Edit/Delete/Rename functionality to
its own page to make it less confusing and to fix some strange
behavior.
- Added global templates which can be used by anyone but can only be
created, modified, or deleted by administrators. This makes it
easier to employ standardized templates.
- Changed the character encoding of the database to utf8mb4 to enable
using emojis in text fields.
- Changed the insert link functionality. There are now two fields, link
text, and URL. The full URL string will now not be displayed in the
note, since it frequently was too long and deformed the table,
causing the user to have to scroll right to see the entire note. If
a URL is entered in the URL field and no link text is entered in the
link text field, the link will show up as just the last part of the
URL. For example, "http://somewhere.com/myfile.pdf" will show as
"myfile.pdf" in the note text. If text is entered in the link text
field, that is what will show as the clickable link in the note text.
NOTE: URLs in previously entered notes will not automatically be
converted.
- Changed the flag handling code to no longer dynamically create flag_
tables in the database to track assignments. This is now done using
a flagmap table.
NOTE: The database will be modified to support this and the
importation of the previous data will take some time during
installation.
- References will no longer be stored in the lognotes table with the note.
There is now a reflinks table that stores the link information.
NOTE: The database will be modified to support this and the
importation of the previous data will take some time during
installation.
- Various code cleanups to prevent php warnings in the logs if logging
is enabled.
- Validate all date and time fields to prevent user entered invalid date
formats from crashing php.
- Fixed profile page to automatically refresh page to show the results
when a user changes their color preferences.
5.3.1 - 2026-02-25
- Fixed bug reported as Issue 1 where failure to select an action for a
part entered in a lognote crashed php in logentry.php.
- Fixed bug where the prompt to set flags on reference chain appeared
even when no flags were available to select in logentry.php.
5.3.2 - 2026-03-02
- Fixed bug reported as Issue 2 where printing search results resulted in
the flags selection was being ignored.

33
distfiles-old/INSTALL Normal file
View File

@@ -0,0 +1,33 @@
INSTALL
OpenLog Online Logbook
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
Installation of OpenLog is straightforward.
1. Gather the required information.
You'll need to know how to configure your web server. This means where
you want to put the files to be served and any configuration required to
allow clients to reach them. You'll also need to know the username and
password of the MySQL administrator.
2. Unpack
Unpack the distribution in a convenient place.
A directory will be created called OpenLog-x.x.x.
3. Review License
Change to the OpenLog-x.x.x directory and review the LICENSE file.
4. Run the install script
Type ./install.sh at a command prompt. Follow the prompts.
5. Check and set Configuration
Click on the Administration menu option on the main page to adjust the initial
settings. You will need to log in as OpenLogAdmin. The initial default password
is "OpenLog-1". From the Administration page, you can click on the links at the
top to add techs, subjects, shifts, etc.
7. Start using OpenLog.

384
distfiles-old/LICENSE Normal file
View File

@@ -0,0 +1,384 @@
The following license applies to all OpenLog code
Copyright (C) 2016 by Rod Wright :
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The \"Program\", below,
refers to any such program or work, and a \"work based on the Program\"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term \"modification\".) Each licensee is addressed as \"you\".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and \"any
later version\", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the \"copyright\" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a \"copyright disclaimer\" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
The following license applies to jquery code :
Copyright jQuery Foundation and other contributors, https://jquery.org/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/jquery-ui
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code contained within the demos directory.
CC0: http://creativecommons.org/publicdomain/zero/1.0/

94
distfiles-old/about.php Normal file
View File

@@ -0,0 +1,94 @@
<?php
/*
about.php
OpenLog Online Logbook
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
$version = OL_VERSION;
$print = $_REQUEST['print'] ?? NULL;
if ($print) {
$sbcolor = P_SIDEBAR_COLOR;
$mbgcolor = P_MENUBG_COLOR;
} else {
$sbcolor = SIDEBAR_COLOR;
$mbgcolor = MENUBG_COLOR;
}
framework("begin", "About OpenLog", "About OpenLog", $print);
pagetable("begin");
if (!$print) {
pageblock("left", "begin");
sidemenu();
pageblock("left", "end");
}
pageblock("right", "begin");
echo "
<h3 align=\"center\">
OpenLog $version
</h3><br>
<p>This program is licensed under the terms of the <a href=\"gpl.php\">GNU General Public License</a>. Click on the link
or see the LICENSE file in the distribution to read it. OpenLog is Copyright (C) 2025 by Rod Wright.</p>
<p>
Although the code
that makes OpenLog work is Open Source, proprietary information may be safely entered into the OpenLog database without fear of affecting the status
of either that information or of OpenLog. This does not conflict with the terms of the GPL, since no database is distributed with OpenLog. If you give a copy of OpenLog to someone else (which you are encouraged to do), you do not need to give them your database
or anything contained therein.</p>
<p>
OpenLog is a simple online logbook application. It allows anyone with a web browser to read, enter, and search for
notes on any subject. The available shifts, employees, and subjects are easily configured. Notes can be referred to
other notes and the entire chain of referenced notes can be displayed in a single page. This makes it convenient to
track ongoing projects or actions on a particular piece of equipment over a long period of time. OpenLog also incorporates
part tracking functions that allow discrepancies and maintenence actions to be documented. Notes, parts, and maintenance
forms can be can be searched for based on a number of criteria. The look and feel of the OpenLog pages are easily changed.
Settings that affect all users can be changed in the Administration menu. User specific settings can be changed in the
My Profile menu. No browser specific HTML is used in OpenLog, so it should be useable in any browser, and it has been
tested using Google Chrome, Mozilla Firefox and Microsoft Internet Explorer.
</p>
<p>
To read about the <a href=\"CHANGELOG\" >changes</a> in this latest version of OpenLog, click on the link or see the CHANGELOG file in the distribution.
</p>
<p>Several pieces of Open Source software make OpenLog possible.
<br>
<table border=0 cellpadding=20>
<tr>
<td><a href=\"http://www.linux.org\" target=\"_blank\"><img src=\"images/linux.png\" border=0></a></td><td><b>Linux</b></td><td>All
development and most of the testing of OpenLog was done on computers running the
<a href=\"http://www.linux.org\" target=\"_blank\">Linux</a> operating system.</td>
</tr>
<tr>
<td><a href=\"http://www.php.net\" target=\"_blank\"><img src=\"images/php-small-trans-dark.gif\"
border=0></a></td><td><b>PHP</b></td><td>OpenLog is written in <a href=\"http://www.php.net\" target=\"_blank\">PHP</a>, a hypertext
preprocessor, which makes possible the dynamic content of the pages.</td>
</tr>
<tr>
<td><a href=\"http://www.mysql.com\" target=\"_blank\"><img src=\"images/poweredbymysql-125.png\"
border=0></a></td><td><b>MySQL</b></td><td>OpenLog stores its data in a <a href=\"http://www.mysql.com\" target=\"_blank\">MySQL</a>
database.</td>
</tr>
<tr>
<td><a href=\"http://http.apache.org\" target=\"_blank\"><img src=\"images/apache_pb.gif\"
border=0></a></td><td><b>Apache</b></td><td>OpenLog was developed using the <a href=\"httpd.apache.org\" target=\"_blank\">Apache</a> web
server.</td>
</tr>
<tr>
<td><a href=\"http://p.yusukekamiyamane.com\" target=\"_blank\"><img src=\"images/Kamiyamane.png\"
border=0></a></td><td><b>Fugue<br>Icons</b></td><td>The icons used in OpenLog are from the Fugue Icon set created by Yusuke Kamiyamane. The entire set is available at
<a href=\"http://p.yusukekamiyamane.com/\" target=\"_blank\">p.yusukekamiyamane.com</a>, and are licensed under a
<a href=\"http://creativecommons.org/licenses/by/3.0/legalcode\" target=\"_blank\">Creative Commons Attribution 3.0 License</a>.</td>
</tr>
</table>
</p>
";
pageblock("right", "end");
pagetable("end");
framework("end", "", "", $print);

856
distfiles-old/common.php Normal file
View File

@@ -0,0 +1,856 @@
<?php
/*
common.php
OpenLog Online Logbook
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
// test for correct installation
if (!file_exists("db.php")) {
echo "
<html>
<head>
<meta http-equiv=\"x-ua-compatible\" content=\"IE=edge\">
<title>Installation error</title>
</head>
<body>
Could not find the db.php file required for this installation.
</body>
</html>
";
exit();
}
include("db.php");
include("settings.php");
// assign variables from constants
// define some other constants
define("ADMIN",2);
define("USER",1);
// build the basic color array
$basic_colors=array(
"White" => "#FFFFFF",
"Silver" => "#C0C0C0",
"Gray" => "#808080",
"Black" => "#000000",
"Red" => "#FF0000",
"Maroon" => "#800000",
"Orange" => "#FFA500",
"Yellow" => "#FFFF00",
"Olive" => "#808000",
"Lime" => "#00FF00",
"Green" => "#008000",
"Aqua" => "#00FFFF",
"Teal" => "#008080",
"Blue" => "#0000FF",
"Navy" => "#000080",
"Fuchsia" => "#FF00FF",
"Purple" => "#800080");
// Determine access mode, login status, and admin status
if ($access_mode == "trusted") $trusted=true; else $trusted=false;
$loggedin=$isadmin=false;
if (isset($_SESSION['userid'])) {
$uid=$_SESSION['userid'];
$loggedin=true;
if (mysqli_fetch_row(mysqli_query($db,"select role from users where id=\"$uid\""))[0] == ADMIN) {
$isadmin=true;
}
}
// Generic functions
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 sidemenu/pagetable
// htmltitle is the page title that appears in the window titlebar
// pagetitle is what will appear as the title of the page itself
// print is whether to format for printing or not
if ($print) {
$bgcolor=P_BACKGROUND_COLOR;
$textcolor=P_TEXT_COLOR;
$linkcolor=P_LINK_COLOR;
$vlinkcolor=P_VLINK_COLOR;
$hdgcolor=P_HEADING_COLOR;
} else {
$bgcolor=BACKGROUND_COLOR;
$textcolor=TEXT_COLOR;
$linkcolor=LINK_COLOR;
$vlinkcolor=VLINK_COLOR;
$hdgcolor=HEADING_COLOR;
}
echo "
<html>
<head>
<meta http-equiv=\"x-ua-compatible\" content=\"IE=edge\">
<title>$htmltitle</title>
<style type=\"text/css\">
* {font-family: Arial, Helvetica, sans-serif;}
table.writeup {table-layout:fixed;}
td.forcewrap {word-wrap: break-word;}
</style>
<style type=\"text/css\">
.fixed {
position:fixed;
}
</style>
<script>
function goBack() {
window.history.back()
}
</script>
<link href=\"jquery-ui/jquery-ui.css\" rel=\"stylesheet\">
<link href=\"jquery-ui/jquery.multiselect.css\" rel=\"stylesheet\">
<style>div.ui-datepicker{font-size:12px;}</style>
<link rel=\"stylesheet\" type=\"text/css\" href=\"colorpicker/css/screen.css\">
<script type=\"text/javascript\" src=\"colorpicker/js/ddcolorposter.js\"></script>
<script type=\"text/javascript\" src=\"colorpicker/js/YAHOO.js\" ></script>
<script type=\"text/javascript2\" src=\"colorpicker/js/log.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/color.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/event.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/dom.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/animation.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/dragdrop.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/slider.js\" ></script>
<script type=\"text/javascript\">
var hue;
var picker;
//var gLogger;
var dd1, dd2;
var r, g, b;
function init() {
if (typeof(ygLogger) != \"undefined\")
ygLogger.init(document.getElementById(\"logDiv\"));
pickerInit();
ddcolorposter.fillcolorbox(\"bgcfield\", \"bgcbox\")
ddcolorposter.fillcolorbox(\"mbgcfield\", \"mbgcbox\")
ddcolorposter.fillcolorbox(\"tcfield\", \"tcbox\")
ddcolorposter.fillcolorbox(\"lcfield\", \"lcbox\")
ddcolorposter.fillcolorbox(\"vlcfield\", \"vlcbox\")
ddcolorposter.fillcolorbox(\"hcfield\", \"hcbox\")
}
// Picker ---------------------------------------------------------
function pickerInit() {
hue = YAHOO.widget.Slider.getVertSlider(\"hueBg\", \"hueThumb\", 0, 180);
hue.onChange = function(newVal) { hueUpdate(newVal); };
picker = YAHOO.widget.Slider.getSliderRegion(\"pickerDiv\", \"selector\",
0, 180, 0, 180);
picker.onChange = function(newX, newY) { pickerUpdate(newX, newY); };
hueUpdate();
dd1 = new YAHOO.util.DD(\"pickerPanel\");
dd1.setHandleElId(\"pickerHandle\");
dd1.endDrag = function(e) {
// picker.thumb.resetConstraints();
// hue.thumb.resetConstraints();
};
}
executeonload(init);
function pickerUpdate(newX, newY) {
pickerSwatchUpdate();
}
function hueUpdate(newVal) {
var h = (180 - hue.getValue()) / 180;
if (h == 1) { h = 0; }
var a = YAHOO.util.Color.hsv2rgb( h, 1, 1);
document.getElementById(\"pickerDiv\").style.backgroundColor =
\"rgb(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";
pickerSwatchUpdate();
}
function pickerSwatchUpdate() {
var h = (180 - hue.getValue());
if (h == 180) { h = 0; }
document.getElementById(\"pickerhval\").value = (h*2);
h = h / 180;
var s = picker.getXValue() / 180;
document.getElementById(\"pickersval\").value = Math.round(s * 100);
var v = (180 - picker.getYValue()) / 180;
document.getElementById(\"pickervval\").value = Math.round(v * 100);
var a = YAHOO.util.Color.hsv2rgb( h, s, v );
document.getElementById(\"pickerSwatch\").style.backgroundColor =
\"rgb(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";
document.getElementById(\"pickerrval\").value = a[0];
document.getElementById(\"pickergval\").value = a[1];
document.getElementById(\"pickerbval\").value = a[2];
var hexvalue = document.getElementById(\"pickerhexval\").value =
YAHOO.util.Color.rgb2hex(a[0], a[1], a[2]);
ddcolorposter.initialize(a[0], a[1], a[2], hexvalue)
}
</script>
</head>
";
echo "
<body bgcolor=\"#$bgcolor\" text=\"#$textcolor\" link=\"#$linkcolor\" vlink=\"#$vlinkcolor\">
";
if ($htmltitle || $pagetitle) {
echo "<font size=5 color=\"#$hdgcolor\"><b> $htmltitle - $pagetitle</b></font>";
if ($print) {
echo "
&nbsp;&nbsp;&nbsp;<input type=\"button\" onClick=\"window.print()\" value=\"Print\" id=\"printbutton\">
&nbsp;&nbsp;&nbsp;<input type=\"button\" onClick=\"window.close()\" value=\"Close\" id=\"closebutton\">
";
}
echo "<br>";
}
} else if ($option=="end") {
echo "
<script src=\"jquery-ui/external/jquery/jquery.js\"></script>
<script src=\"jquery-ui/jquery-ui.js\"></script>
<script src=\"jquery-ui/jquery.multiselect.js\"></script>
<script>
$( \".sidemenu\").addClass(\"fixed\");
$( \":button, :submit, :reset\" ).button();
$( \"#singledatepicker, #reportdatepicker, #actiondatepicker, [id|='onedp']\" ).datepicker({
showOn: \"focus\",
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
$( \"#startdatepicker, [id|='sdp']\" ).datepicker({
showOn: \"focus\",
buttonImage: \"icons/calendar.gif\",
buttonImageOnly: true,
buttonText: \"Select start date\",
inline: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
$( \"#enddatepicker, [id|='edp']\" ).datepicker({
showOn: \"focus\",
buttonImage: \"icons/calendar.gif\",
buttonImageOnly: true,
buttonText: \"Select end date\",
inline: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
$( \"#logoutall\" ).checkboxradio({
icon: false
});
$( \"#device, #subsystem, #discoveredselect, #functional, [id|='sel']\" ).selectmenu();
$( \"#status, #user, #reason\" ).selectmenu();
$( \"#showdays\" ).selectmenu( { width : 130 } );
$( \"#subsystem, #discovered, #searchstatus, #pass, #passconf\").tooltip();
$( \"[id|='ms']\").multiselect();
$( \"#configtabs, #dbadmintabs, #profiletabs\" ).tabs();
</script>
</body>
</html>
";
} else {
echo "
<br>Invalid option \"$option\" passed to framework(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
}
function pagetable($option) {
if ($option=="begin") {
echo "
<br>
<table border=\"0\" width=\"100%\" cellpadding=\"10\">
<tr>
";
} else if ($option=="end") {
echo "
</tr></table>
";
} else {
echo "
<br>Invalid option \"$option\" passed to pagetable(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
}
function pageblock($block,$option) {
if ($block=="left") {
if ($option=="begin") {
echo "
<td width=\"210\" valign=\"top\">
";
} else if ($option=="end") {
echo "
</td>
";
} else {
echo "
<br>Invalid option \"$option\" passed to pageblock(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
} else if ($block=="right") {
if ($option=="begin") {
echo "
<td valign=\"top\">
";
} else if ($option=="end") {
if (defined("FOOTER_MESSAGE")) {
$footer_msg=FOOTER_MESSAGE;
echo "
<br><br>
<center>$footer_msg</center><br>
";
}
echo "
</td>
";
} else {
echo "
<br>Invalid option \"$option\" passed to pageblock(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
} else {
echo "
<br>Invalid block \"$block\" passed to pageblock(). Valid blocks are \"left\" and \"right\".<br>
";
exit(1);
}
}
function sidemenu($printable=true) {
// Displays sidebar menu
global $db,$mbgcolor,$trusted,$loggedin,$isadmin;
if ($trusted || $loggedin) {
echo "
<div class=\"sidemenu\">
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"create.php\" title=\"Create new writeup\"><font size=\"+1\"><b>Create New Writeup</b></font></a></td></tr>
</table>
<br>";
}
echo "
<center><button onclick=\"goBack()\">Go Back</button></center>
";
if ($trusted || $loggedin) {
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"writeups.php\" title=\"View writeups\">View Writeups</a></td></tr>
<tr><td align=\"center\"><a href=\"groups.php\" title=\"View writeup groups\">Writeup Groups</a></td></tr>
<tr><td align=\"center\"><a href=\"search.php\">Search Writeups</a></td></tr>
</table>
<br>
";
if ($isadmin) {
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><b>Admin Functions</b></td></tr>
<tr><td align=\"center\"><a href=\"config.php\" title=\"Control global settings. Must be an administrator.\">Global Settings</a></td></tr>
<tr><td align=\"center\"><a href=\"dbadmin.php\" title=\"Manage the database. Must be an administrator.\">Manage Database</a></td></tr>
<tr><td align=\"center\"><a href=\"https://localhost:10000\" title=\"Webmin for managing a terminal. Webmin must be running on localhost.\">Manage Terminal</a></td></tr>
</table>
<br>
";
}
}
if (! $loggedin) {
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><b>My Account</b></td></tr>
<tr><td align=\"center\"><a href=\"login.php\"><b>Log In</b></a></td></tr>
</table>
<br>";
} else {
$menuuser=$_SESSION['userid'];
$loggedinas=mysqli_fetch_row(mysqli_query($db,"select firstname,lastname from users where id=\"$menuuser\""));
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><b>My Account</b></td></tr>
<tr><td align=\"center\">Logged in as $loggedinas[0] $loggedinas[1]</td></tr><tr><td align=\"center\"><a href=\"login.php?cancel=1\"><b>Log Out</b></a></td></tr>
<tr><td align=\"center\"><a href=\"profile.php\">My Profile</a></td></tr>
</table>
<br>";
}
if ($printable) {
$currentparams=arrayCopy($_REQUEST);
echo "
<br>
<center>
<form method=\"post\" target=\"_blank\">
<input type=\"hidden\" name=\"all_parameters\" value=\"". htmlentities(serialize($currentparams))."\">
<input type=\"submit\" name=\"print\" value=\"Show Printable\" id=\"showprintable\"></form>
</center>
";
}
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"about.php\">About</a></td></tr>
</table>
</div>
";
}
function banner($print) {
// displays a banner
global $db;
$bannerid=BANNER;
// get banner parameters from banner table
$banrow=mysqli_fetch_assoc(mysqli_query($db,"select * from banners where bannerid=\"$bannerid\""));
if (!$banrow) {
$bannerid=1;
} else {
$bannertext=$banrow["bannername"];
if ($print) {
$bannercolor="#FFFFFF";
$bannertxtcolor="#000000";
} else {
$bannercolor=$banrow["bannercolor"];
$bannertxtcolor=$banrow["textcolor"];
}
}
if ($bannerid != 1) {
echo "
<table width=\"100%\">
<tr bgcolor=\"$bannercolor\" align=\"center\"><td colspan=2><font size=\"+1\" color=\"$bannertxtcolor\"><b>$bannertext</b></font></td></tr></table>
";
}
}
function dblookup($db,$table,$in_field,$out_field,$in_data) {
// look up a single field in a database given a value for a single field
$lookup_result=(mysqli_query($db,"select $out_field from $table where $in_field=\"$in_data\""));
if (mysqli_num_rows($lookup_result) > 0) {
$out_data=mysqli_fetch_row($lookup_result);
return($out_data[0]);
} else {
return NULL;
}
}
function arrayCopy( array $array ) {
$result=[];
foreach( $array as $key => $val ) {
if( is_array( $val ) ) {
$result[$key] = arrayCopy( $val );
} elseif ( is_object( $val ) ) {
$result[$key] = clone $val;
} else {
$result[$key] = $val;
}
}
return $result;
}
function validateDate($date, $format = 'Y-m-d') {
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
}
function validateTime($time, $format = 'H:i:s') {
$t = DateTime::createFromFormat($format, $time);
return $t && $t->format($format) == $time;
}
function validate_password($pass,$passconf) {
// run some checks on supplied passwords
// returns a two element array
// first element is true if passwords match, false if not
// second element is true if passwords meet complexity requirements, false if not
$results=[];
// check for match
if ($pass==$passconf) {
$results['match']=true;
} else {
$results['match']=false;
}
// check for complexity
// length
if (strlen($pass) < 8) {
$passlength=false;
} else {
$passlength=true;
}
// upper case
if (preg_match('/[A-Z]/',$pass)) {
$hasupper=true;
} else {
$hasupper=false;
}
// lower case
if (preg_match('/[a-z]/',$pass)) {
$haslower=true;
} else {
$haslower=false;
}
// number
if (preg_match('/[0-9]/',$pass)) {
$hasnumber=true;
} else {
$hasnumber=false;
}
// special character
if (preg_match('/[[:punct:]]/',$pass)) {
$hasspecial=true;
} else {
$hasspecial=false;
}
if ($passlength && $hasupper && $haslower && $hasnumber && $hasspecial) {
$results['complex']=true;
} else {
$results['complex']=false;
}
return $results;
}
function displaywriteup($id) {
// grab some important global variables
global $device_term;
global $discovered_term, $discovered_term_short, $disc_drop_data;
global $functional_term, $functional_term_short;
global $functional_yes, $functional_no;
global $functional_yes_short, $functional_no_short;
global $db;
$writeupdata=mysqli_fetch_assoc(mysqli_query($db,"select * from writeups where id=\"$id\""));
// determine status indicator
if ($writeupdata['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
if ($writeupdata['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
if ($writeupdata['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
// determine functional indicator
if($writeupdata["functional"]==1) {
$funcind="<font color=\"#00FF00\" title=\"$functional_yes\">$functional_yes_short</font>";
} else {
$funcind="<font color=\"#FF0000\" title=\"$functional_no\">$functional_no_short</font>";
}
// look up text data
$devicename=dblookup($db,"devices","id","name",$writeupdata["device"]);
$subsystemname=dblookup($db,"subsystems","id","name",$writeupdata["subsystem"]);
$subsystemdesc=dblookup($db,"subsystems","id","description",$writeupdata["subsystem"]);
$discrtxt=$writeupdata["discrepancy_text"];
$rdate=$writeupdata["report_date"];
$rtime=$writeupdata["report_time"];
$repby=$writeupdata["reported_by"];
$whendiscoveredname=dblookup($db,"discovered","id","whendiscoveredname",$writeupdata["discovered"]);
$whendiscovereddesc=dblookup($db,"discovered","id","whendiscovereddesc",$writeupdata["discovered"]);
$techfname=dblookup($db,"users","id","firstname",$writeupdata["action_by"]);
$techlname=dblookup($db,"users","id","lastname",$writeupdata["action_by"]);
$reasonname=dblookup($db,"reasons","id","text",$writeupdata["action_reason"]);
$actxt=$writeupdata["action_text"];
$adate=$writeupdata["action_date"];
if ($adate=="0000-00-00") $adate="";
$atime=$writeupdata["action_time"];
// determine if this is a member of a group
$member_qry=mysqli_query($db,"select linkgroup from links where writeupid=\"{$writeupdata['id']}\"");
$is_member=mysqli_num_rows($member_qry);
if ($is_member) {
$group_count=$is_member;
$member_group=mysqli_fetch_row($member_qry)[0];
$member_group_name=dblookup($db,"groups","id","name",$member_group);
if ($member_group_name) {
$imgtitle="Member of group: $member_group_name";
} else {
$imgtitle="Member of group ID: $member_group";
}
if ($group_count == 1) {
$group_ind="<a href=\"groups.php?group=$member_group\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
} else {
$group_ind="<a href=\"writeupdetail.php?id={$writeupdata['id']}\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"Member of $group_count groups. Click here to view.\"></a></div>";
}
} else {
$group_ind=NULL;
}
echo "
<table border=\"2\" width=\"100%\"><tr><td>
<table border=\"0\">
<tr><td><b>ID:</b> <a href=\"writeupdetail.php?id=$id\" title=\"View or change details of this writeup\">$id</a></td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>$statusind</b></td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>$device_term:</b> $devicename</td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>Subsystem:</b> <font title=\"$subsystemdesc\">$subsystemname</font></td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>$discovered_term:</b> <font title=\"$whendiscovereddesc\">$whendiscoveredname</font></td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>$funcind</b></td>
</tr>
</table>
<table border=\"0\">
<tr>
<td><b>Discrepancy:</b><br>$discrtxt</td><td>&nbsp;&nbsp;&nbsp;</td>
<td align=\"right\" valign=\"bottom\">$group_ind</td>
</tr>
</table>
<table border=\"0\">
<tr>
<td><b>Report date:</b> $rdate</td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>Report time:</b> $rtime</td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>Reported by:</b> $repby</td>
</tr>
</table>
<hr>
<table border=\"0\">
<tr>
<td><b>Action taken by:</b> $techfname $techlname</td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>Status change reason:</b> $reasonname</td>
</tr>
</table>
<table border=\"0\">
<tr>
<td><b>Action taken:</b><br>$actxt</td>
</tr>
</table>
<table border=\"0\">
<tr>
<td><b>Action date:</b> $adate</td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>Action time:</b> $atime</td>
</tr>
</table>
</td></tr></table>
";
}
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
if ($msgtype == 0) {
$state="ui-state-highlight";
$icon="ui-icon-info";
} else {
$state="ui-state-error";
$icon="ui-icon-alert";
}
if ($msgtxt == "") $msgtxt="PROGRAM ERROR: No message text was supplied.";
echo "
<div class=\"$state ui-corner-all\" style=\"margin-top: 20px; padding: 0 .7em;\">
<p><span class=\"ui-icon $icon\" style=\"float: left; margin-right: .3em;\"></span>
$msgtxt</p>
</div><br><br>
";
}
function getsetting($setting_name,$user_id) {
// get the value of a setting for a user
global $db;
$confqry=mysqli_query($db,"select id,value from config where name=\"$setting_name\"");
$confvalue=mysqli_fetch_assoc($confqry)['value'];
$userqry=mysqli_query($db,"select value from profile where name=\"$setting_name\" and user=\"$user_id\"");
if (mysqli_num_rows($userqry) > 0) {
$uservalue=mysqli_fetch_assoc($userqry)['value'];
if ($uservalue) {
return $uservalue;
} else {
return $confvalue;
}
} else {
return $confvalue;
}
}
function putsetting($setting_name,$setting_value,$user_id) {
// set the value of a setting for a tech
global $db;
$confqry=mysqli_query($db,"select value from config where name=\"$setting_name\"");
$confvalue=mysqli_fetch_assoc($confqry)['value'];
$userqry=mysqli_query($db,"select value from profile where name=\"$setting_name\" and user=\"$user_id\"");
if (mysqli_num_rows($userqry) > 0) {
$uservalue=mysqli_fetch_assoc($userqry)['value'];
if ($setting_value==$confvalue) {
mysqli_query($db,"delete from profile where user=\"$user_id\" and name=\"$setting_name\"");
} else {
if ($uservalue) {
if ($uservalue != $setting_value) mysqli_query($db,"update profile set value=\"$setting_value\" where name=\"$setting_name\" and user=\"$user_id\"");
} else {
mysqli_query($db,"insert into profile(user,name,value) values(\"$user_id\",\"$setting_name\",\"$setting_value\")");
}
}
} else {
mysqli_query($db,"insert into profile(user,name,value) values(\"$user_id\",\"$setting_name\",\"$setting_value\")");
}
}
function group_detail($groupid,$role=false,$mode="view",$selection="none") {
// display a table for a single group
// groupid is the group for which detail is to be shown
// role is true if user is logged in, false if not.
// mode is "select" if selection boxes are to be displayed, "view" if not.
// selection is "all" or "none"
// grab some important global variables
global $device_term;
global $discovered_term, $discovered_term_short, $disc_drop_data;
global $functional_term, $functional_term_short;
global $functional_yes, $functional_no;
global $functional_yes_short, $functional_no_short;
global $db;
// print group id and name
if ($selection == "all") {
$sel_flag="checked";
} elseif ($selection == "none") {
$sel_flag="";
}
$groupname=dblookup($db,"groups","id","name",$groupid);
if ($groupname == "") {
echo "<b>Group ID: &nbsp;$groupid";
} else {
echo "<b>Group Name: &nbsp;$groupname";
}
echo "</b><br>";
// print table headers
if ($role && $mode=="select") {
echo "
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
<tr>
<th style=\"width:1%;\">Select</th>
<th style=\"width:1%;\">ID</th>
<th style=\"width:1%;\">Status</th>
<th style=\"width:100px;\">Date</th>
<th style=\"width:1%;\">$discovered_term_short</th>
<th style=\"width:1%;\">$device_term</th>
<th style=\"width:1%;\">Subsystem</th>
<th style=\"width:1%;\">Reported by</th>
<th>Discrepancy</th>
<th style=\"width:1%;\">$functional_term_short</th>
</tr>
";
} else {
echo "
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
<tr>
<th style=\"width:1%;\">ID</th>
<th style=\"width:1%;\">Status</th>
<th style=\"width:100px;\">Date</th>
<th style=\"width:1%;\">$discovered_term_short</th>
<th style=\"width:1%;\">$device_term</th>
<th style=\"width:1%;\">Subsystem</th>
<th style=\"width:1%;\">Reported by</th>
<th>Discrepancy</th>
<th style=\"width:1%;\">$functional_term_short</th>
</tr>
";
}
$writeup_qry=mysqli_query($db,"select writeupid from links where linkgroup=$groupid order by writeupid asc");
while ($writeup=mysqli_fetch_row($writeup_qry)) {
// get writeup data
$writeupdata=mysqli_fetch_assoc(mysqli_query($db,"select * from writeups where id={$writeup[0]}"));
// convert device number to name
$tname=dblookup($db,"devices","id","name",$writeupdata["device"]);
// convert subsystem number to name
$ssname=dblookup($db,"subsystems","id","name",$writeupdata["subsystem"]);
// determine status indicator
if ($writeupdata['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
if ($writeupdata['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
if ($writeupdata['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
// determine whendiscovered text for discovered id
$whendiscname=mysqli_fetch_row(mysqli_query($db,"select whendiscoveredname from discovered where id=\"{$writeupdata['discovered']}\""))[0];
$whendiscdesc=mysqli_fetch_row(mysqli_query($db,"select whendiscovereddesc from discovered where id=\"{$writeupdata['discovered']}\""))[0];
// determine functional icon
if($writeupdata["functional"]==1) {
$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
} else {
$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
}
// print table row
if ($role && $mode=="select") {
printf(
"<tr>
<td align=\"center\" valign=\"top\"><input type=\"checkbox\" name=\"targets[]\" value=\"%s\" $sel_flag></td>
<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\"><font title=\"%s\">%s</font></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">%s</td>
</tr>\n",
$writeupdata["id"],
$writeupdata["id"],$writeupdata["id"],
$statusind,
$writeupdata["report_date"],
$whendiscdesc, $whendiscname,
$tname,
$ssname,
$writeupdata["reported_by"],
$writeupdata["discrepancy_text"],
$func_icon
);
} else {
printf(
"<tr>
<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\"><font title=\"%s\">%s</font></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">%s</td>
</tr>\n",
$writeupdata["id"],$writeupdata["id"],
$statusind,
$writeupdata["report_date"],
$whendiscdesc, $whendiscname,
$tname,
$ssname,
$writeupdata["reported_by"],
$writeupdata["discrepancy_text"],
$func_icon
);
}
}
echo "</table><br>";
}
?>

382
distfiles-old/gpl.php Normal file
View File

@@ -0,0 +1,382 @@
<?php
/*
gpl.php
OpenLog Online Logbook
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
$print = $_REQUEST['print'] ?? NULL;
if ($print) {
$sbcolor = P_SIDEBAR_COLOR;
$mbgcolor = P_MENUBG_COLOR;
} else {
$sbcolor = SIDEBAR_COLOR;
$mbgcolor = MENUBG_COLOR;
}
framework("begin", "OpenLog License", "OpenLog License", $print);
pagetable("begin");
if (!$print) {
pageblock("left", "begin");
sidemenu();
pageblock("left", "end");
}
pageblock("right", "begin");
echo "
<pre>
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The \"Program\", below,
refers to any such program or work, and a \"work based on the Program\"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term \"modification\".) Each licensee is addressed as \"you\".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and \"any
later version\", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the \"copyright\" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a \"copyright disclaimer\" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
</pre>
";
pageblock("right", "end");
pagetable("end");
framework("end", "", "", $print);

View File

Before

Width:  |  Height:  |  Size: 584 B

After

Width:  |  Height:  |  Size: 584 B

View File

Before

Width:  |  Height:  |  Size: 586 B

After

Width:  |  Height:  |  Size: 586 B

View File

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 458 B

View File

Before

Width:  |  Height:  |  Size: 551 B

After

Width:  |  Height:  |  Size: 551 B

View File

Before

Width:  |  Height:  |  Size: 564 B

After

Width:  |  Height:  |  Size: 564 B

View File

Before

Width:  |  Height:  |  Size: 470 B

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

View File

Before

Width:  |  Height:  |  Size: 696 B

After

Width:  |  Height:  |  Size: 696 B

View File

Before

Width:  |  Height:  |  Size: 811 B

After

Width:  |  Height:  |  Size: 811 B

View File

Before

Width:  |  Height:  |  Size: 479 B

After

Width:  |  Height:  |  Size: 479 B

View File

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 757 B

View File

Before

Width:  |  Height:  |  Size: 521 B

After

Width:  |  Height:  |  Size: 521 B

View File

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 258 B

View File

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

View File

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 342 B

View File

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 316 B

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

100
distfiles-old/login.php Normal file
View File

@@ -0,0 +1,100 @@
<?php
/*
login.php
OpenLog Online Logbook
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
$print = $_REQUEST['print'] ?? NULL;
$tech = $_REQUEST['tech'] ?? NULL;
$pass = $_REQUEST['pass'] ?? NULL;
$login = $_REQUEST['login'] ?? NULL;
$cancel = $_REQUEST['cancel'] ?? NULL;
if ($cancel) {
session_destroy();
}
$techalpha = TECH_ALPHA;
$logname = LOG_NAME;
if ($print) {
$sbcolor = P_SIDEBAR_COLOR;
$mbgcolor = P_MENUBG_COLOR;
} else {
$sbcolor = SIDEBAR_COLOR;
$mbgcolor = MENUBG_COLOR;
}
framework("begin", "$logname", "Login Page", $print);
pagetable("begin");
if (!$print) {
pageblock("left", "begin");
sidemenu("no print");
pageblock("left", "end");
}
pageblock("right", "begin");
if ($login) {
// log me in
$pwhash = mysqli_fetch_row(mysqli_query($db, "select techpass from techs where techid=\"$tech\""))[0];
if (password_verify($pass, $pwhash)) {
$_SESSION['login'] = $tech;
$techname = dblookup($db, "techs", "techid", "techname", $tech);
echo "
Welcome $techname. Please select a menu option at the left to continue.
";
} else {
$adminqry = mysqli_query($db, "select techname from techs where admin=1 and status=1");
echo "
Incorrect password. Please <a href=\"login.php\">try again</a>.<br><br>
Forgot your password? Contact an administrator:<br><br>
";
while ($admintech = mysqli_fetch_row($adminqry)[0]) {
echo "$admintech <br>";
}
}
} else if ($cancel) {
echo "
You are logged out. Please select a menu option at the left to continue.<br><hr>
";
} else {
if (!isset($_SESSION['login'])) {
// show the login form
echo "
<form method=\"post\" action=\"login.php\">
<b>Tech: </b>&nbsp;
<select name=\"tech\">
";
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) {
printf("<option value=\"%s\">%s</option>", $techitem["techid"], $techitem["techname"]);
}
}
echo "</select><br><br>
Password: &nbsp;<input type=\"password\" name=\"pass\" size=\"40\"><br><br>
<input type=\"submit\" name=\"login\" value=\"Log In\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"cancel\" value=\"Cancel\"><br>
</form>
<br><hr>
";
} else {
$loginid = $_SESSION['login'];
$loggedinas = mysqli_fetch_row(mysqli_query($db, "select techname from techs where techid=\"$loginid\""))[0];
echo "
You are already logged in as $loggedinas. Please select a menu option at the left to continue.<br><hr>
";
}
}
pageblock("right", "end");
pagetable("end");
framework("end", "", "", $print);

259
distfiles-old/lognotes.php Normal file
View File

@@ -0,0 +1,259 @@
<?php
/*
lognotes.php
OpenLog Online Logbook
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
//---include("functions.php");
include("common.php");
//$tgt_year=$_REQUEST['y'];
//$tgt_month=$_REQUEST['m'];
//$tgt_day=$_REQUEST['d'];
$tgt_date = $_REQUEST['tgt_date'] ?? "";
$print = $_REQUEST['print'] ?? "";
if (isset($_SESSION['login'])) $techid = $_SESSION['login'];
$logname = LOG_NAME;
$tablestyle = LOG_STYLE;
if ($print) {
$sbcolor = P_SIDEBAR_COLOR;
$mbgcolor = P_MENUBG_COLOR;
} else {
$sbcolor = SIDEBAR_COLOR;
$mbgcolor = MENUBG_COLOR;
}
// use default date values if not supplied
if ($tgt_date == "") $tgt_date = $today;
// define shifttable_classic function
function shifttable_classic($shift, $tgt_date, $db)
{
// convert the shift number to a name for display
$doparts = PARTS_FUNCTIONS;
$showtime = SHOW_TS;
$shname = dblookup($db, "shifts", "shiftid", "shiftname", $shift);
$dshdrdata = mysqli_query($db, "select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
$dshdr = mysqli_fetch_row($dshdrdata);
if ($dshdr) {
// print the shift header
printf("<b><font size=\"+1\">%s</font></b>\n", $shname);
$note = mysqli_query($db, "select lognoteid,tech,subject,lognote,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
echo "<br><table border=\"1\" width=\"100%\">\n";
echo "<tr><th width=\"70\">Note ID</th><th width=\"70\">Tech</th><th width=\"100\">Subject</th><th>Note</th><th width=\"70\">References</th></tr>\n";
while ($tablerow = mysqli_fetch_assoc($note)) {
$thisnote = $tablerow["lognoteid"];
$refs = "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
if (islink($thisnote)) {
$refs = $refs . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"refchain.php?chainnote=$thisnote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
}
// convert tech number to name
$tname = dblookup($db, "techs", "techid", "techname", $tablerow["tech"]);
//convert subject number to name
$subjname = dblookup($db, "subjects", "subjectid", "subjectname", $tablerow["subject"]);
// create links of urls in note
$fmtnote = convertweblinks($tablerow["lognote"]);
// generate the flags string
$flagstring = "";
$flagqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$thisnote");
while ($flagid = mysqli_fetch_row($flagqry)) {
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
$flagcolor = $flagparams["flagcolor"];
$flagsym = $flagparams["flagsym"];
$flagname = $flagparams["flagname"];
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font>&nbsp;&nbsp;";
}
if ($flagstring) {
$fmtnote = $fmtnote . "<br>" . $flagstring . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
} else {
$fmtnote = $fmtnote . "<br>";
}
if ($doparts) {
// turn on the parts indicator if parts were entered with the note
if (mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where lognoteid=\"$thisnote\""))) {
$fmtnote = $fmtnote . "<a href=\"logentry.php?partview=1&noteid=$thisnote\">PARTS</a>";
}
}
// now print the line in the table
if ($showtime) {
printf(
"<tr>
<td valign=\"top\"><a href=\"logentry.php?edit=1&noteid=%s\" title=\"Edit this note\">%s</a>&nbsp;&nbsp;%s</td>
<td valign=\"top\"> %s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>\n",
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tablerow["time"],
$tname,
$subjname,
$fmtnote,
$refs
);
} else {
printf(
"<tr>
<td valign=\"top\"><a href=\"logentry.php?edit=1&noteid=%s\">%s</a></td>
<td valign=\"top\"> %s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>\n",
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tname,
$subjname,
$fmtnote,
$refs
);
}
}
echo "</table>\n";
} else {
// print the shift header
echo "<b>No entries for $shname</b>";
}
echo "<br><br>\n";
}
// define the shifttable_clean function
function shifttable_clean($shift, $tgt_date, $db)
{
// convert the shift number to a name for display
$doparts = PARTS_FUNCTIONS;
$showtime = SHOW_TS;
$shname = dblookup($db, "shifts", "shiftid", "shiftname", $shift);
$dshdrdata = mysqli_query($db, "select date,shift from lognotes where date=\"$tgt_date\" and shift=\"$shift\"");
$dshdr = mysqli_fetch_row($dshdrdata);
if ($dshdr) {
// print the shift header
printf("<b><font size=\"+1\">%s</font></b>\n", $shname);
$note = mysqli_query($db, "select lognoteid,tech,subject,lognote,time from lognotes where date=\"$tgt_date\" and shift=\"$shift\" order by time asc");
echo "<br><br>";
echo "<table border=\"0\" width=\"100%\"><tr><td>\n";
while ($tablerow = mysqli_fetch_assoc($note)) {
$thisnote = $tablerow["lognoteid"];
$refs = "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"logentry.php?add=1&refto=$thisnote\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
if (islink($tablerow["lognoteid"])) {
$refs = $refs . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"refchain.php?chainnote=$thisnote\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View reference chain\" alt=\"View reference chain\"></a>";
}
// convert tech number to name
$tname = dblookup($db, "techs", "techid", "techname", $tablerow["tech"]);
//convert subject number to name
$subjname = dblookup($db, "subjects", "subjectid", "subjectname", $tablerow["subject"]);
// create links of urls in note
$fmtnote = convertweblinks($tablerow["lognote"]);
// generate the flags string
$flagstring = "";
$flagqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$thisnote");
while ($flagid = mysqli_fetch_row($flagqry)) {
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
$flagcolor = $flagparams["flagcolor"];
$flagsym = $flagparams["flagsym"];
$flagname = $flagparams["flagname"];
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font>&nbsp;&nbsp;";
}
if ($flagstring) {
$fmtnote = $fmtnote . "<br>" . $flagstring . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
} else {
$fmtnote = $fmtnote . "<br>";
}
if ($doparts) {
// turn on the parts indicator if parts were entered with the note
if (mysqli_num_rows(mysqli_query($db, "select logpartid from logparts where lognoteid=\"$thisnote\""))) {
$fmtnote = $fmtnote . "<a href=\"logentry.php?edit=1&noteid=$thisnote\" title=\"Click here to see note and parts data.\">PARTS</a>";
}
}
// now print the line in the table
if ($showtime) {
printf(
"<a href=\"logentry.php?edit=1&noteid=%s\" title=\"Note ID. Click to edit.\">%s</a>&nbsp;&nbsp;
<b>%s &nbsp;&nbsp;&nbsp;&nbsp;
%s &nbsp;&nbsp;&nbsp;&nbsp;
%s &nbsp;&nbsp;&nbsp;&nbsp;
%s</b>
<br>%s<br>
<hr>\n",
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tablerow["time"],
$tname,
$subjname,
$refs,
$fmtnote
);
} else {
printf(
"<a href=\"logentry.php?edit=1&noteid=%s\">%s</a>&nbsp;&nbsp;
<b>%s &nbsp;&nbsp;&nbsp;&nbsp;
%s &nbsp;&nbsp;&nbsp;&nbsp;
%s</b>
<br>%s<br>
<hr>\n",
$tablerow["lognoteid"],
$tablerow["lognoteid"],
$tname,
$subjname,
$refs,
$fmtnote
);
}
}
echo "</td></tr></table>\n";
} else {
// print the shift header
echo "<b>No entries for $shname</b>";
}
echo "<br><br>\n";
}
framework("begin", "$logname", "Online Logbook", $print);
pagetable("begin");
if (!$print) {
pageblock("left", "begin");
//calendar($tgt_year,$tgt_month,$tgt_day,"lognotes.php");
echo "<div id=\"caldate\" style=\"display: none;\">";
echo htmlspecialchars($tgt_date);
echo "</div>
<div id=\"lognotescalendar\"></div>
<form method=\"post\" id=\"calendar\" action=\"lognotes.php\">
<input type=\"hidden\" id=\"targetdate\" name=\"tgt_date\" value=\"$tgt_date\">
</form>
";
sidemenu();
echo "<br><br>";
showlinklist($print);
pageblock("left", "end");
} else {
echo "
<center><b>$tgt_year-$tgt_month-$tgt_day</b></center><br>
";
}
pageblock("right", "begin");
banner($print);
if (isset($techid)) nag($techid);
//$date=date("Y-m-d",mktime(0,0,0,$tgt_month,$tgt_day,$tgt_year));
$qry = mysqli_query($db, "select shiftid from shifts where status=1 order by shiftid asc");
while ($shnum = mysqli_fetch_row($qry)) {
if ($tablestyle == 1) {
shifttable_classic($shnum[0], $tgt_date, $db);
} else if ($tablestyle == 2) {
shifttable_clean($shnum[0], $tgt_date, $db);
}
}
banner($print);
pageblock("right", "end");
pagetable("end");
framework("end", "", "", $print);

301
distfiles-old/profile.php Normal file
View File

@@ -0,0 +1,301 @@
<?php
/*
profile.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");
}
$techid = $_SESSION['login'] ?? NULL;
$print = $_REQUEST['print'] ?? NULL;
$table = $_REQUEST['table'] ?? NULL;
$updateinfo = $_REQUEST['updateinfo'] ?? NULL;
$updatedisplay = $_REQUEST['updatedisplay'] ?? NULL;
$setcolor = $_REQUEST['setcolor'] ?? NULL;
$name = $_REQUEST['name'] ?? NULL;
$pass = $_REQUEST['pass'] ?? NULL;
$passconf = $_REQUEST['passconf'] ?? NULL;
$shift = $_REQUEST['shift'] ?? NULL;
$display_urlchunk = $_REQUEST['display_urlchunk'] ?? 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;
$modcolor = $_REQUEST['modcolor'] ?? NULL;
$hexcolor = $_REQUEST['hexcolor'] ?? NULL;
$resetcustom = $_REQUEST["resetcustom"] ?? NULL;
$logname = LOG_NAME;
if ($print) {
$sbcolor = P_SIDEBAR_COLOR;
$mbgcolor = P_MENUBG_COLOR;
} else {
$sbcolor = SIDEBAR_COLOR;
$mbgcolor = MENUBG_COLOR;
}
framework("begin", "$logname", "My Profile", $print);
pagetable("begin");
if (!$print) {
pageblock("left", "begin");
// ******** begin database manipulation ********
if ($updateinfo) {
// name shift password settings
// do error checking
// test for name supplied
if (strlen(trim($name))) {
$namesuppld = TRUE;
} else {
$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 = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;Tech name already exists.<br>";
} else {
$nameunique = TRUE;
}
} else {
$nameunique = TRUE;
}
// test for matching passwords
if ($pass != "password_is_unchanged") {
if ($pass == $passconf) {
$passmatch = TRUE;
$passhash = password_hash($pass, PASSWORD_DEFAULT);
$namepassupdqry = ("update techs set techname=\"$name\",techpass=\"$passhash\" where techid=\"$techid\"");
} else {
$passmatch = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;The passwords you supplied don't match.<br>";
}
} else {
$passmatch = TRUE;
$namepassupdqry = "update techs set techname=\"$name\" where techid=\"$techid\"";
}
if ($namesuppld && $nameunique && $passmatch) {
mysqli_query($db, $namepassupdqry);
mysqli_query($db, "update techs set shift=\"$shift\" where techid=\"$techid\"");
}
}
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;
// test for urlchunk supplied
if (strlen(trim($display_urlchunk))) {
$chunksuppld = TRUE;
} else {
$chunksuppld = FALSE;
echo "<img src=\"icons/exclamation-red.png\" border=\"0\">&nbsp;URL chunk size cannot be blank.<br>";
}
if ($chunksuppld) {
putsetting('url_chunk_size', $display_urlchunk, $techid);
putsetting('show_ts', $display_showts, $techid);
putsetting('tech_alpha', $display_techalpha, $techid);
putsetting('subj_alpha', $display_subjalpha, $techid);
putsetting('log_style', $display_logstyle, $techid);
}
}
if ($setcolor) {
// color settings
$hexcolor = "#" . ltrim($hexcolor);
putsetting($modcolor, $hexcolor, $techid);
$currentpage = $_SERVER['PHP_SELF'];
header("Refresh: .1; url=$currentpage");
}
if ($resetcustom) mysqli_query($db, "delete from customs where customtech=\"$techid\"");
sidemenu();
pageblock("left", "end");
}
pageblock("right", "begin");
// pull my current data from tables
$curname = dblookup($db, "techs", "techid", "techname", $techid);
$curshift = dblookup($db, "techs", "techid", "shift", $techid);
$pass = $passconf = "password_is_unchanged";
// other values from customs
$curlchunk = getsetting('url_chunk_size', $techid)["value"];
$curts = getsetting('show_ts', $techid)["value"];
$curtdo = getsetting('tech_alpha', $techid)["value"];
$cursdo = getsetting('subj_alpha', $techid)["value"];
$curbgc = getsetting('background_color', $techid)["value"];
$cursbc = getsetting('sidebar_color', $techid)["value"];
$curmbgc = getsetting('menubg_color', $techid)["value"];
$curtc = getsetting('text_color', $techid)["value"];
$curlc = getsetting('link_color', $techid)["value"];
$curvlc = getsetting('vlink_color', $techid)["value"];
$curhc = getsetting('heading_color', $techid)["value"];
$curlogstyle = getsetting('log_style', $techid)["value"];
// show the form
echo "
<form method=\"post\" action=\"profile.php\">
<b>My Information</b><br><br>
<table border=\"0\">
<tr><td>
Tech Name (first and last name): &nbsp;<input type=\"text\" name=\"name\" size=\"40\" value=\"$curname\"><br><br>
Password: &nbsp;<input type=\"password\" name=\"pass\" size=\"40\" value=\"$pass\"><br><br>
Repeat Password: &nbsp;<input type=\"password\" name=\"passconf\" size=\"40\" value=\"$passconf\"><br><br>
<font size=\"-1\">Need a random password? &nbsp;</font>
";
$rpw = substr(str_shuffle(password_hash(microtime(), PASSWORD_DEFAULT)), 10, 12);
echo "
&nbsp; $rpw<br><br>
<b>Shift: </b>&nbsp;
<select name=\"shift\">
";
$shiftrow = mysqli_query($db, "select * from shifts");
while ($shiftitem = mysqli_fetch_assoc($shiftrow)) {
if ($shiftitem["status"] == 1) {
if ($shiftitem["shiftid"] == $curshift) {
printf("<option value=\"%s\" selected>%s</option>", $shiftitem["shiftid"], $shiftitem["shiftname"]);
} else {
printf("<option value=\"%s\">%s</option>", $shiftitem["shiftid"], $shiftitem["shiftname"]);
}
}
}
echo "
</select>
</td></tr>
</table>
<br>
<input type=\"submit\" name=\"updateinfo\" value=\"Update My Information\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset\" value=\"Reset Form\"><br><br>
<hr>
<b>My Display Preferences</b><br><br>
Log style (the look of the log notes display): &nbsp;&nbsp;<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):
&nbsp;<input type=\"text\" name=\"display_urlchunk\" size=\"3\" value=\"$curlchunk\"><br><br>
Show timestamps in log notes: &nbsp;&nbsp;
";
if ($curts) {
echo "<input type=\"checkbox\" name=\"display_showts\" checked>";
} else {
echo "<input type=\"checkbox\" name=\"display_showts\">";
}
echo "
<br><br>
Techs display order: &nbsp;&nbsp;
";
if ($curtdo) {
echo "
<input type=\"radio\" name=\"display_techalpha\" value=\"a\" checked>Alphabetical order
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"display_techalpha\" value=\"d\">Database order
";
} else {
echo "
<input type=\"radio\" name=\"display_techalpha\" value=\"a\">Alphabetical order
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"display_techalpha\" value=\"d\" checked>Database order
";
}
echo "
<br><br>
Subjects display order: &nbsp;&nbsp;
";
if ($cursdo) {
echo "
<input type=\"radio\" name=\"display_subjalpha\" value=\"a\" checked>Alphabetical order
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"display_subjalpha\" value=\"d\">Database order
";
} else {
echo "
<input type=\"radio\" name=\"display_subjalpha\" value=\"a\">Alphabetical order
&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"display_subjalpha\" value=\"d\" checked>Database order
";
}
echo "
<br><br>
<input type=\"submit\" name=\"updatedisplay\" value=\"Update My Display Preferences\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset\" value=\"Reset Form\"><br><br>
<hr>
<b>My Color Preferences</b><br><br>
";
switch ($modcolor) {
case "background_color":
echo "<table border=\"0\"><tr><td>Page background color</td><td>";
colorpicker("profile.php?setcolor=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("profile.php?setcolor=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("profile.php?setcolor=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("profile.php?setcolor=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("profile.php?setcolor=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("profile.php?setcolor=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("profile.php?setcolor=1&modcolor=heading_color&hexcolor=");
echo "</td></tr></table><hr>";
break;
}
echo "
<b>Select the color you'd like to change</b><br><br>
<table border=\"1\" cellpadding=\"10\">
<tr><td><a href=\"profile.php?modcolor=background_color\">Page background color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curtc\">$curbgc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=sidebar_color\">Sidebar color</a></td><td bgcolor=\"$cursbc\"><font color=\"$curtc\">$cursbc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=menubg_color\">Menu background color</a></td><td bgcolor=\"$curmbgc\"><font color=\"$curlc\">$curmbgc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=text_color\">Normal text color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curtc\">$curtc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=link_color\">Link color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curlc\">$curlc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=vlink_color\">Visited link color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curvlc\">$curvlc</font></td></tr>
<tr><td><a href=\"profile.php?modcolor=heading_color\">Heading color</a></td><td bgcolor=\"$curbgc\"><font color=\"$curhc\">$curhc</font></td></tr>
</table>
<br><hr>
<br>
<center><input type=\"submit\" name=\"resetcustom\" value=\"Reset All To Defaults\"></center>
</form>
";
pageblock("right", "end");
pagetable("end");
framework("end", "", "", $print);

891
distfiles-old/search.php Normal file
View File

@@ -0,0 +1,891 @@
<?php
/*
search.php
OpenLog Online Logbook
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("functions.php");
$noprint = TRUE;
if (isset($_SESSION['login'])) {
$loggedin = TRUE;
} else {
$loggedin = FALSE;
}
$print = $_REQUEST['print'] ?? NULL;
$search = $_REQUEST['search'] ?? NULL;
$srchnoteid = $_REQUEST['srchnoteid'] ?? NULL;
$srchmfid = $_REQUEST['srchmfid'] ?? NULL;
$srchbdate = $_REQUEST['srchbdate'] ?? NULL;
$srchedate = $_REQUEST['srchedate'] ?? NULL;
$srchshift = $_REQUEST['srchshift'] ?? NULL;
$srchtech = $_REQUEST['srchtech'] ?? NULL;
$srchsubj = $_REQUEST['srchsubj'] ?? NULL;
$srchtext = $_REQUEST['srchtext'] ?? NULL;
$srchuid = $_REQUEST['srchuid'] ?? NULL;
$srchpn = $_REQUEST['srchpn'] ?? NULL;
$srchsn = $_REQUEST['srchsn'] ?? NULL;
$srchpname = $_REQUEST['srchpname'] ?? NULL;
$srchploc = $_REQUEST['srchploc'] ?? NULL;
$srchnha = $_REQUEST['srchnha'] ?? NULL;
$srchrepord = $_REQUEST['srchrepord'] ?? NULL;
$srchflags = $_REQUEST['srchflags'] ?? [];
$target = $_REQUEST['target'] ?? ["log", "maintform", "part"];
$doparts = PARTS_FUNCTIONS;
$logname = LOG_NAME;
$techalpha = TECH_ALPHA;
$subjalpha = SUBJ_ALPHA;
$uidtext = UID_TEXT;
if ($print) {
$sbcolor = P_SIDEBAR_COLOR;
$mbgcolor = P_MENUBG_COLOR;
} else {
$sbcolor = SIDEBAR_COLOR;
$mbgcolor = MENUBG_COLOR;
}
framework("begin", "$logname Search", "Search", $print);
// echo "REQUEST variables: <br>";
// var_dump($_REQUEST);
// echo "<br>";
// ******** begin database manipulation ********
// define the arrays
$logfromtables = [];
$mffromtables = [];
$pfromtables = [];
$logconstraints = [];
$mfconstraints = [];
$pconstraints = [];
// get the date range of lognotes
$logdateqry = mysqli_query($db, "select min(date), max(date) from lognotes");
$logdateresults = mysqli_fetch_row($logdateqry);
$logmindate = $logdateresults[0];
if ($logmindate == "") $logmindate = $today;
$logmaxdate = $logdateresults[1];
if ($logmaxdate == "") $logmaxdate = $today;
// get the date range of maintenance forms
$mfdateqry = mysqli_query($db, "select min(mfdate), max(mfdate) from maintforms");
$mfdateresults = mysqli_fetch_row($mfdateqry);
$mfmindate = $mfdateresults[0];
if ($mfmindate == "") $mfmindate = $today;
$mfmaxdate = $mfdateresults[1];
if ($mfmaxdate == "") $mfmaxdate = $today;
// determine entire date range
$mindate = min($logmindate, $mfmindate);
$maxdate = max($logmaxdate, $mfmaxdate);
if ($search) {
// strip whitespace from beginning and end of text fields
$srchtext = trim($srchtext);
$srchpname = trim($srchpname);
$srchploc = trim($srchploc);
$srchnha = trim($srchnha);
if (in_array("log", $target)) {
// define the query constraints
// log note id
if ($srchnoteid != "any" && $srchnoteid != "") {
$logfromtables[] = "lognotes";
$logconstraints[] = "lognotes.lognoteid=\"$srchnoteid\"";
}
// maint form id
if ($srchmfid != "any" && $srchmfid != "") {
$logfromtables[] = "lognotes";
$logfromtables[] = "maintforms";
$logconstraints[] = "lognotes.lognoteid=maintforms.lognoteid and maintforms.maintformid=\"$srchmfid\"";
}
// date range
if ($srchbdate != "" && $srchedate != "") {
$logfromtables[] = "lognotes";
$logconstraints[] = "lognotes.date between \"$srchbdate\" and \"$srchedate\"";
}
// shift
if ($srchshift != "0") {
$logfromtables[] = "lognotes";
$logconstraints[] = "lognotes.shift=\"$srchshift\"";
}
// tech
if ($srchtech != "0") {
$logfromtables[] = "lognotes";
$logconstraints[] = "lognotes.tech=\"$srchtech\"";
}
// subject
if ($srchsubj != "0") {
$logfromtables[] = "lognotes";
$logconstraints[] = "lognotes.subject=\"$srchsubj\"";
}
// search text
if ($srchtext != "") {
$logfromtables[] = "lognotes";
$logconstraints[] = "lognotes.lognote like \"%$srchtext%\"";
}
// uid
if ($srchuid != "any" && $srchuid != "") {
$logfromtables[] = "lognotes";
$logfromtables[] = "logparts";
$logfromtables[] = "parts";
$logconstraints[] = "lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and parts.uid=\"{$srchuid}\"";
}
// part number
if ($srchpn != "any" && $srchpn != "") {
$logfromtables[] = "lognotes";
$logfromtables[] = "logparts";
$logfromtables[] = "parts";
$logconstraints[] = "lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and parts.partnum=\"{$srchpn}\"";
}
// serial number
if ($srchsn != "any" && $srchsn != "") {
$logfromtables[] = "lognotes";
$logfromtables[] = "logparts";
$logfromtables[] = "parts";
$logconstraints[] = "lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and parts.sernum=\"{$srchsn}\"";
}
// part name
if ($srchpname != "any" && $srchpname != "") {
$logfromtables[] = "lognotes";
$logfromtables[] = "logparts";
$logfromtables[] = "parts";
$logconstraints[] = "lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and parts.partname like \"%{$srchpname}%\"";
}
// part location
if ($srchploc != "any" && $srchploc != "") {
$logfromtables[] = "lognotes";
$logfromtables[] = "logparts";
$logfromtables[] = "parts";
$logfromtables[] = "maintforms";
$logconstraints[] = "lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and maintforms.mfpart=parts.partid and maintforms.mfpartloc like \"%{$srchploc}%\"";
}
// next higher assembly
if ($srchnha != "any" && $srchnha != "") {
$logfromtables[] = "lognotes";
$logfromtables[] = "logparts";
$logfromtables[] = "parts";
$logfromtables[] = "maintforms";
$logconstraints[] = "lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and maintforms.mfpart=parts.partid and maintforms.nha like \"%{$srchnha}%\"";
}
// repair order
if ($srchrepord != "any" && $srchrepord != "") {
$logfromtables[] = "lognotes";
$logfromtables[] = "logparts";
$logfromtables[] = "parts";
$logfromtables[] = "maintforms";
$logconstraints[] = "lognotes.lognoteid=logparts.lognoteid and logparts.partid=parts.partid and maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
}
// flags
if (!empty($srchflags)) {
unset($flagconstraints);
$flagcount = count($srchflags);
$logfromtables[] = "lognotes";
$logfromtables[] = "flagmap";
$flagconstraints[] = "flagmap.lognoteid=lognotes.lognoteid and flagmap.flagid in (";
foreach ($srchflags as $flagid) {
$flagconstraints[] = "\"$flagid\"";
$flagconstraints[] = ",";
}
// remove final comma
array_splice($flagconstraints, -1, 1);
$flagconstraints[] = ") group by flagmap.lognoteid having count(distinct flagmap.flagid)=$flagcount";
// make flagconstraints a single string so that the final implode doesn't split it
$logconstraints[] = join('', $flagconstraints);
}
// build the clauses and run the query
$logfromclause = implode(",", array_unique($logfromtables));
$logwhereclause = implode(" and ", $logconstraints);
$logrowqry = mysqli_query($db, "select lognotes.* from $logfromclause where $logwhereclause order by lognotes.date asc, lognotes.time asc");
}
if (in_array("maintform", $target)) {
// maintforms search
// define the query constraints
// log note id
if ($srchnoteid != "any" && $srchnoteid != "") {
$mffromtables[] = "maintforms";
$mffromtables[] = "lognotes";
$mfconstraints[] = "maintforms.lognoteid=lognotes.lognoteid and lognotes.lognoteid=\"$srchnoteid\"";
}
// maint form id
if ($srchmfid != "any" && $srchmfid != "") {
$mffromtables[] = "maintforms";
$mfconstraints[] = "maintforms.maintformid=\"$srchmfid\"";
}
// date range
if ($srchbdate != "" && $srchedate != "") {
$mffromtables[] = "maintforms";
$mfconstraints[] = "maintforms.mfdate between \"$srchbdate\" and \"$srchedate\"";
}
// shift
if ($srchshift != "0") {
$mffromtables[] = "maintforms";
$mffromtables[] = "lognotes";
$mfconstraints[] = "maintforms.lognoteid=lognotes.lognoteid and lognotes.shift=\"$srchshift\"";
}
// tech
if ($srchtech != "0") {
$mffromtables[] = "maintforms";
$mfconstraints[] = "maintforms.mftech=\"$srchtech\"";
}
// subject
if ($srchsubj != "0") {
$mffromtables[] = "maintforms";
$mffromtables[] = "lognotes";
$mfconstraints[] = "maintforms.lognoteid=lognotes.lognoteid and lognotes.subject=\"$srchsubj\"";
}
// search text
if ($srchtext != "") {
$mffromtables[] = "maintforms";
$mffromtables[] = "maintactions";
$mfconstraints[] = "maintforms.mfmalfunction like \"%$srchtext%\" or (maintactions.action like \"%$srchtext%\" and maintforms.maintformid=maintactions.maintformnum)";
}
// uid
if ($srchuid != "any" && $srchuid != "") {
$mffromtables[] = "maintforms";
$mffromtables[] = "parts";
$mfconstraints[] = "maintforms.mfpart=parts.partid and parts.uid=\"{$srchuid}\"";
}
// part number
if ($srchpn != "any" && $srchpn != "") {
$mffromtables[] = "maintforms";
$mffromtables[] = "parts";
$mfconstraints[] = "maintforms.mfpart=parts.partid and parts.partnum=\"{$srchpn}\"";
}
// serial number
if ($srchsn != "any" && $srchsn != "") {
$mffromtables[] = "maintforms";
$mffromtables[] = "parts";
$mfconstraints[] = "maintforms.mfpart=parts.partid and parts.sernum=\"{$srchsn}\"";
}
// part name
if ($srchpname != "any" && $srchpname != "") {
$mffromtables[] = "maintforms";
$mffromtables[] = "parts";
$mfconstraints[] = "maintforms.mfpart=parts.partid and parts.partname like \"%{$srchpname}%\"";
}
// part location
if ($srchploc != "any" && $srchploc != "") {
$mffromtables[] = "parts";
$mffromtables[] = "maintforms";
$mfconstraints[] = "maintforms.mfpart=parts.partid and maintforms.mfpartloc like \"%{$srchploc}%\"";
}
// next higher assembly
if ($srchnha != "any" && $srchnha != "") {
$mffromtables[] = "parts";
$mffromtables[] = "maintforms";
$mfconstraints[] = "maintforms.mfpart=parts.partid and maintforms.nha like \"%{$srchnha}%\"";
}
// repair order
if ($srchrepord != "any" && $srchrepord != "") {
$mffromtables[] = "parts";
$mffromtables[] = "maintforms";
$mfconstraints[] = "maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
}
// flags
if (!empty($srchflags)) {
unset($flagconstraints);
$flagcount = count($srchflags);
$mffromtables[] = "maintforms";
$mffromtables[] = "flagmap";
$flagconstraints[] = "flagmap.maintformid=maintforms.maintformid and flagmap.flagid in (";
foreach ($srchflags as $thisflagid) {
$flagconstraints[] = "\"$thisflagid\"";
$flagconstraints[] = ",";
}
// remove final comma
array_splice($flagconstraints, -1, 1);
$flagconstraints[] = ") group by flagmap.maintformid having count(distinct flagmap.flagid)=$flagcount";
// make flagconstraints a single string so that the final implode doesn't split it
$mfconstraints[] = join('', $flagconstraints);
}
// build the clauses and run the query
$mffromclause = implode(",", array_unique($mffromtables));
$mfwhereclause = implode(" and ", $mfconstraints);
$mfrowqry = mysqli_query($db, "select maintforms.* from $mffromclause where $mfwhereclause order by maintforms.mfdate asc, maintforms.mftime asc");
}
if (in_array("part", $target)) {
// parts search
// define the query constraints
// log note id
if ($srchnoteid != "any" && $srchnoteid != "") {
$pfromtables[] = "parts";
$pfromtables[] = "logparts";
$pfromtables[] = "lognotes";
$pconstraints[] = "parts.partid=logparts.partid and logparts.lognoteid=lognotes.lognoteid and lognotes.lognoteid=\"$srchnoteid\"";
}
// maint form id
if ($srchmfid != "any" && $srchmfid != "") {
$pfromtables[] = "parts";
$pfromtables[] = "maintforms";
$pconstraints[] = "parts.partid=maintforms.mfpart and maintforms.maintformid=\"$srchmfid\"";
}
// date range doesn't apply to parts
// shift doesn't apply to parts
// tech doesn't apply to parts
// subject doesn't apply to parts
// search text doesn't apply to parts
// uid
if ($srchuid != "any" && $srchuid != "") {
$pfromtables[] = "parts";
$pconstraints[] = "parts.uid=\"{$srchuid}\"";
}
// part number
if ($srchpn != "any" && $srchpn != "") {
$pfromtables[] = "parts";
$pconstraints[] = "parts.partnum=\"{$srchpn}\"";
}
// serial number
if ($srchsn != "any" && $srchsn != "") {
$pfromtables[] = "parts";
$pconstraints[] = "parts.sernum=\"{$srchsn}\"";
}
// part name
if ($srchpname != "any" && $srchpname != "") {
$pfromtables[] = "parts";
$pconstraints[] = "parts.partname like \"%{$srchpname}%\"";
}
// part location
if ($srchploc != "any" && $srchploc != "") {
$pfromtables[] = "parts";
$pfromtables[] = "maintforms";
$pconstraints[] = "maintforms.mfpart=parts.partid and maintforms.mfpartloc like \"%{$srchploc}%\"";
}
// next higher assembly
if ($srchnha != "any" && $srchnha != "") {
$pfromtables[] = "parts";
$pfromtables[] = "maintforms";
$pconstraints[] = "maintforms.mfpart=parts.partid and maintforms.nha like \"%{$srchnha}%\"";
}
// repair order
if ($srchrepord != "any" && $srchrepord != "") {
$pfromtables[] = "parts";
$pfromtables[] = "maintforms";
$pconstraints[] = "maintforms.mfpart=parts.partid and maintforms.repord=\"{$srchrepord}\"";
}
// flags doesn't apply to parts
// build the clauses and run the query
$pfromclause = implode(",", array_unique($pfromtables));
$pwhereclause = implode(" and ", $pconstraints);
$prowqry = mysqli_query($db, "select parts.* from $pfromclause where $pwhereclause order by parts.uid asc");
}
}
// ******** end database manipulation ********
pagetable("begin");
if (!$print) {
pageblock("left", "begin");
sidemenu();
pageblock("left", "end");
}
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 (!$print) {
echo "
<form method=post action=\"search.php\">
<b>Log Note ID:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchnoteid\" size=\"7\" value=\"$noteidval\" title=\"Only show results with this Logbook Note ID number\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Maintenance Form ID:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchmfid\" size=\"7\" value=\"$mfidval\" title=\"Only show results with this Maintenance Form ID number\">
<br><br>
<b>Start Date:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchbdate\" size=\"10\" value=\"$bdateval\" id=\"startdatepicker\" title=\"Format: YYYY-MM-DD\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>End Date:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchedate\" size=\"10\" value=\"$edateval\" id=\"enddatepicker\" title=\"Format: YYYY-MM-DD\">
<br><br>
<b>Shift:</b>&nbsp;&nbsp;<select name=\"srchshift\" title=\"Only show results with this shift\">
";
if ($shiftval == 0) {
echo "<option value=\"0\" selected>any</option>";
} else {
echo "<option value=\"0\">any</option>";
}
$shiftrow = mysqli_query($db, "select * from shifts");
while ($shiftitem = mysqli_fetch_assoc($shiftrow)) {
if ($shiftitem['shiftid'] == $shiftval) {
printf("<option value=\"%s\" selected>%s</option>", $shiftitem['shiftid'], $shiftitem['shiftname']);
} else {
printf("<option value=\"%s\">%s</option>", $shiftitem['shiftid'], $shiftitem['shiftname']);
}
}
echo "
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Tech:</b>&nbsp;&nbsp;<select name=\"srchtech\" title=\"Only show results with this tech\">
";
if ($techval == 0) {
echo "<option value=\"0\" selected>any</option>";
} else {
echo "<option value=\"0\">any</option>";
}
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) {
printf("<option value=\"%s\" selected>%s</option>", $techitem['techid'], $techitem['techname']);
} else {
printf("<option value=\"%s\">%s</option>", $techitem['techid'], $techitem['techname']);
}
}
echo "
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Subject:</b>&nbsp;&nbsp;<select name=\"srchsubj\" title=\"Only show results with this subject\">
";
if ($subjval == 0) {
echo "<option value=\"0\" selected>any</option>";
} else {
echo "<option value=\"0\">any</option>";
}
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) {
printf("<option value=\"%s\" selected>%s</option>", $subjitem['subjectid'], $subjitem['subjectname']);
} else {
printf("<option value=\"%s\">%s</option>", $subjitem['subjectid'], $subjitem['subjectname']);
}
}
echo "
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><br>
";
if ($doparts) {
echo "
<b>$uidtext:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchuid\" size=\"8\" value=\"$uidval\" title=\"Only show results associated with this $uidtext\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Part Number:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchpn\" size=\"20\" value=\"$pnval\" title=\"Only show results associated with this part number\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Serial Number:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchsn\" size=\"20\" value=\"$snval\" title=\"Only show results associated with this serial number\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><br>
<b>Part Name:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchpname\" size=\"40\" value=\"$pnameval\" title=\"Only show results associated with this part name\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Part Location:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchploc\" size=\"20\" value=\"$plocval\" title=\"Only show results associated with this part location\">
<br><br>
<b>Next Higher Assembly:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchnha\" size=\"20\" value=\"$nhaval\" title=\"Only show results associated with this next higher assembly\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Repair Order:</b>&nbsp;&nbsp;<input type=\"text\" name=\"srchrepord\" size=\"12\" value=\"$repordval\" title=\"Only show results associated with this repair order number\">
<br><br>
";
}
echo "
<b>Text in Log Note, Discrepancy, or Maintenance Action:</b><br>
<textarea rows=\"3\" cols=\"70\" name=\"srchtext\" wrap=\"soft\" title=\"Only show results containing text similar to this\">$textval</textarea>
<br><br>
<b>Flags:</b>
";
$flagslist = mysqli_query($db, "select * from flags");
$flagsperline = 8;
$flagcount = 1;
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
//if ($srchflags[0] == "") $srchflags = [];
if (in_array($flagcheckbox["flagid"], $srchflags)) {
printf(
"<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" checked title=\"When checked, only results with this flag set will be shown\"><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=\"srchflags[]\" value=\"%s\" title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
$flagcheckbox["flagid"],
$flagcheckbox["flagcolor"],
$flagcheckbox["flagname"],
$flagcheckbox["flagsym"]
);
}
}
if ($flagcount < $flagsperline) {
echo "&nbsp;&nbsp;&nbsp;";
$flagcount++;
} else {
echo "<br>";
$flagcount = 1;
}
}
echo "
<br><br>
";
if ($doparts) {
echo "
<b>Search in:</b>&nbsp;&nbsp;
";
if ($target[0] == "") $target = [];
if (in_array("log", $target)) {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"log\" title=\"Search in Logbook\" checked>Logbook&nbsp;&nbsp;";
} else {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"log\" title=\"Search in Logbook\">Logbook&nbsp;&nbsp;";
}
if (in_array("maintform", $target)) {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"maintform\" title=\"Search in Maintenance Forms\" checked>Maintenance Forms&nbsp;&nbsp;";
} else {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"maintform\" title=\"Search in Maintenance Forms\">Maintenance Forms&nbsp;&nbsp;";
}
if (in_array("part", $target)) {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"part\" title=\"Search in Parts\" checked>Parts&nbsp;&nbsp;";
} else {
echo "<input type=\"checkbox\" name=\"target[]\" value=\"part\" title=\"Search in Parts\">Parts&nbsp;&nbsp;";
}
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
";
} else {
echo "<input type=\"hidden\" name=\"target[]\" value=\"log\">";
}
echo "
<input type=\"submit\" name=\"search\" value=\"Search\">
";
if ($search) {
$allvars = http_build_query($_REQUEST);
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"search.php?print=1&$allvars\" target=\"_blank\">Print Search Results</a>
";
}
echo "
</form>
<hr>
";
} else {
echo "
<b>Log Note ID:</b>&nbsp;&nbsp; $noteidval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Maintenance Form ID:</b>&nbsp;&nbsp; $mfidval
<br><br>
<b>Start Date:</b>&nbsp;&nbsp; $bdateval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>End Date:</b>&nbsp;&nbsp; $edateval
<br><br>
<b>Shift:</b>&nbsp;&nbsp;
";
if ($shiftval == 0) {
echo "any";
} else {
$shiftname = dblookup($db, "shifts", "shiftid", "shiftname", $shiftval);
echo "$shiftname";
}
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Tech:</b>&nbsp;&nbsp;
";
if ($techval == 0) {
echo "any";
} else {
$techname = dblookup($db, "techs", "techid", "techname", $techval);
echo "$techname";
}
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Subject:</b>&nbsp;&nbsp;
";
if ($subjval == 0) {
echo "any";
} else {
$subjname = dblookup($db, "subjects", "subjectid", "subjectname", $subjval);
echo "$subjname";
}
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><br>
";
if ($doparts) {
echo "
<b>$uidtext:</b>&nbsp;&nbsp; $uidval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Part Number:</b>&nbsp;&nbsp; $pnval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Serial Number:</b>&nbsp;&nbsp; $snval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br><br>
<b>Part Name:</b>&nbsp;&nbsp; $pnameval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Part Location:</b>&nbsp;&nbsp; $plocval
<br><br>
<b>Next Higher Assembly:</b>&nbsp;&nbsp; $nhaval &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<b>Repair Order:</b>&nbsp;&nbsp; $repordval
<br><br>
";
}
echo "
<b>Text in Log Note, Discrepancy, or Maintenance Action:</b><br>
$textval
<br><br>
<b>Flags:</b>
";
$flagslist = mysqli_query($db, "select * from flags");
$flagsperline = 8;
$flagcount = 1;
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
if ($srchflags) {
if ($srchflags[0] == "") $srchflags = [];
if (in_array($flagcheckbox["flagid"], $srchflags)) {
printf(
"<font color=\"%s\">%s</font>",
$flagcheckbox["flagcolor"],
$flagcheckbox["flagsym"]
);
}
}
if ($flagcount < $flagsperline) {
echo "&nbsp;&nbsp;&nbsp;";
$flagcount++;
} else {
echo "<br>";
$flagcount = 1;
}
}
echo "
<br><br>
";
if ($doparts) {
if ($target[0] == "") $target = [];
echo "
<b>Search in:</b>&nbsp;&nbsp;
";
if (in_array("log", $target)) {
echo "Logbook&nbsp;&nbsp;";
}
if (in_array("maintform", $target)) {
echo "Maintenance Forms&nbsp;&nbsp;";
}
if (in_array("part", $target)) {
echo "Parts&nbsp;&nbsp;";
}
echo "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
";
}
echo "
<hr>
";
}
if ($search) {
if ($target[0] == "") $target = [];
if (in_array("log", $target)) {
// run lognotes query and show results
$log_num_results = mysqli_num_rows($logrowqry);
if ($log_num_results) {
echo "
<b>Results from Logbook: $log_num_results</b><br><br>
<table border=\"1\" width=\"100%\">
<tr><th>Note ID</th><th>Date/Time</th><th>Shift</th><th>Tech</th><th>Subject</th><th>Note</th><th>References</th></tr>
";
while ($logtablerow = mysqli_fetch_assoc($logrowqry)) {
$logrefs = "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"logentry.php?refto=$logtablerow[lognoteid]\"><img src=\"icons/plus.png\" border=\"0\" title=\"Add referring note\" alt=\"Add referring note\"></a>";
if (islink($logtablerow['lognoteid'])) {
$logrefs = $logrefs . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"refchain.php?chainnote=$logtablerow[lognoteid]\"><img src=\"icons/magnifier--arrow.png\" border=\"0\" title=\"View ref chain\" alt=\"View ref chain\"></a>";
}
// convert the shift number to a name
$logshname = dblookup($db, "shifts", "shiftid", "shiftname", $logtablerow['shift']);
// convert tech number to name
$logtname = dblookup($db, "techs", "techid", "techname", $logtablerow['tech']);
//convert subject number to name
$logsubjname = dblookup($db, "subjects", "subjectid", "subjectname", $logtablerow['subject']);
// create links of urls in note
$logfmtnote = convertweblinks($logtablerow['lognote']);
// generate the flags string
$flagstring = "";
$flagqry = mysqli_query($db, "select flagid from flagmap where lognoteid=$logtablerow[lognoteid]");
while ($flagid = mysqli_fetch_row($flagqry)) {
$flagparams = mysqli_fetch_assoc(mysqli_query($db, "select * from flags where flagid=\"$flagid[0]\""));
$flagcolor = $flagparams["flagcolor"];
$flagsym = $flagparams["flagsym"];
$flagname = $flagparams["flagname"];
$flagstring = $flagstring . "<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font>&nbsp;&nbsp;";
}
if ($flagstring) {
$logfmtnote = $logfmtnote . "<br>" . $flagstring . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
} else {
$logfmtnote = $logfmtnote . "<br>";
}
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>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
</tr>",
$logtablerow['lognoteid'],
$logtablerow['lognoteid'],
$logtablerow['date'],
$logtablerow['time'],
$logshname,
$logtname,
$logsubjname,
$logfmtnote,
$logrefs
);
}
echo "</table><br><hr>";
} else {
echo "<font size=\"+1\">No Logbook notes match your search criteria.</font><br><hr>";
}
}
if ($target[0] == "") $target = [];
if (in_array("maintform", $target)) {
// run maintforms query and show results
$mf_num_results = mysqli_num_rows($mfrowqry);
if ($mf_num_results) {
echo "
<b>Results from Maintenance Forms: $mf_num_results</b><br><br>
<br><table border=\"1\" width=\"100%\">
<tr>
<th>ID</th>
<th>Date</th>
<th>Tech</th>
<th>$uidtext</th>
<th>Part Number</th>
<th>Serial Number</th>
<th>Part Name</th>
<th>Logbook<br>Note ID</th>
</tr>
";
while ($mfrow = mysqli_fetch_assoc($mfrowqry)) {
// look up part data
$mfuid = dblookup($db, "parts", "partid", "uid", $mfrow["mfpart"]);
if ($mfuid == "") $mfuid = "&nbsp;";
$mfpartno = dblookup($db, "parts", "partid", "partnum", $mfrow["mfpart"]);
if ($mfpartno == "") $mfpartno = "&nbsp;";
$mfserno = dblookup($db, "parts", "partid", "sernum", $mfrow["mfpart"]);
if ($mfserno == "") $mfserno = "&nbsp;";
$mfpartname = dblookup($db, "parts", "partid", "partname", $mfrow["mfpart"]);
if ($mfpartname == "") $mfpartname = "&nbsp;";
// look up tech name
$mftname = dblookup($db, "techs", "techid", "techname", $mfrow["mftech"]);
if ($mfrow["lognoteid"] == 0) {
$mfnoteidval = "&nbsp;";
$mfnotetag = "%s%s";
} else {
$mfnoteidval = $mfrow["lognoteid"];
$mfnotetag = "<a href=\"logentry.php?edit=1&noteid=%s\">%s</a>";
}
printf(
"<tr>
<td align=\"center\" valign=\"top\"><a href=\"maintformentry.php?mfedit=1&maintformid=%s\">%s</a></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">$mfnotetag</td>
</tr>",
$mfrow["maintformid"],
$mfrow["maintformid"],
$mfrow["mfdate"],
$mftname,
$mfuid,
$mfpartno,
$mfserno,
$mfpartname,
$mfnoteidval,
$mfnoteidval
);
}
echo "</table><br><hr>";
} else {
echo "<font size=\"+1\">No Maintenance Forms match your search criteria.</font><br><hr>";
}
}
if ($target[0] == "") $target = [];
if (in_array("part", $target)) {
// run parts query and show results
$p_num_results = mysqli_num_rows($prowqry);
if ($p_num_results) {
echo "
<b>Results from Parts: $p_num_results</b><br><br>
<table width=\"100%\" border=\"1\" cellpadding=\"5\">
<tr>
<th>Action</th>
<th>$uidtext</th>
<th>Part Number</th>
<th>Serial Number</th>
<th>Part Name</th>
</tr>
";
while ($partrow = mysqli_fetch_assoc($prowqry)) {
if ($loggedin) {
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>
</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>",
$partrow['partid'],
$partrow['uid'],
$partrow['partnum'],
$partrow['sernum'],
$partrow['partname']
);
} else {
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\">
</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>",
$partrow['uid'],
$partrow['partnum'],
$partrow['sernum'],
$partrow['partname']
);
}
echo "
</tr>
";
}
echo "</table><br><hr>";
} else {
echo "<font size=\"+1\">No Parts match your search criteria.</font><br><hr>";
}
}
} else {
echo "<font size=\"+1\">Use fields above to define your search.</font>";
}
banner($print);
pageblock("right", "end");
pagetable("end");
framework("end", "", "", $print);

View File

@@ -0,0 +1,63 @@
<?php
/*
settings.php
OpenLog Online Logbook
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
// determine today's date and time and assign them to variables
$today = date("Y-m-d");
$now = date("H:i:s");
$sttl = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"session_ttl_days\""))[0];
$ostype = strtoupper(substr(php_uname('s'), 0, 3));
if ($ostype == 'WIN') {
$sdir = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"win_server_session_dir\""))[0];
} else {
$sdir = mysqli_fetch_row(mysqli_query($db, "select confvalue from configs where confname=\"unix_server_session_dir\""))[0];
}
$lifetime = 60 * 60 * 24 * $sttl;
if (!is_dir($sdir)) mkdir($sdir, 0700, true);
ini_set('session.cookie_lifetime', $lifetime);
ini_set('session.gc_maxlifetime', $lifetime);
ini_set('session.save_path', $sdir);
$ss = session_status();
if ($ss == PHP_SESSION_NONE) session_start();
// get config options from database and assign them to constants
unset($techid);
if (isset($_SESSION['login']) && $_SESSION['login'] != '') {
$techid = $_SESSION['login'];
}
$configqry = mysqli_query($db, "select confname,confvalue,confid from configs");
while ($configrow = mysqli_fetch_assoc($configqry)) {
$constname = strtoupper($configrow["confname"]);
if (isset($techid)) {
$confid = $configrow["confid"];
$custqry = mysqli_query($db, "select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$techid\"");
if (mysqli_num_rows($custqry)) {
$custrow = mysqli_fetch_row($custqry);
$custval = $custrow[0];
} else {
unset($custval);
}
}
if (isset($custval)) {
$constvalue = $custval;
} else {
$constvalue = $configrow["confvalue"];
}
define("$constname", "$constvalue");
}
// error reporting
$logerrors = LOG_ERRORS;
if ($logerrors == 1) {
error_reporting(E_ALL);
} else {
error_reporting(0);
}

View File

@@ -193,7 +193,7 @@
fixed. Made the corrections to the edit code as well as the fixed. Made the corrections to the edit code as well as the
new entry. new entry.
- In logentry.php, the default times for notes entered using dates - In logentry.php, the default times for notes entered using dates
other than today's date contained a trailing coln that mysql other than today's date contained a trailing colon that mysql
didn't like. Removed trailing colons. didn't like. Removed trailing colons.
- Cleaned up the REQUEST importation in multiple files to default to - Cleaned up the REQUEST importation in multiple files to default to
NULL values for parameters not supplied to prevent warning NULL values for parameters not supplied to prevent warning
@@ -233,7 +233,7 @@
installers. installers.
5.2.4.4 - 2025-12-19 5.2.4.4 - 2025-12-19
- Fixed bugs that caused crashes on the Scheduled Maintenance page -Fixed bugs that caused crashes on the Scheduled Maintenance page
that were caused by more strict behavior of php regarding mysql that were caused by more strict behavior of php regarding mysql
queries. queries.
- Fixed bug where some functions defined in functions.php were not - Fixed bug where some functions defined in functions.php were not

View File

@@ -1,33 +1,28 @@
INSTALL Installation or upgrade of OpenDRS is straightforward.
OpenLog Online Logbook
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0 1. Unpack
Unpack the distribution in a convenient place. A directory will
created called OpenDRS-x.x.x/.
2. Review License
Change to the OpenDRS-x.x.x/ directory and review the LICENSE file.
Installation of OpenLog is straightforward. 3. Run the install script
In the same directory, type ./install.sh at a command prompt and
follow the prompts.
1. Gather the required information. 4. Log in
You'll need to know how to configure your web server. This means where Click on the Log In menu option on the main page. If this is a fresh
you want to put the files to be served and any configuration required to installation The initial user is drsadmin and the initial password
allow clients to reach them. You'll also need to know the username and is OpenDRS-1. It is highly recommended that you change this password
password of the MySQL administrator. to a strong one by going to the Manage Database page under the
Admin Functions menu. If this an upgrade, your current usernames and
passwords are unchanged.
2. Unpack 5. Configure
Unpack the distribution in a convenient place. The Admin Functions menu will be shown when logged in as an admin user.
A directory will be created called OpenLog-x.x.x. Click on Global Settings to set display options, page colors, banners, and
miscellaneous options. Click on Manage Database to set users, devices,
3. Review License subsystems, action reasons and when discovereds.
Change to the OpenLog-x.x.x directory and review the LICENSE file.
4. Run the install script
Type ./install.sh at a command prompt. Follow the prompts.
5. Check and set Configuration
Click on the Administration menu option on the main page to adjust the initial
settings. You will need to log in as OpenLogAdmin. The initial default password
is "OpenLog-1". From the Administration page, you can click on the links at the
top to add techs, subjects, shifts, etc.
7. Start using OpenLog.
6. Start making writeups

View File

@@ -1,384 +1,341 @@
The following license applies to all OpenLog code GNU GENERAL PUBLIC LICENSE
Copyright (C) 2016 by Rod Wright : Version 2, June 1991
GNU GENERAL PUBLIC LICENSE Copyright (C) 1989, 1991 Free Software Foundation, Inc.
Version 2, June 1991 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
Copyright (C) 1989, 1991 Free Software Foundation, Inc. of this license document, but changing it is not allowed.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies Preamble
of this license document, but changing it is not allowed.
The licenses for most software are designed to take away your
Preamble freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
The licenses for most software are designed to take away your software--to make sure the software is free for all its users. This
freedom to share and change it. By contrast, the GNU General Public General Public License applies to most of the Free Software
License is intended to guarantee your freedom to share and change free Foundation's software and to any other program whose authors commit to
software--to make sure the software is free for all its users. This using it. (Some other Free Software Foundation software is covered by
General Public License applies to most of the Free Software the GNU Library General Public License instead.) You can apply it to
Foundation's software and to any other program whose authors commit to your programs, too.
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to When we speak of free software, we are referring to freedom, not
your programs, too. price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
When we speak of free software, we are referring to freedom, not this service if you wish), that you receive source code or can get it
price. Our General Public Licenses are designed to make sure that you if you want it, that you can change the software or use pieces of it
have the freedom to distribute copies of free software (and charge for in new free programs; and that you know you can do these things.
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it To protect your rights, we need to make restrictions that forbid
in new free programs; and that you know you can do these things. anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
To protect your rights, we need to make restrictions that forbid distribute copies of the software, or if you modify it.
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you For example, if you distribute copies of such a program, whether
distribute copies of the software, or if you modify it. gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
For example, if you distribute copies of such a program, whether source code. And you must show them these terms so they know their
gratis or for a fee, you must give the recipients all the rights that rights.
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their We protect your rights with two steps: (1) copyright the software, and
rights. (2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy, Also, for each author's protection and ours, we want to make certain
distribute and/or modify the software. that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
Also, for each author's protection and ours, we want to make certain want its recipients to know that what they have is not the original, so
that everyone understands that there is no warranty for this free that any problems introduced by others will not reflect on the original
software. If the software is modified by someone else and passed on, we authors' reputations.
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original Finally, any free program is threatened constantly by software
authors' reputations. patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
Finally, any free program is threatened constantly by software program proprietary. To prevent this, we have made it clear that any
patents. We wish to avoid the danger that redistributors of a free patent must be licensed for everyone's free use or not licensed at all.
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any The precise terms and conditions for copying, distribution and
patent must be licensed for everyone's free use or not licensed at all. modification follow.
The precise terms and conditions for copying, distribution and GNU GENERAL PUBLIC LICENSE
modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
GNU GENERAL PUBLIC LICENSE 0. This License applies to any program or other work which contains
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The \"Program\", below,
0. This License applies to any program or other work which contains refers to any such program or work, and a \"work based on the Program\"
a notice placed by the copyright holder saying it may be distributed means either the Program or any derivative work under copyright law:
under the terms of this General Public License. The \"Program\", below, that is to say, a work containing the Program or a portion of it,
refers to any such program or work, and a \"work based on the Program\" either verbatim or with modifications and/or translated into another
means either the Program or any derivative work under copyright law: language. (Hereinafter, translation is included without limitation in
that is to say, a work containing the Program or a portion of it, the term \"modification\".) Each licensee is addressed as \"you\".
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in Activities other than copying, distribution and modification are not
the term \"modification\".) Each licensee is addressed as \"you\". covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
Activities other than copying, distribution and modification are not is covered only if its contents constitute a work based on the
covered by this License; they are outside its scope. The act of Program (independent of having been made by running the Program).
running the Program is not restricted, and the output from the Program Whether that is true depends on what the Program does.
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program). 1. You may copy and distribute verbatim copies of the Program's
Whether that is true depends on what the Program does. source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
1. You may copy and distribute verbatim copies of the Program's copyright notice and disclaimer of warranty; keep intact all the
source code as you receive it, in any medium, provided that you notices that refer to this License and to the absence of any warranty;
conspicuously and appropriately publish on each copy an appropriate and give any other recipients of the Program a copy of this License
copyright notice and disclaimer of warranty; keep intact all the along with the Program.
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License You may charge a fee for the physical act of transferring a copy, and
along with the Program. you may at your option offer warranty protection in exchange for a fee.
You may charge a fee for the physical act of transferring a copy, and 2. You may modify your copy or copies of the Program or any portion
you may at your option offer warranty protection in exchange for a fee. of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
2. You may modify your copy or copies of the Program or any portion above, provided that you also meet all of these conditions:
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1 a) You must cause the modified files to carry prominent notices
above, provided that you also meet all of these conditions: stating that you changed the files and the date of any change.
a) You must cause the modified files to carry prominent notices b) You must cause any work that you distribute or publish, that in
stating that you changed the files and the date of any change. whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
b) You must cause any work that you distribute or publish, that in parties under the terms of this License.
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third c) If the modified program normally reads commands interactively
parties under the terms of this License. when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
c) If the modified program normally reads commands interactively announcement including an appropriate copyright notice and a
when run, you must cause it, when started running for such notice that there is no warranty (or else, saying that you provide
interactive use in the most ordinary way, to print or display an a warranty) and that users may redistribute the program under
announcement including an appropriate copyright notice and a these conditions, and telling the user how to view a copy of this
notice that there is no warranty (or else, saying that you provide License. (Exception: if the Program itself is interactive but
a warranty) and that users may redistribute the program under does not normally print such an announcement, your work based on
these conditions, and telling the user how to view a copy of this the Program is not required to print an announcement.)
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on These requirements apply to the modified work as a whole. If
the Program is not required to print an announcement.) identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
These requirements apply to the modified work as a whole. If themselves, then this License, and its terms, do not apply to those
identifiable sections of that work are not derived from the Program, sections when you distribute them as separate works. But when you
and can be reasonably considered independent and separate works in distribute the same sections as part of a whole which is a work based
themselves, then this License, and its terms, do not apply to those on the Program, the distribution of the whole must be on the terms of
sections when you distribute them as separate works. But when you this License, whose permissions for other licensees extend to the
distribute the same sections as part of a whole which is a work based entire whole, and thus to each and every part regardless of who wrote it.
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the Thus, it is not the intent of this section to claim rights or contest
entire whole, and thus to each and every part regardless of who wrote it. your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
Thus, it is not the intent of this section to claim rights or contest collective works based on the Program.
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or In addition, mere aggregation of another work not based on the Program
collective works based on the Program. with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
In addition, mere aggregation of another work not based on the Program the scope of this License.
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under 3. You may copy and distribute the Program (or a work based on it,
the scope of this License. under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of a) Accompany it with the complete corresponding machine-readable
Sections 1 and 2 above provided that you also do one of the following: source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections b) Accompany it with a written offer, valid for at least three
1 and 2 above on a medium customarily used for software interchange; or, years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
b) Accompany it with a written offer, valid for at least three machine-readable copy of the corresponding source code, to be
years, to give any third party, for a charge no more than your distributed under the terms of Sections 1 and 2 above on a medium
cost of physically performing source distribution, a complete customarily used for software interchange; or,
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium c) Accompany it with the information you received as to the offer
customarily used for software interchange; or, to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
c) Accompany it with the information you received as to the offer received the program in object code or executable form with such
to distribute corresponding source code. (This alternative is an offer, in accord with Subsection b above.)
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such The source code for a work means the preferred form of the work for
an offer, in accord with Subsection b above.) making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
The source code for a work means the preferred form of the work for associated interface definition files, plus the scripts used to
making modifications to it. For an executable work, complete source control compilation and installation of the executable. However, as a
code means all the source code for all modules it contains, plus any special exception, the source code distributed need not include
associated interface definition files, plus the scripts used to anything that is normally distributed (in either source or binary
control compilation and installation of the executable. However, as a form) with the major components (compiler, kernel, and so on) of the
special exception, the source code distributed need not include operating system on which the executable runs, unless that component
anything that is normally distributed (in either source or binary itself accompanies the executable.
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component If distribution of executable or object code is made by offering
itself accompanies the executable. access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
If distribution of executable or object code is made by offering distribution of the source code, even though third parties are not
access to copy from a designated place, then offering equivalent compelled to copy the source along with the object code.
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not 4. You may not copy, modify, sublicense, or distribute the Program
compelled to copy the source along with the object code. except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
4. You may not copy, modify, sublicense, or distribute the Program void, and will automatically terminate your rights under this License.
except as expressly provided under this License. Any attempt However, parties who have received copies, or rights, from you under
otherwise to copy, modify, sublicense or distribute the Program is this License will not have their licenses terminated so long as such
void, and will automatically terminate your rights under this License. parties remain in full compliance.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such 5. You are not required to accept this License, since you have not
parties remain in full compliance. signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
5. You are not required to accept this License, since you have not prohibited by law if you do not accept this License. Therefore, by
signed it. However, nothing else grants you permission to modify or modifying or distributing the Program (or any work based on the
distribute the Program or its derivative works. These actions are Program), you indicate your acceptance of this License to do so, and
prohibited by law if you do not accept this License. Therefore, by all its terms and conditions for copying, distributing or modifying
modifying or distributing the Program (or any work based on the the Program or works based on it.
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying 6. Each time you redistribute the Program (or any work based on the
the Program or works based on it. Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
6. Each time you redistribute the Program (or any work based on the these terms and conditions. You may not impose any further
Program), the recipient automatically receives a license from the restrictions on the recipients' exercise of the rights granted herein.
original licensor to copy, distribute or modify the Program subject to You are not responsible for enforcing compliance by third parties to
these terms and conditions. You may not impose any further this License.
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to 7. If, as a consequence of a court judgment or allegation of patent
this License. infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
7. If, as a consequence of a court judgment or allegation of patent otherwise) that contradict the conditions of this License, they do not
infringement or for any other reason (not limited to patent issues), excuse you from the conditions of this License. If you cannot
conditions are imposed on you (whether by court order, agreement or distribute so as to satisfy simultaneously your obligations under this
otherwise) that contradict the conditions of this License, they do not License and any other pertinent obligations, then as a consequence you
excuse you from the conditions of this License. If you cannot may not distribute the Program at all. For example, if a patent
distribute so as to satisfy simultaneously your obligations under this license would not permit royalty-free redistribution of the Program by
License and any other pertinent obligations, then as a consequence you all those who receive copies directly or indirectly through you, then
may not distribute the Program at all. For example, if a patent the only way you could satisfy both it and this License would be to
license would not permit royalty-free redistribution of the Program by refrain entirely from distribution of the Program.
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to If any portion of this section is held invalid or unenforceable under
refrain entirely from distribution of the Program. any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
If any portion of this section is held invalid or unenforceable under circumstances.
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other It is not the purpose of this section to induce you to infringe any
circumstances. patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
It is not the purpose of this section to induce you to infringe any integrity of the free software distribution system, which is
patents or other property right claims or to contest validity of any implemented by public license practices. Many people have made
such claims; this section has the sole purpose of protecting the generous contributions to the wide range of software distributed
integrity of the free software distribution system, which is through that system in reliance on consistent application of that
implemented by public license practices. Many people have made system; it is up to the author/donor to decide if he or she is willing
generous contributions to the wide range of software distributed to distribute software through any other system and a licensee cannot
through that system in reliance on consistent application of that impose that choice.
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot This section is intended to make thoroughly clear what is believed to
impose that choice. be a consequence of the rest of this License.
This section is intended to make thoroughly clear what is believed to 8. If the distribution and/or use of the Program is restricted in
be a consequence of the rest of this License. certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
8. If the distribution and/or use of the Program is restricted in may add an explicit geographical distribution limitation excluding
certain countries either by patents or by copyrighted interfaces, the those countries, so that distribution is permitted only in or among
original copyright holder who places the Program under this License countries not thus excluded. In such case, this License incorporates
may add an explicit geographical distribution limitation excluding the limitation as if written in the body of this License.
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates 9. The Free Software Foundation may publish revised and/or new versions
the limitation as if written in the body of this License. of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
9. The Free Software Foundation may publish revised and/or new versions address new problems or concerns.
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to Each version is given a distinguishing version number. If the Program
address new problems or concerns. specifies a version number of this License which applies to it and \"any
later version\", you have the option of following the terms and conditions
Each version is given a distinguishing version number. If the Program either of that version or of any later version published by the Free
specifies a version number of this License which applies to it and \"any Software Foundation. If the Program does not specify a version number of
later version\", you have the option of following the terms and conditions this License, you may choose any version ever published by the Free Software
either of that version or of any later version published by the Free Foundation.
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software 10. If you wish to incorporate parts of the Program into other free
Foundation. programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
10. If you wish to incorporate parts of the Program into other free Software Foundation, write to the Free Software Foundation; we sometimes
programs whose distribution conditions are different, write to the author make exceptions for this. Our decision will be guided by the two goals
to ask for permission. For software which is copyrighted by the Free of preserving the free status of all derivatives of our free software and
Software Foundation, write to the Free Software Foundation; we sometimes of promoting the sharing and reuse of software generally.
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and NO WARRANTY
of promoting the sharing and reuse of software generally.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS REPAIR OR CORRECTION.
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
REPAIR OR CORRECTION. WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY POSSIBILITY OF SUCH DAMAGES.
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE END OF TERMS AND CONDITIONS
POSSIBILITY OF SUCH DAMAGES.
How to Apply These Terms to Your New Programs
END OF TERMS AND CONDITIONS
If you develop a new program, and you want it to be of the greatest
How to Apply These Terms to Your New Programs possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it To do so, attach the following notices to the program. It is safest
free software which everyone can redistribute and change under these terms. to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
To do so, attach the following notices to the program. It is safest the \"copyright\" line and a pointer to where the full notice is found.
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least <one line to give the program's name and a brief idea of what it does.>
the \"copyright\" line and a pointer to where the full notice is found. Copyright (C) <year> <name of author>
<one line to give the program's name and a brief idea of what it does.> This program is free software; you can redistribute it and/or modify
Copyright (C) <year> <name of author> it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
This program is free software; you can redistribute it and/or modify (at your option) any later version.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or This program is distributed in the hope that it will be useful,
(at your option) any later version. but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
This program is distributed in the hope that it will be useful, GNU General Public License for more details.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the You should have received a copy of the GNU General Public License
GNU General Public License for more details. along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
Also add information on how to contact you by electronic and paper mail. when it starts in an interactive mode:
If the program is interactive, make it output a short notice like this Gnomovision version 69, Copyright (C) year name of author
when it starts in an interactive mode: Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
Gnomovision version 69, Copyright (C) year name of author under certain conditions; type `show c' for details.
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it The hypothetical commands `show w' and `show c' should show the appropriate
under certain conditions; type `show c' for details. parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
The hypothetical commands `show w' and `show c' should show the appropriate mouse-clicks or menu items--whatever suits your program.
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be You should also get your employer (if you work as a programmer) or your
mouse-clicks or menu items--whatever suits your program. school, if any, to sign a \"copyright disclaimer\" for the program, if
necessary. Here is a sample; alter the names:
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a \"copyright disclaimer\" for the program, if Yoyodyne, Inc., hereby disclaims all copyright interest in the program
necessary. Here is a sample; alter the names: `Gnomovision' (which makes passes at compilers) written by James Hacker.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program <signature of Ty Coon>, 1 April 1989
`Gnomovision' (which makes passes at compilers) written by James Hacker. Ty Coon, President of Vice
<signature of Ty Coon>, 1 April 1989 This General Public License does not permit incorporating your program into
Ty Coon, President of Vice proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
This General Public License does not permit incorporating your program into library. If this is what you want to do, use the GNU Library General
proprietary programs. If your program is a subroutine library, you may Public License instead of this License.
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
The following license applies to jquery code :
Copyright jQuery Foundation and other contributors, https://jquery.org/
This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history
available at https://github.com/jquery/jquery-ui
The following license applies to all parts of this software except as
documented below:
====
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====
Copyright and related rights for sample code are waived via CC0. Sample
code is defined as all source code contained within the demos directory.
CC0: http://creativecommons.org/publicdomain/zero/1.0/

View File

@@ -1,94 +1,143 @@
<?php <?php
/* /*
about.php about.php
OpenLog Online Logbook OpenDRS Online Discrepancy Reporting System
Copyright (C) 2026 Rod Wright Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */
include("functions.php"); include("common.php");
$version = OL_VERSION; if (array_key_exists('print',$_REQUEST)) {
$print=true;
$print = $_REQUEST['print'] ?? NULL;
if ($print) {
$sbcolor = P_SIDEBAR_COLOR;
$mbgcolor = P_MENUBG_COLOR;
} else { } else {
$sbcolor = SIDEBAR_COLOR; $print=false;
$mbgcolor = MENUBG_COLOR;
} }
framework("begin", "About OpenLog", "About OpenLog", $print); // redirect to index.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:index.php");
exit();
}
// import session variables
if (isset($_SESSION['userid'])) $userid=$_SESSION['userid'];
// import incoming arrays
if ($print) {
// if printer friendly was clicked, values will be passed in serialized
// form as "all_parameters" so we need to load those into $incoming
$incoming=unserialize($_REQUEST['all_parameters']);
} else {
// copy $_REQUEST to $incoming
$incoming=arrayCopy($_REQUEST);
}
// extract incoming array keys into variables
// define local functions
// assign variables from constants
$appname=APP_NAME;
$drs_version=DRS_VERSION;
if ($print=="Printer Friendly") {
$mbgcolor=P_MENUBG_COLOR;
} else {
$mbgcolor=MENUBG_COLOR;
}
framework("begin","$appname","About OpenDRS",$print);
//echo "_REQUEST array <br>";
//var_dump($_REQUEST);
//echo "<br><hr> incoming array <br>";
//var_dump($incoming);
// ******** begin database manipulation ********
// ******** end database manipulation ********
pagetable("begin"); pagetable("begin");
if (!$print) { if (!$print) {
pageblock("left", "begin"); pageblock("left","begin");
sidemenu(); sidemenu();
pageblock("left", "end"); pageblock("left","end");
} }
pageblock("right", "begin"); pageblock("right","begin");
banner($print);
echo "<br>";
echo " echo "
<h3 align=\"center\"> <h3 align=\"center\">
OpenLog $version OpenDRS $drs_version Discrepancy Reporting System
</h3><br> </h3><br>
<p>This program is licensed under the terms of the <a href=\"gpl.php\">GNU General Public License</a>. Click on the link <p>This program is licensed under the terms of the <a href=\"gpl.php\">GNU General Public License</a>. Click on the link
or see the LICENSE file in the distribution to read it. OpenLog is Copyright (C) 2025 by Rod Wright.</p> or see the LICENSE file in the distribution to read it. OpenDRS is Copyright (C) 2025 by Rod Wright.
<p>
Although the code
that makes OpenLog work is Open Source, proprietary information may be safely entered into the OpenLog database without fear of affecting the status
of either that information or of OpenLog. This does not conflict with the terms of the GPL, since no database is distributed with OpenLog. If you give a copy of OpenLog to someone else (which you are encouraged to do), you do not need to give them your database
or anything contained therein.</p>
<p>
OpenLog is a simple online logbook application. It allows anyone with a web browser to read, enter, and search for
notes on any subject. The available shifts, employees, and subjects are easily configured. Notes can be referred to
other notes and the entire chain of referenced notes can be displayed in a single page. This makes it convenient to
track ongoing projects or actions on a particular piece of equipment over a long period of time. OpenLog also incorporates
part tracking functions that allow discrepancies and maintenence actions to be documented. Notes, parts, and maintenance
forms can be can be searched for based on a number of criteria. The look and feel of the OpenLog pages are easily changed.
Settings that affect all users can be changed in the Administration menu. User specific settings can be changed in the
My Profile menu. No browser specific HTML is used in OpenLog, so it should be useable in any browser, and it has been
tested using Google Chrome, Mozilla Firefox and Microsoft Internet Explorer.
</p> </p>
<p> <p>
To read about the <a href=\"CHANGELOG\" >changes</a> in this latest version of OpenLog, click on the link or see the CHANGELOG file in the distribution. OpenDRS is a simple online maintenance tracking/discrepancy reporting application. It allows anyone with a web browser to create,
view, and search writeups. The look and feel of the OpenDRS pages are easily changed.
Settings that affect all users can be changed in the Admin Functions menu. User specific settings can be changed in the
My Profile menu. No browser specific HTML is used in OpenDRS, so it should be useable in any browser, and it has been
tested using Google Chrome, Mozilla Firefox, Microsoft Internet Explorer, and Microsoft Edge.
</p>
<p>
OpenDRS is highly flexible. Instructions are included in the distribution for creating a user terminal with a Raspberry Pi. OpenDRS can be hosted on a
centralized server, accessed by networked PCs and/or Raspberry Pi terminals. It can also be hosted directly on a Raspberry Pi
terminal as a non-networked standalone system or in a small network of Raspberry Pi terminals.
</p>
<p>
To read about the <a href=\"changelog.php\" >changes</a> in this latest version of OpenDRS, click on the link or see the CHANGELOG file in the distribution.
</p> </p>
<p>Several pieces of Open Source software make OpenLog possible. <p>Several pieces of Open Source software make OpenDRS possible.
<br> <br>
<table border=0 cellpadding=20> <table border=0 cellpadding=20>
<tr> <tr>
<td><a href=\"http://www.linux.org\" target=\"_blank\"><img src=\"images/linux.png\" border=0></a></td><td><b>Linux</b></td><td>All <td><a href=\"http://www.linux.org\" target=\"_blank\"><img src=\"images/linux.png\" border=0></a></td><td><b>Linux</b></td><td>All
development and most of the testing of OpenLog was done on computers running the development and most of the testing of OpenDRS was done on computers running the
<a href=\"http://www.linux.org\" target=\"_blank\">Linux</a> operating system.</td> <a href=\"http://www.linux.org\" target=\"_blank\">Linux</a> operating system.</td>
</tr> </tr>
<tr> <tr>
<td><a href=\"http://www.php.net\" target=\"_blank\"><img src=\"images/php-small-trans-dark.gif\" <td><a href=\"http://www.php.net\" target=\"_blank\"><img src=\"images/php-small-trans-dark.gif\"
border=0></a></td><td><b>PHP</b></td><td>OpenLog is written in <a href=\"http://www.php.net\" target=\"_blank\">PHP</a>, a hypertext border=0></a></td><td><b>PHP</b></td><td>OpenDRS is written in <a href=\"http://www.php.net\" target=\"_blank\">PHP</a>, a hypertext
preprocessor, which makes possible the dynamic content of the pages.</td> preprocessor, which makes possible the dynamic content of the pages.</td>
</tr> </tr>
<tr> <tr>
<td><a href=\"http://www.mysql.com\" target=\"_blank\"><img src=\"images/poweredbymysql-125.png\" <td><a href=\"https://mariadb.org\" target=\"_blank\"><img src=\"images/mariadb-badge-180x60.png\"
border=0></a></td><td><b>MySQL</b></td><td>OpenLog stores its data in a <a href=\"http://www.mysql.com\" target=\"_blank\">MySQL</a> border=0></a></td><td><b>MariaDB</b></td><td>OpenDRS stores its data in a <a href=\"https://mariadb.org\" target=\"_blank\">MariaDB</a>
database.</td> database.</td>
</tr> </tr>
<tr> <tr>
<td><a href=\"http://http.apache.org\" target=\"_blank\"><img src=\"images/apache_pb.gif\" <td><a href=\"http://http.apache.org\" target=\"_blank\"><img src=\"images/apache_pb.gif\"
border=0></a></td><td><b>Apache</b></td><td>OpenLog was developed using the <a href=\"httpd.apache.org\" target=\"_blank\">Apache</a> web border=0></a></td><td><b>Apache</b></td><td>OpenDRS was developed using the <a href=\"httpd.apache.org\" target=\"_blank\">Apache</a> web
server.</td> server.</td>
</tr> </tr>
<tr> <tr>
<td><a href=\"http://p.yusukekamiyamane.com\" target=\"_blank\"><img src=\"images/Kamiyamane.png\" <td><a href=\"http://p.yusukekamiyamane.com\" target=\"_blank\"><img src=\"images/Kamiyamane.png\"
border=0></a></td><td><b>Fugue<br>Icons</b></td><td>The icons used in OpenLog are from the Fugue Icon set created by Yusuke Kamiyamane. The entire set is available at border=0></a></td><td><b>Fugue<br>Icons</b></td><td>The icons used in OpenDRS are from the Fugue Icon set created by Yusuke Kamiyamane. The entire set is available at
<a href=\"http://p.yusukekamiyamane.com/\" target=\"_blank\">p.yusukekamiyamane.com</a>, and are licensed under a <a href=\"http://p.yusukekamiyamane.com/\" target=\"_blank\">p.yusukekamiyamane.com</a>, and is licensed under the
<a href=\"http://creativecommons.org/licenses/by/3.0/legalcode\" target=\"_blank\">Creative Commons Attribution 3.0 License</a>.</td> <a href=\"http://creativecommons.org/licenses/by/3.0/legalcode\" target=\"_blank\">Creative Commons Attribution 3.0 License</a>.</td>
</tr> </tr>
</table> </table>
</p> </p>
"; ";
pageblock("right", "end");
echo "<br>";
banner($print);
pageblock("right","end");
pagetable("end"); pagetable("end");
framework("end", "", "", $print); framework("end","","",$print);
?>

92
distfiles/changelog.php Normal file
View File

@@ -0,0 +1,92 @@
<?php
/*
changelog.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("common.php");
if (array_key_exists('print',$_REQUEST)) {
$print=true;
} else {
$print=false;
}
// redirect to index.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:index.php");
exit();
}
// import session variables
if (isset($_SESSION['userid'])) $userid=$_SESSION['userid'];
// import incoming arrays
if ($print) {
// if printer friendly was clicked, values will be passed in serialized
// form as "all_parameters" so we need to load those into $incoming
$incoming=unserialize($_REQUEST['all_parameters']);
} else {
// copy $_REQUEST to $incoming
$incoming=arrayCopy($_REQUEST);
}
// extract incoming array keys into variables
// define local functions
// assign variables from constants
$appname=APP_NAME;
if ($print) {
$mbgcolor=P_MENUBG_COLOR;
} else {
$mbgcolor=MENUBG_COLOR;
}
$role=dblookup($drs_db,"users","id","role",$userid);
framework("begin","$appname","OpenDRS Change Log",$print);
//echo "_REQUEST array <br>";
//var_dump($_REQUEST);
//echo "<br><hr> incoming array <br>";
//var_dump($incoming);
// ******** begin database manipulation ********
// ******** end database manipulation ********
pagetable("begin");
if (!$print) {
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
echo "<br>";
echo "
<pre>
";
echo file_get_contents("CHANGELOG");
echo "
</pre>
";
echo "<br>";
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

View File

@@ -0,0 +1,149 @@
#pickerPanel { width: 360px; height: 240px; font: normal 11px verdana, sans-serif; color: #333; line-height: 19px; margin: 0; }
/* slider */
.dragPanel {
position: relative;
background-color: #eeeeee;
margin: 4px;
width: 260px;
height: 180px;
}
.dragPanel h4 {
background-color: #bbbbbb;
height: 10px;
margin: 0px;
cursor: move;
}
input { font-size: .85em }
.thumb {
cursor:default;
width:18px;
height:18px;
z-index: 9;
position:absolute;
}
.bg {
position:absolute;
left:10px;
height:18px;
width:146px;
border: 0px solid #aaaaaa;
}
.bg span, .bg p {
cursor:default;
position: relative;
font-size: 2px;
overflow: hidden;
color: #aaaaaa;
top: 4px;
height: 10px;
width: 4px;
display: block;
float:left;
}
.bg span {
border-top:1px solid #cccccc;
border-bottom:1px solid #cccccc;
}
.bg .lb {
border-left:1px solid #cccccc;
}
.bg .rb {
border-right:1px solid #cccccc;
}
#valdiv { position:absolute; top: 100px; left:10px; }
#rBG {top:30px}
#gBG {top:50px}
#bBG {top:70px}
#rgbSwatch {
position:absolute;
left:160px;
top:34px;
height:50px;
width:50px;
border:1px solid #aaaaaa;
}
#rgbPanel {
/*
top: 400px;
left: 20px;
*/
width: 360px;
height: 240px;
}
/* picker */
#hueThumb {
cursor:default;
width:18px;
height:18px;
z-index: 9;
position:absolute;
}
#hueBg {
position:absolute;
left:216px;
height:198px;
width:18px;
background:url(../img/hue.png) no-repeat;
top:18px;
}
#pickerDiv {
position:absolute;
left:10px;
height:187px;
width:188px;
/*
background:url(../img/pickerbg.png) no-repeat;
*/
top:20px;
}
#pickerbg {
position:absolute;
z-index: 1;
top:0px;
left:0px;
}
#selector {
cursor:default;
width:11px;
height:11px;
z-index: 9;
position:absolute;
top:0px;
left:0px;
}
#pickerSwatch {
position:absolute;
left:260px;
top:30px;
height:60px;
width:60px;
border:2px solid #aaaaaa;
}
#pickervaldiv { text-align:right; position:absolute; top: 86px; left:246px; }
.colorbox{
width: 25px;
height: 14px;
border: 1px solid black;
border-bottom-width: 0;
}

View File

@@ -0,0 +1,196 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"
xmlns:x2="http://www.w3.org/TR/xhtml2"
xmlns:role="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#"
xmlns:state="http://www.w3.org/2005/07/aaa">
<head>
<title>YUI Color Picker</title>
<link rel="stylesheet" type="text/css" href="css/screen.css">
<script type="text/javascript" src="js/ddcolorposter.js"></script>
<script type="text/javascript" src="js/YAHOO.js" ></script>
<script type="text/javascript2" src="js/log.js" ></script>
<script type="text/javascript" src="js/color.js" ></script>
<script type="text/javascript" src="js/event.js" ></script>
<script type="text/javascript" src="js/dom.js" ></script>
<script type="text/javascript" src="js/animation.js" ></script>
<script type="text/javascript" src="js/dragdrop.js" ></script>
<script type="text/javascript" src="js/slider.js" ></script>
<script type="text/javascript">
var hue;
var picker;
//var gLogger;
var dd1, dd2;
var r, g, b;
function init() {
if (typeof(ygLogger) != "undefined")
ygLogger.init(document.getElementById("logDiv"));
pickerInit();
ddcolorposter.fillcolorbox("colorfield1", "colorbox1") //PREFILL "colorbox1" with hex value from "colorfield1"
ddcolorposter.fillcolorbox("colorfield2", "colorbox2") //PREFILL "colorbox1" with hex value from "colorfield1"
}
// Picker ---------------------------------------------------------
function pickerInit() {
hue = YAHOO.widget.Slider.getVertSlider("hueBg", "hueThumb", 0, 180);
hue.onChange = function(newVal) { hueUpdate(newVal); };
picker = YAHOO.widget.Slider.getSliderRegion("pickerDiv", "selector",
0, 180, 0, 180);
picker.onChange = function(newX, newY) { pickerUpdate(newX, newY); };
hueUpdate();
dd1 = new YAHOO.util.DD("pickerPanel");
dd1.setHandleElId("pickerHandle");
dd1.endDrag = function(e) {
// picker.thumb.resetConstraints();
// hue.thumb.resetConstraints();
};
}
executeonload(init);
function pickerUpdate(newX, newY) {
pickerSwatchUpdate();
}
function hueUpdate(newVal) {
var h = (180 - hue.getValue()) / 180;
if (h == 1) { h = 0; }
var a = YAHOO.util.Color.hsv2rgb( h, 1, 1);
document.getElementById("pickerDiv").style.backgroundColor =
"rgb(" + a[0] + ", " + a[1] + ", " + a[2] + ")";
pickerSwatchUpdate();
}
function pickerSwatchUpdate() {
var h = (180 - hue.getValue());
if (h == 180) { h = 0; }
document.getElementById("pickerhval").value = (h*2);
h = h / 180;
var s = picker.getXValue() / 180;
document.getElementById("pickersval").value = Math.round(s * 100);
var v = (180 - picker.getYValue()) / 180;
document.getElementById("pickervval").value = Math.round(v * 100);
var a = YAHOO.util.Color.hsv2rgb( h, s, v );
document.getElementById("pickerSwatch").style.backgroundColor =
"rgb(" + a[0] + ", " + a[1] + ", " + a[2] + ")";
document.getElementById("pickerrval").value = a[0];
document.getElementById("pickergval").value = a[1];
document.getElementById("pickerbval").value = a[2];
var hexvalue = document.getElementById("pickerhexval").value =
YAHOO.util.Color.rgb2hex(a[0], a[1], a[2]);
ddcolorposter.initialize(a[0], a[1], a[2], hexvalue)
}
</script>
<!--[if gte IE 5.5000]>
<script type="text/javascript">
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}
YAHOO.util.Event.addListener(window, "load", correctPNG);
</script>
<![endif]-->
</head>
<body>
<h3>Color Picker</h3>
<p>
Implements a slider region and a vertical slider to implement an HSV color
picker.
</p>
<div id="pickerPanel" class="dragPanel">
<h4 id="pickerHandle">&nbsp;</h4>
<div id="pickerDiv">
<img id="pickerbg" src="img/pickerbg.png" alt="">
<div id="selector"><img src="img/select.gif"></div>
</div>
<div id="hueBg">
<div id="hueThumb"><img src="img/hline.png"></div>
</div>
<div id="pickervaldiv">
<form name="pickerform" onsubmit="return pickerUpdate()">
<br />
R <input name="pickerrval" id="pickerrval" type="text" value="0" size="3" maxlength="3" />
H <input name="pickerhval" id="pickerhval" type="text" value="0" size="3" maxlength="3" />
<br />
G <input name="pickergval" id="pickergval" type="text" value="0" size="3" maxlength="3" />
S <input name="pickergsal" id="pickersval" type="text" value="0" size="3" maxlength="3" />
<br />
B <input name="pickerbval" id="pickerbval" type="text" value="0" size="3" maxlength="3" />
V <input name="pickervval" id="pickervval" type="text" value="0" size="3" maxlength="3" />
<br />
<br />
# <input name="pickerhexval" id="pickerhexval" type="text" value="0" size="6" maxlength="6" />
<br />
</form>
</div>
<div id="pickerSwatch">&nbsp;</div>
</div>
</div>
</div>
</div>
<form>
# <input type="text" id="colorfield1" onFocus="ddcolorposter.echocolor(this, 'colorbox1')"> <span id="colorbox1" class="colorbox">____</span> <br />
# <input type="text" id="colorfield2" onFocus="ddcolorposter.echocolor(this, 'colorbox2')"> <span id="colorbox2" class="colorbox">____</span>
</form>
More info: <a href="http://www.dynamicdrive.com/dynamicindex11/yuicolorpicker/">YUI Color Picker script</a>.
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 B

View File

@@ -0,0 +1,60 @@
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
/**
* @class The Yahoo global namespace
*/
var YAHOO = function() {
return {
/**
* Yahoo presentation platform utils namespace
*/
util: {},
/**
* Yahoo presentation platform widgets namespace
*/
widget: {},
/**
* Yahoo presentation platform examples namespace
*/
example: {},
/**
* Returns the namespace specified and creates it if it doesn't exist
*
* YAHOO.namespace("property.package");
* YAHOO.namespace("YAHOO.property.package");
*
* Either of the above would create YAHOO.property, then
* YAHOO.property.package
*
* @param {String} sNameSpace String representation of the desired
* namespace
* @return {Object} A reference to the namespace object
*/
namespace: function( sNameSpace ) {
if (!sNameSpace || !sNameSpace.length) {
return null;
}
var levels = sNameSpace.split(".");
var currentNS = YAHOO;
// YAHOO is implied, so it is ignored if it is included
for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
currentNS[levels[i]] = currentNS[levels[i]] || {};
currentNS = currentNS[levels[i]];
}
return currentNS;
}
};
} ();

View File

@@ -0,0 +1,39 @@
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
YAHOO.util.Anim=function(el,attributes,duration,method)
{if(el){this.init(el,attributes,duration,method);}};YAHOO.util.Anim.prototype={doMethod:function(attribute,start,end){return this.method(this.currentFrame,start,end-start,this.totalFrames);},setAttribute:function(attribute,val,unit){YAHOO.util.Dom.setStyle(this.getEl(),attribute,val+unit);},getAttribute:function(attribute){return parseFloat(YAHOO.util.Dom.getStyle(this.getEl(),attribute));},defaultUnits:{opacity:' '},defaultUnit:'px',init:function(el,attributes,duration,method){var isAnimated=false;var startTime=null;var endTime=null;var actualFrames=0;var defaultValues={};el=YAHOO.util.Dom.get(el);this.attributes=attributes||{};this.duration=duration||1;this.method=method||YAHOO.util.Easing.easeNone;this.useSeconds=true;this.currentFrame=0;this.totalFrames=YAHOO.util.AnimMgr.fps;this.getEl=function(){return el;};this.setDefault=function(attribute,val){if(val=='auto'){switch(attribute){case'width':val=el.clientWidth||el.offsetWidth;break;case'height':val=el.clientHeight||el.offsetHeight;break;case'left':if(YAHOO.util.Dom.getStyle(el,'position')=='absolute'){val=el.offsetLeft;}else{val=0;}
break;case'top':if(YAHOO.util.Dom.getStyle(el,'position')=='absolute'){val=el.offsetTop;}else{val=0;}
break;default:val=0;}}
defaultValues[attribute]=val;}
this.getDefault=function(attribute){return defaultValues[attribute];};this.isAnimated=function(){return isAnimated;};this.getStartTime=function(){return startTime;};this.animate=function(){this.onStart.fire();this._onStart.fire();this.totalFrames=(this.useSeconds)?Math.ceil(YAHOO.util.AnimMgr.fps*this.duration):this.duration;YAHOO.util.AnimMgr.registerElement(this);var attributes=this.attributes;var el=this.getEl();var val;for(var attribute in attributes){val=this.getAttribute(attribute);this.setDefault(attribute,val);}
isAnimated=true;actualFrames=0;startTime=new Date();};this.stop=function(){this.currentFrame=0;endTime=new Date();var data={time:endTime,duration:endTime-startTime,frames:actualFrames,fps:actualFrames/this.duration};isAnimated=false;actualFrames=0;this.onComplete.fire(data);};var onTween=function(){var start;var end=null;var val;var unit;var attributes=this['attributes'];for(var attribute in attributes){unit=attributes[attribute]['unit']||this.defaultUnits[attribute]||this.defaultUnit;if(typeof attributes[attribute]['from']!='undefined'){start=attributes[attribute]['from'];}else{start=this.getDefault(attribute);}
if(typeof attributes[attribute]['to']!='undefined'){end=attributes[attribute]['to'];}else if(typeof attributes[attribute]['by']!='undefined'){end=start+attributes[attribute]['by'];}
if(end!==null&&typeof end!='undefined'){val=this.doMethod(attribute,start,end);if((attribute=='width'||attribute=='height'||attribute=='opacity')&&val<0){val=0;}
this.setAttribute(attribute,val,unit);}}
actualFrames+=1;};this._onStart=new YAHOO.util.CustomEvent('_onStart',this);this.onStart=new YAHOO.util.CustomEvent('start',this);this.onTween=new YAHOO.util.CustomEvent('tween',this);this._onTween=new YAHOO.util.CustomEvent('_tween',this);this.onComplete=new YAHOO.util.CustomEvent('complete',this);this._onTween.subscribe(onTween);}};YAHOO.util.AnimMgr=new function(){var thread=null;var queue=[];var tweenCount=0;this.fps=200;this.delay=1;this.registerElement=function(tween){if(tween.isAnimated()){return false;}
queue[queue.length]=tween;tweenCount+=1;this.start();};this.start=function(){if(thread===null){thread=setInterval(this.run,this.delay);}};this.stop=function(tween){if(!tween)
{clearInterval(thread);for(var i=0,len=queue.length;i<len;++i){if(queue[i].isAnimated()){queue[i].stop();}}
queue=[];thread=null;tweenCount=0;}
else{tween.stop();tweenCount-=1;if(tweenCount<=0){this.stop();}}};this.run=function(){for(var i=0,len=queue.length;i<len;++i){var tween=queue[i];if(!tween||!tween.isAnimated()){continue;}
if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null)
{tween.currentFrame+=1;if(tween.useSeconds){correctFrame(tween);}
tween.onTween.fire();tween._onTween.fire();}
else{YAHOO.util.AnimMgr.stop(tween);}}};var correctFrame=function(tween){var frames=tween.totalFrames;var frame=tween.currentFrame;var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);var elapsed=(new Date()-tween.getStartTime());var tweak=0;if(elapsed<tween.duration*1000){tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{tweak=frames-(frame+1);}
if(tweak>0&&isFinite(tweak)){if(tween.currentFrame+tweak>=frames){tweak=frames-(frame+1);}
tween.currentFrame+=tweak;}};}
YAHOO.util.Bezier=new function()
{this.getPosition=function(points,t)
{var n=points.length;var tmp=[];for(var i=0;i<n;++i){tmp[i]=[points[i][0],points[i][1]];}
for(var j=1;j<n;++j){for(i=0;i<n-j;++i){tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}
return[tmp[0][0],tmp[0][1]];};};YAHOO.util.Easing=new function(){this.easeNone=function(t,b,c,d){return b+c*(t/=d);};this.easeIn=function(t,b,c,d){return b+c*((t/=d)*t*t);};this.easeOut=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(tc+-3*ts+3*t);};this.easeBoth=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(-2*tc+3*ts);};this.backIn=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(-3.4005*tc*ts+10.2*ts*ts+-6.2*tc+0.4*ts);};this.backOut=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(8.292*tc*ts+-21.88*ts*ts+22.08*tc+-12.69*ts+5.1975*t);};this.backBoth=function(t,b,c,d){var ts=(t/=d)*t;var tc=ts*t;return b+c*(0.402*tc*ts+-2.1525*ts*ts+-3.2*tc+8*ts+-2.05*t);};};YAHOO.util.Motion=function(el,attributes,duration,method){if(el){this.initMotion(el,attributes,duration,method);}};YAHOO.util.Motion.prototype=new YAHOO.util.Anim();YAHOO.util.Motion.prototype.defaultUnits.points='px';YAHOO.util.Motion.prototype.doMethod=function(attribute,start,end){var val=null;if(attribute=='points'){var translatedPoints=this.getTranslatedPoints();var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;if(translatedPoints){val=YAHOO.util.Bezier.getPosition(translatedPoints,t);}}else{val=this.method(this.currentFrame,start,end-start,this.totalFrames);}
return val;};YAHOO.util.Motion.prototype.getAttribute=function(attribute){var val=null;if(attribute=='points'){val=[this.getAttribute('left'),this.getAttribute('top')];if(isNaN(val[0])){val[0]=0;}
if(isNaN(val[1])){val[1]=0;}}else{val=parseFloat(YAHOO.util.Dom.getStyle(this.getEl(),attribute));}
return val;};YAHOO.util.Motion.prototype.setAttribute=function(attribute,val,unit){if(attribute=='points'){YAHOO.util.Dom.setStyle(this.getEl(),'left',val[0]+unit);YAHOO.util.Dom.setStyle(this.getEl(),'top',val[1]+unit);}else{YAHOO.util.Dom.setStyle(this.getEl(),attribute,val+unit);}};YAHOO.util.Motion.prototype.initMotion=function(el,attributes,duration,method){YAHOO.util.Anim.call(this,el,attributes,duration,method);attributes=attributes||{};attributes.points=attributes.points||{};attributes.points.control=attributes.points.control||[];this.attributes=attributes;var start;var end=null;var translatedPoints=null;this.getTranslatedPoints=function(){return translatedPoints;};var translateValues=function(val,self){var pageXY=YAHOO.util.Dom.getXY(self.getEl());val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];return val;};var onStart=function(){start=this.getAttribute('points');var attributes=this.attributes;var control=attributes['points']['control']||[];if(control.length>0&&control[0].constructor!=Array){control=[control];}
if(YAHOO.util.Dom.getStyle(this.getEl(),'position')=='static'){YAHOO.util.Dom.setStyle(this.getEl(),'position','relative');}
if(typeof attributes['points']['from']!='undefined'){YAHOO.util.Dom.setXY(this.getEl(),attributes['points']['from']);start=this.getAttribute('points');}
else if((start[0]===0||start[1]===0)){YAHOO.util.Dom.setXY(this.getEl(),YAHOO.util.Dom.getXY(this.getEl()));start=this.getAttribute('points');}
var i,len;if(typeof attributes['points']['to']!='undefined'){end=translateValues(attributes['points']['to'],this);for(i=0,len=control.length;i<len;++i){control[i]=translateValues(control[i],this);}}else if(typeof attributes['points']['by']!='undefined'){end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];for(i=0,len=control.length;i<len;++i){control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}
if(end){translatedPoints=[start];if(control.length>0){translatedPoints=translatedPoints.concat(control);}
translatedPoints[translatedPoints.length]=end;}};this._onStart.subscribe(onStart);};YAHOO.util.Scroll=function(el,attributes,duration,method){if(el){YAHOO.util.Anim.call(this,el,attributes,duration,method);}};YAHOO.util.Scroll.prototype=new YAHOO.util.Anim();YAHOO.util.Scroll.prototype.defaultUnits.scroll=' ';YAHOO.util.Scroll.prototype.doMethod=function(attribute,start,end){var val=null;if(attribute=='scroll'){val=[this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{val=this.method(this.currentFrame,start,end-start,this.totalFrames);}
return val;}
YAHOO.util.Scroll.prototype.getAttribute=function(attribute){var val=null;var el=this.getEl();if(attribute=='scroll'){val=[el.scrollLeft,el.scrollTop];}else{val=parseFloat(YAHOO.util.Dom.getStyle(el,attribute));}
return val;};YAHOO.util.Scroll.prototype.setAttribute=function(attribute,val,unit){var el=this.getEl();if(attribute=='scroll'){el.scrollLeft=val[0];el.scrollTop=val[1];}else{YAHOO.util.Dom.setStyle(el,attribute,val+unit);}};

View File

@@ -0,0 +1,101 @@
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
YAHOO.util.Color = new function() {
// Adapted from http://www.easyrgb.com/math.html
// hsv values = 0 - 1
// rgb values 0 - 255
this.hsv2rgb = function (h, s, v) {
var r, g, b;
if ( s == 0 ) {
r = v * 255;
g = v * 255;
b = v * 255;
} else {
// h must be < 1
var var_h = h * 6;
if ( var_h == 6 ) {
var_h = 0;
}
//Or ... var_i = floor( var_h )
var var_i = Math.floor( var_h );
var var_1 = v * ( 1 - s );
var var_2 = v * ( 1 - s * ( var_h - var_i ) );
var var_3 = v * ( 1 - s * ( 1 - ( var_h - var_i ) ) );
if ( var_i == 0 ) {
var_r = v;
var_g = var_3;
var_b = var_1;
} else if ( var_i == 1 ) {
var_r = var_2;
var_g = v;
var_b = var_1;
} else if ( var_i == 2 ) {
var_r = var_1;
var_g = v;
var_b = var_3
} else if ( var_i == 3 ) {
var_r = var_1;
var_g = var_2;
var_b = v;
} else if ( var_i == 4 ) {
var_r = var_3;
var_g = var_1;
var_b = v;
} else {
var_r = v;
var_g = var_1;
var_b = var_2
}
r = var_r * 255 //rgb results = 0 ÷ 255
g = var_g * 255
b = var_b * 255
}
return [Math.round(r), Math.round(g), Math.round(b)];
};
this.rgb2hex = function (r,g,b) {
return this.toHex(r) + this.toHex(g) + this.toHex(b);
};
this.hexchars = "0123456789ABCDEF";
this.toHex = function(n) {
n = n || 0;
n = parseInt(n, 10);
if (isNaN(n)) n = 0;
n = Math.round(Math.min(Math.max(0, n), 255));
return this.hexchars.charAt((n - n % 16) / 16) + this.hexchars.charAt(n % 16);
};
this.toDec = function(hexchar) {
return this.hexchars.indexOf(hexchar.toUpperCase());
};
this.hex2rgb = function(str) {
var rgb = [];
rgb[0] = (this.toDec(str.substr(0, 1)) * 16) +
this.toDec(str.substr(1, 1));
rgb[1] = (this.toDec(str.substr(2, 1)) * 16) +
this.toDec(str.substr(3, 1));
rgb[2] = (this.toDec(str.substr(4, 1)) * 16) +
this.toDec(str.substr(5, 1));
// gLogger.debug("hex2rgb: " + str + ", " + rgb.toString());
return rgb;
};
this.isValidRGB = function(a) {
if ((!a[0] && a[0] !=0) || isNaN(a[0]) || a[0] < 0 || a[0] > 255) return false;
if ((!a[1] && a[1] !=0) || isNaN(a[1]) || a[1] < 0 || a[1] > 255) return false;
if ((!a[2] && a[2] !=0) || isNaN(a[2]) || a[2] < 0 || a[2] > 255) return false;
return true;
};
}

View File

@@ -0,0 +1,43 @@
/*
======================================================================
ddcolorposter.js: By Dynamic Drive (http://www.dynamicdrive.com)
Communicates between Yahoo Color Picker and form fields on your page
Created: Feb 20th, 06'
======================================================================
*/
function executeonload(functionref){
if (window.addEventListener)
window.addEventListener("load", functionref, false)
else if (window.attachEvent)
window.attachEvent("onload", functionref)
else if (document.getElementById)
window.onload=functionref
}
var ddcolorposter={
initialize:function(r,g,b, hexvalue){
this.rvalue=r //store red value
this.gvalue=g //store green value
this.bvalue=b //store blue value
this.hexvalue=hexvalue //store combined hex value
if (typeof this.targetobj!="undefined"){
this.targetobj.value=this.hexvalue //set field to selected hex color value
if (typeof this.divobj!="undefined") //set adjacent div to selected hex color value
this.divobj.style.backgroundColor="#"+this.hexvalue
}
},
echocolor:function(inputobj, divID){
this.targetobj=inputobj
this.divobj=document.getElementById(divID)
this.targetobj.onblur=function(){
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1) //if field contains valid hex value
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
}
},
fillcolorbox:function(inputID, divID){
var inputobj=document.getElementById(inputID)
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1) //if field contains valid hex value
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
}
}

View File

@@ -0,0 +1,26 @@
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
YAHOO.util.Dom=new function(){this.get=function(el){if(typeof el=='string'){el=document.getElementById(el);}
return el;};this.getStyle=function(el,property){var value=null;var dv=document.defaultView;el=this.get(el);if(property=='opacity'&&el.filters){value=1;try{value=el.filters.item('DXImageTransform.Microsoft.Alpha').opacity/100;}catch(e){try{value=el.filters.item('alpha').opacity/100;}catch(e){}}}
else if(el.style[property]){value=el.style[property];}
else if(el.currentStyle&&el.currentStyle[property]){value=el.currentStyle[property];}
else if(dv&&dv.getComputedStyle)
{var converted='';for(i=0,len=property.length;i<len;++i){if(property.charAt(i)==property.charAt(i).toUpperCase()){converted=converted+'-'+property.charAt(i).toLowerCase();}else{converted=converted+property.charAt(i);}}
if(dv.getComputedStyle(el,'').getPropertyValue(converted)){value=dv.getComputedStyle(el,'').getPropertyValue(converted);}}
return value;};this.setStyle=function(el,property,val){el=this.get(el);switch(property){case'opacity':if(el.filters){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle.hasLayout){el.style.zoom=1;}}else{el.style.opacity=val;el.style['-moz-opacity']=val;el.style['-khtml-opacity']=val;}
break;default:el.style[property]=val;}};this.getXY=function(el){el=this.get(el);if(el.parentNode===null||this.getStyle(el,'display')=='none'){return false;}
var parent=null;var pos=[];var box;if(el.getBoundingClientRect){box=el.getBoundingClientRect();var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;var scrollLeft=document.documentElement.scrollLeft||document.body.scrollLeft;return[box.left+scrollLeft,box.top+scrollTop];}
else if(document.getBoxObjectFor){box=document.getBoxObjectFor(el);pos=[box.x,box.y];}
else{pos=[el.offsetLeft,el.offsetTop];parent=el.offsetParent;if(parent!=el){while(parent){pos[0]+=parent.offsetLeft;pos[1]+=parent.offsetTop;parent=parent.offsetParent;}}
var ua=navigator.userAgent.toLowerCase();if(ua.indexOf('opera')!=-1||(ua.indexOf('safari')!=-1&&this.getStyle(el,'position')=='absolute')){pos[1]-=document.body.offsetTop;}}
if(el.parentNode){parent=el.parentNode;}
else{parent=null;}
while(parent&&parent.tagName!='BODY'&&parent.tagName!='HTML'){pos[0]-=parent.scrollLeft;pos[1]-=parent.scrollTop;if(parent.parentNode){parent=parent.parentNode;}
else{parent=null;}}
return pos;};this.getX=function(el){return this.getXY(el)[0];};this.getY=function(el){return this.getXY(el)[1];};this.setXY=function(el,pos,noRetry){el=this.get(el);var pageXY=YAHOO.util.Dom.getXY(el);if(pageXY===false){return false;}
var delta=[parseInt(YAHOO.util.Dom.getStyle(el,'left'),10),parseInt(YAHOO.util.Dom.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=0;}
if(isNaN(delta[1])){delta[1]=0;}
if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';}
if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';}
var newXY=this.getXY(el);if(!noRetry&&(newXY[0]!=pos[0]||newXY[1]!=pos[1])){this.setXY(el,pos,true);}
return true;};this.setX=function(el,x){return this.setXY(el,[x,null]);};this.setY=function(el,y){return this.setXY(el,[null,y]);};this.getRegion=function(el){el=this.get(el);return new YAHOO.util.Region.getRegion(el);};this.getClientWidth=function(){return(document.documentElement.offsetWidth||document.body.offsetWidth);};this.getClientHeight=function(){return(self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight);};};YAHOO.util.Region=function(t,r,b,l){this.top=t;this.right=r;this.bottom=b;this.left=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&&region.right<=this.right&&region.top>=this.top&&region.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+" t: "+this.top+", r: "+this.right+", b: "+this.bottom+", l: "+this.left+"}");}
YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){this.x=x;this.y=y;this.top=y;this.right=x;this.bottom=y;this.left=x;};YAHOO.util.Point.prototype=new YAHOO.util.Region();

1
distfiles/colorpicker/js/dragdrop.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,34 @@
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
YAHOO.util.Key = new function() {
// this.logger = new ygLogger("ygEventUtil");
// DOM key constants
this.DOM_VK_UNDEFINED = 0x0;
this.DOM_VK_RIGHT_ALT = 0x12;
this.DOM_VK_LEFT_ALT = 0x12;
this.DOM_VK_LEFT_CONTROL = 0x11;
this.DOM_VK_RIGHT_CONTROL = 0x11;
this.DOM_VK_LEFT_SHIFT = 0x10;
this.DOM_VK_RIGHT_SHIFT = 0x10;
this.DOM_VK_META = 0x9D;
this.DOM_VK_BACK_SPACE = 0x08;
this.DOM_VK_CAPS_LOCK = 0x14;
this.DOM_VK_DELETE = 0x7F;
this.DOM_VK_END = 0x23;
this.DOM_VK_ENTER = 0x0D;
this.DOM_VK_ESCAPE = 0x1B;
this.DOM_VK_HOME = 0x24;
this.DOM_VK_NUM_LOCK = 0x90;
this.DOM_VK_PAUSE = 0x13;
this.DOM_VK_PRINTSCREEN = 0x9A;
this.DOM_VK_SCROLL_LOCK = 0x91;
this.DOM_VK_SPACE = 0x20;
this.DOM_VK_TAB = 0x09;
this.DOM_VK_LEFT = 0x25;
this.DOM_VK_RIGHT = 0x27;
this.DOM_VK_UP = 0x26;
this.DOM_VK_DOWN = 0x28;
this.DOM_VK_PAGE_DOWN = 0x22;
this.DOM_VK_PAGE_UP = 0x21;
};

View File

@@ -0,0 +1,89 @@
/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
/**
* @class a general logging class. Expects to be initalized with a reference
* to a html element to write to.
*
* @constructor
* @param {String} sModuleName the name of the module this instance belongs
* to. Used in the log message to help id where the msg came from.
*/
function ygLogger(sModuleName) {
if (this.setModuleName)
this.setModuleName(sModuleName);
}
ygLogger.DEBUG_ENABLED = true;
ygLogger.targetEl = null;
ygLogger.logStack = [];
ygLogger.startLog = new Date().getTime();
ygLogger.lastLog = new Date().getTime();
ygLogger.locked = true;
ygLogger.logTimeout = null;
ygLogger.init = function(oHostElement) {
if (oHostElement) {
ygLogger.targetEl = oHostElement;
} else {
// create element or create window?
}
};
ygLogger.prototype.setModuleName = function(sModuleName) {
this.logName = sModuleName;
};
ygLogger.prototype.debug = function() {
if (ygLogger.DEBUG_ENABLED) {
var newDate = new Date();
var newTime = newDate.getTime();
var timeStamp = newTime - ygLogger.lastLog;
var totalSeconds = (newTime - ygLogger.startLog) / 1000;
ygLogger.lastLog = newTime;
for (var i = 0; i < arguments.length; i++) {
ygLogger.logStack[ygLogger.logStack.length] =
timeStamp + " ms(" + totalSeconds + ") " +
newDate.toLocaleTimeString() + "<br />" +
this.logName + ": <b>" + arguments[i] + "</b>";
}
if (ygLogger.logTimeout == null) {
ygLogger.logTimeout = setTimeout("ygLogger._outputMessages()" , 1);
}
}
};
ygLogger.disable = function() {
ygLogger.DEBUG_ENABLED = false;
try { ygLogger.targetEl.style.visibility = "hidden"; } catch(e) {}
};
ygLogger.enable = function() {
ygLogger.DEBUG_ENABLED = true;
try { ygLogger.targetEl.style.visibility = ""; } catch(e) {}
};
ygLogger._outputMessages = function() {
if (ygLogger.targetEl != null) {
for (var i = 0; i < ygLogger.logStack.length; i++) {
var sMsg = ygLogger.logStack[i];
var oNewElement = ygLogger.targetEl.appendChild(
document.createElement("p"));
oNewElement.innerHTML = sMsg;
}
ygLogger.logStack = [];
ygLogger.targetEl.scrollTop = ygLogger.targetEl.scrollHeight;
// debugger;
}
ygLogger.logTimeout = null;
};

File diff suppressed because one or more lines are too long

866
distfiles/common.php Normal file
View File

@@ -0,0 +1,866 @@
<?php
/*
common.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
// test for correct installation
if (!file_exists("db.php")) {
echo "
<html>
<head>
<meta http-equiv=\"x-ua-compatible\" content=\"IE=edge\">
<title>Installation error</title>
</head>
<body>
Could not find the db.php file required for this installation.
</body>
</html>
";
exit();
}
include("db.php");
include("settings.php");
// assign variables from constants
$device_term=DEVICE_TERM;
$discovered_term=DISCOVERED_TERM;
$discovered_term_short=DISCOVERED_TERM_SHORT;
$functional_term=FUNCTIONAL_TERM;
$functional_term_short=FUNCTIONAL_TERM_SHORT;
$disc_drop_data=DISC_DROP_DATA;
$functional_yes=FUNCTIONAL_YES;
$functional_no=FUNCTIONAL_NO;
$functional_yes_short=FUNCTIONAL_YES_SHORT;
$functional_no_short=FUNCTIONAL_NO_SHORT;
$access_mode=ACCESS_MODE;
// define some other constants
define("ADMIN",2);
define("USER",1);
// build the basic color array
$basic_colors=array(
"White" => "#FFFFFF",
"Silver" => "#C0C0C0",
"Gray" => "#808080",
"Black" => "#000000",
"Red" => "#FF0000",
"Maroon" => "#800000",
"Orange" => "#FFA500",
"Yellow" => "#FFFF00",
"Olive" => "#808000",
"Lime" => "#00FF00",
"Green" => "#008000",
"Aqua" => "#00FFFF",
"Teal" => "#008080",
"Blue" => "#0000FF",
"Navy" => "#000080",
"Fuchsia" => "#FF00FF",
"Purple" => "#800080");
// Determine access mode, login status, and admin status
if ($access_mode == "trusted") $trusted=true; else $trusted=false;
$loggedin=$isadmin=false;
if (isset($_SESSION['userid'])) {
$uid=$_SESSION['userid'];
$loggedin=true;
if (mysqli_fetch_row(mysqli_query($drs_db,"select role from users where id=\"$uid\""))[0] == ADMIN) {
$isadmin=true;
}
}
// Generic functions
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 sidemenu/pagetable
// htmltitle is the page title that appears in the window titlebar
// pagetitle is what will appear as the title of the page itself
// print is whether to format for printing or not
if ($print) {
$bgcolor=P_BACKGROUND_COLOR;
$textcolor=P_TEXT_COLOR;
$linkcolor=P_LINK_COLOR;
$vlinkcolor=P_VLINK_COLOR;
$hdgcolor=P_HEADING_COLOR;
} else {
$bgcolor=BACKGROUND_COLOR;
$textcolor=TEXT_COLOR;
$linkcolor=LINK_COLOR;
$vlinkcolor=VLINK_COLOR;
$hdgcolor=HEADING_COLOR;
}
echo "
<html>
<head>
<meta http-equiv=\"x-ua-compatible\" content=\"IE=edge\">
<title>$htmltitle</title>
<style type=\"text/css\">
* {font-family: Arial, Helvetica, sans-serif;}
table.writeup {table-layout:fixed;}
td.forcewrap {word-wrap: break-word;}
</style>
<style type=\"text/css\">
.fixed {
position:fixed;
}
</style>
<script>
function goBack() {
window.history.back()
}
</script>
<link href=\"jquery-ui/jquery-ui.css\" rel=\"stylesheet\">
<link href=\"jquery-ui/jquery.multiselect.css\" rel=\"stylesheet\">
<style>div.ui-datepicker{font-size:12px;}</style>
<link rel=\"stylesheet\" type=\"text/css\" href=\"colorpicker/css/screen.css\">
<script type=\"text/javascript\" src=\"colorpicker/js/ddcolorposter.js\"></script>
<script type=\"text/javascript\" src=\"colorpicker/js/YAHOO.js\" ></script>
<script type=\"text/javascript2\" src=\"colorpicker/js/log.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/color.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/event.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/dom.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/animation.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/dragdrop.js\" ></script>
<script type=\"text/javascript\" src=\"colorpicker/js/slider.js\" ></script>
<script type=\"text/javascript\">
var hue;
var picker;
//var gLogger;
var dd1, dd2;
var r, g, b;
function init() {
if (typeof(ygLogger) != \"undefined\")
ygLogger.init(document.getElementById(\"logDiv\"));
pickerInit();
ddcolorposter.fillcolorbox(\"bgcfield\", \"bgcbox\")
ddcolorposter.fillcolorbox(\"mbgcfield\", \"mbgcbox\")
ddcolorposter.fillcolorbox(\"tcfield\", \"tcbox\")
ddcolorposter.fillcolorbox(\"lcfield\", \"lcbox\")
ddcolorposter.fillcolorbox(\"vlcfield\", \"vlcbox\")
ddcolorposter.fillcolorbox(\"hcfield\", \"hcbox\")
}
// Picker ---------------------------------------------------------
function pickerInit() {
hue = YAHOO.widget.Slider.getVertSlider(\"hueBg\", \"hueThumb\", 0, 180);
hue.onChange = function(newVal) { hueUpdate(newVal); };
picker = YAHOO.widget.Slider.getSliderRegion(\"pickerDiv\", \"selector\",
0, 180, 0, 180);
picker.onChange = function(newX, newY) { pickerUpdate(newX, newY); };
hueUpdate();
dd1 = new YAHOO.util.DD(\"pickerPanel\");
dd1.setHandleElId(\"pickerHandle\");
dd1.endDrag = function(e) {
// picker.thumb.resetConstraints();
// hue.thumb.resetConstraints();
};
}
executeonload(init);
function pickerUpdate(newX, newY) {
pickerSwatchUpdate();
}
function hueUpdate(newVal) {
var h = (180 - hue.getValue()) / 180;
if (h == 1) { h = 0; }
var a = YAHOO.util.Color.hsv2rgb( h, 1, 1);
document.getElementById(\"pickerDiv\").style.backgroundColor =
\"rgb(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";
pickerSwatchUpdate();
}
function pickerSwatchUpdate() {
var h = (180 - hue.getValue());
if (h == 180) { h = 0; }
document.getElementById(\"pickerhval\").value = (h*2);
h = h / 180;
var s = picker.getXValue() / 180;
document.getElementById(\"pickersval\").value = Math.round(s * 100);
var v = (180 - picker.getYValue()) / 180;
document.getElementById(\"pickervval\").value = Math.round(v * 100);
var a = YAHOO.util.Color.hsv2rgb( h, s, v );
document.getElementById(\"pickerSwatch\").style.backgroundColor =
\"rgb(\" + a[0] + \", \" + a[1] + \", \" + a[2] + \")\";
document.getElementById(\"pickerrval\").value = a[0];
document.getElementById(\"pickergval\").value = a[1];
document.getElementById(\"pickerbval\").value = a[2];
var hexvalue = document.getElementById(\"pickerhexval\").value =
YAHOO.util.Color.rgb2hex(a[0], a[1], a[2]);
ddcolorposter.initialize(a[0], a[1], a[2], hexvalue)
}
</script>
</head>
";
echo "
<body bgcolor=\"#$bgcolor\" text=\"#$textcolor\" link=\"#$linkcolor\" vlink=\"#$vlinkcolor\">
";
if ($htmltitle || $pagetitle) {
echo "<font size=5 color=\"#$hdgcolor\"><b> $htmltitle - $pagetitle</b></font>";
if ($print) {
echo "
&nbsp;&nbsp;&nbsp;<input type=\"button\" onClick=\"window.print()\" value=\"Print\" id=\"printbutton\">
&nbsp;&nbsp;&nbsp;<input type=\"button\" onClick=\"window.close()\" value=\"Close\" id=\"closebutton\">
";
}
echo "<br>";
}
} else if ($option=="end") {
echo "
<script src=\"jquery-ui/external/jquery/jquery.js\"></script>
<script src=\"jquery-ui/jquery-ui.js\"></script>
<script src=\"jquery-ui/jquery.multiselect.js\"></script>
<script>
$( \".sidemenu\").addClass(\"fixed\");
$( \":button, :submit, :reset\" ).button();
$( \"#singledatepicker, #reportdatepicker, #actiondatepicker, [id|='onedp']\" ).datepicker({
showOn: \"focus\",
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
$( \"#startdatepicker, [id|='sdp']\" ).datepicker({
showOn: \"focus\",
buttonImage: \"icons/calendar.gif\",
buttonImageOnly: true,
buttonText: \"Select start date\",
inline: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
$( \"#enddatepicker, [id|='edp']\" ).datepicker({
showOn: \"focus\",
buttonImage: \"icons/calendar.gif\",
buttonImageOnly: true,
buttonText: \"Select end date\",
inline: true,
showButtonPanel: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\"
});
$( \"#logoutall\" ).checkboxradio({
icon: false
});
$( \"#device, #subsystem, #discoveredselect, #functional, [id|='sel']\" ).selectmenu();
$( \"#status, #user, #reason\" ).selectmenu();
$( \"#showdays\" ).selectmenu( { width : 130 } );
$( \"#subsystem, #discovered, #searchstatus, #pass, #passconf\").tooltip();
$( \"[id|='ms']\").multiselect();
$( \"#configtabs, #dbadmintabs, #profiletabs\" ).tabs();
</script>
</body>
</html>
";
} else {
echo "
<br>Invalid option \"$option\" passed to framework(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
}
function pagetable($option) {
if ($option=="begin") {
echo "
<br>
<table border=\"0\" width=\"100%\" cellpadding=\"10\">
<tr>
";
} else if ($option=="end") {
echo "
</tr></table>
";
} else {
echo "
<br>Invalid option \"$option\" passed to pagetable(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
}
function pageblock($block,$option) {
if ($block=="left") {
if ($option=="begin") {
echo "
<td width=\"210\" valign=\"top\">
";
} else if ($option=="end") {
echo "
</td>
";
} else {
echo "
<br>Invalid option \"$option\" passed to pageblock(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
} else if ($block=="right") {
if ($option=="begin") {
echo "
<td valign=\"top\">
";
} else if ($option=="end") {
if (defined("FOOTER_MESSAGE")) {
$footer_msg=FOOTER_MESSAGE;
echo "
<br><br>
<center>$footer_msg</center><br>
";
}
echo "
</td>
";
} else {
echo "
<br>Invalid option \"$option\" passed to pageblock(). Valid options are \"begin\" and \"end\".<br>
";
exit(1);
}
} else {
echo "
<br>Invalid block \"$block\" passed to pageblock(). Valid blocks are \"left\" and \"right\".<br>
";
exit(1);
}
}
function sidemenu($printable=true) {
// Displays sidebar menu
global $drs_db,$mbgcolor,$trusted,$loggedin,$isadmin;
if ($trusted || $loggedin) {
echo "
<div class=\"sidemenu\">
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"create.php\" title=\"Create new writeup\"><font size=\"+1\"><b>Create New Writeup</b></font></a></td></tr>
</table>
<br>";
}
echo "
<center><button onclick=\"goBack()\">Go Back</button></center>
";
if ($trusted || $loggedin) {
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"writeups.php\" title=\"View writeups\">View Writeups</a></td></tr>
<tr><td align=\"center\"><a href=\"groups.php\" title=\"View writeup groups\">Writeup Groups</a></td></tr>
<tr><td align=\"center\"><a href=\"search.php\">Search Writeups</a></td></tr>
</table>
<br>
";
if ($isadmin) {
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><b>Admin Functions</b></td></tr>
<tr><td align=\"center\"><a href=\"config.php\" title=\"Control global settings. Must be an administrator.\">Global Settings</a></td></tr>
<tr><td align=\"center\"><a href=\"dbadmin.php\" title=\"Manage the database. Must be an administrator.\">Manage Database</a></td></tr>
<tr><td align=\"center\"><a href=\"https://localhost:10000\" title=\"Webmin for managing a terminal. Webmin must be running on localhost.\">Manage Terminal</a></td></tr>
</table>
<br>
";
}
}
if (! $loggedin) {
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><b>My Account</b></td></tr>
<tr><td align=\"center\"><a href=\"login.php\"><b>Log In</b></a></td></tr>
</table>
<br>";
} else {
$menuuser=$_SESSION['userid'];
$loggedinas=mysqli_fetch_row(mysqli_query($drs_db,"select firstname,lastname from users where id=\"$menuuser\""));
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><b>My Account</b></td></tr>
<tr><td align=\"center\">Logged in as $loggedinas[0] $loggedinas[1]</td></tr><tr><td align=\"center\"><a href=\"login.php?cancel=1\"><b>Log Out</b></a></td></tr>
<tr><td align=\"center\"><a href=\"profile.php\">My Profile</a></td></tr>
</table>
<br>";
}
if ($printable) {
$currentparams=arrayCopy($_REQUEST);
echo "
<br>
<center>
<form method=\"post\" target=\"_blank\">
<input type=\"hidden\" name=\"all_parameters\" value=\"". htmlentities(serialize($currentparams))."\">
<input type=\"submit\" name=\"print\" value=\"Show Printable\" id=\"showprintable\"></form>
</center>
";
}
echo "
<br>
<table style=\"table-layout:fixed;width:210px;\" bgcolor=\"#$mbgcolor\" border=\"1\" width=\"100%\">
<tr><td align=\"center\"><a href=\"about.php\">About</a></td></tr>
</table>
</div>
";
}
function banner($print) {
// displays a banner
global $drs_db;
$bannerid=BANNER;
// get banner parameters from banner table
$banrow=mysqli_fetch_assoc(mysqli_query($drs_db,"select * from banners where bannerid=\"$bannerid\""));
if (!$banrow) {
$bannerid=1;
} else {
$bannertext=$banrow["bannername"];
if ($print) {
$bannercolor="#FFFFFF";
$bannertxtcolor="#000000";
} else {
$bannercolor=$banrow["bannercolor"];
$bannertxtcolor=$banrow["textcolor"];
}
}
if ($bannerid != 1) {
echo "
<table width=\"100%\">
<tr bgcolor=\"$bannercolor\" align=\"center\"><td colspan=2><font size=\"+1\" color=\"$bannertxtcolor\"><b>$bannertext</b></font></td></tr></table>
";
}
}
function dblookup($drs_db,$table,$in_field,$out_field,$in_data) {
// look up a single field in a database given a value for a single field
$lookup_result=(mysqli_query($drs_db,"select $out_field from $table where $in_field=\"$in_data\""));
if (mysqli_num_rows($lookup_result) > 0) {
$out_data=mysqli_fetch_row($lookup_result);
return($out_data[0]);
} else {
return NULL;
}
}
function arrayCopy( array $array ) {
$result=[];
foreach( $array as $key => $val ) {
if( is_array( $val ) ) {
$result[$key] = arrayCopy( $val );
} elseif ( is_object( $val ) ) {
$result[$key] = clone $val;
} else {
$result[$key] = $val;
}
}
return $result;
}
function validateDate($date, $format = 'Y-m-d') {
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
}
function validateTime($time, $format = 'H:i:s') {
$t = DateTime::createFromFormat($format, $time);
return $t && $t->format($format) == $time;
}
function validate_password($pass,$passconf) {
// run some checks on supplied passwords
// returns a two element array
// first element is true if passwords match, false if not
// second element is true if passwords meet complexity requirements, false if not
$results=[];
// check for match
if ($pass==$passconf) {
$results['match']=true;
} else {
$results['match']=false;
}
// check for complexity
// length
if (strlen($pass) < 8) {
$passlength=false;
} else {
$passlength=true;
}
// upper case
if (preg_match('/[A-Z]/',$pass)) {
$hasupper=true;
} else {
$hasupper=false;
}
// lower case
if (preg_match('/[a-z]/',$pass)) {
$haslower=true;
} else {
$haslower=false;
}
// number
if (preg_match('/[0-9]/',$pass)) {
$hasnumber=true;
} else {
$hasnumber=false;
}
// special character
if (preg_match('/[[:punct:]]/',$pass)) {
$hasspecial=true;
} else {
$hasspecial=false;
}
if ($passlength && $hasupper && $haslower && $hasnumber && $hasspecial) {
$results['complex']=true;
} else {
$results['complex']=false;
}
return $results;
}
function displaywriteup($id) {
// grab some important global variables
global $device_term;
global $discovered_term, $discovered_term_short, $disc_drop_data;
global $functional_term, $functional_term_short;
global $functional_yes, $functional_no;
global $functional_yes_short, $functional_no_short;
global $drs_db;
$writeupdata=mysqli_fetch_assoc(mysqli_query($drs_db,"select * from writeups where id=\"$id\""));
// determine status indicator
if ($writeupdata['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
if ($writeupdata['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
if ($writeupdata['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
// determine functional indicator
if($writeupdata["functional"]==1) {
$funcind="<font color=\"#00FF00\" title=\"$functional_yes\">$functional_yes_short</font>";
} else {
$funcind="<font color=\"#FF0000\" title=\"$functional_no\">$functional_no_short</font>";
}
// look up text data
$devicename=dblookup($drs_db,"devices","id","name",$writeupdata["device"]);
$subsystemname=dblookup($drs_db,"subsystems","id","name",$writeupdata["subsystem"]);
$subsystemdesc=dblookup($drs_db,"subsystems","id","description",$writeupdata["subsystem"]);
$discrtxt=$writeupdata["discrepancy_text"];
$rdate=$writeupdata["report_date"];
$rtime=$writeupdata["report_time"];
$repby=$writeupdata["reported_by"];
$whendiscoveredname=dblookup($drs_db,"discovered","id","whendiscoveredname",$writeupdata["discovered"]);
$whendiscovereddesc=dblookup($drs_db,"discovered","id","whendiscovereddesc",$writeupdata["discovered"]);
$techfname=dblookup($drs_db,"users","id","firstname",$writeupdata["action_by"]);
$techlname=dblookup($drs_db,"users","id","lastname",$writeupdata["action_by"]);
$reasonname=dblookup($drs_db,"reasons","id","text",$writeupdata["action_reason"]);
$actxt=$writeupdata["action_text"];
$adate=$writeupdata["action_date"];
if ($adate=="0000-00-00") $adate="";
$atime=$writeupdata["action_time"];
// determine if this is a member of a group
$member_qry=mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$writeupdata['id']}\"");
$is_member=mysqli_num_rows($member_qry);
if ($is_member) {
$group_count=$is_member;
$member_group=mysqli_fetch_row($member_qry)[0];
$member_group_name=dblookup($drs_db,"groups","id","name",$member_group);
if ($member_group_name) {
$imgtitle="Member of group: $member_group_name";
} else {
$imgtitle="Member of group ID: $member_group";
}
if ($group_count == 1) {
$group_ind="<a href=\"groups.php?group=$member_group\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
} else {
$group_ind="<a href=\"writeupdetail.php?id={$writeupdata['id']}\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"Member of $group_count groups. Click here to view.\"></a></div>";
}
} else {
$group_ind=NULL;
}
echo "
<table border=\"2\" width=\"100%\"><tr><td>
<table border=\"0\">
<tr><td><b>ID:</b> <a href=\"writeupdetail.php?id=$id\" title=\"View or change details of this writeup\">$id</a></td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>$statusind</b></td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>$device_term:</b> $devicename</td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>Subsystem:</b> <font title=\"$subsystemdesc\">$subsystemname</font></td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>$discovered_term:</b> <font title=\"$whendiscovereddesc\">$whendiscoveredname</font></td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>$funcind</b></td>
</tr>
</table>
<table border=\"0\">
<tr>
<td><b>Discrepancy:</b><br>$discrtxt</td><td>&nbsp;&nbsp;&nbsp;</td>
<td align=\"right\" valign=\"bottom\">$group_ind</td>
</tr>
</table>
<table border=\"0\">
<tr>
<td><b>Report date:</b> $rdate</td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>Report time:</b> $rtime</td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>Reported by:</b> $repby</td>
</tr>
</table>
<hr>
<table border=\"0\">
<tr>
<td><b>Action taken by:</b> $techfname $techlname</td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>Status change reason:</b> $reasonname</td>
</tr>
</table>
<table border=\"0\">
<tr>
<td><b>Action taken:</b><br>$actxt</td>
</tr>
</table>
<table border=\"0\">
<tr>
<td><b>Action date:</b> $adate</td><td>&nbsp;&nbsp;&nbsp;</td>
<td><b>Action time:</b> $atime</td>
</tr>
</table>
</td></tr></table>
";
}
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
if ($msgtype == 0) {
$state="ui-state-highlight";
$icon="ui-icon-info";
} else {
$state="ui-state-error";
$icon="ui-icon-alert";
}
if ($msgtxt == "") $msgtxt="PROGRAM ERROR: No message text was supplied.";
echo "
<div class=\"$state ui-corner-all\" style=\"margin-top: 20px; padding: 0 .7em;\">
<p><span class=\"ui-icon $icon\" style=\"float: left; margin-right: .3em;\"></span>
$msgtxt</p>
</div><br><br>
";
}
function getsetting($setting_name,$user_id) {
// get the value of a setting for a user
global $drs_db;
$confqry=mysqli_query($drs_db,"select id,value from config where name=\"$setting_name\"");
$confvalue=mysqli_fetch_assoc($confqry)['value'];
$userqry=mysqli_query($drs_db,"select value from profile where name=\"$setting_name\" and user=\"$user_id\"");
if (mysqli_num_rows($userqry) > 0) {
$uservalue=mysqli_fetch_assoc($userqry)['value'];
if ($uservalue) {
return $uservalue;
} else {
return $confvalue;
}
} else {
return $confvalue;
}
}
function putsetting($setting_name,$setting_value,$user_id) {
// set the value of a setting for a tech
global $drs_db;
$confqry=mysqli_query($drs_db,"select value from config where name=\"$setting_name\"");
$confvalue=mysqli_fetch_assoc($confqry)['value'];
$userqry=mysqli_query($drs_db,"select value from profile where name=\"$setting_name\" and user=\"$user_id\"");
if (mysqli_num_rows($userqry) > 0) {
$uservalue=mysqli_fetch_assoc($userqry)['value'];
if ($setting_value==$confvalue) {
mysqli_query($drs_db,"delete from profile where user=\"$user_id\" and name=\"$setting_name\"");
} else {
if ($uservalue) {
if ($uservalue != $setting_value) mysqli_query($drs_db,"update profile set value=\"$setting_value\" where name=\"$setting_name\" and user=\"$user_id\"");
} else {
mysqli_query($drs_db,"insert into profile(user,name,value) values(\"$user_id\",\"$setting_name\",\"$setting_value\")");
}
}
} else {
mysqli_query($drs_db,"insert into profile(user,name,value) values(\"$user_id\",\"$setting_name\",\"$setting_value\")");
}
}
function group_detail($groupid,$role=false,$mode="view",$selection="none") {
// display a table for a single group
// groupid is the group for which detail is to be shown
// role is true if user is logged in, false if not.
// mode is "select" if selection boxes are to be displayed, "view" if not.
// selection is "all" or "none"
// grab some important global variables
global $device_term;
global $discovered_term, $discovered_term_short, $disc_drop_data;
global $functional_term, $functional_term_short;
global $functional_yes, $functional_no;
global $functional_yes_short, $functional_no_short;
global $drs_db;
// print group id and name
if ($selection == "all") {
$sel_flag="checked";
} elseif ($selection == "none") {
$sel_flag="";
}
$groupname=dblookup($drs_db,"groups","id","name",$groupid);
if ($groupname == "") {
echo "<b>Group ID: &nbsp;$groupid";
} else {
echo "<b>Group Name: &nbsp;$groupname";
}
echo "</b><br>";
// print table headers
if ($role && $mode=="select") {
echo "
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
<tr>
<th style=\"width:1%;\">Select</th>
<th style=\"width:1%;\">ID</th>
<th style=\"width:1%;\">Status</th>
<th style=\"width:100px;\">Date</th>
<th style=\"width:1%;\">$discovered_term_short</th>
<th style=\"width:1%;\">$device_term</th>
<th style=\"width:1%;\">Subsystem</th>
<th style=\"width:1%;\">Reported by</th>
<th>Discrepancy</th>
<th style=\"width:1%;\">$functional_term_short</th>
</tr>
";
} else {
echo "
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
<tr>
<th style=\"width:1%;\">ID</th>
<th style=\"width:1%;\">Status</th>
<th style=\"width:100px;\">Date</th>
<th style=\"width:1%;\">$discovered_term_short</th>
<th style=\"width:1%;\">$device_term</th>
<th style=\"width:1%;\">Subsystem</th>
<th style=\"width:1%;\">Reported by</th>
<th>Discrepancy</th>
<th style=\"width:1%;\">$functional_term_short</th>
</tr>
";
}
$writeup_qry=mysqli_query($drs_db,"select writeupid from links where linkgroup=$groupid order by writeupid asc");
while ($writeup=mysqli_fetch_row($writeup_qry)) {
// get writeup data
$writeupdata=mysqli_fetch_assoc(mysqli_query($drs_db,"select * from writeups where id={$writeup[0]}"));
// convert device number to name
$tname=dblookup($drs_db,"devices","id","name",$writeupdata["device"]);
// convert subsystem number to name
$ssname=dblookup($drs_db,"subsystems","id","name",$writeupdata["subsystem"]);
// determine status indicator
if ($writeupdata['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
if ($writeupdata['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
if ($writeupdata['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
// determine whendiscovered text for discovered id
$whendiscname=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscoveredname from discovered where id=\"{$writeupdata['discovered']}\""))[0];
$whendiscdesc=mysqli_fetch_row(mysqli_query($drs_db,"select whendiscovereddesc from discovered where id=\"{$writeupdata['discovered']}\""))[0];
// determine functional icon
if($writeupdata["functional"]==1) {
$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes_short\">";
} else {
$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no_short\">";
}
// print table row
if ($role && $mode=="select") {
printf(
"<tr>
<td align=\"center\" valign=\"top\"><input type=\"checkbox\" name=\"targets[]\" value=\"%s\" $sel_flag></td>
<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\"><font title=\"%s\">%s</font></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">%s</td>
</tr>\n",
$writeupdata["id"],
$writeupdata["id"],$writeupdata["id"],
$statusind,
$writeupdata["report_date"],
$whendiscdesc, $whendiscname,
$tname,
$ssname,
$writeupdata["reported_by"],
$writeupdata["discrepancy_text"],
$func_icon
);
} else {
printf(
"<tr>
<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\"><font title=\"%s\">%s</font></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">%s</td>
</tr>\n",
$writeupdata["id"],$writeupdata["id"],
$statusind,
$writeupdata["report_date"],
$whendiscdesc, $whendiscname,
$tname,
$ssname,
$writeupdata["reported_by"],
$writeupdata["discrepancy_text"],
$func_icon
);
}
}
echo "</table><br>";
}
?>

586
distfiles/config.php Normal file
View File

@@ -0,0 +1,586 @@
<?php
/*
config.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("common.php");
if (array_key_exists('print',$_REQUEST)) {
$print=true;
} else {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// redirect to index.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:index.php");
exit();
}
// import session variables
// redirect to index.php if not an admin
if (! $isadmin) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:index.php");
exit();
}
// import incoming arrays
if ($print) {
// if printer friendly was clicked, values will be passed in serialized
// form as "all_parameters" so we need to load those into $incoming[]
$incoming=unserialize($_REQUEST['all_parameters']);
} else {
// copy $_REQUEST[] to $incoming[]
$incoming=arrayCopy($_REQUEST);
}
// extract incoming array keys into variables
extract($incoming, EXTR_SKIP);
/*
* possible keys are:
* update_display
* display_appname
* display_banner
* display_footer
* display_funchelp
* display_device_term
* display_discovered_term
* display_discovered_term_short
* display_disc_drop_data
* display_functional_term
* display_functional_term_short
* display_functional_yes
* display_functional_no
* display_functional_yes_short
* display_functional_no_short
* update_colors
* reset_colors
* newbgc
* newmbgc
* newtc
* newlc
* newvlc
* newhc
* edit_banner
* add_banner
* update_banner
* delete_banner
* bnrid
* bnrname
* bnrcolor
* bnrtxtcolor
* update_misc
* sessttl
* logoutall
* accessmode
*/
if (!isset($update_display)) $update_display=false;
if (!isset($update_colors)) $update_colors=false;
if (!isset($reset_colors)) $reset_colors=false;
if (!isset($add_banner)) $add_banner=false;
if (!isset($edit_banner)) $edit_banner=false;
if (!isset($update_banner)) $update_banner=false;
if (!isset($delete_banner)) $delete_banner=false;
if (!isset($update_misc)) $update_misc=false;
if (!isset($logoutall)) $logoutall=false;
// assign variables from constants
$appname=APP_NAME;
if ($print=="Printer Friendly") {
$mbgcolor=P_MENUBG_COLOR;
} else {
$mbgcolor=MENUBG_COLOR;
}
framework("begin","$appname","Configuration",$print);
//echo "_REQUEST array <br>";
//var_dump($_REQUEST);
//echo "<br><hr> incoming array <br>";
//var_dump($incoming);
// ******** begin database manipulation ********
$nameunique_err=$namesuppld_err=$ttlsuppld_err=$dirsuppld_err=false;
if ($update_display) {
// remove html tags from footer_message and sanitize
$display_footer=strip_tags($display_footer);
$clean_display_footer=mysqli_real_escape_string($drs_db,$display_footer);
// remove html tags from app name and sanitize
$display_appname=strip_tags($display_appname);
$clean_display_appname=mysqli_real_escape_string($drs_db,$display_appname);
// remove html tags from functional help text and sanitize
$display_funchelp=strip_tags($display_funchelp);
$clean_display_funchelp=mysqli_real_escape_string($drs_db,$display_funchelp);
// remove html tags from device term and sanitize
$display_device_term=strip_tags($display_device_term);
$clean_display_device_term=mysqli_real_escape_string($drs_db,$display_device_term);
// remove html tags from discovered term and sanitize
$display_discovered_term=strip_tags($display_discovered_term);
$clean_display_discovered_term=mysqli_real_escape_string($drs_db,$display_discovered_term);
// remove html tags from short discovered term and sanitize
$display_discovered_term_short=strip_tags($display_discovered_term_short);
$clean_display_discovered_term_short=mysqli_real_escape_string($drs_db,$display_discovered_term_short);
// remove html tags from functional term and sanitize
$display_functional_term=strip_tags($display_functional_term);
$clean_display_functional_term=mysqli_real_escape_string($drs_db,$display_functional_term);
// remove html tags from short functional term and sanitize
$display_functional_term_short=strip_tags($display_functional_term_short);
$clean_display_functional_term_short=mysqli_real_escape_string($drs_db,$display_functional_term_short);
// remove html tags from functional yes and sanitize
$display_functional_yes=strip_tags($display_functional_yes);
$clean_display_functional_yes=mysqli_real_escape_string($drs_db,$display_functional_yes);
// remove html tags from functional no and sanitize
$display_functional_no=strip_tags($display_functional_no);
$clean_display_functional_no=mysqli_real_escape_string($drs_db,$display_functional_no);
// remove html tags from short functional yes and sanitize
$display_functional_yes_short=strip_tags($display_functional_yes_short);
$clean_display_functional_yes_short=mysqli_real_escape_string($drs_db,$display_functional_yes_short);
// remove html tags from short functional no and sanitize
$display_functional_no_short=strip_tags($display_functional_no_short);
$clean_display_functional_no_short=mysqli_real_escape_string($drs_db,$display_functional_no_short);
mysqli_query($drs_db,"update config set value=\"$clean_display_appname\" where name=\"app_name\"");
mysqli_query($drs_db,"update config set value=\"$display_banner\" where name=\"banner\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_footer\" where name=\"footer_message\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_funchelp\" where name=\"functional_help_txt\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_device_term\" where name=\"device_term\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_discovered_term\" where name=\"discovered_term\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_discovered_term_short\" where name=\"discovered_term_short\"");
mysqli_query($drs_db,"update config set value=\"$display_disc_drop_data\" where name=\"disc_drop_data\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_term\" where name=\"functional_term\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_term_short\" where name=\"functional_term_short\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_yes\" where name=\"functional_yes\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_no\" where name=\"functional_no\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_yes_short\" where name=\"functional_yes_short\"");
mysqli_query($drs_db,"update config set value=\"$clean_display_functional_no_short\" where name=\"functional_no_short\"");
echo "<meta http-equiv='refresh' content='0'>";
}
if ($update_colors) {
if ($newbgc) mysqli_query($drs_db,"update config set value=\"$newbgc\" where name=\"background_color\"");
if ($newmbgc) mysqli_query($drs_db,"update config set value=\"$newmbgc\" where name=\"menubg_color\"");
if ($newtc) mysqli_query($drs_db,"update config set value=\"$newtc\" where name=\"text_color\"");
if ($newlc) mysqli_query($drs_db,"update config set value=\"$newlc\" where name=\"link_color\"");
if ($newvlc) mysqli_query($drs_db,"update config set value=\"$newvlc\" where name=\"vlink_color\"");
if ($newhc) mysqli_query($drs_db,"update config set value=\"$newhc\" where name=\"heading_color\"");
echo "<meta http-equiv='refresh' content='0'>";
}
if ($reset_colors) {
mysqli_query($drs_db,"update config set value=defaultvalue where name like \"%_color\"");
echo "<meta http-equiv='refresh' content='0'>";
}
if ($add_banner) {
// do error checking
// remove html tags from banner name
$bnrname=strip_tags($bnrname);
// test for name supplied
if (strlen(trim($bnrname))) {
$namesuppld=true;
$namesuppld_err=false;
} else {
$namesuppld=false;
$namesuppld_err=true;
}
// test for name unique
if (mysqli_num_rows(mysqli_query($drs_db,"select bannerid from banners where bannername=\"$bnrname\""))) {
$nameunique=false;
$nameunique_err=true;
} else {
$nameunique=true;
$nameunique_err=false;
}
if ($namesuppld && $nameunique) {
// sanitize banner name
$clean_bnrname=mysqli_real_escape_string($drs_db,$bnrname);
// modify the table
mysqli_query($drs_db,"insert into banners(bannername,bannercolor,textcolor) values(\"$clean_bnrname\",\"$bnrcolor\",\"$bnrtxtcolor\")");
}
}
if ($edit_banner) {
if ($delete_banner) {
mysqli_query($drs_db,"delete from banners where bannerid=\"$bnrid\"");
unset($edit_banner);
}
if ($update_banner) {
// do error checking
// remove html tags from banner name
$bnrname=strip_tags($bnrname);
// test for name supplied
if (strlen(trim($bnrname))) {
$namesuppld=true;
$namesuppld_err=false;
} else {
$namesuppld=false;
$namesuppld_err=true;
}
// test for name unique
if (mysqli_num_rows(mysqli_query($drs_db,"select bannerid from banners where bannername=\"$bnrname\" and bannerid!=\"$bnrid\""))) {
if (mysqli_num_rows(mysqli_query($drs_db,"select bannerid from banners where bannername=\"$bnrname\""))) {
$nameunique=false;
$nameunique_err=true;
} else {
$nameunique=true;
$nameunique_err=false;
}
} else {
$nameunique=true;
}
if ($namesuppld && $nameunique) {
// sanitize banner name
$clean_bnrname=mysqli_real_escape_string($drs_db,$bnrname);
// modify the table
mysqli_query($drs_db,"update banners set bannername=\"$bnrname\",bannercolor=\"$bnrcolor\",textcolor=\"$bnrtxtcolor\" where bannerid=\"$bnrid\"");
}
}
}
if ($update_misc) {
if ($accessmode) {
mysqli_query($drs_db,"update config set value=\"$accessmode\" where name=\"access_mode\"");
}
if ($logoutall) {
if ($ostype == 'WIN') {
$sessfileloc=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"win_server_session_dir\""))[0];
} else {
$sessfileloc=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"unix_server_session_dir\""))[0];
}
foreach (glob($sessfileloc."/*") as $sessfile) {
unlink($sessfile);
}
}
// test for sessttl supplied
if (strlen(trim($sessttl))) {
$ttlsuppld=true;
} else {
$ttlsuppld=false;
$ttlsuppld_err=true;
}
if ($ttlsuppld) {
mysqli_query($drs_db,"update config set value=\"$sessttl\" where name=\"session_ttl_days\"");
}
}
// ******** end database manipulation ********
pagetable("begin");
if (!$print) {
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
echo "<br>";
echo "
<div id=\"configtabs\">
<ul>
<li><a href=\"#display_options\">Display Options</a></li>
<li><a href=\"#page_colors\">Page Colors</a></li>
<li><a href=\"#banners\">Banners</a></li>
<li><a href=\"#miscellaneous\">Miscellaneous Options</a></li>
</ul>
<div id=\"display_options\">
<form method=\"post\" action=\"config.php\">
";
$curapn=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"app_name\""))[0];
$curbnr=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"banner\""))[0];
$curftr=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"footer_message\""))[0];
$curfunchelp=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_help_txt\""))[0];
$curdscterm=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"discovered_term\""))[0];
$curdscterms=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"discovered_term_short\""))[0];
$curdiscdropdata=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"disc_drop_data\""))[0];
$curfuncterm=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_term\""))[0];
$curfuncterms=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_term_short\""))[0];
$curfuncyes=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_yes\""))[0];
$curfuncno=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_no\""))[0];
$curfuncyess=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_yes_short\""))[0];
$curfuncnos=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"functional_no_short\""))[0];
$curdevterm=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"device_term\""))[0];
echo "
<font size=\"+1\"><b>Display Configuration Parameters</b></font><br><br><br><br>
";
echo "
Application Name (will appear at the top of every page):<br>
<input type=\"text\" name=\"display_appname\" size=\"80\" value=\"$curapn\">
<br><br><br>
";
echo "
Banner (will appear at the top and bottom of pages): &nbsp;<select name=\"display_banner\" id=\"sel-banner\">
";
$bannerqry=mysqli_query($drs_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"]);
}
}
$dropnamestate=$dropdescstate="";
if($curdiscdropdata=="Name") $dropnamestate="checked";
if($curdiscdropdata=="Desc") $dropdescstate="checked";
echo "
</select><br><br><br>
Footer Message (will appear at the bottom of pages):<br>
<input type=\"text\" name=\"display_footer\" size=\"80\" value=\"$curftr\"><br><br><br>
Device Terminology :&nbsp;&nbsp;&nbsp;
<input type=\"text\" name=\"display_device_term\" size=\"10\" value=\"$curdevterm\"><br><br><br>
When Discovered Terminology :&nbsp;&nbsp;&nbsp;
<input type=\"text\" name=\"display_discovered_term\" size=\"20\" value=\"$curdscterm\"><br><br><br>
Short When Discovered Terminology (shown where space is limited, like table headers) :<br>
<input type=\"text\" name=\"display_discovered_term_short\" size=\"9\" value=\"$curdscterms\"><br><br><br>
When Discovered data to show in dropdowns:&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"display_disc_drop_data\" value=\"Name\" $dropnamestate> Name &nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"display_disc_drop_data\" value=\"Desc\" $dropdescstate> Description<br><br><br>
Functional Terminology :&nbsp;&nbsp;&nbsp;
<input type=\"text\" name=\"display_functional_term\" size=\"20\" value=\"$curfuncterm\"><br><br><br>
Short Functional Terminology (shown where space is limited, like table headers) :<br>
<input type=\"text\" name=\"display_functional_term_short\" size=\"4\" value=\"$curfuncterms\"><br><br><br>
Functional Yes Terminology :&nbsp;&nbsp;&nbsp;
<input type=\"text\" name=\"display_functional_yes\" size=\"20\" value=\"$curfuncyes\"><br><br><br>
Functional No Terminology :&nbsp;&nbsp;&nbsp;
<input type=\"text\" name=\"display_functional_no\" size=\"20\" value=\"$curfuncno\"><br><br><br>
Short Functional Yes Terminology (shown where space is limited, like table headers) :<br>
<input type=\"text\" name=\"display_functional_yes_short\" size=\"4\" value=\"$curfuncyess\"><br><br><br>
Short Functional No Terminology (shown where space is limited, like table headers) :<br>
<input type=\"text\" name=\"display_functional_no_short\" size=\"4\" value=\"$curfuncnos\"><br><br><br>
Functional Help Text :<br>
<textarea rows=\"4\" cols=\"80\" name=\"display_funchelp\" wrap=\"soft\">$curfunchelp</textarea><br><br><br><br>
<input type=\"submit\" name=\"update_display\" value=\"Update Options\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br><br><br>
</form>
";
echo "
</div>
<div id=\"page_colors\">
";
$curbgc=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"background_color\""))[0];
$curmbgc=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"menubg_color\""))[0];
$curtc=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"text_color\""))[0];
$curlc=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"link_color\""))[0];
$curvlc=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"vlink_color\""))[0];
$curhc=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"heading_color\""))[0];
echo "
<font size=\"+1\"><b>Color Configuration Parameters</b></font><br><br>
<table border=\"0\"><tr>
<td>
<form method=\"post\" action=\"config.php#page_colors\">
<b>Select the color you'd like to change then use the color picker to select a new color</b><br><br>
<table border=\"0\" cellpadding=\"10\">
<tr><td>Page background color</td><td>#<input type=\"text\" name=\"newbgc\" value=\"$curbgc\" id=\"bgcfield\" onFocus=\"ddcolorposter.echocolor(this, 'bgcbox')\"> <span id=\"bgcbox\" class=\"colorbox\">____</span></td></tr>
<tr><td>Menu background color</td><td>#<input type=\"text\" name=\"newmbgc\" value=\"$curmbgc\" id=\"mbgcfield\" onFocus=\"ddcolorposter.echocolor(this, 'mbgcbox')\"> <span id=\"mbgcbox\" class=\"colorbox\">____</span></td></tr>
<tr><td>Normal text color</td><td>#<input type=\"text\" name=\"newtc\" value=\"$curtc\" id=\"tcfield\" onFocus=\"ddcolorposter.echocolor(this, 'tcbox')\"> <span id=\"tcbox\" class=\"colorbox\">____</span></td></tr>
<tr><td>Link color</td><td>#<input type=\"text\" name=\"newlc\" value=\"$curlc\" id=\"lcfield\" onFocus=\"ddcolorposter.echocolor(this, 'lcbox')\"> <span id=\"lcbox\" class=\"colorbox\">____</span></td></tr>
<tr><td>Visited link color</td><td>#<input type=\"text\" name=\"newvlc\" value=\"$curvlc\" id=\"vlcfield\" onFocus=\"ddcolorposter.echocolor(this, 'vlcbox')\"> <span id=\"vlcbox\" class=\"colorbox\">____</span></td></tr>
<tr><td>Heading color</td><td>#<input type=\"text\" name=\"newhc\" value=\"$curhc\" id=\"hcfield\" onFocus=\"ddcolorposter.echocolor(this, 'hcbox')\"> <span id=\"hcbox\" class=\"colorbox\">____</span></td></tr>
</table>
<br><br>
<input type=\"submit\" name=\"update_colors\" value=\"Update Colors\">&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset_colors\" value=\"Reset Colors to Defaults\">
</td>
<td>
<div id=\"pickerPanel\" class=\"dragPanel\">
<h4 id=\"pickerHandle\">&nbsp;</h4>
<div id=\"pickerDiv\">
<img id=\"pickerbg\" src=\"colorpicker/img/pickerbg.png\" alt=\"\">
<div id=\"selector\"><img src=\"colorpicker/img/select.gif\"></div>
</div>
<div id=\"hueBg\">
<div id=\"hueThumb\"><img src=\"colorpicker/img/hline.png\"></div>
</div>
<div id=\"pickervaldiv\">
<form name=\"pickerform\" onsubmit=\"return pickerUpdate()\">
<font size=\"-3\">
<br />
R <input name=\"pickerrval\" id=\"pickerrval\" type=\"text\" value=\"0\" size=\"3\" maxlength=\"3\" />
H <input name=\"pickerhval\" id=\"pickerhval\" type=\"text\" value=\"0\" size=\"3\" maxlength=\"3\" />
<br />
G <input name=\"pickergval\" id=\"pickergval\" type=\"text\" value=\"0\" size=\"3\" maxlength=\"3\" />
S <input name=\"pickergsal\" id=\"pickersval\" type=\"text\" value=\"0\" size=\"3\" maxlength=\"3\" />
<br />
B <input name=\"pickerbval\" id=\"pickerbval\" type=\"text\" value=\"0\" size=\"3\" maxlength=\"3\" />
V <input name=\"pickervval\" id=\"pickervval\" type=\"text\" value=\"0\" size=\"3\" maxlength=\"3\" />
<br />
<br />
# <input name=\"pickerhexval\" id=\"pickerhexval\" type=\"text\" value=\"0\" size=\"6\" maxlength=\"6\" />
<br />
</font>
</form>
</div>
<div id=\"pickerSwatch\">&nbsp;</div>
</div>
</td>
</tr></table>
";
echo "
</form>
</div>
<div id=\"banners\">
";
if ($nameunique_err) format_message(1,"Banner name already exists. Please try another.");
if ($namesuppld_err) format_message(1,"Banner name cannot be blank.");
if ($edit_banner) {
// set form options for editing
$sectiontitle="<font size=\"+1\"><b>Modify Banner</b></font><br><br>";
$formtag="<form method=\"post\" action=\"config.php?edit_banner=1#banners\">";
$buttontags="
<input type=\"hidden\" name=\"bnrid\" value=\"$bnrid\">
<input type=\"submit\" name=\"update_banner\" value=\"Update Banner\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"delete_banner\" value=\"Delete Banner\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
";
// pull current values from database
$currentvalues=mysqli_fetch_assoc(mysqli_query($drs_db,"select * from banners where bannerid=$bnrid"));
$bnrname=$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="<font size=\"+1\"><b>Add New Banner</b></font><br><br>";
$formtag="<form method=\"post\" action=\"config.php#banners\">";
$bnrname="";
$buttontags="
<input type=\"submit\" name=\"add_banner\" 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): &nbsp;<input type=\"text\" name=\"bnrname\" size=\"40\" value=\"$bnrname\"><br><br>
Banner Color (background color of the banner): &nbsp;
<select name=\"bnrcolor\">
$bnrcoloropts
</select><br><br>
Banner Text Color (text color of the banner, different than banner color): &nbsp;
<select name=\"bnrtxtcolor\">
$bnrtextcoloropts
</select><br><br>
</td></tr>
</table>
$buttontags
</form>
<br><hr>
";
// show the table of entities
$existingdata=mysqli_query($drs_db,"select * from banners where bannerid!=1 order by bannerid asc");
echo "
<b>Existing Banners</b>&nbsp;&nbsp;&nbsp;<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=\"config.php?edit_banner=1&bnrid=%s#banners\">%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>";
echo "
</div>
<div id=\"miscellaneous\">
<form method=\"post\" action=\"config.php#miscellaneous\">
";
if ($ttlsuppld_err) format_message(1,"Session expiration time cannot be blank.");
$curaccessmode=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"access_mode\""))[0];
$trustedstate=$untrustedstate="";
if($curaccessmode=="trusted") $trustedstate="checked";
if($curaccessmode=="untrusted") $untrustedstate="checked";
$curttl=mysqli_fetch_row(mysqli_query($drs_db,"select value from config where name=\"session_ttl_days\""))[0];
echo "
<font size=\"+1\"><b>Miscellaneous Configuration Parameters</b></font><br><br><br><br>
Access mode:&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"accessmode\" value=\"trusted\" $trustedstate> Trusted &nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"accessmode\" value=\"untrusted\" $untrustedstate> Untrusted<br><br><br>
Session expiration time (users will have to log in again after this long) : &nbsp;<input type=\"text\" name=\"sessttl\" size=\"3\" value=\"$curttl\"> days<br><br>
Force logout of all users &nbsp;<input type=\"checkbox\" name=\"logoutall\"><br><br><br><br>
<input type=\"submit\" name=\"update_misc\" value=\"Update Options\">&nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"submit\" name=\"reset\" value=\"Reset\"><br>
</div>
</div>
";
echo "<br>";
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

279
distfiles/create.php Normal file
View File

@@ -0,0 +1,279 @@
<?php
/*
create.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("common.php");
if (array_key_exists('print',$_REQUEST)) {
$print=true;
} else {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// redirect to writeups.php on change cancel
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:writeups.php");
exit();
}
// import session variables
if (isset($_SESSION['userid'])) {
$userid=$_SESSION['userid'];
} else {
$userid=NULL;
}
// import incoming arrays
if ($print) {
// if printer friendly was clicked, values will be passed in serialized
// form as "all_parameters" so we need to load those into $incoming[]
$incoming=unserialize($_REQUEST['all_parameters']);
} else {
// copy $_REQUEST[] to $incoming[]
$incoming=arrayCopy($_REQUEST);
}
// extract incoming array keys into variables
extract($incoming, EXTR_SKIP);
/*
* possible keys are:
* create
* device
* discovered
* functional
* reported_by
* report_date
* report_time
* subsystem
* discrepancy_text
* status
*/
if (!isset($device)) $device=NULL;
if (!isset($discovered)) $discovered=NULL;
if (!isset($reported_by)) $reported_by=NULL;
if (!isset($discrepancy_text)) $discrepancy_text=NULL;
if (!isset($functional)) $functional=NULL;
if (!isset($subsystem)) $subsystem=NULL;
// assign variables from constants
$appname=APP_NAME;
if ($print) {
$mbgcolor=P_MENUBG_COLOR;
} else {
$mbgcolor=MENUBG_COLOR;
}
$role=dblookup($drs_db,"users","id","role",$userid);
framework("begin","$appname","New Writeup",$print);
//echo "_REQUEST array <br>";
//var_dump($_REQUEST);
//echo "<br><hr> incoming array <br>";
//var_dump($incoming);
// ******** begin database manipulation ********
if (!isset($report_date) || $report_date=="automatic") $report_date=$today;
if (!isset($report_time) || $report_time=="automatic") $report_time=$now;
if (isset($create)) {
// add the entry if create is pressed
if ($discrepancy_text!=NULL && $reported_by!=NULL && $device!=NULL && $subsystem!=NULL && $discovered!=NULL) {
// sanitize and fix blank date and time
$report_date=mysqli_real_escape_string($drs_db,$report_date);
$report_time=mysqli_real_escape_string($drs_db,$report_time);
if (!isset($report_date)) $report_date=$today;
if (!isset($report_time)) $report_time=$now;
// remove html tags from discrepancy text and sanitize
$discrepancy_text=strip_tags($discrepancy_text);
$clean_discrepancy_text=mysqli_real_escape_string($drs_db,$discrepancy_text);
$clean_reported_by=mysqli_real_escape_string($drs_db,$reported_by);
// add the record to writeups
mysqli_query($drs_db,"insert into writeups(device,discovered,functional,reported_by,report_date,report_time,subsystem,discrepancy_text,status)
values (\"$device\",\"$discovered\",\"$functional\",\"$clean_reported_by\",\"$report_date\",\"$report_time\",\"$subsystem\",\"$clean_discrepancy_text\",\"$status\")");
}
}
// ******** end database manipulation ********
pagetable("begin");
if (!$print) {
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
echo "<br>";
// display the form
if (isset($create)) {
if ($discrepancy_text!=NULL && $reported_by!=NULL) {
format_message(0,"<strong>Writeup created.</strong> You may create another writeup or <a href=\"writeups.php\">return to View Writeups page.</a>");
$preserve=false;
}
if ($device==NULL) {
format_message(1,"You didn't select a $device_term. Please try again.");
$preserve=true;
}
if ($subsystem==NULL) {
format_message(1,"You didn't select a subsystem. Please try again.");
$preserve=true;
}
if ($discovered==NULL) {
format_message(1,"You didn't select a $discovered_term. Please try again.");
$preserve=true;
}
if ($discrepancy_text==NULL) {
format_message(1,"You didn't enter any discrepancy text. Please try again.");
$preserve=true;
}
if ($reported_by==NULL) {
format_message(1,"You didn't enter your name in the Reported by: block. Please try again.");
$preserve=true;
}
} else {
$preserve=false;
}
echo "
<form method=\"post\" action=\"create.php\">
";
// start writeup entry section
echo "
<table border=\"0\" cellpadding=\"5\">
<tr>
<td align=\"left\">$device_term<br>
<select name=\"device\" id=\"device\">
<option value=\"\">Please select...</option>
";
$trow=mysqli_query($drs_db,"select * from devices where active is true order by id asc");
while ($titem=mysqli_fetch_assoc($trow)) {
if ($device==$titem["id"] && $preserve) {
printf("<option value=\"%s\" selected>%s</option>",$titem["id"],$titem["name"]);
} else {
printf("<option value=\"%s\">%s</option>",$titem["id"],$titem["name"]);
}
}
echo "
</select></td>
<td align=\"left\">Subsystem<br>
<select name=\"subsystem\" id=\"subsystem\">
<option value=\"\">Please select...</option>
";
$ssrow=mysqli_query($drs_db,"select * from subsystems where active is true order by id asc");
while ($ssitem=mysqli_fetch_assoc($ssrow)) {
if ($subsystem==$ssitem["id"] && $preserve) {
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$ssitem["id"],$ssitem["description"],$ssitem["name"]);
} else {
printf("<option value=\"%s\" title=\"%s\">%s</option>",$ssitem["id"],$ssitem["description"],$ssitem["name"]);
}
}
echo "
</select></td><td></td>
</tr>
<tr>
<td align=\"left\">$discovered_term<br>
<select name=\"discovered\" id=\"discoveredselect\">
<option value=\"\">Please select...</option>
";
if ($disc_drop_data=="Name") {
$discddtitle="whendiscovereddesc";
$discddtext="whendiscoveredname";
} else if ($disc_drop_data=="Desc") {
$discddtitle="whendiscoveredname";
$discddtext="whendiscovereddesc";
}
$drow=mysqli_query($drs_db,"select * from discovered where active is true order by whendiscoveredname asc");
while ($ditem=mysqli_fetch_assoc($drow)) {
if ($discovered==$ditem["id"] && $preserve) {
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$ditem["id"],$ditem["$discddtitle"],$ditem["$discddtext"]);
} else {
printf("<option value=\"%s\" title=\"%s\">%s</option>",$ditem["id"],$ditem["$discddtitle"],$ditem["$discddtext"]);
}
}
if (!$preserve) {
$report_date="automatic";
$report_time="automatic";
$discrepancy_text="";
$reported_by="";
}
$funcyesstate=$funcnostate="";
if ($preserve) {
if($functional==1) $funcyesstate="checked";
if($functional==0) $funcnostate="checked";
} else {
$funcyesstate="checked";
}
echo "</select></td>";
if (!$role) {
$timedatedisable="disabled";
} else {
$timedatedisable="";
}
echo "
<td align=\"left\" >Report Date<br>
<input type=\"text\" name=\"report_date\" size=\"10\" maxlength=\"10\" value=\"$report_date\" id=\"singledatepicker\" title=\"Format: YYYY-MM-DD\" $timedatedisable></td>
<td align=\"left\">Report Time<br>
<input type=\"text\" name=\"report_time\" size=\"8\" maxlength=\"8\" value=\"$report_time\" title=\"Format: HH:MM:SS\" $timedatedisable></td>
";
echo "
</tr>
<tr><td></td><td></td><td></td></tr>
<tr><td colspan=\"3\">
Discrepancy <font size=\"-2\">(required)</font><br>
<textarea rows=\"10\" cols=\"80\" name=\"discrepancy_text\" wrap=\"soft\">$discrepancy_text</textarea><br>
</tr>
<tr>
<td>Reported by <font size=\"-2\">(required)</font><br>
<input type=\"text\" name=\"reported_by\" size=\"30\" value=\"$reported_by\" title=\"Who to contact with questions about this writeup\"></td>
<td>$functional_term? &nbsp; <img src=\"icons/question.png\" title=\"" . FUNCTIONAL_HELP_TXT . "\"><br>
<input type=\"radio\" name=\"functional\" value=\"1\" $funcyesstate> Yes &nbsp;&nbsp;&nbsp;&nbsp;
<input type=\"radio\" name=\"functional\" value=\"0\" $funcnostate> No
</td>
<td align=\"right\" valign=\"bottom\"><input type=\"submit\" name=\"create\" value=\"Submit Writeup\" id=\"createbutton\"></td>
</tr>
<tr><td></td><td></td><td></td></tr>
<td></td><td></td><td align=\"right\" valign=\"bottom\">
<input type=\"submit\" name=\"cancel\" value=\"Cancel\" id=\"usercancelbutton\"></td>
</tr>
</table>
<input type=\"hidden\" name=\"status\" value=\"1\">
</form>
<br>
";
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

1219
distfiles/dbadmin.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,35 +1,82 @@
<?php <?php
/* /*
gpl.php gpl.php
OpenLog Online Logbook OpenMTS Online Maintenance Tracking System
Copyright (C) 2026 Rod Wright Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0 SPDX-License-Identifier: GPL-2.0
*/ */
include("functions.php"); include("common.php");
if (array_key_exists('print',$_REQUEST)) {
$print=true;
$print = $_REQUEST['print'] ?? NULL;
if ($print) {
$sbcolor = P_SIDEBAR_COLOR;
$mbgcolor = P_MENUBG_COLOR;
} else { } else {
$sbcolor = SIDEBAR_COLOR; $print=false;
$mbgcolor = MENUBG_COLOR;
} }
framework("begin", "OpenLog License", "OpenLog License", $print); // redirect to search.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:search.php");
exit();
}
// import session variables
if (isset($_SESSION['userid'])) $userid=$_SESSION['userid'];
// import incoming arrays
if ($print) {
// if printer friendly was clicked, values will be passed in serialized
// form as "all_parameters" so we need to load those into $incoming
$incoming=unserialize($_REQUEST['all_parameters']);
} else {
// copy $_REQUEST to $incoming
$incoming=arrayCopy($_REQUEST);
}
// extract incoming array keys into variables
// define local functions
// assign variables from constants
$appname=APP_NAME;
if ($print) {
$mbgcolor=P_MENUBG_COLOR;
} else {
$mbgcolor=MENUBG_COLOR;
}
$role=dblookup($drs_db,"users","id","role",$userid);
framework("begin","$appname","GNU General Public License",$print);
//echo "_REQUEST array <br>";
//var_dump($_REQUEST);
//echo "<br><hr> incoming array <br>";
//var_dump($incoming);
// ******** begin database manipulation ********
// ******** end database manipulation ********
pagetable("begin"); pagetable("begin");
if (!$print) { if (!$print) {
pageblock("left", "begin"); pageblock("left","begin");
sidemenu(); sidemenu();
pageblock("left", "end"); pageblock("left","end");
} }
pageblock("right", "begin"); pageblock("right","begin");
banner($print);
echo "<br>";
echo " echo "
<center>
<pre> <pre>
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 2, June 1991 Version 2, June 1991
@@ -374,9 +421,15 @@ Public License instead of this License.
</pre> </pre>
</center>
"; ";
pageblock("right", "end");
echo "<br>";
banner($print);
pageblock("right","end");
pagetable("end"); pagetable("end");
framework("end", "", "", $print); framework("end","","",$print);
?>

923
distfiles/groups.php Normal file
View File

@@ -0,0 +1,923 @@
<?php
/*
groups.php
OpenDRS Online Discrepancy Reporting System
Copyright (C) 2026 Rod Wright
SPDX-License-Identifier: GPL-2.0
*/
include("common.php");
if (array_key_exists('print',$_REQUEST)) {
$print=true;
} else {
$print=false;
}
// redirect to login page if access_mode is untrusted and user is
// not logged in
if ($access_mode == "untrusted" && ! isset($_SESSION['userid'])) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:login.php");
exit();
}
// redirect to groups.php on cancel button press
if (array_key_exists('cancel',$_REQUEST)) {
header("Cache-Control:no-cache, must-revalidate");
header("Pragma:no-cache");
header("Location:groups.php");
exit();
}
// import session variables
if (isset($_SESSION['userid'])) {
$userid=$_SESSION['userid'];
} else {
$userid=NULL;
}
// import incoming arrays
if ($print) {
// if printer friendly was clicked, values will be passed in serialized
// form as "all_parameters" so we need to load those into $incoming
$incoming=unserialize($_REQUEST['all_parameters']);
} else {
// copy $_REQUEST to $incoming
$incoming=arrayCopy($_REQUEST);
}
// extract incoming array keys into variables
extract($incoming, EXTR_SKIP);
/*
* possible keys are:
* action
* save
* targets
* group
* name
* search
* s_status
* s_device
* s_subsystem
* s_discovered
* s_report_date_start
* s_report_date_end
* s_report_time_start
* s_report_time_end
* s_discrepancy_text
* s_reported_by
* s_functional
* edit_status
* edit_action_by
* edit_action_reason
* edit_action_date
* edit_action_time
* edit_action_text
*/
if (!isset($action)) $action=NULL;
if (!isset($s_discrepancy_text)) $s_discrepancy_text=NULL;
if (!isset($s_reported_by)) $s_reported_by=NULL;
if (!isset($edit_status)) $edit_status=NULL;
if (!isset($edit_action_by)) $edit_action_by=NULL;
if (!isset($edit_action_reason)) $edit_action_reason=NULL;
if (!isset($edit_action_text)) $edit_action_text=NULL;
if (!isset($save)) $save=false;
if (!isset($search)) $search=false;
if (!isset($group)) $group=NULL;
if (!isset($name)) $name=NULL;
// define local functions
// assign variables from constants
$appname=APP_NAME;
if ($print) {
$mbgcolor=P_MENUBG_COLOR;
} else {
$mbgcolor=MENUBG_COLOR;
}
$role=dblookup($drs_db,"users","id","role",$userid);
framework("begin","$appname","Writeup Groups",$print);
//echo "_REQUEST array <br>";
//var_dump($_REQUEST);
//echo "<br><hr> incoming array <br>";
//var_dump($incoming);
// ******** begin database manipulation ********
// get max report date from writeups table, validate input dates/times and set defaults
$maxrepdate_qry=mysqli_query($drs_db,"select max(report_date) from writeups");
$maxrepdate=mysqli_fetch_row($maxrepdate_qry)[0];
if (!isset($s_report_date_start) || !validateDate($s_report_date_start)) $s_report_date_start=mysqli_fetch_row(mysqli_query($drs_db,"select date_sub(curdate(),interval 30 day)"))[0];
if (!isset($s_report_date_end) || !validateDate($s_report_date_end)) $s_report_date_end=$maxrepdate;
if (!isset($s_report_time_start) || !validateTime($s_report_time_start)) $s_report_time_start="00:00:00";
if (!isset($s_report_time_end) || !validateTime($s_report_time_end)) $s_report_time_end="23:59:59";
if (!isset($edit_action_date) || !validateDate($edit_action_date)) $edit_action_date=$today;
if (!isset($edit_action_time) || !validateTime($edit_action_time)) $edit_action_time=$now;
if ($action=="add" && $role && $save) {
$fail=false;
if ($group==NULL) {
// group was not supplied, so create a new one
mysqli_query($drs_db,"insert into groups(name) value(\"\")");
$fail=mysqli_error($drs_db);
$group=mysqli_insert_id($drs_db);
}
foreach ($targets as $target) {
// add writeup to the group
if (!mysqli_num_rows(mysqli_query($drs_db,"select id from links where writeupid=\"$target\" and linkgroup=\"$group\""))) {
// target is not already a member of this group
mysqli_query($drs_db,"insert into links (linkgroup,writeupid) values($group,$target)");
$fail=mysqli_error($drs_db);
}
}
} elseif ($action=="remove" && $role && $save) {
$fail=false;
$writeups=[];
$writeups_qry=mysqli_query($drs_db,"select writeupid from links where linkgroup=\"$group\"");
while ($writeuprow=mysqli_fetch_row($writeups_qry)) {
$writeups[]=$writeuprow[0];
}
foreach ($writeups as $writeup) {
if (!isset($targets) || !in_array($writeup,$targets)) {
// remove writeup from group
mysqli_query($drs_db,"delete from links where writeupid=$writeup and linkgroup=$group");
$fail=mysqli_error($drs_db);
}
}
// if there are no longer any writeups in this group, dissolve it
$memb_qty_query=mysqli_query($drs_db,"select id from links where linkgroup=\"$group\"");
if (mysqli_num_rows($memb_qty_query) == 0) {
mysqli_query($drs_db,"delete from groups where id=$group");
$fail=mysqli_error($drs_db);
}
} elseif ($action=="dissolve" && $role && $save) {
$fail=false;
// unassign all writeups from a group and delete the group
mysqli_query($drs_db,"delete from links where linkgroup=$group");
$fail=mysqli_error($drs_db);
mysqli_query($drs_db,"delete from groups where id=$group");
$fail=mysqli_error($drs_db);
} elseif ($action=="setname" && $role && $save) {
$fail=false;
// change the name of a group
// remove html tags from group name and sanitize
$name=strip_tags($name);
$clean_name=mysqli_real_escape_string($drs_db,$name);
mysqli_query($drs_db,"update groups set name=\"$clean_name\" where id=\"$group\"");
$fail=mysqli_error($drs_db);
} elseif ($action=="takeaction" && $role && $save) {
$fail=false;
// set the status, action by, reason action date/time and append supplied text to action text
// for all ids in group
if ($edit_action_reason!=NULL) {
// sanitize date and time
$edit_action_date=mysqli_real_escape_string($drs_db,$edit_action_date);
$edit_action_time=mysqli_real_escape_string($drs_db,$edit_action_time);
// remove html tags from action text and sanitize
$edit_action_text=strip_tags($edit_action_text);
$clean_edit_action_text=mysqli_real_escape_string($drs_db,$edit_action_text);
// update the group members
$groupmem_qry=mysqli_query($drs_db,"select writeupid from links where linkgroup=\"$group\"");
while ($edit_row=mysqli_fetch_row($groupmem_qry)) {
$writeup_to_edit=$edit_row[0];
$writeup_action_text=dblookup($drs_db,"writeups","id","action_text",$writeup_to_edit);
$full_action_text=$writeup_action_text." GROUP ACTION TAKEN: ".$clean_edit_action_text;
mysqli_query($drs_db,"update writeups set status=\"$edit_status\",action_by=\"$edit_action_by\",action_date=\"$edit_action_date\",action_time=\"$edit_action_time\",action_reason=\"$edit_action_reason\",action_text=\"$full_action_text\" where id=\"$writeup_to_edit\"");
$fail=mysqli_error($drs_db);
}
} else {
$fail="A status change reason was not selected.";
}
}
if ($search) {
// strip whitespace from beginning and end of text fields
$s_reported_by=trim($s_reported_by);
$s_discrepancy_text=trim($s_discrepancy_text);
// build the query string
$query_string="";
// device
if (isset($s_device)) {
$query_string="{$query_string}(";
$device_param="Devices:";
foreach ($s_device as $dev_val) {
$query_string="{$query_string}device=\"{$dev_val}\" or ";
$device_dsp=dblookup($drs_db,"devices","id","name",$dev_val);
$device_param="{$device_param} {$device_dsp}, ";
}
$device_param=rtrim($device_param,", ");
$num_devices=mysqli_num_rows(mysqli_query($drs_db,"select id from devices"));
if (count($s_device)==$num_devices) $device_param="Devices: any";
$query_string=rtrim($query_string," or ");
$query_string="{$query_string})";
$query_string="{$query_string} and ";
}
// subsystem
if (isset($s_subsystem)) {
$query_string="{$query_string}(";
$subsystem_param="Subsystems:";
foreach ($s_subsystem as $sub_val) {
$query_string="{$query_string}subsystem=\"{$sub_val}\" or ";
$subsystem_dsp=dblookup($drs_db,"subsystems","id","name",$sub_val);
$subsystem_param="{$subsystem_param} {$subsystem_dsp}, ";
}
$subsystem_param=rtrim($subsystem_param,", ");
$num_subsystems=mysqli_num_rows(mysqli_query($drs_db,"select id from subsystems"));
if (count($s_subsystem)==$num_subsystems) $subsystem_param="Subsystems: any";
$query_string=rtrim($query_string," or ");
$query_string="{$query_string})";
$query_string="{$query_string} and ";
}
// discovered
if (isset($s_discovered)) {
$query_string="{$query_string}(";
$discovered_param="{$discovered_term_short}s:";
foreach ($s_discovered as $disc_val) {
$query_string="{$query_string}discovered=\"{$disc_val}\" or ";
$disc_dsp=$disc_val;
$discovered_param="{$discovered_param} {$disc_dsp}, ";
}
$discovered_param=rtrim($discovered_param,", ");
$num_discovereds=mysqli_num_rows(mysqli_query($drs_db,"select id from discovered"));
if (count($s_discovered)==$num_discovereds) $discovered_param="{$discovered_term_short}s: any";
$query_string=rtrim($query_string," or ");
$query_string="{$query_string})";
$query_string="{$query_string} and ";
}
// functional
if (isset($s_functional)) {
$query_string="{$query_string}(";
$func_param="$functional_term:";
foreach ($s_functional as $func_val) {
$query_string="{$query_string}functional=\"{$func_val}\" or ";
if ($func_val=="0") $func_dsp="<font color=\"#FF0000\">$functional_no_short</font>";
if ($func_val=="1") $func_dsp="<font color=\"#00FF00\">$functional_yes_short</font>";
$func_param="{$func_param} {$func_dsp}, ";
}
$func_param=rtrim($func_param,", ");
$query_string=rtrim($query_string," or ");
$query_string="{$query_string})";
$query_string="{$query_string} and ";
}
// status
if (isset($s_status)) {
$query_string="{$query_string}(";
$status_param="Status:";
foreach ($s_status as $stat_val) {
$query_string="{$query_string}status=\"{$stat_val}\" or ";
if ($stat_val=="1") $stat_dsp="<font color=\"#FF0000\">OPEN</font>";
if ($stat_val=="2") $stat_dsp="<font color=\"#00FF00\">CLSD</font>";
if ($stat_val=="3") $stat_dsp="<font color=\"#FFFF00\">DFRD</font>";
$status_param="{$status_param} {$stat_dsp}, ";
}
$status_param=rtrim($status_param,", ");
$query_string=rtrim($query_string," or ");
$query_string="{$query_string})";
$query_string="{$query_string} and ";
}
// report date
$query_string="{$query_string}(";
$query_string="{$query_string}report_date between \"{$s_report_date_start}\" and \"{$s_report_date_end}\"";
$query_string="{$query_string})";
$query_string="{$query_string} and ";
$reportdate_param="Report date between {$s_report_date_start} and {$s_report_date_end}";
// report time
$query_string="{$query_string}(";
$query_string="{$query_string}report_time between \"{$s_report_time_start}\" and \"{$s_report_time_end}\"";
$query_string="{$query_string})";
$query_string="{$query_string} and ";
$reporttime_param="Report time between {$s_report_time_start} and {$s_report_time_end}";
// discrepancy text
if (isset($s_discrepancy_text)) {
$query_string="{$query_string}(";
$query_string="{$query_string}discrepancy_text like \"%{$s_discrepancy_text}%\"";
$query_string="{$query_string})";
$query_string="{$query_string} and ";
$discrepancytext_param="Text in discrepancy: {$s_discrepancy_text}";
} else {
$discrepancytext_param="Text in discrepancy: any";
}
// reported by
if (isset($s_reported_by)) {
$query_string="{$query_string}(";
$query_string="{$query_string}reported_by like \"%{$s_reported_by}%\"";
$query_string="{$query_string})";
$query_string="{$query_string} and ";
$repby_param="Text in Reported by: {$s_reported_by}";
} else {
$repby_param="Text in Reported by: any";
}
$query_string=rtrim($query_string," and ");
$query_string="select * from writeups where {$query_string} order by report_date asc";
}
// ******** end database manipulation ********
pagetable("begin");
if (!$print) {
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
echo "<br>";
if ($action=="add") {
if (!isset($targets)) $targets=[];
if (count($targets) > 1) {
$plural="s";
} else {
$plural="";
}
if ($save && !$fail) {
format_message(0,"<strong>Writeup$plural successfully added.</strong> <a href=\"groups.php\">Return to Writeup Groups page.</a>");
} elseif ($save && $fail) {
format_message(2,"<strong>An error was encountered when adding writeup$plural.</strong> The error was \" $fail \"");
}
if ($save) {
// show the group
$mode="view";
group_detail($group,$role,$mode);
if ($role) {
// show buttons
echo "
<form method=post action=\"groups.php\">
<input type=\"hidden\" name=\"group\" value=\"$group\">
<input type=\"hidden\" name=\"action\" value=\"add\">
<button name=\"action\" value=\"add\" type=\"submit\">Add writeups to this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"remove\" type=\"submit\">Remove writeups from this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"dissolve\" type=\"submit\">Dissolve this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"setname\" type=\"submit\">Set name for this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"takeaction\" type=\"submit\">Take group action</button>
</form>
";
}
} else {
if ($role){
// show mini search with discrepancy data only
echo "
<form method=post action=\"groups.php\">
<input type=\"hidden\" name=\"group\" value=\"$group\">
<input type=\"hidden\" name=\"action\" value=\"add\">
<b>Search Parameters</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Enter search terms to find writeups to add to the group.<br>
<table border=\"0\" cellpadding=\"5\">
<tr>
<td align=\"left\">
";
// Status cell **********************
echo "
Status<br>
";
if ($search) {
$openstate=$clsdstate=$dfrdstate="";
if (in_array("1",$s_status,true)) $openstate="selected";
if (in_array("2",$s_status,true)) $clsdstate="selected";
if (in_array("3",$s_status,true)) $dfrdstate="selected";
} else {
$openstate=$clsdstate=$dfrdstate="selected";
}
echo "
<select name=\"s_status[]\" id=\"ms-status\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
<option title=\"Open\" value=\"1\" $openstate>OPEN</option>
<option title=\"Closed\" value=\"2\" $clsdstate>CLSD</option>
<option title=\"Deferred\" value=\"3\" $dfrdstate>DFRD</option>
</select>
";
// **********************************
echo "
</td>
<td align=\"left\">
";
// Device cell *********************
echo "
Device<br>
<select name=\"s_device[]\" id=\"ms-device\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
";
$drow=mysqli_query($drs_db,"select * from devices order by id asc");
while ($ditem=mysqli_fetch_assoc($drow)) {
if (!$search || in_array($ditem["id"],$s_device,true)) {
printf("<option value=\"%s\" selected>%s</option>",$ditem["id"],$ditem["name"]);
} else {
printf("<option value=\"%s\">%s</option>",$ditem["id"],$ditem["name"]);
}
}
echo "
</select>
";
// **********************************
echo "
</td>
<td align=\"left\">
";
// Subsystem cell *******************
echo "
Subsystem<br>
<select name=\"s_subsystem[]\" id=\"ms-subsystem\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
";
$ssrow=mysqli_query($drs_db,"select * from subsystems order by id asc");
while ($ssitem=mysqli_fetch_assoc($ssrow)) {
if (!$search || in_array($ssitem["id"],$s_subsystem,true)) {
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$ssitem["id"],$ssitem["description"],$ssitem["name"]);
} else {
printf("<option value=\"%s\" title=\"%s\">%s</option>",$ssitem["id"],$ssitem["description"],$ssitem["name"]);
}
}
echo "
</select>
";
// **********************************
echo "
</td>
";
echo "
</tr>
<tr>
<td align=\"left\">
";
// Discovered cell **********************
echo "
$discovered_term<br>
<select name=\"s_discovered[]\" id=\"ms-discovered\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
";
$discrow=mysqli_query($drs_db,"select * from discovered order by whendiscoveredname asc");
while ($discitem=mysqli_fetch_assoc($discrow)) {
if (!$search || in_array($discitem["id"],$s_discovered,true)) {
printf("<option value=\"%s\" title=\"%s\" selected>%s</option>",$discitem["id"],$discitem["whendiscovereddesc"],$discitem["whendiscoveredname"]);
} else {
printf("<option value=\"%s\" title=\"%s\">%s</option>",$discitem["id"],$discitem["whendiscovereddesc"],$discitem["whendiscoveredname"]);
}
}
echo "
</select>
";
// **********************************
echo "
</td>
<td align=\"left\">
";
// Report Date cell *****************
echo "
Report Date Between<br>
<input type=\"text\" name=\"s_report_date_start\" size=\"10\" maxlength=\"10\" value=\"$s_report_date_start\" id=\"sdp-report_date\" title=\"Format: YYYY-MM-DD\">
&nbsp;and&nbsp;
<input type=\"text\" name=\"s_report_date_end\" size=\"10\" maxlength=\"10\" value=\"$s_report_date_end\" id=\"edp-report_date\" title=\"Format: YYYY-MM-DD\">
";
// **********************************
echo "
</td>
";
echo "
<td align=\"left\">
";
// Report Time cell *****************
echo "
Report Time Between<br>
<input type=\"text\" name=\"s_report_time_start\" size=\"8\" maxlength=\"8\" value=\"$s_report_time_start\" title=\"Format: HH:MM:SS\">
&nbsp;and&nbsp;
<input type=\"text\" name=\"s_report_time_end\" size=\"8\" maxlength=\"8\" value=\"$s_report_time_end\" title=\"Format: HH:MM:SS\">
";
// **********************************
echo "
</td>
</tr>
<tr><td></td><td></td><td></td></tr>
<tr>
<td colspan=\"3\">
";
// Discrepancy text cell ************
echo "
Words in Discrepancy<br>
<textarea rows=\"5\" cols=\"80\" name=\"s_discrepancy_text\" wrap=\"soft\">$s_discrepancy_text</textarea><br>
";
// **********************************
echo "
</td>
</tr>
<tr>
<td align=\"left\">
";
// Reported by cell *****************
echo "
Reported by<br>
<input type=\"text\" name=\"s_reported_by\" size=\"30\" value=\"$s_reported_by\">
";
// **********************************
echo "
</td>
<td align=\"left\">
";
// functional cell ************
echo "
$functional_term? &nbsp; <img src=\"icons/question.png\" title=\"" . FUNCTIONAL_HELP_TXT . "\"><br>
";
if ($search) {
$funcyesstate=$funcnostate="";
if (in_array("1",$s_functional,true)) $funcyesstate="selected";
if (in_array("0",$s_functional,true)) $funcnostate="selected";
} else {
$funcyesstate=$funcnostate="selected";
}
echo "
<select name=\"s_functional[]\" id=\"ms-functional\" multiple title=\"If you uncheck all, then this field will not be included in the search.\">
<option value=\"1\" $funcyesstate>$functional_yes</option>
<option value=\"0\" $funcnostate>$functional_no</option>
</select>
</td>
";
// **********************************"
echo "
<td align=\"right\">
<input type=\"submit\" name=\"search\" value=\"Find Writeups\">
</td></tr>
</table>
</form>";
// display the results
if ($search) {
$writeup_qry=mysqli_query($drs_db,$query_string);
if (mysqli_num_rows($writeup_qry)) {
echo "
<form method=post action=\"groups.php\">
<input type=\"hidden\" name=\"group\" value=\"$group\">
<input type=\"hidden\" name=\"action\" value=\"add\">
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
<tr>
<th style=\"width:1%;\">Select</th>
<th style=\"width:1%;\">ID</th>
<th style=\"width:1%;\">Status</th>
<th style=\"width:100px;\">Date</th>
<th style=\"width:1%;\">Device</th>
<th style=\"width:1%;\">Reported by</th>
<th>Discrepancy</th>
<th style=\"width:1%;\">$functional_term_short</th>
</tr>
";
while ($tablerow = mysqli_fetch_assoc($writeup_qry)) {
// determine functional icon
if($tablerow["functional"]==1) {
$func_icon="<img src=\"icons/tick.png\" border=\"0\" title=\"$functional_yes\" alt=\"$functional_yes\">";
} else {
$func_icon="<img src=\"icons/cross.png\" border=\"0\" title=\"$functional_no\" alt=\"$functional_no\">";
}
// determine status indicator
if ($tablerow['status']==1) $statusind="<font color=\"#FF0000\"><div title=\"Open\">OPEN</div></font>";
if ($tablerow['status']==2) $statusind="<font color=\"#00FF00\"><div title=\"Closed\">CLSD</div></font>";
if ($tablerow['status']==3) $statusind="<font color=\"#FFFF00\"><div title=\"Deferred\">DFRD</div></font>";
// convert device number to name
$dname=dblookup($drs_db,"devices","id","name",$tablerow["device"]);
$disc_txt="{$tablerow["discrepancy_text"]}";
// determine if this is a member of a group
$member_qry=mysqli_query($drs_db,"select linkgroup from links where writeupid=\"{$tablerow['id']}\"");
$is_member=mysqli_num_rows($member_qry);
if ($is_member) {
$group_count=$is_member;
$member_group=mysqli_fetch_row($member_qry)[0];
$member_group_name=dblookup($drs_db,"groups","id","name",$member_group);
if ($member_group_name) {
$imgtitle="Member of group: $member_group_name";
} else {
$imgtitle="Member of group ID: $member_group";
}
if ($group_count == 1) {
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php?group=$member_group\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"$imgtitle\"></a></div>";
} else {
$disc_txt=$disc_txt."<div align=\"right\"><a href=\"groups.php\"><img src=\"icons/block.png\" alt=\"GRP\" title=\"View writeup groups\"></a></div>";
}
}
// print table row
printf(
"<tr>
<td align=\"center\" valign=\"top\"><input type=\"checkbox\" name=\"targets[]\" value=\"%s\"></td>
<td align=\"center\" valign=\"top\"><a href=\"writeupdetail.php?id=%s\" title=\"View or change details of this writeup\">%s</a></td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">%s</td>
</tr>\n",
$tablerow["id"],
$tablerow["id"],$tablerow["id"],
$statusind,
$tablerow["report_date"],
$dname,
$tablerow["reported_by"],
$disc_txt,
$func_icon
);
}
echo "
</table>\n
<br>
Select the writeups above you'd like to add to the group and &nbsp;&nbsp;
<button name=\"save\" value=\"save\" type=\"submit\">Save group</button>
<br><br>
If nothing looks appropriate, you can modify the search parameters above and search again or select another menu option.
</form>";
} else {
echo "
<b>No writeups match your search parameters.</b><br><br>
You can modify the search parameters above and search again or select another menu option.
";
}
}
}
}
} elseif ($action=="remove") {
if ($save && !$fail) {
format_message(0,"<strong>Group successfully modified.</strong> <a href=\"groups.php\">Return to Writeup Groups page.</a>");
} elseif ($save && $fail) {
format_message(2,"<strong>An error was encountered when modifying group.</strong> The error was \" $fail \"");
}
if ($role && mysqli_num_rows(mysqli_query($drs_db,"select id from links where linkgroup=$group"))) {
// show group table with everything selected
echo "
<form method=post action=\"groups.php\">
<input type=\"hidden\" name=\"group\" value=\"$group\">
<input type=\"hidden\" name=\"action\" value=\"remove\">
";
group_detail($group,$role,"select","all");
echo "
Deselect the writeups you want to remove from this group. <br><br>
<b>NOTE:</b> Deselecting them all will dissolve the group.
<br><br>
<button name=\"save\" value=\"save\" type=\"submit\">Modify this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"cancel\" value=\"cancel\" type=\"submit\">Cancel</button>
</form>
";
}
} elseif ($action=="dissolve") {
if ($save && !$fail) {
format_message(0,"<strong>Group dissolved.</strong> <a href=\"groups.php\">Return to Writeup Groups page.</a>");
} elseif ($save && $fail) {
format_message(2,"<strong>An error was encountered when dissolving the group.</strong> The error was \" $fail \"");
} else {
if ($role) {
echo "
<form method=post action=\"groups.php\">
<input type=\"hidden\" name=\"group\" value=\"$group\">
<input type=\"hidden\" name=\"action\" value=\"dissolve\">
<b>NOTE:</b> Dissolving this group will unassign its member writeups and remove the group.<br><br>
It will not delete any writeups or affect their assignment to other groups.<br><br>
<button name=\"save\" value=\"save\" type=\"submit\">Dissolve this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"cancel\" value=\"cancel\" type=\"submit\">Cancel</button>
</form>
";
}
// show the group
$mode="view";
group_detail($group,$role,$mode);
if ($role) {
// show buttons
echo "
<form method=post action=\"groups.php\">
<input type=\"hidden\" name=\"group\" value=\"$group\">
<button name=\"action\" value=\"add\" type=\"submit\">Add writeups to this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"remove\" type=\"submit\">Remove writeups from this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"dissolve\" type=\"submit\">Dissolve this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"setname\" type=\"submit\">Set name for this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"takeaction\" type=\"submit\">Take group action</button>
</form>
";
}
}
} elseif ($action=="setname") {
if ($save && !$fail) {
format_message(0,"<strong>Group name updated.</strong> <a href=\"groups.php\">Return to Writeup Groups page.</a>");
} elseif ($save && $fail) {
format_message(2,"<strong>An error was encountered when updating the group name.</strong> The error was \" $fail \"");
}
if ($role) {
// get current group name if there is one and show the form
$curr_name=dblookup($drs_db,"groups","id","name",$group);
echo "
<form method=post action=\"groups.php\">
<input type=\"hidden\" name=\"group\" value=\"$group\">
<input type=\"hidden\" name=\"action\" value=\"setname\">
<input type=\"text\" name=\"name\" size=\"60\" value=\"$curr_name\">
<button name=\"save\" value=\"save\" type=\"submit\">Update group name</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"cancel\" value=\"cancel\" type=\"submit\">Cancel</button>
</form>
";
}
// show the group
$mode="view";
group_detail($group,$role,$mode);
if ($role) {
// show buttons
echo "
<form method=post action=\"groups.php\">
<input type=\"hidden\" name=\"group\" value=\"$group\">
<button name=\"action\" value=\"add\" type=\"submit\">Add writeups to this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"remove\" type=\"submit\">Remove writeups from this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"dissolve\" type=\"submit\">Dissolve this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"setname\" type=\"submit\">Set name for this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"takeaction\" type=\"submit\">Take group action</button>
</form>
";
}
} elseif ($action=="takeaction") {
if ($save && !$fail) {
format_message(0,"<strong>Group action completed.</strong> <a href=\"groups.php\">Return to Writeup Groups page.</a>");
} elseif ($save && $fail) {
format_message(2,"<strong>An error was encountered when taking group action.</strong> The error was \" $fail \"");
}
// show the group
$mode="view";
group_detail($group,$role,$mode);
if ($role && ! $save) {
// show action form
echo "
<form method=post action=\"groups.php\">
<input type=\"hidden\" name=\"group\" value=\"$group\">
<input type=\"hidden\" name=\"action\" value=\"takeaction\">
<table border=\"0\" cellpadding=\"5\" width=\"600\">
<tr>
<td>Status<br>
<select name=\"edit_status\" id=\"status\">
<option value=\"1\">OPEN</option>
<option value=\"2\"selected>CLOSED</option>
<option value=\"3\">DEFERRED</option>
</select>
</td>
<td>Action taken by<br>
";
if ($role==ADMIN) {
// allow selection of tech name
echo "
<select name=\"edit_action_by\" id=\"user\">
";
$persrow=mysqli_query($drs_db,"select id,firstname,lastname from users where active is true order by lastname asc");
while ($persitem=mysqli_fetch_assoc($persrow)) {
if ($userid==$persitem["id"]) {
printf("<option value=\"%s\" selected>%s %s</option>",$persitem["id"],$persitem["firstname"],$persitem["lastname"]);
} else {
printf("<option value=\"%s\">%s %s</option>",$persitem["id"],$persitem["firstname"],$persitem["lastname"]);
}
}
echo "
</select>
";
} else {
// limit the choice to the tech in question
echo "
<select name=\"edit_action_by\" id=\"user\">
";
$persrow=mysqli_query($drs_db,"select id,firstname,lastname from users where active is true order by lastname asc");
while ($persitem=mysqli_fetch_assoc($persrow)) {
if ($userid==$persitem["id"]) {
printf("<option value=\"%s\" selected>%s %s</option>",$persitem["id"],$persitem["firstname"],$persitem["lastname"]);
}
}
echo "
</select>
";
}
echo "
</td>
<td>Status change reason<br>
<select name=\"edit_action_reason\" id=\"reason\">
";
$reasrow=mysqli_query($drs_db,"select id,text from reasons where active is true order by id asc");
if ($edit_action_reason==NULL) echo "<option selected></option>";
while ($reasitem=mysqli_fetch_assoc($reasrow)) {
if ($edit_action_reason==$reasitem["id"]) {
printf("<option value=\"%s\" selected>%s</option>",$reasitem["id"],$reasitem["text"]);
} else {
printf("<option value=\"%s\">%s</option>",$reasitem["id"],$reasitem["text"]);
}
}
echo "
</select>
</td>
</tr>
<tr><td></td><td></td><td></td></tr>
<tr><td colspan=\"3\">
Action Taken <font size=\"-2\">(required)</font><br>
<textarea rows=\"10\" cols=\"80\" name=\"edit_action_text\" wrap=\"soft\"></textarea><br>
</td>
</tr>
<tr>
<td align=\"left\" >Action Taken Date<br>
<input type=\"text\" name=\"edit_action_date\" size=\"10\" maxlength=\"10\" value=\"$today\" id=\"actiondatepicker\" title=\"Format: YYYY-MM-DD\"></td>
<td align=\"left\">Action Taken Time<br>
<input type=\"text\" name=\"edit_action_time\" size=\"8\" maxlength=\"8\" value=\"$now\" title=\"Format: HH:MM:SS\"></td>
<td align=\"right\" valign=\"bottom\"><button type=\"submit\" name=\"save\" value=\"save\">Save action</button></td>
</tr>
<tr>
<td align=\"left\" valign=\"bottom\">
<td></td><td align=\"right\" valign=\"bottom\">
<input type=\"submit\" name=\"cancel\" value=\"Cancel Changes\"></td>
</tr>
</table>
</form>
";
}
} else {
if ($role) {
echo "
<form method=post action=\"groups.php\">
<button name=\"action\" value=\"add\" type=\"submit\">Create a new group</button>
</form>
<hr>
";
}
if ($group!=NULL) {
// show only the requested group
$mode="view";
group_detail($group,$role,$mode);
if ($role) {
// show buttons
echo "
<form method=post action=\"groups.php\">
<input type=\"hidden\" name=\"group\" value=\"$group\">
<button name=\"action\" value=\"add\" type=\"submit\">Add writeups to this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"remove\" type=\"submit\">Remove writeups from this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"dissolve\" type=\"submit\">Dissolve this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"setname\" type=\"submit\">Set name for this group</button>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name=\"action\" value=\"takeaction\" type=\"submit\">Take group action</button>
</form>
";
}
echo "<hr><br>";
} else {
// show group table
$groups_qry=mysqli_query($drs_db,"select * from groups");
if (mysqli_num_rows($groups_qry)) {
echo "
<br><br>
<table border=\"1\" cellpadding=\"5\" style=\"width:100%;\">
<tr>
<th style=\"width:1%;\">ID</th>
<th>Name</th>
<th style=\"width:1%;\">Writeups assigned</th>
</tr>
";
while ($grouprow=mysqli_fetch_assoc($groups_qry)) {
$num_query=mysqli_query($drs_db,"select id from links where linkgroup={$grouprow['id']}");
$num_writeups=mysqli_num_rows($num_query);
if($grouprow['name']=="") {
$name_text="Group {$grouprow['id']} has not been named";
} else {
$name_text="{$grouprow['name']}";
}
// print table row
printf(
"<tr>
<td align=\"center\" valign=\"top\"><a href=\"groups.php?group=%s\" title=\"View or change details of this group\">%s</a></td>
<td valign=\"top\">%s</td>
<td align=\"center\" valign=\"top\">%s</td>
</tr>\n",
$grouprow["id"],$grouprow["id"],
$name_text,
$num_writeups
);
}
echo "</table><br>";
} else {
echo "<br>No writeup groups were found.<br><br><br>";
}
}
}
echo "<br>";
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>

Some files were not shown because too many files have changed in this diff Show More