[geeklog-cvs] geeklog-1.3/public_html calendar.php,1.47,1.48

dhaun at iowaoutdoors.org dhaun at iowaoutdoors.org
Sat Sep 4 15:42:51 EDT 2004


Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv6475

Modified Files:
	calendar.php 
Log Message:
Avoid using 'mode=' in the URL if it isn't necessary.


Index: calendar.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/calendar.php,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** calendar.php	29 Aug 2004 14:16:06 -0000	1.47
--- calendar.php	4 Sep 2004 19:42:48 -0000	1.48
***************
*** 160,163 ****
--- 160,185 ----
  
  /**
+ * Add the 'mode=' parameter to a URL
+ *
+ * @param    string  $mode   the mode ('personal' or empty string)
+ * @param    boolean $more   whether there are more parameters in the URL or not
+ * @param    string          'mode' parameter for the URL or an empty string
+ *
+ */
+ function addMode ($mode, $more = true)
+ {
+     $retval = '';
+ 
+     if (!empty ($mode)) {
+         $retval .= 'mode=' . $mode;
+         if ($more) {
+             $retval .= '&';
+         }
+     }
+ 
+     return $retval;
+ }
+ 
+ /**
  * Gets a small, text-only version of a calendar
  *
***************
*** 598,603 ****
          }
          $monthname = $cal->getMonthName($monthnum);
!         $cal_templates->set_var('day'.$i,$dayname . ", <a href=\"{$_CONF['site_url']}/calendar.php?mode=$mode&view=day&day=$daynum&month=$monthnum&year=$yearnum\">" . strftime ('%x', $thedate[1]) . '</a>');
!         $cal_templates->set_var('langlink_addevent'.$i, '<a href="' . $_CONF['site_url'] . "/submit.php?type=event&mode=$mode&day=$daynum&month=$monthnum&year=$yearnum" . '">' . $LANG30[8] . '</a>');
          if ($mode == 'personal') {
              $calsql = "SELECT * FROM {$_TABLES['personal_events']} WHERE (uid = {$_USER['uid']}) AND ((allday=1 AND datestart = \"$yearnum-$monthnum-$daynum\") OR (datestart >= \"$yearnum-$monthnum-$daynum 00:00:00\" AND datestart <= \"$yearnum-$monthnum-$daynum 23:59:59\") OR (dateend >= \"$yearnum-$monthnum-$daynum 00:00:00\" AND dateend <= \"$yearnum-$monthnum-$daynum 23:59:59\") OR (\"$yearnum-$monthnum-$daynum\" between datestart and dateend)) ORDER BY datestart,timestart";
--- 620,632 ----
          }
          $monthname = $cal->getMonthName($monthnum);
!         $cal_templates->set_var ('day' . $i, $dayname . ', <a href="'
!             . $_CONF['site_url'] . '/calendar.php?' . addMode ($mode)
!             . 'view=day&day=' . $daynum . '&month=' . $monthnum
!             . '&year=' . $yearnum . '">' . strftime ('%x', $thedate[1])
!             . '</a>');
!         $cal_templates->set_var ('langlink_addevent' . $i, '<a href="'
!             . $_CONF['site_url'] . '/submit.php?type=event&'
!             . addMode ($mode) . 'day=' . $daynum . '&month=' . $monthnum
!             . '&year=' . $yearnum . '">' . $LANG30[8] . '</a>');
          if ($mode == 'personal') {
              $calsql = "SELECT * FROM {$_TABLES['personal_events']} WHERE (uid = {$_USER['uid']}) AND ((allday=1 AND datestart = \"$yearnum-$monthnum-$daynum\") OR (datestart >= \"$yearnum-$monthnum-$daynum 00:00:00\" AND datestart <= \"$yearnum-$monthnum-$daynum 23:59:59\") OR (dateend >= \"$yearnum-$monthnum-$daynum 00:00:00\" AND dateend <= \"$yearnum-$monthnum-$daynum 23:59:59\") OR (\"$yearnum-$monthnum-$daynum\" between datestart and dateend)) ORDER BY datestart,timestart";
***************
*** 632,636 ****
                  $cal_templates->set_var('event_endtime', ' - ' . $endtime);
              }
!             $cal_templates->set_var('event_title_and_link', '<a href="' . $_CONF['site_url'] . '/calendar_event.php?mode=' . $mode . '&eid=' . $A['eid'] . '">' . stripslashes($A['title']) . '</a>');
              // Provide delete event link if user has access
              if (SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']) == 3 AND $mode == 'personal') {
--- 661,668 ----
                  $cal_templates->set_var('event_endtime', ' - ' . $endtime);
              }
!             $cal_templates->set_var ('event_title_and_link', '<a href="'
!                 . $_CONF['site_url'] . '/calendar_event.php?' . addMode ($mode)
!                 . 'eid=' . $A['eid'] . '">' . stripslashes($A['title'])
!                 . '</a>');
              // Provide delete event link if user has access
              if (SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']) == 3 AND $mode == 'personal') {
***************
*** 785,790 ****
              }
  
!             $cal_templates->set_var('cal_day_anchortags', '<a href="calendar.php?view=day&mode=' . $mode . '&day=' . $curday->daynumber. '&month=' . $month
!                 . '&year=' . $year . '" class="cal-date">' . $curday->daynumber. '</a><hr>');
  
              if ($mode == 'personal') {
--- 817,825 ----
              }
  
!             $cal_templates->set_var ('cal_day_anchortags', '<a href="'
!                 . $_CONF['site_url'] . 'calendar.php?view=day&'
!                 . addMode ($mode) . 'day=' . $curday->daynumber. '&month='
!                 . $month . '&year=' . $year . '" class="cal-date">'
!                 . $curday->daynumber. '</a><hr>');
  
              if ($mode == 'personal') {
***************
*** 810,818 ****
                          if ($results['title']) {
                              $cal_templates->set_var('cal_day_entries','');
!                             $entries .= '<a href="' . $_CONF['site_url'] . '/calendar_event.php?mode=' . $mode . '&eid=' . $results['eid'] . '" class="cal-event">' . stripslashes ($results['title']) . '</a><hr>';
                          }
                      } 
                  }
!                 for ($z=$z;$z<=4;$z++) {
                      $entries .= '<br>';
                  }
--- 845,857 ----
                          if ($results['title']) {
                              $cal_templates->set_var('cal_day_entries','');
!                             $entries .= '<a href="' . $_CONF['site_url']
!                                 . '/calendar_event.php?' . addMode ($mode)
!                                 . 'eid=' . $results['eid']
!                                 . '" class="cal-event">'
!                                 . stripslashes ($results['title']) . '</a><hr>';
                          }
                      } 
                  }
!                 for ($z = $z; $z <= 4; $z++) {
                      $entries .= '<br>';
                  }




More information about the geeklog-cvs mailing list