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; }
function deleteByIndex($p_index) { PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'"); $v_result=1; // ----- Look if the $p_index is really an integer if (is_integer($p_index)) { // ----- Call the delete fct if (($v_result = $this->privDeleteByIndex("$p_index", $p_list)) != 1) { TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); return(0); } } // ----- Look if the index is a string else if (is_string($p_index)) { // ----- Call the delete fct if (($v_result = $this->privDeleteByIndex($p_index, $p_list)) != 1) { TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); return(0); } } // ----- Invalid variable else { // ----- Error log PclErrorLog(-3, "Invalid variable type $p_index"); // ----- Return TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); return 0; } // ----- Return PclTraceFctEnd(__FILE__, __LINE__, $p_list); return $p_list; }
function PclTraceFctEnd($p_file, $p_line, $p_return = 1, $p_message = "") { TrFctEnd($p_file, $p_line, $p_return, $p_message); }
function PclTarHandlePathReduction($p_dir) { TrFctStart(__FILE__, __LINE__, "PclTarHandlePathReduction", "dir='{$p_dir}'"); $v_result = ""; if ($p_dir != "") { $v_list = explode("/", $p_dir); for ($i = sizeof($v_list) - 1; $i >= 0; $i--) { if ($v_list[$i] == ".") { } else { if ($v_list[$i] == "..") { $i--; } else { if ($v_list[$i] == "" && $i != sizeof($v_list) - 1 && $i != 0) { } else { $v_result = $v_list[$i] . ($i != sizeof($v_list) - 1 ? "/" . $v_result : ""); } } } } } TrFctEnd(__FILE__, __LINE__, $v_result); return $v_result; }