Edit File by line
/home/barbar84/www/extracte.../filemang...
File: pclzip.lib.php
case PCLZIP_OPT_TEMP_FILE_OFF :
[1500] Fix | Delete
// ----- Check for incompatible options
[1501] Fix | Delete
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) {
[1502] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'");
[1503] Fix | Delete
return PclZip::errorCode();
[1504] Fix | Delete
}
[1505] Fix | Delete
// ----- Check for incompatible options
[1506] Fix | Delete
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
[1507] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'");
[1508] Fix | Delete
return PclZip::errorCode();
[1509] Fix | Delete
}
[1510] Fix | Delete
[1511] Fix | Delete
$v_result_list[$p_options_list[$i]] = true;
[1512] Fix | Delete
break;
[1513] Fix | Delete
[1514] Fix | Delete
case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
[1515] Fix | Delete
// ----- Check the number of parameters
[1516] Fix | Delete
if (($i+1) >= $p_size) {
[1517] Fix | Delete
// ----- Error log
[1518] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1519] Fix | Delete
[1520] Fix | Delete
// ----- Return
[1521] Fix | Delete
return PclZip::errorCode();
[1522] Fix | Delete
}
[1523] Fix | Delete
[1524] Fix | Delete
// ----- Get the value
[1525] Fix | Delete
if ( is_string($p_options_list[$i+1])
[1526] Fix | Delete
&& ($p_options_list[$i+1] != '')) {
[1527] Fix | Delete
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], FALSE);
[1528] Fix | Delete
$i++;
[1529] Fix | Delete
}
[1530] Fix | Delete
else {
[1531] Fix | Delete
}
[1532] Fix | Delete
break;
[1533] Fix | Delete
[1534] Fix | Delete
// ----- Look for options that request an array of string for value
[1535] Fix | Delete
case PCLZIP_OPT_BY_NAME :
[1536] Fix | Delete
// ----- Check the number of parameters
[1537] Fix | Delete
if (($i+1) >= $p_size) {
[1538] Fix | Delete
// ----- Error log
[1539] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1540] Fix | Delete
[1541] Fix | Delete
// ----- Return
[1542] Fix | Delete
return PclZip::errorCode();
[1543] Fix | Delete
}
[1544] Fix | Delete
[1545] Fix | Delete
// ----- Get the value
[1546] Fix | Delete
if (is_string($p_options_list[$i+1])) {
[1547] Fix | Delete
$v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
[1548] Fix | Delete
}
[1549] Fix | Delete
else if (is_array($p_options_list[$i+1])) {
[1550] Fix | Delete
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
[1551] Fix | Delete
}
[1552] Fix | Delete
else {
[1553] Fix | Delete
// ----- Error log
[1554] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1555] Fix | Delete
[1556] Fix | Delete
// ----- Return
[1557] Fix | Delete
return PclZip::errorCode();
[1558] Fix | Delete
}
[1559] Fix | Delete
$i++;
[1560] Fix | Delete
break;
[1561] Fix | Delete
[1562] Fix | Delete
// ----- Look for options that request an EREG or PREG expression
[1563] Fix | Delete
case PCLZIP_OPT_BY_EREG :
[1564] Fix | Delete
// ereg() is deprecated starting with PHP 5.3. Copy PCLZIP_OPT_BY_EREG
[1565] Fix | Delete
// to PCLZIP_OPT_BY_PREG
[1566] Fix | Delete
$p_options_list[$i] = PCLZIP_OPT_BY_PREG;
[1567] Fix | Delete
case PCLZIP_OPT_BY_PREG :
[1568] Fix | Delete
//case PCLZIP_OPT_CRYPT :
[1569] Fix | Delete
// ----- Check the number of parameters
[1570] Fix | Delete
if (($i+1) >= $p_size) {
[1571] Fix | Delete
// ----- Error log
[1572] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1573] Fix | Delete
[1574] Fix | Delete
// ----- Return
[1575] Fix | Delete
return PclZip::errorCode();
[1576] Fix | Delete
}
[1577] Fix | Delete
[1578] Fix | Delete
// ----- Get the value
[1579] Fix | Delete
if (is_string($p_options_list[$i+1])) {
[1580] Fix | Delete
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
[1581] Fix | Delete
}
[1582] Fix | Delete
else {
[1583] Fix | Delete
// ----- Error log
[1584] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1585] Fix | Delete
[1586] Fix | Delete
// ----- Return
[1587] Fix | Delete
return PclZip::errorCode();
[1588] Fix | Delete
}
[1589] Fix | Delete
$i++;
[1590] Fix | Delete
break;
[1591] Fix | Delete
[1592] Fix | Delete
// ----- Look for options that takes a string
[1593] Fix | Delete
case PCLZIP_OPT_COMMENT :
[1594] Fix | Delete
case PCLZIP_OPT_ADD_COMMENT :
[1595] Fix | Delete
case PCLZIP_OPT_PREPEND_COMMENT :
[1596] Fix | Delete
// ----- Check the number of parameters
[1597] Fix | Delete
if (($i+1) >= $p_size) {
[1598] Fix | Delete
// ----- Error log
[1599] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
[1600] Fix | Delete
"Missing parameter value for option '"
[1601] Fix | Delete
.PclZipUtilOptionText($p_options_list[$i])
[1602] Fix | Delete
."'");
[1603] Fix | Delete
[1604] Fix | Delete
// ----- Return
[1605] Fix | Delete
return PclZip::errorCode();
[1606] Fix | Delete
}
[1607] Fix | Delete
[1608] Fix | Delete
// ----- Get the value
[1609] Fix | Delete
if (is_string($p_options_list[$i+1])) {
[1610] Fix | Delete
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
[1611] Fix | Delete
}
[1612] Fix | Delete
else {
[1613] Fix | Delete
// ----- Error log
[1614] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
[1615] Fix | Delete
"Wrong parameter value for option '"
[1616] Fix | Delete
.PclZipUtilOptionText($p_options_list[$i])
[1617] Fix | Delete
."'");
[1618] Fix | Delete
[1619] Fix | Delete
// ----- Return
[1620] Fix | Delete
return PclZip::errorCode();
[1621] Fix | Delete
}
[1622] Fix | Delete
$i++;
[1623] Fix | Delete
break;
[1624] Fix | Delete
[1625] Fix | Delete
// ----- Look for options that request an array of index
[1626] Fix | Delete
case PCLZIP_OPT_BY_INDEX :
[1627] Fix | Delete
// ----- Check the number of parameters
[1628] Fix | Delete
if (($i+1) >= $p_size) {
[1629] Fix | Delete
// ----- Error log
[1630] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1631] Fix | Delete
[1632] Fix | Delete
// ----- Return
[1633] Fix | Delete
return PclZip::errorCode();
[1634] Fix | Delete
}
[1635] Fix | Delete
[1636] Fix | Delete
// ----- Get the value
[1637] Fix | Delete
$v_work_list = array();
[1638] Fix | Delete
if (is_string($p_options_list[$i+1])) {
[1639] Fix | Delete
[1640] Fix | Delete
// ----- ReCopy spaces
[1641] Fix | Delete
$p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
[1642] Fix | Delete
[1643] Fix | Delete
// ----- Parse items
[1644] Fix | Delete
$v_work_list = explode(",", $p_options_list[$i+1]);
[1645] Fix | Delete
}
[1646] Fix | Delete
else if (is_integer($p_options_list[$i+1])) {
[1647] Fix | Delete
$v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
[1648] Fix | Delete
}
[1649] Fix | Delete
else if (is_array($p_options_list[$i+1])) {
[1650] Fix | Delete
$v_work_list = $p_options_list[$i+1];
[1651] Fix | Delete
}
[1652] Fix | Delete
else {
[1653] Fix | Delete
// ----- Error log
[1654] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1655] Fix | Delete
[1656] Fix | Delete
// ----- Return
[1657] Fix | Delete
return PclZip::errorCode();
[1658] Fix | Delete
}
[1659] Fix | Delete
[1660] Fix | Delete
// ----- Reduce the index list
[1661] Fix | Delete
// each index item in the list must be a couple with a start and
[1662] Fix | Delete
// an end value : [0,3], [5-5], [8-10], ...
[1663] Fix | Delete
// ----- Check the format of each item
[1664] Fix | Delete
$v_sort_flag=false;
[1665] Fix | Delete
$v_sort_value=0;
[1666] Fix | Delete
for ($j=0; $j<sizeof($v_work_list); $j++) {
[1667] Fix | Delete
// ----- Explode the item
[1668] Fix | Delete
$v_item_list = explode("-", $v_work_list[$j]);
[1669] Fix | Delete
$v_size_item_list = sizeof($v_item_list);
[1670] Fix | Delete
[1671] Fix | Delete
// ----- TBC : Here we might check that each item is a
[1672] Fix | Delete
// real integer ...
[1673] Fix | Delete
[1674] Fix | Delete
// ----- Look for single value
[1675] Fix | Delete
if ($v_size_item_list == 1) {
[1676] Fix | Delete
// ----- Set the option value
[1677] Fix | Delete
$v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
[1678] Fix | Delete
$v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
[1679] Fix | Delete
}
[1680] Fix | Delete
elseif ($v_size_item_list == 2) {
[1681] Fix | Delete
// ----- Set the option value
[1682] Fix | Delete
$v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
[1683] Fix | Delete
$v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
[1684] Fix | Delete
}
[1685] Fix | Delete
else {
[1686] Fix | Delete
// ----- Error log
[1687] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1688] Fix | Delete
[1689] Fix | Delete
// ----- Return
[1690] Fix | Delete
return PclZip::errorCode();
[1691] Fix | Delete
}
[1692] Fix | Delete
[1693] Fix | Delete
[1694] Fix | Delete
// ----- Look for list sort
[1695] Fix | Delete
if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
[1696] Fix | Delete
$v_sort_flag=true;
[1697] Fix | Delete
[1698] Fix | Delete
// ----- TBC : An automatic sort should be writen ...
[1699] Fix | Delete
// ----- Error log
[1700] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1701] Fix | Delete
[1702] Fix | Delete
// ----- Return
[1703] Fix | Delete
return PclZip::errorCode();
[1704] Fix | Delete
}
[1705] Fix | Delete
$v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
[1706] Fix | Delete
}
[1707] Fix | Delete
[1708] Fix | Delete
// ----- Sort the items
[1709] Fix | Delete
if ($v_sort_flag) {
[1710] Fix | Delete
// TBC : To Be Completed
[1711] Fix | Delete
}
[1712] Fix | Delete
[1713] Fix | Delete
// ----- Next option
[1714] Fix | Delete
$i++;
[1715] Fix | Delete
break;
[1716] Fix | Delete
[1717] Fix | Delete
// ----- Look for options that request no value
[1718] Fix | Delete
case PCLZIP_OPT_RECopy_ALL_PATH :
[1719] Fix | Delete
case PCLZIP_OPT_EXTRACT_AS_STRING :
[1720] Fix | Delete
case PCLZIP_OPT_NO_COMPRESSION :
[1721] Fix | Delete
case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
[1722] Fix | Delete
case PCLZIP_OPT_REPLACE_NEWER :
[1723] Fix | Delete
case PCLZIP_OPT_STOP_ON_ERROR :
[1724] Fix | Delete
$v_result_list[$p_options_list[$i]] = true;
[1725] Fix | Delete
break;
[1726] Fix | Delete
[1727] Fix | Delete
// ----- Look for options that request an octal value
[1728] Fix | Delete
case PCLZIP_OPT_SET_CHMOD :
[1729] Fix | Delete
// ----- Check the number of parameters
[1730] Fix | Delete
if (($i+1) >= $p_size) {
[1731] Fix | Delete
// ----- Error log
[1732] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1733] Fix | Delete
[1734] Fix | Delete
// ----- Return
[1735] Fix | Delete
return PclZip::errorCode();
[1736] Fix | Delete
}
[1737] Fix | Delete
[1738] Fix | Delete
// ----- Get the value
[1739] Fix | Delete
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
[1740] Fix | Delete
$i++;
[1741] Fix | Delete
break;
[1742] Fix | Delete
[1743] Fix | Delete
// ----- Look for options that request a call-back
[1744] Fix | Delete
case PCLZIP_CB_PRE_EXTRACT :
[1745] Fix | Delete
case PCLZIP_CB_POST_EXTRACT :
[1746] Fix | Delete
case PCLZIP_CB_PRE_ADD :
[1747] Fix | Delete
case PCLZIP_CB_POST_ADD :
[1748] Fix | Delete
/* for futur use
[1749] Fix | Delete
case PCLZIP_CB_PRE_DELETE :
[1750] Fix | Delete
case PCLZIP_CB_POST_DELETE :
[1751] Fix | Delete
case PCLZIP_CB_PRE_LIST :
[1752] Fix | Delete
case PCLZIP_CB_POST_LIST :
[1753] Fix | Delete
*/
[1754] Fix | Delete
// ----- Check the number of parameters
[1755] Fix | Delete
if (($i+1) >= $p_size) {
[1756] Fix | Delete
// ----- Error log
[1757] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1758] Fix | Delete
[1759] Fix | Delete
// ----- Return
[1760] Fix | Delete
return PclZip::errorCode();
[1761] Fix | Delete
}
[1762] Fix | Delete
[1763] Fix | Delete
// ----- Get the value
[1764] Fix | Delete
$v_function_name = $p_options_list[$i+1];
[1765] Fix | Delete
[1766] Fix | Delete
// ----- Check that the value is a valid existing function
[1767] Fix | Delete
if (!function_exists($v_function_name)) {
[1768] Fix | Delete
// ----- Error log
[1769] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
[1770] Fix | Delete
[1771] Fix | Delete
// ----- Return
[1772] Fix | Delete
return PclZip::errorCode();
[1773] Fix | Delete
}
[1774] Fix | Delete
[1775] Fix | Delete
// ----- Set the attribute
[1776] Fix | Delete
$v_result_list[$p_options_list[$i]] = $v_function_name;
[1777] Fix | Delete
$i++;
[1778] Fix | Delete
break;
[1779] Fix | Delete
[1780] Fix | Delete
default :
[1781] Fix | Delete
// ----- Error log
[1782] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
[1783] Fix | Delete
"Unknown parameter '"
[1784] Fix | Delete
.$p_options_list[$i]."'");
[1785] Fix | Delete
[1786] Fix | Delete
// ----- Return
[1787] Fix | Delete
return PclZip::errorCode();
[1788] Fix | Delete
}
[1789] Fix | Delete
[1790] Fix | Delete
// ----- Next options
[1791] Fix | Delete
$i++;
[1792] Fix | Delete
}
[1793] Fix | Delete
[1794] Fix | Delete
// ----- Look for mandatory options
[1795] Fix | Delete
if ($v_requested_options !== false) {
[1796] Fix | Delete
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
[1797] Fix | Delete
// ----- Look for mandatory option
[1798] Fix | Delete
if ($v_requested_options[$key] == 'mandatory') {
[1799] Fix | Delete
// ----- Look if present
[1800] Fix | Delete
if (!isset($v_result_list[$key])) {
[1801] Fix | Delete
// ----- Error log
[1802] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
[1803] Fix | Delete
[1804] Fix | Delete
// ----- Return
[1805] Fix | Delete
return PclZip::errorCode();
[1806] Fix | Delete
}
[1807] Fix | Delete
}
[1808] Fix | Delete
}
[1809] Fix | Delete
}
[1810] Fix | Delete
[1811] Fix | Delete
// ----- Look for default values
[1812] Fix | Delete
if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
[1813] Fix | Delete
[1814] Fix | Delete
}
[1815] Fix | Delete
[1816] Fix | Delete
// ----- Return
[1817] Fix | Delete
return $v_result;
[1818] Fix | Delete
}
[1819] Fix | Delete
// --------------------------------------------------------------------------------
[1820] Fix | Delete
[1821] Fix | Delete
// --------------------------------------------------------------------------------
[1822] Fix | Delete
// Function : privOptionDefaultThreshold()
[1823] Fix | Delete
// Description :
[1824] Fix | Delete
// Parameters :
[1825] Fix | Delete
// Return Values :
[1826] Fix | Delete
// --------------------------------------------------------------------------------
[1827] Fix | Delete
function privOptionDefaultThreshold(&$p_options)
[1828] Fix | Delete
{
[1829] Fix | Delete
$v_result=1;
[1830] Fix | Delete
[1831] Fix | Delete
if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
[1832] Fix | Delete
|| isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
[1833] Fix | Delete
return $v_result;
[1834] Fix | Delete
}
[1835] Fix | Delete
[1836] Fix | Delete
// ----- Get 'memory_limit' configuration value
[1837] Fix | Delete
$v_memory_limit = ini_get('memory_limit');
[1838] Fix | Delete
$v_memory_limit = (float)trim($v_memory_limit);
[1839] Fix | Delete
$last = strtolower(substr($v_memory_limit, -1));
[1840] Fix | Delete
[1841] Fix | Delete
if($last == 'g')
[1842] Fix | Delete
//$v_memory_limit = $v_memory_limit*1024*1024*1024;
[1843] Fix | Delete
$v_memory_limit = $v_memory_limit*1073741824;
[1844] Fix | Delete
if($last == 'm')
[1845] Fix | Delete
//$v_memory_limit = $v_memory_limit*1024*1024;
[1846] Fix | Delete
$v_memory_limit = $v_memory_limit*1048576;
[1847] Fix | Delete
if($last == 'k')
[1848] Fix | Delete
$v_memory_limit = $v_memory_limit*1024;
[1849] Fix | Delete
[1850] Fix | Delete
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
[1851] Fix | Delete
[1852] Fix | Delete
[1853] Fix | Delete
// ----- Sanity check : No threshold if value lower than 1M
[1854] Fix | Delete
if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) {
[1855] Fix | Delete
unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
[1856] Fix | Delete
}
[1857] Fix | Delete
[1858] Fix | Delete
// ----- Return
[1859] Fix | Delete
return $v_result;
[1860] Fix | Delete
}
[1861] Fix | Delete
// --------------------------------------------------------------------------------
[1862] Fix | Delete
[1863] Fix | Delete
// --------------------------------------------------------------------------------
[1864] Fix | Delete
// Function : privFileDescrParseAtt()
[1865] Fix | Delete
// Description :
[1866] Fix | Delete
// Parameters :
[1867] Fix | Delete
// Return Values :
[1868] Fix | Delete
// 1 on success.
[1869] Fix | Delete
// 0 on failure.
[1870] Fix | Delete
// --------------------------------------------------------------------------------
[1871] Fix | Delete
function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
[1872] Fix | Delete
{
[1873] Fix | Delete
$v_result=1;
[1874] Fix | Delete
[1875] Fix | Delete
// ----- For each file in the list check the attributes
[1876] Fix | Delete
foreach ($p_file_list as $v_key => $v_value) {
[1877] Fix | Delete
[1878] Fix | Delete
// ----- Check if the option is supported
[1879] Fix | Delete
if (!isset($v_requested_options[$v_key])) {
[1880] Fix | Delete
// ----- Error log
[1881] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
[1882] Fix | Delete
[1883] Fix | Delete
// ----- Return
[1884] Fix | Delete
return PclZip::errorCode();
[1885] Fix | Delete
}
[1886] Fix | Delete
[1887] Fix | Delete
// ----- Look for attribute
[1888] Fix | Delete
switch ($v_key) {
[1889] Fix | Delete
case PCLZIP_ATT_FILE_NAME :
[1890] Fix | Delete
if (!is_string($v_value)) {
[1891] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
[1892] Fix | Delete
return PclZip::errorCode();
[1893] Fix | Delete
}
[1894] Fix | Delete
[1895] Fix | Delete
$p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
[1896] Fix | Delete
[1897] Fix | Delete
if ($p_filedescr['filename'] == '') {
[1898] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
[1899] Fix | Delete
return PclZip::errorCode();
[1900] Fix | Delete
}
[1901] Fix | Delete
[1902] Fix | Delete
break;
[1903] Fix | Delete
[1904] Fix | Delete
case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
[1905] Fix | Delete
if (!is_string($v_value)) {
[1906] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
[1907] Fix | Delete
return PclZip::errorCode();
[1908] Fix | Delete
}
[1909] Fix | Delete
[1910] Fix | Delete
$p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
[1911] Fix | Delete
[1912] Fix | Delete
if ($p_filedescr['new_short_name'] == '') {
[1913] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
[1914] Fix | Delete
return PclZip::errorCode();
[1915] Fix | Delete
}
[1916] Fix | Delete
break;
[1917] Fix | Delete
[1918] Fix | Delete
case PCLZIP_ATT_FILE_NEW_FULL_NAME :
[1919] Fix | Delete
if (!is_string($v_value)) {
[1920] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
[1921] Fix | Delete
return PclZip::errorCode();
[1922] Fix | Delete
}
[1923] Fix | Delete
[1924] Fix | Delete
$p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
[1925] Fix | Delete
[1926] Fix | Delete
if ($p_filedescr['new_full_name'] == '') {
[1927] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
[1928] Fix | Delete
return PclZip::errorCode();
[1929] Fix | Delete
}
[1930] Fix | Delete
break;
[1931] Fix | Delete
[1932] Fix | Delete
// ----- Look for options that takes a string
[1933] Fix | Delete
case PCLZIP_ATT_FILE_COMMENT :
[1934] Fix | Delete
if (!is_string($v_value)) {
[1935] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
[1936] Fix | Delete
return PclZip::errorCode();
[1937] Fix | Delete
}
[1938] Fix | Delete
[1939] Fix | Delete
$p_filedescr['comment'] = $v_value;
[1940] Fix | Delete
break;
[1941] Fix | Delete
[1942] Fix | Delete
case PCLZIP_ATT_FILE_MTIME :
[1943] Fix | Delete
if (!is_integer($v_value)) {
[1944] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". Integer expected for attribute '".PclZipUtilOptionText($v_key)."'");
[1945] Fix | Delete
return PclZip::errorCode();
[1946] Fix | Delete
}
[1947] Fix | Delete
[1948] Fix | Delete
$p_filedescr['mtime'] = $v_value;
[1949] Fix | Delete
break;
[1950] Fix | Delete
[1951] Fix | Delete
case PCLZIP_ATT_FILE_CONTENT :
[1952] Fix | Delete
$p_filedescr['content'] = $v_value;
[1953] Fix | Delete
break;
[1954] Fix | Delete
[1955] Fix | Delete
default :
[1956] Fix | Delete
// ----- Error log
[1957] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
[1958] Fix | Delete
"Unknown parameter '".$v_key."'");
[1959] Fix | Delete
[1960] Fix | Delete
// ----- Return
[1961] Fix | Delete
return PclZip::errorCode();
[1962] Fix | Delete
}
[1963] Fix | Delete
[1964] Fix | Delete
// ----- Look for mandatory options
[1965] Fix | Delete
if ($v_requested_options !== false) {
[1966] Fix | Delete
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
[1967] Fix | Delete
// ----- Look for mandatory option
[1968] Fix | Delete
if ($v_requested_options[$key] == 'mandatory') {
[1969] Fix | Delete
// ----- Look if present
[1970] Fix | Delete
if (!isset($p_file_list[$key])) {
[1971] Fix | Delete
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
[1972] Fix | Delete
return PclZip::errorCode();
[1973] Fix | Delete
}
[1974] Fix | Delete
}
[1975] Fix | Delete
}
[1976] Fix | Delete
}
[1977] Fix | Delete
[1978] Fix | Delete
// end foreach
[1979] Fix | Delete
}
[1980] Fix | Delete
[1981] Fix | Delete
// ----- Return
[1982] Fix | Delete
return $v_result;
[1983] Fix | Delete
}
[1984] Fix | Delete
// --------------------------------------------------------------------------------
[1985] Fix | Delete
[1986] Fix | Delete
// --------------------------------------------------------------------------------
[1987] Fix | Delete
// Function : privFileDescrExpand()
[1988] Fix | Delete
// Description :
[1989] Fix | Delete
// This method look for each item of the list to see if its a file, a folder
[1990] Fix | Delete
// or a string to be added as file. For any other type of files (link, other)
[1991] Fix | Delete
// just ignore the item.
[1992] Fix | Delete
// Then prepare the information that will be stored for that file.
[1993] Fix | Delete
// When its a folder, expand the folder with all the files that are in that
[1994] Fix | Delete
// folder (recursively).
[1995] Fix | Delete
// Parameters :
[1996] Fix | Delete
// Return Values :
[1997] Fix | Delete
// 1 on success.
[1998] Fix | Delete
// 0 on failure.
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function