From c47e3bfff4085690778075429b62b2d443637409 Mon Sep 17 00:00:00 2001
From: Bruce Bannon
Date: Sat, 16 Sep 2023 02:39:06 -0600
Subject: [PATCH 1/3] example of reworked phpDoc
---
access.php | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/access.php b/access.php
index 75eb09dcf..ae8e9caf3 100644
--- a/access.php
+++ b/access.php
@@ -3,11 +3,11 @@
* This page is used to manage user access rights.
*
* It has three different modes:
- * - list users to manage (no parameters)
- * - manage a single user's rights (just "user" parameter)
- * this will include which functions the user can access and
- * (if $ALLOW_VIEW_OTHER is 'Y') which calendars they can view/edit/approve
- * - update the database (form handler)
+ * - list users to manage (no parameters)
+ * - manage a single user's rights (just "user" parameter)
+ * this will include which functions the user can access and
+ * (if $ALLOW_VIEW_OTHER is 'Y') which calendars they can view/edit/approve
+ * - update the database (form handler)
*
* Input Parameters:
* user - specifies which user to manage, a form will be presented
@@ -15,6 +15,11 @@
*
* access_N - where N is 0 to ACCESS_NUMBER_FUNCTIONS as defined in
* includes/access.php. Each should be either 'Y' or 'N'.
+ *
+ * @package WebCalendar
+ */
+/**
+ * Include the basics.
*/
require_once 'includes/init.php';
@@ -443,7 +448,14 @@
echo print_trailer();
/**
- * Get the list of users that the specified user can see.
+ * get_list_of_users
+ *
+ * @param string $user
+ *
+ * @global string $is_admin
+ * @global string $is_nonuser_admin
+ *
+ * @return array of users that the specified user can see.
*/
function get_list_of_users( $user ) {
global $is_admin, $is_nonuser_admin;
From 68332b75ee745ed278c8f2a8e9ce0e813f94db1a Mon Sep 17 00:00:00 2001
From: Bruce Bannon
Date: Sat, 16 Sep 2023 08:28:49 -0600
Subject: [PATCH 2/3] examples of new-ish php functions to shorten code
---
about.php | 2 +-
access.php | 32 ++++++++--------
admin.php | 11 ++++--
includes/functions.php | 84 +++++++++++++++---------------------------
4 files changed, 55 insertions(+), 74 deletions(-)
diff --git a/about.php b/about.php
index 56a6f7e45..43c692c4c 100644
--- a/about.php
+++ b/about.php
@@ -35,11 +35,11 @@
' . ( empty ( $credits ) ? '' : "
+
-
" ) . print_trailer ( false,true,true );
?>
diff --git a/access.php b/access.php
index 75eb09dcf..f8eaf87ed 100644
--- a/access.php
+++ b/access.php
@@ -204,9 +204,7 @@
$div = ceil( ACCESS_NUMBER_FUNCTIONS / 4 );
// We can reorder the display of user rights here.
- $order = [
- 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 27,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26];
+ $order = array_merge ( [1, 0], range ( 2, 14 ), [27], range ( 15, 26 ) );
// Make sure that we have defined all the types of access
// defined in access.php.
assert( count( $order ) == ACCESS_NUMBER_FUNCTIONS );
@@ -343,6 +341,10 @@
$bottomedge = '';
if( $j == 3 )
continue;
+
+ $j8 = $j * 8;
+ $j64 = $j * 64;
+
echo '