I’m having a weird error with Eyeos…
never happened before.
but was just wondering.
This is the error output when i hit Install EyeOS
[code]to [$p_path]"); } // ----- Add the path if (substr($v_header[‘filename’], 0, 1) == “/”) $v_header[‘filename’] = $p_path.$v_header[‘filename’]; else $v_header[‘filename’] = $p_path."/".$v_header[‘filename’]; } // ----- //Trace //TrFctMessage(FILE, LINE, 2, “Extracting file (with path) '”.$v_header[‘filename’]."’, size ‘".$v_header[‘size’]."’"); // ----- Check that the file does not exists if (file_exists($v_header[‘filename’])) { //TrFctMessage(FILE, LINE, 2, “File '”.$v_header[‘filename’]."’ already exists"); // ----- Look if file is a directory if (is_dir($v_header[‘filename’])) { //TrFctMessage(FILE, LINE, 2, “Existing file '”.$v_header[‘filename’]."’ is a directory"); // ----- Change the file status $v_header[‘status’] = “already_a_directory”; // ----- Skip the extract $v_extraction_stopped = 1; $v_extract_file = 0; } // ----- Look if file is write protected else if (!is_writeable($v_header[‘filename’])) { //TrFctMessage(FILE, LINE, 2, “Existing file '”.$v_header[‘filename’]."’ is write protected"); // ----- Change the file status $v_header[‘status’] = “write_protected”; // ----- Skip the extract $v_extraction_stopped = 1; $v_extract_file = 0; } // ----- Look if the extracted file is older /In eyeUpdate need overwrite files else if (filemtime($v_header[‘filename’]) > $v_header[‘mtime’]) { //TrFctMessage(FILE, LINE, 2, “Existing file '”.$v_header[‘filename’]."’ is newer (".date(“l dS of F Y h:i:s A”, filemtime($v_header[‘filename’])).") than the extracted file (".date(“l dS of F Y h:i:s A”, $v_header[‘mtime’]).")"); // ----- Change the file status $v_header[‘status’] = “newer_exist”; // ----- Skip the extract $v_extraction_stopped = 1; $v_extract_file = 0; }/ } // ----- Check the directory availability and create it if necessary else { if ($v_header[‘typeflag’]==“5”) $v_dir_to_check = $v_header[‘filename’]; else if (!strstr($v_header[‘filename’], “/”)) $v_dir_to_check = “”; else $v_dir_to_check = dirname($v_header[‘filename’]); if (($v_result = PclTarHandlerDirCheck($v_dir_to_check)) != 1) { //TrFctMessage(FILE, LINE, 2, “Unable to create path for '”.$v_header[‘filename’]."’"); // ----- Change the file status $v_header[‘status’] = “path_creation_fail”; // ----- Skip the extract $v_extraction_stopped = 1; $v_extract_file = 0; } } // ----- Do the real bytes extraction (if not a directory) if (($v_extract_file) && ($v_header[‘typeflag’]!=“5”)) { // ----- Open the destination file in write mode if (($v_dest_file = @fopen($v_header[‘filename’], “wb”)) == 0) { //TrFctMessage(FILE, LINE, 2, “Error while opening '”.$v_header[‘filename’]."’ in write binary mode"); // ----- Change the file status $v_header[‘status’] = “write_error”; // ----- Jump to next file //TrFctMessage(FILE, LINE, 2, “Jump to next file”); if ($p_tar_mode == “tar”) fseek($v_tar, ftell($v_tar)+(ceil(($v_header[‘size’]/512))*512)); else gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[‘size’]/512))*512)); } else { //TrFctMessage(FILE, LINE, 2, “Start extraction of '”.$v_header[‘filename’]."’"); // ----- Read data $n = floor($v_header[‘size’]/512); for ($i=0; $i<$n; $i++) { //TrFctMessage(FILE, LINE, 3, “Read complete 512 bytes block number “.($i+1)); if ($p_tar_mode == “tar”) $v_content = fread($v_tar, 512); else $v_content = gzread($v_tar, 512); fwrite($v_dest_file, $v_content, 512); } if (($v_header[‘size’] % 512) != 0) { //TrFctMessage(FILE, LINE, 3, “Read last “.($v_header[‘size’] % 512).” bytes in a 512 block”); if ($p_tar_mode == “tar”) $v_content = fread($v_tar, 512); else $v_content = gzread($v_tar, 512); fwrite($v_dest_file, $v_content, ($v_header[‘size’] % 512)); } // ----- Close the destination file fclose($v_dest_file); // ----- Change the file mode, mtime touch($v_header[‘filename’], $v_header[‘mtime’]); //chmod($v_header[‘filename’], DecOct($v_header[‘mode’])); } // ----- Check the file size clearstatcache(); if (filesize($v_header[‘filename’]) != $v_header[‘size’]) { // ----- Error log PclTarErrorLog(-7, “Extracted file '”.$v_header[‘filename’].”’ does not have the correct file size '”.filesize($v_filename)."’ (’".$v_header[‘size’]."’ expected). Archive may be corrupted."); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } // ----- //Trace //TrFctMessage(FILE, LINE, 2, “Extraction done”); } else { //TrFctMessage(FILE, LINE, 2, “Extraction of file '”.$v_header[‘filename’]."’ skipped."); // ----- Jump to next file //TrFctMessage(FILE, LINE, 2, “Jump to next file”); if ($p_tar_mode == “tar”) fseek($v_tar, ftell($v_tar)+(ceil(($v_header[‘size’]/512))*512)); else gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[‘size’]/512))*512)); } // ----- Return //TrFctEnd(FILE, LINE, $v_result); return $v_result; } // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // Function : PclTarHandleDelete() // Description : // Parameters : // Return Values : // -------------------------------------------------------------------------------- function PclTarHandleDelete($p_tarname, $p_file_list, &$p_list_detail, $p_tar_mode) { //TrFctStart(FILE, LINE, “PclTarHandleDelete”, “archive=’$p_tarname’, list, tar_mode=$p_tar_mode”); $v_result=1; $v_nb=0; // ----- Look for regular tar file if ($p_tar_mode == “tar”) { // ----- Open file //TrFctMessage(FILE, LINE, 3, “Open file in binary read mode”); if (($v_tar = @fopen($p_tarname, “rb”)) == 0) { // ----- Error log PclTarErrorLog(-2, “Unable to open file ‘$p_tarname’ in binary read mode”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } // ----- Open a temporary file in write mode $v_temp_tarname = uniqid(“pcltar-”).".tmp"; //TrFctMessage(FILE, LINE, 2, “Creating temporary archive file $v_temp_tarname”); if (($v_temp_tar = @fopen($v_temp_tarname, “wb”)) == 0) { // ----- Close tar file fclose($v_tar); // ----- Error log PclTarErrorLog(-1, “Unable to open file ‘$v_temp_tarname’ in binary write mode”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } } // ----- Look for compressed tar file else { // ----- Open the file in read mode //TrFctMessage(FILE, LINE, 3, “Open file in gzip binary read mode”); if (($v_tar = @gzopen($p_tarname, “rb”)) == 0) { // ----- Error log PclTarErrorLog(-2, “Unable to open file ‘$p_tarname’ in binary read mode”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } // ----- Open a temporary file in write mode $v_temp_tarname = uniqid(“pcltar-”).".tmp"; //TrFctMessage(FILE, LINE, 2, “Creating temporary archive file $v_temp_tarname”); if (($v_temp_tar = @gzopen($v_temp_tarname, “wb”)) == 0) { // ----- Close tar file gzclose($v_tar); // ----- Error log PclTarErrorLog(-1, “Unable to open file ‘$v_temp_tarname’ in binary write mode”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } } // ----- Read the blocks While (!($v_end_of_file = ($p_tar_mode == “tar”?feof($v_tar):gzeof($v_tar)))) { //TrFctMessage(FILE, LINE, 3, “Looking for next header …”); // ----- Clear cache of file infos clearstatcache(); // ----- Reset delete tag $v_delete_file = FALSE; // ----- Read the first 512 block header if ($p_tar_mode == “tar”) $v_binary_data = fread($v_tar, 512); else $v_binary_data = gzread($v_tar, 512); // ----- Read the header properties if (($v_result = PclTarHandleReadHeader($v_binary_data, $v_header)) != 1) { // ----- Close the archive file if ($p_tar_mode == “tar”) { fclose($v_tar); fclose($v_temp_tar); } else { gzclose($v_tar); gzclose($v_temp_tar); } @unlink($v_temp_tarname); // ----- Return //TrFctEnd(FILE, LINE, $v_result); return $v_result; } // ----- Look for empty blocks to skip if ($v_header[‘filename’] == “”) { //TrFctMessage(FILE, LINE, 2, “Empty block found. End of archive ?”); continue; } //TrFctMessage(FILE, LINE, 2, “Found file '”.$v_header[‘filename’]."’, size ‘".$v_header[‘size’]."’"); // ----- Look for filenames to delete for ($i=0, $v_delete_file=FALSE; ($i<= 0) { if ($v_len==0) { //TrFctMessage(FILE, LINE, 3, “Found that '”.$v_header[‘filename’]."’ need to be deleted"); $v_delete_file = TRUE; } else { //TrFctMessage(FILE, LINE, 3, “Look if '”.$v_header[‘filename’]."’ is a file in $p_file_list[$i]"); if (substr($v_header[‘filename’], strlen($p_file_list[$i]), 1) == “/”) { //TrFctMessage(FILE, LINE, 3, “’”.$v_header[‘filename’]."’ is a file in $p_file_list[$i]"); $v_delete_file = TRUE; } } } } // ----- Copy files that do not need to be deleted if (!$v_delete_file) { //TrFctMessage(FILE, LINE, 2, “Keep file '”.$v_header[‘filename’]."’"); // ----- Write the file header if ($p_tar_mode == “tar”) { fputs($v_temp_tar, $v_binary_data, 512); } else { gzputs($v_temp_tar, $v_binary_data, 512); } // ----- Write the file data $n = ceil($v_header[‘size’]/512); for ($i=0; $i<$n; $i++) { //TrFctMessage(FILE, LINE, 3, “Read complete 512 bytes block number “.($i+1)); if ($p_tar_mode == “tar”) { $v_content = fread($v_tar, 512); fwrite($v_temp_tar, $v_content, 512); } else { $v_content = gzread($v_tar, 512); gzwrite($v_temp_tar, $v_content, 512); } } // ----- File name and properties are logged if listing mode or file is extracted //TrFctMessage(FILE, LINE, 2, “Memorize info about file '”.$v_header[‘filename’].”’”); // ----- Add the array describing the file into the list $p_list_detail[$v_nb] = $v_header; $p_list_detail[$v_nb][status] = “ok”; // ----- Increment $v_nb++; } // ----- Look for file that is to be deleted else { // ----- //Trace //TrFctMessage(FILE, LINE, 2, “Start deletion of '”.$v_header[‘filename’]."’"); //TrFctMessage(FILE, LINE, 4, “Position avant jump [”.($p_tar_mode==“tar”?ftell($v_tar):gztell($v_tar))."]"); // ----- Jump to next file if ($p_tar_mode == “tar”) fseek($v_tar, ftell($v_tar)+(ceil(($v_header[‘size’]/512))*512)); else gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[‘size’]/512))*512)); //TrFctMessage(FILE, LINE, 4, “Position apr?s jump [”.($p_tar_mode==“tar”?ftell($v_tar):gztell($v_tar))."]"); } // ----- Look for end of file if ($p_tar_mode == “tar”) $v_end_of_file = feof($v_tar); else $v_end_of_file = gzeof($v_tar); } // ----- Write the last empty buffer PclTarHandleFooter($v_temp_tar, $p_tar_mode); // ----- Close the tarfile if ($p_tar_mode == “tar”) { fclose($v_tar); fclose($v_temp_tar); } else { gzclose($v_tar); gzclose($v_temp_tar); } // ----- Unlink tar file if (!@unlink($p_tarname)) { // ----- Error log PclTarErrorLog(-11, “Error while deleting archive name $p_tarname”); } // ----- Rename tar file if (!@rename($v_temp_tarname, $p_tarname)) { // ----- Error log PclTarErrorLog(-12, “Error while renaming temporary file $v_temp_tarname to archive name $p_tarname”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } // ----- Return //TrFctEnd(FILE, LINE, $v_result); return $v_result; } // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // Function : PclTarHandleUpdate() // Description : // Parameters : // Return Values : // -------------------------------------------------------------------------------- function PclTarHandleUpdate($p_tarname, $p_file_list, &$p_list_detail, $p_tar_mode, $p_add_dir, $p_remove_dir) { //TrFctStart(FILE, LINE, “PclTarHandleUpdate”, “archive=’$p_tarname’, list, tar_mode=$p_tar_mode”); $v_result=1; $v_nb=0; $v_found_list = array(); // ----- Look for regular tar file if ($p_tar_mode == “tar”) { // ----- Open file //TrFctMessage(FILE, LINE, 3, “Open file in binary read mode”); if (($v_tar = @fopen($p_tarname, “rb”)) == 0) { // ----- Error log PclTarErrorLog(-2, “Unable to open file ‘$p_tarname’ in binary read mode”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } // ----- Open a temporary file in write mode $v_temp_tarname = uniqid(“pcltar-”).".tmp"; //TrFctMessage(FILE, LINE, 2, “Creating temporary archive file $v_temp_tarname”); if (($v_temp_tar = @fopen($v_temp_tarname, “wb”)) == 0) { // ----- Close tar file fclose($v_tar); // ----- Error log PclTarErrorLog(-1, “Unable to open file ‘$v_temp_tarname’ in binary write mode”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } } // ----- Look for compressed tar file else { // ----- Open the file in read mode //TrFctMessage(FILE, LINE, 3, “Open file in gzip binary read mode”); if (($v_tar = @gzopen($p_tarname, “rb”)) == 0) { // ----- Error log PclTarErrorLog(-2, “Unable to open file ‘$p_tarname’ in binary read mode”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } // ----- Open a temporary file in write mode $v_temp_tarname = uniqid(“pcltar-”).".tmp"; //TrFctMessage(FILE, LINE, 2, “Creating temporary archive file $v_temp_tarname”); if (($v_temp_tar = @gzopen($v_temp_tarname, “wb”)) == 0) { // ----- Close tar file gzclose($v_tar); // ----- Error log PclTarErrorLog(-1, “Unable to open file ‘$v_temp_tarname’ in binary write mode”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } } // ----- Prepare the list of files for ($i=0; $i $v_header[‘mtime’]) { //TrFctMessage(FILE, LINE, 3, “File ‘$p_file_list[$i]’ need to be updated”); $v_update_file = TRUE; } else { //TrFctMessage(FILE, LINE, 3, “File ‘$p_file_list[$i]’ does not need to be updated”); $v_update_file = FALSE; } // ----- Flag the name in order not to add the file at the end $v_found_list[$i] = 1; } else { //TrFctMessage(FILE, LINE, 4, “File ‘$p_file_list[$i]’ is not '”.$v_header[‘filename’]."’"); } } // ----- Copy files that do not need to be updated if (!$v_update_file) { //TrFctMessage(FILE, LINE, 2, “Keep file '”.$v_header[‘filename’]."’"); // ----- Write the file header if ($p_tar_mode == “tar”) { fputs($v_temp_tar, $v_binary_data, 512); } else { gzputs($v_temp_tar, $v_binary_data, 512); } // ----- Write the file data $n = ceil($v_header[‘size’]/512); for ($j=0; $j<$n; $j++) { //TrFctMessage(FILE, LINE, 3, “Read complete 512 bytes block number “.($j+1)); if ($p_tar_mode == “tar”) { $v_content = fread($v_tar, 512); fwrite($v_temp_tar, $v_content, 512); } else { $v_content = gzread($v_tar, 512); gzwrite($v_temp_tar, $v_content, 512); } } // ----- File name and properties are logged if listing mode or file is extracted //TrFctMessage(FILE, LINE, 2, “Memorize info about file '”.$v_header[‘filename’].”’”); // ----- Add the array describing the file into the list $p_list_detail[$v_nb] = $v_header; $p_list_detail[$v_nb][status] = ($v_found_file?“not_updated”:“ok”); // ----- Increment $v_nb++; } // ----- Look for file that need to be updated else { // ----- //Trace //TrFctMessage(FILE, LINE, 2, “Start update of file ‘$v_current_filename’”); // ----- Store the old file size $v_old_size = $v_header[‘size’]; // ----- Add the file if (($v_result = PclTarHandleAddFile($v_temp_tar, $v_current_filename, $p_tar_mode, $v_header, $p_add_dir, $p_remove_dir)) != 1) { // ----- Close the tarfile if ($p_tar_mode == “tar”) { fclose($v_tar); fclose($v_temp_tar); } else { gzclose($v_tar); gzclose($v_temp_tar); } @unlink($p_temp_tarname); // ----- Return status //TrFctEnd(FILE, LINE, $v_result); return $v_result; } // ----- //Trace //TrFctMessage(FILE, LINE, 2, “Skip old file '”.$v_header[‘filename’]."’"); // ----- Jump to next file if ($p_tar_mode == “tar”) fseek($v_tar, ftell($v_tar)+(ceil(($v_old_size/512))*512)); else gzseek($v_tar, gztell($v_tar)+(ceil(($v_old_size/512))512)); // ----- Add the array describing the file into the list $p_list_detail[$v_nb] = $v_header; $p_list_detail[$v_nb][status] = “updated”; // ----- Increment $v_nb++; } // ----- Look for end of file if ($p_tar_mode == “tar”) $v_end_of_file = feof($v_tar); else $v_end_of_file = gzeof($v_tar); } // ----- Look for files that does not exists in the archive and need to be added for ($i=0; $i<148; $i++) { $v_checksum+=ord(substr($v_binary_data,$i,1)); } // … Ignore the checksum value and replace it by ’ ’ (space) for ($i=148; $i<156; $i++) { $v_checksum += ord(’ ‘); } // … Last part of the header for ($i=156; $i<512; $i++) { $v_checksum+=ord(substr($v_binary_data,$i,1)); } //TrFctMessage(FILE, LINE, 3, “Calculated checksum : $v_checksum”); // ----- Extract the values //TrFctMessage(FILE, LINE, 2, “Header : ‘$v_binary_data’”); $v_data = unpack(“a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor”, $v_binary_data); // ----- Extract the checksum for check $v_header[‘checksum’] = OctDec(trim($v_data[‘checksum’])); //TrFctMessage(FILE, LINE, 3, “File checksum : '”.$v_header[‘checksum’]."’"); if ($v_header[‘checksum’] != $v_checksum) { //TrFctMessage(FILE, LINE, 2, “File checksum is invalid : $v_checksum calculated, “.$v_header[‘checksum’].” expected”); $v_header[‘filename’] = “”; $v_header[‘status’] = “invalid_header”; // ----- Look for last block (empty block) if (($v_checksum == 256) && ($v_header[‘checksum’] == 0)) { $v_header[‘status’] = “empty”; // ----- Return //TrFctEnd(FILE, LINE, $v_result, “End of archive found”); return $v_result; } // ----- Error log PclTarErrorLog(-13, “Invalid checksum : $v_checksum calculated, “.$v_header[‘checksum’].” expected”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } //TrFctMessage(FILE, LINE, 2, “File checksum is valid ($v_checksum)”); // ----- Extract the properties $v_header[‘filename’] = trim($v_data[‘filename’]); //TrFctMessage(FILE, LINE, 2, “Name : '”.$v_header[‘filename’]."’"); $v_header[‘mode’] = OctDec(trim($v_data[‘mode’])); //TrFctMessage(FILE, LINE, 2, “Mode : '”.DecOct($v_header[‘mode’])."’"); $v_header[‘uid’] = OctDec(trim($v_data[‘uid’])); //TrFctMessage(FILE, LINE, 2, “Uid : '”.$v_header[‘uid’]."’"); $v_header[‘gid’] = OctDec(trim($v_data[‘gid’])); //TrFctMessage(FILE, LINE, 2, “Gid : '”.$v_header[‘gid’]."’"); $v_header[‘size’] = OctDec(trim($v_data[‘size’])); //TrFctMessage(FILE, LINE, 2, “Size : '”.$v_header[‘size’]."’"); $v_header[‘mtime’] = OctDec(trim($v_data[‘mtime’])); //TrFctMessage(FILE, LINE, 2, “Date : “.date(“l dS of F Y h:i:s A”, $v_header[‘mtime’])); if (($v_header[‘typeflag’] = $v_data[‘typeflag’]) == “5”) { $v_header[‘size’] = 0; //TrFctMessage(FILE, LINE, 2, “Size (folder) : '”.$v_header[‘size’].”’”); } //TrFctMessage(FILE, LINE, 2, “File typeflag : '”.$v_header[‘typeflag’]."’"); / ----- All these fields are removed form the header because they do not carry interesting info $v_header[link] = trim($v_data[link]); //TrFctMessage(FILE, LINE, 2, “Linkname : $v_header[linkname]”); $v_header[magic] = trim($v_data[magic]); //TrFctMessage(FILE, LINE, 2, “Magic : $v_header[magic]”); $v_header[version] = trim($v_data[version]); //TrFctMessage(FILE, LINE, 2, “Version : $v_header[version]”); $v_header[uname] = trim($v_data[uname]); //TrFctMessage(FILE, LINE, 2, “Uname : $v_header[uname]”); $v_header[gname] = trim($v_data[gname]); //TrFctMessage(FILE, LINE, 2, “Gname : $v_header[gname]”); $v_header[devmajor] = trim($v_data[devmajor]); //TrFctMessage(FILE, LINE, 2, “Devmajor : $v_header[devmajor]”); $v_header[devminor] = trim($v_data[devminor]); //TrFctMessage(FILE, LINE, 2, “Devminor : $v_header[devminor]”); / // ----- Set the status field $v_header[‘status’] = “ok”; // ----- Return //TrFctEnd(FILE, LINE, $v_result); return $v_result; } // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // Function : PclTarHandlerDirCheck() // Description : // Check if a directory exists, if not it creates it and all the parents directory // which may be useful. // Parameters : // $p_dir : Directory path to check (without / at the end). // Return Values : // 1 : OK // -1 : Unable to create directory // -------------------------------------------------------------------------------- function PclTarHandlerDirCheck($p_dir) { $v_result = 1; //TrFctStart(FILE, LINE, “PclTarHandlerDirCheck”, “$p_dir”); // ----- Check the directory availability if ((is_dir($p_dir)) || ($p_dir == “”)) { //TrFctEnd(FILE, LINE, “’$p_dir’ is a directory”); return 1; } // ----- Look for file alone / if (!strstr("$p_dir", “/”)) { //TrFctEnd(FILE, LINE, “’$p_dir’ is a file with no directory”); return 1; } */ // ----- Extract parent directory $p_parent_dir = dirname($p_dir); //TrFctMessage(FILE, LINE, 3, “Parent directory is ‘$p_parent_dir’”); // ----- Just a check if ($p_parent_dir != $p_dir) { // ----- Look for parent directory if ($p_parent_dir != “”) { if (($v_result = PclTarHandlerDirCheck($p_parent_dir)) != 1) { //TrFctEnd(FILE, LINE, $v_result); return $v_result; } } } // ----- Create the directory //TrFctMessage(FILE, LINE, 3, “Create directory ‘$p_dir’”); if (!@mkdir($p_dir, 0777)) { // ----- Error log PclTarErrorLog(-8, “Unable to create directory ‘$p_dir’”); // ----- Return //TrFctEnd(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); return PclTarErrorCode(); } // ----- Return //TrFctEnd(FILE, LINE, $v_result, “Directory ‘$p_dir’ created”); return $v_result; } // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // Function : PclTarHandleExtension() // Description : // Parameters : // Return Values : // -------------------------------------------------------------------------------- function PclTarHandleExtension($p_tarname) { //TrFctStart(FILE, LINE, “PclTarHandleExtension”, “tar=$p_tarname”); // ----- Look for file extension if ((substr($p_tarname, -7) == “.tar.gz”) || (substr($p_tarname, -4) == “.tgz”)) { //TrFctMessage(FILE, LINE, 2, “Archive is a gzip tar”); $v_tar_mode = “tgz”; } else if (substr($p_tarname, -4) == “.tar”) { //TrFctMessage(FILE, LINE, 2, “Archive is a tar”); $v_tar_mode = “tar”; } else { // ----- Error log PclTarErrorLog(-9, “Invalid archive extension”); //TrFctMessage(FILE, LINE, PclTarErrorCode(), PclTarErrorString()); $v_tar_mode = “”; } // ----- Return //TrFctEnd(FILE, LINE, $v_tar_mode); return $v_tar_mode; } // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // Function : PclTarHandlePathReduction() // Description : // Parameters : // Return Values : // -------------------------------------------------------------------------------- function PclTarHandlePathReduction($p_dir) { //TrFctStart(FILE, LINE, “PclTarHandlePathReduction”, “dir=’$p_dir’”); $v_result = “”; // ----- Look for not empty path if ($p_dir != “”) { // ----- Explode path by directory names $v_list = explode("/", $p_dir); // ----- Study directories from last to first for ($i=sizeof($v_list)-1; $i>=0; $i–) { // ----- Look for current path if ($v_list[$i] == “.”) { // ----- Ignore this directory // Should be the first $i=0, but no check is done } else if ($v_list[$i] == “…”) { // ----- Ignore it and ignore the $i-1 $i–; } else if (($v_list[$i] == “”) && ($i!=(sizeof($v_list)-1)) && ($i!=0)) { // ----- Ignore only the double ‘//’ in path, // but not the first and last ‘/’ } else { $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); } } } // ----- Return //TrFctEnd(FILE, LINE, $v_result); return $v_result; } // -------------------------------------------------------------------------------- // ******************************************************************************** // Included from the former PclTarError Library // ******************************************************************************** // ----- Internal variables $g_pcltar_error_string = “”; $g_pcltar_error_code = 1; // -------------------------------------------------------------------------------- // Function : PclTarErrorLog() // Description : // Parameters : // -------------------------------------------------------------------------------- function PclTarErrorLog($p_error_code=0, $p_error_string="") { global $g_pcltar_error_string; global $g_pcltar_error_code; $g_pcltar_error_code = $p_error_code; $g_pcltar_error_string = $p_error_string; } // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // Function : PclTarErrorFatal() // Description : // Parameters : // -------------------------------------------------------------------------------- //This function not is used by pcltar.lib.php /*function PclTarErrorFatal($p_file, $p_line, $p_error_string="") { global $g_pcltar_error_string; global $g_pcltar_error_code; $v_message = “”; $v_message .= "
PclTarError Library has detected a fatal error on file ‘$p_file’, line $p_line
"; $v_message .= "
$p_error_string
"; $v_message .= “”; die($v_message); }*/ // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // Function : PclTarErrorReset() // Description : // Parameters : // -------------------------------------------------------------------------------- //This function is not used by this library /function PclTarErrorReset() { global $g_pcltar_error_string; global $g_pcltar_error_code; $g_pcltar_error_code = 1; $g_pcltar_error_string = “”; }/ // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // Function : PclTarErrorCode() // Description : // Parameters : // -------------------------------------------------------------------------------- function PclTarErrorCode() { global $g_pcltar_error_string; global $g_pcltar_error_code; return($g_pcltar_error_code); } // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // Function : PclTarErrorString() // Description : // Parameters : // -------------------------------------------------------------------------------- //This functio is not used by this library /*function PclTarErrorString() { global $g_pcltar_error_string; global $g_pcltar_error_code; return($g_pcltar_error_string." "); }*/ // -------------------------------------------------------------------------------- ?>
Anybody can help me ?