70 $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
71 if ($timearray[
'year'] < 1980) {
72 $timearray[
'year'] = 1980;
73 $timearray[
'mon'] = 1;
74 $timearray[
'mday'] = 1;
75 $timearray[
'hours'] = 0;
76 $timearray[
'minutes'] = 0;
77 $timearray[
'seconds'] = 0;
79 return (($timearray[
'year'] - 1980) << 25) | ($timearray[
'mon'] << 21) | ($timearray[
'mday'] << 16) | ($timearray[
'hours'] << 11) | ($timearray[
'minutes'] << 5) | ($timearray[
'seconds'] >> 1);
95 $hexdtime =
'\x' . $dtime[6] . $dtime[7] .
'\x' . $dtime[4] . $dtime[5] .
'\x' . $dtime[2] . $dtime[3] .
'\x' . $dtime[0] . $dtime[1];
96 eval(
'$hexdtime = "' . $hexdtime .
'";');
98 $fr =
"\x50\x4b\x03\x04";
104 $unc_len = strlen($data);
106 $zdata = gzcompress($data);
107 $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2);
108 $c_len = strlen($zdata);
109 $fr .= pack(
'V', $crc);
110 $fr .= pack(
'V', $c_len);
111 $fr .= pack(
'V', $unc_len);
112 $fr .= pack(
'v', strlen(
$name));
119 $fr .= pack(
'V', $crc);
120 $fr .= pack(
'V', $c_len);
121 $fr .= pack(
'V', $unc_len);
123 $this->datasec[] = $fr;
124 $new_offset = strlen(implode(
'', $this->datasec));
126 $cdrec =
"\x50\x4b\x01\x02";
127 $cdrec .=
"\x00\x00";
128 $cdrec .=
"\x14\x00";
129 $cdrec .=
"\x00\x00";
130 $cdrec .=
"\x08\x00";
132 $cdrec .= pack(
'V', $crc);
133 $cdrec .= pack(
'V', $c_len);
134 $cdrec .= pack(
'V', $unc_len);
135 $cdrec .= pack(
'v', strlen(
$name));
136 $cdrec .= pack(
'v', 0);
137 $cdrec .= pack(
'v', 0);
138 $cdrec .= pack(
'v', 0);
139 $cdrec .= pack(
'v', 0);
140 $cdrec .= pack(
'V', 32);
141 $cdrec .= pack(
'V', $this->old_offset);
142 $this->old_offset = $new_offset;
146 $this->ctrl_dir[] = $cdrec;
157 $data = implode(
'', $this->datasec);
158 $ctrldir = implode(
'', $this->ctrl_dir);
160 return $data . $ctrldir . $this->eof_ctrl_dir . pack(
'v', count($this->ctrl_dir)) .
161 pack(
'v', count($this->ctrl_dir)) .
162 pack(
'V', strlen($ctrldir)) .
163 pack(
'V', strlen($data)) .
unix2DosTime($unixtime=0)
addFile($data, $name, $time=0)