year = $year; $this->month = $month; $this->day = $day; $this->hour = $hour; $this->minute = $minute; $this->second = $second; $this->ampm = $ampm; $this->timezone = $timezone; $this->ntp = $ntp; $this->ntp_1 = $ntp_1; $this->ntp_2 = $ntp_2; } } */ class Date { var $year; var $month; var $day; var $hour; var $minute; var $second; var $ampm; var $daySavingsAdjust; var $timezone; var $ntp; var $ntp_1; var $ntp_2; var $usingCustomTZ; var $customTZHourOffset; var $customTZMinuteOffset; function Date($year,$month,$day,$hour,$minute,$second, $ampm, $daySavingsAdjust=true, $timezone, $ntp, $ntp_1, $ntp_2, $usingCustomTZ=false,$customTZHourOffset=0,$customTZMinuteOffset=0) { $this->year = $year; $this->month = $month; $this->day = $day; $this->hour = $hour; $this->minute = $minute; $this->second = $second; $this->ampm = $ampm; $this->daySavingsAdjust = $daySavingsAdjust; $this->timezone = $timezone; $this->ntp = $ntp; $this->ntp_1 = $ntp_1; $this->ntp_2 = $ntp_2; $this->usingCustomTZ = $usingCustomTZ; $this->customTZHourOffset = $customTZHourOffset; $this->customTZMinuteOffset = $customTZMinuteOffset; } }; //Process data for actions if($_SERVER['REQUEST_METHOD']=='POST') { $url = $_REQUEST['url']; $month = $_POST['month']; //error_log("GUI month: ".$month); $day = $_POST['day']; //error_log("GUI day: ".$day); $year = $_POST['year']; //error_log("GUI year: ".$year); $datetext=$day."-".$month."-".$year; //error_log($datetext); $timestamp = strtotime($datetext); //error_log($timestamp); $date = getdate($timestamp); //error_log($date['year']."-".$date['mon']."-".$date['mday']); $hour = intval($_POST['hour']); //error_log("GUI hour: ".$hour); $daytime = $_POST['daytime']; //error_log("GUI daytime: ".$daytime ); if($hour<12 && $daytime=="PM"){ $hour = $hour+12; }else if($hour==12 && $daytime=="AM"){ $hour = 0; } settype($hour, "string"); //error_log("GUI hour 24h: ".$hour." type: ".gettype($hour)); $minute = intval($_POST['minute']); settype($minute, "string"); //error_log("GUI minute: ".$minute); $second = intval($_POST['second']); settype($second, "string"); //error_log("GUI second: ".$second); $timezone = $_POST['timezone']; //error_log("GUI timezone: ".$timezone); $ntp = $_POST['ntp']; if ($ntp == 0) { $ntp = 0; } else { $ntp = 1; } /* function DateTime($year,$month,$day,$hour,$minute,$second, $ampm, $daySavingsAdjust=true, $timezone, $ntp, $ntp_1, $ntp_2, $usingCustomTZ=false,$customTZHourOffset=0,$customTZMinuteOffset=0) */ $datetime = new Date($date['year'], $date['mon'], $date['mday'], $hour, $minute, $second, $ampm, 0, $timezone, $ntp, $_POST['ntp_1'], $_POST['ntp_2'], 0,0,0); error_log('update_date_and_time('.$user.','.$datetime->year.','.$datetime->month.','.$datetime->day.','.$datetime->hour.','.$datetime->minute.','.$datetime->second.','.$datetime->timezone.','.$datetime->ntp.','.$datetime->ntp_1.','.$datetime->ntp_2); update_date_and_time($user,$datetime); $returnMessage = 'The library date and time settings have been successfully modified.'; } ?>