Changeset:
        a1ef55c35f62
        
https://sourceforge.net/p/mrbs/hg-code/ci/a1ef55c35f62e7fb9cc2475f91d2bdd23fc3c91d
Author:
        Campbell Morrison <[email protected]>
Date:
        Thu Mar 02 11:21:04 2017 +0000
Log message:

Moved the "You are [username]" link out into a function.

diffstat:

 web/Themes/default/header.inc       |   2 +-
 web/session/functions_session.inc   |  11 +++++++++++
 web/session/session_cookie.inc      |  16 +++-------------
 web/session/session_http.inc        |  17 ++---------------
 web/session/session_joomla.inc      |  15 +++------------
 web/session/session_php.inc         |  15 +++------------
 web/session/session_remote_user.inc |  22 ++++++----------------
 web/session/session_wordpress.inc   |  15 +++------------
 8 files changed, 32 insertions(+), 81 deletions(-)

diffs (234 lines):

diff -r e31799d3177b -r a1ef55c35f62 web/Themes/default/header.inc
--- a/web/Themes/default/header.inc     Thu Mar 02 10:09:19 2017 +0000
+++ b/web/Themes/default/header.inc     Thu Mar 02 11:21:04 2017 +0000
@@ -191,7 +191,7 @@
     // For session protocols that define their own logon box...
     if (function_exists(__NAMESPACE__ . "\\print_logon_box"))
     {
-      echo "<li>\n";
+      echo "<li id=\"logon_box\">\n";
       print_logon_box();
       echo "</li>\n";
     }
diff -r e31799d3177b -r a1ef55c35f62 web/session/functions_session.inc
--- a/web/session/functions_session.inc Thu Mar 02 10:09:19 2017 +0000
+++ b/web/session/functions_session.inc Thu Mar 02 11:21:04 2017 +0000
@@ -56,3 +56,14 @@
   // Print footer and exit
   print_footer(TRUE);
 }
+
+
+// Generate the "You are xxxx" link, which gives a report on the user's 
upcoming bookings.
+function print_report_link($user)
+{
+  $search_string = "report.php?creatormatch=" . urlencode($user) . 
"&amp;phase=2";
+  $html = "<a href=\"$search_string\" title=\"" . get_vocab('show_my_entries') 
. "\">" .
+           get_vocab('you_are') . " " . htmlspecialchars($user) .
+          "</a>\n";
+  echo $html;
+}
diff -r e31799d3177b -r a1ef55c35f62 web/session/session_cookie.inc
--- a/web/session/session_cookie.inc    Thu Mar 02 10:09:19 2017 +0000
+++ b/web/session/session_cookie.inc    Thu Mar 02 11:21:04 2017 +0000
@@ -259,7 +259,7 @@
 // Print the logon entry on the top banner.
 function print_logon_box()
 {
-  global $QUERY_STRING, $auth, $day, $month, $year;
+  global $QUERY_STRING, $auth;
   
   $target_url = this_page();
 
@@ -269,21 +269,11 @@
   }
   
   $user = getUserName();
