72 $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
73 if ($timearray[
'year'] < 1980) {
74 $timearray[
'year'] = 1980;
75 $timearray[
'mon'] = 1;
76 $timearray[
'mday'] = 1;
77 $timearray[
'hours'] = 0;
78 $timearray[
'minutes'] = 0;
79 $timearray[
'seconds'] = 0;
81 return (($timearray[
'year'] - 1980) << 25) | ($timearray[
'mon'] << 21) | ($timearray[
'mday'] << 16) | ($timearray[
'hours'] << 11) | ($timearray[
'minutes'] << 5) | ($timearray[
'seconds'] >> 1);
93 $name = str_replace(
'\\',
'/', $name);
96 $hexdtime =
'\x' . $dtime[6] . $dtime[7] .
'\x' . $dtime[4] . $dtime[5] .
'\x' . $dtime[2] . $dtime[3] .
'\x' . $dtime[0] . $dtime[1];
97 eval(
'$hexdtime = "' . $hexdtime .
'";');
99 $fr =
"\x50\x4b\x03\x04";
105 $unc_len = strlen($data);
107 $zdata = gzcompress($data);
108 $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2);
109 $c_len = strlen($zdata);
110 $fr .= pack(
'V', $crc);
111 $fr .= pack(
'V', $c_len);
112 $fr .= pack(
'V', $unc_len);
113 $fr .= pack(
'v', strlen($name));
120 $fr .= pack(
'V', $crc);
121 $fr .= pack(
'V', $c_len);
122 $fr .= pack(
'V', $unc_len);
124 $this->datasec[] = $fr;
125 $new_offset = strlen(implode(
'', $this->datasec));
127 $cdrec =
"\x50\x4b\x01\x02";
128 $cdrec .=
"\x00\x00";
129 $cdrec .=
"\x14\x00";
130 $cdrec .=
"\x00\x00";
131 $cdrec .=
"\x08\x00";
133 $cdrec .= pack(
'V', $crc);
134 $cdrec .= pack(
'V', $c_len);
135 $cdrec .= pack(
'V', $unc_len);
136 $cdrec .= pack(
'v', strlen($name));
137 $cdrec .= pack(
'v', 0);
138 $cdrec .= pack(
'v', 0);
139 $cdrec .= pack(
'v', 0);
140 $cdrec .= pack(
'v', 0);
141 $cdrec .= pack(
'V', 32);
142 $cdrec .= pack(
'V', $this->old_offset);
143 $this->old_offset = $new_offset;
147 $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)) .