mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Remove trailing whitespace
git-svn-id: http://svn.automattic.com/wordpress/trunk@11930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
aa1e377ede
commit
8e3808bce2
@ -46,7 +46,7 @@ case 'editcomment' :
|
|||||||
|
|
||||||
if ( 'trash' == $comment->comment_approved )
|
if ( 'trash' == $comment->comment_approved )
|
||||||
comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') );
|
comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') );
|
||||||
|
|
||||||
$comment = get_comment_to_edit( $comment_id );
|
$comment = get_comment_to_edit( $comment_id );
|
||||||
|
|
||||||
include('edit-form-comment.php');
|
include('edit-form-comment.php');
|
||||||
@ -170,12 +170,12 @@ case 'trashcomment' :
|
|||||||
case 'untrashcomment' :
|
case 'untrashcomment' :
|
||||||
$comment_id = absint( $_REQUEST['c'] );
|
$comment_id = absint( $_REQUEST['c'] );
|
||||||
$noredir = isset($_REQUEST['noredir']);
|
$noredir = isset($_REQUEST['noredir']);
|
||||||
|
|
||||||
if (!$comment = get_comment($comment_id))
|
if (!$comment = get_comment($comment_id))
|
||||||
comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php') );
|
comment_footer_die( __('Oops, no comment with this ID.') . sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php') );
|
||||||
if (!current_user_can('edit_post', $comment->comment_post_ID ))
|
if (!current_user_can('edit_post', $comment->comment_post_ID ))
|
||||||
comment_footer_die( __('You are not allowed to edit comments on this post.') );
|
comment_footer_die( __('You are not allowed to edit comments on this post.') );
|
||||||
|
|
||||||
if ($action == 'trashcomment') {
|
if ($action == 'trashcomment') {
|
||||||
check_admin_referer( 'trash-comment_' . $comment_id );
|
check_admin_referer( 'trash-comment_' . $comment_id );
|
||||||
wp_trash_comment($comment_id);
|
wp_trash_comment($comment_id);
|
||||||
@ -184,7 +184,7 @@ case 'untrashcomment' :
|
|||||||
check_admin_referer( 'untrash-comment_' . $comment_id );
|
check_admin_referer( 'untrash-comment_' . $comment_id );
|
||||||
wp_untrash_comment($comment_id);
|
wp_untrash_comment($comment_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ))
|
if ('' != wp_get_referer() && false == $noredir && false === strpos(wp_get_referer(), 'comment.php' ))
|
||||||
wp_redirect( wp_get_referer() );
|
wp_redirect( wp_get_referer() );
|
||||||
else if ('' != wp_get_original_referer() && false == $noredir)
|
else if ('' != wp_get_original_referer() && false == $noredir)
|
||||||
|
@ -19,7 +19,7 @@ $post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
|
|||||||
|
|
||||||
if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2']) ) {
|
if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2']) ) {
|
||||||
check_admin_referer('bulk-comments');
|
check_admin_referer('bulk-comments');
|
||||||
|
|
||||||
if ((isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {
|
if ((isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) && !empty($_REQUEST['pagegen_timestamp'])) {
|
||||||
$comment_status = $wpdb->escape($_REQUEST['comment_status']);
|
$comment_status = $wpdb->escape($_REQUEST['comment_status']);
|
||||||
$delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']);
|
$delete_time = $wpdb->escape($_REQUEST['pagegen_timestamp']);
|
||||||
@ -29,9 +29,9 @@ if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_R
|
|||||||
$comment_ids = $_REQUEST['delete_comments'];
|
$comment_ids = $_REQUEST['delete_comments'];
|
||||||
$doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
|
$doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2'];
|
||||||
} else wp_redirect($_SERVER['HTTP_REFERER']);
|
} else wp_redirect($_SERVER['HTTP_REFERER']);
|
||||||
|
|
||||||
$approved = $unapproved = $spammed = $trashed = $untrashed = $deleted = 0;
|
$approved = $unapproved = $spammed = $trashed = $untrashed = $deleted = 0;
|
||||||
|
|
||||||
foreach ($comment_ids as $comment_id) { // Check the permissions on each
|
foreach ($comment_ids as $comment_id) { // Check the permissions on each
|
||||||
$_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
|
$_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
|
|||||||
|
|
||||||
if ( !wp_trash_post($post_id) )
|
if ( !wp_trash_post($post_id) )
|
||||||
wp_die( __('Error in moving to trash...') );
|
wp_die( __('Error in moving to trash...') );
|
||||||
|
|
||||||
$trashed++;
|
$trashed++;
|
||||||
}
|
}
|
||||||
$sendback = add_query_arg('trashed', $trashed, $sendback);
|
$sendback = add_query_arg('trashed', $trashed, $sendback);
|
||||||
@ -53,7 +53,7 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
|
|||||||
|
|
||||||
if ( !wp_untrash_post($post_id) )
|
if ( !wp_untrash_post($post_id) )
|
||||||
wp_die( __('Error in restoring from trash...') );
|
wp_die( __('Error in restoring from trash...') );
|
||||||
|
|
||||||
$untrashed++;
|
$untrashed++;
|
||||||
}
|
}
|
||||||
$sendback = add_query_arg('untrashed', $untrashed, $sendback);
|
$sendback = add_query_arg('untrashed', $untrashed, $sendback);
|
||||||
|
@ -48,7 +48,7 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
|
|||||||
|
|
||||||
if ( !wp_trash_post($post_id) )
|
if ( !wp_trash_post($post_id) )
|
||||||
wp_die( __('Error in moving to trash...') );
|
wp_die( __('Error in moving to trash...') );
|
||||||
|
|
||||||
$trashed++;
|
$trashed++;
|
||||||
}
|
}
|
||||||
$sendback = add_query_arg('trashed', $trashed, $sendback);
|
$sendback = add_query_arg('trashed', $trashed, $sendback);
|
||||||
@ -61,7 +61,7 @@ if ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delet
|
|||||||
|
|
||||||
if ( !wp_untrash_post($post_id) )
|
if ( !wp_untrash_post($post_id) )
|
||||||
wp_die( __('Error in restoring from trash...') );
|
wp_die( __('Error in restoring from trash...') );
|
||||||
|
|
||||||
$untrashed++;
|
$untrashed++;
|
||||||
}
|
}
|
||||||
$sendback = add_query_arg('untrashed', $untrashed, $sendback);
|
$sendback = add_query_arg('untrashed', $untrashed, $sendback);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
|
if (!defined('PCLZIP_READ_BLOCK_SIZE')) {
|
||||||
define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
|
define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- File list separator
|
// ----- File list separator
|
||||||
// In version 1.x of PclZip, the separator for file list is a space
|
// In version 1.x of PclZip, the separator for file list is a space
|
||||||
// (which is not a very smart choice, specifically for windows paths !).
|
// (which is not a very smart choice, specifically for windows paths !).
|
||||||
@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
// ----- Optional threshold ratio for use of temporary files
|
// ----- Optional threshold ratio for use of temporary files
|
||||||
// Pclzip sense the size of the file to add/extract and decide to
|
// Pclzip sense the size of the file to add/extract and decide to
|
||||||
// use or not temporary file. The algorythm is looking for
|
// use or not temporary file. The algorythm is looking for
|
||||||
// memory_limit of PHP and apply a ratio.
|
// memory_limit of PHP and apply a ratio.
|
||||||
// threshold = memory_limit * ratio.
|
// threshold = memory_limit * ratio.
|
||||||
// Recommended values are under 0.5. Default 0.47.
|
// Recommended values are under 0.5. Default 0.47.
|
||||||
@ -152,7 +152,7 @@
|
|||||||
define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
|
define( 'PCLZIP_OPT_ADD_TEMP_FILE_ON', 77021 ); // alias
|
||||||
define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
|
define( 'PCLZIP_OPT_TEMP_FILE_OFF', 77022 );
|
||||||
define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
|
define( 'PCLZIP_OPT_ADD_TEMP_FILE_OFF', 77022 ); // alias
|
||||||
|
|
||||||
// ----- File description attributes
|
// ----- File description attributes
|
||||||
define( 'PCLZIP_ATT_FILE_NAME', 79001 );
|
define( 'PCLZIP_ATT_FILE_NAME', 79001 );
|
||||||
define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
|
define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
|
||||||
@ -198,7 +198,7 @@
|
|||||||
// ----- Internal error handling
|
// ----- Internal error handling
|
||||||
var $error_code = 1;
|
var $error_code = 1;
|
||||||
var $error_string = '';
|
var $error_string = '';
|
||||||
|
|
||||||
// ----- Current status of the magic_quotes_runtime
|
// ----- Current status of the magic_quotes_runtime
|
||||||
// This value store the php configuration for magic_quotes
|
// This value store the php configuration for magic_quotes
|
||||||
// The class can then disable the magic_quotes and reset it after
|
// The class can then disable the magic_quotes and reset it after
|
||||||
@ -341,7 +341,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for default option values
|
// ----- Look for default option values
|
||||||
$this->privOptionDefaultThreshold($v_options);
|
$this->privOptionDefaultThreshold($v_options);
|
||||||
|
|
||||||
@ -350,16 +350,16 @@
|
|||||||
$v_att_list = array();
|
$v_att_list = array();
|
||||||
$v_filedescr_list = array();
|
$v_filedescr_list = array();
|
||||||
$p_result_list = array();
|
$p_result_list = array();
|
||||||
|
|
||||||
// ----- Look if the $p_filelist is really an array
|
// ----- Look if the $p_filelist is really an array
|
||||||
if (is_array($p_filelist)) {
|
if (is_array($p_filelist)) {
|
||||||
|
|
||||||
// ----- Look if the first element is also an array
|
// ----- Look if the first element is also an array
|
||||||
// This will mean that this is a file description entry
|
// This will mean that this is a file description entry
|
||||||
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
|
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
|
||||||
$v_att_list = $p_filelist;
|
$v_att_list = $p_filelist;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- The list is a list of string names
|
// ----- The list is a list of string names
|
||||||
else {
|
else {
|
||||||
$v_string_list = $p_filelist;
|
$v_string_list = $p_filelist;
|
||||||
@ -378,7 +378,7 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Reformat the string list
|
// ----- Reformat the string list
|
||||||
if (sizeof($v_string_list) != 0) {
|
if (sizeof($v_string_list) != 0) {
|
||||||
foreach ($v_string_list as $v_string) {
|
foreach ($v_string_list as $v_string) {
|
||||||
@ -390,7 +390,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- For each file in the list check the attributes
|
// ----- For each file in the list check the attributes
|
||||||
$v_supported_attributes
|
$v_supported_attributes
|
||||||
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
|
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
|
||||||
@ -549,16 +549,16 @@
|
|||||||
$v_att_list = array();
|
$v_att_list = array();
|
||||||
$v_filedescr_list = array();
|
$v_filedescr_list = array();
|
||||||
$p_result_list = array();
|
$p_result_list = array();
|
||||||
|
|
||||||
// ----- Look if the $p_filelist is really an array
|
// ----- Look if the $p_filelist is really an array
|
||||||
if (is_array($p_filelist)) {
|
if (is_array($p_filelist)) {
|
||||||
|
|
||||||
// ----- Look if the first element is also an array
|
// ----- Look if the first element is also an array
|
||||||
// This will mean that this is a file description entry
|
// This will mean that this is a file description entry
|
||||||
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
|
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
|
||||||
$v_att_list = $p_filelist;
|
$v_att_list = $p_filelist;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- The list is a list of string names
|
// ----- The list is a list of string names
|
||||||
else {
|
else {
|
||||||
$v_string_list = $p_filelist;
|
$v_string_list = $p_filelist;
|
||||||
@ -577,14 +577,14 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Reformat the string list
|
// ----- Reformat the string list
|
||||||
if (sizeof($v_string_list) != 0) {
|
if (sizeof($v_string_list) != 0) {
|
||||||
foreach ($v_string_list as $v_string) {
|
foreach ($v_string_list as $v_string) {
|
||||||
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
|
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- For each file in the list check the attributes
|
// ----- For each file in the list check the attributes
|
||||||
$v_supported_attributes
|
$v_supported_attributes
|
||||||
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
|
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
|
||||||
@ -1049,7 +1049,7 @@
|
|||||||
// Options :
|
// Options :
|
||||||
// PCLZIP_OPT_BY_INDEX :
|
// PCLZIP_OPT_BY_INDEX :
|
||||||
// PCLZIP_OPT_BY_NAME :
|
// PCLZIP_OPT_BY_NAME :
|
||||||
// PCLZIP_OPT_BY_EREG :
|
// PCLZIP_OPT_BY_EREG :
|
||||||
// PCLZIP_OPT_BY_PREG :
|
// PCLZIP_OPT_BY_PREG :
|
||||||
// Return Values :
|
// Return Values :
|
||||||
// 0 on failure,
|
// 0 on failure,
|
||||||
@ -1124,7 +1124,7 @@
|
|||||||
function deleteByIndex($p_index)
|
function deleteByIndex($p_index)
|
||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
|
||||||
|
|
||||||
$p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
|
$p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
@ -1178,7 +1178,7 @@
|
|||||||
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
|
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
|
||||||
{
|
{
|
||||||
$this->privSwapBackMagicQuotes();
|
$this->privSwapBackMagicQuotes();
|
||||||
|
|
||||||
// ----- Error log
|
// ----- Error log
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
||||||
|
|
||||||
@ -1507,7 +1507,7 @@
|
|||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
|
||||||
$v_result=1;
|
$v_result=1;
|
||||||
|
|
||||||
// ----- Read the options
|
// ----- Read the options
|
||||||
$i=0;
|
$i=0;
|
||||||
while ($i<$p_size) {
|
while ($i<$p_size) {
|
||||||
@ -1552,14 +1552,14 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Check for incompatible options
|
// ----- Check for incompatible options
|
||||||
if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) {
|
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'");
|
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '".PclZipUtilOptionText($p_options_list[$i])."' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'");
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Check the value
|
// ----- Check the value
|
||||||
$v_value = $p_options_list[$i+1];
|
$v_value = $p_options_list[$i+1];
|
||||||
if ((!is_integer($v_value)) || ($v_value<0)) {
|
if ((!is_integer($v_value)) || ($v_value<0)) {
|
||||||
@ -1581,7 +1581,7 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
$v_result_list[$p_options_list[$i]] = true;
|
$v_result_list[$p_options_list[$i]] = true;
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
||||||
break;
|
break;
|
||||||
@ -1599,7 +1599,7 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
$v_result_list[$p_options_list[$i]] = true;
|
$v_result_list[$p_options_list[$i]] = true;
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
||||||
break;
|
break;
|
||||||
@ -1763,7 +1763,7 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Reduce the index list
|
// ----- Reduce the index list
|
||||||
// each index item in the list must be a couple with a start and
|
// each index item in the list must be a couple with a start and
|
||||||
// an end value : [0,3], [5-5], [8-10], ...
|
// an end value : [0,3], [5-5], [8-10], ...
|
||||||
@ -1774,10 +1774,10 @@
|
|||||||
// ----- Explode the item
|
// ----- Explode the item
|
||||||
$v_item_list = explode("-", $v_work_list[$j]);
|
$v_item_list = explode("-", $v_work_list[$j]);
|
||||||
$v_size_item_list = sizeof($v_item_list);
|
$v_size_item_list = sizeof($v_item_list);
|
||||||
|
|
||||||
// ----- TBC : Here we might check that each item is a
|
// ----- TBC : Here we might check that each item is a
|
||||||
// real integer ...
|
// real integer ...
|
||||||
|
|
||||||
// ----- Look for single value
|
// ----- Look for single value
|
||||||
if ($v_size_item_list == 1) {
|
if ($v_size_item_list == 1) {
|
||||||
// ----- Set the option value
|
// ----- Set the option value
|
||||||
@ -1815,7 +1815,7 @@
|
|||||||
}
|
}
|
||||||
$v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
|
$v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Sort the items
|
// ----- Sort the items
|
||||||
if ($v_sort_flag) {
|
if ($v_sort_flag) {
|
||||||
// TBC : To Be Completed
|
// TBC : To Be Completed
|
||||||
@ -1928,11 +1928,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for default values
|
// ----- Look for default values
|
||||||
if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
|
if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Calculate auto threshold");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Calculate auto threshold");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
@ -1951,19 +1951,19 @@
|
|||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOptionDefaultThreshold", "");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOptionDefaultThreshold", "");
|
||||||
$v_result=1;
|
$v_result=1;
|
||||||
|
|
||||||
if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|
if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|
||||||
|| isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
|
|| isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Create an auto-threshold for use of temporay files");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Create an auto-threshold for use of temporay files");
|
||||||
// ----- Get 'memory_limit' configuration value
|
// ----- Get 'memory_limit' configuration value
|
||||||
$v_memory_limit = ini_get('memory_limit');
|
$v_memory_limit = ini_get('memory_limit');
|
||||||
$v_memory_limit = trim($v_memory_limit);
|
$v_memory_limit = trim($v_memory_limit);
|
||||||
$last = strtolower(substr($v_memory_limit, -1));
|
$last = strtolower(substr($v_memory_limit, -1));
|
||||||
|
|
||||||
if($last == 'g')
|
if($last == 'g')
|
||||||
//$v_memory_limit = $v_memory_limit*1024*1024*1024;
|
//$v_memory_limit = $v_memory_limit*1024*1024*1024;
|
||||||
$v_memory_limit = $v_memory_limit*1073741824;
|
$v_memory_limit = $v_memory_limit*1073741824;
|
||||||
@ -1972,9 +1972,9 @@
|
|||||||
$v_memory_limit = $v_memory_limit*1048576;
|
$v_memory_limit = $v_memory_limit*1048576;
|
||||||
if($last == 'k')
|
if($last == 'k')
|
||||||
$v_memory_limit = $v_memory_limit*1024;
|
$v_memory_limit = $v_memory_limit*1024;
|
||||||
|
|
||||||
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
|
$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit*PCLZIP_TEMPORARY_FILE_RATIO);
|
||||||
|
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Threshold value is : ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]." bytes");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Threshold value is : ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]." bytes");
|
||||||
|
|
||||||
@ -1983,7 +1983,7 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Unset the threshold (value ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD].") because under 1Mo sanity check)");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3,"Unset the threshold (value ".$p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD].") because under 1Mo sanity check)");
|
||||||
unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
|
unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
return $v_result;
|
return $v_result;
|
||||||
@ -2002,10 +2002,10 @@
|
|||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
|
||||||
$v_result=1;
|
$v_result=1;
|
||||||
|
|
||||||
// ----- For each file in the list check the attributes
|
// ----- For each file in the list check the attributes
|
||||||
foreach ($p_file_list as $v_key => $v_value) {
|
foreach ($p_file_list as $v_key => $v_value) {
|
||||||
|
|
||||||
// ----- Check if the option is supported
|
// ----- Check if the option is supported
|
||||||
if (!isset($v_requested_options[$v_key])) {
|
if (!isset($v_requested_options[$v_key])) {
|
||||||
// ----- Error log
|
// ----- Error log
|
||||||
@ -2027,7 +2027,7 @@
|
|||||||
|
|
||||||
$p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
|
$p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
||||||
|
|
||||||
if ($p_filedescr['filename'] == '') {
|
if ($p_filedescr['filename'] == '') {
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
||||||
@ -2123,10 +2123,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// end foreach
|
// end foreach
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
return $v_result;
|
return $v_result;
|
||||||
@ -2140,7 +2140,7 @@
|
|||||||
// or a string to be added as file. For any other type of files (link, other)
|
// or a string to be added as file. For any other type of files (link, other)
|
||||||
// just ignore the item.
|
// just ignore the item.
|
||||||
// Then prepare the information that will be stored for that file.
|
// Then prepare the information that will be stored for that file.
|
||||||
// When its a folder, expand the folder with all the files that are in that
|
// When its a folder, expand the folder with all the files that are in that
|
||||||
// folder (recursively).
|
// folder (recursively).
|
||||||
// Parameters :
|
// Parameters :
|
||||||
// Return Values :
|
// Return Values :
|
||||||
@ -2151,23 +2151,23 @@
|
|||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
|
||||||
$v_result=1;
|
$v_result=1;
|
||||||
|
|
||||||
// ----- Create a result list
|
// ----- Create a result list
|
||||||
$v_result_list = array();
|
$v_result_list = array();
|
||||||
|
|
||||||
// ----- Look each entry
|
// ----- Look each entry
|
||||||
for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
|
for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for file ".$i.".");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for file ".$i.".");
|
||||||
|
|
||||||
// ----- Get filedescr
|
// ----- Get filedescr
|
||||||
$v_descr = $p_filedescr_list[$i];
|
$v_descr = $p_filedescr_list[$i];
|
||||||
|
|
||||||
// ----- Reduce the filename
|
// ----- Reduce the filename
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
|
||||||
$v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
|
$v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false);
|
||||||
$v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
|
$v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
|
||||||
|
|
||||||
// ----- Look for real file or folder
|
// ----- Look for real file or folder
|
||||||
if (file_exists($v_descr['filename'])) {
|
if (file_exists($v_descr['filename'])) {
|
||||||
if (@is_file($v_descr['filename'])) {
|
if (@is_file($v_descr['filename'])) {
|
||||||
@ -2189,13 +2189,13 @@
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for string added as file
|
// ----- Look for string added as file
|
||||||
else if (isset($v_descr['content'])) {
|
else if (isset($v_descr['content'])) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a string added as a file");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a string added as a file");
|
||||||
$v_descr['type'] = 'virtual_file';
|
$v_descr['type'] = 'virtual_file';
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Missing file
|
// ----- Missing file
|
||||||
else {
|
else {
|
||||||
// ----- Error log
|
// ----- Error log
|
||||||
@ -2206,13 +2206,13 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Calculate the stored filename
|
// ----- Calculate the stored filename
|
||||||
$this->privCalculateStoredFilename($v_descr, $p_options);
|
$this->privCalculateStoredFilename($v_descr, $p_options);
|
||||||
|
|
||||||
// ----- Add the descriptor in result list
|
// ----- Add the descriptor in result list
|
||||||
$v_result_list[sizeof($v_result_list)] = $v_descr;
|
$v_result_list[sizeof($v_result_list)] = $v_descr;
|
||||||
|
|
||||||
// ----- Look for folder
|
// ----- Look for folder
|
||||||
if ($v_descr['type'] == 'folder') {
|
if ($v_descr['type'] == 'folder') {
|
||||||
// ----- List of items in folder
|
// ----- List of items in folder
|
||||||
@ -2226,10 +2226,10 @@
|
|||||||
if (($v_item_handler == '.') || ($v_item_handler == '..')) {
|
if (($v_item_handler == '.') || ($v_item_handler == '..')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Compose the full filename
|
// ----- Compose the full filename
|
||||||
$v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
|
$v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
|
||||||
|
|
||||||
// ----- Look for different stored filename
|
// ----- Look for different stored filename
|
||||||
// Because the name of the folder was changed, the name of the
|
// Because the name of the folder was changed, the name of the
|
||||||
// files/sub-folders also change
|
// files/sub-folders also change
|
||||||
@ -2241,17 +2241,17 @@
|
|||||||
$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
|
$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$v_dirlist_nb++;
|
$v_dirlist_nb++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@closedir($v_folder_handler);
|
@closedir($v_folder_handler);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
|
||||||
// TBC : unable to open folder in read mode
|
// TBC : unable to open folder in read mode
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Expand each element of the list
|
// ----- Expand each element of the list
|
||||||
if ($v_dirlist_nb != 0) {
|
if ($v_dirlist_nb != 0) {
|
||||||
// ----- Expand
|
// ----- Expand
|
||||||
@ -2259,7 +2259,7 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Concat the resulting list
|
// ----- Concat the resulting list
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
|
||||||
$v_result_list = array_merge($v_result_list, $v_dirlist_descr);
|
$v_result_list = array_merge($v_result_list, $v_dirlist_descr);
|
||||||
@ -2268,12 +2268,12 @@
|
|||||||
else {
|
else {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Free local array
|
// ----- Free local array
|
||||||
unset($v_dirlist_descr);
|
unset($v_dirlist_descr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Get the result list
|
// ----- Get the result list
|
||||||
$p_filedescr_list = $v_result_list;
|
$p_filedescr_list = $v_result_list;
|
||||||
|
|
||||||
@ -2294,7 +2294,7 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
|
||||||
$v_result=1;
|
$v_result=1;
|
||||||
$v_list_detail = array();
|
$v_list_detail = array();
|
||||||
|
|
||||||
// ----- Magic quotes trick
|
// ----- Magic quotes trick
|
||||||
$this->privDisableMagicQuotes();
|
$this->privDisableMagicQuotes();
|
||||||
|
|
||||||
@ -2655,7 +2655,7 @@
|
|||||||
// Function : privAddFileList()
|
// Function : privAddFileList()
|
||||||
// Description :
|
// Description :
|
||||||
// Parameters :
|
// Parameters :
|
||||||
// $p_filedescr_list : An array containing the file description
|
// $p_filedescr_list : An array containing the file description
|
||||||
// or directory names to add in the zip
|
// or directory names to add in the zip
|
||||||
// $p_result_list : list of added files with their properties (specially the status field)
|
// $p_result_list : list of added files with their properties (specially the status field)
|
||||||
// Return Values :
|
// Return Values :
|
||||||
@ -2675,7 +2675,7 @@
|
|||||||
// ----- Format the filename
|
// ----- Format the filename
|
||||||
$p_filedescr_list[$j]['filename']
|
$p_filedescr_list[$j]['filename']
|
||||||
= PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
|
= PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
|
||||||
|
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
|
||||||
|
|
||||||
// ----- Skip empty file names
|
// ----- Skip empty file names
|
||||||
@ -2735,7 +2735,7 @@
|
|||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
|
||||||
$v_result=1;
|
$v_result=1;
|
||||||
|
|
||||||
// ----- Working variable
|
// ----- Working variable
|
||||||
$p_filename = $p_filedescr['filename'];
|
$p_filename = $p_filedescr['filename'];
|
||||||
|
|
||||||
@ -2748,8 +2748,8 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for a stored different filename
|
// ----- Look for a stored different filename
|
||||||
/* TBC : Removed
|
/* TBC : Removed
|
||||||
if (isset($p_filedescr['stored_filename'])) {
|
if (isset($p_filedescr['stored_filename'])) {
|
||||||
$v_stored_filename = $p_filedescr['stored_filename'];
|
$v_stored_filename = $p_filedescr['stored_filename'];
|
||||||
@ -2786,20 +2786,20 @@
|
|||||||
$p_header['external'] = 0x00000000;
|
$p_header['external'] = 0x00000000;
|
||||||
$p_header['size'] = filesize($p_filename);
|
$p_header['size'] = filesize($p_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for regular folder
|
// ----- Look for regular folder
|
||||||
else if ($p_filedescr['type']=='folder') {
|
else if ($p_filedescr['type']=='folder') {
|
||||||
$p_header['external'] = 0x00000010;
|
$p_header['external'] = 0x00000010;
|
||||||
$p_header['mtime'] = filemtime($p_filename);
|
$p_header['mtime'] = filemtime($p_filename);
|
||||||
$p_header['size'] = filesize($p_filename);
|
$p_header['size'] = filesize($p_filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for virtual file
|
// ----- Look for virtual file
|
||||||
else if ($p_filedescr['type'] == 'virtual_file') {
|
else if ($p_filedescr['type'] == 'virtual_file') {
|
||||||
$p_header['external'] = 0x00000000;
|
$p_header['external'] = 0x00000000;
|
||||||
$p_header['size'] = strlen($p_filedescr['content']);
|
$p_header['size'] = strlen($p_filedescr['content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
|
||||||
|
|
||||||
// ----- Look for filetime
|
// ----- Look for filetime
|
||||||
@ -2855,7 +2855,7 @@
|
|||||||
if ($p_header['stored_filename'] == "") {
|
if ($p_header['stored_filename'] == "") {
|
||||||
$p_header['status'] = "filtered";
|
$p_header['status'] = "filtered";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Check the path length
|
// ----- Check the path length
|
||||||
if (strlen($p_header['stored_filename']) > 0xFF) {
|
if (strlen($p_header['stored_filename']) > 0xFF) {
|
||||||
$p_header['status'] = 'filename_too_long';
|
$p_header['status'] = 'filename_too_long';
|
||||||
@ -2867,7 +2867,7 @@
|
|||||||
// ----- Look for a file
|
// ----- Look for a file
|
||||||
if ($p_filedescr['type'] == 'file') {
|
if ($p_filedescr['type'] == 'file') {
|
||||||
// ----- Look for using temporary file to zip
|
// ----- Look for using temporary file to zip
|
||||||
if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
|
if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
|
||||||
&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
|
&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
|
||||||
|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|
|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|
||||||
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
|
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])) ) ) {
|
||||||
@ -2876,12 +2876,12 @@
|
|||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Use "in memory" zip algo
|
// ----- Use "in memory" zip algo
|
||||||
else {
|
else {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"In memory compression.");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"In memory compression.");
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory usage : ".memory_get_usage(TRUE)." bytes");
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory peak : ".memory_get_peak_usage(TRUE)." bytes");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Current memory peak : ".memory_get_peak_usage(TRUE)." bytes");
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
|
||||||
|
|
||||||
// ----- Open the source file
|
// ----- Open the source file
|
||||||
@ -2893,15 +2893,15 @@
|
|||||||
|
|
||||||
// ----- Read the file content
|
// ----- Read the file content
|
||||||
$v_content = @fread($v_file, $p_header['size']);
|
$v_content = @fread($v_file, $p_header['size']);
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after reading file : ".memory_get_usage(TRUE)." bytes");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after reading file : ".memory_get_usage(TRUE)." bytes");
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after reading file : ".memory_get_peak_usage(TRUE)." bytes");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after reading file : ".memory_get_peak_usage(TRUE)." bytes");
|
||||||
|
|
||||||
// ----- Close the file
|
// ----- Close the file
|
||||||
@fclose($v_file);
|
@fclose($v_file);
|
||||||
|
|
||||||
// ----- Calculate the CRC
|
// ----- Calculate the CRC
|
||||||
$p_header['crc'] = @crc32($v_content);
|
$p_header['crc'] = @crc32($v_content);
|
||||||
|
|
||||||
// ----- Look for no compression
|
// ----- Look for no compression
|
||||||
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
|
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
|
||||||
@ -2909,20 +2909,20 @@
|
|||||||
$p_header['compressed_size'] = $p_header['size'];
|
$p_header['compressed_size'] = $p_header['size'];
|
||||||
$p_header['compression'] = 0;
|
$p_header['compression'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for normal compression
|
// ----- Look for normal compression
|
||||||
else {
|
else {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
|
||||||
// ----- Compress the content
|
// ----- Compress the content
|
||||||
$v_content = @gzdeflate($v_content);
|
$v_content = @gzdeflate($v_content);
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after gzdeflate : ".memory_get_usage(TRUE)." bytes");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory usage after gzdeflate : ".memory_get_usage(TRUE)." bytes");
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after gzdeflate : ".memory_get_peak_usage(TRUE)." bytes");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2,"Memory peak after gzdeflate : ".memory_get_peak_usage(TRUE)." bytes");
|
||||||
|
|
||||||
// ----- Set header parameters
|
// ----- Set header parameters
|
||||||
$p_header['compressed_size'] = strlen($v_content);
|
$p_header['compressed_size'] = strlen($v_content);
|
||||||
$p_header['compression'] = 8;
|
$p_header['compression'] = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Call the header generation
|
// ----- Call the header generation
|
||||||
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
||||||
@fclose($v_file);
|
@fclose($v_file);
|
||||||
@ -2939,13 +2939,13 @@
|
|||||||
|
|
||||||
// ----- Look for a virtual file (a file from string)
|
// ----- Look for a virtual file (a file from string)
|
||||||
else if ($p_filedescr['type'] == 'virtual_file') {
|
else if ($p_filedescr['type'] == 'virtual_file') {
|
||||||
|
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Add by string");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Add by string");
|
||||||
$v_content = $p_filedescr['content'];
|
$v_content = $p_filedescr['content'];
|
||||||
|
|
||||||
// ----- Calculate the CRC
|
// ----- Calculate the CRC
|
||||||
$p_header['crc'] = @crc32($v_content);
|
$p_header['crc'] = @crc32($v_content);
|
||||||
|
|
||||||
// ----- Look for no compression
|
// ----- Look for no compression
|
||||||
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
|
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
|
||||||
@ -2953,7 +2953,7 @@
|
|||||||
$p_header['compressed_size'] = $p_header['size'];
|
$p_header['compressed_size'] = $p_header['size'];
|
||||||
$p_header['compression'] = 0;
|
$p_header['compression'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for normal compression
|
// ----- Look for normal compression
|
||||||
else {
|
else {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
|
||||||
@ -2964,7 +2964,7 @@
|
|||||||
$p_header['compressed_size'] = strlen($v_content);
|
$p_header['compressed_size'] = strlen($v_content);
|
||||||
$p_header['compression'] = 8;
|
$p_header['compression'] = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Call the header generation
|
// ----- Call the header generation
|
||||||
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
||||||
@fclose($v_file);
|
@fclose($v_file);
|
||||||
@ -3035,7 +3035,7 @@
|
|||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileUsingTempFile", "filename='".$p_filedescr['filename']."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileUsingTempFile", "filename='".$p_filedescr['filename']."'");
|
||||||
$v_result=PCLZIP_ERR_NO_ERROR;
|
$v_result=PCLZIP_ERR_NO_ERROR;
|
||||||
|
|
||||||
// ----- Working variable
|
// ----- Working variable
|
||||||
$p_filename = $p_filedescr['filename'];
|
$p_filename = $p_filedescr['filename'];
|
||||||
|
|
||||||
@ -3153,7 +3153,7 @@
|
|||||||
|
|
||||||
// ----- Unlink the temporary file
|
// ----- Unlink the temporary file
|
||||||
@unlink($v_gzip_temp_name);
|
@unlink($v_gzip_temp_name);
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
return $v_result;
|
return $v_result;
|
||||||
@ -3172,7 +3172,7 @@
|
|||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
|
||||||
$v_result=1;
|
$v_result=1;
|
||||||
|
|
||||||
// ----- Working variables
|
// ----- Working variables
|
||||||
$p_filename = $p_filedescr['filename'];
|
$p_filename = $p_filedescr['filename'];
|
||||||
if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
|
if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
|
||||||
@ -3201,7 +3201,7 @@
|
|||||||
$v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']);
|
$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."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for path and/or short name change
|
// ----- Look for path and/or short name change
|
||||||
else {
|
else {
|
||||||
|
|
||||||
@ -3234,7 +3234,7 @@
|
|||||||
|
|
||||||
if ( (substr($p_filename, 0, 2) == "./")
|
if ( (substr($p_filename, 0, 2) == "./")
|
||||||
|| (substr($p_remove_dir, 0, 2) == "./")) {
|
|| (substr($p_remove_dir, 0, 2) == "./")) {
|
||||||
|
|
||||||
if ( (substr($p_filename, 0, 2) == "./")
|
if ( (substr($p_filename, 0, 2) == "./")
|
||||||
&& (substr($p_remove_dir, 0, 2) != "./")) {
|
&& (substr($p_remove_dir, 0, 2) != "./")) {
|
||||||
$p_remove_dir = "./".$p_remove_dir;
|
$p_remove_dir = "./".$p_remove_dir;
|
||||||
@ -3260,10 +3260,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Remove drive letter if any
|
// ----- Remove drive letter if any
|
||||||
$v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename);
|
$v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename);
|
||||||
|
|
||||||
// ----- Look for path to add
|
// ----- Look for path to add
|
||||||
if ($p_add_dir != "") {
|
if ($p_add_dir != "") {
|
||||||
if (substr($p_add_dir, -1) == "/")
|
if (substr($p_add_dir, -1) == "/")
|
||||||
@ -3278,7 +3278,7 @@
|
|||||||
$v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
|
$v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
|
||||||
$p_filedescr['stored_filename'] = $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']));
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
return $v_result;
|
return $v_result;
|
||||||
@ -3443,7 +3443,7 @@
|
|||||||
{
|
{
|
||||||
// ----- Magic quotes trick
|
// ----- Magic quotes trick
|
||||||
$this->privSwapBackMagicQuotes();
|
$this->privSwapBackMagicQuotes();
|
||||||
|
|
||||||
// ----- Error log
|
// ----- Error log
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
||||||
|
|
||||||
@ -3726,7 +3726,7 @@
|
|||||||
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
||||||
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
|
||||||
|
|
||||||
// ----- Look if the index is in the list
|
// ----- Look if the index is in the list
|
||||||
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
|
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look if index '$i' is in [".$p_options[PCLZIP_OPT_BY_INDEX][$j]['start'].",".$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']."]");
|
||||||
@ -3766,7 +3766,7 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
||||||
|
|
||||||
$this->privSwapBackMagicQuotes();
|
$this->privSwapBackMagicQuotes();
|
||||||
|
|
||||||
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
|
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
|
||||||
"Filename '".$v_header['stored_filename']."' is "
|
"Filename '".$v_header['stored_filename']."' is "
|
||||||
."compressed by an unsupported compression "
|
."compressed by an unsupported compression "
|
||||||
@ -3776,7 +3776,7 @@
|
|||||||
return PclZip::errorCode();
|
return PclZip::errorCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Check encrypted files
|
// ----- Check encrypted files
|
||||||
if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
|
if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
|
||||||
@ -3813,7 +3813,7 @@
|
|||||||
|
|
||||||
$v_extract = false;
|
$v_extract = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for real extraction
|
// ----- Look for real extraction
|
||||||
if ($v_extract)
|
if ($v_extract)
|
||||||
{
|
{
|
||||||
@ -3867,7 +3867,7 @@
|
|||||||
|
|
||||||
// ----- Next extracted file
|
// ----- Next extracted file
|
||||||
$v_nb_extracted++;
|
$v_nb_extracted++;
|
||||||
|
|
||||||
// ----- Look for user callback abort
|
// ----- Look for user callback abort
|
||||||
if ($v_result1 == 2) {
|
if ($v_result1 == 2) {
|
||||||
break;
|
break;
|
||||||
@ -4019,13 +4019,13 @@
|
|||||||
if ($p_path != '') {
|
if ($p_path != '') {
|
||||||
$p_entry['filename'] = $p_path."/".$p_entry['filename'];
|
$p_entry['filename'] = $p_path."/".$p_entry['filename'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Check a base_dir_restriction
|
// ----- Check a base_dir_restriction
|
||||||
if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
|
if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
|
||||||
$v_inclusion
|
$v_inclusion
|
||||||
= PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
|
= PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
|
||||||
$p_entry['filename']);
|
$p_entry['filename']);
|
||||||
if ($v_inclusion == 0) {
|
if ($v_inclusion == 0) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
|
||||||
|
|
||||||
@ -4055,7 +4055,7 @@
|
|||||||
$p_entry['status'] = "skipped";
|
$p_entry['status'] = "skipped";
|
||||||
$v_result = 1;
|
$v_result = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for abort result
|
// ----- Look for abort result
|
||||||
if ($v_result == 2) {
|
if ($v_result == 2) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
||||||
@ -4087,7 +4087,7 @@
|
|||||||
|
|
||||||
// ----- Change the file status
|
// ----- Change the file status
|
||||||
$p_entry['status'] = "already_a_directory";
|
$p_entry['status'] = "already_a_directory";
|
||||||
|
|
||||||
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
||||||
// For historical reason first PclZip implementation does not stop
|
// For historical reason first PclZip implementation does not stop
|
||||||
// when this kind of error occurs.
|
// when this kind of error occurs.
|
||||||
@ -4172,10 +4172,10 @@
|
|||||||
|
|
||||||
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
|
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
|
||||||
|
|
||||||
// ----- Change the file status
|
// ----- Change the file status
|
||||||
$p_entry['status'] = "path_creation_fail";
|
$p_entry['status'] = "path_creation_fail";
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
//return $v_result;
|
//return $v_result;
|
||||||
@ -4220,7 +4220,7 @@
|
|||||||
$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
||||||
@fwrite($v_dest_file, $v_binary_data, $v_read_size);
|
@fwrite($v_dest_file, $v_binary_data, $v_read_size);
|
||||||
*/
|
*/
|
||||||
@fwrite($v_dest_file, $v_buffer, $v_read_size);
|
@fwrite($v_dest_file, $v_buffer, $v_read_size);
|
||||||
$v_size -= $v_read_size;
|
$v_size -= $v_read_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4229,7 +4229,7 @@
|
|||||||
|
|
||||||
// ----- Change the file mtime
|
// ----- Change the file mtime
|
||||||
touch($p_entry['filename'], $p_entry['mtime']);
|
touch($p_entry['filename'], $p_entry['mtime']);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -4245,7 +4245,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// ----- Look for using temporary file to unzip
|
// ----- Look for using temporary file to unzip
|
||||||
if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
|
if ( (!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF]))
|
||||||
&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
|
&& (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON])
|
||||||
|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|
|| (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD])
|
||||||
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
|
&& ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])) ) ) {
|
||||||
@ -4254,47 +4254,47 @@
|
|||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for extract in memory
|
// ----- Look for extract in memory
|
||||||
else {
|
else {
|
||||||
|
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
|
||||||
|
|
||||||
// ----- Read the compressed file in a buffer (one shot)
|
// ----- Read the compressed file in a buffer (one shot)
|
||||||
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
||||||
|
|
||||||
// ----- Decompress the file
|
// ----- Decompress the file
|
||||||
$v_file_content = @gzinflate($v_buffer);
|
$v_file_content = @gzinflate($v_buffer);
|
||||||
unset($v_buffer);
|
unset($v_buffer);
|
||||||
if ($v_file_content === FALSE) {
|
if ($v_file_content === FALSE) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
|
||||||
|
|
||||||
// ----- Change the file status
|
// ----- Change the file status
|
||||||
// TBC
|
// TBC
|
||||||
$p_entry['status'] = "error";
|
$p_entry['status'] = "error";
|
||||||
|
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Opening destination file
|
// ----- Opening destination file
|
||||||
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
|
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
|
||||||
|
|
||||||
// ----- Change the file status
|
// ----- Change the file status
|
||||||
$p_entry['status'] = "write_error";
|
$p_entry['status'] = "write_error";
|
||||||
|
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Write the uncompressed data
|
// ----- Write the uncompressed data
|
||||||
@fwrite($v_dest_file, $v_file_content, $p_entry['size']);
|
@fwrite($v_dest_file, $v_file_content, $p_entry['size']);
|
||||||
unset($v_file_content);
|
unset($v_file_content);
|
||||||
|
|
||||||
// ----- Closing the destination file
|
// ----- Closing the destination file
|
||||||
@fclose($v_dest_file);
|
@fclose($v_dest_file);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Change the file mtime
|
// ----- Change the file mtime
|
||||||
@ -4317,7 +4317,7 @@
|
|||||||
if ($p_entry['status'] == "aborted") {
|
if ($p_entry['status'] == "aborted") {
|
||||||
$p_entry['status'] = "skipped";
|
$p_entry['status'] = "skipped";
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for post-extract callback
|
// ----- Look for post-extract callback
|
||||||
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
|
||||||
@ -4354,7 +4354,7 @@
|
|||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileUsingTempFile', "filename='".$p_entry['filename']."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileUsingTempFile', "filename='".$p_entry['filename']."'");
|
||||||
$v_result=1;
|
$v_result=1;
|
||||||
|
|
||||||
// ----- Creates a temporary file
|
// ----- Creates a temporary file
|
||||||
$v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
|
$v_gzip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.gz';
|
||||||
if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
|
if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) {
|
||||||
@ -4426,7 +4426,7 @@
|
|||||||
|
|
||||||
// ----- Delete the temporary file
|
// ----- Delete the temporary file
|
||||||
@unlink($v_gzip_temp_name);
|
@unlink($v_gzip_temp_name);
|
||||||
|
|
||||||
// ----- Return
|
// ----- Return
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
return $v_result;
|
return $v_result;
|
||||||
@ -4515,7 +4515,7 @@
|
|||||||
|
|
||||||
// ----- Read the compressed file in a buffer (one shot)
|
// ----- Read the compressed file in a buffer (one shot)
|
||||||
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
||||||
|
|
||||||
// ----- Decompress the file
|
// ----- Decompress the file
|
||||||
$v_file_content = gzinflate($v_buffer);
|
$v_file_content = gzinflate($v_buffer);
|
||||||
unset($v_buffer);
|
unset($v_buffer);
|
||||||
@ -4604,7 +4604,7 @@
|
|||||||
|
|
||||||
// ----- Reading the file
|
// ----- Reading the file
|
||||||
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
|
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
|
||||||
|
|
||||||
// ----- Decompress the file
|
// ----- Decompress the file
|
||||||
if (($p_string = @gzinflate($v_data)) === FALSE) {
|
if (($p_string = @gzinflate($v_data)) === FALSE) {
|
||||||
// TBC
|
// TBC
|
||||||
@ -4921,7 +4921,7 @@
|
|||||||
if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
|
if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for flag bit 3
|
// ----- Look for flag bit 3
|
||||||
if (($p_local_header['flag'] & 8) == 8) {
|
if (($p_local_header['flag'] & 8) == 8) {
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
|
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
|
||||||
@ -5026,9 +5026,9 @@
|
|||||||
|
|
||||||
// ----- Add the byte
|
// ----- Add the byte
|
||||||
// $v_bytes = ($v_bytes << 8) | Ord($v_byte);
|
// $v_bytes = ($v_bytes << 8) | Ord($v_byte);
|
||||||
// Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
|
// Note we mask the old value down such that once shifted we can never end up with more than a 32bit number
|
||||||
// Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
|
// Otherwise on systems where we have 64bit integers the check below for the magic number will fail.
|
||||||
$v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
|
$v_bytes = ( ($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte);
|
||||||
|
|
||||||
// ----- Compare the bytes
|
// ----- Compare the bytes
|
||||||
if ($v_bytes == 0x504b0506)
|
if ($v_bytes == 0x504b0506)
|
||||||
@ -5363,7 +5363,7 @@
|
|||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
return $v_result;
|
return $v_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Check that local file header is same as central file header
|
// ----- Check that local file header is same as central file header
|
||||||
if ($this->privCheckFileHeaders($v_local_header,
|
if ($this->privCheckFileHeaders($v_local_header,
|
||||||
$v_header_list[$i]) != 1) {
|
$v_header_list[$i]) != 1) {
|
||||||
@ -5456,11 +5456,11 @@
|
|||||||
// TBC : I should test the result ...
|
// TBC : I should test the result ...
|
||||||
//@rename($v_zip_temp_name, $this->zipname);
|
//@rename($v_zip_temp_name, $this->zipname);
|
||||||
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
||||||
|
|
||||||
// ----- Destroy the temporary archive
|
// ----- Destroy the temporary archive
|
||||||
unset($v_temp_zip);
|
unset($v_temp_zip);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Remove every files : reset the file
|
// ----- Remove every files : reset the file
|
||||||
else if ($v_central_dir['entries'] != 0) {
|
else if ($v_central_dir['entries'] != 0) {
|
||||||
$this->privCloseFd();
|
$this->privCloseFd();
|
||||||
@ -6008,7 +6008,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- Look for skip
|
// ----- Look for skip
|
||||||
if ($v_skip > 0) {
|
if ($v_skip > 0) {
|
||||||
while ($v_skip > 0) {
|
while ($v_skip > 0) {
|
||||||
@ -6043,7 +6043,7 @@
|
|||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
|
||||||
$v_result = 1;
|
$v_result = 1;
|
||||||
|
|
||||||
// ----- Look for path beginning by ./
|
// ----- Look for path beginning by ./
|
||||||
if ( ($p_dir == '.')
|
if ( ($p_dir == '.')
|
||||||
|| ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
|
|| ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
|
||||||
@ -6234,7 +6234,7 @@
|
|||||||
function PclZipUtilOptionText($p_option)
|
function PclZipUtilOptionText($p_option)
|
||||||
{
|
{
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
|
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
|
||||||
|
|
||||||
$v_list = get_defined_constants();
|
$v_list = get_defined_constants();
|
||||||
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
|
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
|
||||||
$v_prefix = substr($v_key, 0, 10);
|
$v_prefix = substr($v_key, 0, 10);
|
||||||
@ -6246,7 +6246,7 @@
|
|||||||
return $v_key;
|
return $v_key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$v_result = 'Unknown';
|
$v_result = 'Unknown';
|
||||||
|
|
||||||
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
||||||
|
@ -18,7 +18,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
var $errors = null;
|
var $errors = null;
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*
|
*
|
||||||
* @param $arg mixed ingored argument
|
* @param $arg mixed ingored argument
|
||||||
*/
|
*/
|
||||||
function WP_Filesystem_Direct($arg) {
|
function WP_Filesystem_Direct($arg) {
|
||||||
@ -27,7 +27,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* connect filesystem.
|
* connect filesystem.
|
||||||
*
|
*
|
||||||
* @return bool Returns true on success or false on failure (always true for WP_Filesystem_Direct).
|
* @return bool Returns true on success or false on failure (always true for WP_Filesystem_Direct).
|
||||||
*/
|
*/
|
||||||
function connect() {
|
function connect() {
|
||||||
@ -35,26 +35,26 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Reads entire file into a string
|
* Reads entire file into a string
|
||||||
*
|
*
|
||||||
* @param $file string Name of the file to read.
|
* @param $file string Name of the file to read.
|
||||||
* @return string|bool The function returns the read data or false on failure.
|
* @return string|bool The function returns the read data or false on failure.
|
||||||
*/
|
*/
|
||||||
function get_contents($file) {
|
function get_contents($file) {
|
||||||
return @file_get_contents($file);
|
return @file_get_contents($file);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Reads entire file into an array
|
* Reads entire file into an array
|
||||||
*
|
*
|
||||||
* @param $file string Path to the file.
|
* @param $file string Path to the file.
|
||||||
* @return array|bool the file contents in an array or false on failure.
|
* @return array|bool the file contents in an array or false on failure.
|
||||||
*/
|
*/
|
||||||
function get_contents_array($file) {
|
function get_contents_array($file) {
|
||||||
return @file($file);
|
return @file($file);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Write a string to a file
|
* Write a string to a file
|
||||||
*
|
*
|
||||||
* @param $file string Path to the file where to write the data.
|
* @param $file string Path to the file where to write the data.
|
||||||
* @param $contents string The data to write.
|
* @param $contents string The data to write.
|
||||||
* @param $mode int (optional) The file permissions as octal number, usually 0644.
|
* @param $mode int (optional) The file permissions as octal number, usually 0644.
|
||||||
* @param $type string (optional) Specifies additional type of access you require to the file.
|
* @param $type string (optional) Specifies additional type of access you require to the file.
|
||||||
@ -70,8 +70,8 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Gets the current working directory
|
* Gets the current working directory
|
||||||
*
|
*
|
||||||
* @return string|bool the current working directory on success, or false on failure.
|
* @return string|bool the current working directory on success, or false on failure.
|
||||||
*/
|
*/
|
||||||
function cwd() {
|
function cwd() {
|
||||||
return @getcwd();
|
return @getcwd();
|
||||||
@ -79,7 +79,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
/**
|
/**
|
||||||
* Change directory
|
* Change directory
|
||||||
*
|
*
|
||||||
* @param $dir string The new current directory.
|
* @param $dir string The new current directory.
|
||||||
* @return bool Returns true on success or false on failure.
|
* @return bool Returns true on success or false on failure.
|
||||||
*/
|
*/
|
||||||
function chdir($dir) {
|
function chdir($dir) {
|
||||||
@ -87,10 +87,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Changes file group
|
* Changes file group
|
||||||
*
|
*
|
||||||
* @param $file string Path to the file.
|
* @param $file string Path to the file.
|
||||||
* @param $group mixed A group name or number.
|
* @param $group mixed A group name or number.
|
||||||
* @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False.
|
* @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False.
|
||||||
* @return bool Returns true on success or false on failure.
|
* @return bool Returns true on success or false on failure.
|
||||||
*/
|
*/
|
||||||
function chgrp($file, $group, $recursive = false) {
|
function chgrp($file, $group, $recursive = false) {
|
||||||
@ -110,10 +110,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Changes filesystem permissions
|
* Changes filesystem permissions
|
||||||
*
|
*
|
||||||
* @param $file string Path to the file.
|
* @param $file string Path to the file.
|
||||||
* @param $mode int (optional) The permissions as octal number, usually 0644 for files, 0755 for dirs.
|
* @param $mode int (optional) The permissions as octal number, usually 0644 for files, 0755 for dirs.
|
||||||
* @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False.
|
* @param $recursive bool (optional) If set True changes file group recursivly. Defaults to False.
|
||||||
* @return bool Returns true on success or false on failure.
|
* @return bool Returns true on success or false on failure.
|
||||||
*/
|
*/
|
||||||
function chmod($file, $mode = false, $recursive = false) {
|
function chmod($file, $mode = false, $recursive = false) {
|
||||||
@ -126,7 +126,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
elseif ( $this->is_dir($file) )
|
elseif ( $this->is_dir($file) )
|
||||||
$mode = FS_CHMOD_DIR;
|
$mode = FS_CHMOD_DIR;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $recursive )
|
if ( ! $recursive )
|
||||||
@ -143,10 +143,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Changes file owner
|
* Changes file owner
|
||||||
*
|
*
|
||||||
* @param $file string Path to the file.
|
* @param $file string Path to the file.
|
||||||
* @param $owner mixed A user name or number.
|
* @param $owner mixed A user name or number.
|
||||||
* @param $recursive bool (optional) If set True changes file owner recursivly. Defaults to False.
|
* @param $recursive bool (optional) If set True changes file owner recursivly. Defaults to False.
|
||||||
* @return bool Returns true on success or false on failure.
|
* @return bool Returns true on success or false on failure.
|
||||||
*/
|
*/
|
||||||
function chown($file, $owner, $recursive = false) {
|
function chown($file, $owner, $recursive = false) {
|
||||||
@ -165,8 +165,8 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Gets file owner
|
* Gets file owner
|
||||||
*
|
*
|
||||||
* @param $file string Path to the file.
|
* @param $file string Path to the file.
|
||||||
* @return string Username of the user.
|
* @return string Username of the user.
|
||||||
*/
|
*/
|
||||||
function owner($file) {
|
function owner($file) {
|
||||||
@ -180,10 +180,10 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Gets file permissions
|
* Gets file permissions
|
||||||
*
|
*
|
||||||
* FIXME does not handle errors in fileperms()
|
* FIXME does not handle errors in fileperms()
|
||||||
*
|
*
|
||||||
* @param $file string Path to the file.
|
* @param $file string Path to the file.
|
||||||
* @return string Mode of the file (last 4 digits).
|
* @return string Mode of the file (last 4 digits).
|
||||||
*/
|
*/
|
||||||
function getchmod($file) {
|
function getchmod($file) {
|
||||||
|
@ -149,7 +149,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base {
|
|||||||
elseif ( $this->is_dir($file) )
|
elseif ( $this->is_dir($file) )
|
||||||
$mode = FS_CHMOD_DIR;
|
$mode = FS_CHMOD_DIR;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $recursive || ! $this->is_dir($file) ) {
|
if ( ! $recursive || ! $this->is_dir($file) ) {
|
||||||
|
@ -160,7 +160,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
|||||||
elseif ( $this->is_dir($file) )
|
elseif ( $this->is_dir($file) )
|
||||||
$mode = FS_CHMOD_DIR;
|
$mode = FS_CHMOD_DIR;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $recursive || ! $this->is_dir($file) ) {
|
if ( ! $recursive || ! $this->is_dir($file) ) {
|
||||||
|
@ -194,7 +194,7 @@ class WP_Filesystem_SSH2 extends WP_Filesystem_Base {
|
|||||||
elseif ( $this->is_dir($file) )
|
elseif ( $this->is_dir($file) )
|
||||||
$mode = FS_CHMOD_DIR;
|
$mode = FS_CHMOD_DIR;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! $recursive || ! $this->is_dir($file) )
|
if ( ! $recursive || ! $this->is_dir($file) )
|
||||||
|
@ -570,7 +570,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
|||||||
$this->skin->after();
|
$this->skin->after();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = $current->response[ $theme ];
|
$r = $current->response[ $theme ];
|
||||||
|
|
||||||
add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
|
add_filter('upgrader_pre_install', array(&$this, 'current_before'), 10, 2);
|
||||||
@ -1006,10 +1006,10 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
|
|||||||
$name = $theme_info['Name'];
|
$name = $theme_info['Name'];
|
||||||
$stylesheet = $this->upgrader->result['destination_name'];
|
$stylesheet = $this->upgrader->result['destination_name'];
|
||||||
$template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
|
$template = !empty($theme_info['Template']) ? $theme_info['Template'] : $stylesheet;
|
||||||
|
|
||||||
$preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
|
$preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), trailingslashit(esc_url(get_option('home'))) ) );
|
||||||
$activate_link = wp_nonce_url("themes.php?action=activate&template=" . urlencode($template) . "&stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
|
$activate_link = wp_nonce_url("themes.php?action=activate&template=" . urlencode($template) . "&stylesheet=" . urlencode($stylesheet), 'switch-theme_' . $template);
|
||||||
|
|
||||||
$update_actions = array(
|
$update_actions = array(
|
||||||
'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview “%s”'), $name)) . '">' . __('Preview') . '</a>',
|
'preview' => '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview “%s”'), $name)) . '">' . __('Preview') . '</a>',
|
||||||
'activate' => '<a href="' . $activate_link . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate “%s”'), $name ) ) . '">' . __('Activate') . '</a>',
|
'activate' => '<a href="' . $activate_link . '" class="activatelink" title="' . esc_attr( sprintf( __('Activate “%s”'), $name ) ) . '">' . __('Activate') . '</a>',
|
||||||
|
@ -268,7 +268,7 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
|||||||
// Don't export revisions. They bloat the export.
|
// Don't export revisions. They bloat the export.
|
||||||
if ( 'revision' == $post->post_type )
|
if ( 'revision' == $post->post_type )
|
||||||
continue;
|
continue;
|
||||||
setup_postdata($post);
|
setup_postdata($post);
|
||||||
|
|
||||||
$is_sticky = 0;
|
$is_sticky = 0;
|
||||||
if ( is_sticky( $post->ID ) )
|
if ( is_sticky( $post->ID ) )
|
||||||
|
@ -598,7 +598,7 @@ function WP_Filesystem( $args = false, $context = false ) {
|
|||||||
$abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
|
$abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
|
||||||
if( ! file_exists($abstraction_file) )
|
if( ! file_exists($abstraction_file) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
require_once($abstraction_file);
|
require_once($abstraction_file);
|
||||||
}
|
}
|
||||||
$method = "WP_Filesystem_$method";
|
$method = "WP_Filesystem_$method";
|
||||||
|
@ -42,7 +42,7 @@ function wp_image_editor($post_id) {
|
|||||||
|
|
||||||
<div onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-fliph" title="<?php echo esc_attr__( 'Flip horizontally' ); ?>"></div>
|
<div onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-fliph" title="<?php echo esc_attr__( 'Flip horizontally' ); ?>"></div>
|
||||||
<div onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-flipv" title="<?php echo esc_attr__( 'Flip vertically' ); ?>"></div>
|
<div onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-flipv" title="<?php echo esc_attr__( 'Flip vertically' ); ?>"></div>
|
||||||
|
|
||||||
<div id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-undo disabled" title="<?php echo esc_attr__( 'Undo' ); ?>"></div>
|
<div id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-undo disabled" title="<?php echo esc_attr__( 'Undo' ); ?>"></div>
|
||||||
<div id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-redo disabled" title="<?php echo esc_attr__( 'Redo' ); ?>"></div>
|
<div id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>)" class="imgedit-redo disabled" title="<?php echo esc_attr__( 'Redo' ); ?>"></div>
|
||||||
<br class="clear" />
|
<br class="clear" />
|
||||||
|
@ -615,7 +615,7 @@ function add_menu_page( $page_title, $menu_title, $access_level, $file, $functio
|
|||||||
} else {
|
} else {
|
||||||
$menu[$position] = $new_menu;
|
$menu[$position] = $new_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_registered_pages[$hookname] = true;
|
$_registered_pages[$hookname] = true;
|
||||||
|
|
||||||
return $hookname;
|
return $hookname;
|
||||||
@ -623,17 +623,17 @@ function add_menu_page( $page_title, $menu_title, $access_level, $file, $functio
|
|||||||
|
|
||||||
function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
|
function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
|
||||||
global $_wp_last_object_menu;
|
global $_wp_last_object_menu;
|
||||||
|
|
||||||
$_wp_last_object_menu++;
|
$_wp_last_object_menu++;
|
||||||
|
|
||||||
return add_menu_page($page_title, $menu_title, $access_level, $file, $function, $icon_url, $_wp_last_object_menu);
|
return add_menu_page($page_title, $menu_title, $access_level, $file, $function, $icon_url, $_wp_last_object_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_utility_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
|
function add_utility_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
|
||||||
global $_wp_last_utility_menu;
|
global $_wp_last_utility_menu;
|
||||||
|
|
||||||
$_wp_last_utility_menu++;
|
$_wp_last_utility_menu++;
|
||||||
|
|
||||||
return add_menu_page($page_title, $menu_title, $access_level, $file, $function, $icon_url, $_wp_last_utility_menu);
|
return add_menu_page($page_title, $menu_title, $access_level, $file, $function, $icon_url, $_wp_last_utility_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,7 +674,7 @@ function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $fi
|
|||||||
|
|
||||||
$_registered_pages[$hookname] = true;
|
$_registered_pages[$hookname] = true;
|
||||||
// backwards-compatibility for plugins using add_management page. See wp-admin/admin.php for redirect from edit.php to tools.php
|
// backwards-compatibility for plugins using add_management page. See wp-admin/admin.php for redirect from edit.php to tools.php
|
||||||
if ( 'tools.php' == $parent )
|
if ( 'tools.php' == $parent )
|
||||||
$_registered_pages[get_plugin_page_hookname( $file, 'edit.php')] = true;
|
$_registered_pages[get_plugin_page_hookname( $file, 'edit.php')] = true;
|
||||||
|
|
||||||
return $hookname;
|
return $hookname;
|
||||||
|
@ -1078,7 +1078,7 @@ function wp_set_post_lock( $post_id ) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs the notice message to say that someone else is editing this post at the moment.
|
* Outputs the notice message to say that someone else is editing this post at the moment.
|
||||||
*
|
*
|
||||||
* @since 2.9.0
|
* @since 2.9.0
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
@ -1086,7 +1086,7 @@ function _admin_notice_post_locked() {
|
|||||||
global $post;
|
global $post;
|
||||||
$last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) );
|
$last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) );
|
||||||
$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
|
$last_user_name = $last_user ? $last_user->display_name : __('Somebody');
|
||||||
|
|
||||||
switch ($post->post_type) {
|
switch ($post->post_type) {
|
||||||
case 'post':
|
case 'post':
|
||||||
$message = __( 'Warning: %s is currently editing this post' );
|
$message = __( 'Warning: %s is currently editing this post' );
|
||||||
@ -1097,9 +1097,9 @@ function _admin_notice_post_locked() {
|
|||||||
default:
|
default:
|
||||||
$message = __( 'Warning: %s is currently editing this.' );
|
$message = __( 'Warning: %s is currently editing this.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = sprintf( $message, esc_html( $last_user_name ) );
|
$message = sprintf( $message, esc_html( $last_user_name ) );
|
||||||
echo "<div class='error'><p>$message</p></div>";
|
echo "<div class='error'><p>$message</p></div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2065,7 +2065,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0
|
|||||||
} else {
|
} else {
|
||||||
$query .= "AND $approved $post $typesql";
|
$query .= "AND $approved $post $typesql";
|
||||||
}
|
}
|
||||||
|
|
||||||
$comments = $wpdb->get_results("SELECT * $query $orderby");
|
$comments = $wpdb->get_results("SELECT * $query $orderby");
|
||||||
if ( '' === $total )
|
if ( '' === $total )
|
||||||
$total = $wpdb->get_var("SELECT COUNT(c.comment_ID) $query");
|
$total = $wpdb->get_var("SELECT COUNT(c.comment_ID) $query");
|
||||||
|
@ -54,7 +54,7 @@ function display_setup_form( $error = null ) {
|
|||||||
if ( isset($_POST) && !empty($_POST) ) {
|
if ( isset($_POST) && !empty($_POST) ) {
|
||||||
$blog_public = isset($_POST['blog_public']);
|
$blog_public = isset($_POST['blog_public']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! is_null( $error ) ) {
|
if ( ! is_null( $error ) ) {
|
||||||
?>
|
?>
|
||||||
<p><?php printf( __('<strong>ERROR</strong>: %s'), $error); ?></p>
|
<p><?php printf( __('<strong>ERROR</strong>: %s'), $error); ?></p>
|
||||||
|
@ -60,7 +60,7 @@ case 'edit' :
|
|||||||
|
|
||||||
if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') );
|
if ( empty($att->ID) ) wp_die( __('You attempted to edit an attachment that doesn’t exist. Perhaps it was deleted?') );
|
||||||
if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') );
|
if ( $att->post_status == 'trash' ) wp_die( __('You can’t edit this attachment because it is in the Trash. Please move it out of the Trash and try again.') );
|
||||||
|
|
||||||
add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
|
add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
|
||||||
|
|
||||||
wp_enqueue_script( 'wp-ajax-response' );
|
wp_enqueue_script( 'wp-ajax-response' );
|
||||||
|
@ -131,7 +131,7 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
|||||||
|
|
||||||
if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) {
|
if ( ( ('index.php' != $sub_item[2]) && file_exists(WP_PLUGIN_DIR . "/$sub_file") ) || ! empty($menu_hook) ) {
|
||||||
// If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
|
// If admin.php is the current page or if the parent exists as a file in the plugins or admin dir
|
||||||
|
|
||||||
$parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($menu_file);
|
$parent_exists = (!$admin_is_parent && file_exists(WP_PLUGIN_DIR . "/$menu_file") && !is_dir(WP_PLUGIN_DIR . "/{$item[2]}") ) || file_exists($menu_file);
|
||||||
if ( $parent_exists )
|
if ( $parent_exists )
|
||||||
echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
|
echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
|
||||||
|
@ -61,7 +61,7 @@ if ( !empty($action) ) {
|
|||||||
case 'activate-selected':
|
case 'activate-selected':
|
||||||
if ( ! current_user_can('activate_plugins') )
|
if ( ! current_user_can('activate_plugins') )
|
||||||
wp_die(__('You do not have sufficient permissions to activate plugins for this blog.'));
|
wp_die(__('You do not have sufficient permissions to activate plugins for this blog.'));
|
||||||
|
|
||||||
check_admin_referer('bulk-manage-plugins');
|
check_admin_referer('bulk-manage-plugins');
|
||||||
|
|
||||||
$plugins = (array) $_POST['checked'];
|
$plugins = (array) $_POST['checked'];
|
||||||
|
@ -68,7 +68,7 @@ switch ( $step ) :
|
|||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
wp_upgrade();
|
wp_upgrade();
|
||||||
|
|
||||||
$backto = empty($_GET['backto']) ? '' : $_GET['backto'] ;
|
$backto = empty($_GET['backto']) ? '' : $_GET['backto'] ;
|
||||||
$backto = stripslashes( urldecode( $backto ) );
|
$backto = stripslashes( urldecode( $backto ) );
|
||||||
$backto = esc_url_raw( $backto );
|
$backto = esc_url_raw( $backto );
|
||||||
|
@ -69,7 +69,7 @@ if ( isset($_GET['find_detached']) ) {
|
|||||||
|
|
||||||
} elseif ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
|
} elseif ( isset($_GET['doaction']) || isset($_GET['doaction2']) || isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
|
||||||
check_admin_referer('bulk-media');
|
check_admin_referer('bulk-media');
|
||||||
|
|
||||||
if ( isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
|
if ( isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
|
||||||
$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
|
$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
|
||||||
$doaction = 'delete';
|
$doaction = 'delete';
|
||||||
@ -78,7 +78,7 @@ if ( isset($_GET['find_detached']) ) {
|
|||||||
$doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
|
$doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
|
||||||
} else
|
} else
|
||||||
wp_redirect($_SERVER['HTTP_REFERER']);
|
wp_redirect($_SERVER['HTTP_REFERER']);
|
||||||
|
|
||||||
$location = 'upload.php';
|
$location = 'upload.php';
|
||||||
if ( $referer = wp_get_referer() ) {
|
if ( $referer = wp_get_referer() ) {
|
||||||
if ( false !== strpos($referer, 'upload.php') )
|
if ( false !== strpos($referer, 'upload.php') )
|
||||||
@ -90,7 +90,7 @@ if ( isset($_GET['find_detached']) ) {
|
|||||||
foreach( (array) $post_ids as $post_id ) {
|
foreach( (array) $post_ids as $post_id ) {
|
||||||
if ( !current_user_can('delete_post', $post_id) )
|
if ( !current_user_can('delete_post', $post_id) )
|
||||||
wp_die( __('You are not allowed to move this post to the trash.') );
|
wp_die( __('You are not allowed to move this post to the trash.') );
|
||||||
|
|
||||||
if ( !wp_trash_post($post_id) )
|
if ( !wp_trash_post($post_id) )
|
||||||
wp_die( __('Error in moving to trash...') );
|
wp_die( __('Error in moving to trash...') );
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ if ( isset($_GET['find_detached']) ) {
|
|||||||
foreach( (array) $post_ids as $post_id ) {
|
foreach( (array) $post_ids as $post_id ) {
|
||||||
if ( !current_user_can('delete_post', $post_id) )
|
if ( !current_user_can('delete_post', $post_id) )
|
||||||
wp_die( __('You are not allowed to move this post out of the trash.') );
|
wp_die( __('You are not allowed to move this post out of the trash.') );
|
||||||
|
|
||||||
if ( !wp_untrash_post($post_id) )
|
if ( !wp_untrash_post($post_id) )
|
||||||
wp_die( __('Error in restoring from trash...') );
|
wp_die( __('Error in restoring from trash...') );
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ if ( isset($_GET['find_detached']) ) {
|
|||||||
foreach( (array) $post_ids as $post_id_del ) {
|
foreach( (array) $post_ids as $post_id_del ) {
|
||||||
if ( !current_user_can('delete_post', $post_id_del) )
|
if ( !current_user_can('delete_post', $post_id_del) )
|
||||||
wp_die( __('You are not allowed to delete this post.') );
|
wp_die( __('You are not allowed to delete this post.') );
|
||||||
|
|
||||||
if ( !wp_delete_attachment($post_id_del) )
|
if ( !wp_delete_attachment($post_id_del) )
|
||||||
wp_die( __('Error in deleting...') );
|
wp_die( __('Error in deleting...') );
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ else
|
|||||||
<tr>
|
<tr>
|
||||||
<th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
|
<th><label for="<?php echo $name; ?>"><?php echo apply_filters('user_'.$name.'_label', $desc); ?></label></th>
|
||||||
<td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
|
<td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -781,7 +781,7 @@ EOD;
|
|||||||
}
|
}
|
||||||
|
|
||||||
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
|
$location = get_post_meta($entry['ID'], '_wp_attached_file', true);
|
||||||
$location = get_option ('upload_path') . '/' . $location;
|
$location = get_option ('upload_path') . '/' . $location;
|
||||||
$filetype = wp_check_filetype($location);
|
$filetype = wp_check_filetype($location);
|
||||||
|
|
||||||
if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
|
if(!isset($location) || 'attachment' != $entry['post_type'] || empty($filetype['ext']))
|
||||||
@ -791,9 +791,9 @@ EOD;
|
|||||||
header('Content-Type: ' . $entry['post_mime_type']);
|
header('Content-Type: ' . $entry['post_mime_type']);
|
||||||
header('Connection: close');
|
header('Connection: close');
|
||||||
|
|
||||||
if ($fp = fopen($location, "rb")) {
|
if ($fp = fopen($location, "rb")) {
|
||||||
status_header('200');
|
status_header('200');
|
||||||
header('Content-Type: ' . $entry['post_mime_type']);
|
header('Content-Type: ' . $entry['post_mime_type']);
|
||||||
header('Connection: close');
|
header('Connection: close');
|
||||||
|
|
||||||
while(!feof($fp)) {
|
while(!feof($fp)) {
|
||||||
|
@ -95,8 +95,8 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
|
|||||||
$redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
|
$redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
|
||||||
}
|
}
|
||||||
} elseif ( is_single() && !empty($_GET['name']) && ! $redirect_url ) {
|
} elseif ( is_single() && !empty($_GET['name']) && ! $redirect_url ) {
|
||||||
if ( $redirect_url = get_permalink( $wp_query->get_queried_object_id() ) )
|
if ( $redirect_url = get_permalink( $wp_query->get_queried_object_id() ) )
|
||||||
$redirect['query'] = remove_query_arg('name', $redirect['query']);
|
$redirect['query'] = remove_query_arg('name', $redirect['query']);
|
||||||
} elseif ( is_page() && !empty($_GET['page_id']) && ! $redirect_url ) {
|
} elseif ( is_page() && !empty($_GET['page_id']) && ! $redirect_url ) {
|
||||||
if ( $redirect_url = get_permalink(get_query_var('page_id')) )
|
if ( $redirect_url = get_permalink(get_query_var('page_id')) )
|
||||||
$redirect['query'] = remove_query_arg('page_id', $redirect['query']);
|
$redirect['query'] = remove_query_arg('page_id', $redirect['query']);
|
||||||
|
@ -266,7 +266,7 @@ class Services_JSON
|
|||||||
*/
|
*/
|
||||||
function _encode($var)
|
function _encode($var)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (gettype($var)) {
|
switch (gettype($var)) {
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
return $var ? 'true' : 'false';
|
return $var ? 'true' : 'false';
|
||||||
|
@ -214,7 +214,7 @@ class WP {
|
|||||||
|
|
||||||
// Trim the query of everything up to the '?'.
|
// Trim the query of everything up to the '?'.
|
||||||
$query = preg_replace("!^.+\?!", '', $query);
|
$query = preg_replace("!^.+\?!", '', $query);
|
||||||
|
|
||||||
// Substitute the substring matches into the query.
|
// Substitute the substring matches into the query.
|
||||||
$query = addslashes(WP_MatchesMapRegex::apply($query, $matches));
|
$query = addslashes(WP_MatchesMapRegex::apply($query, $matches));
|
||||||
|
|
||||||
@ -1594,59 +1594,59 @@ class WP_Ajax_Response {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class to remove the need to use eval to replace $matches[] in query strings.
|
* Helper class to remove the need to use eval to replace $matches[] in query strings.
|
||||||
*
|
*
|
||||||
* @since 2.9.0
|
* @since 2.9.0
|
||||||
*/
|
*/
|
||||||
class WP_MatchesMapRegex {
|
class WP_MatchesMapRegex {
|
||||||
/**
|
/**
|
||||||
* store for matches
|
* store for matches
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $_matches;
|
var $_matches;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* store for mapping result
|
* store for mapping result
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $output;
|
var $output;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* subject to perform mapping on (query string containing $matches[] references
|
* subject to perform mapping on (query string containing $matches[] references
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_subject;
|
var $_subject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* regexp pattern to match $matches[] references
|
* regexp pattern to match $matches[] references
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number
|
var $_pattern = '(\$matches\[[1-9]+[0-9]*\])'; // magic number
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*
|
*
|
||||||
* @param string $subject subject if regex
|
* @param string $subject subject if regex
|
||||||
* @param array $matches data to use in map
|
* @param array $matches data to use in map
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
function WP_MatchesMapRegex($subject, $matches) {
|
function WP_MatchesMapRegex($subject, $matches) {
|
||||||
$this->_subject = $subject;
|
$this->_subject = $subject;
|
||||||
$this->_matches = $matches;
|
$this->_matches = $matches;
|
||||||
$this->output = $this->_map();
|
$this->output = $this->_map();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Substitute substring matches in subject.
|
* Substitute substring matches in subject.
|
||||||
*
|
*
|
||||||
* static helper function to ease use
|
* static helper function to ease use
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $subject subject
|
* @param string $subject subject
|
||||||
* @param array $matches data used for subsitution
|
* @param array $matches data used for subsitution
|
||||||
@ -1654,12 +1654,12 @@ class WP_MatchesMapRegex {
|
|||||||
*/
|
*/
|
||||||
function apply($subject, $matches) {
|
function apply($subject, $matches) {
|
||||||
$oSelf =& new WP_MatchesMapRegex($subject, $matches);
|
$oSelf =& new WP_MatchesMapRegex($subject, $matches);
|
||||||
return $oSelf->output;
|
return $oSelf->output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* do the actual mapping
|
* do the actual mapping
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@ -1667,10 +1667,10 @@ class WP_MatchesMapRegex {
|
|||||||
$callback = array(&$this, 'callback');
|
$callback = array(&$this, 'callback');
|
||||||
return preg_replace_callback($this->_pattern, $callback, $this->_subject);
|
return preg_replace_callback($this->_pattern, $callback, $this->_subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* preg_replace_callback hook
|
* preg_replace_callback hook
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $matches preg_replace regexp matches
|
* @param array $matches preg_replace regexp matches
|
||||||
* @return string
|
* @return string
|
||||||
@ -1679,7 +1679,7 @@ class WP_MatchesMapRegex {
|
|||||||
$index = intval(substr($matches[0], 9, -1));
|
$index = intval(substr($matches[0], 9, -1));
|
||||||
return ( isset( $this->_matches[$index] ) ? $this->_matches[$index] : '' );
|
return ( isset( $this->_matches[$index] ) ? $this->_matches[$index] : '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -835,12 +835,12 @@ function comments_template( $file = '/comments.php', $separate_comments = false
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The email address of the current comment author escaped for use in attributes.
|
* The email address of the current comment author escaped for use in attributes.
|
||||||
*/
|
*/
|
||||||
$comment_author_email = $commenter['comment_author_email']; // Escaped by sanitize_comment_cookies()
|
$comment_author_email = $commenter['comment_author_email']; // Escaped by sanitize_comment_cookies()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The url of the current comment author escaped for use in attributes.
|
* The url of the current comment author escaped for use in attributes.
|
||||||
*/
|
*/
|
||||||
$comment_author_url = esc_url($commenter['comment_author_url']);
|
$comment_author_url = esc_url($commenter['comment_author_url']);
|
||||||
|
|
||||||
/** @todo Use API instead of SELECTs. */
|
/** @todo Use API instead of SELECTs. */
|
||||||
|
@ -734,9 +734,9 @@ function wp_delete_comment($comment_id) {
|
|||||||
|
|
||||||
if (wp_get_comment_status($comment_id) != 'trash' && wp_get_comment_status($comment_id) != 'spam' && EMPTY_TRASH_DAYS > 0)
|
if (wp_get_comment_status($comment_id) != 'trash' && wp_get_comment_status($comment_id) != 'spam' && EMPTY_TRASH_DAYS > 0)
|
||||||
return wp_trash_comment($comment_id);
|
return wp_trash_comment($comment_id);
|
||||||
|
|
||||||
do_action('delete_comment', $comment_id);
|
do_action('delete_comment', $comment_id);
|
||||||
|
|
||||||
$trash_meta = get_option('wp_trash_meta');
|
$trash_meta = get_option('wp_trash_meta');
|
||||||
if (is_array($trash_meta) && isset($trash_meta['comments'][$comment_id])) {
|
if (is_array($trash_meta) && isset($trash_meta['comments'][$comment_id])) {
|
||||||
unset($trash_meta['comments'][$comment_id]);
|
unset($trash_meta['comments'][$comment_id]);
|
||||||
@ -1093,7 +1093,7 @@ function wp_new_comment( $commentdata ) {
|
|||||||
*/
|
*/
|
||||||
function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
|
function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$status = '0';
|
$status = '0';
|
||||||
switch ( $comment_status ) {
|
switch ( $comment_status ) {
|
||||||
case 'hold':
|
case 'hold':
|
||||||
|
@ -32,12 +32,12 @@ function wptexturize($text) {
|
|||||||
$curl = '';
|
$curl = '';
|
||||||
$textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
|
$textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||||
$stop = count($textarr);
|
$stop = count($textarr);
|
||||||
|
|
||||||
/* translators: opening curly quote */
|
/* translators: opening curly quote */
|
||||||
$opening_quote = _x('“', 'opening curly quote');
|
$opening_quote = _x('“', 'opening curly quote');
|
||||||
/* translators: closing curly quote */
|
/* translators: closing curly quote */
|
||||||
$closing_quote = _x('”', 'closing curly quote');
|
$closing_quote = _x('”', 'closing curly quote');
|
||||||
|
|
||||||
$no_texturize_tags = apply_filters('no_texturize_tags', array('pre', 'code', 'kbd', 'style', 'script', 'tt'));
|
$no_texturize_tags = apply_filters('no_texturize_tags', array('pre', 'code', 'kbd', 'style', 'script', 'tt'));
|
||||||
$no_texturize_shortcodes = apply_filters('no_texturize_shortcodes', array('code'));
|
$no_texturize_shortcodes = apply_filters('no_texturize_shortcodes', array('code'));
|
||||||
$no_texturize_tags_stack = array();
|
$no_texturize_tags_stack = array();
|
||||||
@ -1326,7 +1326,7 @@ function translate_smiley($smiley) {
|
|||||||
$smiley = trim(reset($smiley));
|
$smiley = trim(reset($smiley));
|
||||||
$img = $wpsmiliestrans[$smiley];
|
$img = $wpsmiliestrans[$smiley];
|
||||||
$smiley_masked = esc_attr($smiley);
|
$smiley_masked = esc_attr($smiley);
|
||||||
|
|
||||||
$srcurl = apply_filters('smilies_src', "$siteurl/wp-includes/images/smilies/$img", $img, $siteurl);
|
$srcurl = apply_filters('smilies_src', "$siteurl/wp-includes/images/smilies/$img", $img, $siteurl);
|
||||||
|
|
||||||
return " <img src='$srcurl' alt='$smiley_masked' class='wp-smiley' /> ";
|
return " <img src='$srcurl' alt='$smiley_masked' class='wp-smiley' /> ";
|
||||||
@ -2087,14 +2087,14 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a deep string replace operation to ensure the values in $search are no longer present
|
* Perform a deep string replace operation to ensure the values in $search are no longer present
|
||||||
*
|
*
|
||||||
* Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values
|
* Repeats the replacement operation until it no longer replaces anything so as to remove "nested" values
|
||||||
* e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that
|
* e.g. $subject = '%0%0%0DDD', $search ='%0D', $result ='' rather than the '%0%0DD' that
|
||||||
* str_replace would return
|
* str_replace would return
|
||||||
*
|
*
|
||||||
* @since 2.8.1
|
* @since 2.8.1
|
||||||
* @access private
|
* @access private
|
||||||
*
|
*
|
||||||
* @param string|array $search
|
* @param string|array $search
|
||||||
* @param string $subject
|
* @param string $subject
|
||||||
* @return string The processed string
|
* @return string The processed string
|
||||||
@ -2110,7 +2110,7 @@ function _deep_replace($search, $subject){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $subject;
|
return $subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3308,13 +3308,13 @@ function wp_timezone_choice( $selected_zone ) {
|
|||||||
$display = $zone['t_continent'];
|
$display = $zone['t_continent'];
|
||||||
} else {
|
} else {
|
||||||
// It's inside a continent group
|
// It's inside a continent group
|
||||||
|
|
||||||
// Continent optgroup
|
// Continent optgroup
|
||||||
if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
|
if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
|
||||||
$label = ( 'Etc' === $zone['continent'] ) ? __( 'Manual offsets' ) : $zone['t_continent'];
|
$label = ( 'Etc' === $zone['continent'] ) ? __( 'Manual offsets' ) : $zone['t_continent'];
|
||||||
$structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
|
$structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the city to the value
|
// Add the city to the value
|
||||||
$value[] = $zone['city'];
|
$value[] = $zone['city'];
|
||||||
if ( 'Etc' === $zone['continent'] ) {
|
if ( 'Etc' === $zone['continent'] ) {
|
||||||
@ -3342,7 +3342,7 @@ function wp_timezone_choice( $selected_zone ) {
|
|||||||
$selected = 'selected="selected" ';
|
$selected = 'selected="selected" ';
|
||||||
}
|
}
|
||||||
$structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
|
$structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
|
||||||
|
|
||||||
// Close continent optgroup
|
// Close continent optgroup
|
||||||
if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) {
|
if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) {
|
||||||
$structure[] = '</optgroup>';
|
$structure[] = '</optgroup>';
|
||||||
@ -3364,7 +3364,7 @@ function _cleanup_header_comment($str) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS.
|
* Permanently deletes posts, pages, attachments, and comments which have been in the trash for EMPTY_TRASH_DAYS.
|
||||||
*
|
*
|
||||||
* @since 2.9.0
|
* @since 2.9.0
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@ -3373,15 +3373,15 @@ function wp_scheduled_delete() {
|
|||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
|
$delete_timestamp = time() - (60*60*24*EMPTY_TRASH_DAYS);
|
||||||
|
|
||||||
$posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
|
$posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
|
||||||
|
|
||||||
foreach ( (array) $posts_to_delete as $post ) {
|
foreach ( (array) $posts_to_delete as $post ) {
|
||||||
wp_delete_post($post['post_id']);
|
wp_delete_post($post['post_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Trashed Comments
|
//Trashed Comments
|
||||||
//TODO Come up with a better store for the comment trash meta.
|
//TODO Come up with a better store for the comment trash meta.
|
||||||
$trash_meta = get_option('wp_trash_meta');
|
$trash_meta = get_option('wp_trash_meta');
|
||||||
if ( !is_array($trash_meta) )
|
if ( !is_array($trash_meta) )
|
||||||
return;
|
return;
|
||||||
|
@ -1813,10 +1813,10 @@ class WP_Http_Encoding {
|
|||||||
/**
|
/**
|
||||||
* Decompression of deflated string while staying compatible with the majority of servers.
|
* Decompression of deflated string while staying compatible with the majority of servers.
|
||||||
*
|
*
|
||||||
* Certain Servers will return deflated data with headers which PHP's gziniflate()
|
* Certain Servers will return deflated data with headers which PHP's gziniflate()
|
||||||
* function cannot handle out of the box. The following function lifted from
|
* function cannot handle out of the box. The following function lifted from
|
||||||
* http://au2.php.net/manual/en/function.gzinflate.php#77336 will attempt to deflate
|
* http://au2.php.net/manual/en/function.gzinflate.php#77336 will attempt to deflate
|
||||||
* the various return forms used.
|
* the various return forms used.
|
||||||
*
|
*
|
||||||
* @since 2.8.1
|
* @since 2.8.1
|
||||||
* @link http://au2.php.net/manual/en/function.gzinflate.php#77336
|
* @link http://au2.php.net/manual/en/function.gzinflate.php#77336
|
||||||
|
@ -1176,16 +1176,16 @@ function safecss_filter_attr( $css, $deprecated = '' ) {
|
|||||||
return '';
|
return '';
|
||||||
|
|
||||||
$css_array = split( ';', trim( $css ) );
|
$css_array = split( ';', trim( $css ) );
|
||||||
$allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float',
|
$allowed_attr = apply_filters( 'safe_style_css', array( 'text-align', 'margin', 'color', 'float',
|
||||||
'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color',
|
'border', 'background', 'background-color', 'border-bottom', 'border-bottom-color',
|
||||||
'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left',
|
'border-bottom-style', 'border-bottom-width', 'border-collapse', 'border-color', 'border-left',
|
||||||
'border-left-color', 'border-left-style', 'border-left-width', 'border-right', 'border-right-color',
|
'border-left-color', 'border-left-style', 'border-left-width', 'border-right', 'border-right-color',
|
||||||
'border-right-style', 'border-right-width', 'border-spacing', 'border-style', 'border-top',
|
'border-right-style', 'border-right-width', 'border-spacing', 'border-style', 'border-top',
|
||||||
'border-top-color', 'border-top-style', 'border-top-width', 'border-width', 'caption-side',
|
'border-top-color', 'border-top-style', 'border-top-width', 'border-width', 'caption-side',
|
||||||
'clear', 'cursor', 'direction', 'font', 'font-family', 'font-size', 'font-style',
|
'clear', 'cursor', 'direction', 'font', 'font-family', 'font-size', 'font-style',
|
||||||
'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'margin-bottom',
|
'font-variant', 'font-weight', 'height', 'letter-spacing', 'line-height', 'margin-bottom',
|
||||||
'margin-left', 'margin-right', 'margin-top', 'overflow', 'padding', 'padding-bottom',
|
'margin-left', 'margin-right', 'margin-top', 'overflow', 'padding', 'padding-bottom',
|
||||||
'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align',
|
'padding-left', 'padding-right', 'padding-top', 'text-decoration', 'text-indent', 'vertical-align',
|
||||||
'width' ) );
|
'width' ) );
|
||||||
|
|
||||||
if ( empty($allowed_attr) )
|
if ( empty($allowed_attr) )
|
||||||
|
@ -1648,10 +1648,10 @@ function paginate_comments_links($args = array()) {
|
|||||||
*/
|
*/
|
||||||
function get_shortcut_link() {
|
function get_shortcut_link() {
|
||||||
$link = "javascript:
|
$link = "javascript:
|
||||||
var d=document,
|
var d=document,
|
||||||
w=window,
|
w=window,
|
||||||
e=w.getSelection,
|
e=w.getSelection,
|
||||||
k=d.getSelection,
|
k=d.getSelection,
|
||||||
x=d.selection,
|
x=d.selection,
|
||||||
s=(e?e():(k)?k():(x?x.createRange().text:0)),
|
s=(e?e():(k)?k():(x?x.createRange().text:0)),
|
||||||
f='" . admin_url('press-this.php') . "',
|
f='" . admin_url('press-this.php') . "',
|
||||||
|
@ -349,7 +349,7 @@ function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $de
|
|||||||
$newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );
|
$newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );
|
||||||
|
|
||||||
imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
||||||
|
|
||||||
// convert from full colors to index colors, like original PNG.
|
// convert from full colors to index colors, like original PNG.
|
||||||
if ( IMAGETYPE_PNG == $orig_type && !imageistruecolor( $image ) )
|
if ( IMAGETYPE_PNG == $orig_type && !imageistruecolor( $image ) )
|
||||||
imagetruecolortopalette( $newimage, false, imagecolorstotal( $image ) );
|
imagetruecolortopalette( $newimage, false, imagecolorstotal( $image ) );
|
||||||
@ -378,7 +378,7 @@ function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $de
|
|||||||
} else {
|
} else {
|
||||||
// all other formats are converted to jpg
|
// all other formats are converted to jpg
|
||||||
$destfilename = "{$dir}/{$name}-{$suffix}.jpg";
|
$destfilename = "{$dir}/{$name}-{$suffix}.jpg";
|
||||||
if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) )
|
if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) )
|
||||||
return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
|
return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,7 +837,7 @@ function gd_edit_image_support($mime_type) {
|
|||||||
return function_exists('imagecreatefrompng');
|
return function_exists('imagecreatefrompng');
|
||||||
case 'image/gif':
|
case 'image/gif':
|
||||||
return function_exists('imagecreatefromgif');
|
return function_exists('imagecreatefromgif');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -998,7 +998,7 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
|
|||||||
$notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n";
|
$notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n";
|
||||||
$notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
|
$notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
|
||||||
$notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";
|
$notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";
|
||||||
/* translators: 1: blog name, 2: post title */
|
/* translators: 1: blog name, 2: post title */
|
||||||
$subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
|
$subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
|
||||||
} elseif ('pingback' == $comment_type) {
|
} elseif ('pingback' == $comment_type) {
|
||||||
/* translators: 1: post id, 2: post title */
|
/* translators: 1: post id, 2: post title */
|
||||||
|
@ -135,7 +135,7 @@ function &get_children($args = '', $output = OBJECT) {
|
|||||||
$r = wp_parse_args( $args, $defaults );
|
$r = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
$children = get_posts( $r );
|
$children = get_posts( $r );
|
||||||
|
|
||||||
if ( !$children )
|
if ( !$children )
|
||||||
return $kids;
|
return $kids;
|
||||||
|
|
||||||
@ -583,7 +583,7 @@ function delete_post_meta($post_id, $meta_key, $meta_value = '') {
|
|||||||
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $meta_key, $meta_value ) );
|
$wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $meta_key, $meta_value ) );
|
||||||
|
|
||||||
wp_cache_delete($post_id, 'post_meta');
|
wp_cache_delete($post_id, 'post_meta');
|
||||||
|
|
||||||
do_action( 'deleted_post_meta', $meta_id, $post_id, $meta_key, $meta_value );
|
do_action( 'deleted_post_meta', $meta_id, $post_id, $meta_key, $meta_value );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -672,12 +672,12 @@ function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_action( 'update_post_meta', $meta_id, $post_id, $meta_key, $meta_value );
|
do_action( 'update_post_meta', $meta_id, $post_id, $meta_key, $meta_value );
|
||||||
|
|
||||||
$wpdb->update( $wpdb->postmeta, $data, $where );
|
$wpdb->update( $wpdb->postmeta, $data, $where );
|
||||||
wp_cache_delete($post_id, 'post_meta');
|
wp_cache_delete($post_id, 'post_meta');
|
||||||
|
|
||||||
do_action( 'updated_post_meta', $meta_id, $post_id, $meta_key, $meta_value );
|
do_action( 'updated_post_meta', $meta_id, $post_id, $meta_key, $meta_value );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1154,12 +1154,12 @@ function wp_delete_post($postid = 0) {
|
|||||||
|
|
||||||
if ( ($post->post_type == 'post' || $post->post_type == 'page') && get_post_status($postid) != 'trash' && EMPTY_TRASH_DAYS > 0 )
|
if ( ($post->post_type == 'post' || $post->post_type == 'page') && get_post_status($postid) != 'trash' && EMPTY_TRASH_DAYS > 0 )
|
||||||
return wp_trash_post($postid);
|
return wp_trash_post($postid);
|
||||||
|
|
||||||
if ( $post->post_type == 'attachment' )
|
if ( $post->post_type == 'attachment' )
|
||||||
return wp_delete_attachment($postid);
|
return wp_delete_attachment($postid);
|
||||||
|
|
||||||
do_action('delete_post', $postid);
|
do_action('delete_post', $postid);
|
||||||
|
|
||||||
delete_post_meta($postid,'_wp_trash_meta_status');
|
delete_post_meta($postid,'_wp_trash_meta_status');
|
||||||
delete_post_meta($postid,'_wp_trash_meta_time');
|
delete_post_meta($postid,'_wp_trash_meta_time');
|
||||||
|
|
||||||
@ -1819,14 +1819,14 @@ function check_and_publish_future_post($post_id) {
|
|||||||
function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) {
|
function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) {
|
||||||
if ( in_array( $post_status, array( 'draft', 'pending' ) ) )
|
if ( in_array( $post_status, array( 'draft', 'pending' ) ) )
|
||||||
return $slug;
|
return $slug;
|
||||||
|
|
||||||
global $wpdb, $wp_rewrite;
|
global $wpdb, $wp_rewrite;
|
||||||
$hierarchical_post_types = apply_filters('hierarchical_post_types', array('page'));
|
$hierarchical_post_types = apply_filters('hierarchical_post_types', array('page'));
|
||||||
if ( 'attachment' == $post_type ) {
|
if ( 'attachment' == $post_type ) {
|
||||||
// Attachment slugs must be unique across all types.
|
// Attachment slugs must be unique across all types.
|
||||||
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
|
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
|
||||||
$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID));
|
$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID));
|
||||||
|
|
||||||
if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
|
if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
|
||||||
$suffix = 2;
|
$suffix = 2;
|
||||||
do {
|
do {
|
||||||
@ -1841,7 +1841,7 @@ function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_pa
|
|||||||
// separate namespace than posts so page slugs are allowed to overlap post slugs.
|
// separate namespace than posts so page slugs are allowed to overlap post slugs.
|
||||||
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode("', '", $wpdb->escape($hierarchical_post_types)) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
|
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode("', '", $wpdb->escape($hierarchical_post_types)) . "' ) AND ID != %d AND post_parent = %d LIMIT 1";
|
||||||
$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent));
|
$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent));
|
||||||
|
|
||||||
if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
|
if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
|
||||||
$suffix = 2;
|
$suffix = 2;
|
||||||
do {
|
do {
|
||||||
@ -1855,7 +1855,7 @@ function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_pa
|
|||||||
// Post slugs must be unique across all posts.
|
// Post slugs must be unique across all posts.
|
||||||
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
|
$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
|
||||||
$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID));
|
$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID));
|
||||||
|
|
||||||
if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
|
if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
|
||||||
$suffix = 2;
|
$suffix = 2;
|
||||||
do {
|
do {
|
||||||
|
@ -2697,7 +2697,7 @@ function setup_postdata($post) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_action_ref_array('the_post', array(&$post));
|
do_action_ref_array('the_post', array(&$post));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ function wp_create_user($username, $password, $email = '') {
|
|||||||
* Setup the default contact methods
|
* Setup the default contact methods
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
* @since
|
* @since
|
||||||
*
|
*
|
||||||
* @return array $user_contactmethods Array of contact methods and their labels.
|
* @return array $user_contactmethods Array of contact methods and their labels.
|
||||||
*/
|
*/
|
||||||
|
@ -452,7 +452,7 @@ function wp_default_styles( &$styles ) {
|
|||||||
|
|
||||||
// Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
|
// Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
|
||||||
$styles->add( 'colors', true, array(), $colors_version );
|
$styles->add( 'colors', true, array(), $colors_version );
|
||||||
|
|
||||||
// do not refer to these directly, the right one is queued by the above "meta" colors handle
|
// do not refer to these directly, the right one is queued by the above "meta" colors handle
|
||||||
$styles->add( 'colors-fresh', "/wp-admin/css/colors-fresh$suffix.css", array(), $colors_version);
|
$styles->add( 'colors-fresh', "/wp-admin/css/colors-fresh$suffix.css", array(), $colors_version);
|
||||||
$styles->add_data( 'colors-fresh', 'rtl', true );
|
$styles->add_data( 'colors-fresh', 'rtl', true );
|
||||||
|
@ -604,13 +604,13 @@ function get_category_template() {
|
|||||||
$category = get_category( $cat_ID );
|
$category = get_category( $cat_ID );
|
||||||
|
|
||||||
$templates = array();
|
$templates = array();
|
||||||
|
|
||||||
if ( !is_wp_error($category) )
|
if ( !is_wp_error($category) )
|
||||||
$templates[] = "category-{$category->slug}.php";
|
$templates[] = "category-{$category->slug}.php";
|
||||||
|
|
||||||
$templates[] = "category-$cat_ID.php";
|
$templates[] = "category-$cat_ID.php";
|
||||||
$templates[] = "category.php";
|
$templates[] = "category.php";
|
||||||
|
|
||||||
$template = locate_template($templates);
|
$template = locate_template($templates);
|
||||||
return apply_filters('category_template', $template);
|
return apply_filters('category_template', $template);
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
|
|||||||
|
|
||||||
wp_cache_delete($user_id, 'users');
|
wp_cache_delete($user_id, 'users');
|
||||||
|
|
||||||
if ( !$cur )
|
if ( !$cur )
|
||||||
do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
|
do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
|
||||||
else
|
else
|
||||||
do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
|
do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
|
||||||
|
@ -263,7 +263,7 @@ class wpdb {
|
|||||||
*/
|
*/
|
||||||
var $old_tables = array('categories', 'post2cat', 'link2cat');
|
var $old_tables = array('categories', 'post2cat', 'link2cat');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format specifiers for DB columns. Columns not listed here default to %s. Initialized in wp-settings.php.
|
* Format specifiers for DB columns. Columns not listed here default to %s. Initialized in wp-settings.php.
|
||||||
*
|
*
|
||||||
|
@ -59,8 +59,8 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') {
|
|||||||
|
|
||||||
if ( $is_iphone ) {
|
if ( $is_iphone ) {
|
||||||
?>
|
?>
|
||||||
<meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" />
|
<meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" />
|
||||||
<style type="text/css" media="screen">
|
<style type="text/css" media="screen">
|
||||||
form { margin-left: 0px; }
|
form { margin-left: 0px; }
|
||||||
#login { margin-top: 20px; }
|
#login { margin-top: 20px; }
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user