本文整理汇总了PHP中PclZipUtilTranslateWinPath函数的典型用法代码示例。如果您正苦于以下问题:PHP PclZipUtilTranslateWinPath函数的具体用法?PHP PclZipUtilTranslateWinPath怎么用?PHP PclZipUtilTranslateWinPath使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PclZipUtilTranslateWinPath函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: privCalculateStoredFilename
function privCalculateStoredFilename(&$p_filedescr, &$p_options)
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
$v_result = 1;
// ----- Working variables
$p_filename = $p_filedescr['filename'];
if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
$p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
} else {
$p_add_dir = '';
}
if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
$p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
} else {
$p_remove_dir = '';
}
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Remove path ='".$p_remove_dir."'");
if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
$p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
} else {
$p_remove_all_dir = 0;
}
// ----- Look for full name change
if (isset($p_filedescr['new_full_name'])) {
// ----- Remove drive letter if any
$v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
} else {
// ----- Look for short name change
// Its when we cahnge just the filename but not the path
if (isset($p_filedescr['new_short_name'])) {
$v_path_info = pathinfo($p_filename);
$v_dir = '';
if ($v_path_info['dirname'] != '') {
$v_dir = $v_path_info['dirname'] . '/';
}
$v_stored_filename = $v_dir . $p_filedescr['new_short_name'];
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing short name of '".$p_filename."' for '".$v_stored_filename."'");
} else {
// ----- Calculate the stored filename
$v_stored_filename = $p_filename;
}
// ----- Look for all path to remove
if ($p_remove_all_dir) {
$v_stored_filename = basename($p_filename);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove all path selected change '".$p_filename."' for '".$v_stored_filename."'");
} else {
if ($p_remove_dir != "") {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Partial path to remove");
if (substr($p_remove_dir, -1) != '/') {
$p_remove_dir .= "/";
}
if (substr($p_filename, 0, 2) == "./" || substr($p_remove_dir, 0, 2) == "./") {
if (substr($p_filename, 0, 2) == "./" && substr($p_remove_dir, 0, 2) != "./") {
$p_remove_dir = "./" . $p_remove_dir;
}
if (substr($p_filename, 0, 2) != "./" && substr($p_remove_dir, 0, 2) == "./") {
$p_remove_dir = substr($p_remove_dir, 2);
}
}
$v_compare = PclZipUtilPathInclusion($p_remove_dir, $v_stored_filename);
if ($v_compare > 0) {
if ($v_compare == 2) {
$v_stored_filename = "";
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder");
} else {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$p_remove_dir' in file '$v_stored_filename'");
$v_stored_filename = substr($v_stored_filename, strlen($p_remove_dir));
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Result is '$v_stored_filename'");
}
}
}
}
// ----- Remove drive letter if any
$v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename);
// ----- Look for path to add
if ($p_add_dir != "") {
if (substr($p_add_dir, -1) == "/") {
$v_stored_filename = $p_add_dir . $v_stored_filename;
} else {
$v_stored_filename = $p_add_dir . "/" . $v_stored_filename;
}
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'");
}
}
// ----- Filename (reduce the path of stored name)
$v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
$p_filedescr['stored_filename'] = $v_stored_filename;
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
示例2: privAddFileList
function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
{
$v_result = 1;
$v_header = array();
// ----- Recuperate the current number of elt in list
$v_nb = sizeof($p_result_list);
// ----- Loop on the files
for ($j = 0; $j < sizeof($p_filedescr_list) && $v_result == 1; $j++) {
// ----- Format the filename
$p_filedescr_list[$j]['filename'] = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
// ----- Skip empty file names
// TBC : Can this be possible ? not checked in DescrParseAtt ?
if ($p_filedescr_list[$j]['filename'] == "") {
continue;
}
// ----- Check the filename
if ($p_filedescr_list[$j]['type'] != 'virtual_file' && !file_exists($p_filedescr_list[$j]['filename'])) {
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $p_filedescr_list[$j]['filename'] . "' does not exist");
return PclZip::errorCode();
}
// ----- Look if it is a file or a dir with no all path remove option
// or a dir with all its path removed
// if ( (is_file($p_filedescr_list[$j]['filename']))
// || ( is_dir($p_filedescr_list[$j]['filename'])
if ($p_filedescr_list[$j]['type'] == 'file' || $p_filedescr_list[$j]['type'] == 'virtual_file' || $p_filedescr_list[$j]['type'] == 'folder' && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
// ----- Add the file
$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header, $p_options);
if ($v_result != 1) {
return $v_result;
}
// ----- Store the file infos
$p_result_list[$v_nb++] = $v_header;
}
}
// ----- Return
return $v_result;
}
示例3: privAddFileList
function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "filedescr_list");
$v_result = 1;
$v_header = array();
// ----- Recuperate the current number of elt in list
$v_nb = sizeof($p_result_list);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have ".$v_nb." elements");
// ----- Loop on the files
for ($j = 0; $j < sizeof($p_filedescr_list) && $v_result == 1; $j++) {
// ----- Format the filename
$p_filedescr_list[$j]['filename'] = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
// ----- Skip empty file names
// TBC : Can this be possible ? not checked in DescrParseAtt ?
if ($p_filedescr_list[$j]['filename'] == "") {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");
continue;
}
// ----- Check the filename
if (!file_exists($p_filedescr_list[$j]['filename'])) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $p_filedescr_list[$j]['filename'] . "' does not exists");
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Look if it is a file or a dir with no all path remove option
if (is_file($p_filedescr_list[$j]['filename']) || is_dir($p_filedescr_list[$j]['filename']) && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
// ----- Add the file
$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header, $p_options);
if ($v_result != 1) {
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Store the file infos
$p_result_list[$v_nb++] = $v_header;
}
}
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have ".$v_nb." elements");
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
示例4: privAddFileList
function privAddFileList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "list, add_dir='$p_add_dir', remove_dir='$p_remove_dir'");
$v_result = 1;
$v_header = array();
// ----- Recuperate the current number of elt in list
$v_nb = sizeof($p_result_list);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have $v_nb elements");
// ----- Loop on the files
for ($j = 0; $j < count($p_list) && $v_result == 1; $j++) {
// ----- Recuperate the filename
$p_filename = PclZipUtilTranslateWinPath($p_list[$j], false);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file [$p_filename]");
// ----- Skip empty file names
if ($p_filename == "") {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");
continue;
}
// ----- Check the filename
if (!file_exists($p_filename)) {
// ----- Error log
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '$p_filename' does not exists");
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '{$p_filename}' does not exists");
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
/* This test is done later
// ----- Check the path length
if (strlen($p_filename) > 0xFF)
{
// ----- Error log
PclZip::privErrorLog(-5, "File name is too long (max. 255) : '$p_filename'");
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
*/
// ----- Look if it is a file or a dir with no all pathnre move
if (is_file($p_filename) || is_dir($p_filename) && !$p_remove_all_dir) {
// ----- Add the file
if (($v_result = $this->privAddFile($p_filename, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1) {
// ----- Return status
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Store the file infos
$p_result_list[$v_nb++] = $v_header;
}
// ----- Look for directory
if (is_dir($p_filename)) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "$p_filename is a directory");
// ----- Look for path
if ($p_filename != ".") {
$v_path = $p_filename . "/";
} else {
$v_path = "";
}
// ----- Read the directory for files and sub-directories
$p_hdir = opendir($p_filename);
$p_hitem = readdir($p_hdir);
// '.' directory
$p_hitem = readdir($p_hdir);
// '..' directory
while (($p_hitem = readdir($p_hdir)) !== false) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for $p_hitem in the directory");
// ----- Look for a file
if (is_file($v_path . $p_hitem)) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Add the file '".$v_path.$p_hitem."'");
// ----- Add the file
if (($v_result = $this->privAddFile($v_path . $p_hitem, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1) {
// ----- Return status
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
// ----- Store the file infos
$p_result_list[$v_nb++] = $v_header;
} else {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Add the directory '".$v_path.$p_hitem."'");
// ----- Need an array as parameter
$p_temp_list[0] = $v_path . $p_hitem;
$v_result = $this->privAddFileList($p_temp_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options);
// ----- Update the number of elements of the list
$v_nb = sizeof($p_result_list);
}
}
// ----- Free memory for the recursive loop
unset($p_temp_list);
unset($p_hdir);
unset($p_hitem);
}
}
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have $v_nb elements");
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
return $v_result;
}
示例5: array
$filedata = array();
while ($row = $db->fetch_assoc($result)) {
$filepath = str_replace('{folder}', $config['smileypath'], $row['replace']);
$filedata[$row['id']] = array('search' => $row['search'], 'replace' => $row['replace'], 'desc' => $row['desc']);
if (!preg_match('~http(s)?:\\/\\/~i', $filepath)) {
$files[] = $filepath;
}
}
$myini = new INI();
$myini->write($smilieconfig, $filedata);
$files[] = $smilieconfig;
$files = array_unique($files);
require_once 'classes/class.zip.php';
$archive = new PclZip($tempdir . $file);
// Have to parse $dir with PclZipUtilTranslateWinPath to have equal paths at $files-Array and $dir (PclZip-Bug?)
$v_list = $archive->create($files, PCLZIP_OPT_REMOVE_PATH, PclZipUtilTranslateWinPath($config['smileypath']));
if ($v_list == 0) {
echo head();
unset($archive);
$filesystem->unlink($smilieconfig);
error('admin.php?action=bbcodes&job=smileys', $archive->errorInfo(true));
} else {
viscacha_header('Content-Type: application/zip');
viscacha_header('Content-Disposition: attachment; filename="' . $file . '"');
viscacha_header('Content-Length: ' . filesize($tempdir . $file));
readfile($tempdir . $file);
unset($archive);
$filesystem->unlink($smilieconfig);
$filesystem->unlink($tempdir . $file);
}
} elseif ($job == 'smileys') {
示例6: privAddFileList
function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
{
$v_result = 1;
$v_header = array();
$v_nb = sizeof($p_result_list);
for ($j = 0; $j < sizeof($p_filedescr_list) && $v_result == 1; $j++) {
$p_filedescr_list[$j]['filename'] = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
if ($p_filedescr_list[$j]['filename'] == "") {
continue;
}
if ($p_filedescr_list[$j]['type'] != 'virtual_file' && !file_exists($p_filedescr_list[$j]['filename'])) {
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $p_filedescr_list[$j]['filename'] . "' does not exists");
return PclZip::errorCode();
}
if ($p_filedescr_list[$j]['type'] == 'file' || $p_filedescr_list[$j]['type'] == 'virtual_file' || $p_filedescr_list[$j]['type'] == 'folder' && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header, $p_options);
if ($v_result != 1) {
return $v_result;
}
$p_result_list[$v_nb++] = $v_header;
}
}
return $v_result;
}
示例7: privAddFileList
function privAddFileList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
{
$v_result = 1;
$v_header = array();
$v_nb = sizeof($p_result_list);
for ($j = 0; $j < count($p_list) && $v_result == 1; $j++) {
$p_filename = PclZipUtilTranslateWinPath($p_list[$j], false);
if ($p_filename == "") {
continue;
}
if (!file_exists($p_filename)) {
Zip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '{$p_filename}' does not exists");
return Zip::errorCode();
}
if (is_file($p_filename) || is_dir($p_filename) && !$p_remove_all_dir) {
if (($v_result = $this->privAddFile($p_filename, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1) {
return $v_result;
}
$p_result_list[$v_nb++] = $v_header;
}
if (@is_dir($p_filename)) {
if ($p_filename != ".") {
$v_path = $p_filename . "/";
} else {
$v_path = "";
}
if ($p_hdir = @opendir($p_filename)) {
while (($p_hitem = @readdir($p_hdir)) !== false) {
if ($p_hitem == '.' || $p_hitem == '..') {
continue;
}
if (@is_file($v_path . $p_hitem)) {
if (($v_result = $this->privAddFile($v_path . $p_hitem, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1) {
return $v_result;
}
$p_result_list[$v_nb++] = $v_header;
} elseif (@is_dir($v_path . $p_hitem)) {
$p_temp_list[0] = $v_path . $p_hitem;
$v_result = $this->privAddFileList($p_temp_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options);
$v_nb = sizeof($p_result_list);
}
}
@closedir($p_hdir);
}
unset($p_temp_list);
unset($p_hdir);
unset($p_hitem);
}
}
return $v_result;
}
示例8: privParseOptions
function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false)
{
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
$v_result = 1;
// ----- Read the options
$i = 0;
while ($i < $p_size) {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Looking for table index $i, option = '".PclZipUtilOptionText($p_options_list[$i])."(".$p_options_list[$i].")'");
// ----- Check if the option is supported
if (!isset($v_requested_options[$p_options_list[$i]])) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '" . $p_options_list[$i] . "' for this method");
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Look for next option
switch ($p_options_list[$i]) {
// ----- Look for options that request a path value
case PCLZIP_OPT_PATH:
case PCLZIP_OPT_REMOVE_PATH:
case PCLZIP_OPT_ADD_PATH:
// ----- Check the number of parameters
if ($i + 1 >= $p_size) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Get the value
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
$i++;
break;
case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION:
// ----- Check the number of parameters
if ($i + 1 >= $p_size) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Get the value
if (is_string($p_options_list[$i + 1]) && $p_options_list[$i + 1] != '') {
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false);
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
$i++;
} else {
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." set with an empty value is ignored.");
}
break;
// ----- Look for options that request an array of string for value
// ----- Look for options that request an array of string for value
case PCLZIP_OPT_BY_NAME:
// ----- Check the number of parameters
if ($i + 1 >= $p_size) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Get the value
if (is_string($p_options_list[$i + 1])) {
$v_result_list[$p_options_list[$i]][0] = $p_options_list[$i + 1];
} else {
if (is_array($p_options_list[$i + 1])) {
$v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1];
} else {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
}
////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
$i++;
break;
// ----- Look for options that request an EREG or PREG expression
// ----- Look for options that request an EREG or PREG expression
case PCLZIP_OPT_BY_EREG:
case PCLZIP_OPT_BY_PREG:
//case PCLZIP_OPT_CRYPT :
// ----- Check the number of parameters
if ($i + 1 >= $p_size) {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
// ----- Return
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
return PclZip::errorCode();
}
// ----- Get the value
if (is_string($p_options_list[$i + 1])) {
$v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1];
} else {
// ----- Error log
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
//.........这里部分代码省略.........
示例9: privParseOptions
function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false)
{
$v_result = 1;
$i = 0;
while ($i < $p_size) {
if (!isset($v_requested_options[$p_options_list[$i]])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '" . $p_options_list[$i] . "' for this method");
return PclZip::errorCode();
}
switch ($p_options_list[$i]) {
case PCLZIP_OPT_PATH:
case PCLZIP_OPT_REMOVE_PATH:
case PCLZIP_OPT_ADD_PATH:
if ($i + 1 >= $p_size) {
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
return PclZip::errorCode();
}
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], FALSE);
$i++;
break;
case PCLZIP_OPT_TEMP_FILE_THRESHOLD:
if ($i + 1 >= $p_size) {
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
return PclZip::errorCode();
}
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
return PclZip::errorCode();
}
$v_value = $p_options_list[$i + 1];
if (!is_integer($v_value) || $v_value < 0) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
return PclZip::errorCode();
}
$v_result_list[$p_options_list[$i]] = $v_value * 1048576;
$i++;
break;
case PCLZIP_OPT_TEMP_FILE_ON:
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
return PclZip::errorCode();
}
$v_result_list[$p_options_list[$i]] = true;
break;
case PCLZIP_OPT_TEMP_FILE_OFF:
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
return PclZip::errorCode();
}
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
return PclZip::errorCode();
}
$v_result_list[$p_options_list[$i]] = true;
break;
case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION:
if ($i + 1 >= $p_size) {
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
return PclZip::errorCode();
}
if (is_string($p_options_list[$i + 1]) && $p_options_list[$i + 1] != '') {
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], FALSE);
$i++;
} else {
}
break;
case PCLZIP_OPT_BY_NAME:
if ($i + 1 >= $p_size) {
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
return PclZip::errorCode();
}
if (is_string($p_options_list[$i + 1])) {
$v_result_list[$p_options_list[$i]][0] = $p_options_list[$i + 1];
} else {
if (is_array($p_options_list[$i + 1])) {
$v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1];
} else {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
return PclZip::errorCode();
}
}
$i++;
break;
case PCLZIP_OPT_BY_EREG:
$p_options_list[$i] = PCLZIP_OPT_BY_PREG;
case PCLZIP_OPT_BY_PREG:
if ($i + 1 >= $p_size) {
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
return PclZip::errorCode();
}
if (is_string($p_options_list[$i + 1])) {
$v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1];
} else {
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'");
return PclZip::errorCode();
}
$i++;
break;
case PCLZIP_OPT_COMMENT:
case PCLZIP_OPT_ADD_COMMENT:
//.........这里部分代码省略.........