Edit File by line
/home/barbar84/www/extracte.../filemang...
File: pclzip.lib.php
}
[500] Fix | Delete
}
[501] Fix | Delete
[502] Fix | Delete
// ----- Look for 2 args
[503] Fix | Delete
// Here we need to support the first historic synopsis of the
[504] Fix | Delete
// method.
[505] Fix | Delete
else {
[506] Fix | Delete
[507] Fix | Delete
// ----- Get the first argument
[508] Fix | Delete
$v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
[509] Fix | Delete
[510] Fix | Delete
// ----- Look for the optional second argument
[511] Fix | Delete
if ($v_size == 2) {
[512] Fix | Delete
$v_options[PCLZIP_OPT_RECopy_PATH] = $v_arg_list[1];
[513] Fix | Delete
}
[514] Fix | Delete
else if ($v_size > 2) {
[515] Fix | Delete
// ----- Error log
[516] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
[517] Fix | Delete
[518] Fix | Delete
// ----- Return
[519] Fix | Delete
return 0;
[520] Fix | Delete
}
[521] Fix | Delete
}
[522] Fix | Delete
}
[523] Fix | Delete
[524] Fix | Delete
// ----- Look for default option values
[525] Fix | Delete
$this->privOptionDefaultThreshold($v_options);
[526] Fix | Delete
[527] Fix | Delete
// ----- Init
[528] Fix | Delete
$v_string_list = array();
[529] Fix | Delete
$v_att_list = array();
[530] Fix | Delete
$v_filedescr_list = array();
[531] Fix | Delete
$p_result_list = array();
[532] Fix | Delete
[533] Fix | Delete
// ----- Look if the $p_filelist is really an array
[534] Fix | Delete
if (is_array($p_filelist)) {
[535] Fix | Delete
[536] Fix | Delete
// ----- Look if the first element is also an array
[537] Fix | Delete
// This will mean that this is a file description entry
[538] Fix | Delete
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
[539] Fix | Delete
$v_att_list = $p_filelist;
[540] Fix | Delete
}
[541] Fix | Delete
[542] Fix | Delete
// ----- The list is a list of string names
[543] Fix | Delete
else {
[544] Fix | Delete
$v_string_list = $p_filelist;
[545] Fix | Delete
}
[546] Fix | Delete
}
[547] Fix | Delete
[548] Fix | Delete
// ----- Look if the $p_filelist is a string
[549] Fix | Delete
else if (is_string($p_filelist)) {
[550] Fix | Delete
// ----- Create a list from the string
[551] Fix | Delete
$v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
[552] Fix | Delete
}
[553] Fix | Delete
[554] Fix | Delete
// ----- Invalid variable type for $p_filelist
[555] Fix | Delete
else {
[556] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
[557] Fix | Delete
return 0;
[558] Fix | Delete
}
[559] Fix | Delete
[560] Fix | Delete
// ----- Reformat the string list
[561] Fix | Delete
if (sizeof($v_string_list) != 0) {
[562] Fix | Delete
foreach ($v_string_list as $v_string) {
[563] Fix | Delete
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
[564] Fix | Delete
}
[565] Fix | Delete
}
[566] Fix | Delete
[567] Fix | Delete
// ----- For each file in the list check the attributes
[568] Fix | Delete
$v_supported_attributes
[569] Fix | Delete
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
[570] Fix | Delete
,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
[571] Fix | Delete
,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
[572] Fix | Delete
,PCLZIP_ATT_FILE_MTIME => 'optional'
[573] Fix | Delete
,PCLZIP_ATT_FILE_CONTENT => 'optional'
[574] Fix | Delete
,PCLZIP_ATT_FILE_COMMENT => 'optional'
[575] Fix | Delete
);
[576] Fix | Delete
foreach ($v_att_list as $v_entry) {
[577] Fix | Delete
$v_result = $this->privFileDescrParseAtt($v_entry,
[578] Fix | Delete
$v_filedescr_list[],
[579] Fix | Delete
$v_options,
[580] Fix | Delete
$v_supported_attributes);
[581] Fix | Delete
if ($v_result != 1) {
[582] Fix | Delete
return 0;
[583] Fix | Delete
}
[584] Fix | Delete
}
[585] Fix | Delete
[586] Fix | Delete
// ----- Expand the filelist (expand directories)
[587] Fix | Delete
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
[588] Fix | Delete
if ($v_result != 1) {
[589] Fix | Delete
return 0;
[590] Fix | Delete
}
[591] Fix | Delete
[592] Fix | Delete
// ----- Call the create fct
[593] Fix | Delete
$v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
[594] Fix | Delete
if ($v_result != 1) {
[595] Fix | Delete
return 0;
[596] Fix | Delete
}
[597] Fix | Delete
[598] Fix | Delete
// ----- Return
[599] Fix | Delete
return $p_result_list;
[600] Fix | Delete
}
[601] Fix | Delete
// --------------------------------------------------------------------------------
[602] Fix | Delete
[603] Fix | Delete
// --------------------------------------------------------------------------------
[604] Fix | Delete
// Function : listContent()
[605] Fix | Delete
// Description :
[606] Fix | Delete
// This public method, gives the list of the files and directories, with their
[607] Fix | Delete
// properties.
[608] Fix | Delete
// The properties of each entries in the list are (used also in other functions) :
[609] Fix | Delete
// filename : Name of the file. For a create or add action it is the filename
[610] Fix | Delete
// given by the user. For an extract function it is the filename
[611] Fix | Delete
// of the extracted file.
[612] Fix | Delete
// stored_filename : Name of the file / directory stored in the archive.
[613] Fix | Delete
// size : Size of the stored file.
[614] Fix | Delete
// compressed_size : Size of the file's data compressed in the archive
[615] Fix | Delete
// (without the headers overhead)
[616] Fix | Delete
// mtime : Last known modification date of the file (UNIX timestamp)
[617] Fix | Delete
// comment : Comment associated with the file
[618] Fix | Delete
// folder : true | false
[619] Fix | Delete
// index : index of the file in the archive
[620] Fix | Delete
// status : status of the action (depending of the action) :
[621] Fix | Delete
// Values are :
[622] Fix | Delete
// ok : OK !
[623] Fix | Delete
// filtered : the file / dir is not extracted (filtered by user)
[624] Fix | Delete
// already_a_directory : the file can not be extracted because a
[625] Fix | Delete
// directory with the same name already exists
[626] Fix | Delete
// write_protected : the file can not be extracted because a file
[627] Fix | Delete
// with the same name already exists and is
[628] Fix | Delete
// write protected
[629] Fix | Delete
// newer_exist : the file was not extracted because a newer file exists
[630] Fix | Delete
// path_creation_fail : the file is not extracted because the folder
[631] Fix | Delete
// does not exist and can not be created
[632] Fix | Delete
// write_error : the file was not extracted because there was a
[633] Fix | Delete
// error while writing the file
[634] Fix | Delete
// read_error : the file was not extracted because there was a error
[635] Fix | Delete
// while reading the file
[636] Fix | Delete
// invalid_header : the file was not extracted because of an archive
[637] Fix | Delete
// format error (bad file header)
[638] Fix | Delete
// Note that each time a method can continue operating when there
[639] Fix | Delete
// is an action error on a file, the error is only logged in the file status.
[640] Fix | Delete
// Return Values :
[641] Fix | Delete
// 0 on an unrecoverable failure,
[642] Fix | Delete
// The list of the files in the archive.
[643] Fix | Delete
// --------------------------------------------------------------------------------
[644] Fix | Delete
function listContent()
[645] Fix | Delete
{
[646] Fix | Delete
$v_result=1;
[647] Fix | Delete
[648] Fix | Delete
// ----- Reset the error handler
[649] Fix | Delete
$this->privErrorReset();
[650] Fix | Delete
[651] Fix | Delete
// ----- Check archive
[652] Fix | Delete
if (!$this->privCheckFormat()) {
[653] Fix | Delete
return(0);
[654] Fix | Delete
}
[655] Fix | Delete
[656] Fix | Delete
// ----- Call the extracting fct
[657] Fix | Delete
$p_list = array();
[658] Fix | Delete
if (($v_result = $this->privList($p_list)) != 1)
[659] Fix | Delete
{
[660] Fix | Delete
unset($p_list);
[661] Fix | Delete
return(0);
[662] Fix | Delete
}
[663] Fix | Delete
[664] Fix | Delete
// ----- Return
[665] Fix | Delete
return $p_list;
[666] Fix | Delete
}
[667] Fix | Delete
// --------------------------------------------------------------------------------
[668] Fix | Delete
[669] Fix | Delete
// --------------------------------------------------------------------------------
[670] Fix | Delete
// Function :
[671] Fix | Delete
// extract($p_path="./", $p_reCopy_path="")
[672] Fix | Delete
// extract([$p_option, $p_option_value, ...])
[673] Fix | Delete
// Description :
[674] Fix | Delete
// This method supports two synopsis. The first one is historical.
[675] Fix | Delete
// This method extract all the files / directories from the archive to the
[676] Fix | Delete
// folder indicated in $p_path.
[677] Fix | Delete
// If you want to ignore the 'root' part of path of the memorized files
[678] Fix | Delete
// you can indicate this in the optional $p_reCopy_path parameter.
[679] Fix | Delete
// By default, if a newer file with the same name already exists, the
[680] Fix | Delete
// file is not extracted.
[681] Fix | Delete
//
[682] Fix | Delete
// If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
[683] Fix | Delete
// are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
[684] Fix | Delete
// at the end of the path value of PCLZIP_OPT_PATH.
[685] Fix | Delete
// Parameters :
[686] Fix | Delete
// $p_path : Path where the files and directories are to be extracted
[687] Fix | Delete
// $p_reCopy_path : First part ('root' part) of the memorized path
[688] Fix | Delete
// (if any similar) to reCopy while extracting.
[689] Fix | Delete
// Options :
[690] Fix | Delete
// PCLZIP_OPT_PATH :
[691] Fix | Delete
// PCLZIP_OPT_ADD_PATH :
[692] Fix | Delete
// PCLZIP_OPT_RECopy_PATH :
[693] Fix | Delete
// PCLZIP_OPT_RECopy_ALL_PATH :
[694] Fix | Delete
// PCLZIP_CB_PRE_EXTRACT :
[695] Fix | Delete
// PCLZIP_CB_POST_EXTRACT :
[696] Fix | Delete
// Return Values :
[697] Fix | Delete
// 0 or a negative value on failure,
[698] Fix | Delete
// The list of the extracted files, with a status of the action.
[699] Fix | Delete
// (see PclZip::listContent() for list entry format)
[700] Fix | Delete
// --------------------------------------------------------------------------------
[701] Fix | Delete
function extract()
[702] Fix | Delete
{
[703] Fix | Delete
$v_result=1;
[704] Fix | Delete
[705] Fix | Delete
// ----- Reset the error handler
[706] Fix | Delete
$this->privErrorReset();
[707] Fix | Delete
[708] Fix | Delete
// ----- Check archive
[709] Fix | Delete
if (!$this->privCheckFormat()) {
[710] Fix | Delete
return(0);
[711] Fix | Delete
}
[712] Fix | Delete
[713] Fix | Delete
// ----- Set default values
[714] Fix | Delete
$v_options = array();
[715] Fix | Delete
// $v_path = "./";
[716] Fix | Delete
$v_path = '';
[717] Fix | Delete
$v_reCopy_path = "";
[718] Fix | Delete
$v_reCopy_all_path = false;
[719] Fix | Delete
[720] Fix | Delete
// ----- Look for variable options arguments
[721] Fix | Delete
$v_size = func_num_args();
[722] Fix | Delete
[723] Fix | Delete
// ----- Default values for option
[724] Fix | Delete
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
[725] Fix | Delete
[726] Fix | Delete
// ----- Look for arguments
[727] Fix | Delete
if ($v_size > 0) {
[728] Fix | Delete
// ----- Get the arguments
[729] Fix | Delete
$v_arg_list = func_get_args();
[730] Fix | Delete
[731] Fix | Delete
// ----- Look for first arg
[732] Fix | Delete
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
[733] Fix | Delete
[734] Fix | Delete
// ----- Parse the options
[735] Fix | Delete
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
[736] Fix | Delete
array (PCLZIP_OPT_PATH => 'optional',
[737] Fix | Delete
PCLZIP_OPT_RECopy_PATH => 'optional',
[738] Fix | Delete
PCLZIP_OPT_RECopy_ALL_PATH => 'optional',
[739] Fix | Delete
PCLZIP_OPT_ADD_PATH => 'optional',
[740] Fix | Delete
PCLZIP_CB_PRE_EXTRACT => 'optional',
[741] Fix | Delete
PCLZIP_CB_POST_EXTRACT => 'optional',
[742] Fix | Delete
PCLZIP_OPT_SET_CHMOD => 'optional',
[743] Fix | Delete
PCLZIP_OPT_BY_NAME => 'optional',
[744] Fix | Delete
PCLZIP_OPT_BY_EREG => 'optional',
[745] Fix | Delete
PCLZIP_OPT_BY_PREG => 'optional',
[746] Fix | Delete
PCLZIP_OPT_BY_INDEX => 'optional',
[747] Fix | Delete
PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
[748] Fix | Delete
PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
[749] Fix | Delete
PCLZIP_OPT_REPLACE_NEWER => 'optional'
[750] Fix | Delete
,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
[751] Fix | Delete
,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
[752] Fix | Delete
PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
[753] Fix | Delete
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
[754] Fix | Delete
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
[755] Fix | Delete
));
[756] Fix | Delete
if ($v_result != 1) {
[757] Fix | Delete
return 0;
[758] Fix | Delete
}
[759] Fix | Delete
[760] Fix | Delete
// ----- Set the arguments
[761] Fix | Delete
if (isset($v_options[PCLZIP_OPT_PATH])) {
[762] Fix | Delete
$v_path = $v_options[PCLZIP_OPT_PATH];
[763] Fix | Delete
}
[764] Fix | Delete
if (isset($v_options[PCLZIP_OPT_RECopy_PATH])) {
[765] Fix | Delete
$v_reCopy_path = $v_options[PCLZIP_OPT_RECopy_PATH];
[766] Fix | Delete
}
[767] Fix | Delete
if (isset($v_options[PCLZIP_OPT_RECopy_ALL_PATH])) {
[768] Fix | Delete
$v_reCopy_all_path = $v_options[PCLZIP_OPT_RECopy_ALL_PATH];
[769] Fix | Delete
}
[770] Fix | Delete
if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
[771] Fix | Delete
// ----- Check for '/' in last path char
[772] Fix | Delete
if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
[773] Fix | Delete
$v_path .= '/';
[774] Fix | Delete
}
[775] Fix | Delete
$v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
[776] Fix | Delete
}
[777] Fix | Delete
}
[778] Fix | Delete
[779] Fix | Delete
// ----- Look for 2 args
[780] Fix | Delete
// Here we need to support the first historic synopsis of the
[781] Fix | Delete
// method.
[782] Fix | Delete
else {
[783] Fix | Delete
[784] Fix | Delete
// ----- Get the first argument
[785] Fix | Delete
$v_path = $v_arg_list[0];
[786] Fix | Delete
[787] Fix | Delete
// ----- Look for the optional second argument
[788] Fix | Delete
if ($v_size == 2) {
[789] Fix | Delete
$v_reCopy_path = $v_arg_list[1];
[790] Fix | Delete
}
[791] Fix | Delete
else if ($v_size > 2) {
[792] Fix | Delete
// ----- Error log
[793] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
[794] Fix | Delete
[795] Fix | Delete
// ----- Return
[796] Fix | Delete
return 0;
[797] Fix | Delete
}
[798] Fix | Delete
}
[799] Fix | Delete
}
[800] Fix | Delete
[801] Fix | Delete
// ----- Look for default option values
[802] Fix | Delete
$this->privOptionDefaultThreshold($v_options);
[803] Fix | Delete
[804] Fix | Delete
// ----- Trace
[805] Fix | Delete
[806] Fix | Delete
// ----- Call the extracting fct
[807] Fix | Delete
$p_list = array();
[808] Fix | Delete
$v_result = $this->privExtractByRule($p_list, $v_path, $v_reCopy_path,
[809] Fix | Delete
$v_reCopy_all_path, $v_options);
[810] Fix | Delete
if ($v_result < 1) {
[811] Fix | Delete
unset($p_list);
[812] Fix | Delete
return(0);
[813] Fix | Delete
}
[814] Fix | Delete
[815] Fix | Delete
// ----- Return
[816] Fix | Delete
return $p_list;
[817] Fix | Delete
}
[818] Fix | Delete
// --------------------------------------------------------------------------------
[819] Fix | Delete
[820] Fix | Delete
[821] Fix | Delete
// --------------------------------------------------------------------------------
[822] Fix | Delete
// Function :
[823] Fix | Delete
// extractByIndex($p_index, $p_path="./", $p_reCopy_path="")
[824] Fix | Delete
// extractByIndex($p_index, [$p_option, $p_option_value, ...])
[825] Fix | Delete
// Description :
[826] Fix | Delete
// This method supports two synopsis. The first one is historical.
[827] Fix | Delete
// This method is doing a partial extract of the archive.
[828] Fix | Delete
// The extracted files or folders are identified by their index in the
[829] Fix | Delete
// archive (from 0 to n).
[830] Fix | Delete
// Note that if the index identify a folder, only the folder entry is
[831] Fix | Delete
// extracted, not all the files included in the archive.
[832] Fix | Delete
// Parameters :
[833] Fix | Delete
// $p_index : A single index (integer) or a string of indexes of files to
[834] Fix | Delete
// extract. The form of the string is "0,4-6,8-12" with only numbers
[835] Fix | Delete
// and '-' for range or ',' to separate ranges. No spaces or ';'
[836] Fix | Delete
// are allowed.
[837] Fix | Delete
// $p_path : Path where the files and directories are to be extracted
[838] Fix | Delete
// $p_reCopy_path : First part ('root' part) of the memorized path
[839] Fix | Delete
// (if any similar) to reCopy while extracting.
[840] Fix | Delete
// Options :
[841] Fix | Delete
// PCLZIP_OPT_PATH :
[842] Fix | Delete
// PCLZIP_OPT_ADD_PATH :
[843] Fix | Delete
// PCLZIP_OPT_RECopy_PATH :
[844] Fix | Delete
// PCLZIP_OPT_RECopy_ALL_PATH :
[845] Fix | Delete
// PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
[846] Fix | Delete
// not as files.
[847] Fix | Delete
// The resulting content is in a new field 'content' in the file
[848] Fix | Delete
// structure.
[849] Fix | Delete
// This option must be used alone (any other options are ignored).
[850] Fix | Delete
// PCLZIP_CB_PRE_EXTRACT :
[851] Fix | Delete
// PCLZIP_CB_POST_EXTRACT :
[852] Fix | Delete
// Return Values :
[853] Fix | Delete
// 0 on failure,
[854] Fix | Delete
// The list of the extracted files, with a status of the action.
[855] Fix | Delete
// (see PclZip::listContent() for list entry format)
[856] Fix | Delete
// --------------------------------------------------------------------------------
[857] Fix | Delete
//function extractByIndex($p_index, options...)
[858] Fix | Delete
function extractByIndex($p_index)
[859] Fix | Delete
{
[860] Fix | Delete
$v_result=1;
[861] Fix | Delete
[862] Fix | Delete
// ----- Reset the error handler
[863] Fix | Delete
$this->privErrorReset();
[864] Fix | Delete
[865] Fix | Delete
// ----- Check archive
[866] Fix | Delete
if (!$this->privCheckFormat()) {
[867] Fix | Delete
return(0);
[868] Fix | Delete
}
[869] Fix | Delete
[870] Fix | Delete
// ----- Set default values
[871] Fix | Delete
$v_options = array();
[872] Fix | Delete
// $v_path = "./";
[873] Fix | Delete
$v_path = '';
[874] Fix | Delete
$v_reCopy_path = "";
[875] Fix | Delete
$v_reCopy_all_path = false;
[876] Fix | Delete
[877] Fix | Delete
// ----- Look for variable options arguments
[878] Fix | Delete
$v_size = func_num_args();
[879] Fix | Delete
[880] Fix | Delete
// ----- Default values for option
[881] Fix | Delete
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
[882] Fix | Delete
[883] Fix | Delete
// ----- Look for arguments
[884] Fix | Delete
if ($v_size > 1) {
[885] Fix | Delete
// ----- Get the arguments
[886] Fix | Delete
$v_arg_list = func_get_args();
[887] Fix | Delete
[888] Fix | Delete
// ----- ReCopy form the options list the first argument
[889] Fix | Delete
array_shift($v_arg_list);
[890] Fix | Delete
$v_size--;
[891] Fix | Delete
[892] Fix | Delete
// ----- Look for first arg
[893] Fix | Delete
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
[894] Fix | Delete
[895] Fix | Delete
// ----- Parse the options
[896] Fix | Delete
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
[897] Fix | Delete
array (PCLZIP_OPT_PATH => 'optional',
[898] Fix | Delete
PCLZIP_OPT_RECopy_PATH => 'optional',
[899] Fix | Delete
PCLZIP_OPT_RECopy_ALL_PATH => 'optional',
[900] Fix | Delete
PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
[901] Fix | Delete
PCLZIP_OPT_ADD_PATH => 'optional',
[902] Fix | Delete
PCLZIP_CB_PRE_EXTRACT => 'optional',
[903] Fix | Delete
PCLZIP_CB_POST_EXTRACT => 'optional',
[904] Fix | Delete
PCLZIP_OPT_SET_CHMOD => 'optional',
[905] Fix | Delete
PCLZIP_OPT_REPLACE_NEWER => 'optional'
[906] Fix | Delete
,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
[907] Fix | Delete
,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional',
[908] Fix | Delete
PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional',
[909] Fix | Delete
PCLZIP_OPT_TEMP_FILE_ON => 'optional',
[910] Fix | Delete
PCLZIP_OPT_TEMP_FILE_OFF => 'optional'
[911] Fix | Delete
));
[912] Fix | Delete
if ($v_result != 1) {
[913] Fix | Delete
return 0;
[914] Fix | Delete
}
[915] Fix | Delete
[916] Fix | Delete
// ----- Set the arguments
[917] Fix | Delete
if (isset($v_options[PCLZIP_OPT_PATH])) {
[918] Fix | Delete
$v_path = $v_options[PCLZIP_OPT_PATH];
[919] Fix | Delete
}
[920] Fix | Delete
if (isset($v_options[PCLZIP_OPT_RECopy_PATH])) {
[921] Fix | Delete
$v_reCopy_path = $v_options[PCLZIP_OPT_RECopy_PATH];
[922] Fix | Delete
}
[923] Fix | Delete
if (isset($v_options[PCLZIP_OPT_RECopy_ALL_PATH])) {
[924] Fix | Delete
$v_reCopy_all_path = $v_options[PCLZIP_OPT_RECopy_ALL_PATH];
[925] Fix | Delete
}
[926] Fix | Delete
if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
[927] Fix | Delete
// ----- Check for '/' in last path char
[928] Fix | Delete
if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
[929] Fix | Delete
$v_path .= '/';
[930] Fix | Delete
}
[931] Fix | Delete
$v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
[932] Fix | Delete
}
[933] Fix | Delete
if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
[934] Fix | Delete
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
[935] Fix | Delete
}
[936] Fix | Delete
else {
[937] Fix | Delete
}
[938] Fix | Delete
}
[939] Fix | Delete
[940] Fix | Delete
// ----- Look for 2 args
[941] Fix | Delete
// Here we need to support the first historic synopsis of the
[942] Fix | Delete
// method.
[943] Fix | Delete
else {
[944] Fix | Delete
[945] Fix | Delete
// ----- Get the first argument
[946] Fix | Delete
$v_path = $v_arg_list[0];
[947] Fix | Delete
[948] Fix | Delete
// ----- Look for the optional second argument
[949] Fix | Delete
if ($v_size == 2) {
[950] Fix | Delete
$v_reCopy_path = $v_arg_list[1];
[951] Fix | Delete
}
[952] Fix | Delete
else if ($v_size > 2) {
[953] Fix | Delete
// ----- Error log
[954] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
[955] Fix | Delete
[956] Fix | Delete
// ----- Return
[957] Fix | Delete
return 0;
[958] Fix | Delete
}
[959] Fix | Delete
}
[960] Fix | Delete
}
[961] Fix | Delete
[962] Fix | Delete
// ----- Trace
[963] Fix | Delete
[964] Fix | Delete
// ----- Trick
[965] Fix | Delete
// Here I want to reuse extractByRule(), so I need to parse the $p_index
[966] Fix | Delete
// with privParseOptions()
[967] Fix | Delete
$v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
[968] Fix | Delete
$v_options_trick = array();
[969] Fix | Delete
$v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
[970] Fix | Delete
array (PCLZIP_OPT_BY_INDEX => 'optional' ));
[971] Fix | Delete
if ($v_result != 1) {
[972] Fix | Delete
return 0;
[973] Fix | Delete
}
[974] Fix | Delete
$v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
[975] Fix | Delete
[976] Fix | Delete
// ----- Look for default option values
[977] Fix | Delete
$this->privOptionDefaultThreshold($v_options);
[978] Fix | Delete
[979] Fix | Delete
// ----- Call the extracting fct
[980] Fix | Delete
if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_reCopy_path, $v_reCopy_all_path, $v_options)) < 1) {
[981] Fix | Delete
return(0);
[982] Fix | Delete
}
[983] Fix | Delete
[984] Fix | Delete
// ----- Return
[985] Fix | Delete
return $p_list;
[986] Fix | Delete
}
[987] Fix | Delete
// --------------------------------------------------------------------------------
[988] Fix | Delete
[989] Fix | Delete
// --------------------------------------------------------------------------------
[990] Fix | Delete
// Function :
[991] Fix | Delete
// delete([$p_option, $p_option_value, ...])
[992] Fix | Delete
// Description :
[993] Fix | Delete
// This method reCopys files from the archive.
[994] Fix | Delete
// If no parameters are given, then all the archive is emptied.
[995] Fix | Delete
// Parameters :
[996] Fix | Delete
// None or optional arguments.
[997] Fix | Delete
// Options :
[998] Fix | Delete
// PCLZIP_OPT_BY_INDEX :
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function