+  
   if (isset($user))
   {
-    // words 'you are xxxx' becomes a link to the
-    // report page with only entries created by xxx. Past entries are not
-    // displayed but this can be changed
-    $search_string = "report.php?from_day=$day&amp;from_month=$month&amp;".
-      "from_year=$year&amp;to_day=1&amp;to_month=12&amp;to_year=2030&amp;".
-      
"areamatch=&amp;roommatch=&amp;namematch=&amp;descrmatch=&amp;summarize=1&amp;".
-      "sortby=r&amp;display=d&amp;sumby=d&amp;creatormatch=$user";
+    print_report_link($user);
 ?>
-      <a href="<?php echo "$search_string\" title=\""
-         . get_vocab('show_my_entries') . "\">
-        " . get_vocab('you_are')." "
-         . htmlspecialchars($user) ?>
-      </a>
       <form method="post" action="admin.php">
         <div>
           <input type="hidden" name="target_url" value="<?php echo 
htmlspecialchars($target_url) ?>">
diff -r e31799d3177b -r a1ef55c35f62 web/session/session_http.inc
--- a/web/session/session_http.inc      Thu Mar 02 10:09:19 2017 +0000
+++ b/web/session/session_http.inc      Thu Mar 02 11:21:04 2017 +0000
@@ -73,7 +73,7 @@
 // Print the logon entry on the top banner.
 function print_logon_box()
 {
-  global $QUERY_STRING, $auth, $day, $month, $year;
+  global $QUERY_STRING, $auth;
   
   $target_url = this_page();
 
@@ -85,20 +85,7 @@
   $user = getUserName();
   if (isset($user))
   {
-    // words 'you are xxxx' becomes a link to the
-    // report page with only entries created by xxx. Past entries are not
-    // displayed but this can be changed
-    $search_string = "report.php?from_day=$day&amp;from_month=$month&amp;".
-      
"from_year=$year&amp;to_day=1&amp;to_month=12&amp;to_year=2030&amp;areamatch=&amp;".
-      
"roommatch=&amp;namematch=&amp;descrmatch=&amp;summarize=1&amp;sortby=r&amp;display=d&amp;".
-      "sumby=d&amp;creatormatch=$user";
-?>
-
-
-      <a href="<?php echo "$search_string\" title=\""
-         . get_vocab('show_my_entries') . "\">" . get_vocab('you_are')." "
-         . htmlspecialchars($user) ?></a>
-<?php
+    print_report_link($user);
   }
   else
   {
diff -r e31799d3177b -r a1ef55c35f62 web/session/session_joomla.inc
--- a/web/session/session_joomla.inc    Thu Mar 02 10:09:19 2017 +0000
+++ b/web/session/session_joomla.inc    Thu Mar 02 11:21:04 2017 +0000
@@ -120,7 +120,7 @@
 // Print the logon entry on the top banner.
 function print_logon_box()
 {
-  global $QUERY_STRING, $auth, $day, $month, $year;
+  global $QUERY_STRING, $auth;
   
   $target_url = this_page();
 
@@ -132,17 +132,8 @@
   $user=getUserName();
   if (isset($user))
   {
-    // words 'you are xxxx' becomes a link to the
-    // report page with only entries created by xxx. Past entries are not
-    // displayed but this can be changed
-    $search_string = "report.php?from_day=$day&amp;from_month=$month&amp;".
-      
"from_year=$year&amp;to_day=1&amp;to_month=12&amp;to_year=2030&amp;areamatch=&amp;".
-      
"roommatch=&amp;namematch=&amp;descrmatch=&amp;summarize=1&amp;sortby=r&amp;display=d&amp;".
-      "sumby=d&amp;creatormatch=".urlencode($user); ?>
-
-                <a href="<?php echo "$search_string\" title=\""
-         . get_vocab('show_my_entries') . "\">" . get_vocab('you_are')." "
-         . htmlspecialchars($user) ?></a>
+    print_report_link($user);
+    ?>
                 <form method="post" action="admin.php">
                   <div>
                     <input type="hidden" name="target_url" value="<?php echo 
htmlspecialchars($target_url) ?>">
diff -r e31799d3177b -r a1ef55c35f62 web/session/session_php.inc
--- a/web/session/session_php.inc       Thu Mar 02 10:09:19 2017 +0000
+++ b/web/session/session_php.inc       Thu Mar 02 11:21:04 2017 +0000
@@ -190,7 +190,7 @@
 // Print the logon entry on the top banner.
 function print_logon_box()
 {
-  global $QUERY_STRING, $auth, $day, $month, $year;
+  global $QUERY_STRING, $auth;
 
   $target_url = this_page();
 
@@ -201,17 +201,8 @@
   $user=getUserName();
   if (isset($user))
   {
-    // words 'you are xxxx' becomes a link to the
-    // report page with only entries created by xxx. Past entries are not
-    // displayed but this can be changed
-    $search_string = "report.php?from_day=$day&amp;from_month=$month&amp;".
-      
"from_year=$year&amp;to_day=1&amp;to_month=12&amp;to_year=2030&amp;areamatch=&amp;".
-      
"roommatch=&amp;namematch=&amp;descrmatch=&amp;summarize=1&amp;sortby=r&amp;display=d&amp;".
-      "sumby=d&amp;creatormatch=".urlencode($user); ?>
-
-                <a href="<?php echo "$search_string\" title=\""
-         . get_vocab('show_my_entries') . "\">" . get_vocab('you_are')." "
-         . htmlspecialchars($user) ?></a>
+    print_report_link($user);
+    ?>
                 <form method="post" action="admin.php">
                   <div>
                     <input type="hidden" name="target_url" value="<?php echo 
htmlspecialchars($target_url) ?>">
diff -r e31799d3177b -r a1ef55c35f62 web/session/session_remote_user.inc
--- a/web/session/session_remote_user.inc       Thu Mar 02 10:09:19 2017 +0000
+++ b/web/session/session_remote_user.inc       Thu Mar 02 11:21:04 2017 +0000
@@ -49,28 +49,18 @@
 // Print the logon entry on the top banner.
 function print_logon_box()
 {
-  global $auth, $day, $month, $year;
+  global $auth;
   
   $user = getUserName();
 
   if (isset($user))
   {
-    // words 'you are xxxx' becomes a link to the
-    // report page with only entries created by xxx. Past entries are not
-    // displayed but this can be changed
-    $search_string = "report.php?from_day=$day&amp;from_month=$month&amp;".
-      
"from_year=$year&amp;to_day=1&amp;to_month=12&amp;to_year=2030&amp;areamatch=&amp;".
-      
"roommatch=&amp;namematch=&amp;descrmatch=&amp;summarize=1&amp;sortby=r&amp;display=d&amp;".
-      "sumby=d&amp;creatormatch=$user"; ?>
+    print_report_link($user);
 
-      <a href="<?php echo "$search_string\" title=\""
-         . get_vocab('show_my_entries') . "\">" . get_vocab('you_are')." "
-         . htmlspecialchars($user) ?></a>
-<?php
-  if ($auth['type'] == 'db')
-  {
-    print "<a id=\"user_list_link\" href=\"edit_users.php\">" . 
get_vocab('user_list') . "</a>\n";
-  }
+    if ($auth['type'] == 'db')
+    {
+      print "<a id=\"user_list_link\" href=\"edit_users.php\">" . 
get_vocab('user_list') . "</a>\n";
+    }
 
     // Retrieve logout link from configuration, if specified
     if (isset($auth['remote_user']['logout_link']) &&
diff -r e31799d3177b -r a1ef55c35f62 web/session/session_wordpress.inc
--- a/web/session/session_wordpress.inc Thu Mar 02 10:09:19 2017 +0000
+++ b/web/session/session_wordpress.inc Thu Mar 02 11:21:04 2017 +0000
@@ -126,7 +126,7 @@
 // Print the logon entry on the top banner.
 function print_logon_box()
 {
-  global $QUERY_STRING, $auth, $day, $month, $year;
+  global $QUERY_STRING, $auth;
 
   $target_url = this_page();
 
@@ -138,17 +138,8 @@
   $user=getUserName();
   if (isset($user))
   {
-    // words 'you are xxxx' becomes a link to the
-    // report page with only entries created by xxx. Past entries are not
-    // displayed but this can be changed
-    $search_string = "report.php?from_day=$day&amp;from_month=$month&amp;".
-      
"from_year=$year&amp;to_day=1&amp;to_month=12&amp;to_year=2030&amp;areamatch=&amp;".
-      
"roommatch=&amp;namematch=&amp;descrmatch=&amp;summarize=1&amp;sortby=r&amp;display=d&amp;".
-      "sumby=d&amp;creatormatch=".urlencode($user); ?>
-
-                <a href="<?php echo "$search_string\" title=\""
-         . get_vocab('show_my_entries') . "\">" . get_vocab('you_are')." "
-         . htmlspecialchars($user) ?></a>
+    print_report_link($user);
+    ?>
                 <form method="post" action="admin.php">
                   <div>
                     <input type="hidden" name="target_url" value="<?php echo 
htmlspecialchars($target_url) ?>">

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to