From: <par...@us...> - 2010-04-12 18:58:46
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv20875/functions Modified Files: Tag: phpicalendar-editor calendar_functions.php date_functions.php draw_functions.php event.js ical_parser.php init.inc.php template.php userauth_functions.php Log Message: merge with HEAD Index: calendar_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/calendar_functions.php,v retrieving revision 1.36 retrieving revision 1.36.2.1 diff -C2 -d -r1.36 -r1.36.2.1 *** calendar_functions.php 26 Jan 2009 03:27:30 -0000 1.36 --- calendar_functions.php 12 Apr 2010 18:58:37 -0000 1.36.2.1 *************** *** 188,191 **** --- 188,195 ---- // Print each calendar option. $return = ''; + + $all_cals = false; + if (count($cals) > 1) $all_cals = true; + foreach ($cals as $cal_tmp) { // Format the calendar path for display. *************** *** 245,248 **** --- 249,256 ---- $cal_encoded_tmp = md5($phpiCal_config->salt.$cal_tmp);; } + + // Try to detect unselected calendars + if (!in_array($cal_encoded_tmp, explode(",", $cal))) $all_cals = false; + // Display the option. // *************** *** 252,272 **** if($pick) { if (in_array($cal_encoded_tmp, explode(",", $cal)) || count($cals) == count(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_encoded_tmp == urldecode($cal)) { ! $return .= "<option value=\"$current_view.php?cal=$cal_encoded_tmp&getdate=$getdate\" selected=\"selected\">$cal_displayname_tmp</option>"; ! } else { ! $return .= "<option value=\"$current_view.php?cal=$cal_encoded_tmp&getdate=$getdate\">$cal_displayname_tmp</option>"; } - } } // option to open all (non-web) calenders together if (!$pick) { ! if ($cal == $phpiCal_config->ALL_CALENDARS_COMBINED) { $return .= "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&getdate=$getdate\" selected=\"selected\">$all_cal_comb_lang</option>"; } else { --- 260,279 ---- if($pick) { if (in_array($cal_encoded_tmp, explode(",", $cal)) || count($cals) == count(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 { ! if ($cal_encoded_tmp == $cal || $cal_encoded_tmp == urldecode($cal)) { ! $return .= "<option value=\"$current_view.php?cal=$cal_encoded_tmp&getdate=$getdate\" selected=\"selected\">$cal_displayname_tmp</option>"; ! } else { ! $return .= "<option value=\"$current_view.php?cal=$cal_encoded_tmp&getdate=$getdate\">$cal_displayname_tmp</option>"; ! } } } // option to open all (non-web) calenders together if (!$pick) { ! if ($all_cals || $cal == $phpiCal_config->ALL_CALENDARS_COMBINED) { $return .= "<option value=\"$current_view.php?cal=$phpiCal_config->ALL_CALENDARS_COMBINED&getdate=$getdate\" selected=\"selected\">$all_cal_comb_lang</option>"; } else { *************** *** 274,277 **** --- 281,285 ---- } } + return $return; } \ No newline at end of file Index: date_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/date_functions.php,v retrieving revision 1.52.2.2 retrieving revision 1.52.2.3 diff -C2 -d -r1.52.2.2 -r1.52.2.3 *** date_functions.php 23 Feb 2009 21:28:57 -0000 1.52.2.2 --- date_functions.php 12 Apr 2010 18:58:37 -0000 1.52.2.3 *************** *** 5,8 **** --- 5,32 ---- + // get remote file last modification date (returns unix timestamp) + function remote_filemtime($url) { + $fp = fopen($url, 'r'); + if (!$fp) return 0; + $metadata = stream_get_meta_data($fp); + fclose($fp); + + $unixtime = 0; + foreach ($metadata['wrapper_data'] as $response) { + // case: redirection + // WARNING: does not handle relative redirection + if (substr(strtolower($response), 0, 10) == 'location: ') { + return GetRemoteLastModified(substr($response, 10)); + } + // case: last-modified + else if (substr(strtolower($response), 0, 15) == 'last-modified: ') { + $unixtime = strtotime(substr($response, 15)); + break; + } + } + + return $unixtime; + } + // takes iCalendar 2 day format and makes it into 3 characters // if $txt is true, it returns the 3 letters, otherwise it returns the *************** *** 156,159 **** --- 180,215 ---- return $offset; } + + /* Returns a string to be used in HTML title attributes + $arr is a master array item + $time is the event's UNIX timestamp + */ + function makeTitle($arr, $time) { + global $timeFormat, $dateFormat_week; + + $event_text = chopToWordCount(sanitizeForWeb(urldecode($arr["event_text"])), 20); + if ($time == -1) { + $start = localizeDate($dateFormat_week, $arr['start_unixtime']); + $end = localizeDate($dateFormat_week, ($arr['end_unixtime'] - 60)); + $title = $event_text; + if ($start != $end) $title .= "\n$start - $end"; + } else { + $start = date($timeFormat, $arr['start_unixtime']); + $end = date($timeFormat, $arr['end_unixtime']); + $title = "$start: $event_text"; + if ($start != $end) $title = "$event_text\n$start - $end"; + } + + if (!empty($arr['location'])) { + $title .= "\nLocation: " . chopToWordCount(sanitizeForWeb(urldecode($arr['location'])), 20); + } + if (!empty($arr['description'])) { + $title .= "\n\n" . chopToWordCount(sanitizeForWeb(urldecode($arr['description'])), 80); + } + $title = trim($title); + + return $title; + } + /* Returns a string to make event text with a link to popup boxes $arr is a master array item *************** *** 170,186 **** $event_text = stripslashes(urldecode($arr["event_text"])); # build tooltip ! if ($time == -1) { ! $start = localizeDate($dateFormat_week, $arr['start_unixtime']); ! $end = localizeDate($dateFormat_week, ($arr['end_unixtime'] - 60)); ! $title = $event_text; ! if ($start != $end) $title = "$start - $end $event_text"; ! } else { ! $start = date($timeFormat, $arr['start_unixtime']); ! $end = date($timeFormat, $arr['end_unixtime']); ! $title = "$start: $event_text"; ! if ($start != $end) $title = "$start - $end $event_text"; ! } ! $title .= "\n".urldecode($arr['description'])."\n".urldecode($arr['location']); ! $title = trim($title); # for iCal pseudo tag <http> comptability if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$matches)) { --- 226,230 ---- $event_text = stripslashes(urldecode($arr["event_text"])); # build tooltip ! $title = makeTitle($arr, $time); # for iCal pseudo tag <http> comptability if (ereg("<([[:alpha:]]+://)([^<>[:space:]]+)>",$event_text,$matches)) { *************** *** 191,194 **** --- 235,240 ---- $event_text = strip_tags($event_text, '<b><i><u><img>'); } + + if (!empty($link_class)) $link_class = ' class="'.$link_class.'"'; if (!empty($event_text)) { *************** *** 211,218 **** // --></script>"; ! $return .= '<a class="'.$link_class.'" title="'.$title.'" href="#" onclick="openEventWindow('.$popup_data_index.'); return false;">'; $popup_data_index++; } else { ! $return .= '<a class="'.$link_class.'" title="'.$title.'" href="'.$res[1].'">'; } $return .= $pre_text.$event_text.$post_text.'</a>'."\n"; --- 257,264 ---- // --></script>"; ! $return .= '<a'.$link_class.' title="'.$title.'" href="#" onclick="openEventWindow('.$popup_data_index.'); return false;">'; $popup_data_index++; } else { ! $return .= '<a'.$link_class.' title="'.$title.'" href="'.$res[1].'">'; } $return .= $pre_text.$event_text.$post_text.'</a>'."\n"; Index: draw_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/draw_functions.php,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -C2 -d -r1.9 -r1.9.2.1 *** draw_functions.php 28 Dec 2008 19:30:41 -0000 1.9 --- draw_functions.php 12 Apr 2010 18:58:37 -0000 1.9.2.1 *************** *** 1,5 **** <?php # drawEventTimes returns starttime and endtime and event length for drawing into a grid ! function drawEventTimes ($start, $end) { global $phpiCal_config; $sta_h = $sta_min = $end_h = $end_min = "00"; --- 1,5 ---- <?php # drawEventTimes returns starttime and endtime and event length for drawing into a grid ! function drawEventTimes ($start, $end, $long_event = FALSE) { global $phpiCal_config; $sta_h = $sta_min = $end_h = $end_min = "00"; *************** *** 25,29 **** } ! if (($sta_h . $sta_min) == ($end_h . $end_min)) { $end_min += $gridLength; if ($end_min == 60) { --- 25,29 ---- } ! if ((!$long_event) && (($sta_h . $sta_min) == ($end_h . $end_min))) { $end_min += $gridLength; if ($end_min == 60) { *************** *** 31,36 **** $end_min = "00"; } ! } $draw_len = ($end_h * 60 + $end_min) - ($sta_h * 60 + $sta_min); return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len); } --- 31,37 ---- $end_min = "00"; } ! } $draw_len = ($end_h * 60 + $end_min) - ($sta_h * 60 + $sta_min); + return array ("draw_start" => ($sta_h . $sta_min), "draw_end" => ($end_h . $end_min), "draw_length" => $draw_len); } Index: event.js =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/event.js,v retrieving revision 1.17.2.2 retrieving revision 1.17.2.3 diff -C2 -d -r1.17.2.2 -r1.17.2.3 *** event.js 23 Feb 2009 21:28:57 -0000 1.17.2.2 --- event.js 12 Apr 2010 18:58:37 -0000 1.17.2.3 *************** *** 12,16 **** // open a new window ! var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=275'); form.target = 'Popup'; form.submit(); --- 12,16 ---- // open a new window ! var w = window.open('', 'Popup', 'scrollbars=yes,width=550,height=350'); form.target = 'Popup'; form.submit(); *************** *** 37,41 **** // open a new window ! var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=325'); form.target = 'Popup'; form.submit(); --- 37,41 ---- // open a new window ! var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=350'); form.target = 'Popup'; form.submit(); *************** *** 59,63 **** // open a new window ! var w = window.open('', 'Popup', 'scrollbars=yes,width=460,height=275'); form.target = 'Popup'; form.submit(); --- 59,63 ---- // open a new window ! var w = window.open('', 'Popup', 'scrollbars=yes,width=550,height=350'); form.target = 'Popup'; form.submit(); *************** *** 72,73 **** --- 72,104 ---- //--> </script> + <script language="JavaScript" type="text/javascript"> + <!-- + + function submitform(form, value) { + // Parse value. + var values = decodeURI(value).split("&"); + var temp = values[0].split("?", 2); + var action = temp[0]; + values[0] = temp[1]; + + try { + form.setAttribute("action", action); + } + catch(e) { + form.action = action; + } + + // Stuff the hidden form fields. + for (var i = 0; i < values.length; i++) { + temp = values[i].split("=", 2); + form.elements.namedItem(temp[0]).value = temp[1]; + } + + // Clear the select+option value. + var select = form.elements.namedItem("form_action") + select.options[select.selectedIndex].value = ""; + + form.submit(); + } + //--> + </script> Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.246 retrieving revision 1.246.2.1 diff -C2 -d -r1.246 -r1.246.2.1 *** ical_parser.php 5 Feb 2009 15:19:42 -0000 1.246 --- ical_parser.php 12 Apr 2010 18:58:37 -0000 1.246.2.1 *************** *** 12,16 **** if ($phpiCal_config->save_parsed_cals == 'yes') { if (sizeof ($cal_filelist) > 1) { ! $parsedcal = $phpiCal_config->tmp_dir.'/parsedcal-'.urlencode($cpath.'::'.$cal_filename).'-'.$this_year; if (file_exists($parsedcal)) { $fd = fopen($parsedcal, 'r'); --- 12,16 ---- if ($phpiCal_config->save_parsed_cals == 'yes') { if (sizeof ($cal_filelist) > 1) { ! $parsedcal = $phpiCal_config->tmp_dir.'/parsedcal-'.urlencode($cpath.'::'.$phpiCal_config->ALL_CALENDARS_COMBINED).'-'.$this_year; if (file_exists($parsedcal)) { $fd = fopen($parsedcal, 'r'); *************** *** 20,34 **** $z=1; $y=0; - $webcal_mtime = time() - ($phpiCal_config->webcal_hours * 3600); if (sizeof($master_array['-4']) == (sizeof($cal_filelist))) { foreach ($master_array['-4'] as $temp_array) { $mtime = $master_array['-4'][$z]['mtime']; $fname = $master_array['-4'][$z]['filename']; ! $wcalc = $master_array['-4'][$z]['webcal']; if ($wcalc == 'no') $realcal_mtime = filemtime($fname); ! if (isset($realcal_mtime) && ($mtime == $realcal_mtime) && ($wcalc == 'no')) { ! $y++; ! } elseif (($wcalc == 'yes') && ($mtime > $webcal_mtime)) { ! //echo date('H:i',$mtime). ' > '. date('H:i',$webcal_mtime); $y++; } --- 20,33 ---- $z=1; $y=0; if (sizeof($master_array['-4']) == (sizeof($cal_filelist))) { foreach ($master_array['-4'] as $temp_array) { $mtime = $master_array['-4'][$z]['mtime']; $fname = $master_array['-4'][$z]['filename']; ! $wcalc = $master_array['-4'][$z]['webcal']; ! if ($wcalc == 'no') $realcal_mtime = filemtime($fname); ! else $realcal_mtime = remote_filemtime($fname); ! ! if ($mtime == $realcal_mtime) { $y++; } *************** *** 51,55 **** } else { foreach ($cal_filelist as $filename) { ! $realcal_mtime = filemtime($filename); $parsedcal = $phpiCal_config->tmp_dir.'/parsedcal-'.urlencode($cpath.'::'.$cal_filename).'-'.$this_year; if (file_exists($parsedcal)) { --- 50,60 ---- } else { foreach ($cal_filelist as $filename) { ! if (substr($filename, 0, 7) == 'http://' || substr($filename, 0, 8) == 'https://' || substr($filename, 0, 9) == 'webcal://') { ! $realcal_mtime = remote_filemtime($filename); ! } ! else { ! $realcal_mtime = filemtime($filename); ! } ! $parsedcal = $phpiCal_config->tmp_dir.'/parsedcal-'.urlencode($cpath.'::'.$cal_filename).'-'.$this_year; if (file_exists($parsedcal)) { *************** *** 85,98 **** // Let's see if we're doing a webcal - $is_webcal = FALSE; if (substr($filename, 0, 7) == 'http://' || substr($filename, 0, 8) == 'https://' || substr($filename, 0, 9) == 'webcal://') { ! $is_webcal = TRUE; ! $cal_webcalPrefix = str_replace('http://','webcal://',$filename); ! $cal_httpPrefix = str_replace('webcal://','http://',$filename); ! $cal_httpsPrefix = str_replace('webcal://','https://',$filename); ! $cal_httpsPrefix = str_replace('http://','https://',$cal_httpsPrefix); $filename = $cal_httpPrefix; $master_array['-4'][$calnumber]['webcal'] = 'yes'; ! $actual_mtime = time(); } else { $actual_mtime = @filemtime($filename); --- 90,100 ---- // Let's see if we're doing a webcal if (substr($filename, 0, 7) == 'http://' || substr($filename, 0, 8) == 'https://' || substr($filename, 0, 9) == 'webcal://') { ! $cal_webcalPrefix = str_replace(array('http://', 'https://'), 'webcal://', $filename); ! $cal_httpPrefix = str_replace(array('webcal://', 'https://'), 'http://', $filename); ! $cal_httpsPrefix = str_replace(array('http://', 'webcal://'), 'https://', $filename); $filename = $cal_httpPrefix; $master_array['-4'][$calnumber]['webcal'] = 'yes'; ! $actual_mtime = @remote_filemtime($filename); } else { $actual_mtime = @filemtime($filename); *************** *** 105,109 **** if ($ifile == FALSE) exit(error($lang['l_error_cantopen'], $filename)); $nextline = fgets($ifile, 1024); ! if (trim($nextline) != 'BEGIN:VCALENDAR') exit(error($lang['l_error_invalidcal'], $filename)); // Set a value so we can check to make sure $master_array contains valid data --- 107,111 ---- if ($ifile == FALSE) exit(error($lang['l_error_cantopen'], $filename)); $nextline = fgets($ifile, 1024); ! #if (trim($nextline) != 'BEGIN:VCALENDAR') exit(error($lang['l_error_invalidcal'], $filename)); // Set a value so we can check to make sure $master_array contains valid data *************** *** 127,130 **** --- 129,133 ---- } $line = str_replace('\n',"\n",$line); + $line = str_replace('\t',"\t",$line); $line = trim(stripslashes($line)); switch ($line) { *************** *** 137,141 **** $beginning, $start_of_vevent, $valarm_description, $start_unixtime, $end_unixtime, $display_end_tmp, $end_time_tmp1, ! $recurrence_id, $uid, $rrule, $until_check, $until, $byweek, $byweekno, $byminute, $byhour, $bysecond --- 140,144 ---- $beginning, $start_of_vevent, $valarm_description, $start_unixtime, $end_unixtime, $display_end_tmp, $end_time_tmp1, ! $recurrence_id, $recurrence_d, $recurrence_, $uid, $rrule, $until_check, $until, $byweek, $byweekno, $byminute, $byhour, $bysecond *************** *** 218,221 **** --- 221,226 ---- case 'BEGIN:VTODO': $vtodo_set = TRUE; + $start_date = ''; + $start_time = ''; $summary = ''; $due_date = ''; *************** *** 322,328 **** case 'SUMMARY': - $data = str_replace("\\n", "<br />", $data); - $data = str_replace("\\t", " ", $data); - $data = str_replace("\\r", "<br />", $data); $data = str_replace('$', '$', $data); $data = stripslashes($data); --- 327,330 ---- *************** *** 336,342 **** case 'DESCRIPTION': - $data = str_replace("\n", "<br />", $data); - $data = str_replace("\\t", " ", $data); - $data = str_replace("\r", "<br />", $data); $data = str_replace('$', '$', $data); $data = stripslashes($data); --- 338,341 ---- *************** *** 426,439 **** break; case 'ATTENDEE': ! $attendee[] = array ('name' => ereg_replace ("ATTENDEE;CN=([^;]*).*", "\\1", $field), ! 'email' => ereg_replace (".*mailto:(.*).*", "\\1", $field), ! 'RSVP' => ereg_replace (".*RSVP=([^;]*).*", "\\1", $field), ! 'PARSTAT' => ereg_replace (".*PARTSTAT=([^;]*).*", "\\1", $field), ! 'ROLE' => ereg_replace (".*ROLE=([^;]*).*", "\\1", $field)); break; case 'ORGANIZER': ! $field = str_replace("ORGANIZER;CN=", "", $field); ! $data = str_replace ("mailto:", "", $data); ! $organizer[] = array ('name' => stripslashes($field), 'email' => stripslashes($data)); break; case 'LOCATION': --- 425,461 ---- break; case 'ATTENDEE': ! $email = preg_match("/mailto:(.*)/i", $data, $matches1); ! $name = preg_match("/CN=([^;]*)/i", $field, $matches2); ! $rsvp = preg_match("/RSVP=([^;]*)/i", $field, $matches3); ! $partstat = preg_match("/PARTSTAT=([^;]*)/i", $field, $matches4); ! $role = preg_match("/ROLE=([^;]*)/i", $field, $matches5); ! ! $email = ($email ? $matches1[1] : ''); ! $name = ($name ? $matches2[1] : $email); ! $rsvp = ($rsvp ? $matches3[1] : ''); ! $partstat = ($partstat ? $matches4[1] : ''); ! $role = ($role ? $matches5[1] : ''); ! ! // Emergency fallback ! if (empty($name) && empty($email)) $name = $data; ! ! $attendee[] = array ('name' => stripslashes($name), ! 'email' => stripslashes($email), ! 'RSVP' => stripslashes($rsvp), ! 'PARTSTAT' => stripslashes($partstat), ! 'ROLE' => stripslashes($role) ! ); break; case 'ORGANIZER': ! $email = preg_match("/mailto:(.*)/i", $data, $matches1); ! $name = preg_match("/CN=([^;]*)/i", $field, $matches2); ! ! $email = ($email ? $matches1[1] : ''); ! $name = ($name ? $matches2[1] : $email); ! ! // Emergency fallback ! if (empty($name) && empty($email)) $name = $data; ! ! $organizer[] = array ('name' => stripslashes($name), 'email' => stripslashes($email)); break; case 'LOCATION': *************** *** 484,487 **** --- 506,510 ---- @fclose($fd); @touch($parsedcal, $realcal_mtime); + @chmod($parsedcal, 0600); // 0640 } } Index: init.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init.inc.php,v retrieving revision 1.122 retrieving revision 1.122.2.1 diff -C2 -d -r1.122 -r1.122.2.1 *** init.inc.php 4 Jan 2009 21:58:18 -0000 1.122 --- init.inc.php 12 Apr 2010 18:58:37 -0000 1.122.2.1 *************** *** 99,106 **** // Make some protocol alternatives, and set our real identifier to the // HTTP protocol. ! $cal_webcalPrefix = str_replace('http://','webcal://',$web_cal); ! $cal_httpPrefix = str_replace('webcal://','http://',$web_cal); ! $cal_httpsPrefix = str_replace('webcal://','https://',$web_cal); ! $cal_httpsPrefix = str_replace('http://','https://',$web_cal); // We can only include this web calendar if we allow all web calendars --- 99,105 ---- // Make some protocol alternatives, and set our real identifier to the // HTTP protocol. ! $cal_webcalPrefix = str_replace(array('http://', 'https://'), 'webcal://', $web_cal); ! $cal_httpPrefix = str_replace(array('webcal://', 'https://'), 'http://', $web_cal); ! $cal_httpsPrefix = str_replace(array('http://', 'webcal://'), 'https://', $web_cal); // We can only include this web calendar if we allow all web calendars *************** *** 123,132 **** } $cals[] = urlencode($web_cal); - //$filename = $cal_filename; $subscribe_path = $cal_webcalPrefix; // Add the webcal to the available calendars. ! $web_cal = $cal_httpPrefix; ! $cal_filelist[] = $web_cal; } --- 122,129 ---- } $cals[] = urlencode($web_cal); $subscribe_path = $cal_webcalPrefix; // Add the webcal to the available calendars. ! $cal_filelist[] = $cal_httpPrefix; } Index: template.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/template.php,v retrieving revision 1.113 retrieving revision 1.113.2.1 diff -C2 -d -r1.113 -r1.113.2.1 *** template.php 31 Dec 2008 07:23:54 -0000 1.113 --- template.php 12 Apr 2010 18:58:37 -0000 1.113.2.1 *************** *** 6,11 **** var $page; function draw_subscribe($template_p) { ! global $phpiCal_config, $getdate, $cal, $ALL_CALENDARS_COMBINED, $subscribe_path, $download_filename; ! if ($cal != $ALL_CALENDARS_COMBINED && $subscribe_path != '' && $download_filename != '') { $this->page = str_replace('{SUBSCRIBE_PATH}', $subscribe_path, $this->page); $this->page = str_replace('{DOWNLOAD_FILENAME}', $download_filename, $this->page); --- 6,11 ---- var $page; function draw_subscribe($template_p) { ! global $phpiCal_config, $getdate, $cal, $subscribe_path, $download_filename; [...1536 lines suppressed...] } ! function output() { global $phpiCal_config, $php_started, $lang, $template_started, $cpath; ! // Looks for {MONTH} before sending page out preg_match_all ('!\{MONTH_([A-Z]*)\|?([+|-])([0-9]{1,2})\}!Uis', $this->page, $match); *************** *** 1185,1189 **** } } ! $php_ended = @getmicrotime(); $generated1 = number_format(($php_ended-$php_started),3); --- 1218,1222 ---- } } ! $php_ended = @getmicrotime(); $generated1 = number_format(($php_ended-$php_started),3); Index: userauth_functions.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/userauth_functions.php,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** userauth_functions.php 31 Dec 2008 11:16:34 -0000 1.8 --- userauth_functions.php 12 Apr 2010 18:58:37 -0000 1.8.2.1 *************** *** 4,14 **** // Returns the login query string. function login_querys() { - global $QUERY_STRING; - // Remove the username, password, and action values. ! $querys = preg_replace('/(username|password|action)=[^&]+/', '', $QUERY_STRING); // Return the login query string. ! $querys = preg_replace('/&&/', '', $querys); return $querys; } --- 4,12 ---- // Returns the login query string. function login_querys() { // Remove the username, password, and action values. ! $querys = preg_replace('/(username|password|action)=[^&]+/', '', $_SERVER['QUERY_STRING']); // Return the login query string. ! $querys = preg_replace('/&&|&$/', '', $querys); return $querys; } *************** *** 18,32 **** // Returns the logout query string. function logout_querys() { - global $QUERY_STRING; - // Make sure the action is logout. ! $querys = preg_replace('/action=[^&]+/', 'action=logout', $QUERY_STRING); ! if ($querys == $QUERY_STRING) $querys .= '&action=logout'; ! // Remove references to the username or password. $querys = preg_replace('/(username|password)=[^&]+/', '', $querys); ! // Return the logout query string. ! $querys = preg_replace('/&&/', '', $querys); return $querys; } --- 16,28 ---- // Returns the logout query string. function logout_querys() { // Make sure the action is logout. ! $querys = preg_replace('/action=[^&]+/', 'action=logout', $_SERVER['QUERY_STRING']); ! if ($querys == $_SERVER['QUERY_STRING']) $querys .= '&action=logout'; ! // Remove references to the username or password. $querys = preg_replace('/(username|password)=[^&]+/', '', $querys); ! // Return the logout query string. ! $querys = preg_replace('/&&|&$/', '', $querys); return $querys; } *************** *** 45,55 **** function user_login() { global $phpiCal_config, $locked_map; ! // Initialize return values. $invalid_login = false; $username = ''; $password = ''; ! // If not HTTP authenticated, try login via cookies or the web page. if (isset($_SERVER['PHP_AUTH_USER'])) { return array($username, $password, $invalid_login); } --- 41,54 ---- function user_login() { global $phpiCal_config, $locked_map; ! // Initialize return values. $invalid_login = false; $username = ''; $password = ''; ! // If not HTTP authenticated, try login via cookies or the web page. if (isset($_SERVER['PHP_AUTH_USER'])) { + $username = $_SERVER['PHP_AUTH_USER']; + if (isset($_SERVER['PHP_AUTH_PW'])) $password = $_SERVER['PHP_AUTH_PW']; + return array($username, $password, $invalid_login); } *************** *** 63,67 **** } } ! // Look for session authentication. if ($phpiCal_config->login_cookies != 'yes') { --- 62,66 ---- } } ! // Look for session authentication. if ($phpiCal_config->login_cookies != 'yes') { *************** *** 75,91 **** } } ! // Look for a new username and password. ! # Should only take these from post? # if (isset($_GET['username'], $_GET['password'])){ # $username = $_GET['username']; # $password = $_GET['password']; ! # } else ! if (isset($_POST['username'], $_POST['password'])){ $username = $_POST['username']; $password = $_POST['password']; } ! // Check to make sure the username and password is valid. if (!array_key_exists("$username:$password", $locked_map)) { --- 74,90 ---- } } ! // Look for a new username and password. ! # Should only take these from post? # if (isset($_GET['username'], $_GET['password'])){ # $username = $_GET['username']; # $password = $_GET['password']; ! # } else ! if (isset($_POST['username'], $_POST['password'])){ $username = $_POST['username']; $password = $_POST['password']; } ! // Check to make sure the username and password is valid. if (!array_key_exists("$username:$password", $locked_map)) { *************** *** 94,107 **** return array($username, $password, true); } ! // Set the login cookie or session authentication values. ! if ($login_cookies == 'yes') { $the_cookie = serialize(array('username' => $username, 'password' => $password)); ! setcookie('phpicalendar_login', $the_cookie, time()+(60*60*24*7*12*10), '/', $cookie_uri, 0); } else { $_SESSION['username'] = $username; $_SESSION['password'] = $password; } ! // Return the username and password. return array($username, $password, $invalid_login); --- 93,106 ---- return array($username, $password, true); } ! // Set the login cookie or session authentication values. ! if ($phpiCal_config->login_cookies == 'yes' && empty($_COOKIE['phpicalendar_login'])) { $the_cookie = serialize(array('username' => $username, 'password' => $password)); ! setcookie('phpicalendar_login', $the_cookie, time()+(60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0); } else { $_SESSION['username'] = $username; $_SESSION['password'] = $password; } ! // Return the username and password. return array($username, $password, $invalid_login); *************** *** 114,121 **** function user_logout() { global $phpiCal_config; ! // Clear the login cookie or session authentication values. if ($phpiCal_config->login_cookies == 'yes') { setcookie('phpicalendar_login', '', time()-(60*60*24*7), '/', $phpiCal_config->cookie_uri, 0); } else { // Check if the session has already been started. --- 113,121 ---- function user_logout() { global $phpiCal_config; ! // Clear the login cookie or session authentication values. if ($phpiCal_config->login_cookies == 'yes') { setcookie('phpicalendar_login', '', time()-(60*60*24*7), '/', $phpiCal_config->cookie_uri, 0); + unset($_COOKIE['phpicalendar_login']); } else { // Check if the session has already been started. *************** *** 124,133 **** setcookie(session_name(), session_id(), time()+(60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0); } ! // Clear the session authentication values. unset($_SESSION['username']); unset($_SESSION['password']); } ! // Return empty username and password. return array('', ''); --- 124,133 ---- setcookie(session_name(), session_id(), time()+(60*60*24*7*12*10), '/', $phpiCal_config->cookie_uri, 0); } ! // Clear the session authentication values. unset($_SESSION['username']); unset($_SESSION['password']); } ! // Return empty username and password. return array('', ''); |