From: <cl...@us...> - 2005-09-14 20:45:04
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28924/functions Modified Files: calendar_functions.php init.inc.php Log Message: Multiple calendar selection patch. Needs formatting. Index: calendar_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/calendar_functions.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** calendar_functions.php 25 Oct 2004 02:21:27 -0000 1.8 --- calendar_functions.php 14 Sep 2005 20:44:55 -0000 1.9 *************** *** 77,107 **** // Otherwise just include the requested calendar. else { // Make sure this is not a blacklisted calendar. We don't have // to remove a .ics suffix because it would not have been passed // in the argument. ! if (in_array($cal_filename, $blacklisted_cals)) ! exit(error($lang['l_error_restrictedcal'], $cal_filename)); // If HTTP authenticated, make sure this calendar is available // to the user. if (isset($http_user)) { ! if (!in_array($cal_filename, $apache_map[$http_user])) { // Use the invalid calendar message so that the user is // not made aware of locked calendars. ! exit(error($lang['l_error_invalidcal'], $cal_filename)); } } // Otherwise make sure this calendar is not locked. ! else if (in_array($cal_filename, $locked_cals) && ! !in_array($cal_filename, $unlocked_cals)) { // Use the invalid calendar message so that the user is // not made aware of locked calendars. ! exit(error($lang['l_error_invalidcal'], $cal_filename)); } // Add this calendar. ! array_push($calendars, "$calendar_path/$cal_filename.ics"); } --- 77,117 ---- // Otherwise just include the requested calendar. else { + if(!is_array($cal_filename)) { + $cal_filename_local = array($cal_filename); + } + else { + $cal_filename_local = $cal_filename; + } + + foreach($cal_filename_local as $c) { + // Make sure this is not a blacklisted calendar. We don't have // to remove a .ics suffix because it would not have been passed // in the argument. ! if (in_array($c, $blacklisted_cals)) ! exit(error($lang['l_error_restrictedcal'], $c)); // If HTTP authenticated, make sure this calendar is available // to the user. if (isset($http_user)) { ! if (!in_array($c, $apache_map[$http_user])) { // Use the invalid calendar message so that the user is // not made aware of locked calendars. ! exit(error($lang['l_error_invalidcal'], $c)); } } // Otherwise make sure this calendar is not locked. ! else if (in_array($c, $locked_cals) && ! !in_array($c, $unlocked_cals)) { // Use the invalid calendar message so that the user is // not made aware of locked calendars. ! exit(error($lang['l_error_invalidcal'], $c)); } // Add this calendar. ! array_push($calendars, "$calendar_path/$c.ics"); ! } } *************** *** 140,144 **** // // $cals = The calendars (entire path, e.g. from availableCalendars). ! function display_ical_list($cals) { global $cal, $ALL_CALENDARS_COMBINED, $current_view, $getdate, $calendar_lang, $all_cal_comb_lang; --- 150,154 ---- // // $cals = The calendars (entire path, e.g. from availableCalendars). ! function display_ical_list($cals, $pick=FALSE) { global $cal, $ALL_CALENDARS_COMBINED, $current_view, $getdate, $calendar_lang, $all_cal_comb_lang; *************** *** 178,181 **** --- 188,199 ---- // if it is a webcal. So that is how we perform the comparison when // trying to figure out if this is the selected calendar. + if($pick) { + if (in_array($cal_encoded_tmp, explode(",", $cal))) { + $return .= "<option value=\"$cal_encoded_tmp\" selected=\"selected\">$cal_displayname_tmp</option>\n"; + } else { + $return .= "<option value=\"$cal_encoded_tmp\">$cal_displayname_tmp</option>\n"; + } + } + else { $cal_httpPrefix_tmp = str_replace('webcal://', 'http://', $cal_tmp); if ($cal_httpPrefix_tmp == urldecode($cal)) { *************** *** 185,188 **** --- 203,207 ---- } } + } // option to open all (non-web) calenders together Index: init.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init.inc.php,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** init.inc.php 16 May 2005 18:14:46 -0000 1.73 --- init.inc.php 14 Sep 2005 20:44:55 -0000 1.74 *************** *** 81,86 **** $is_webcal = FALSE; ! if (isset($_GET['cal']) && $_GET['cal'] != '') { $cal_filename = urldecode($_GET['cal']); } else { if (isset($default_cal_check)) { --- 81,99 ---- $is_webcal = FALSE; ! if (isset($_GET['cal'])) { ! //if we get a comma-separated list of calendars, split into array ! if(stristr($_GET['cal'], ",")) { ! $_GET['cal'] = explode(",", $_GET['cal']); ! } ! //if we have an array of calendard, decode each (though I'm not sure this is necessary) ! if(is_array($_GET['cal'])) { ! $cal_filename = array(); ! foreach($_GET['cal'] as $c) { ! $cal_filename[] = urldecode($c); ! } ! } ! else { $cal_filename = urldecode($_GET['cal']); + } } else { if (isset($default_cal_check)) { *************** *** 101,105 **** } ! if (substr($cal_filename, 0, 7) == 'http://' || substr($cal_filename, 0, 8) == 'https://' || substr($cal_filename, 0, 9) == 'webcal://') { $is_webcal = TRUE; $cal_webcalPrefix = str_replace('http://','webcal://',$cal_filename); --- 114,118 ---- } ! if (!is_array($cal_filename) && (substr($cal_filename, 0, 7) == 'http://' || substr($cal_filename, 0, 8) == 'https://' || substr($cal_filename, 0, 9) == 'webcal://')) { $is_webcal = TRUE; $cal_webcalPrefix = str_replace('http://','webcal://',$cal_filename); *************** *** 123,129 **** } } else { ! $cal_displayname = str_replace('32', ' ', $cal_filename); $cal = urlencode($cal_filename); ! if (in_array($cal_filename, $blacklisted_cals)) { exit(error($lang['l_error_restrictedcal'], $cal_filename)); } else { --- 136,155 ---- } } else { ! $cal_displayname = str_replace('32', ' ', (is_array($cal_filename) ? implode(", ", $cal_filename) : $cal_filename)); ! if(is_array($cal_filename)) { ! $cal = array(); ! $blacklisted = FALSE; ! foreach($cal_filename as $c) { ! $cal[] = urlencode($c); ! if(in_array($c, $blacklisted_cals)) $blacklisted = TRUE; ! } ! $cal = implode(",", $cal); ! } ! else { $cal = urlencode($cal_filename); ! $blacklisted = in_array($cal_filename, $blacklisted_cals); ! } ! ! if ($blacklisted) { exit(error($lang['l_error_restrictedcal'], $cal_filename)); } else { |