Version Description
Download this release
Release Info
Developer | hallsofmontezuma |
Plugin | All in One SEO Pack |
Version | 1.6.3 |
Comparing to | |
See all releases |
Code changes from version 1.6.2 to 1.6.3
- aioseop.class.php +40 -4
- all_in_one_seo_pack.php +5 -2
- trunk/aioseop.class.php +0 -1975
- trunk/all_in_one_seo_pack-bg_BG.mo +0 -0
- trunk/all_in_one_seo_pack-bg_NO.mo +0 -0
- trunk/all_in_one_seo_pack-da_DK.mo +0 -0
- trunk/all_in_one_seo_pack-de_DE.mo +0 -0
- trunk/all_in_one_seo_pack-es_ES.mo +0 -0
- trunk/all_in_one_seo_pack-fr_FR.mo +0 -0
- trunk/all_in_one_seo_pack-he_IL.mo +0 -0
- trunk/all_in_one_seo_pack-hu_HU.mo +0 -0
- trunk/all_in_one_seo_pack-it_IT.mo +0 -0
- trunk/all_in_one_seo_pack-ja.mo +0 -0
- trunk/all_in_one_seo_pack-nl_NL.mo +0 -0
- trunk/all_in_one_seo_pack-pl_PL.mo +0 -0
- trunk/all_in_one_seo_pack-pt_BR.mo +0 -0
- trunk/all_in_one_seo_pack-ru_RU.mo +0 -0
- trunk/all_in_one_seo_pack-tr_TR.mo +0 -0
- trunk/all_in_one_seo_pack-uk.mo +0 -0
- trunk/all_in_one_seo_pack-zh_CN.mo +0 -0
- trunk/all_in_one_seo_pack-zh_TW.mo +0 -0
- trunk/all_in_one_seo_pack.php +0 -766
- trunk/all_in_one_seo_pack.pot +0 -293
- trunk/images/twitter.png +0 -0
- trunk/pclzip.lib.php +0 -5651
- trunk/readme.txt +0 -70
aioseop.class.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
class All_in_One_SEO_Pack {
|
4 |
|
5 |
-
var $version = "1.6.
|
6 |
|
7 |
/** Max numbers of chars in auto-generated description */
|
8 |
var $maximum_description_length = 160;
|
@@ -105,6 +105,14 @@ class All_in_One_SEO_Pack {
|
|
105 |
return $this->rewrite_title($content);
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
function init() {
|
109 |
if (function_exists('load_plugin_textdomain')) {
|
110 |
if ( !defined('WP_PLUGIN_DIR') ) {
|
@@ -490,6 +498,7 @@ if (function_exists('load_plugin_textdomain')) {
|
|
490 |
/** @return The original title as delivered by WP (well, in most cases) */
|
491 |
function get_original_title() {
|
492 |
global $wp_query;
|
|
|
493 |
if (!$wp_query) {
|
494 |
return null;
|
495 |
}
|
@@ -549,7 +558,7 @@ if (function_exists('load_plugin_textdomain')) {
|
|
549 |
function paged_title($title) {
|
550 |
// the page number if paged
|
551 |
global $paged;
|
552 |
-
|
553 |
// simple tagging support
|
554 |
global $STagging;
|
555 |
|
@@ -633,7 +642,12 @@ if (function_exists('load_plugin_textdomain')) {
|
|
633 |
$header = $this->replace_title($header, $title);
|
634 |
} else if (is_category() && !is_feed()) {
|
635 |
$category_description = $this->internationalize(category_description());
|
636 |
-
|
|
|
|
|
|
|
|
|
|
|
637 |
$title_format = $aioseop_options['aiosp_category_title_format'];
|
638 |
$title = str_replace('%category_title%', $category_name, $title_format);
|
639 |
$title = str_replace('%category_description%', $category_description, $title);
|
@@ -1261,6 +1275,12 @@ if (function_exists('load_plugin_textdomain')) {
|
|
1261 |
$message = null;
|
1262 |
$message_updated = __("All in One SEO Options Updated.", 'all_in_one_seo_pack');
|
1263 |
global $aioseop_options;
|
|
|
|
|
|
|
|
|
|
|
|
|
1264 |
// update options
|
1265 |
if ($_POST['action'] && $_POST['action'] == 'aiosp_update') {
|
1266 |
$nonce = $_POST['nonce-aioseop'];
|
@@ -1288,6 +1308,7 @@ if (function_exists('load_plugin_textdomain')) {
|
|
1288 |
$aioseop_options['aiosp_archive_noindex'] = $_POST['aiosp_archive_noindex'];
|
1289 |
$aioseop_options['aiosp_tags_noindex'] = $_POST['aiosp_tags_noindex'];
|
1290 |
$aioseop_options['aiosp_generate_descriptions'] = $_POST['aiosp_generate_descriptions'];
|
|
|
1291 |
$aioseop_options['aiosp_debug_info'] = $_POST['aiosp_debug_info'];
|
1292 |
$aioseop_options['aiosp_post_meta_tags'] = $_POST['aiosp_post_meta_tags'];
|
1293 |
$aioseop_options['aiosp_page_meta_tags'] = $_POST['aiosp_page_meta_tags'];
|
@@ -1424,7 +1445,6 @@ title='<?php echo $item['title']; ?>'>
|
|
1424 |
<?php endforeach; ?>
|
1425 |
</ul>
|
1426 |
<?php } }else{
|
1427 |
-
echo "sdf";
|
1428 |
//fall back on something else for feed here
|
1429 |
}?>
|
1430 |
|
@@ -1871,6 +1891,22 @@ _e("Check this and your META descriptions will get autogenerated if there's no e
|
|
1871 |
</td>
|
1872 |
</tr>
|
1873 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1874 |
<tr>
|
1875 |
<th scope="row" style="text-align:right; vertical-align:top;">
|
1876 |
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_meta_tags_tip');">
|
2 |
|
3 |
class All_in_One_SEO_Pack {
|
4 |
|
5 |
+
var $version = "1.6.3";
|
6 |
|
7 |
/** Max numbers of chars in auto-generated description */
|
8 |
var $maximum_description_length = 160;
|
105 |
return $this->rewrite_title($content);
|
106 |
}
|
107 |
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
//
|
114 |
+
//CHECK IF ARRAY EXISTS IN DB, IF SO, GET ARRAY, ADD EVERYTHING, CHECK FOR ISSET?
|
115 |
+
//
|
116 |
function init() {
|
117 |
if (function_exists('load_plugin_textdomain')) {
|
118 |
if ( !defined('WP_PLUGIN_DIR') ) {
|
498 |
/** @return The original title as delivered by WP (well, in most cases) */
|
499 |
function get_original_title() {
|
500 |
global $wp_query;
|
501 |
+
global $aioseop_options;
|
502 |
if (!$wp_query) {
|
503 |
return null;
|
504 |
}
|
558 |
function paged_title($title) {
|
559 |
// the page number if paged
|
560 |
global $paged;
|
561 |
+
global $aioseop_options;
|
562 |
// simple tagging support
|
563 |
global $STagging;
|
564 |
|
642 |
$header = $this->replace_title($header, $title);
|
643 |
} else if (is_category() && !is_feed()) {
|
644 |
$category_description = $this->internationalize(category_description());
|
645 |
+
if($aioseop_options['aiosp_cap_cats']){
|
646 |
+
$category_name = ucwords($this->internationalize(single_cat_title('', false)));
|
647 |
+
}else{
|
648 |
+
$category_name = $this->internationalize(single_cat_title('', false));
|
649 |
+
}
|
650 |
+
//$category_name = ucwords($this->internationalize(single_cat_title('', false)));
|
651 |
$title_format = $aioseop_options['aiosp_category_title_format'];
|
652 |
$title = str_replace('%category_title%', $category_name, $title_format);
|
653 |
$title = str_replace('%category_description%', $category_description, $title);
|
1275 |
$message = null;
|
1276 |
$message_updated = __("All in One SEO Options Updated.", 'all_in_one_seo_pack');
|
1277 |
global $aioseop_options;
|
1278 |
+
|
1279 |
+
|
1280 |
+
if(!$aioseop_options['aiosp_cap_cats']){
|
1281 |
+
$aioseop_options['aiosp_cap_cats'] = '1';
|
1282 |
+
}
|
1283 |
+
|
1284 |
// update options
|
1285 |
if ($_POST['action'] && $_POST['action'] == 'aiosp_update') {
|
1286 |
$nonce = $_POST['nonce-aioseop'];
|
1308 |
$aioseop_options['aiosp_archive_noindex'] = $_POST['aiosp_archive_noindex'];
|
1309 |
$aioseop_options['aiosp_tags_noindex'] = $_POST['aiosp_tags_noindex'];
|
1310 |
$aioseop_options['aiosp_generate_descriptions'] = $_POST['aiosp_generate_descriptions'];
|
1311 |
+
$aioseop_options['aiosp_cap_cats'] = $_POST['aiosp_cap_cats'];
|
1312 |
$aioseop_options['aiosp_debug_info'] = $_POST['aiosp_debug_info'];
|
1313 |
$aioseop_options['aiosp_post_meta_tags'] = $_POST['aiosp_post_meta_tags'];
|
1314 |
$aioseop_options['aiosp_page_meta_tags'] = $_POST['aiosp_page_meta_tags'];
|
1445 |
<?php endforeach; ?>
|
1446 |
</ul>
|
1447 |
<?php } }else{
|
|
|
1448 |
//fall back on something else for feed here
|
1449 |
}?>
|
1450 |
|
1891 |
</td>
|
1892 |
</tr>
|
1893 |
|
1894 |
+
<tr>
|
1895 |
+
<th scope="row" style="text-align:right; vertical-align:top;">
|
1896 |
+
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_cap_cats_tip');">
|
1897 |
+
<?php _e('Capitalize Category Titles:', 'all_in_one_seo_pack')?>
|
1898 |
+
</a>
|
1899 |
+
</td>
|
1900 |
+
<td>
|
1901 |
+
<input type="checkbox" name="aiosp_cap_cats" <?php if ($aioseop_options['aiosp_cap_cats']) echo "checked=\"1\""; ?>/>
|
1902 |
+
<div style="max-width:500px; text-align:left; display:none" id="aiosp_cap_cats_tip">
|
1903 |
+
<?php
|
1904 |
+
_e("Check this and Category Titles will have the first letter of each word capitalized.", 'all_in_one_seo_pack');
|
1905 |
+
?>
|
1906 |
+
</div>
|
1907 |
+
</td>
|
1908 |
+
</tr>
|
1909 |
+
|
1910 |
<tr>
|
1911 |
<th scope="row" style="text-align:right; vertical-align:top;">
|
1912 |
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_meta_tags_tip');">
|
all_in_one_seo_pack.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: All in One SEO Pack
|
5 |
Plugin URI: http://semperfiwebdesign.com
|
6 |
Description: Out-of-the-box SEO for your Wordpress blog. <a href="options-general.php?page=all-in-one-seo-pack/aioseop.class.php">Options configuration panel</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">Donate</a> | <a href="http://semperfiwebdesign.com/forum/" >Support</a> | <a href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank" title="Amazon Wish List">Amazon Wishlist</a>
|
7 |
-
Version: 1.6.
|
8 |
Author: Michael Torbert
|
9 |
Author URI: http://michaeltorbert.com
|
10 |
*/
|
@@ -554,10 +554,12 @@ echo "<div class='updated fade' style='background-color:green;border-color:green
|
|
554 |
}
|
555 |
|
556 |
function aioseop_get_version(){
|
557 |
-
return '1.6.
|
558 |
}
|
559 |
|
560 |
|
|
|
|
|
561 |
function aioseop_mrt_mkarry() {
|
562 |
$naioseop_options = array(
|
563 |
"aiosp_can"=>1,
|
@@ -581,6 +583,7 @@ $naioseop_options = array(
|
|
581 |
"aiosp_category_noindex"=>1,
|
582 |
"aiosp_archive_noindex"=>1,
|
583 |
"aiosp_tags_noindex"=>0,
|
|
|
584 |
"aiosp_generate_descriptions"=>1,
|
585 |
"aiosp_debug_info"=>null,
|
586 |
"aiosp_post_meta_tags"=>'',
|
4 |
Plugin Name: All in One SEO Pack
|
5 |
Plugin URI: http://semperfiwebdesign.com
|
6 |
Description: Out-of-the-box SEO for your Wordpress blog. <a href="options-general.php?page=all-in-one-seo-pack/aioseop.class.php">Options configuration panel</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">Donate</a> | <a href="http://semperfiwebdesign.com/forum/" >Support</a> | <a href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank" title="Amazon Wish List">Amazon Wishlist</a>
|
7 |
+
Version: 1.6.3
|
8 |
Author: Michael Torbert
|
9 |
Author URI: http://michaeltorbert.com
|
10 |
*/
|
554 |
}
|
555 |
|
556 |
function aioseop_get_version(){
|
557 |
+
return '1.6.3';
|
558 |
}
|
559 |
|
560 |
|
561 |
+
|
562 |
+
|
563 |
function aioseop_mrt_mkarry() {
|
564 |
$naioseop_options = array(
|
565 |
"aiosp_can"=>1,
|
583 |
"aiosp_category_noindex"=>1,
|
584 |
"aiosp_archive_noindex"=>1,
|
585 |
"aiosp_tags_noindex"=>0,
|
586 |
+
"aiosp_cap_cats"=>1,
|
587 |
"aiosp_generate_descriptions"=>1,
|
588 |
"aiosp_debug_info"=>null,
|
589 |
"aiosp_post_meta_tags"=>'',
|
trunk/aioseop.class.php
DELETED
@@ -1,1975 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class All_in_One_SEO_Pack {
|
4 |
-
|
5 |
-
var $version = "1.6.2";
|
6 |
-
|
7 |
-
/** Max numbers of chars in auto-generated description */
|
8 |
-
var $maximum_description_length = 160;
|
9 |
-
|
10 |
-
/** Minimum number of chars an excerpt should be so that it can be used
|
11 |
-
* as description. Touch only if you know what you're doing
|
12 |
-
*/
|
13 |
-
var $minimum_description_length = 1;
|
14 |
-
|
15 |
-
var $ob_start_detected = false;
|
16 |
-
|
17 |
-
var $title_start = -1;
|
18 |
-
|
19 |
-
var $title_end = -1;
|
20 |
-
|
21 |
-
/** The title before rewriting */
|
22 |
-
var $orig_title = '';
|
23 |
-
|
24 |
-
/** Temp filename for the latest version. */
|
25 |
-
// var $upgrade_filename = 'temp.zip';
|
26 |
-
|
27 |
-
/** Where to extract the downloaded newest version. */
|
28 |
-
// var $upgrade_folder;
|
29 |
-
|
30 |
-
/** Any error in upgrading. */
|
31 |
-
// var $upgrade_error;
|
32 |
-
|
33 |
-
/** Which zip to download in order to upgrade .*/
|
34 |
-
// var $upgrade_url = 'http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip';
|
35 |
-
|
36 |
-
/** Filename of log file. */
|
37 |
-
var $log_file;
|
38 |
-
|
39 |
-
/** Flag whether there should be logging. */
|
40 |
-
var $do_log;
|
41 |
-
|
42 |
-
var $wp_version;
|
43 |
-
|
44 |
-
var $aioseop_op;
|
45 |
-
//var $aioseop_options = get_option('aioseop_options');
|
46 |
-
|
47 |
-
function All_in_One_SEO_Pack() {
|
48 |
-
global $wp_version;
|
49 |
-
global $aioseop_options;
|
50 |
-
$this->wp_version = $wp_version;
|
51 |
-
|
52 |
-
$this->log_file = dirname(__FILE__) . '/all_in_one_seo_pack.log';
|
53 |
-
if ($aioseop_options['aiosp_do_log']) {
|
54 |
-
$this->do_log = true;
|
55 |
-
} else {
|
56 |
-
$this->do_log = false;
|
57 |
-
}
|
58 |
-
|
59 |
-
// $this->upgrade_filename = dirname(__FILE__) . '/' . $this->upgrade_filename;
|
60 |
-
// $this->upgrade_folder = dirname(__FILE__);
|
61 |
-
}
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Convert a string to lower case
|
65 |
-
* Compatible with mb_strtolower(), an UTF-8 friendly replacement for strtolower()
|
66 |
-
*/
|
67 |
-
function strtolower($str) {
|
68 |
-
global $UTF8_TABLES;
|
69 |
-
return strtr($str, $UTF8_TABLES['strtolower']);
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Convert a string to upper case
|
74 |
-
* Compatible with mb_strtoupper(), an UTF-8 friendly replacement for strtoupper()
|
75 |
-
*/
|
76 |
-
function strtoupper($str) {
|
77 |
-
global $UTF8_TABLES;
|
78 |
-
return strtr($str, $UTF8_TABLES['strtoupper']);
|
79 |
-
}
|
80 |
-
|
81 |
-
|
82 |
-
function template_redirect() {
|
83 |
-
global $wp_query;
|
84 |
-
global $aioseop_options;
|
85 |
-
|
86 |
-
$post = $wp_query->get_queried_object();
|
87 |
-
|
88 |
-
if (is_feed()) {
|
89 |
-
return;
|
90 |
-
}
|
91 |
-
|
92 |
-
if (is_single() || is_page()) {
|
93 |
-
$aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, '_aioseop_disable', true)));
|
94 |
-
if ($aiosp_disable) {
|
95 |
-
return;
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
if ($aioseop_options['aiosp_rewrite_titles']) {
|
100 |
-
ob_start(array($this, 'output_callback_for_title'));
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
function output_callback_for_title($content) {
|
105 |
-
return $this->rewrite_title($content);
|
106 |
-
}
|
107 |
-
|
108 |
-
function init() {
|
109 |
-
if (function_exists('load_plugin_textdomain')) {
|
110 |
-
if ( !defined('WP_PLUGIN_DIR') ) {
|
111 |
-
load_plugin_textdomain('all_in_one_seo_pack', str_replace( ABSPATH, '', dirname(__FILE__)));
|
112 |
-
} else {
|
113 |
-
load_plugin_textdomain('all_in_one_seo_pack', false, dirname(plugin_basename(__FILE__)));
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
|
118 |
-
/*
|
119 |
-
if (function_exists('load_plugin_textdomain')) {
|
120 |
-
load_plugin_textdomain('all_in_one_seo_pack', WP_PLUGIN_DIR . '/all-in-one-seo-pack');
|
121 |
-
}
|
122 |
-
*/
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
function is_static_front_page() {
|
127 |
-
global $wp_query;
|
128 |
-
global $aioseop_options;
|
129 |
-
$post = $wp_query->get_queried_object();
|
130 |
-
return get_option('show_on_front') == 'page' && is_page() && $post->ID == get_option('page_on_front');
|
131 |
-
}
|
132 |
-
|
133 |
-
function is_static_posts_page() {
|
134 |
-
global $wp_query;
|
135 |
-
$post = $wp_query->get_queried_object();
|
136 |
-
return get_option('show_on_front') == 'page' && is_home() && $post->ID == get_option('page_for_posts');
|
137 |
-
}
|
138 |
-
|
139 |
-
function get_base() {
|
140 |
-
return '/'.end(explode('/', str_replace(array('\\','/all_in_one_seo_pack.php'),array('/',''),__FILE__)));
|
141 |
-
}
|
142 |
-
|
143 |
-
function seo_mrt_admin_head() {
|
144 |
-
$home = get_settings('siteurl');
|
145 |
-
$stylesheet = WP_PLUGIN_URL . '/all-in-one-seo-pack/style.css';
|
146 |
-
echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
|
147 |
-
}
|
148 |
-
|
149 |
-
|
150 |
-
function wp_head() {
|
151 |
-
if (is_feed()) {
|
152 |
-
return;
|
153 |
-
}
|
154 |
-
|
155 |
-
global $wp_query;
|
156 |
-
global $aioseop_options;
|
157 |
-
$post = $wp_query->get_queried_object();
|
158 |
-
$meta_string = null;
|
159 |
-
if($this->is_static_posts_page()){
|
160 |
-
$title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) );
|
161 |
-
|
162 |
-
}
|
163 |
-
//echo("wp_head() " . wp_title('', false) . " is_home() => " . is_home() . ", is_page() => " . is_page() . ", is_single() => " . is_single() . ", is_static_front_page() => " . $this->is_static_front_page() . ", is_static_posts_page() => " . $this->is_static_posts_page());
|
164 |
-
|
165 |
-
if (is_single() || is_page()) {
|
166 |
-
$aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post->ID, '_aioseop_disable', true)));
|
167 |
-
if ($aiosp_disable) {
|
168 |
-
return;
|
169 |
-
}
|
170 |
-
}
|
171 |
-
|
172 |
-
if ($aioseop_options['aiosp_rewrite_titles']) {
|
173 |
-
// make the title rewrite as short as possible
|
174 |
-
if (function_exists('ob_list_handlers')) {
|
175 |
-
$active_handlers = ob_list_handlers();
|
176 |
-
} else {
|
177 |
-
$active_handlers = array();
|
178 |
-
}
|
179 |
-
if (sizeof($active_handlers) > 0 &&
|
180 |
-
strtolower($active_handlers[sizeof($active_handlers) - 1]) ==
|
181 |
-
strtolower('All_in_One_SEO_Pack::output_callback_for_title')) {
|
182 |
-
ob_end_flush();
|
183 |
-
} else {
|
184 |
-
$this->log("another plugin interfering?");
|
185 |
-
// if we get here there *could* be trouble with another plugin :(
|
186 |
-
$this->ob_start_detected = true;
|
187 |
-
if (function_exists('ob_list_handlers')) {
|
188 |
-
foreach (ob_list_handlers() as $handler) {
|
189 |
-
$this->log("detected output handler $handler");
|
190 |
-
}
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
|
195 |
-
echo "\n<!-- All in One SEO Pack $this->version by Michael Torbert of Semper Fi Web Design";
|
196 |
-
if ($this->ob_start_detected) {
|
197 |
-
echo "ob_start_detected ";
|
198 |
-
}
|
199 |
-
echo "[$this->title_start,$this->title_end] ";
|
200 |
-
echo "-->\n";
|
201 |
-
if ((is_home() && $aioseop_options['aiosp_home_keywords'] && !$this->is_static_posts_page()) || $this->is_static_front_page()) {
|
202 |
-
$keywords = trim($this->internationalize($aioseop_options['aiosp_home_keywords']));
|
203 |
-
} elseif($this->is_static_posts_page() && !$aioseop_options['aiosp_dynamic_postspage_keywords']){ // and if option = use page set keywords instead of keywords from recent posts
|
204 |
-
//$keywords = "posts keyyysss" . stripcslashes(get_post_meta($post->ID,'keywords',true));
|
205 |
-
$keywords = stripcslashes($this->internationalize(get_post_meta($post->ID, "_aioseop_keywords", true)));
|
206 |
-
|
207 |
-
// $keywords = $this->get_unique_keywords($keywords);
|
208 |
-
|
209 |
-
}else {
|
210 |
-
$keywords = $this->get_all_keywords();
|
211 |
-
}
|
212 |
-
if (is_single() || is_page() || $this->is_static_posts_page()) {
|
213 |
-
if ($this->is_static_front_page()) {
|
214 |
-
$description = trim(stripcslashes($this->internationalize($aioseop_options['aiosp_home_description'])));
|
215 |
-
} else {
|
216 |
-
$description = $this->get_post_description($post);
|
217 |
-
$description = apply_filters('aioseop_description',$description);
|
218 |
-
}
|
219 |
-
} else if (is_home()) {
|
220 |
-
$description = trim(stripcslashes($this->internationalize($aioseop_options['aiosp_home_description'])));
|
221 |
-
} else if (is_category()) {
|
222 |
-
$description = $this->internationalize(category_description());
|
223 |
-
}
|
224 |
-
|
225 |
-
if (isset($description) && (strlen($description) > $this->minimum_description_length) && !(is_home() && is_paged())) {
|
226 |
-
$description = trim(strip_tags($description));
|
227 |
-
$description = str_replace('"', '', $description);
|
228 |
-
|
229 |
-
// replace newlines on mac / windows?
|
230 |
-
$description = str_replace("\r\n", ' ', $description);
|
231 |
-
|
232 |
-
// maybe linux uses this alone
|
233 |
-
$description = str_replace("\n", ' ', $description);
|
234 |
-
|
235 |
-
if (isset($meta_string)) {
|
236 |
-
//$meta_string .= "\n";
|
237 |
-
} else {
|
238 |
-
$meta_string = '';
|
239 |
-
}
|
240 |
-
|
241 |
-
// description format
|
242 |
-
$description_format = $aioseop_options['aiosp_description_format'];
|
243 |
-
if (!isset($description_format) || empty($description_format)) {
|
244 |
-
$description_format = "%description%";
|
245 |
-
}
|
246 |
-
$description = str_replace('%description%', $description, $description_format);
|
247 |
-
$description = str_replace('%blog_title%', get_bloginfo('name'), $description);
|
248 |
-
$description = str_replace('%blog_description%', get_bloginfo('description'), $description);
|
249 |
-
$description = str_replace('%wp_title%', $this->get_original_title(), $description);
|
250 |
-
//$description = html_entity_decode($description, ENT_COMPAT, get_bloginfo('charset'));
|
251 |
-
if($aioseop_options['aiosp_can'] && is_attachment()){
|
252 |
-
$url = $this->aiosp_mrt_get_url($wp_query);
|
253 |
-
if ($url) {
|
254 |
-
preg_match_all('/(\d+)/', $url, $matches);
|
255 |
-
if (is_array($matches)){
|
256 |
-
$uniqueDesc = join('',$matches[0]);
|
257 |
-
}
|
258 |
-
}
|
259 |
-
$description .= ' ' . $uniqueDesc;
|
260 |
-
}
|
261 |
-
$meta_string .= sprintf("<meta name=\"description\" content=\"%s\" />", $description);
|
262 |
-
}
|
263 |
-
$keywords = apply_filters('aioseop_keywords',$keywords);
|
264 |
-
if (isset ($keywords) && !empty($keywords) && !(is_home() && is_paged())) {
|
265 |
-
if (isset($meta_string)) {
|
266 |
-
$meta_string .= "\n";
|
267 |
-
}
|
268 |
-
$meta_string .= sprintf("<meta name=\"keywords\" content=\"%s\" />", $keywords);
|
269 |
-
}
|
270 |
-
|
271 |
-
if (function_exists('is_tag')) {
|
272 |
-
$is_tag = is_tag();
|
273 |
-
}
|
274 |
-
|
275 |
-
if ((is_category() && $aioseop_options['aiosp_category_noindex']) ||
|
276 |
-
(!is_category() && is_archive() &&!$is_tag && $aioseop_options['aiosp_archive_noindex']) ||
|
277 |
-
($aioseop_options['aiosp_tags_noindex'] && $is_tag)) {
|
278 |
-
if (isset($meta_string)) {
|
279 |
-
$meta_string .= "\n";
|
280 |
-
}
|
281 |
-
$meta_string .= '<meta name="robots" content="noindex,follow" />';
|
282 |
-
}
|
283 |
-
|
284 |
-
$page_meta = stripcslashes($aioseop_options['aiosp_page_meta_tags']);
|
285 |
-
$post_meta = stripcslashes($aioseop_options['aiosp_post_meta_tags']);
|
286 |
-
$home_meta = stripcslashes($aioseop_options['aiosp_home_meta_tags']);
|
287 |
-
if (is_page() && isset($page_meta) && !empty($page_meta) || $this->is_static_posts_page()) {
|
288 |
-
if (isset($meta_string)) {
|
289 |
-
$meta_string .= "\n";
|
290 |
-
}
|
291 |
-
echo "\n$page_meta";
|
292 |
-
}
|
293 |
-
|
294 |
-
if (is_single() && isset($post_meta) && !empty($post_meta)) {
|
295 |
-
if (isset($meta_string)) {
|
296 |
-
$meta_string .= "\n";
|
297 |
-
}
|
298 |
-
$meta_string .= "$post_meta";
|
299 |
-
}
|
300 |
-
|
301 |
-
if (is_home() && !empty($home_meta)) {
|
302 |
-
if (isset($meta_string)) {
|
303 |
-
$meta_string .= "\n";
|
304 |
-
}
|
305 |
-
$meta_string .= "$home_meta";
|
306 |
-
}
|
307 |
-
|
308 |
-
if ($meta_string != null) {
|
309 |
-
echo "$meta_string\n";
|
310 |
-
}
|
311 |
-
|
312 |
-
if($aioseop_options['aiosp_can']){
|
313 |
-
$url = $this->aiosp_mrt_get_url($wp_query);
|
314 |
-
if ($url) {
|
315 |
-
$url = apply_filters('aioseop_canonical_url',$url);
|
316 |
-
|
317 |
-
echo "".'<link rel="canonical" href="'.$url.'" />'."\n";
|
318 |
-
}
|
319 |
-
}
|
320 |
-
|
321 |
-
echo "<!-- /all in one seo pack -->\n";
|
322 |
-
}
|
323 |
-
|
324 |
-
// Thank you, Yoast de Valk, for much of this code.
|
325 |
-
|
326 |
-
function aiosp_mrt_get_url($query) {
|
327 |
-
global $aioseop_options;
|
328 |
-
if ($query->is_404 || $query->is_search) {
|
329 |
-
return false;
|
330 |
-
}
|
331 |
-
$haspost = count($query->posts) > 0;
|
332 |
-
$has_ut = function_exists('user_trailingslashit');
|
333 |
-
|
334 |
-
if (get_query_var('m')) {
|
335 |
-
$m = preg_replace('/[^0-9]/', '', get_query_var('m'));
|
336 |
-
switch (strlen($m)) {
|
337 |
-
case 4:
|
338 |
-
$link = get_year_link($m);
|
339 |
-
break;
|
340 |
-
case 6:
|
341 |
-
$link = get_month_link(substr($m, 0, 4), substr($m, 4, 2));
|
342 |
-
break;
|
343 |
-
case 8:
|
344 |
-
$link = get_day_link(substr($m, 0, 4), substr($m, 4, 2),
|
345 |
-
substr($m, 6, 2));
|
346 |
-
break;
|
347 |
-
default:
|
348 |
-
return false;
|
349 |
-
}
|
350 |
-
} elseif (($query->is_single || $query->is_page) && $haspost) {
|
351 |
-
$post = $query->posts[0];
|
352 |
-
$link = get_permalink($post->ID);
|
353 |
-
$link = $this->yoast_get_paged($link);
|
354 |
-
/* if ($page && $page > 1) {
|
355 |
-
$link = trailingslashit($link) . "page/". "$page";
|
356 |
-
if ($has_ut) {
|
357 |
-
$link = user_trailingslashit($link, 'paged');
|
358 |
-
} else {
|
359 |
-
$link .= '/';
|
360 |
-
}
|
361 |
-
}
|
362 |
-
if ($query->is_page && ('page' == get_option('show_on_front')) &&
|
363 |
-
$post->ID == get_option('page_on_front'))
|
364 |
-
{
|
365 |
-
$link = trailingslashit($link);
|
366 |
-
}*/
|
367 |
-
} elseif ($query->is_author && $haspost) {
|
368 |
-
global $wp_version;
|
369 |
-
if ($wp_version >= '2') {
|
370 |
-
$author = get_userdata(get_query_var('author'));
|
371 |
-
if ($author === false)
|
372 |
-
return false;
|
373 |
-
$link = get_author_link(false, $author->ID,
|
374 |
-
$author->user_nicename);
|
375 |
-
} else {
|
376 |
-
global $cache_userdata;
|
377 |
-
$userid = get_query_var('author');
|
378 |
-
$link = get_author_link(false, $userid,
|
379 |
-
$cache_userdata[$userid]->user_nicename);
|
380 |
-
}
|
381 |
-
} elseif ($query->is_category && $haspost) {
|
382 |
-
$link = get_category_link(get_query_var('cat'));
|
383 |
-
$link = $this->yoast_get_paged($link);
|
384 |
-
} else if ($query->is_tag && $haspost) {
|
385 |
-
$tag = get_term_by('slug',get_query_var('tag'),'post_tag');
|
386 |
-
if (!empty($tag->term_id)) {
|
387 |
-
$link = get_tag_link($tag->term_id);
|
388 |
-
}
|
389 |
-
$link = $this->yoast_get_paged($link);
|
390 |
-
} elseif ($query->is_day && $haspost) {
|
391 |
-
$link = get_day_link(get_query_var('year'),
|
392 |
-
get_query_var('monthnum'),
|
393 |
-
get_query_var('day'));
|
394 |
-
} elseif ($query->is_month && $haspost) {
|
395 |
-
$link = get_month_link(get_query_var('year'),
|
396 |
-
get_query_var('monthnum'));
|
397 |
-
} elseif ($query->is_year && $haspost) {
|
398 |
-
$link = get_year_link(get_query_var('year'));
|
399 |
-
} elseif ($query->is_home) {
|
400 |
-
if ((get_option('show_on_front') == 'page') &&
|
401 |
-
($pageid = get_option('page_for_posts')))
|
402 |
-
{
|
403 |
-
$link = get_permalink($pageid);
|
404 |
-
$link = $this->yoast_get_paged($link);
|
405 |
-
$link = trailingslashit($link);
|
406 |
-
} else {
|
407 |
-
$link = get_option('home');
|
408 |
-
$link = $this->yoast_get_paged($link);
|
409 |
-
$link = trailingslashit($link); }
|
410 |
-
} else {
|
411 |
-
return false;
|
412 |
-
}
|
413 |
-
|
414 |
-
return $link;
|
415 |
-
|
416 |
-
}
|
417 |
-
|
418 |
-
|
419 |
-
function yoast_get_paged($link) {
|
420 |
-
$page = get_query_var('paged');
|
421 |
-
if ($page && $page > 1) {
|
422 |
-
$link = trailingslashit($link) ."page/". "$page";
|
423 |
-
if ($has_ut) {
|
424 |
-
$link = user_trailingslashit($link, 'paged');
|
425 |
-
} else {
|
426 |
-
$link .= '/';
|
427 |
-
}
|
428 |
-
}
|
429 |
-
return $link;
|
430 |
-
}
|
431 |
-
|
432 |
-
|
433 |
-
function get_post_description($post) {
|
434 |
-
global $aioseop_options;
|
435 |
-
$description = trim(stripcslashes($this->internationalize(get_post_meta($post->ID, "_aioseop_description", true))));
|
436 |
-
if (!$description) {
|
437 |
-
$description = $this->trim_excerpt_without_filters_full_length($this->internationalize($post->post_excerpt));
|
438 |
-
if (!$description && $aioseop_options["aiosp_generate_descriptions"]) {
|
439 |
-
$description = $this->trim_excerpt_without_filters($this->internationalize($post->post_content));
|
440 |
-
}
|
441 |
-
}
|
442 |
-
|
443 |
-
// "internal whitespace trim"
|
444 |
-
$description = preg_replace("/\s\s+/", " ", $description);
|
445 |
-
|
446 |
-
return $description;
|
447 |
-
}
|
448 |
-
|
449 |
-
function replace_title($content, $title) {
|
450 |
-
$title = trim(strip_tags($title));
|
451 |
-
|
452 |
-
$title_tag_start = "<title>";
|
453 |
-
$title_tag_end = "</title>";
|
454 |
-
$len_start = strlen($title_tag_start);
|
455 |
-
$len_end = strlen($title_tag_end);
|
456 |
-
$title = stripcslashes(trim($title));
|
457 |
-
$start = strpos($content, $title_tag_start);
|
458 |
-
$end = strpos($content, $title_tag_end);
|
459 |
-
|
460 |
-
$this->title_start = $start;
|
461 |
-
$this->title_end = $end;
|
462 |
-
$this->orig_title = $title;
|
463 |
-
|
464 |
-
if ($start && $end) {
|
465 |
-
$header = substr($content, 0, $start + $len_start) . $title . substr($content, $end);
|
466 |
-
} else {
|
467 |
-
// this breaks some sitemap plugins (like wpg2)
|
468 |
-
//$header = $content . "<title>$title</title>";
|
469 |
-
|
470 |
-
$header = $content;
|
471 |
-
}
|
472 |
-
|
473 |
-
return $header;
|
474 |
-
}
|
475 |
-
|
476 |
-
function internationalize($in) {
|
477 |
-
if (function_exists('langswitch_filter_langs_with_message')) {
|
478 |
-
$in = langswitch_filter_langs_with_message($in);
|
479 |
-
}
|
480 |
-
if (function_exists('polyglot_filter')) {
|
481 |
-
$in = polyglot_filter($in);
|
482 |
-
}
|
483 |
-
if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
|
484 |
-
$in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($in);
|
485 |
-
}
|
486 |
-
$in = apply_filters('localization', $in);
|
487 |
-
return $in;
|
488 |
-
}
|
489 |
-
|
490 |
-
/** @return The original title as delivered by WP (well, in most cases) */
|
491 |
-
function get_original_title() {
|
492 |
-
global $wp_query;
|
493 |
-
if (!$wp_query) {
|
494 |
-
return null;
|
495 |
-
}
|
496 |
-
|
497 |
-
$post = $wp_query->get_queried_object();
|
498 |
-
|
499 |
-
// the_search_query() is not suitable, it cannot just return
|
500 |
-
global $s;
|
501 |
-
|
502 |
-
$title = null;
|
503 |
-
|
504 |
-
if (is_home()) {
|
505 |
-
$title = get_option('blogname');
|
506 |
-
} else if (is_single()) {
|
507 |
-
$title = $this->internationalize(wp_title('', false));
|
508 |
-
} else if (is_search() && isset($s) && !empty($s)) {
|
509 |
-
if (function_exists('attribute_escape')) {
|
510 |
-
$search = attribute_escape(stripcslashes($s));
|
511 |
-
} else {
|
512 |
-
$search = wp_specialchars(stripcslashes($s), true);
|
513 |
-
}
|
514 |
-
$search = $this->capitalize($search);
|
515 |
-
$title = $search;
|
516 |
-
} else if (is_category() && !is_feed()) {
|
517 |
-
$category_description = $this->internationalize(category_description());
|
518 |
-
$category_name = ucwords($this->internationalize(single_cat_title('', false)));
|
519 |
-
$title = $category_name;
|
520 |
-
} else if (is_page()) {
|
521 |
-
$title = $this->internationalize(wp_title('', false));
|
522 |
-
} else if (function_exists('is_tag') && is_tag()) {
|
523 |
-
global $utw;
|
524 |
-
if ($utw) {
|
525 |
-
$tags = $utw->GetCurrentTagSet();
|
526 |
-
$tag = $tags[0]->tag;
|
527 |
-
$tag = str_replace('-', ' ', $tag);
|
528 |
-
} else {
|
529 |
-
// wordpress > 2.3
|
530 |
-
$tag = $this->internationalize(wp_title('', false));
|
531 |
-
}
|
532 |
-
if ($tag) {
|
533 |
-
$title = $tag;
|
534 |
-
}
|
535 |
-
} else if (is_archive()) {
|
536 |
-
$title = $this->internationalize(wp_title('', false));
|
537 |
-
} else if (is_404()) {
|
538 |
-
$title_format = $aioseop_options['aiosp_404_title_format'];
|
539 |
-
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
540 |
-
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
541 |
-
$new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
|
542 |
-
$new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
|
543 |
-
$title = $new_title;
|
544 |
-
}
|
545 |
-
|
546 |
-
return trim($title);
|
547 |
-
}
|
548 |
-
|
549 |
-
function paged_title($title) {
|
550 |
-
// the page number if paged
|
551 |
-
global $paged;
|
552 |
-
|
553 |
-
// simple tagging support
|
554 |
-
global $STagging;
|
555 |
-
|
556 |
-
if (is_paged() || (isset($STagging) && $STagging->is_tag_view() && $paged)) {
|
557 |
-
$part = $this->internationalize($aioseop_options['aiosp_paged_format']);
|
558 |
-
if (isset($part) || !empty($part)) {
|
559 |
-
$part = " " . trim($part);
|
560 |
-
$part = str_replace('%page%', $paged, $part);
|
561 |
-
$this->log("paged_title() [$title] [$part]");
|
562 |
-
$title .= $part;
|
563 |
-
}
|
564 |
-
}
|
565 |
-
return $title;
|
566 |
-
}
|
567 |
-
|
568 |
-
function rewrite_title($header) {
|
569 |
-
global $aioseop_options;
|
570 |
-
global $wp_query;
|
571 |
-
if (!$wp_query) {
|
572 |
-
$header .= "<!-- no wp_query found! -->\n";
|
573 |
-
return $header;
|
574 |
-
}
|
575 |
-
|
576 |
-
$post = $wp_query->get_queried_object();
|
577 |
-
|
578 |
-
// the_search_query() is not suitable, it cannot just return
|
579 |
-
global $s;
|
580 |
-
|
581 |
-
global $STagging;
|
582 |
-
|
583 |
-
if (is_home() && !$this->is_static_posts_page()) {
|
584 |
-
$title = $this->internationalize($aioseop_options['aiosp_home_title']);
|
585 |
-
if (empty($title)) {
|
586 |
-
$title = $this->internationalize(get_option('blogname'));
|
587 |
-
}
|
588 |
-
$title = $this->paged_title($title);
|
589 |
-
$header = $this->replace_title($header, $title);
|
590 |
-
} else if (is_attachment()) {
|
591 |
-
$title = get_the_title($post->post_parent).' '.$post->post_title.' – '.get_option('blogname');
|
592 |
-
$header = $this->replace_title($header,$title);
|
593 |
-
} else if (is_single()) {
|
594 |
-
// we're not in the loop :(
|
595 |
-
$authordata = get_userdata($post->post_author);
|
596 |
-
$categories = get_the_category();
|
597 |
-
$category = '';
|
598 |
-
if (count($categories) > 0) {
|
599 |
-
$category = $categories[0]->cat_name;
|
600 |
-
}
|
601 |
-
$title = $this->internationalize(get_post_meta($post->ID, "_aioseop_title", true));
|
602 |
-
if (!$title) {
|
603 |
-
$title = $this->internationalize(get_post_meta($post->ID, "title_tag", true));
|
604 |
-
if (!$title) {
|
605 |
-
$title = $this->internationalize(wp_title('', false));
|
606 |
-
}
|
607 |
-
}
|
608 |
-
$title_format = $aioseop_options['aiosp_post_title_format'];
|
609 |
-
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
610 |
-
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
611 |
-
$new_title = str_replace('%post_title%', $title, $new_title);
|
612 |
-
$new_title = str_replace('%category%', $category, $new_title);
|
613 |
-
$new_title = str_replace('%category_title%', $category, $new_title);
|
614 |
-
$new_title = str_replace('%post_author_login%', $authordata->user_login, $new_title);
|
615 |
-
$new_title = str_replace('%post_author_nicename%', $authordata->user_nicename, $new_title);
|
616 |
-
$new_title = str_replace('%post_author_firstname%', ucwords($authordata->first_name), $new_title);
|
617 |
-
$new_title = str_replace('%post_author_lastname%', ucwords($authordata->last_name), $new_title);
|
618 |
-
$title = $new_title;
|
619 |
-
$title = trim($title);
|
620 |
-
$title = apply_filters('aioseop_title_single',$title);
|
621 |
-
$header = $this->replace_title($header, $title);
|
622 |
-
} else if (is_search() && isset($s) && !empty($s)) {
|
623 |
-
if (function_exists('attribute_escape')) {
|
624 |
-
$search = attribute_escape(stripcslashes($s));
|
625 |
-
} else {
|
626 |
-
$search = wp_specialchars(stripcslashes($s), true);
|
627 |
-
}
|
628 |
-
$search = $this->capitalize($search);
|
629 |
-
$title_format = $aioseop_options['aiosp_search_title_format'];
|
630 |
-
$title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
631 |
-
$title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
|
632 |
-
$title = str_replace('%search%', $search, $title);
|
633 |
-
$header = $this->replace_title($header, $title);
|
634 |
-
} else if (is_category() && !is_feed()) {
|
635 |
-
$category_description = $this->internationalize(category_description());
|
636 |
-
$category_name = ucwords($this->internationalize(single_cat_title('', false)));
|
637 |
-
$title_format = $aioseop_options['aiosp_category_title_format'];
|
638 |
-
$title = str_replace('%category_title%', $category_name, $title_format);
|
639 |
-
$title = str_replace('%category_description%', $category_description, $title);
|
640 |
-
$title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title);
|
641 |
-
$title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
|
642 |
-
$title = $this->paged_title($title);
|
643 |
-
$header = $this->replace_title($header, $title);
|
644 |
-
} else if (is_page() || $this->is_static_posts_page()) {
|
645 |
-
// we're not in the loop :(
|
646 |
-
$authordata = get_userdata($post->post_author);
|
647 |
-
if ($this->is_static_front_page()) {
|
648 |
-
if ($this->internationalize($aioseop_options['aiosp_home_title'])) {
|
649 |
-
$header = $this->replace_title($header, $this->internationalize($aioseop_options['aiosp_home_title']));
|
650 |
-
}
|
651 |
-
} else {
|
652 |
-
$title = $this->internationalize(get_post_meta($post->ID, "_aioseop_title", true));
|
653 |
-
if (!$title) {
|
654 |
-
$title = $this->internationalize(wp_title('', false));
|
655 |
-
}
|
656 |
-
$title_format = $aioseop_options['aiosp_page_title_format'];
|
657 |
-
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
658 |
-
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
659 |
-
$new_title = str_replace('%page_title%', $title, $new_title);
|
660 |
-
$new_title = str_replace('%page_author_login%', $authordata->user_login, $new_title);
|
661 |
-
$new_title = str_replace('%page_author_nicename%', $authordata->user_nicename, $new_title);
|
662 |
-
$new_title = str_replace('%page_author_firstname%', ucwords($authordata->first_name), $new_title);
|
663 |
-
$new_title = str_replace('%page_author_lastname%', ucwords($authordata->last_name), $new_title);
|
664 |
-
$title = trim($new_title);
|
665 |
-
$title = apply_filters('aioseop_title_page',$title);
|
666 |
-
$header = $this->replace_title($header, $title);
|
667 |
-
}
|
668 |
-
} else if (function_exists('is_tag') && is_tag()) {
|
669 |
-
global $utw;
|
670 |
-
if ($utw) {
|
671 |
-
$tags = $utw->GetCurrentTagSet();
|
672 |
-
$tag = $tags[0]->tag;
|
673 |
-
$tag = str_replace('-', ' ', $tag);
|
674 |
-
} else {
|
675 |
-
// wordpress > 2.3
|
676 |
-
$tag = $this->internationalize(wp_title('', false));
|
677 |
-
}
|
678 |
-
if ($tag) {
|
679 |
-
$tag = $this->capitalize($tag);
|
680 |
-
$title_format = $aioseop_options['aiosp_tag_title_format'];
|
681 |
-
$title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
682 |
-
$title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
|
683 |
-
$title = str_replace('%tag%', $tag, $title);
|
684 |
-
$title = $this->paged_title($title);
|
685 |
-
$header = $this->replace_title($header, $title);
|
686 |
-
}
|
687 |
-
} else if (isset($STagging) && $STagging->is_tag_view()) { // simple tagging support
|
688 |
-
$tag = $STagging->search_tag;
|
689 |
-
if ($tag) {
|
690 |
-
$tag = $this->capitalize($tag);
|
691 |
-
$title_format = $aioseop_options['aiosp_tag_title_format'];
|
692 |
-
$title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
693 |
-
$title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $title);
|
694 |
-
$title = str_replace('%tag%', $tag, $title);
|
695 |
-
$title = $this->paged_title($title);
|
696 |
-
$header = $this->replace_title($header, $title);
|
697 |
-
}
|
698 |
-
} else if (is_archive()) {
|
699 |
-
$date = $this->internationalize(wp_title('', false));
|
700 |
-
$title_format = $aioseop_options['aiosp_archive_title_format'];
|
701 |
-
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
702 |
-
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
703 |
-
$new_title = str_replace('%date%', $date, $new_title);
|
704 |
-
$title = trim($new_title);
|
705 |
-
$title = $this->paged_title($title);
|
706 |
-
$header = $this->replace_title($header, $title);
|
707 |
-
} else if (is_404()) {
|
708 |
-
$title_format = $aioseop_options['aiosp_404_title_format'];
|
709 |
-
$new_title = str_replace('%blog_title%', $this->internationalize(get_bloginfo('name')), $title_format);
|
710 |
-
$new_title = str_replace('%blog_description%', $this->internationalize(get_bloginfo('description')), $new_title);
|
711 |
-
$new_title = str_replace('%request_url%', $_SERVER['REQUEST_URI'], $new_title);
|
712 |
-
$new_title = str_replace('%request_words%', $this->request_as_words($_SERVER['REQUEST_URI']), $new_title);
|
713 |
-
$new_title = str_replace('%404_title%', $this->internationalize(wp_title('', false)), $new_title);
|
714 |
-
$header = $this->replace_title($header, $new_title);
|
715 |
-
}
|
716 |
-
|
717 |
-
return $header;
|
718 |
-
|
719 |
-
}
|
720 |
-
|
721 |
-
/**
|
722 |
-
* @return User-readable nice words for a given request.
|
723 |
-
*/
|
724 |
-
function request_as_words($request) {
|
725 |
-
$request = htmlspecialchars($request);
|
726 |
-
$request = str_replace('.html', ' ', $request);
|
727 |
-
$request = str_replace('.htm', ' ', $request);
|
728 |
-
$request = str_replace('.', ' ', $request);
|
729 |
-
$request = str_replace('/', ' ', $request);
|
730 |
-
$request_a = explode(' ', $request);
|
731 |
-
$request_new = array();
|
732 |
-
foreach ($request_a as $token) {
|
733 |
-
$request_new[] = ucwords(trim($token));
|
734 |
-
}
|
735 |
-
$request = implode(' ', $request_new);
|
736 |
-
return $request;
|
737 |
-
}
|
738 |
-
|
739 |
-
function capitalize($s) {
|
740 |
-
$s = trim($s);
|
741 |
-
$tokens = explode(' ', $s);
|
742 |
-
while (list($key, $val) = each($tokens)) {
|
743 |
-
$tokens[$key] = trim($tokens[$key]);
|
744 |
-
$tokens[$key] = strtoupper(substr($tokens[$key], 0, 1)) . substr($tokens[$key], 1);
|
745 |
-
}
|
746 |
-
$s = implode(' ', $tokens);
|
747 |
-
return $s;
|
748 |
-
}
|
749 |
-
|
750 |
-
function trim_excerpt_without_filters($text) {
|
751 |
-
$text = str_replace(']]>', ']]>', $text);
|
752 |
-
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
|
753 |
-
$text = strip_tags($text);
|
754 |
-
$max = $this->maximum_description_length;
|
755 |
-
|
756 |
-
if ($max < strlen($text)) {
|
757 |
-
while($text[$max] != ' ' && $max > $this->minimum_description_length) {
|
758 |
-
$max--;
|
759 |
-
}
|
760 |
-
}
|
761 |
-
$text = substr($text, 0, $max);
|
762 |
-
return trim(stripcslashes($text));
|
763 |
-
}
|
764 |
-
|
765 |
-
function trim_excerpt_without_filters_full_length($text) {
|
766 |
-
$text = str_replace(']]>', ']]>', $text);
|
767 |
-
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
|
768 |
-
$text = strip_tags($text);
|
769 |
-
return trim(stripcslashes($text));
|
770 |
-
}
|
771 |
-
|
772 |
-
/**
|
773 |
-
* @return comma-separated list of unique keywords
|
774 |
-
*/
|
775 |
-
function get_all_keywords() {
|
776 |
-
global $posts;
|
777 |
-
global $aioseop_options;
|
778 |
-
|
779 |
-
if (is_404()) {
|
780 |
-
return null;
|
781 |
-
}
|
782 |
-
|
783 |
-
// if we are on synthetic pages
|
784 |
-
if (!is_home() && !is_page() && !is_single() &&!$this->is_static_front_page() && !$this->is_static_posts_page()) {
|
785 |
-
return null;
|
786 |
-
}
|
787 |
-
|
788 |
-
$keywords = array();
|
789 |
-
if (is_array($posts)) {
|
790 |
-
foreach ($posts as $post) {
|
791 |
-
if ($post) {
|
792 |
-
|
793 |
-
// custom field keywords
|
794 |
-
$keywords_a = $keywords_i = null;
|
795 |
-
$description_a = $description_i = null;
|
796 |
-
|
797 |
-
$id = (is_attachment())?($post->post_parent):($post->ID); // if attachment then use parent post id
|
798 |
-
$keywords_i = stripcslashes($this->internationalize(get_post_meta($id, "_aioseop_keywords", true)));
|
799 |
-
//$id = $post->ID;
|
800 |
-
//$keywords_i = stripcslashes($this->internationalize(get_post_meta($post->ID, "_aioseop_keywords", true)));
|
801 |
-
$keywords_i = str_replace('"', '', $keywords_i);
|
802 |
-
if (isset($keywords_i) && !empty($keywords_i)) {
|
803 |
-
$traverse = explode(',', $keywords_i);
|
804 |
-
foreach ($traverse as $keyword) {
|
805 |
-
$keywords[] = $keyword;
|
806 |
-
}
|
807 |
-
}
|
808 |
-
|
809 |
-
// WP 2.3 tags
|
810 |
-
if (function_exists('get_the_tags')) {
|
811 |
-
//$tags = get_the_tags($post->ID);
|
812 |
-
$tags = get_the_tags($id);
|
813 |
-
if ($tags && is_array($tags)) {
|
814 |
-
foreach ($tags as $tag) {
|
815 |
-
$keywords[] = $this->internationalize($tag->name);
|
816 |
-
}
|
817 |
-
}
|
818 |
-
}
|
819 |
-
|
820 |
-
// Ultimate Tag Warrior integration
|
821 |
-
global $utw;
|
822 |
-
if ($utw) {
|
823 |
-
$tags = $utw->GetTagsForPost($post);
|
824 |
-
if (is_array($tags)) {
|
825 |
-
foreach ($tags as $tag) {
|
826 |
-
$tag = $tag->tag;
|
827 |
-
$tag = str_replace('_',' ', $tag);
|
828 |
-
$tag = str_replace('-',' ',$tag);
|
829 |
-
$tag = stripcslashes($tag);
|
830 |
-
$keywords[] = $tag;
|
831 |
-
}
|
832 |
-
}
|
833 |
-
}
|
834 |
-
|
835 |
-
// autometa
|
836 |
-
$autometa = stripcslashes(get_post_meta($id, 'autometa', true));
|
837 |
-
//$autometa = stripcslashes(get_post_meta($post->ID, "autometa", true));
|
838 |
-
if (isset($autometa) && !empty($autometa)) {
|
839 |
-
$autometa_array = explode(' ', $autometa);
|
840 |
-
foreach ($autometa_array as $e) {
|
841 |
-
$keywords[] = $e;
|
842 |
-
}
|
843 |
-
}
|
844 |
-
|
845 |
-
if ($aioseop_options['aiosp_use_categories'] && !is_page()) {
|
846 |
-
$categories = get_the_category($id);
|
847 |
-
//$categories = get_the_category($post->ID);
|
848 |
-
foreach ($categories as $category) {
|
849 |
-
$keywords[] = $this->internationalize($category->cat_name);
|
850 |
-
}
|
851 |
-
}
|
852 |
-
|
853 |
-
}
|
854 |
-
}
|
855 |
-
}
|
856 |
-
|
857 |
-
return $this->get_unique_keywords($keywords);
|
858 |
-
}
|
859 |
-
|
860 |
-
function get_meta_keywords() {
|
861 |
-
global $posts;
|
862 |
-
|
863 |
-
$keywords = array();
|
864 |
-
if (is_array($posts)) {
|
865 |
-
foreach ($posts as $post) {
|
866 |
-
if ($post) {
|
867 |
-
// custom field keywords
|
868 |
-
$keywords_a = $keywords_i = null;
|
869 |
-
$description_a = $description_i = null;
|
870 |
-
$id = $post->ID;
|
871 |
-
$keywords_i = stripcslashes(get_post_meta($post->ID, "_aioseop_keywords", true));
|
872 |
-
$keywords_i = str_replace('"', '', $keywords_i);
|
873 |
-
if (isset($keywords_i) && !empty($keywords_i)) {
|
874 |
-
$keywords[] = $keywords_i;
|
875 |
-
}
|
876 |
-
}
|
877 |
-
}
|
878 |
-
}
|
879 |
-
|
880 |
-
return $this->get_unique_keywords($keywords);
|
881 |
-
}
|
882 |
-
|
883 |
-
function get_unique_keywords($keywords) {
|
884 |
-
$small_keywords = array();
|
885 |
-
foreach ($keywords as $word) {
|
886 |
-
if (function_exists('mb_strtolower'))
|
887 |
-
$small_keywords[] = mb_strtolower($word, get_bloginfo('charset'));
|
888 |
-
else
|
889 |
-
$small_keywords[] = $this->strtolower($word);
|
890 |
-
}
|
891 |
-
$keywords_ar = array_unique($small_keywords);
|
892 |
-
return implode(',', $keywords_ar);
|
893 |
-
}
|
894 |
-
|
895 |
-
function get_url($url) {
|
896 |
-
if (function_exists('file_get_contents')) {
|
897 |
-
$file = file_get_contents($url);
|
898 |
-
} else {
|
899 |
-
$curl = curl_init($url);
|
900 |
-
curl_setopt($curl, CURLOPT_HEADER, 0);
|
901 |
-
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
902 |
-
$file = curl_exec($curl);
|
903 |
-
curl_close($curl);
|
904 |
-
}
|
905 |
-
return $file;
|
906 |
-
}
|
907 |
-
|
908 |
-
function log($message) {
|
909 |
-
if ($this->do_log) {
|
910 |
-
error_log(date('Y-m-d H:i:s') . " " . $message . "\n", 3, $this->log_file);
|
911 |
-
}
|
912 |
-
}
|
913 |
-
|
914 |
-
function download_newest_version() {
|
915 |
-
$success = true;
|
916 |
-
$file_content = $this->get_url($this->upgrade_url);
|
917 |
-
if ($file_content === false) {
|
918 |
-
$this->upgrade_error = sprintf(__("Could not download distribution (%s)"), $this->upgrade_url);
|
919 |
-
$success = false;
|
920 |
-
} else if (strlen($file_content) < 100) {
|
921 |
-
$this->upgrade_error = sprintf(__("Could not download distribution (%s): %s"), $this->upgrade_url, $file_content);
|
922 |
-
$success = false;
|
923 |
-
} else {
|
924 |
-
$this->log(sprintf("filesize of download ZIP: %d", strlen($file_content)));
|
925 |
-
$fh = @fopen($this->upgrade_filename, 'w');
|
926 |
-
$this->log("fh is $fh");
|
927 |
-
if (!$fh) {
|
928 |
-
$this->upgrade_error = sprintf(__("Could not open %s for writing"), $this->upgrade_filename);
|
929 |
-
$this->upgrade_error .= "<br />";
|
930 |
-
$this->upgrade_error .= sprintf(__("Please make sure %s is writable"), $this->upgrade_folder);
|
931 |
-
$success = false;
|
932 |
-
} else {
|
933 |
-
$bytes_written = @fwrite($fh, $file_content);
|
934 |
-
$this->log("wrote $bytes_written bytes");
|
935 |
-
if (!$bytes_written) {
|
936 |
-
$this->upgrade_error = sprintf(__("Could not write to %s"), $this->upgrade_filename);
|
937 |
-
$success = false;
|
938 |
-
}
|
939 |
-
}
|
940 |
-
if ($success) {
|
941 |
-
fclose($fh);
|
942 |
-
}
|
943 |
-
}
|
944 |
-
return $success;
|
945 |
-
}
|
946 |
-
|
947 |
-
function install_newest_version() {
|
948 |
-
$success = $this->download_newest_version();
|
949 |
-
if ($success) {
|
950 |
-
$success = $this->extract_plugin();
|
951 |
-
unlink($this->upgrade_filename);
|
952 |
-
}
|
953 |
-
return $success;
|
954 |
-
}
|
955 |
-
|
956 |
-
function extract_plugin() {
|
957 |
-
if (!class_exists('PclZip')) {
|
958 |
-
require_once ('pclzip.lib.php');
|
959 |
-
}
|
960 |
-
$archive = new PclZip($this->upgrade_filename);
|
961 |
-
$files = $archive->extract(PCLZIP_OPT_STOP_ON_ERROR, PCLZIP_OPT_REPLACE_NEWER, PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_PATH, $this->upgrade_folder);
|
962 |
-
$this->log("files is $files");
|
963 |
-
if (is_array($files)) {
|
964 |
-
$num_extracted = sizeof($files);
|
965 |
-
$this->log("extracted $num_extracted files to $this->upgrade_folder");
|
966 |
-
$this->log(print_r($files, true));
|
967 |
-
return true;
|
968 |
-
} else {
|
969 |
-
$this->upgrade_error = $archive->errorInfo();
|
970 |
-
return false;
|
971 |
-
}
|
972 |
-
}
|
973 |
-
|
974 |
-
/** crude approximization of whether current user is an admin */
|
975 |
-
function is_admin() {
|
976 |
-
return current_user_can('level_8');
|
977 |
-
}
|
978 |
-
|
979 |
-
|
980 |
-
function is_directory_writable($directory) {
|
981 |
-
$filename = $directory . '/' . 'tmp_file_' . time();
|
982 |
-
$fh = @fopen($filename, 'w');
|
983 |
-
if (!$fh) {
|
984 |
-
return false;
|
985 |
-
}
|
986 |
-
|
987 |
-
$written = fwrite($fh, "test");
|
988 |
-
fclose($fh);
|
989 |
-
unlink($filename);
|
990 |
-
if ($written) {
|
991 |
-
return true;
|
992 |
-
} else {
|
993 |
-
return false;
|
994 |
-
}
|
995 |
-
}
|
996 |
-
|
997 |
-
|
998 |
-
function is_upgrade_directory_writable() {
|
999 |
-
//return $this->is_directory_writable($this->upgrade_folder);
|
1000 |
-
// let's assume it is
|
1001 |
-
return true;
|
1002 |
-
}
|
1003 |
-
|
1004 |
-
|
1005 |
-
function post_meta_tags($id) {
|
1006 |
-
$awmp_edit = $_POST["aiosp_edit"];
|
1007 |
-
$nonce = $_POST['nonce-aioseop-edit'];
|
1008 |
-
// if (!wp_verify_nonce($nonce, 'edit-aioseop-nonce')) die ( 'Security Check - If you receive this in error, log out and back in to WordPress');
|
1009 |
-
if (isset($awmp_edit) && !empty($awmp_edit) && wp_verify_nonce($nonce, 'edit-aioseop-nonce')) {
|
1010 |
-
$keywords = $_POST["aiosp_keywords"];
|
1011 |
-
$description = $_POST["aiosp_description"];
|
1012 |
-
$title = $_POST["aiosp_title"];
|
1013 |
-
$aiosp_meta = $_POST["aiosp_meta"];
|
1014 |
-
$aiosp_disable = $_POST["aiosp_disable"];
|
1015 |
-
$aiosp_titleatr = $_POST["aiosp_titleatr"];
|
1016 |
-
$aiosp_menulabel = $_POST["aiosp_menulabel"];
|
1017 |
-
|
1018 |
-
delete_post_meta($id, '_aioseop_keywords');
|
1019 |
-
delete_post_meta($id, '_aioseop_description');
|
1020 |
-
delete_post_meta($id, '_aioseop_title');
|
1021 |
-
delete_post_meta($id, '_aioseop_titleatr');
|
1022 |
-
delete_post_meta($id, '_aioseop_menulabel');
|
1023 |
-
|
1024 |
-
|
1025 |
-
if ($this->is_admin()) {
|
1026 |
-
delete_post_meta($id, '_aioseop_disable');
|
1027 |
-
}
|
1028 |
-
//delete_post_meta($id, 'aiosp_meta');
|
1029 |
-
|
1030 |
-
if (isset($keywords) && !empty($keywords)) {
|
1031 |
-
add_post_meta($id, '_aioseop_keywords', $keywords);
|
1032 |
-
}
|
1033 |
-
if (isset($description) && !empty($description)) {
|
1034 |
-
add_post_meta($id, '_aioseop_description', $description);
|
1035 |
-
}
|
1036 |
-
if (isset($title) && !empty($title)) {
|
1037 |
-
add_post_meta($id, '_aioseop_title', $title);
|
1038 |
-
}
|
1039 |
-
if (isset($aiosp_titleatr) && !empty($aiosp_titleatr)) {
|
1040 |
-
add_post_meta($id, '_aioseop_titleatr', $aiosp_titleatr);
|
1041 |
-
}
|
1042 |
-
if (isset($aiosp_menulabel) && !empty($aiosp_menulabel)) {
|
1043 |
-
add_post_meta($id, '_aioseop_menulabel', $aiosp_menulabel);
|
1044 |
-
}
|
1045 |
-
if (isset($aiosp_disable) && !empty($aiosp_disable) && $this->is_admin()) {
|
1046 |
-
add_post_meta($id, '_aioseop_disable', $aiosp_disable);
|
1047 |
-
}
|
1048 |
-
/*
|
1049 |
-
if (isset($aiosp_meta) && !empty($aiosp_meta)) {
|
1050 |
-
add_post_meta($id, 'aiosp_meta', $aiosp_meta);
|
1051 |
-
}
|
1052 |
-
*/
|
1053 |
-
}
|
1054 |
-
}
|
1055 |
-
|
1056 |
-
function edit_category($id) {
|
1057 |
-
global $wpdb;
|
1058 |
-
$id = $wpdb->escape($id);
|
1059 |
-
$awmp_edit = $_POST["aiosp_edit"];
|
1060 |
-
if (isset($awmp_edit) && !empty($awmp_edit)) {
|
1061 |
-
$keywords = $wpdb->escape($_POST["aiosp_keywords"]);
|
1062 |
-
$title = $wpdb->escape($_POST["aiosp_title"]);
|
1063 |
-
$old_category = $wpdb->get_row("select * from $this->table_categories where category_id=$id", OBJECT);
|
1064 |
-
if ($old_category) {
|
1065 |
-
$wpdb->query($wpdb->prepare("update $this->table_categories
|
1066 |
-
set meta_title='$title', meta_keywords='$keywords'
|
1067 |
-
where category_id=$id"));
|
1068 |
-
} else {
|
1069 |
-
$wpdb->query($wpdb->prepare("insert into $this->table_categories(meta_title, meta_keywords, category_id)
|
1070 |
-
values ('$title', '$keywords', $id"));
|
1071 |
-
}
|
1072 |
-
//$wpdb->query($wpdb->prepare("insert into $this->table_categories"))
|
1073 |
-
/*
|
1074 |
-
delete_post_meta($id, 'keywords');
|
1075 |
-
delete_post_meta($id, 'description');
|
1076 |
-
delete_post_meta($id, 'title');
|
1077 |
-
|
1078 |
-
if (isset($keywords) && !empty($keywords)) {
|
1079 |
-
add_post_meta($id, 'keywords', $keywords);
|
1080 |
-
}
|
1081 |
-
if (isset($description) && !empty($description)) {
|
1082 |
-
add_post_meta($id, 'description', $description);
|
1083 |
-
}
|
1084 |
-
if (isset($title) && !empty($title)) {
|
1085 |
-
add_post_meta($id, 'title', $title);
|
1086 |
-
}
|
1087 |
-
*/
|
1088 |
-
}
|
1089 |
-
}
|
1090 |
-
|
1091 |
-
/**
|
1092 |
-
* @deprecated This was for the feature of dedicated meta tags for categories which never went mainstream.
|
1093 |
-
*/
|
1094 |
-
function edit_category_form() {
|
1095 |
-
global $post;
|
1096 |
-
$keywords = stripcslashes(get_post_meta($post->ID, '_aioseop_keywords', true));
|
1097 |
-
$title = stripcslashes(get_post_meta($post->ID, '_aioseop_title', true));
|
1098 |
-
$description = stripcslashes(get_post_meta($post->ID, '_aioseop_description', true));
|
1099 |
-
?>
|
1100 |
-
<input value="aiosp_edit" type="hidden" name="aiosp_edit" />
|
1101 |
-
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
1102 |
-
<tr>
|
1103 |
-
<th width="33%" scope="row" valign="top">
|
1104 |
-
<a href="http://wp.uberdose.com/2007/03/24/all-in-one-seo-pack/"><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></a>
|
1105 |
-
</th>
|
1106 |
-
</tr>
|
1107 |
-
<tr>
|
1108 |
-
<th width="33%" scope="row" valign="top"><label for="aiosp_title"><?php _e('Title:', 'all_in_one_seo_pack') ?></label></th>
|
1109 |
-
<td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="70"/></td>
|
1110 |
-
</tr>
|
1111 |
-
<tr>
|
1112 |
-
<th width="33%" scope="row" valign="top"><label for="aiosp_keywords"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></label></th>
|
1113 |
-
<td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="70"/></td>
|
1114 |
-
</tr>
|
1115 |
-
</table>
|
1116 |
-
<?php
|
1117 |
-
}
|
1118 |
-
|
1119 |
-
function add_meta_tags_textinput() {
|
1120 |
-
global $post;
|
1121 |
-
$post_id = $post;
|
1122 |
-
if (is_object($post_id)) {
|
1123 |
-
$post_id = $post_id->ID;
|
1124 |
-
}
|
1125 |
-
$keywords = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_keywords', true)));
|
1126 |
-
$title = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_title', true)));
|
1127 |
-
$description = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_description', true)));
|
1128 |
-
$aiosp_meta = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_meta', true)));
|
1129 |
-
$aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_disable', true)));
|
1130 |
-
$aiosp_titleatr = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_titleatr', true)));
|
1131 |
-
$aiosp_menulabel = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_menulabel', true)));
|
1132 |
-
|
1133 |
-
?>
|
1134 |
-
<SCRIPT LANGUAGE="JavaScript">
|
1135 |
-
<!-- Begin
|
1136 |
-
function countChars(field,cntfield) {
|
1137 |
-
cntfield.value = field.value.length;
|
1138 |
-
}
|
1139 |
-
// End -->
|
1140 |
-
</script>
|
1141 |
-
|
1142 |
-
<?php if (substr($this->wp_version, 0, 3) >= '2.5') { ?>
|
1143 |
-
<div id="postaiosp" class="postbox closed">
|
1144 |
-
<h3><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></h3>
|
1145 |
-
<div class="inside">
|
1146 |
-
<div id="postaiosp">
|
1147 |
-
<?php } else { ?>
|
1148 |
-
<div class="dbx-b-ox-wrapper">
|
1149 |
-
<fieldset id="seodiv" class="dbx-box">
|
1150 |
-
<div class="dbx-h-andle-wrapper">
|
1151 |
-
<h3 class="dbx-handle"><?php _e('All in One SEO Pack', 'all_in_one_seo_pack') ?></h3>
|
1152 |
-
</div>
|
1153 |
-
<div class="dbx-c-ontent-wrapper">
|
1154 |
-
<div class="dbx-content">
|
1155 |
-
<?php } ?>
|
1156 |
-
|
1157 |
-
<a target="__blank" href="http://semperfiwebdesign.com/portfolio/wordpress/wordpress-plugins/all-in-one-seo-pack/"><?php _e('Click here for Support', 'all_in_one_seo_pack') ?></a>
|
1158 |
-
<input value="aiosp_edit" type="hidden" name="aiosp_edit" />
|
1159 |
-
<table style="margin-bottom:40px">
|
1160 |
-
<tr>
|
1161 |
-
<th style="text-align:left;" colspan="2">
|
1162 |
-
</th>
|
1163 |
-
</tr>
|
1164 |
-
<tr>
|
1165 |
-
<th scope="row" style="text-align:right;"><?php _e('Title:', 'all_in_one_seo_pack') ?></th>
|
1166 |
-
<td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="62"/></td>
|
1167 |
-
</tr>
|
1168 |
-
<tr>
|
1169 |
-
<th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
|
1170 |
-
<td><textarea name="aiosp_description" rows="1" cols="60"
|
1171 |
-
onKeyDown="countChars(document.post.aiosp_description,document.post.length1)"
|
1172 |
-
onKeyUp="countChars(document.post.aiosp_description,document.post.length1)"><?php echo $description ?></textarea><br />
|
1173 |
-
<input readonly type="text" name="length1" size="3" maxlength="3" value="<?php echo strlen($description);?>" />
|
1174 |
-
<?php _e(' characters. Most search engines use a maximum of 160 chars for the description.', 'all_in_one_seo_pack') ?>
|
1175 |
-
</td>
|
1176 |
-
</tr>
|
1177 |
-
<tr>
|
1178 |
-
<th scope="row" style="text-align:right;"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></th>
|
1179 |
-
<td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="62"/></td>
|
1180 |
-
</tr>
|
1181 |
-
<input type="hidden" name="nonce-aioseop-edit" value="<?php echo wp_create_nonce('edit-aioseop-nonce'); ?>" />
|
1182 |
-
<?php if ($this->is_admin()) { ?>
|
1183 |
-
<tr>
|
1184 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1185 |
-
<?php _e('Disable on this page/post:', 'all_in_one_seo_pack')?>
|
1186 |
-
</th>
|
1187 |
-
<td>
|
1188 |
-
<input type="checkbox" name="aiosp_disable" <?php if ($aiosp_disable) echo "checked=\"1\""; ?>/>
|
1189 |
-
</td>
|
1190 |
-
</tr>
|
1191 |
-
|
1192 |
-
<tr>
|
1193 |
-
<th scope="row" style="text-align:right;"><?php _e('Title Attribute:', 'all_in_one_seo_pack') ?></th>
|
1194 |
-
<td><input value="<?php echo $aiosp_titleatr ?>" type="text" name="aiosp_titleatr" size="62"/></td>
|
1195 |
-
</tr>
|
1196 |
-
|
1197 |
-
<tr>
|
1198 |
-
<th scope="row" style="text-align:right;"><?php _e('Menu Label:', 'all_in_one_seo_pack') ?></th>
|
1199 |
-
<td><input value="<?php echo $aiosp_menulabel ?>" type="text" name="aiosp_menulabel" size="62"/></td>
|
1200 |
-
</tr>
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
1207 |
-
<?php } ?>
|
1208 |
-
|
1209 |
-
</table>
|
1210 |
-
|
1211 |
-
<?php if (substr($this->wp_version, 0, 3) >= '2.5') { ?>
|
1212 |
-
</div></div></div>
|
1213 |
-
<?php } else { ?>
|
1214 |
-
</div>
|
1215 |
-
</fieldset>
|
1216 |
-
</div>
|
1217 |
-
<?php } ?>
|
1218 |
-
|
1219 |
-
<?php
|
1220 |
-
}
|
1221 |
-
|
1222 |
-
function admin_menu() {
|
1223 |
-
$file = __FILE__;
|
1224 |
-
|
1225 |
-
// hack for 1.5
|
1226 |
-
if (substr($this->wp_version, 0, 3) == '1.5') {
|
1227 |
-
$file = 'all-in-one-seo-pack/all_in_one_seo_pack.php';
|
1228 |
-
}
|
1229 |
-
//add_management_page(__('All in One SEO Title', 'all_in_one_seo_pack'), __('All in One SEO', 'all_in_one_seo_pack'), 10, $file, array($this, 'management_panel'));
|
1230 |
-
add_submenu_page('options-general.php', __('All in One SEO', 'all_in_one_seo_pack'), __('All in One SEO', 'all_in_one_seo_pack'), 10, $file, array($this, 'options_panel'));
|
1231 |
-
}
|
1232 |
-
|
1233 |
-
function management_panel() {
|
1234 |
-
$message = null;
|
1235 |
-
$base_url = "edit.php?page=" . __FILE__;
|
1236 |
-
//echo($base_url);
|
1237 |
-
$type = $_REQUEST['type'];
|
1238 |
-
if (!isset($type)) {
|
1239 |
-
$type = "posts";
|
1240 |
-
}
|
1241 |
-
?>
|
1242 |
-
|
1243 |
-
<ul class="aiosp_menu">
|
1244 |
-
<li><a href="<?php echo $base_url ?>&type=posts">Posts</a>
|
1245 |
-
</li>
|
1246 |
-
<li><a href="<?php echo $base_url ?>&type=pages">Pages</a>
|
1247 |
-
</li>
|
1248 |
-
</ul>
|
1249 |
-
|
1250 |
-
<?php
|
1251 |
-
|
1252 |
-
if ($type == "posts") {
|
1253 |
-
echo("posts");
|
1254 |
-
} elseif ($type == "pages") {
|
1255 |
-
echo("pages");
|
1256 |
-
}
|
1257 |
-
|
1258 |
-
}
|
1259 |
-
|
1260 |
-
function options_panel() {
|
1261 |
-
$message = null;
|
1262 |
-
$message_updated = __("All in One SEO Options Updated.", 'all_in_one_seo_pack');
|
1263 |
-
global $aioseop_options;
|
1264 |
-
// update options
|
1265 |
-
if ($_POST['action'] && $_POST['action'] == 'aiosp_update') {
|
1266 |
-
$nonce = $_POST['nonce-aioseop'];
|
1267 |
-
if (!wp_verify_nonce($nonce, 'aioseop-nonce')) die ( 'Security Check - If you receive this in error, log out and back in to WordPress');
|
1268 |
-
$message = $message_updated;
|
1269 |
-
$aioseop_options['aiosp_can'] = $_POST['aiosp_can'];
|
1270 |
-
$aioseop_options['aiosp_donate'] = $_POST['aiosp_donate'];
|
1271 |
-
$aioseop_options['aiosp_home_title'] = $_POST['aiosp_home_title'];
|
1272 |
-
$aioseop_options['aiosp_home_description'] = $_POST['aiosp_home_description'];
|
1273 |
-
$aioseop_options['aiosp_home_keywords'] = $_POST['aiosp_home_keywords'];
|
1274 |
-
$aioseop_options['aiosp_max_words_excerpt'] = $_POST['aiosp_max_words_excerpt'];
|
1275 |
-
$aioseop_options['aiosp_rewrite_titles'] = $_POST['aiosp_rewrite_titles'];
|
1276 |
-
$aioseop_options['aiosp_post_title_format'] = $_POST['aiosp_post_title_format'];
|
1277 |
-
$aioseop_options['aiosp_page_title_format'] = $_POST['aiosp_page_title_format'];
|
1278 |
-
$aioseop_options['aiosp_category_title_format'] = $_POST['aiosp_category_title_format'];
|
1279 |
-
$aioseop_options['aiosp_archive_title_format'] = $_POST['aiosp_archive_title_format'];
|
1280 |
-
$aioseop_options['aiosp_tag_title_format'] = $_POST['aiosp_tag_title_format'];
|
1281 |
-
$aioseop_options['aiosp_search_title_format'] = $_POST['aiosp_search_title_format'];
|
1282 |
-
$aioseop_options['aiosp_description_format'] = $_POST['aiosp_description_format'];
|
1283 |
-
$aioseop_options['aiosp_404_title_format'] = $_POST['aiosp_404_title_format'];
|
1284 |
-
$aioseop_options['aiosp_paged_format'] = $_POST['aiosp_paged_format'];
|
1285 |
-
$aioseop_options['aiosp_use_categories'] = $_POST['aiosp_use_categories'];
|
1286 |
-
$aioseop_options['aiosp_dynamic_postspage_keywords'] = $_POST['aiosp_dynamic_postspage_keywords'];
|
1287 |
-
$aioseop_options['aiosp_category_noindex'] = $_POST['aiosp_category_noindex'];
|
1288 |
-
$aioseop_options['aiosp_archive_noindex'] = $_POST['aiosp_archive_noindex'];
|
1289 |
-
$aioseop_options['aiosp_tags_noindex'] = $_POST['aiosp_tags_noindex'];
|
1290 |
-
$aioseop_options['aiosp_generate_descriptions'] = $_POST['aiosp_generate_descriptions'];
|
1291 |
-
$aioseop_options['aiosp_debug_info'] = $_POST['aiosp_debug_info'];
|
1292 |
-
$aioseop_options['aiosp_post_meta_tags'] = $_POST['aiosp_post_meta_tags'];
|
1293 |
-
$aioseop_options['aiosp_page_meta_tags'] = $_POST['aiosp_page_meta_tags'];
|
1294 |
-
$aioseop_options['aiosp_home_meta_tags'] = $_POST['aiosp_home_meta_tags'];
|
1295 |
-
$aioseop_options['aiosp_do_log'] = $_POST['aiosp_do_log'];
|
1296 |
-
$aioseop_options['aiosp_enabled'] = $_POST['aiosp_enabled'];
|
1297 |
-
|
1298 |
-
update_option('aioseop_options', $aioseop_options);
|
1299 |
-
|
1300 |
-
if (function_exists('wp_cache_flush')) {
|
1301 |
-
wp_cache_flush();
|
1302 |
-
}
|
1303 |
-
} /*elseif ($_POST['aiosp_upgrade']) {
|
1304 |
-
$message = __("Upgraded to newest version. Please revisit the options page to make sure you see the newest version.", 'all_in_one_seo_pack');
|
1305 |
-
$success = $this->install_newest_version();
|
1306 |
-
if (!$success) {
|
1307 |
-
$message = __("Upgrade failed", 'all_in_one_seo_pack');
|
1308 |
-
if (isset($this->upgrade_error) && !empty($this->upgrade_error)) {
|
1309 |
-
$message .= ": " . $this->upgrade_error;
|
1310 |
-
} else {
|
1311 |
-
$message .= ".";
|
1312 |
-
}
|
1313 |
-
}
|
1314 |
-
}*/
|
1315 |
-
|
1316 |
-
?>
|
1317 |
-
<?php if ($message) : ?>
|
1318 |
-
<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
|
1319 |
-
<?php endif; ?>
|
1320 |
-
<div id="dropmessage" class="updated" style="display:none;"></div>
|
1321 |
-
<div class="wrap">
|
1322 |
-
<h2><?php _e('All in One SEO Plugin Options', 'all_in_one_seo_pack'); ?></h2>
|
1323 |
-
<p>
|
1324 |
-
<?php //_e("This is version ", 'all_in_one_seo_pack') ?><?php //_e("$this->version ", 'all_in_one_seo_pack') ?>
|
1325 |
-
<a target="_blank" title="<?php _e('All in One SEO Plugin Release History', 'all_in_one_seo_pack')?>"
|
1326 |
-
href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-pack-release-history/"><?php _e("Changelog", 'all_in_one_seo_pack')?>
|
1327 |
-
</a>
|
1328 |
-
| <a target="_blank" title="<?php _e('FAQ', 'all_in_one_seo_pack') ?>"
|
1329 |
-
href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/"><?php _e('FAQ', 'all_in_one_seo_pack') ?></a>
|
1330 |
-
| <a target="_blank" title="<?php _e('All in One SEO Plugin Support Forum', 'all_in_one_seo_pack') ?>"
|
1331 |
-
href="http://semperfiwebdesign.com/portfolio/wordpress/wordpress-plugins/forum/"><?php _e('Support', 'all_in_one_seo_pack') ?></a>
|
1332 |
-
| <a target="_blank" title="<?php _e('All in One SEO Plugin Translations', 'all_in_one_seo_pack') ?>"
|
1333 |
-
href="http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/translations-for-all-in-one-seo-pack/"><?php _e('Translations', 'all_in_one_seo_pack') ?></a>
|
1334 |
-
<br /><br />
|
1335 |
-
<a target="_blank" title="<?php echo 'Donate' ?>"
|
1336 |
-
href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8"><img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" width="" alt="Donate" /><?php //echo 'Donate' ?></a>
|
1337 |
-
| <a target="_blank" title="Amazon Wish List" href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web"><img src="https://images-na.ssl-images-amazon.com/images/G/01/gifts/registries/wishlist/v2/web/wl-btn-74-b._V46774601_.gif" width="74" alt="My Amazon.com Wish List" height="42" border="0" /></a>
|
1338 |
-
| <a target="_blank" title="<?php _e('Follow us on Twitter', 'all_in_one_seo_pack') ?>"
|
1339 |
-
href="http://twitter.com/michaeltorbert/"><img src="<?php echo WP_PLUGIN_URL; ?>/all-in-one-seo-pack/images/twitter.png" alt="<?php _e('Follow Us on Twitter', 'all_in_one_seo_pack') ?>" height="47px" /></a>
|
1340 |
-
|
1341 |
-
</p>
|
1342 |
-
|
1343 |
-
|
1344 |
-
<!--
|
1345 |
-
<p>
|
1346 |
-
<?php
|
1347 |
-
//$canwrite = $this->is_upgrade_directory_writable();
|
1348 |
-
//$canwrite = false;
|
1349 |
-
?>
|
1350 |
-
<form class="form-table" name="dofollow" action="" method="post">
|
1351 |
-
<p class="submit">
|
1352 |
-
<input type="submit" <?php //if (!$canwrite) echo(' disabled="disabled" ');?> name="aiosp_upgrade" value="<?php //_e('One Click Upgrade', 'all_in_one_seo_pack')?> »" />
|
1353 |
-
<strong><?php //_e("(Remember: Backup early, backup often!)", 'all_in_one_seo_pack') ?></strong>
|
1354 |
-
</form>
|
1355 |
-
</p>
|
1356 |
-
<p></p>
|
1357 |
-
|
1358 |
-
|
1359 |
-
<?php //if (!$canwrite) {
|
1360 |
-
//echo("<p><strong>"); echo(sprintf(__("Please make sure that %s is writable.", 'all_in_one_seo_pack'), $this->upgrade_folder)); echo("</p></strong>");
|
1361 |
-
// } ?>
|
1362 |
-
</p>
|
1363 |
-
-->
|
1364 |
-
|
1365 |
-
<script type="text/javascript">
|
1366 |
-
<!--
|
1367 |
-
function toggleVisibility(id) {
|
1368 |
-
var e = document.getElementById(id);
|
1369 |
-
if(e.style.display == 'block')
|
1370 |
-
e.style.display = 'none';
|
1371 |
-
else
|
1372 |
-
e.style.display = 'block';
|
1373 |
-
}
|
1374 |
-
//-->
|
1375 |
-
</script>
|
1376 |
-
|
1377 |
-
<h3><?php _e('Click on option titles to get help!', 'all_in_one_seo_pack') ?></h3>
|
1378 |
-
|
1379 |
-
<?php
|
1380 |
-
$uri = "feed://donations.semperfiwebdesign.com/category/highest-donations/feed/";
|
1381 |
-
include_once(ABSPATH . WPINC . '/rss.php');
|
1382 |
-
$rss = fetch_rss($uri);
|
1383 |
-
if($rss){
|
1384 |
-
echo "Highest Donations";
|
1385 |
-
$maxitems = 5;
|
1386 |
-
if(is_array($rss->items)){
|
1387 |
-
$items = array_slice($rss->items, 0, $maxitems);
|
1388 |
-
?>
|
1389 |
-
<ul>
|
1390 |
-
<?php if (empty($items)) echo '<li>No items</li>';
|
1391 |
-
else
|
1392 |
-
foreach ( $items as $item ) : ?>
|
1393 |
-
<li><a href='<?php echo $item['description']; ?>'
|
1394 |
-
title='<?php echo $item['title']; ?>'>
|
1395 |
-
<?php echo $item['title']; ?>
|
1396 |
-
</a></li>
|
1397 |
-
<?php endforeach; ?>
|
1398 |
-
</ul>
|
1399 |
-
<?php } }else{
|
1400 |
-
//do something else for feed here
|
1401 |
-
}
|
1402 |
-
|
1403 |
-
|
1404 |
-
?>
|
1405 |
-
|
1406 |
-
<?php
|
1407 |
-
$uri = "feed://donations.semperfiwebdesign.com/category/all-in-one-seo-pack/feed/";
|
1408 |
-
include_once(ABSPATH . WPINC . '/rss.php');
|
1409 |
-
$rss = fetch_rss($uri);
|
1410 |
-
if($rss){
|
1411 |
-
echo "Latest Donations";
|
1412 |
-
$maxitems = 5;
|
1413 |
-
if(is_array($rss->items)){
|
1414 |
-
$items = array_slice($rss->items, 0, $maxitems);
|
1415 |
-
?>
|
1416 |
-
<ul>
|
1417 |
-
<?php if (empty($items)) echo '<li>No items</li>';
|
1418 |
-
else
|
1419 |
-
foreach ( $items as $item ) : ?>
|
1420 |
-
<li><a href='<?php echo $item['link']; ?>'
|
1421 |
-
title='<?php echo $item['title']; ?>'>
|
1422 |
-
<?php echo $item['title']; ?>
|
1423 |
-
</a></li>
|
1424 |
-
<?php endforeach; ?>
|
1425 |
-
</ul>
|
1426 |
-
<?php } }else{
|
1427 |
-
//fall back on something else for feed here
|
1428 |
-
}?>
|
1429 |
-
|
1430 |
-
<?php
|
1431 |
-
global $wpdb;
|
1432 |
-
$somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'keywords'");
|
1433 |
-
$somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'title'") + $somecount;
|
1434 |
-
$somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'description'") + $somecount;
|
1435 |
-
$somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'aiosp_meta'") + $somecount;
|
1436 |
-
$somecount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key = 'aiosp_disable'") + $somecount;
|
1437 |
-
if($somecount > 0){
|
1438 |
-
echo "<div class='error' style='text-align:center;'><p><strong>Your database meta needs to be updated. " . $somecount . " old fields remaining</strong> <em>(Back up your database before updating.)</em>
|
1439 |
-
<FORM action='' method='post' name='aioseop-migrate'>
|
1440 |
-
<input type='hidden' name='nonce-aioseop-migrate' value='" . wp_create_nonce('aioseop-migrate-nonce') . "' />
|
1441 |
-
<input type='submit' name='aioseop_migrate' class='button-primary' value='Update Database'>
|
1442 |
-
</FORM>
|
1443 |
-
</p></div>";
|
1444 |
-
}
|
1445 |
-
|
1446 |
-
if(!get_option('aioseop_options')){
|
1447 |
-
echo "<div class='error' style='text-align:center;'><p><strong>Your database options need to be updated.</strong><em>(Back up your database before updating.)</em>
|
1448 |
-
<FORM action='' method='post' name='aioseop-migrate-options'>
|
1449 |
-
<input type='hidden' name='nonce-aioseop-migrate-options' value='" . wp_create_nonce('aioseop-migrate-nonce-options') . "' />
|
1450 |
-
<input type='submit' name='aioseop_migrate_options' class='button-primary' value='Update Database Options'>
|
1451 |
-
</FORM>
|
1452 |
-
</p></div>";
|
1453 |
-
|
1454 |
-
}
|
1455 |
-
|
1456 |
-
?>
|
1457 |
-
|
1458 |
-
|
1459 |
-
<form name="dofollow" action="" method="post">
|
1460 |
-
<table class="form-table">
|
1461 |
-
<?php $aioseop_options = get_option('aioseop_options'); ?>
|
1462 |
-
<?php if (!$aioseop_options['aiosp_donate']){?>
|
1463 |
-
<tr>
|
1464 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1465 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_donate_tip');">
|
1466 |
-
<?php _e('I enjoy this plugin and have made a donation:', 'all_in_one_seo_pack')?>
|
1467 |
-
</a>
|
1468 |
-
</td>
|
1469 |
-
<td>
|
1470 |
-
<input type="checkbox" name="aiosp_donate" <?php if ($aioseop_options['aiosp_donate']) echo "checked=\"1\""; ?>/>
|
1471 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_donate_tip">
|
1472 |
-
<?php
|
1473 |
-
_e('All donations support continued development of this free software.', 'all_in_one_seo_pack');
|
1474 |
-
?>
|
1475 |
-
</div>
|
1476 |
-
</td>
|
1477 |
-
</tr>
|
1478 |
-
<?php } ?>
|
1479 |
-
|
1480 |
-
<tr>
|
1481 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1482 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_enabled_tip');">
|
1483 |
-
<?php _e('Plugin Status:', 'all_in_one_seo_pack')?>
|
1484 |
-
</a>
|
1485 |
-
</td>
|
1486 |
-
<td>
|
1487 |
-
<input type="radio" name="aiosp_enabled" value="1" <?php if($aioseop_options['aiosp_enabled']) echo "checked"?> > Enabled<br>
|
1488 |
-
<input type="radio" name="aiosp_enabled" value="0" <?php if(!$aioseop_options['aiosp_enabled']) echo "checked"?>> Disabled
|
1489 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_enabled_tip">
|
1490 |
-
<?php
|
1491 |
-
_e('All in One SEO Pack must be enabled for use.', 'all_in_one_seo_pack');
|
1492 |
-
?>
|
1493 |
-
</div>
|
1494 |
-
</td>
|
1495 |
-
</tr>
|
1496 |
-
|
1497 |
-
<tr>
|
1498 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1499 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_title_tip');">
|
1500 |
-
<?php _e('Home Title:', 'all_in_one_seo_pack')?>
|
1501 |
-
</a>
|
1502 |
-
</td>
|
1503 |
-
<td>
|
1504 |
-
<textarea cols="57" rows="2" name="aiosp_home_title"><?php echo stripcslashes($aioseop_options['aiosp_home_title']); ?></textarea>
|
1505 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_home_title_tip">
|
1506 |
-
<?php
|
1507 |
-
_e('As the name implies, this will be the title of your homepage. This is independent of any other option. If not set, the default blog title will get used.', 'all_in_one_seo_pack');
|
1508 |
-
?>
|
1509 |
-
</div>
|
1510 |
-
</td>
|
1511 |
-
</tr>
|
1512 |
-
|
1513 |
-
<tr>
|
1514 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1515 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_description_tip');">
|
1516 |
-
<?php _e('Home Description:', 'all_in_one_seo_pack')?>
|
1517 |
-
</a>
|
1518 |
-
</td>
|
1519 |
-
<td>
|
1520 |
-
<textarea cols="57" rows="2" name="aiosp_home_description"><?php echo stripcslashes($aioseop_options['aiosp_home_description']); ?></textarea>
|
1521 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_home_description_tip">
|
1522 |
-
<?php
|
1523 |
-
_e('The META description for your homepage. Independent of any other options, the default is no META description at all if this is not set.', 'all_in_one_seo_pack');
|
1524 |
-
?>
|
1525 |
-
</div>
|
1526 |
-
</td>
|
1527 |
-
</tr>
|
1528 |
-
|
1529 |
-
<tr>
|
1530 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1531 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_keywords_tip');">
|
1532 |
-
<?php _e('Home Keywords (comma separated):', 'all_in_one_seo_pack')?>
|
1533 |
-
</a>
|
1534 |
-
</td>
|
1535 |
-
<td>
|
1536 |
-
<textarea cols="57" rows="2" name="aiosp_home_keywords"><?php echo stripcslashes($aioseop_options['aiosp_home_keywords']); ?></textarea>
|
1537 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_home_keywords_tip">
|
1538 |
-
<?php
|
1539 |
-
_e("A comma separated list of your most important keywords for your site that will be written as META keywords on your homepage. Don't stuff everything in here.", 'all_in_one_seo_pack');
|
1540 |
-
?>
|
1541 |
-
</div>
|
1542 |
-
</td>
|
1543 |
-
</tr>
|
1544 |
-
|
1545 |
-
<tr>
|
1546 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1547 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_can_tip');">
|
1548 |
-
<?php _e('Canonical URLs:', 'all_in_one_seo_pack')?>
|
1549 |
-
</a>
|
1550 |
-
</td>
|
1551 |
-
<td>
|
1552 |
-
<input type="checkbox" name="aiosp_can" <?php if ($aioseop_options['aiosp_can']) echo "checked=\"1\""; ?>/>
|
1553 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_can_tip">
|
1554 |
-
<?php
|
1555 |
-
_e("This option will automatically generate Canonical URLS for your entire WordPress installation. This will help to prevent duplicate content penalties by <a href='http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html' target='_blank'>Google</a>.", 'all_in_one_seo_pack');
|
1556 |
-
?>
|
1557 |
-
</div>
|
1558 |
-
</td>
|
1559 |
-
</tr>
|
1560 |
-
|
1561 |
-
<tr>
|
1562 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1563 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_rewrite_titles_tip');">
|
1564 |
-
<?php _e('Rewrite Titles:', 'all_in_one_seo_pack')?>
|
1565 |
-
</a>
|
1566 |
-
</td>
|
1567 |
-
<td>
|
1568 |
-
<input type="checkbox" name="aiosp_rewrite_titles" <?php if ($aioseop_options['aiosp_rewrite_titles']) echo "checked=\"1\""; ?>/>
|
1569 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_rewrite_titles_tip">
|
1570 |
-
<?php
|
1571 |
-
_e("Note that this is all about the title tag. This is what you see in your browser's window title bar. This is NOT visible on a page, only in the window title bar and of course in the source. If set, all page, post, category, search and archive page titles get rewritten. You can specify the format for most of them. For example: The default templates puts the title tag of posts like this: “Blog Archive >> Blog Name >> Post Title” (maybe I've overdone slightly). This is far from optimal. With the default post title format, Rewrite Title rewrites this to “Post Title | Blog Name”. If you have manually defined a title (in one of the text fields for All in One SEO Plugin input) this will become the title of your post in the format string.", 'all_in_one_seo_pack');
|
1572 |
-
?>
|
1573 |
-
</div>
|
1574 |
-
</td>
|
1575 |
-
</tr>
|
1576 |
-
|
1577 |
-
<tr>
|
1578 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1579 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_title_format_tip');">
|
1580 |
-
<?php _e('Post Title Format:', 'all_in_one_seo_pack')?>
|
1581 |
-
</a>
|
1582 |
-
</td>
|
1583 |
-
<td>
|
1584 |
-
<input size="59" name="aiosp_post_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_post_title_format']); ?>"/>
|
1585 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_post_title_format_tip">
|
1586 |
-
<?php
|
1587 |
-
_e('The following macros are supported:', 'all_in_one_seo_pack');
|
1588 |
-
echo('<ul>');
|
1589 |
-
echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
|
1590 |
-
echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
|
1591 |
-
echo('<li>'); _e('%post_title% - The original title of the post', 'all_in_one_seo_pack'); echo('</li>');
|
1592 |
-
echo('<li>'); _e('%category_title% - The (main) category of the post', 'all_in_one_seo_pack'); echo('</li>');
|
1593 |
-
echo('<li>'); _e('%category% - Alias for %category_title%', 'all_in_one_seo_pack'); echo('</li>');
|
1594 |
-
echo('<li>'); _e("%post_author_login% - This post's author' login", 'all_in_one_seo_pack'); echo('</li>');
|
1595 |
-
echo('<li>'); _e("%post_author_nicename% - This post's author' nicename", 'all_in_one_seo_pack'); echo('</li>');
|
1596 |
-
echo('<li>'); _e("%post_author_firstname% - This post's author' first name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
|
1597 |
-
echo('<li>'); _e("%post_author_lastname% - This post's author' last name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
|
1598 |
-
echo('</ul>');
|
1599 |
-
?>
|
1600 |
-
</div>
|
1601 |
-
</td>
|
1602 |
-
</tr>
|
1603 |
-
|
1604 |
-
<tr>
|
1605 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1606 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_page_title_format_tip');">
|
1607 |
-
<?php _e('Page Title Format:', 'all_in_one_seo_pack')?>
|
1608 |
-
</a>
|
1609 |
-
</td>
|
1610 |
-
<td>
|
1611 |
-
<input size="59" name="aiosp_page_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_page_title_format']); ?>"/>
|
1612 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_page_title_format_tip">
|
1613 |
-
<?php
|
1614 |
-
_e('The following macros are supported:', 'all_in_one_seo_pack');
|
1615 |
-
echo('<ul>');
|
1616 |
-
echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
|
1617 |
-
echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
|
1618 |
-
echo('<li>'); _e('%page_title% - The original title of the page', 'all_in_one_seo_pack'); echo('</li>');
|
1619 |
-
echo('<li>'); _e("%page_author_login% - This page's author' login", 'all_in_one_seo_pack'); echo('</li>');
|
1620 |
-
echo('<li>'); _e("%page_author_nicename% - This page's author' nicename", 'all_in_one_seo_pack'); echo('</li>');
|
1621 |
-
echo('<li>'); _e("%page_author_firstname% - This page's author' first name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
|
1622 |
-
echo('<li>'); _e("%page_author_lastname% - This page's author' last name (capitalized)", 'all_in_one_seo_pack'); echo('</li>');
|
1623 |
-
echo('</ul>');
|
1624 |
-
?>
|
1625 |
-
</div>
|
1626 |
-
</td>
|
1627 |
-
</tr>
|
1628 |
-
|
1629 |
-
<tr>
|
1630 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1631 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_category_title_format_tip');">
|
1632 |
-
<?php _e('Category Title Format:', 'all_in_one_seo_pack')?>
|
1633 |
-
</a>
|
1634 |
-
</td>
|
1635 |
-
<td>
|
1636 |
-
<input size="59" name="aiosp_category_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_category_title_format']); ?>"/>
|
1637 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_category_title_format_tip">
|
1638 |
-
<?php
|
1639 |
-
_e('The following macros are supported:', 'all_in_one_seo_pack');
|
1640 |
-
echo('<ul>');
|
1641 |
-
echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
|
1642 |
-
echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
|
1643 |
-
echo('<li>'); _e('%category_title% - The original title of the category', 'all_in_one_seo_pack'); echo('</li>');
|
1644 |
-
echo('<li>'); _e('%category_description% - The description of the category', 'all_in_one_seo_pack'); echo('</li>');
|
1645 |
-
echo('</ul>');
|
1646 |
-
?>
|
1647 |
-
</div>
|
1648 |
-
</td>
|
1649 |
-
</tr>
|
1650 |
-
|
1651 |
-
<tr>
|
1652 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1653 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_archive_title_format_tip');">
|
1654 |
-
<?php _e('Archive Title Format:', 'all_in_one_seo_pack')?>
|
1655 |
-
</a>
|
1656 |
-
</td>
|
1657 |
-
<td>
|
1658 |
-
<input size="59" name="aiosp_archive_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_archive_title_format']); ?>"/>
|
1659 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_archive_title_format_tip">
|
1660 |
-
<?php
|
1661 |
-
_e('The following macros are supported:', 'all_in_one_seo_pack');
|
1662 |
-
echo('<ul>');
|
1663 |
-
echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
|
1664 |
-
echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
|
1665 |
-
echo('<li>'); _e('%date% - The original archive title given by wordpress, e.g. "2007" or "2007 August"', 'all_in_one_seo_pack'); echo('</li>');
|
1666 |
-
echo('</ul>');
|
1667 |
-
?>
|
1668 |
-
</div>
|
1669 |
-
</td>
|
1670 |
-
</tr>
|
1671 |
-
|
1672 |
-
<tr>
|
1673 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1674 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_tag_title_format_tip');">
|
1675 |
-
<?php _e('Tag Title Format:', 'all_in_one_seo_pack')?>
|
1676 |
-
</a>
|
1677 |
-
</td>
|
1678 |
-
<td>
|
1679 |
-
<input size="59" name="aiosp_tag_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_tag_title_format']); ?>"/>
|
1680 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_tag_title_format_tip">
|
1681 |
-
<?php
|
1682 |
-
_e('The following macros are supported:', 'all_in_one_seo_pack');
|
1683 |
-
echo('<ul>');
|
1684 |
-
echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
|
1685 |
-
echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
|
1686 |
-
echo('<li>'); _e('%tag% - The name of the tag', 'all_in_one_seo_pack'); echo('</li>');
|
1687 |
-
echo('</ul>');
|
1688 |
-
?>
|
1689 |
-
</div>
|
1690 |
-
</td>
|
1691 |
-
</tr>
|
1692 |
-
|
1693 |
-
<tr>
|
1694 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1695 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_search_title_format_tip');">
|
1696 |
-
<?php _e('Search Title Format:', 'all_in_one_seo_pack')?>
|
1697 |
-
</a>
|
1698 |
-
</td>
|
1699 |
-
<td>
|
1700 |
-
<input size="59" name="aiosp_search_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_search_title_format']); ?>"/>
|
1701 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_search_title_format_tip">
|
1702 |
-
<?php
|
1703 |
-
_e('The following macros are supported:', 'all_in_one_seo_pack');
|
1704 |
-
echo('<ul>');
|
1705 |
-
echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
|
1706 |
-
echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
|
1707 |
-
echo('<li>'); _e('%search% - What was searched for', 'all_in_one_seo_pack'); echo('</li>');
|
1708 |
-
echo('</ul>');
|
1709 |
-
?>
|
1710 |
-
</div>
|
1711 |
-
</td>
|
1712 |
-
</tr>
|
1713 |
-
|
1714 |
-
<tr>
|
1715 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1716 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_description_format_tip');">
|
1717 |
-
<?php _e('Description Format:', 'all_in_one_seo_pack')?>
|
1718 |
-
</a>
|
1719 |
-
</td>
|
1720 |
-
<td>
|
1721 |
-
<input size="59" name="aiosp_description_format" value="<?php echo stripcslashes($aioseop_options['aiosp_description_format']); ?>"/>
|
1722 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_description_format_tip">
|
1723 |
-
<?php
|
1724 |
-
_e('The following macros are supported:', 'all_in_one_seo_pack');
|
1725 |
-
echo('<ul>');
|
1726 |
-
echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
|
1727 |
-
echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
|
1728 |
-
echo('<li>'); _e('%description% - The original description as determined by the plugin, e.g. the excerpt if one is set or an auto-generated one if that option is set', 'all_in_one_seo_pack'); echo('</li>');
|
1729 |
-
echo('<li>'); _e('%wp_title% - The original wordpress title, e.g. post_title for posts', 'all_in_one_seo_pack'); echo('</li>');
|
1730 |
-
echo('</ul>');
|
1731 |
-
?>
|
1732 |
-
</div>
|
1733 |
-
</td>
|
1734 |
-
</tr>
|
1735 |
-
|
1736 |
-
<tr>
|
1737 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1738 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_404_title_format_tip');">
|
1739 |
-
<?php _e('404 Title Format:', 'all_in_one_seo_pack')?>
|
1740 |
-
</a>
|
1741 |
-
</td>
|
1742 |
-
<td>
|
1743 |
-
<input size="59" name="aiosp_404_title_format" value="<?php echo stripcslashes($aioseop_options['aiosp_404_title_format']); ?>"/>
|
1744 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_404_title_format_tip">
|
1745 |
-
<?php
|
1746 |
-
_e('The following macros are supported:', 'all_in_one_seo_pack');
|
1747 |
-
echo('<ul>');
|
1748 |
-
echo('<li>'); _e('%blog_title% - Your blog title', 'all_in_one_seo_pack'); echo('</li>');
|
1749 |
-
echo('<li>'); _e('%blog_description% - Your blog description', 'all_in_one_seo_pack'); echo('</li>');
|
1750 |
-
echo('<li>'); _e('%request_url% - The original URL path, like "/url-that-does-not-exist/"', 'all_in_one_seo_pack'); echo('</li>');
|
1751 |
-
echo('<li>'); _e('%request_words% - The URL path in human readable form, like "Url That Does Not Exist"', 'all_in_one_seo_pack'); echo('</li>');
|
1752 |
-
echo('<li>'); _e('%404_title% - Additional 404 title input"', 'all_in_one_seo_pack'); echo('</li>');
|
1753 |
-
echo('</ul>');
|
1754 |
-
?>
|
1755 |
-
</div>
|
1756 |
-
</td>
|
1757 |
-
</tr>
|
1758 |
-
|
1759 |
-
<tr>
|
1760 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1761 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_paged_format_tip');">
|
1762 |
-
<?php _e('Paged Format:', 'all_in_one_seo_pack')?>
|
1763 |
-
</a>
|
1764 |
-
</td>
|
1765 |
-
<td>
|
1766 |
-
<input size="59" name="aiosp_paged_format" value="<?php echo stripcslashes($aioseop_options['aiosp_paged_format']); ?>"/>
|
1767 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_paged_format_tip">
|
1768 |
-
<?php
|
1769 |
-
_e('This string gets appended/prepended to titles when they are for paged index pages (like home or archive pages).', 'all_in_one_seo_pack');
|
1770 |
-
_e('The following macros are supported:', 'all_in_one_seo_pack');
|
1771 |
-
echo('<ul>');
|
1772 |
-
echo('<li>'); _e('%page% - The page number', 'all_in_one_seo_pack'); echo('</li>');
|
1773 |
-
echo('</ul>');
|
1774 |
-
?>
|
1775 |
-
</div>
|
1776 |
-
</td>
|
1777 |
-
</tr>
|
1778 |
-
|
1779 |
-
<tr>
|
1780 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1781 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_use_categories_tip');">
|
1782 |
-
<?php _e('Use Categories for META keywords:', 'all_in_one_seo_pack')?>
|
1783 |
-
</td>
|
1784 |
-
<td>
|
1785 |
-
<input type="checkbox" name="aiosp_use_categories" <?php if ($aioseop_options['aiosp_use_categories']) echo "checked=\"1\""; ?>/>
|
1786 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_use_categories_tip">
|
1787 |
-
<?php
|
1788 |
-
_e('Check this if you want your categories for a given post used as the META keywords for this post (in addition to any keywords and tags you specify on the post edit page).', 'all_in_one_seo_pack');
|
1789 |
-
?>
|
1790 |
-
</div>
|
1791 |
-
</td>
|
1792 |
-
</tr>
|
1793 |
-
|
1794 |
-
<tr>
|
1795 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1796 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_dynamic_postspage_keywords_tip');">
|
1797 |
-
<?php _e('Dynamically Generate Keywords for Posts Page:', 'all_in_one_seo_pack')?>
|
1798 |
-
</td>
|
1799 |
-
<td>
|
1800 |
-
<input type="checkbox" name="aiosp_dynamic_postspage_keywords" <?php if ($aioseop_options['aiosp_dynamic_postspage_keywords']) echo "checked=\"1\""; ?>/>
|
1801 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_dynamic_postspage_keywords_tip">
|
1802 |
-
<?php
|
1803 |
-
_e('Check this if you want your keywords on a custom posts page (set it in options->reading) to be dynamically generated from the keywords of the posts showing on that page. If unchecked, it will use the keywords set in the edit page screen for the posts page.', 'all_in_one_seo_pack');
|
1804 |
-
?>
|
1805 |
-
</div>
|
1806 |
-
</td>
|
1807 |
-
</tr>
|
1808 |
-
|
1809 |
-
<tr>
|
1810 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1811 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_category_noindex_tip');">
|
1812 |
-
<?php _e('Use noindex for Categories:', 'all_in_one_seo_pack')?>
|
1813 |
-
</a>
|
1814 |
-
</td>
|
1815 |
-
<td>
|
1816 |
-
<input type="checkbox" name="aiosp_category_noindex" <?php if ($aioseop_options['aiosp_category_noindex']) echo "checked=\"1\""; ?>/>
|
1817 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_category_noindex_tip">
|
1818 |
-
<?php
|
1819 |
-
_e('Check this for excluding category pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
|
1820 |
-
?>
|
1821 |
-
</div>
|
1822 |
-
</td>
|
1823 |
-
</tr>
|
1824 |
-
|
1825 |
-
<tr>
|
1826 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1827 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_archive_noindex_tip');">
|
1828 |
-
<?php _e('Use noindex for Archives:', 'all_in_one_seo_pack')?>
|
1829 |
-
</a>
|
1830 |
-
</td>
|
1831 |
-
<td>
|
1832 |
-
<input type="checkbox" name="aiosp_archive_noindex" <?php if ($aioseop_options['aiosp_archive_noindex']) echo "checked=\"1\""; ?>/>
|
1833 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_archive_noindex_tip">
|
1834 |
-
<?php
|
1835 |
-
_e('Check this for excluding archive pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
|
1836 |
-
?>
|
1837 |
-
</div>
|
1838 |
-
</td>
|
1839 |
-
</tr>
|
1840 |
-
|
1841 |
-
<tr>
|
1842 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1843 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_tags_noindex_tip');">
|
1844 |
-
<?php _e('Use noindex for Tag Archives:', 'all_in_one_seo_pack')?>
|
1845 |
-
</a>
|
1846 |
-
</td>
|
1847 |
-
<td>
|
1848 |
-
<input type="checkbox" name="aiosp_tags_noindex" <?php if ($aioseop_options['aiosp_tags_noindex']) echo "checked=\"1\""; ?>/>
|
1849 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_tags_noindex_tip">
|
1850 |
-
<?php
|
1851 |
-
_e('Check this for excluding tag pages from being crawled. Useful for avoiding duplicate content.', 'all_in_one_seo_pack');
|
1852 |
-
?>
|
1853 |
-
</div>
|
1854 |
-
</td>
|
1855 |
-
</tr>
|
1856 |
-
|
1857 |
-
<tr>
|
1858 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1859 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_generate_descriptions_tip');">
|
1860 |
-
<?php _e('Autogenerate Descriptions:', 'all_in_one_seo_pack')?>
|
1861 |
-
</a>
|
1862 |
-
</td>
|
1863 |
-
<td>
|
1864 |
-
<input type="checkbox" name="aiosp_generate_descriptions" <?php if ($aioseop_options['aiosp_generate_descriptions']) echo "checked=\"1\""; ?>/>
|
1865 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_generate_descriptions_tip">
|
1866 |
-
<?php
|
1867 |
-
_e("Check this and your META descriptions will get autogenerated if there's no excerpt.", 'all_in_one_seo_pack');
|
1868 |
-
?>
|
1869 |
-
</div>
|
1870 |
-
</td>
|
1871 |
-
</tr>
|
1872 |
-
|
1873 |
-
<tr>
|
1874 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1875 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_post_meta_tags_tip');">
|
1876 |
-
<?php _e('Additional Post Headers:', 'all_in_one_seo_pack')?>
|
1877 |
-
</a>
|
1878 |
-
</td>
|
1879 |
-
<td>
|
1880 |
-
<textarea cols="57" rows="2" name="aiosp_post_meta_tags"><?php echo stripcslashes($aioseop_options['aiosp_post_meta_tags']); ?></textarea>
|
1881 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_post_meta_tags_tip">
|
1882 |
-
<?php
|
1883 |
-
_e('What you enter here will be copied verbatim to your header on post pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
|
1884 |
-
?>
|
1885 |
-
</div>
|
1886 |
-
</td>
|
1887 |
-
</tr>
|
1888 |
-
|
1889 |
-
<tr>
|
1890 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1891 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_page_meta_tags_tip');">
|
1892 |
-
<?php _e('Additional Page Headers:', 'all_in_one_seo_pack')?>
|
1893 |
-
</a>
|
1894 |
-
</td>
|
1895 |
-
<td>
|
1896 |
-
<textarea cols="57" rows="2" name="aiosp_page_meta_tags"><?php echo stripcslashes($aioseop_options['aiosp_page_meta_tags']); ?></textarea>
|
1897 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_page_meta_tags_tip">
|
1898 |
-
<?php
|
1899 |
-
_e('What you enter here will be copied verbatim to your header on pages. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
|
1900 |
-
?>
|
1901 |
-
</div>
|
1902 |
-
</td>
|
1903 |
-
</tr>
|
1904 |
-
|
1905 |
-
<tr>
|
1906 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1907 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_home_meta_tags_tip');">
|
1908 |
-
<?php _e('Additional Home Headers:', 'all_in_one_seo_pack')?>
|
1909 |
-
</a>
|
1910 |
-
</td>
|
1911 |
-
<td>
|
1912 |
-
<textarea cols="57" rows="2" name="aiosp_home_meta_tags"><?php echo stripcslashes($aioseop_options['aiosp_home_meta_tags']); ?></textarea>
|
1913 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_home_meta_tags_tip">
|
1914 |
-
<?php
|
1915 |
-
_e('What you enter here will be copied verbatim to your header on the home page. You can enter whatever additional headers you want here, even references to stylesheets.', 'all_in_one_seo_pack');
|
1916 |
-
?>
|
1917 |
-
</div>
|
1918 |
-
</td>
|
1919 |
-
</tr>
|
1920 |
-
|
1921 |
-
<tr>
|
1922 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1923 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'auto_social')?>" onclick="toggleVisibility('aiosp_do_log_tip');">
|
1924 |
-
<?php _e('Log important events:', 'all_in_one_seo_pack')?>
|
1925 |
-
</a>
|
1926 |
-
</td>
|
1927 |
-
<td>
|
1928 |
-
<input type="checkbox" name="aiosp_do_log" <?php if ($aioseop_options['aiosp_do_log']) echo "checked=\"1\""; ?>/>
|
1929 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_do_log_tip">
|
1930 |
-
<?php
|
1931 |
-
_e('Check this and SEO pack will create a log of important events (all_in_one_seo_pack.log) in its plugin directory which might help debugging it. Make sure this directory is writable.', 'all_in_one_seo_pack');
|
1932 |
-
?>
|
1933 |
-
</div>
|
1934 |
-
</td>
|
1935 |
-
</tr>
|
1936 |
-
|
1937 |
-
<?php if ($aioseop_options['aiosp_donate']){?>
|
1938 |
-
<tr>
|
1939 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
1940 |
-
<a style="cursor:pointer;" title="<?php _e('Click for Help!', 'all_in_one_seo_pack')?>" onclick="toggleVisibility('aiosp_donate_tip');">
|
1941 |
-
<?php _e('Thank you for your donation:', 'all_in_one_seo_pack')?>
|
1942 |
-
</a>
|
1943 |
-
</td>
|
1944 |
-
<td>
|
1945 |
-
<input type="checkbox" name="aiosp_donate" <?php if ($aioseop_options['aiosp_donate']) echo "checked=\"1\""; ?>/>
|
1946 |
-
<div style="max-width:500px; text-align:left; display:none" id="aiosp_donate_tip">
|
1947 |
-
<?php
|
1948 |
-
_e('All donations support continued development of this free software.', 'all_in_one_seo_pack');
|
1949 |
-
?>
|
1950 |
-
</div>
|
1951 |
-
</td>
|
1952 |
-
</tr>
|
1953 |
-
<?php } ?>
|
1954 |
-
|
1955 |
-
</table>
|
1956 |
-
<p class="submit">
|
1957 |
-
<input type="hidden" name="action" value="aiosp_update" />
|
1958 |
-
<input type="hidden" name="nonce-aioseop" value="<?php echo wp_create_nonce('aioseop-nonce'); ?>" />
|
1959 |
-
<input type="hidden" name="page_options" value="aiosp_home_description" />
|
1960 |
-
<input type="submit" class='button-primary' name="Submit" value="<?php _e('Update Options', 'all_in_one_seo_pack')?> »" />
|
1961 |
-
</p>
|
1962 |
-
<p><br />
|
1963 |
-
<strong>Check out these other great plugins!</strong><br />
|
1964 |
-
<a href="http://semperfiwebdesign.com/custom-applications/sms-text-message/" title="SMS Text Message WordPress plugin">SMS Text Message</a> - sends SMS updates to your readers<br />
|
1965 |
-
<a href="http://semperfiwebdesign.com/custom-applications/wp-security-scan/" title="WordPress Security">WordPress Security Scan</a> - provides vital security for your WordPress site
|
1966 |
-
</p>
|
1967 |
-
</form>
|
1968 |
-
</div>
|
1969 |
-
<?php
|
1970 |
-
|
1971 |
-
} // options_panel
|
1972 |
-
|
1973 |
-
}
|
1974 |
-
|
1975 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/all_in_one_seo_pack-bg_BG.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-bg_NO.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-da_DK.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-de_DE.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-es_ES.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-fr_FR.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-he_IL.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-hu_HU.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-it_IT.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-ja.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-nl_NL.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-pl_PL.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-pt_BR.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-ru_RU.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-tr_TR.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-uk.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-zh_CN.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack-zh_TW.mo
DELETED
Binary file
|
trunk/all_in_one_seo_pack.php
DELETED
@@ -1,766 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Plugin Name: All in One SEO Pack
|
5 |
-
Plugin URI: http://semperfiwebdesign.com
|
6 |
-
Description: Out-of-the-box SEO for your Wordpress blog. <a href="options-general.php?page=all-in-one-seo-pack/aioseop.class.php">Options configuration panel</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">Donate</a> | <a href="http://semperfiwebdesign.com/forum/" >Support</a> | <a href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank" title="Amazon Wish List">Amazon Wishlist</a>
|
7 |
-
Version: 1.6.2
|
8 |
-
Author: Michael Torbert
|
9 |
-
Author URI: http://michaeltorbert.com
|
10 |
-
*/
|
11 |
-
|
12 |
-
/*
|
13 |
-
Copyright (C) 2008-2009 Michael Torbert, semperfiwebdesign.com (michael AT semperfiwebdesign DOT com)
|
14 |
-
Original code by uberdose of uberdose.com
|
15 |
-
|
16 |
-
This program is free software; you can redistribute it and/or modify
|
17 |
-
it under the terms of the GNU General Public License as published by
|
18 |
-
the Free Software Foundation; either version 3 of the License, or
|
19 |
-
(at your option) any later version.
|
20 |
-
|
21 |
-
This program is distributed in the hope that it will be useful,
|
22 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
23 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
24 |
-
GNU General Public License for more details.
|
25 |
-
|
26 |
-
You should have received a copy of the GNU General Public License
|
27 |
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
28 |
-
*/
|
29 |
-
|
30 |
-
/*******************************************************************************************************/
|
31 |
-
register_activation_hook(__FILE__,'aioseop_activate_pl');
|
32 |
-
|
33 |
-
$UTF8_TABLES['strtolower'] = array(
|
34 |
-
"Z" => "z", "Y" => "y", "X" => "x",
|
35 |
-
"W" => "w", "V" => "v", "U" => "u",
|
36 |
-
"T" => "t", "S" => "s", "R" => "r",
|
37 |
-
"Q" => "q", "P" => "p", "O" => "o",
|
38 |
-
"N" => "n", "M" => "m", "L" => "l",
|
39 |
-
"K" => "k", "J" => "j", "I" => "i",
|
40 |
-
"H" => "h", "G" => "g", "F" => "f",
|
41 |
-
"E" => "e", "D" => "d", "C" => "c",
|
42 |
-
"B" => "b", "A" => "a", "Å" => "å",
|
43 |
-
"K" => "k", "Ω" => "ω", "Ώ" => "ώ",
|
44 |
-
"Ὼ" => "ὼ", "Ό" => "ό", "Ὸ" => "ὸ",
|
45 |
-
"Ῥ" => "ῥ", "Ύ" => "ύ", "Ὺ" => "ὺ",
|
46 |
-
"Ῡ" => "ῡ", "Ῠ" => "� ", "Ί" => "ί",
|
47 |
-
"Ὶ" => "ὶ", "Ῑ" => "ῑ", "Ῐ" => "ῐ",
|
48 |
-
"Ή" => "ή", "Ὴ" => "ὴ", "Έ" => "έ",
|
49 |
-
"Ὲ" => "ὲ", "Ά" => "ά", "Ὰ" => "ὰ",
|
50 |
-
"Ᾱ" => "ᾱ", "Ᾰ" => "ᾰ", "Ὧ" => "ὧ",
|
51 |
-
"Ὦ" => "ὦ", "Ὥ" => "ὥ", "Ὤ" => "ὤ",
|
52 |
-
"Ὣ" => "ὣ", "Ὢ" => "ὢ", "Ὡ" => "ὡ",
|
53 |
-
"Ὠ" => "� ", "Ὗ" => "ὗ", "Ὕ" => "ὕ",
|
54 |
-
"Ὓ" => "ὓ", "Ὑ" => "ὑ", "Ὅ" => "ὅ",
|
55 |
-
"Ὄ" => "ὄ", "Ὃ" => "ὃ", "Ὂ" => "ὂ",
|
56 |
-
"Ὁ" => "ὁ", "Ὀ" => "ὀ", "Ἷ" => "ἷ",
|
57 |
-
"Ἶ" => "ἶ", "Ἵ" => "ἵ", "Ἴ" => "ἴ",
|
58 |
-
"Ἳ" => "ἳ", "Ἲ" => "ἲ", "Ἱ" => "ἱ",
|
59 |
-
"Ἰ" => "ἰ", "Ἧ" => "ἧ", "Ἦ" => "ἦ",
|
60 |
-
"Ἥ" => "ἥ", "Ἤ" => "ἤ", "Ἣ" => "ἣ",
|
61 |
-
"Ἢ" => "ἢ", "Ἡ" => "ἡ", "Ἠ" => "� ",
|
62 |
-
"Ἕ" => "ἕ", "Ἔ" => "ἔ", "Ἓ" => "ἓ",
|
63 |
-
"Ἒ" => "ἒ", "Ἑ" => "ἑ", "Ἐ" => "ἐ",
|
64 |
-
"Ἇ" => "ἇ", "Ἆ" => "ἆ", "Ἅ" => "ἅ",
|
65 |
-
"Ἄ" => "ἄ", "Ἃ" => "ἃ", "Ἂ" => "ἂ",
|
66 |
-
"Ἁ" => "ἁ", "Ἀ" => "ἀ", "Ỹ" => "ỹ",
|
67 |
-
"Ỷ" => "ỷ", "Ỵ" => "ỵ", "Ỳ" => "ỳ",
|
68 |
-
"Ự" => "ự", "Ữ" => "ữ", "Ử" => "ử",
|
69 |
-
"Ừ" => "ừ", "Ứ" => "ứ", "Ủ" => "ủ",
|
70 |
-
"Ụ" => "ụ", "Ợ" => "ợ", "� " => "ỡ",
|
71 |
-
"Ở" => "ở", "Ờ" => "ờ", "Ớ" => "ớ",
|
72 |
-
"Ộ" => "ộ", "Ỗ" => "ỗ", "Ổ" => "ổ",
|
73 |
-
"Ồ" => "ồ", "Ố" => "ố", "Ỏ" => "ỏ",
|
74 |
-
"Ọ" => "ọ", "Ị" => "ị", "Ỉ" => "ỉ",
|
75 |
-
"Ệ" => "ệ", "Ễ" => "ễ", "Ể" => "ể",
|
76 |
-
"Ề" => "ề", "Ế" => "ế", "Ẽ" => "ẽ",
|
77 |
-
"Ẻ" => "ẻ", "Ẹ" => "ẹ", "Ặ" => "ặ",
|
78 |
-
"Ẵ" => "ẵ", "Ẳ" => "ẳ", "Ằ" => "ằ",
|
79 |
-
"Ắ" => "ắ", "Ậ" => "ậ", "Ẫ" => "ẫ",
|
80 |
-
"Ẩ" => "ẩ", "Ầ" => "ầ", "Ấ" => "ấ",
|
81 |
-
"Ả" => "ả", "� " => "ạ", "Ẕ" => "ẕ",
|
82 |
-
"Ẓ" => "ẓ", "Ẑ" => "ẑ", "Ẏ" => "ẏ",
|
83 |
-
"Ẍ" => "ẍ", "Ẋ" => "ẋ", "Ẉ" => "ẉ",
|
84 |
-
"Ẇ" => "ẇ", "Ẅ" => "ẅ", "Ẃ" => "ẃ",
|
85 |
-
"Ẁ" => "ẁ", "Ṿ" => "ṿ", "Ṽ" => "ṽ",
|
86 |
-
"Ṻ" => "ṻ", "Ṹ" => "ṹ", "Ṷ" => "ṷ",
|
87 |
-
"Ṵ" => "ṵ", "Ṳ" => "ṳ", "Ṱ" => "ṱ",
|
88 |
-
"Ṯ" => "ṯ", "Ṭ" => "ṭ", "Ṫ" => "ṫ",
|
89 |
-
"Ṩ" => "ṩ", "Ṧ" => "ṧ", "Ṥ" => "ṥ",
|
90 |
-
"Ṣ" => "ṣ", "� " => "ṡ", "Ṟ" => "ṟ",
|
91 |
-
"Ṝ" => "ṝ", "Ṛ" => "ṛ", "Ṙ" => "ṙ",
|
92 |
-
"Ṗ" => "ṗ", "Ṕ" => "ṕ", "Ṓ" => "ṓ",
|
93 |
-
"Ṑ" => "ṑ", "Ṏ" => "ṏ", "Ṍ" => "ṍ",
|
94 |
-
"Ṋ" => "ṋ", "Ṉ" => "ṉ", "Ṇ" => "ṇ",
|
95 |
-
"Ṅ" => "ṅ", "Ṃ" => "ṃ", "Ṁ" => "ṁ",
|
96 |
-
"Ḿ" => "ḿ", "Ḽ" => "ḽ", "Ḻ" => "ḻ",
|
97 |
-
"Ḹ" => "ḹ", "Ḷ" => "ḷ", "Ḵ" => "ḵ",
|
98 |
-
"Ḳ" => "ḳ", "Ḱ" => "ḱ", "Ḯ" => "ḯ",
|
99 |
-
"Ḭ" => "ḭ", "Ḫ" => "ḫ", "Ḩ" => "ḩ",
|
100 |
-
"Ḧ" => "ḧ", "Ḥ" => "ḥ", "Ḣ" => "ḣ",
|
101 |
-
"� " => "ḡ", "Ḟ" => "ḟ", "Ḝ" => "ḝ",
|
102 |
-
"Ḛ" => "ḛ", "Ḙ" => "ḙ", "Ḗ" => "ḗ",
|
103 |
-
"Ḕ" => "ḕ", "Ḓ" => "ḓ", "Ḑ" => "ḑ",
|
104 |
-
"Ḏ" => "ḏ", "Ḍ" => "ḍ", "Ḋ" => "ḋ",
|
105 |
-
"Ḉ" => "ḉ", "Ḇ" => "ḇ", "Ḅ" => "ḅ",
|
106 |
-
"Ḃ" => "ḃ", "Ḁ" => "ḁ", "Ֆ" => "ֆ",
|
107 |
-
"Օ" => "օ", "Ք" => "ք", "Փ" => "փ",
|
108 |
-
"Ւ" => "ւ", "Ց" => "ց", "Ր" => "ր",
|
109 |
-
"Տ" => "տ", "Վ" => "վ", "Ս" => "ս",
|
110 |
-
"Ռ" => "ռ", "Ջ" => "ջ", "Պ" => "պ",
|
111 |
-
"Չ" => "չ", "Ո" => "ո", "Շ" => "շ",
|
112 |
-
"Ն" => "ն", "Յ" => "յ", "Մ" => "մ",
|
113 |
-
"Ճ" => "ճ", "Ղ" => "ղ", "Ձ" => "ձ",
|
114 |
-
"Հ" => "հ", "Կ" => "կ", "Ծ" => "ծ",
|
115 |
-
"Խ" => "խ", "Լ" => "լ", "Ի" => "ի",
|
116 |
-
"Ժ" => "ժ", "Թ" => "թ", "Ը" => "ը",
|
117 |
-
"Է" => "է", "Զ" => "զ", "Ե" => "ե",
|
118 |
-
"Դ" => "դ", "Գ" => "գ", "Բ" => "բ",
|
119 |
-
"Ա" => "ա", "Ԏ" => "ԏ", "Ԍ" => "ԍ",
|
120 |
-
"Ԋ" => "ԋ", "Ԉ" => "ԉ", "Ԇ" => "ԇ",
|
121 |
-
"Ԅ" => "ԅ", "Ԃ" => "ԃ", "Ԁ" => "ԁ",
|
122 |
-
"Ӹ" => "ӹ", "Ӵ" => "ӵ", "Ӳ" => "ӳ",
|
123 |
-
"Ӱ" => "ӱ", "Ӯ" => "ӯ", "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", "Ѥ" => "ѥ",
|
145 |
-
"Ѣ" => "ѣ", "� " => "ѡ", "Я" => "я",
|
146 |
-
"Ю" => "ю", "Э" => "э", "Ь" => "ь",
|
147 |
-
"Ы" => "ы", "Ъ" => "ъ", "Щ" => "щ",
|
148 |
-
"Ш" => "ш", "Ч" => "ч", "Ц" => "ц",
|
149 |
-
"Х" => "х", "Ф" => "ф", "У" => "у",
|
150 |
-
"Т" => "т", "С" => "с", "� " => "р",
|
151 |
-
"П" => "п", "О" => "о", "Н" => "н",
|
152 |
-
"М" => "м", "Л" => "л", "К" => "к",
|
153 |
-
"Й" => "й", "И" => "и", "З" => "з",
|
154 |
-
"Ж" => "ж", "Е" => "е", "Д" => "д",
|
155 |
-
"Г" => "г", "В" => "в", "Б" => "б",
|
156 |
-
"А" => "а", "Џ" => "џ", "Ў" => "ў",
|
157 |
-
"Ѝ" => "ѝ", "Ќ" => "ќ", "Ћ" => "ћ",
|
158 |
-
"Њ" => "њ", "Љ" => "љ", "Ј" => "ј",
|
159 |
-
"Ї" => "ї", "І" => "і", "Ѕ" => "ѕ",
|
160 |
-
"Є" => "є", "Ѓ" => "ѓ", "Ђ" => "ђ",
|
161 |
-
"Ё" => "ё", "Ѐ" => "ѐ", "ϴ" => "θ",
|
162 |
-
"Ϯ" => "ϯ", "Ϭ" => "ϭ", "Ϫ" => "ϫ",
|
163 |
-
"Ϩ" => "ϩ", "Ϧ" => "ϧ", "Ϥ" => "ϥ",
|
164 |
-
"Ϣ" => "ϣ", "� " => "ϡ", "Ϟ" => "ϟ",
|
165 |
-
"Ϝ" => "ϝ", "Ϛ" => "ϛ", "Ϙ" => "ϙ",
|
166 |
-
"Ϋ" => "ϋ", "Ϊ" => "ϊ", "Ω" => "ω",
|
167 |
-
"Ψ" => "ψ", "Χ" => "χ", "Φ" => "φ",
|
168 |
-
"Υ" => "υ", "Τ" => "τ", "Σ" => "σ",
|
169 |
-
"Ρ" => "ρ", "� " => "π", "Ο" => "ο",
|
170 |
-
"Ξ" => "ξ", "Ν" => "ν", "Μ" => "μ",
|
171 |
-
"Λ" => "λ", "Κ" => "κ", "Ι" => "ι",
|
172 |
-
"Θ" => "θ", "Η" => "η", "Ζ" => "ζ",
|
173 |
-
"Ε" => "ε", "Δ" => "δ", "Γ" => "γ",
|
174 |
-
"Β" => "β", "Α" => "α", "Ώ" => "ώ",
|
175 |
-
"Ύ" => "ύ", "Ό" => "ό", "Ί" => "ί",
|
176 |
-
"Ή" => "ή", "Έ" => "έ", "Ά" => "ά",
|
177 |
-
"Ȳ" => "ȳ", "Ȱ" => "ȱ", "Ȯ" => "ȯ",
|
178 |
-
"Ȭ" => "ȭ", "Ȫ" => "ȫ", "Ȩ" => "ȩ",
|
179 |
-
"Ȧ" => "ȧ", "Ȥ" => "ȥ", "Ȣ" => "ȣ",
|
180 |
-
"� " => "ƞ", "Ȟ" => "ȟ", "Ȝ" => "ȝ",
|
181 |
-
"Ț" => "ț", "Ș" => "ș", "Ȗ" => "ȗ",
|
182 |
-
"Ȕ" => "ȕ", "Ȓ" => "ȓ", "Ȑ" => "ȑ",
|
183 |
-
"Ȏ" => "ȏ", "Ȍ" => "ȍ", "Ȋ" => "ȋ",
|
184 |
-
"Ȉ" => "ȉ", "Ȇ" => "ȇ", "Ȅ" => "ȅ",
|
185 |
-
"Ȃ" => "ȃ", "Ȁ" => "ȁ", "Ǿ" => "ǿ",
|
186 |
-
"Ǽ" => "ǽ", "Ǻ" => "ǻ", "Ǹ" => "ǹ",
|
187 |
-
"Ƿ" => "ƿ", "Ƕ" => "ƕ", "Ǵ" => "ǵ",
|
188 |
-
"DZ" => "dz", "Ǯ" => "ǯ", "Ǭ" => "ǭ",
|
189 |
-
"Ǫ" => "ǫ", "Ǩ" => "ǩ", "Ǧ" => "ǧ",
|
190 |
-
"Ǥ" => "ǥ", "Ǣ" => "ǣ", "� " => "ǡ",
|
191 |
-
"Ǟ" => "ǟ", "Ǜ" => "ǜ", "Ǚ" => "ǚ",
|
192 |
-
"Ǘ" => "ǘ", "Ǖ" => "ǖ", "Ǔ" => "ǔ",
|
193 |
-
"Ǒ" => "ǒ", "Ǐ" => "ǐ", "Ǎ" => "ǎ",
|
194 |
-
"NJ" => "nj", "LJ" => "lj", "DŽ" => "dž",
|
195 |
-
"Ƽ" => "ƽ", "Ƹ" => "ƹ", "Ʒ" => "ʒ",
|
196 |
-
"Ƶ" => "ƶ", "Ƴ" => "ƴ", "Ʋ" => "ʋ",
|
197 |
-
"Ʊ" => "ʊ", "Ư" => "ư", "Ʈ" => "ʈ",
|
198 |
-
"Ƭ" => "ƭ", "Ʃ" => "ʃ", "Ƨ" => "ƨ",
|
199 |
-
"Ʀ" => "ʀ", "Ƥ" => "ƥ", "Ƣ" => "ƣ",
|
200 |
-
"� " => "ơ", "Ɵ" => "ɵ", "Ɲ" => "ɲ",
|
201 |
-
"Ɯ" => "ɯ", "Ƙ" => "ƙ", "Ɨ" => "ɨ",
|
202 |
-
"Ɩ" => "ɩ", "Ɣ" => "ɣ", "Ɠ" => "� ",
|
203 |
-
"Ƒ" => "ƒ", "Ɛ" => "ɛ", "Ə" => "ə",
|
204 |
-
"Ǝ" => "ǝ", "Ƌ" => "ƌ", "Ɗ" => "ɗ",
|
205 |
-
"Ɖ" => "ɖ", "Ƈ" => "ƈ", "Ɔ" => "ɔ",
|
206 |
-
"Ƅ" => "ƅ", "Ƃ" => "ƃ", "Ɓ" => "ɓ",
|
207 |
-
"Ž" => "ž", "Ż" => "ż", "Ź" => "ź",
|
208 |
-
"Ÿ" => "ÿ", "Ŷ" => "ŷ", "Ŵ" => "ŵ",
|
209 |
-
"Ų" => "ų", "Ű" => "ű", "Ů" => "ů",
|
210 |
-
"Ŭ" => "ŭ", "Ū" => "ū", "Ũ" => "ũ",
|
211 |
-
"Ŧ" => "ŧ", "Ť" => "ť", "Ţ" => "ţ",
|
212 |
-
"� " => "š", "Ş" => "ş", "Ŝ" => "ŝ",
|
213 |
-
"Ś" => "ś", "Ř" => "ř", "Ŗ" => "ŗ",
|
214 |
-
"Ŕ" => "ŕ", "Œ" => "œ", "Ő" => "ő",
|
215 |
-
"Ŏ" => "ŏ", "Ō" => "ō", "Ŋ" => "ŋ",
|
216 |
-
"Ň" => "ň", "Ņ" => "ņ", "Ń" => "ń",
|
217 |
-
"Ł" => "ł", "Ŀ" => "ŀ", "Ľ" => "ľ",
|
218 |
-
"Ļ" => "ļ", "Ĺ" => "ĺ", "Ķ" => "ķ",
|
219 |
-
"Ĵ" => "ĵ", "IJ" => "ij", "İ" => "i",
|
220 |
-
"Į" => "į", "Ĭ" => "ĭ", "Ī" => "ī",
|
221 |
-
"Ĩ" => "ĩ", "Ħ" => "ħ", "Ĥ" => "ĥ",
|
222 |
-
"Ģ" => "ģ", "� " => "ġ", "Ğ" => "ğ",
|
223 |
-
"Ĝ" => "ĝ", "Ě" => "ě", "Ę" => "ę",
|
224 |
-
"Ė" => "ė", "Ĕ" => "ĕ", "Ē" => "ē",
|
225 |
-
"Đ" => "đ", "Ď" => "ď", "Č" => "č",
|
226 |
-
"Ċ" => "ċ", "Ĉ" => "ĉ", "Ć" => "ć",
|
227 |
-
"Ą" => "ą", "Ă" => "ă", "Ā" => "ā",
|
228 |
-
"Þ" => "þ", "Ý" => "ý", "Ü" => "ü",
|
229 |
-
"Û" => "û", "Ú" => "ú", "Ù" => "ù",
|
230 |
-
"Ø" => "ø", "Ö" => "ö", "Õ" => "õ",
|
231 |
-
"Ô" => "ô", "Ó" => "ó", "Ò" => "ò",
|
232 |
-
"Ñ" => "ñ", "Ð" => "ð", "Ï" => "ï",
|
233 |
-
"Î" => "î", "Í" => "í", "Ì" => "ì",
|
234 |
-
"Ë" => "ë", "Ê" => "ê", "É" => "é",
|
235 |
-
"È" => "è", "Ç" => "ç", "Æ" => "æ",
|
236 |
-
"Å" => "å", "Ä" => "ä", "Ã" => "ã",
|
237 |
-
"Â" => "â", "Á" => "á", "À" => "� ",
|
238 |
-
"Z" => "z", "Y" => "y", "X" => "x",
|
239 |
-
"W" => "w", "V" => "v", "U" => "u",
|
240 |
-
"T" => "t", "S" => "s", "R" => "r",
|
241 |
-
"Q" => "q", "P" => "p", "O" => "o",
|
242 |
-
"N" => "n", "M" => "m", "L" => "l",
|
243 |
-
"K" => "k", "J" => "j", "I" => "i",
|
244 |
-
"H" => "h", "G" => "g", "F" => "f",
|
245 |
-
"E" => "e", "D" => "d", "C" => "c",
|
246 |
-
"B" => "b", "A" => "a",
|
247 |
-
);
|
248 |
-
|
249 |
-
|
250 |
-
$UTF8_TABLES['strtoupper'] = array(
|
251 |
-
"z" => "Z", "y" => "Y", "x" => "X",
|
252 |
-
"w" => "W", "v" => "V", "u" => "U",
|
253 |
-
"t" => "T", "s" => "S", "r" => "R",
|
254 |
-
"q" => "Q", "p" => "P", "o" => "O",
|
255 |
-
"n" => "N", "m" => "M", "l" => "L",
|
256 |
-
"k" => "K", "j" => "J", "i" => "I",
|
257 |
-
"h" => "H", "g" => "G", "f" => "F",
|
258 |
-
"e" => "E", "d" => "D", "c" => "C",
|
259 |
-
"b" => "B", "a" => "A", "ῳ" => "ῼ",
|
260 |
-
"ῥ" => "Ῥ", "ῡ" => "Ῡ", "� " => "Ῠ",
|
261 |
-
"ῑ" => "Ῑ", "ῐ" => "Ῐ", "ῃ" => "ῌ",
|
262 |
-
"ι" => "Ι", "ᾳ" => "ᾼ", "ᾱ" => "Ᾱ",
|
263 |
-
"ᾰ" => "Ᾰ", "ᾧ" => "ᾯ", "ᾦ" => "ᾮ",
|
264 |
-
"ᾥ" => "ᾭ", "ᾤ" => "ᾬ", "ᾣ" => "ᾫ",
|
265 |
-
"ᾢ" => "ᾪ", "ᾡ" => "ᾩ", "� " => "ᾨ",
|
266 |
-
"ᾗ" => "ᾟ", "ᾖ" => "ᾞ", "ᾕ" => "ᾝ",
|
267 |
-
"ᾔ" => "ᾜ", "ᾓ" => "ᾛ", "ᾒ" => "ᾚ",
|
268 |
-
"ᾑ" => "ᾙ", "ᾐ" => "ᾘ", "ᾇ" => "ᾏ",
|
269 |
-
"ᾆ" => "ᾎ", "ᾅ" => "ᾍ", "ᾄ" => "ᾌ",
|
270 |
-
"ᾃ" => "ᾋ", "ᾂ" => "ᾊ", "ᾁ" => "ᾉ",
|
271 |
-
"ᾀ" => "ᾈ", "ώ" => "Ώ", "ὼ" => "Ὼ",
|
272 |
-
"ύ" => "Ύ", "ὺ" => "Ὺ", "ό" => "Ό",
|
273 |
-
"ὸ" => "Ὸ", "ί" => "Ί", "ὶ" => "Ὶ",
|
274 |
-
"ή" => "Ή", "ὴ" => "Ὴ", "έ" => "Έ",
|
275 |
-
"ὲ" => "Ὲ", "ά" => "Ά", "ὰ" => "Ὰ",
|
276 |
-
"ὧ" => "Ὧ", "ὦ" => "Ὦ", "ὥ" => "Ὥ",
|
277 |
-
"ὤ" => "Ὤ", "ὣ" => "Ὣ", "ὢ" => "Ὢ",
|
278 |
-
"ὡ" => "Ὡ", "� " => "Ὠ", "ὗ" => "Ὗ",
|
279 |
-
"ὕ" => "Ὕ", "ὓ" => "Ὓ", "ὑ" => "Ὑ",
|
280 |
-
"ὅ" => "Ὅ", "ὄ" => "Ὄ", "ὃ" => "Ὃ",
|
281 |
-
"ὂ" => "Ὂ", "ὁ" => "Ὁ", "ὀ" => "Ὀ",
|
282 |
-
"ἷ" => "Ἷ", "ἶ" => "Ἶ", "ἵ" => "Ἵ",
|
283 |
-
"ἴ" => "Ἴ", "ἳ" => "Ἳ", "ἲ" => "Ἲ",
|
284 |
-
"ἱ" => "Ἱ", "ἰ" => "Ἰ", "ἧ" => "Ἧ",
|
285 |
-
"ἦ" => "Ἦ", "ἥ" => "Ἥ", "ἤ" => "Ἤ",
|
286 |
-
"ἣ" => "Ἣ", "ἢ" => "Ἢ", "ἡ" => "Ἡ",
|
287 |
-
"� " => "Ἠ", "ἕ" => "Ἕ", "ἔ" => "Ἔ",
|
288 |
-
"ἓ" => "Ἓ", "ἒ" => "Ἒ", "ἑ" => "Ἑ",
|
289 |
-
"ἐ" => "Ἐ", "ἇ" => "Ἇ", "ἆ" => "Ἆ",
|
290 |
-
"ἅ" => "Ἅ", "ἄ" => "Ἄ", "ἃ" => "Ἃ",
|
291 |
-
"ἂ" => "Ἂ", "ἁ" => "Ἁ", "ἀ" => "Ἀ",
|
292 |
-
"ỹ" => "Ỹ", "ỷ" => "Ỷ", "ỵ" => "Ỵ",
|
293 |
-
"ỳ" => "Ỳ", "ự" => "Ự", "ữ" => "Ữ",
|
294 |
-
"ử" => "Ử", "ừ" => "Ừ", "ứ" => "Ứ",
|
295 |
-
"ủ" => "Ủ", "ụ" => "Ụ", "ợ" => "Ợ",
|
296 |
-
"ỡ" => "� ", "ở" => "Ở", "ờ" => "Ờ",
|
297 |
-
"ớ" => "Ớ", "ộ" => "Ộ", "ỗ" => "Ỗ",
|
298 |
-
"ổ" => "Ổ", "ồ" => "Ồ", "ố" => "Ố",
|
299 |
-
"ỏ" => "Ỏ", "ọ" => "Ọ", "ị" => "Ị",
|
300 |
-
"ỉ" => "Ỉ", "ệ" => "Ệ", "ễ" => "Ễ",
|
301 |
-
"ể" => "Ể", "ề" => "Ề", "ế" => "Ế",
|
302 |
-
"ẽ" => "Ẽ", "ẻ" => "Ẻ", "ẹ" => "Ẹ",
|
303 |
-
"ặ" => "Ặ", "ẵ" => "Ẵ", "ẳ" => "Ẳ",
|
304 |
-
"ằ" => "Ằ", "ắ" => "Ắ", "ậ" => "Ậ",
|
305 |
-
"ẫ" => "Ẫ", "ẩ" => "Ẩ", "ầ" => "Ầ",
|
306 |
-
"ấ" => "Ấ", "ả" => "Ả", "ạ" => "� ",
|
307 |
-
"ẛ" => "� ", "ẕ" => "Ẕ", "ẓ" => "Ẓ",
|
308 |
-
"ẑ" => "Ẑ", "ẏ" => "Ẏ", "ẍ" => "Ẍ",
|
309 |
-
"ẋ" => "Ẋ", "ẉ" => "Ẉ", "ẇ" => "Ẇ",
|
310 |
-
"ẅ" => "Ẅ", "ẃ" => "Ẃ", "ẁ" => "Ẁ",
|
311 |
-
"ṿ" => "Ṿ", "ṽ" => "Ṽ", "ṻ" => "Ṻ",
|
312 |
-
"ṹ" => "Ṹ", "ṷ" => "Ṷ", "ṵ" => "Ṵ",
|
313 |
-
"ṳ" => "Ṳ", "ṱ" => "Ṱ", "ṯ" => "Ṯ",
|
314 |
-
"ṭ" => "Ṭ", "ṫ" => "Ṫ", "ṩ" => "Ṩ",
|
315 |
-
"ṧ" => "Ṧ", "ṥ" => "Ṥ", "ṣ" => "Ṣ",
|
316 |
-
"ṡ" => "� ", "ṟ" => "Ṟ", "ṝ" => "Ṝ",
|
317 |
-
"ṛ" => "Ṛ", "ṙ" => "Ṙ", "ṗ" => "Ṗ",
|
318 |
-
"ṕ" => "Ṕ", "ṓ" => "Ṓ", "ṑ" => "Ṑ",
|
319 |
-
"ṏ" => "Ṏ", "ṍ" => "Ṍ", "ṋ" => "Ṋ",
|
320 |
-
"ṉ" => "Ṉ", "ṇ" => "Ṇ", "ṅ" => "Ṅ",
|
321 |
-
"ṃ" => "Ṃ", "ṁ" => "Ṁ", "ḿ" => "Ḿ",
|
322 |
-
"ḽ" => "Ḽ", "ḻ" => "Ḻ", "ḹ" => "Ḹ",
|
323 |
-
"ḷ" => "Ḷ", "ḵ" => "Ḵ", "ḳ" => "Ḳ",
|
324 |
-
"ḱ" => "Ḱ", "ḯ" => "Ḯ", "ḭ" => "Ḭ",
|
325 |
-
"ḫ" => "Ḫ", "ḩ" => "Ḩ", "ḧ" => "Ḧ",
|
326 |
-
"ḥ" => "Ḥ", "ḣ" => "Ḣ", "ḡ" => "� ",
|
327 |
-
"ḟ" => "Ḟ", "ḝ" => "Ḝ", "ḛ" => "Ḛ",
|
328 |
-
"ḙ" => "Ḙ", "ḗ" => "Ḗ", "ḕ" => "Ḕ",
|
329 |
-
"ḓ" => "Ḓ", "ḑ" => "Ḑ", "ḏ" => "Ḏ",
|
330 |
-
"ḍ" => "Ḍ", "ḋ" => "Ḋ", "ḉ" => "Ḉ",
|
331 |
-
"ḇ" => "Ḇ", "ḅ" => "Ḅ", "ḃ" => "Ḃ",
|
332 |
-
"ḁ" => "Ḁ", "ֆ" => "Ֆ", "օ" => "Օ",
|
333 |
-
"ք" => "Ք", "փ" => "Փ", "ւ" => "Ւ",
|
334 |
-
"ց" => "Ց", "ր" => "Ր", "տ" => "Տ",
|
335 |
-
"վ" => "Վ", "ս" => "Ս", "ռ" => "Ռ",
|
336 |
-
"ջ" => "Ջ", "պ" => "Պ", "չ" => "Չ",
|
337 |
-
"ո" => "Ո", "շ" => "Շ", "ն" => "Ն",
|
338 |
-
"յ" => "Յ", "մ" => "Մ", "ճ" => "Ճ",
|
339 |
-
"ղ" => "Ղ", "ձ" => "Ձ", "հ" => "Հ",
|
340 |
-
"կ" => "Կ", "ծ" => "Ծ", "խ" => "Խ",
|
341 |
-
"լ" => "Լ", "ի" => "Ի", "ժ" => "Ժ",
|
342 |
-
"թ" => "Թ", "ը" => "Ը", "է" => "Է",
|
343 |
-
"զ" => "Զ", "ե" => "Ե", "դ" => "Դ",
|
344 |
-
"գ" => "Գ", "բ" => "Բ", "ա" => "Ա",
|
345 |
-
"ԏ" => "Ԏ", "ԍ" => "Ԍ", "ԋ" => "Ԋ",
|
346 |
-
"ԉ" => "Ԉ", "ԇ" => "Ԇ", "ԅ" => "Ԅ",
|
347 |
-
"ԃ" => "Ԃ", "ԁ" => "Ԁ", "ӹ" => "Ӹ",
|
348 |
-
"ӵ" => "Ӵ", "ӳ" => "Ӳ", "ӱ" => "Ӱ",
|
349 |
-
"ӯ" => "Ӯ", "ӭ" => "Ӭ", "ӫ" => "Ӫ",
|
350 |
-
"ө" => "Ө", "ӧ" => "Ӧ", "ӥ" => "Ӥ",
|
351 |
-
"ӣ" => "Ӣ", "ӡ" => "� ", "ӟ" => "Ӟ",
|
352 |
-
"ӝ" => "Ӝ", "ӛ" => "Ӛ", "ә" => "Ә",
|
353 |
-
"ӗ" => "Ӗ", "ӕ" => "Ӕ", "ӓ" => "Ӓ",
|
354 |
-
"ӑ" => "Ӑ",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
|
376 |
-
"ё" => "Ё", "ѐ" => "Ѐ", "я" => "Я",
|
377 |
-
"ю" => "Ю", "э" => "Э", "ь" => "Ь",
|
378 |
-
"ы" => "Ы", "ъ" => "Ъ", "щ" => "Щ",
|
379 |
-
"ш" => "Ш", "ч" => "Ч", "ц" => "Ц",
|
380 |
-
"х" => "Х", "ф" => "Ф", "у" => "У",
|
381 |
-
"т" => "Т", "с" => "С", "р" => "� ",
|
382 |
-
"п" => "П", "о" => "О", "н" => "Н",
|
383 |
-
"м" => "М", "л" => "Л", "к" => "К",
|
384 |
-
"й" => "Й", "и" => "И", "з" => "З",
|
385 |
-
"ж" => "Ж", "е" => "Е", "д" => "Д",
|
386 |
-
"г" => "Г", "в" => "В", "б" => "Б",
|
387 |
-
"а" => "А", "ϵ" => "Ε", "ϲ" => "Σ",
|
388 |
-
"ϱ" => "Ρ", "ϰ" => "Κ", "ϯ" => "Ϯ",
|
389 |
-
"ϭ" => "Ϭ", "ϫ" => "Ϫ", "ϩ" => "Ϩ",
|
390 |
-
"ϧ" => "Ϧ", "ϥ" => "Ϥ", "ϣ" => "Ϣ",
|
391 |
-
"ϡ" => "� ", "ϟ" => "Ϟ", "ϝ" => "Ϝ",
|
392 |
-
"ϛ" => "Ϛ", "ϙ" => "Ϙ", "ϖ" => "� ",
|
393 |
-
"ϕ" => "Φ", "ϑ" => "Θ", "ϐ" => "Β",
|
394 |
-
"ώ" => "Ώ", "ύ" => "Ύ", "ό" => "Ό",
|
395 |
-
"ϋ" => "Ϋ", "ϊ" => "Ϊ", "ω" => "Ω",
|
396 |
-
"ψ" => "Ψ", "χ" => "Χ", "φ" => "Φ",
|
397 |
-
"υ" => "Υ", "τ" => "Τ", "σ" => "Σ",
|
398 |
-
"ς" => "Σ", "ρ" => "Ρ", "π" => "� ",
|
399 |
-
"ο" => "Ο", "ξ" => "Ξ", "ν" => "Ν",
|
400 |
-
"μ" => "Μ", "λ" => "Λ", "κ" => "Κ",
|
401 |
-
"ι" => "Ι", "θ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",
|
423 |
-
"ǩ" => "Ǩ", "ǧ" => "Ǧ", "ǥ" => "Ǥ",
|
424 |
-
"ǣ" => "Ǣ", "ǡ" => "� ", "ǟ" => "Ǟ",
|
425 |
-
"ǝ" => "Ǝ", "ǜ" => "Ǜ", "ǚ" => "Ǚ",
|
426 |
-
"ǘ" => "Ǘ", "ǖ" => "Ǖ", "ǔ" => "Ǔ",
|
427 |
-
"ǒ" => "Ǒ", "ǐ" => "Ǐ", "ǎ" => "Ǎ",
|
428 |
-
"nj" => "Nj", "lj" => "Lj", "dž" => "Dž",
|
429 |
-
"ƿ" => "Ƿ", "ƽ" => "Ƽ", "ƹ" => "Ƹ",
|
430 |
-
"ƶ" => "Ƶ", "ƴ" => "Ƴ", "ư" => "Ư",
|
431 |
-
"ƭ" => "Ƭ", "ƨ" => "Ƨ", "ƥ" => "Ƥ",
|
432 |
-
"ƣ" => "Ƣ", "ơ" => "� ", "ƞ" => "� ",
|
433 |
-
"ƙ" => "Ƙ", "ƕ" => "Ƕ", "ƒ" => "Ƒ",
|
434 |
-
"ƌ" => "Ƌ", "ƈ" => "Ƈ", "ƅ" => "Ƅ",
|
435 |
-
"ƃ" => "Ƃ", "ſ" => "S", "ž" => "Ž",
|
436 |
-
"ż" => "Ż", "ź" => "Ź", "ŷ" => "Ŷ",
|
437 |
-
"ŵ" => "Ŵ", "ų" => "Ų", "ű" => "Ű",
|
438 |
-
"ů" => "Ů", "ŭ" => "Ŭ", "ū" => "Ū",
|
439 |
-
"ũ" => "Ũ", "ŧ" => "Ŧ", "ť" => "Ť",
|
440 |
-
"ţ" => "Ţ", "š" => "� ", "ş" => "Ş",
|
441 |
-
"ŝ" => "Ŝ", "ś" => "Ś", "ř" => "Ř",
|
442 |
-
"ŗ" => "Ŗ", "ŕ" => "Ŕ", "œ" => "Œ",
|
443 |
-
"ő" => "Ő", "ŏ" => "Ŏ", "ō" => "Ō",
|
444 |
-
"ŋ" => "Ŋ", "ň" => "Ň", "ņ" => "Ņ",
|
445 |
-
"ń" => "Ń", "ł" => "Ł", "ŀ" => "Ŀ",
|
446 |
-
"ľ" => "Ľ", "ļ" => "Ļ", "ĺ" => "Ĺ",
|
447 |
-
"ķ" => "Ķ", "ĵ" => "Ĵ", "ij" => "IJ",
|
448 |
-
"ı" => "I", "į" => "Į", "ĭ" => "Ĭ",
|
449 |
-
"ī" => "Ī", "ĩ" => "Ĩ", "ħ" => "Ħ",
|
450 |
-
"ĥ" => "Ĥ", "ģ" => "Ģ", "ġ" => "� ",
|
451 |
-
"ğ" => "Ğ", "ĝ" => "Ĝ", "ě" => "Ě",
|
452 |
-
"ę" => "Ę", "ė" => "Ė", "ĕ" => "Ĕ",
|
453 |
-
"ē" => "Ē", "đ" => "Đ", "ď" => "Ď",
|
454 |
-
"č" => "Č", "ċ" => "Ċ", "ĉ" => "Ĉ",
|
455 |
-
"ć" => "Ć", "ą" => "Ą", "ă" => "Ă",
|
456 |
-
"ā" => "Ā", "ÿ" => "Ÿ", "þ" => "Þ",
|
457 |
-
"ý" => "Ý", "ü" => "Ü", "û" => "Û",
|
458 |
-
"ú" => "Ú", "ù" => "Ù", "ø" => "Ø",
|
459 |
-
"ö" => "Ö", "õ" => "Õ", "ô" => "Ô",
|
460 |
-
"ó" => "Ó", "ò" => "Ò", "ñ" => "Ñ",
|
461 |
-
"ð" => "Ð", "ï" => "Ï", "î" => "Î",
|
462 |
-
"í" => "Í", "ì" => "Ì", "ë" => "Ë",
|
463 |
-
"ê" => "Ê", "é" => "É", "è" => "È",
|
464 |
-
"ç" => "Ç", "æ" => "Æ", "å" => "Å",
|
465 |
-
"ä" => "Ä", "ã" => "Ã", "â" => "Â",
|
466 |
-
"á" => "Á", "� " => "À", "µ" => "Μ",
|
467 |
-
"z" => "Z", "y" => "Y", "x" => "X",
|
468 |
-
"w" => "W", "v" => "V", "u" => "U",
|
469 |
-
"t" => "T", "s" => "S", "r" => "R",
|
470 |
-
"q" => "Q", "p" => "P", "o" => "O",
|
471 |
-
"n" => "N", "m" => "M", "l" => "L",
|
472 |
-
"k" => "K", "j" => "J", "i" => "I",
|
473 |
-
"h" => "H", "g" => "G", "f" => "F",
|
474 |
-
"e" => "E", "d" => "D", "c" => "C",
|
475 |
-
"b" => "B", "a" => "A",
|
476 |
-
);
|
477 |
-
|
478 |
-
if ( ! defined( 'WP_CONTENT_URL' ) )
|
479 |
-
define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
|
480 |
-
if ( ! defined( 'WP_CONTENT_DIR' ) )
|
481 |
-
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
|
482 |
-
if ( ! defined( 'WP_PLUGIN_URL' ) )
|
483 |
-
define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
|
484 |
-
if ( ! defined( 'WP_PLUGIN_DIR' ) )
|
485 |
-
define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
|
486 |
-
|
487 |
-
require_once('aioseop.class.php');
|
488 |
-
|
489 |
-
global $aioseop_options;
|
490 |
-
$aioseop_options = get_option('aioseop_options');
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
/*
|
495 |
-
add_option("aiosp_home_description", null, 'All in One SEO Plugin Home Description', 'yes');
|
496 |
-
add_option("aiosp_home_title", null, 'All in One SEO Plugin Home Title', 'yes');
|
497 |
-
add_option("aiosp_donate", 0, 'All in One SEO Pack Donate', 'no');
|
498 |
-
add_option("aiosp_can", 1, 'All in One SEO Pack Canonical URLs', 'yes');
|
499 |
-
add_option("aiosp_rewrite_titles", 1, 'All in One SEO Plugin Rewrite Titles', 'yes');
|
500 |
-
add_option("aiosp_use_categories", 0, 'All in One SEO Plugin Use Categories', 'yes');
|
501 |
-
add_option("aiosp_category_noindex", 1, 'All in One SEO Plugin Noindex for Categories', 'yes');
|
502 |
-
add_option("aiosp_archive_noindex", 1, 'All in One SEO Plugin Noindex for Archives', 'yes');
|
503 |
-
add_option("aiosp_tags_noindex", 0, 'All in One SEO Plugin Noindex for Tag Archives', 'yes');
|
504 |
-
add_option("aiosp_generate_descriptions", 1, 'All in One SEO Plugin Autogenerate Descriptions', 'yes');
|
505 |
-
add_option("aiosp_post_title_format", '%post_title% | %blog_title%', 'All in One SEO Plugin Post Title Format', 'yes');
|
506 |
-
add_option("aiosp_page_title_format", '%page_title% | %blog_title%', 'All in One SEO Plugin Page Title Format', 'yes');
|
507 |
-
add_option("aiosp_dynamic_postspage_keywords", 1, 'All in One SEO Plugin Dynamic Posts Page Keywords', 'yes');
|
508 |
-
add_option("aiosp_category_title_format", '%category_title% | %blog_title%', 'All in One SEO Plugin Category Title Format', 'yes');
|
509 |
-
add_option("aiosp_archive_title_format", '%date% | %blog_title%', 'All in One SEO Plugin Archive Title Format', 'yes');
|
510 |
-
add_option("aiosp_tag_title_format", '%tag% | %blog_title%', 'All in One SEO Plugin Tag Title Format', 'yes');
|
511 |
-
add_option("aiosp_search_title_format", '%search% | %blog_title%', 'All in One SEO Plugin Search Title Format', 'yes');
|
512 |
-
add_option("aiosp_description_format", '%description%', 'All in One SEO Plugin Description Format', 'yes');
|
513 |
-
add_option("aiosp_paged_format", ' - Part %page%', 'All in One SEO Plugin Paged Format', 'yes');
|
514 |
-
add_option("aiosp_404_title_format", 'Nothing found for %request_words%', 'All in One SEO Plugin 404 Title Format', 'yes');
|
515 |
-
add_option("aiosp_post_meta_tags", '', 'All in One SEO Plugin Additional Post Meta Tags', 'yes');
|
516 |
-
add_option("aiosp_page_meta_tags", '', 'All in One SEO Plugin Additional Post Meta Tags', 'yes');
|
517 |
-
add_option("aiosp_home_meta_tags", '', 'All in One SEO Plugin Additional Home Meta Tags', 'yes');
|
518 |
-
add_option("aiosp_do_log", null, 'All in One SEO Plugin write log file', 'yes');
|
519 |
-
*/
|
520 |
-
|
521 |
-
//$role = get_role('administrator');
|
522 |
-
//$role->add_cap('Edit AIOSEOP Options');
|
523 |
-
//$role->add_cap('Edit AIOSEOP on Posts/Pages');
|
524 |
-
|
525 |
-
////checking to see if things need to be updated
|
526 |
-
|
527 |
-
//if_post('turn-on'){
|
528 |
-
|
529 |
-
/* automattic?
|
530 |
-
if(!get_option('aioseop_options')){
|
531 |
-
aioseop_mrt_fix_meta(); //move this to the if also
|
532 |
-
aioseop_mrt_mkarry();
|
533 |
-
}
|
534 |
-
*/
|
535 |
-
|
536 |
-
if($_POST['aioseop_migrate']) aioseop_mrt_fix_meta();
|
537 |
-
if($_POST['aioseop_migrate_options']) aioseop_mrt_mkarry();
|
538 |
-
if(!get_option('aiosp_post_title_format') && !get_option('aioseop_options')) aioseop_mrt_mkarry();
|
539 |
-
|
540 |
-
//}end _post('turn_on')
|
541 |
-
|
542 |
-
|
543 |
-
////end checking to see if things need to be updated
|
544 |
-
|
545 |
-
|
546 |
-
function aioseop_mrt_fix_meta(){
|
547 |
-
global $wpdb;
|
548 |
-
$wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_aioseop_keywords' WHERE meta_key = 'keywords'");
|
549 |
-
$wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_aioseop_title' WHERE meta_key = 'title'");
|
550 |
-
$wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_aioseop_description' WHERE meta_key = 'description'");
|
551 |
-
$wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_aioseop_meta' WHERE meta_key = 'aiosp_meta'");
|
552 |
-
$wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_aioseop_disable' WHERE meta_key = 'aiosp_disable'");
|
553 |
-
echo "<div class='updated fade' style='background-color:green;border-color:green;'><p><strong>Updating SEO post meta in database.</strong></p></div";
|
554 |
-
}
|
555 |
-
|
556 |
-
function aioseop_get_version(){
|
557 |
-
return '1.6.2';
|
558 |
-
}
|
559 |
-
|
560 |
-
|
561 |
-
function aioseop_mrt_mkarry() {
|
562 |
-
$naioseop_options = array(
|
563 |
-
"aiosp_can"=>1,
|
564 |
-
"aiosp_donate"=>0,
|
565 |
-
"aiosp_home_title"=>null,
|
566 |
-
"aiosp_home_description"=>'',
|
567 |
-
"aiosp_home_keywords"=>null,
|
568 |
-
"aiosp_max_words_excerpt"=>'something',
|
569 |
-
"aiosp_rewrite_titles"=>1,
|
570 |
-
"aiosp_post_title_format"=>'%post_title% | %blog_title%',
|
571 |
-
"aiosp_page_title_format"=>'%page_title% | %blog_title%',
|
572 |
-
"aiosp_category_title_format"=>'%category_title% | %blog_title%',
|
573 |
-
"aiosp_archive_title_format"=>'%date% | %blog_title%',
|
574 |
-
"aiosp_tag_title_format"=>'%tag% | %blog_title%',
|
575 |
-
"aiosp_search_title_format"=>'%search% | %blog_title%',
|
576 |
-
"aiosp_description_format"=>'%description%',
|
577 |
-
"aiosp_404_title_format"=>'Nothing found for %request_words%',
|
578 |
-
"aiosp_paged_format"=>' - Part %page%',
|
579 |
-
"aiosp_use_categories"=>0,
|
580 |
-
"aiosp_dynamic_postspage_keywords"=>1,
|
581 |
-
"aiosp_category_noindex"=>1,
|
582 |
-
"aiosp_archive_noindex"=>1,
|
583 |
-
"aiosp_tags_noindex"=>0,
|
584 |
-
"aiosp_generate_descriptions"=>1,
|
585 |
-
"aiosp_debug_info"=>null,
|
586 |
-
"aiosp_post_meta_tags"=>'',
|
587 |
-
"aiosp_page_meta_tags"=>'',
|
588 |
-
"aiosp_home_meta_tags"=>'',
|
589 |
-
"aiosp_enabled" =>0,
|
590 |
-
"aiosp_do_log"=>null);
|
591 |
-
|
592 |
-
foreach( $naioseop_options as $aioseop_opt_name => $value ) {
|
593 |
-
if( $aioseop_oldval = get_option($aioseop_opt_name) ) {
|
594 |
-
$naioseop_options[$aioseop_opt_name] = $aioseop_oldval;
|
595 |
-
|
596 |
-
}
|
597 |
-
delete_option($aioseop_opt_name);
|
598 |
-
}
|
599 |
-
|
600 |
-
add_option('aioseop_options',$naioseop_options);
|
601 |
-
echo "<div class='updated fade' style='background-color:green;border-color:green;'><p><strong>Updating SEO configuration options in database</strong></p></div";
|
602 |
-
|
603 |
-
}
|
604 |
-
//if( function_exists( 'is_site_admin' ) ) {
|
605 |
-
|
606 |
-
function aioseop_activation_notice(){
|
607 |
-
global $aioseop_options;
|
608 |
-
echo '<div class="error fade" style="background-color:red;"><p><strong>All in One SEO Pack must be configured. Go to <a href="' . admin_url( 'options-general.php?page=all-in-one-seo-pack/aioseop.class.php' ) . '">the admin page</a> to enable and configure the plugin.</strong></p></div>';
|
609 |
-
|
610 |
-
}
|
611 |
-
|
612 |
-
//add_action('after_plugin_row_all-in-one-seo-pack/all_in_one_seo_pack.php', 'add_plugin_row', 10, 2);
|
613 |
-
|
614 |
-
function add_plugin_row($links, $file) {
|
615 |
-
|
616 |
-
echo '<td colspan="5" style="background-color:yellow;">';
|
617 |
-
echo wp_remote_fopen('http://aioseop.semperfiwebdesign.com/');
|
618 |
-
echo '</td>';
|
619 |
-
|
620 |
-
}
|
621 |
-
function aioseop_activate_pl(){
|
622 |
-
if(get_option('aioseop_options')){
|
623 |
-
$aioseop_options = get_option('aioseop_options');
|
624 |
-
$aioseop_options['aiosp_enabled'] = "0";
|
625 |
-
$aioseop_options['aiosp_donate'] = "0";
|
626 |
-
update_option('aioseop_options',$aioseop_options);
|
627 |
-
}
|
628 |
-
}
|
629 |
-
|
630 |
-
|
631 |
-
if($aioseop_options['aiosp_enabled']){
|
632 |
-
add_action('wp_list_pages', 'aioseop_list_pages');
|
633 |
-
|
634 |
-
}
|
635 |
-
$aiosp = new All_in_One_SEO_Pack();
|
636 |
-
add_action('edit_post', array($aiosp, 'post_meta_tags'));
|
637 |
-
add_action('publish_post', array($aiosp, 'post_meta_tags'));
|
638 |
-
add_action('save_post', array($aiosp, 'post_meta_tags'));
|
639 |
-
add_action('edit_page_form', array($aiosp, 'post_meta_tags'));
|
640 |
-
add_action('init', array($aiosp, 'init'));
|
641 |
-
add_action('wp_head', array($aiosp, 'wp_head'));
|
642 |
-
add_action('template_redirect', array($aiosp, 'template_redirect'));
|
643 |
-
//add_action('admin_head',array($aiosp, 'seo_mrt_admin_head');
|
644 |
-
add_action('admin_menu', array($aiosp, 'admin_menu'));
|
645 |
-
add_action('admin_menu', 'aiosp_meta_box_add');
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
if( ($_POST['aiosp_enabled'] == null && $aioseop_options['aiosp_enabled']!='1') || $_POST['aiosp_enabled']=='0'){
|
650 |
-
add_action( 'admin_notices', 'aioseop_activation_notice');
|
651 |
-
}
|
652 |
-
|
653 |
-
// Thanks to SarahG for much of the code for the following two functions
|
654 |
-
function aioseop_list_pages($content){
|
655 |
-
$url = preg_replace(array('/\//', '/\./', '/\-/'), array('\/', '\.', '\-'), get_option('siteurl'));
|
656 |
-
$pattern = '/<li class="page_item page-item-(\d+)([^\"]*)"><a href=\"([^\"]+)" title="([^\"]+)">([^<]+)<\/a>/i';
|
657 |
-
return preg_replace_callback($pattern, "aioseop_filter_callback", $content);
|
658 |
-
}
|
659 |
-
|
660 |
-
function aioseop_filter_callback($matches) {
|
661 |
-
global $wpdb;
|
662 |
-
if ($matches[1] && !empty($matches[1])) $postID = $matches[1];
|
663 |
-
if (empty($postID)) $postID = get_option("page_on_front");
|
664 |
-
$title_attrib = stripslashes(get_post_meta($postID, '_aioseop_titleatr', true));
|
665 |
-
$menulabel = stripslashes(get_post_meta($postID, '_aioseop_menulabel', true));
|
666 |
-
if (empty($menulabel)) $menulabel = $matches[4];
|
667 |
-
if (!empty($title_attrib)) :
|
668 |
-
$filtered = '<li class="page_item page-item-'.$postID.$matches[2].'"><a href="'.$matches[3].'" title="'.$title_attrib.'">'.$menulabel.'</a>';
|
669 |
-
else :
|
670 |
-
$filtered = '<li class="page_item page-item-'.$postID.$matches[2].'"><a href="'.$matches[3].'">'.$menulabel.'</a>';
|
671 |
-
endif;
|
672 |
-
return $filtered;
|
673 |
-
}
|
674 |
-
|
675 |
-
if (substr($aiosp->wp_version, 0, 3) < '2.5') {
|
676 |
-
add_action('dbx_post_advanced', array($aiosp, 'add_meta_tags_textinput'));
|
677 |
-
add_action('dbx_page_advanced', array($aiosp, 'add_meta_tags_textinput'));
|
678 |
-
}
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
function aiosp_meta_box_add() {
|
684 |
-
if ( function_exists('add_meta_box') ) {
|
685 |
-
add_meta_box('aiosp',__('All in One SEO Pack', 'all_in_one_seo_pack'),'aiosp_meta','post');
|
686 |
-
add_meta_box('aiosp',__('All in One SEO Pack', 'all_in_one_seo_pack'),'aiosp_meta','page');
|
687 |
-
} else {
|
688 |
-
add_action('dbx_post_advanced', array($aiosp, 'add_meta_tags_textinput'));
|
689 |
-
add_action('dbx_page_advanced', array($aiosp, 'add_meta_tags_textinput'));
|
690 |
-
}
|
691 |
-
}
|
692 |
-
|
693 |
-
function aiosp_meta() {
|
694 |
-
|
695 |
-
global $post;
|
696 |
-
|
697 |
-
$post_id = $post;
|
698 |
-
if (is_object($post_id)){
|
699 |
-
$post_id = $post_id->ID;
|
700 |
-
}
|
701 |
-
$keywords = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_keywords', true)));
|
702 |
-
$title = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_title', true)));
|
703 |
-
$description = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_description', true)));
|
704 |
-
$aiosp_meta = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aiosp_meta', true)));
|
705 |
-
$aiosp_disable = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aiosp_disable', true)));
|
706 |
-
$aiosp_titleatr = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_titleatr', true)));
|
707 |
-
$aiosp_menulabel = htmlspecialchars(stripcslashes(get_post_meta($post_id, '_aioseop_menulabel', true)));
|
708 |
-
?>
|
709 |
-
<SCRIPT LANGUAGE="JavaScript">
|
710 |
-
<!-- Begin
|
711 |
-
function countChars(field,cntfield) {
|
712 |
-
cntfield.value = field.value.length;
|
713 |
-
}
|
714 |
-
// End -->
|
715 |
-
</script>
|
716 |
-
<input value="aiosp_edit" type="hidden" name="aiosp_edit" />
|
717 |
-
|
718 |
-
<a target="__blank" href="http://semperfiwebdesign.com/portfolio/wordpress/wordpress-plugins/all-in-one-seo-pack/"><?php _e('Click here for Support', 'all_in_one_seo_pack') ?></a>
|
719 |
-
<table style="margin-bottom:40px">
|
720 |
-
<tr>
|
721 |
-
<th style="text-align:left;" colspan="2">
|
722 |
-
</th>
|
723 |
-
</tr>
|
724 |
-
<tr>
|
725 |
-
<th scope="row" style="text-align:right;"><?php _e('Title:', 'all_in_one_seo_pack') ?></th>
|
726 |
-
<td><input value="<?php echo $title ?>" type="text" name="aiosp_title" size="62"/></td>
|
727 |
-
</tr>
|
728 |
-
<tr>
|
729 |
-
<th scope="row" style="text-align:right;"><?php _e('Description:', 'all_in_one_seo_pack') ?></th>
|
730 |
-
<td><textarea name="aiosp_description" rows="3" cols="60"
|
731 |
-
onKeyDown="countChars(document.post.aiosp_description,document.post.length1)"
|
732 |
-
onKeyUp="countChars(document.post.aiosp_description,document.post.length1)"><?php echo $description ?></textarea><br />
|
733 |
-
<input readonly type="text" name="length1" size="3" maxlength="3" value="<?php echo strlen($description);?>" />
|
734 |
-
<?php _e(' characters. Most search engines use a maximum of 160 chars for the description.', 'all_in_one_seo_pack') ?>
|
735 |
-
</td>
|
736 |
-
</tr>
|
737 |
-
<tr>
|
738 |
-
<th scope="row" style="text-align:right;"><?php _e('Keywords (comma separated):', 'all_in_one_seo_pack') ?></th>
|
739 |
-
<td><input value="<?php echo $keywords ?>" type="text" name="aiosp_keywords" size="62"/></td>
|
740 |
-
</tr>
|
741 |
-
<input type="hidden" name="nonce-aioseop-edit" value="<?php echo wp_create_nonce('edit-aioseop-nonce') ?>" />
|
742 |
-
<?php if($post->post_type=='page'){ ?>
|
743 |
-
<tr>
|
744 |
-
<th scope="row" style="text-align:right;"><?php _e('Title Attribute:', 'all_in_one_seo_pack') ?></th>
|
745 |
-
<td><input value="<?php echo $aiosp_titleatr ?>" type="text" name="aiosp_titleatr" size="62"/></td>
|
746 |
-
</tr>
|
747 |
-
|
748 |
-
<tr>
|
749 |
-
<th scope="row" style="text-align:right;"><?php _e('Menu Label:', 'all_in_one_seo_pack') ?></th>
|
750 |
-
<td><input value="<?php echo $aiosp_menulabel ?>" type="text" name="aiosp_menulabel" size="62"/></td>
|
751 |
-
</tr>
|
752 |
-
<?php } ?>
|
753 |
-
<tr>
|
754 |
-
<th scope="row" style="text-align:right; vertical-align:top;">
|
755 |
-
<?php _e('Disable on this page/post:', 'all_in_one_seo_pack')?>
|
756 |
-
</th>
|
757 |
-
<td>
|
758 |
-
<input type="checkbox" name="aiosp_disable" <?php if ($aiosp_disable) echo "checked=\"1\""; ?>/>
|
759 |
-
</td>
|
760 |
-
</tr>
|
761 |
-
|
762 |
-
|
763 |
-
</table>
|
764 |
-
<?php
|
765 |
-
}
|
766 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/all_in_one_seo_pack.pot
DELETED
@@ -1,293 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: \n"
|
4 |
-
"POT-Creation-Date: \n"
|
5 |
-
"PO-Revision-Date: 2007-12-11 06:09+0200\n"
|
6 |
-
"Last-Translator: Baris Unver <baris.unver@beyn.org>\n"
|
7 |
-
"Language-Team: \n"
|
8 |
-
"MIME-Version: 1.0\n"
|
9 |
-
"Content-Type: text/plain; charset=iso-8859-1\n"
|
10 |
-
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
|
12 |
-
msgid "All in One SEO Pack"
|
13 |
-
msgstr ""
|
14 |
-
|
15 |
-
msgid "Title:"
|
16 |
-
msgstr ""
|
17 |
-
|
18 |
-
msgid "Keywords (comma separated):"
|
19 |
-
msgstr ""
|
20 |
-
|
21 |
-
msgid "Description:"
|
22 |
-
msgstr ""
|
23 |
-
|
24 |
-
msgid " characters. Most search engines use a maximum of 160 chars for the description."
|
25 |
-
msgstr ""
|
26 |
-
|
27 |
-
msgid "All in One SEO"
|
28 |
-
msgstr ""
|
29 |
-
|
30 |
-
msgid "All in One SEO Options Updated."
|
31 |
-
msgstr ""
|
32 |
-
|
33 |
-
msgid "All in One SEO Plugin Options"
|
34 |
-
msgstr ""
|
35 |
-
|
36 |
-
msgid "This is version "
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
msgid "All in One SEO Plugin Release History"
|
40 |
-
msgstr ""
|
41 |
-
|
42 |
-
msgid "FAQ"
|
43 |
-
msgstr ""
|
44 |
-
|
45 |
-
msgid "All in One SEO Plugin Feedback"
|
46 |
-
msgstr ""
|
47 |
-
|
48 |
-
msgid "Feedback"
|
49 |
-
msgstr ""
|
50 |
-
|
51 |
-
msgid "All in One SEO Plugin Translations"
|
52 |
-
msgstr ""
|
53 |
-
|
54 |
-
msgid "Translations"
|
55 |
-
msgstr ""
|
56 |
-
|
57 |
-
msgid "Click for Help!"
|
58 |
-
msgstr ""
|
59 |
-
|
60 |
-
msgid "Home Title:"
|
61 |
-
msgstr ""
|
62 |
-
|
63 |
-
msgid "As the name implies, this will be the title of your homepage. This is independent of any other option. If not set, the default blog title will get used."
|
64 |
-
msgstr ""
|
65 |
-
|
66 |
-
msgid "Home Description:"
|
67 |
-
msgstr ""
|
68 |
-
|
69 |
-
msgid "The META description for your homepage. Independent of any other options, the default is no META description at all if this is not set."
|
70 |
-
msgstr ""
|
71 |
-
|
72 |
-
msgid "Home Keywords (comma separated):"
|
73 |
-
msgstr ""
|
74 |
-
|
75 |
-
msgid "A comma separated list of your most important keywords for your site that will be written as META keywords on your homepage. Don't stuff everything in here."
|
76 |
-
msgstr ""
|
77 |
-
|
78 |
-
msgid "Rewrite Titles:"
|
79 |
-
msgstr ""
|
80 |
-
|
81 |
-
msgid "Note that this is all about the title tag. This is what you see in your browser's window title bar. This is NOT visible on a page, only in the window title bar and of course in the source. If set, all page, post, category, search and archive page titles get rewritten. You can specify the format for most of them. For example: The default templates puts the title tag of posts like this: \"Blog Archive >> Blog Name >> Post Title\" (maybe I've overdone slightly). This is far from optimal. With the default post title format, Rewrite Title rewrites this to \"Post Title | Blog Name\". If you have manually defined a title (in one of the text fields for All in One SEO Plugin input) this will become the title of your post in the format string."
|
82 |
-
msgstr ""
|
83 |
-
|
84 |
-
msgid "Post Title Format:"
|
85 |
-
msgstr ""
|
86 |
-
|
87 |
-
msgid "The following macros are supported:"
|
88 |
-
msgstr ""
|
89 |
-
|
90 |
-
msgid "%blog_title% - Your blog title"
|
91 |
-
msgstr ""
|
92 |
-
|
93 |
-
msgid "%blog_description% - Your blog description"
|
94 |
-
msgstr ""
|
95 |
-
|
96 |
-
msgid "%post_title% - The original title of the post"
|
97 |
-
msgstr ""
|
98 |
-
|
99 |
-
msgid "%category_title% - The (main) category of the post"
|
100 |
-
msgstr ""
|
101 |
-
|
102 |
-
msgid "%category% - Alias for %category_title%"
|
103 |
-
msgstr ""
|
104 |
-
|
105 |
-
msgid "Page Title Format:"
|
106 |
-
msgstr ""
|
107 |
-
|
108 |
-
msgid "%page_title% - The original title of the page"
|
109 |
-
msgstr ""
|
110 |
-
|
111 |
-
msgid "Category Title Format:"
|
112 |
-
msgstr ""
|
113 |
-
|
114 |
-
msgid "%category_title% - The original title of the category"
|
115 |
-
msgstr ""
|
116 |
-
|
117 |
-
msgid "%category_description% - The description of the category"
|
118 |
-
msgstr ""
|
119 |
-
|
120 |
-
msgid "Archive Title Format:"
|
121 |
-
msgstr ""
|
122 |
-
|
123 |
-
msgid "%date% - The original archive title given by wordpress, e.g. \"2007\" or \"2007 August\""
|
124 |
-
msgstr ""
|
125 |
-
|
126 |
-
msgid "Tag Title Format:"
|
127 |
-
msgstr ""
|
128 |
-
|
129 |
-
msgid "%tag% - The name of the tag"
|
130 |
-
msgstr ""
|
131 |
-
|
132 |
-
msgid "Search Title Format:"
|
133 |
-
msgstr ""
|
134 |
-
|
135 |
-
msgid "%search% - What was searched for"
|
136 |
-
msgstr ""
|
137 |
-
|
138 |
-
msgid "Description Format:"
|
139 |
-
msgstr ""
|
140 |
-
|
141 |
-
msgid "%description% - The original description as determined by the plugin, e.g. the excerpt if one is set or an auto-generated one if that option is set"
|
142 |
-
msgstr ""
|
143 |
-
|
144 |
-
msgid "404 Title Format:"
|
145 |
-
msgstr ""
|
146 |
-
|
147 |
-
msgid "%request_url% - The original URL path, like \"/url-that-does-not-exist/\""
|
148 |
-
msgstr ""
|
149 |
-
|
150 |
-
msgid "%request_words% - The URL path in human readable form, like \"Url That Does Not Exist\""
|
151 |
-
msgstr ""
|
152 |
-
|
153 |
-
msgid "Use Categories for META keywords:"
|
154 |
-
msgstr ""
|
155 |
-
|
156 |
-
msgid "Check this if you want your categories for a given post used as the META keywords for this post (in addition to any keywords and tags you specify on the post edit page)."
|
157 |
-
msgstr ""
|
158 |
-
|
159 |
-
msgid "Use noindex for Categories:"
|
160 |
-
msgstr ""
|
161 |
-
|
162 |
-
msgid "Check this for excluding category pages from being crawled. Useful for avoiding duplicate content."
|
163 |
-
msgstr ""
|
164 |
-
|
165 |
-
msgid "Use noindex for Archives:"
|
166 |
-
msgstr ""
|
167 |
-
|
168 |
-
msgid "Check this for excluding archive pages from being crawled. Useful for avoiding duplicate content."
|
169 |
-
msgstr ""
|
170 |
-
|
171 |
-
msgid "Use noindex for Tag Archives:"
|
172 |
-
msgstr ""
|
173 |
-
|
174 |
-
msgid "Check this for excluding tag pages from being crawled. Useful for avoiding duplicate content."
|
175 |
-
msgstr ""
|
176 |
-
|
177 |
-
msgid "Autogenerate Descriptions:"
|
178 |
-
msgstr ""
|
179 |
-
|
180 |
-
msgid "Check this and your META descriptions will get autogenerated if there's no excerpt."
|
181 |
-
msgstr ""
|
182 |
-
|
183 |
-
msgid "Update Options"
|
184 |
-
msgstr ""
|
185 |
-
|
186 |
-
msgid "Additional Post Headers:"
|
187 |
-
msgstr ""
|
188 |
-
|
189 |
-
msgid "Additional Page Headers:"
|
190 |
-
msgstr ""
|
191 |
-
|
192 |
-
msgid "What you enter here will be copied verbatim to your header on post pages. You can enter whatever additional headers you want here, even references to stylesheets."
|
193 |
-
msgstr ""
|
194 |
-
|
195 |
-
msgid "What you enter here will be copied verbatim to your header on pages. You can enter whatever additional headers you want here, even references to stylesheets."
|
196 |
-
msgstr ""
|
197 |
-
|
198 |
-
msgid "%wp_title% - The original wordpress title, e.g. post_title for posts"
|
199 |
-
msgstr ""
|
200 |
-
|
201 |
-
msgid "Upgraded to newest version. Please revisit the options page to make sure you see the newest version."
|
202 |
-
msgstr ""
|
203 |
-
|
204 |
-
msgid "Upgrade failed"
|
205 |
-
msgstr ""
|
206 |
-
|
207 |
-
msgid "(Remember: Backup early, backup often!)"
|
208 |
-
msgstr ""
|
209 |
-
|
210 |
-
msgid "Please make sure that %s is writable."
|
211 |
-
msgstr ""
|
212 |
-
|
213 |
-
msgid "One Click Upgrade"
|
214 |
-
msgstr ""
|
215 |
-
|
216 |
-
msgid "Should I upgrade?"
|
217 |
-
msgstr ""
|
218 |
-
|
219 |
-
msgid "Additional META:"
|
220 |
-
msgstr ""
|
221 |
-
|
222 |
-
msgid "Could not download distribution (%s)"
|
223 |
-
msgstr ""
|
224 |
-
|
225 |
-
msgid "Could not download distribution (%s): %s"
|
226 |
-
msgstr ""
|
227 |
-
|
228 |
-
msgid "Could not open %s for writing"
|
229 |
-
msgstr ""
|
230 |
-
|
231 |
-
msgid "Please make sure %s is writable"
|
232 |
-
msgstr ""
|
233 |
-
|
234 |
-
msgid "Could not write to %s"
|
235 |
-
msgstr ""
|
236 |
-
|
237 |
-
msgid "Disable on this page/post:"
|
238 |
-
msgstr ""
|
239 |
-
|
240 |
-
msgid "Paged Format:"
|
241 |
-
msgstr ""
|
242 |
-
|
243 |
-
msgid "This string gets appended/prepended to titles when they are for paged index pages (like home or archive pages)."
|
244 |
-
msgstr ""
|
245 |
-
|
246 |
-
msgid "%page% - The page number"
|
247 |
-
msgstr ""
|
248 |
-
|
249 |
-
msgid "Part %page%"
|
250 |
-
msgstr ""
|
251 |
-
|
252 |
-
msgid "Log important events:"
|
253 |
-
msgstr ""
|
254 |
-
|
255 |
-
msgid "Check this and SEO pack will create a log of important events (all_in_one_seo_pack.log) in its plugin directory which might help debugging it. Make sure this directory is writable."
|
256 |
-
msgstr ""
|
257 |
-
|
258 |
-
msgid "%page_author_login% - This page's author' login"
|
259 |
-
msgstr ""
|
260 |
-
|
261 |
-
msgid "%page_author_nicename% - This page's author' nicename"
|
262 |
-
msgstr ""
|
263 |
-
|
264 |
-
msgid "%page_author_firstname% - This page's author' first name (capitalized)"
|
265 |
-
msgstr ""
|
266 |
-
|
267 |
-
msgid "%page_author_lastname% - This page's author' last name (capitalized)"
|
268 |
-
msgstr ""
|
269 |
-
|
270 |
-
msgid "%post_author_login% - This post's author' login"
|
271 |
-
msgstr ""
|
272 |
-
|
273 |
-
msgid "%post_author_nicename% - This post's author' nicename"
|
274 |
-
msgstr ""
|
275 |
-
|
276 |
-
msgid "%post_author_firstname% - This post's author' first name (capitalized)"
|
277 |
-
msgstr ""
|
278 |
-
|
279 |
-
msgid "%post_author_lastname% - This post's author' last name (capitalized)"
|
280 |
-
msgstr ""
|
281 |
-
|
282 |
-
msgid "Additional Home Headers:"
|
283 |
-
msgstr ""
|
284 |
-
|
285 |
-
msgid "What you enter here will be copied verbatim to your header on the home page. You can enter whatever additional headers you want here, even references to stylesheets."
|
286 |
-
msgstr ""
|
287 |
-
|
288 |
-
msgid "Click here for Support"
|
289 |
-
msgstr ""
|
290 |
-
|
291 |
-
msgid "You can click on option titles to get help!"
|
292 |
-
msgstr ""
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/images/twitter.png
DELETED
Binary file
|
trunk/pclzip.lib.php
DELETED
@@ -1,5651 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// --------------------------------------------------------------------------------
|
3 |
-
// PhpConcept Library - Zip Module 2.5
|
4 |
-
// --------------------------------------------------------------------------------
|
5 |
-
// License GNU/LGPL - Vincent Blavet - March 2006
|
6 |
-
// http://www.phpconcept.net
|
7 |
-
// --------------------------------------------------------------------------------
|
8 |
-
//
|
9 |
-
// Presentation :
|
10 |
-
// PclZip is a PHP library that manage ZIP archives.
|
11 |
-
// So far tests show that archives generated by PclZip are readable by
|
12 |
-
// WinZip application and other tools.
|
13 |
-
//
|
14 |
-
// Description :
|
15 |
-
// See readme.txt and http://www.phpconcept.net
|
16 |
-
//
|
17 |
-
// Warning :
|
18 |
-
// This library and the associated files are non commercial, non professional
|
19 |
-
// work.
|
20 |
-
// It should not have unexpected results. However if any damage is caused by
|
21 |
-
// this software the author can not be responsible.
|
22 |
-
// The use of this software is at the risk of the user.
|
23 |
-
//
|
24 |
-
// --------------------------------------------------------------------------------
|
25 |
-
// $Id: pclzip.lib.php,v 1.44 2006/03/08 21:23:59 vblavet Exp $
|
26 |
-
// --------------------------------------------------------------------------------
|
27 |
-
|
28 |
-
// ----- Constants
|
29 |
-
define( 'PCLZIP_READ_BLOCK_SIZE', 2048 );
|
30 |
-
|
31 |
-
define( 'PCLZIP_SEPARATOR', ',' );
|
32 |
-
|
33 |
-
define( 'PCLZIP_ERROR_EXTERNAL', 0 );
|
34 |
-
|
35 |
-
define( 'PCLZIP_TEMPORARY_DIR', '' );
|
36 |
-
|
37 |
-
// --------------------------------------------------------------------------------
|
38 |
-
// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
|
39 |
-
// --------------------------------------------------------------------------------
|
40 |
-
|
41 |
-
// ----- Global variables
|
42 |
-
$g_pclzip_version = "2.5";
|
43 |
-
|
44 |
-
define( 'PCLZIP_ERR_USER_ABORTED', 2 );
|
45 |
-
define( 'PCLZIP_ERR_NO_ERROR', 0 );
|
46 |
-
define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
|
47 |
-
define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
|
48 |
-
define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
|
49 |
-
define( 'PCLZIP_ERR_MISSING_FILE', -4 );
|
50 |
-
define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
|
51 |
-
define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
|
52 |
-
define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
|
53 |
-
define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
|
54 |
-
define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
|
55 |
-
define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
|
56 |
-
define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
|
57 |
-
define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
|
58 |
-
define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
|
59 |
-
define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
|
60 |
-
define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
|
61 |
-
define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
|
62 |
-
define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
|
63 |
-
define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
|
64 |
-
define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
|
65 |
-
define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
|
66 |
-
define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );
|
67 |
-
|
68 |
-
// ----- Options values
|
69 |
-
define( 'PCLZIP_OPT_PATH', 77001 );
|
70 |
-
define( 'PCLZIP_OPT_ADD_PATH', 77002 );
|
71 |
-
define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
|
72 |
-
define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
|
73 |
-
define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
|
74 |
-
define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
|
75 |
-
define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
|
76 |
-
define( 'PCLZIP_OPT_BY_NAME', 77008 );
|
77 |
-
define( 'PCLZIP_OPT_BY_INDEX', 77009 );
|
78 |
-
define( 'PCLZIP_OPT_BY_EREG', 77010 );
|
79 |
-
define( 'PCLZIP_OPT_BY_PREG', 77011 );
|
80 |
-
define( 'PCLZIP_OPT_COMMENT', 77012 );
|
81 |
-
define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
|
82 |
-
define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
|
83 |
-
define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
|
84 |
-
define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
|
85 |
-
define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
|
86 |
-
// Having big trouble with crypt. Need to multiply 2 long int
|
87 |
-
// which is not correctly supported by PHP ...
|
88 |
-
//define( 'PCLZIP_OPT_CRYPT', 77018 );
|
89 |
-
define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
|
90 |
-
|
91 |
-
// ----- File description attributes
|
92 |
-
define( 'PCLZIP_ATT_FILE_NAME', 79001 );
|
93 |
-
define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
|
94 |
-
define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
|
95 |
-
|
96 |
-
// ----- Call backs values
|
97 |
-
define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
|
98 |
-
define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
|
99 |
-
define( 'PCLZIP_CB_PRE_ADD', 78003 );
|
100 |
-
define( 'PCLZIP_CB_POST_ADD', 78004 );
|
101 |
-
|
102 |
-
class PclZip
|
103 |
-
{
|
104 |
-
// ----- Filename of the zip file
|
105 |
-
var $zipname = '';
|
106 |
-
|
107 |
-
// ----- File descriptor of the zip file
|
108 |
-
var $zip_fd = 0;
|
109 |
-
|
110 |
-
// ----- Internal error handling
|
111 |
-
var $error_code = 1;
|
112 |
-
var $error_string = '';
|
113 |
-
|
114 |
-
// ----- Current status of the magic_quotes_runtime
|
115 |
-
// This value store the php configuration for magic_quotes
|
116 |
-
// The class can then disable the magic_quotes and reset it after
|
117 |
-
var $magic_quotes_status;
|
118 |
-
|
119 |
-
// --------------------------------------------------------------------------------
|
120 |
-
// Function : PclZip()
|
121 |
-
// Description :
|
122 |
-
// Creates a PclZip object and set the name of the associated Zip archive
|
123 |
-
// filename.
|
124 |
-
// Note that no real action is taken, if the archive does not exist it is not
|
125 |
-
// created. Use create() for that.
|
126 |
-
// --------------------------------------------------------------------------------
|
127 |
-
function PclZip($p_zipname)
|
128 |
-
{
|
129 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::PclZip', "zipname=$p_zipname");
|
130 |
-
|
131 |
-
// ----- Tests the zlib
|
132 |
-
if (!function_exists('gzopen'))
|
133 |
-
{
|
134 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 1, "zlib extension seems to be missing");
|
135 |
-
die('Abort '.basename(__FILE__).' : Missing zlib extensions');
|
136 |
-
}
|
137 |
-
|
138 |
-
// ----- Set the attributes
|
139 |
-
$this->zipname = $p_zipname;
|
140 |
-
$this->zip_fd = 0;
|
141 |
-
$this->magic_quotes_status = -1;
|
142 |
-
|
143 |
-
// ----- Return
|
144 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 1);
|
145 |
-
return;
|
146 |
-
}
|
147 |
-
|
148 |
-
function create($p_filelist)
|
149 |
-
{
|
150 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::create', "filelist='$p_filelist', ...");
|
151 |
-
$v_result=1;
|
152 |
-
|
153 |
-
// ----- Reset the error handler
|
154 |
-
$this->privErrorReset();
|
155 |
-
|
156 |
-
// ----- Set default values
|
157 |
-
$v_options = array();
|
158 |
-
$v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
|
159 |
-
|
160 |
-
// ----- Look for variable options arguments
|
161 |
-
$v_size = func_num_args();
|
162 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
163 |
-
|
164 |
-
// ----- Look for arguments
|
165 |
-
if ($v_size > 1) {
|
166 |
-
// ----- Get the arguments
|
167 |
-
$v_arg_list = func_get_args();
|
168 |
-
|
169 |
-
// ----- Remove from the options list the first argument
|
170 |
-
array_shift($v_arg_list);
|
171 |
-
$v_size--;
|
172 |
-
|
173 |
-
// ----- Look for first arg
|
174 |
-
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
175 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
|
176 |
-
|
177 |
-
// ----- Parse the options
|
178 |
-
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
179 |
-
array (PCLZIP_OPT_REMOVE_PATH => 'optional',
|
180 |
-
PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
|
181 |
-
PCLZIP_OPT_ADD_PATH => 'optional',
|
182 |
-
PCLZIP_CB_PRE_ADD => 'optional',
|
183 |
-
PCLZIP_CB_POST_ADD => 'optional',
|
184 |
-
PCLZIP_OPT_NO_COMPRESSION => 'optional',
|
185 |
-
PCLZIP_OPT_COMMENT => 'optional'
|
186 |
-
//, PCLZIP_OPT_CRYPT => 'optional'
|
187 |
-
));
|
188 |
-
if ($v_result != 1) {
|
189 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
190 |
-
return 0;
|
191 |
-
}
|
192 |
-
}
|
193 |
-
|
194 |
-
// ----- Look for 2 args
|
195 |
-
// Here we need to support the first historic synopsis of the
|
196 |
-
// method.
|
197 |
-
else {
|
198 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
199 |
-
|
200 |
-
// ----- Get the first argument
|
201 |
-
$v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
|
202 |
-
|
203 |
-
// ----- Look for the optional second argument
|
204 |
-
if ($v_size == 2) {
|
205 |
-
$v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
|
206 |
-
}
|
207 |
-
else if ($v_size > 2) {
|
208 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
209 |
-
"Invalid number / type of arguments");
|
210 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
211 |
-
return 0;
|
212 |
-
}
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
-
// ----- Init
|
217 |
-
$v_string_list = array();
|
218 |
-
$v_att_list = array();
|
219 |
-
$v_filedescr_list = array();
|
220 |
-
$p_result_list = array();
|
221 |
-
|
222 |
-
// ----- Look if the $p_filelist is really an array
|
223 |
-
if (is_array($p_filelist)) {
|
224 |
-
|
225 |
-
// ----- Look if the first element is also an array
|
226 |
-
// This will mean that this is a file description entry
|
227 |
-
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
|
228 |
-
$v_att_list = $p_filelist;
|
229 |
-
}
|
230 |
-
|
231 |
-
// ----- The list is a list of string names
|
232 |
-
else {
|
233 |
-
$v_string_list = $p_filelist;
|
234 |
-
}
|
235 |
-
}
|
236 |
-
|
237 |
-
// ----- Look if the $p_filelist is a string
|
238 |
-
else if (is_string($p_filelist)) {
|
239 |
-
// ----- Create a list from the string
|
240 |
-
$v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
|
241 |
-
}
|
242 |
-
|
243 |
-
// ----- Invalid variable type for $p_filelist
|
244 |
-
else {
|
245 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
|
246 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
247 |
-
return 0;
|
248 |
-
}
|
249 |
-
|
250 |
-
// ----- Reformat the string list
|
251 |
-
if (sizeof($v_string_list) != 0) {
|
252 |
-
foreach ($v_string_list as $v_string) {
|
253 |
-
if ($v_string != '') {
|
254 |
-
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
|
255 |
-
}
|
256 |
-
else {
|
257 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Ignore an empty filename");
|
258 |
-
}
|
259 |
-
}
|
260 |
-
}
|
261 |
-
|
262 |
-
// ----- For each file in the list check the attributes
|
263 |
-
$v_supported_attributes
|
264 |
-
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
|
265 |
-
,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
|
266 |
-
,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
|
267 |
-
);
|
268 |
-
foreach ($v_att_list as $v_entry) {
|
269 |
-
$v_result = $this->privFileDescrParseAtt($v_entry,
|
270 |
-
$v_filedescr_list[],
|
271 |
-
$v_options,
|
272 |
-
$v_supported_attributes);
|
273 |
-
if ($v_result != 1) {
|
274 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
275 |
-
return 0;
|
276 |
-
}
|
277 |
-
}
|
278 |
-
|
279 |
-
// ----- Expand the filelist (expand directories)
|
280 |
-
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
|
281 |
-
if ($v_result != 1) {
|
282 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
283 |
-
return 0;
|
284 |
-
}
|
285 |
-
|
286 |
-
// ----- Call the create fct
|
287 |
-
$v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
|
288 |
-
if ($v_result != 1) {
|
289 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
290 |
-
return 0;
|
291 |
-
}
|
292 |
-
|
293 |
-
// ----- Return
|
294 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
|
295 |
-
return $p_result_list;
|
296 |
-
}
|
297 |
-
// --------------------------------------------------------------------------------
|
298 |
-
|
299 |
-
// --------------------------------------------------------------------------------
|
300 |
-
// Function :
|
301 |
-
// add($p_filelist, $p_add_dir="", $p_remove_dir="")
|
302 |
-
// add($p_filelist, $p_option, $p_option_value, ...)
|
303 |
-
// Description :
|
304 |
-
// This method supports two synopsis. The first one is historical.
|
305 |
-
// This methods add the list of files in an existing archive.
|
306 |
-
// If a file with the same name already exists, it is added at the end of the
|
307 |
-
// archive, the first one is still present.
|
308 |
-
// If the archive does not exist, it is created.
|
309 |
-
// Parameters :
|
310 |
-
// $p_filelist : An array containing file or directory names, or
|
311 |
-
// a string containing one filename or one directory name, or
|
312 |
-
// a string containing a list of filenames and/or directory
|
313 |
-
// names separated by spaces.
|
314 |
-
// $p_add_dir : A path to add before the real path of the archived file,
|
315 |
-
// in order to have it memorized in the archive.
|
316 |
-
// $p_remove_dir : A path to remove from the real path of the file to archive,
|
317 |
-
// in order to have a shorter path memorized in the archive.
|
318 |
-
// When $p_add_dir and $p_remove_dir are set, $p_remove_dir
|
319 |
-
// is removed first, before $p_add_dir is added.
|
320 |
-
// Options :
|
321 |
-
// PCLZIP_OPT_ADD_PATH :
|
322 |
-
// PCLZIP_OPT_REMOVE_PATH :
|
323 |
-
// PCLZIP_OPT_REMOVE_ALL_PATH :
|
324 |
-
// PCLZIP_OPT_COMMENT :
|
325 |
-
// PCLZIP_OPT_ADD_COMMENT :
|
326 |
-
// PCLZIP_OPT_PREPEND_COMMENT :
|
327 |
-
// PCLZIP_CB_PRE_ADD :
|
328 |
-
// PCLZIP_CB_POST_ADD :
|
329 |
-
// Return Values :
|
330 |
-
// 0 on failure,
|
331 |
-
// The list of the added files, with a status of the add action.
|
332 |
-
// (see PclZip::listContent() for list entry format)
|
333 |
-
// --------------------------------------------------------------------------------
|
334 |
-
function add($p_filelist)
|
335 |
-
{
|
336 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::add', "filelist='$p_filelist', ...");
|
337 |
-
$v_result=1;
|
338 |
-
|
339 |
-
// ----- Reset the error handler
|
340 |
-
$this->privErrorReset();
|
341 |
-
|
342 |
-
// ----- Set default values
|
343 |
-
$v_options = array();
|
344 |
-
$v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
|
345 |
-
|
346 |
-
// ----- Look for variable options arguments
|
347 |
-
$v_size = func_num_args();
|
348 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
349 |
-
|
350 |
-
// ----- Look for arguments
|
351 |
-
if ($v_size > 1) {
|
352 |
-
// ----- Get the arguments
|
353 |
-
$v_arg_list = func_get_args();
|
354 |
-
|
355 |
-
// ----- Remove form the options list the first argument
|
356 |
-
array_shift($v_arg_list);
|
357 |
-
$v_size--;
|
358 |
-
|
359 |
-
// ----- Look for first arg
|
360 |
-
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
361 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
|
362 |
-
|
363 |
-
// ----- Parse the options
|
364 |
-
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
365 |
-
array (PCLZIP_OPT_REMOVE_PATH => 'optional',
|
366 |
-
PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
|
367 |
-
PCLZIP_OPT_ADD_PATH => 'optional',
|
368 |
-
PCLZIP_CB_PRE_ADD => 'optional',
|
369 |
-
PCLZIP_CB_POST_ADD => 'optional',
|
370 |
-
PCLZIP_OPT_NO_COMPRESSION => 'optional',
|
371 |
-
PCLZIP_OPT_COMMENT => 'optional',
|
372 |
-
PCLZIP_OPT_ADD_COMMENT => 'optional',
|
373 |
-
PCLZIP_OPT_PREPEND_COMMENT => 'optional'
|
374 |
-
//, PCLZIP_OPT_CRYPT => 'optional'
|
375 |
-
));
|
376 |
-
if ($v_result != 1) {
|
377 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
378 |
-
return 0;
|
379 |
-
}
|
380 |
-
}
|
381 |
-
|
382 |
-
// ----- Look for 2 args
|
383 |
-
// Here we need to support the first historic synopsis of the
|
384 |
-
// method.
|
385 |
-
else {
|
386 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
387 |
-
|
388 |
-
// ----- Get the first argument
|
389 |
-
$v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
|
390 |
-
|
391 |
-
// ----- Look for the optional second argument
|
392 |
-
if ($v_size == 2) {
|
393 |
-
$v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
|
394 |
-
}
|
395 |
-
else if ($v_size > 2) {
|
396 |
-
// ----- Error log
|
397 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
398 |
-
|
399 |
-
// ----- Return
|
400 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
401 |
-
return 0;
|
402 |
-
}
|
403 |
-
}
|
404 |
-
}
|
405 |
-
|
406 |
-
// ----- Init
|
407 |
-
$v_string_list = array();
|
408 |
-
$v_att_list = array();
|
409 |
-
$v_filedescr_list = array();
|
410 |
-
$p_result_list = array();
|
411 |
-
|
412 |
-
// ----- Look if the $p_filelist is really an array
|
413 |
-
if (is_array($p_filelist)) {
|
414 |
-
|
415 |
-
// ----- Look if the first element is also an array
|
416 |
-
// This will mean that this is a file description entry
|
417 |
-
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
|
418 |
-
$v_att_list = $p_filelist;
|
419 |
-
}
|
420 |
-
|
421 |
-
// ----- The list is a list of string names
|
422 |
-
else {
|
423 |
-
$v_string_list = $p_filelist;
|
424 |
-
}
|
425 |
-
}
|
426 |
-
|
427 |
-
// ----- Look if the $p_filelist is a string
|
428 |
-
else if (is_string($p_filelist)) {
|
429 |
-
// ----- Create a list from the string
|
430 |
-
$v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
|
431 |
-
}
|
432 |
-
|
433 |
-
// ----- Invalid variable type for $p_filelist
|
434 |
-
else {
|
435 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
|
436 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
437 |
-
return 0;
|
438 |
-
}
|
439 |
-
|
440 |
-
// ----- Reformat the string list
|
441 |
-
if (sizeof($v_string_list) != 0) {
|
442 |
-
foreach ($v_string_list as $v_string) {
|
443 |
-
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
|
444 |
-
}
|
445 |
-
}
|
446 |
-
|
447 |
-
// ----- For each file in the list check the attributes
|
448 |
-
$v_supported_attributes
|
449 |
-
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
|
450 |
-
,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
|
451 |
-
,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
|
452 |
-
);
|
453 |
-
foreach ($v_att_list as $v_entry) {
|
454 |
-
$v_result = $this->privFileDescrParseAtt($v_entry,
|
455 |
-
$v_filedescr_list[],
|
456 |
-
$v_options,
|
457 |
-
$v_supported_attributes);
|
458 |
-
if ($v_result != 1) {
|
459 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
460 |
-
return 0;
|
461 |
-
}
|
462 |
-
}
|
463 |
-
|
464 |
-
// ----- Expand the filelist (expand directories)
|
465 |
-
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
|
466 |
-
if ($v_result != 1) {
|
467 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
468 |
-
return 0;
|
469 |
-
}
|
470 |
-
|
471 |
-
// ----- Call the create fct
|
472 |
-
$v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
|
473 |
-
if ($v_result != 1) {
|
474 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
475 |
-
return 0;
|
476 |
-
}
|
477 |
-
|
478 |
-
// ----- Return
|
479 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
|
480 |
-
return $p_result_list;
|
481 |
-
}
|
482 |
-
// --------------------------------------------------------------------------------
|
483 |
-
|
484 |
-
// --------------------------------------------------------------------------------
|
485 |
-
// Function : listContent()
|
486 |
-
// Description :
|
487 |
-
// This public method, gives the list of the files and directories, with their
|
488 |
-
// properties.
|
489 |
-
// The properties of each entries in the list are (used also in other functions) :
|
490 |
-
// filename : Name of the file. For a create or add action it is the filename
|
491 |
-
// given by the user. For an extract function it is the filename
|
492 |
-
// of the extracted file.
|
493 |
-
// stored_filename : Name of the file / directory stored in the archive.
|
494 |
-
// size : Size of the stored file.
|
495 |
-
// compressed_size : Size of the file's data compressed in the archive
|
496 |
-
// (without the headers overhead)
|
497 |
-
// mtime : Last known modification date of the file (UNIX timestamp)
|
498 |
-
// comment : Comment associated with the file
|
499 |
-
// folder : true | false
|
500 |
-
// index : index of the file in the archive
|
501 |
-
// status : status of the action (depending of the action) :
|
502 |
-
// Values are :
|
503 |
-
// ok : OK !
|
504 |
-
// filtered : the file / dir is not extracted (filtered by user)
|
505 |
-
// already_a_directory : the file can not be extracted because a
|
506 |
-
// directory with the same name already exists
|
507 |
-
// write_protected : the file can not be extracted because a file
|
508 |
-
// with the same name already exists and is
|
509 |
-
// write protected
|
510 |
-
// newer_exist : the file was not extracted because a newer file exists
|
511 |
-
// path_creation_fail : the file is not extracted because the folder
|
512 |
-
// does not exists and can not be created
|
513 |
-
// write_error : the file was not extracted because there was a
|
514 |
-
// error while writing the file
|
515 |
-
// read_error : the file was not extracted because there was a error
|
516 |
-
// while reading the file
|
517 |
-
// invalid_header : the file was not extracted because of an archive
|
518 |
-
// format error (bad file header)
|
519 |
-
// Note that each time a method can continue operating when there
|
520 |
-
// is an action error on a file, the error is only logged in the file status.
|
521 |
-
// Return Values :
|
522 |
-
// 0 on an unrecoverable failure,
|
523 |
-
// The list of the files in the archive.
|
524 |
-
// --------------------------------------------------------------------------------
|
525 |
-
function listContent()
|
526 |
-
{
|
527 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::listContent', "");
|
528 |
-
$v_result=1;
|
529 |
-
|
530 |
-
// ----- Reset the error handler
|
531 |
-
$this->privErrorReset();
|
532 |
-
|
533 |
-
// ----- Check archive
|
534 |
-
if (!$this->privCheckFormat()) {
|
535 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
536 |
-
return(0);
|
537 |
-
}
|
538 |
-
|
539 |
-
// ----- Call the extracting fct
|
540 |
-
$p_list = array();
|
541 |
-
if (($v_result = $this->privList($p_list)) != 1)
|
542 |
-
{
|
543 |
-
unset($p_list);
|
544 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
545 |
-
return(0);
|
546 |
-
}
|
547 |
-
|
548 |
-
// ----- Return
|
549 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
550 |
-
return $p_list;
|
551 |
-
}
|
552 |
-
// --------------------------------------------------------------------------------
|
553 |
-
|
554 |
-
// --------------------------------------------------------------------------------
|
555 |
-
// Function :
|
556 |
-
// extract($p_path="./", $p_remove_path="")
|
557 |
-
// extract([$p_option, $p_option_value, ...])
|
558 |
-
// Description :
|
559 |
-
// This method supports two synopsis. The first one is historical.
|
560 |
-
// This method extract all the files / directories from the archive to the
|
561 |
-
// folder indicated in $p_path.
|
562 |
-
// If you want to ignore the 'root' part of path of the memorized files
|
563 |
-
// you can indicate this in the optional $p_remove_path parameter.
|
564 |
-
// By default, if a newer file with the same name already exists, the
|
565 |
-
// file is not extracted.
|
566 |
-
//
|
567 |
-
// If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
|
568 |
-
// are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
|
569 |
-
// at the end of the path value of PCLZIP_OPT_PATH.
|
570 |
-
// Parameters :
|
571 |
-
// $p_path : Path where the files and directories are to be extracted
|
572 |
-
// $p_remove_path : First part ('root' part) of the memorized path
|
573 |
-
// (if any similar) to remove while extracting.
|
574 |
-
// Options :
|
575 |
-
// PCLZIP_OPT_PATH :
|
576 |
-
// PCLZIP_OPT_ADD_PATH :
|
577 |
-
// PCLZIP_OPT_REMOVE_PATH :
|
578 |
-
// PCLZIP_OPT_REMOVE_ALL_PATH :
|
579 |
-
// PCLZIP_CB_PRE_EXTRACT :
|
580 |
-
// PCLZIP_CB_POST_EXTRACT :
|
581 |
-
// Return Values :
|
582 |
-
// 0 or a negative value on failure,
|
583 |
-
// The list of the extracted files, with a status of the action.
|
584 |
-
// (see PclZip::listContent() for list entry format)
|
585 |
-
// --------------------------------------------------------------------------------
|
586 |
-
function extract()
|
587 |
-
{
|
588 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extract", "");
|
589 |
-
$v_result=1;
|
590 |
-
|
591 |
-
// ----- Reset the error handler
|
592 |
-
$this->privErrorReset();
|
593 |
-
|
594 |
-
// ----- Check archive
|
595 |
-
if (!$this->privCheckFormat()) {
|
596 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
597 |
-
return(0);
|
598 |
-
}
|
599 |
-
|
600 |
-
// ----- Set default values
|
601 |
-
$v_options = array();
|
602 |
-
// $v_path = "./";
|
603 |
-
$v_path = '';
|
604 |
-
$v_remove_path = "";
|
605 |
-
$v_remove_all_path = false;
|
606 |
-
|
607 |
-
// ----- Look for variable options arguments
|
608 |
-
$v_size = func_num_args();
|
609 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
610 |
-
|
611 |
-
// ----- Default values for option
|
612 |
-
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
613 |
-
|
614 |
-
// ----- Look for arguments
|
615 |
-
if ($v_size > 0) {
|
616 |
-
// ----- Get the arguments
|
617 |
-
$v_arg_list = func_get_args();
|
618 |
-
|
619 |
-
// ----- Look for first arg
|
620 |
-
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
621 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
|
622 |
-
|
623 |
-
// ----- Parse the options
|
624 |
-
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
625 |
-
array (PCLZIP_OPT_PATH => 'optional',
|
626 |
-
PCLZIP_OPT_REMOVE_PATH => 'optional',
|
627 |
-
PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
|
628 |
-
PCLZIP_OPT_ADD_PATH => 'optional',
|
629 |
-
PCLZIP_CB_PRE_EXTRACT => 'optional',
|
630 |
-
PCLZIP_CB_POST_EXTRACT => 'optional',
|
631 |
-
PCLZIP_OPT_SET_CHMOD => 'optional',
|
632 |
-
PCLZIP_OPT_BY_NAME => 'optional',
|
633 |
-
PCLZIP_OPT_BY_EREG => 'optional',
|
634 |
-
PCLZIP_OPT_BY_PREG => 'optional',
|
635 |
-
PCLZIP_OPT_BY_INDEX => 'optional',
|
636 |
-
PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
|
637 |
-
PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
|
638 |
-
PCLZIP_OPT_REPLACE_NEWER => 'optional'
|
639 |
-
,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
|
640 |
-
,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'
|
641 |
-
));
|
642 |
-
if ($v_result != 1) {
|
643 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
644 |
-
return 0;
|
645 |
-
}
|
646 |
-
|
647 |
-
// ----- Set the arguments
|
648 |
-
if (isset($v_options[PCLZIP_OPT_PATH])) {
|
649 |
-
$v_path = $v_options[PCLZIP_OPT_PATH];
|
650 |
-
}
|
651 |
-
if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
|
652 |
-
$v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
|
653 |
-
}
|
654 |
-
if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
|
655 |
-
$v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
|
656 |
-
}
|
657 |
-
if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
|
658 |
-
// ----- Check for '/' in last path char
|
659 |
-
if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
|
660 |
-
$v_path .= '/';
|
661 |
-
}
|
662 |
-
$v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
|
663 |
-
}
|
664 |
-
}
|
665 |
-
|
666 |
-
// ----- Look for 2 args
|
667 |
-
// Here we need to support the first historic synopsis of the
|
668 |
-
// method.
|
669 |
-
else {
|
670 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
671 |
-
|
672 |
-
// ----- Get the first argument
|
673 |
-
$v_path = $v_arg_list[0];
|
674 |
-
|
675 |
-
// ----- Look for the optional second argument
|
676 |
-
if ($v_size == 2) {
|
677 |
-
$v_remove_path = $v_arg_list[1];
|
678 |
-
}
|
679 |
-
else if ($v_size > 2) {
|
680 |
-
// ----- Error log
|
681 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
682 |
-
|
683 |
-
// ----- Return
|
684 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
685 |
-
return 0;
|
686 |
-
}
|
687 |
-
}
|
688 |
-
}
|
689 |
-
|
690 |
-
// ----- Trace
|
691 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
|
692 |
-
|
693 |
-
// ----- Call the extracting fct
|
694 |
-
$p_list = array();
|
695 |
-
$v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
|
696 |
-
$v_remove_all_path, $v_options);
|
697 |
-
if ($v_result < 1) {
|
698 |
-
unset($p_list);
|
699 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
700 |
-
return(0);
|
701 |
-
}
|
702 |
-
|
703 |
-
// ----- Return
|
704 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
705 |
-
return $p_list;
|
706 |
-
}
|
707 |
-
// --------------------------------------------------------------------------------
|
708 |
-
|
709 |
-
|
710 |
-
// --------------------------------------------------------------------------------
|
711 |
-
// Function :
|
712 |
-
// extractByIndex($p_index, $p_path="./", $p_remove_path="")
|
713 |
-
// extractByIndex($p_index, [$p_option, $p_option_value, ...])
|
714 |
-
// Description :
|
715 |
-
// This method supports two synopsis. The first one is historical.
|
716 |
-
// This method is doing a partial extract of the archive.
|
717 |
-
// The extracted files or folders are identified by their index in the
|
718 |
-
// archive (from 0 to n).
|
719 |
-
// Note that if the index identify a folder, only the folder entry is
|
720 |
-
// extracted, not all the files included in the archive.
|
721 |
-
// Parameters :
|
722 |
-
// $p_index : A single index (integer) or a string of indexes of files to
|
723 |
-
// extract. The form of the string is "0,4-6,8-12" with only numbers
|
724 |
-
// and '-' for range or ',' to separate ranges. No spaces or ';'
|
725 |
-
// are allowed.
|
726 |
-
// $p_path : Path where the files and directories are to be extracted
|
727 |
-
// $p_remove_path : First part ('root' part) of the memorized path
|
728 |
-
// (if any similar) to remove while extracting.
|
729 |
-
// Options :
|
730 |
-
// PCLZIP_OPT_PATH :
|
731 |
-
// PCLZIP_OPT_ADD_PATH :
|
732 |
-
// PCLZIP_OPT_REMOVE_PATH :
|
733 |
-
// PCLZIP_OPT_REMOVE_ALL_PATH :
|
734 |
-
// PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
|
735 |
-
// not as files.
|
736 |
-
// The resulting content is in a new field 'content' in the file
|
737 |
-
// structure.
|
738 |
-
// This option must be used alone (any other options are ignored).
|
739 |
-
// PCLZIP_CB_PRE_EXTRACT :
|
740 |
-
// PCLZIP_CB_POST_EXTRACT :
|
741 |
-
// Return Values :
|
742 |
-
// 0 on failure,
|
743 |
-
// The list of the extracted files, with a status of the action.
|
744 |
-
// (see PclZip::listContent() for list entry format)
|
745 |
-
// --------------------------------------------------------------------------------
|
746 |
-
//function extractByIndex($p_index, options...)
|
747 |
-
function extractByIndex($p_index)
|
748 |
-
{
|
749 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extractByIndex", "index='$p_index', ...");
|
750 |
-
$v_result=1;
|
751 |
-
|
752 |
-
// ----- Reset the error handler
|
753 |
-
$this->privErrorReset();
|
754 |
-
|
755 |
-
// ----- Check archive
|
756 |
-
if (!$this->privCheckFormat()) {
|
757 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
758 |
-
return(0);
|
759 |
-
}
|
760 |
-
|
761 |
-
// ----- Set default values
|
762 |
-
$v_options = array();
|
763 |
-
// $v_path = "./";
|
764 |
-
$v_path = '';
|
765 |
-
$v_remove_path = "";
|
766 |
-
$v_remove_all_path = false;
|
767 |
-
|
768 |
-
// ----- Look for variable options arguments
|
769 |
-
$v_size = func_num_args();
|
770 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
771 |
-
|
772 |
-
// ----- Default values for option
|
773 |
-
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
774 |
-
|
775 |
-
// ----- Look for arguments
|
776 |
-
if ($v_size > 1) {
|
777 |
-
// ----- Get the arguments
|
778 |
-
$v_arg_list = func_get_args();
|
779 |
-
|
780 |
-
// ----- Remove form the options list the first argument
|
781 |
-
array_shift($v_arg_list);
|
782 |
-
$v_size--;
|
783 |
-
|
784 |
-
// ----- Look for first arg
|
785 |
-
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
786 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
|
787 |
-
|
788 |
-
// ----- Parse the options
|
789 |
-
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
790 |
-
array (PCLZIP_OPT_PATH => 'optional',
|
791 |
-
PCLZIP_OPT_REMOVE_PATH => 'optional',
|
792 |
-
PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
|
793 |
-
PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
|
794 |
-
PCLZIP_OPT_ADD_PATH => 'optional',
|
795 |
-
PCLZIP_CB_PRE_EXTRACT => 'optional',
|
796 |
-
PCLZIP_CB_POST_EXTRACT => 'optional',
|
797 |
-
PCLZIP_OPT_SET_CHMOD => 'optional',
|
798 |
-
PCLZIP_OPT_REPLACE_NEWER => 'optional'
|
799 |
-
,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
|
800 |
-
,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'
|
801 |
-
));
|
802 |
-
if ($v_result != 1) {
|
803 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
804 |
-
return 0;
|
805 |
-
}
|
806 |
-
|
807 |
-
// ----- Set the arguments
|
808 |
-
if (isset($v_options[PCLZIP_OPT_PATH])) {
|
809 |
-
$v_path = $v_options[PCLZIP_OPT_PATH];
|
810 |
-
}
|
811 |
-
if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
|
812 |
-
$v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
|
813 |
-
}
|
814 |
-
if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
|
815 |
-
$v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
|
816 |
-
}
|
817 |
-
if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
|
818 |
-
// ----- Check for '/' in last path char
|
819 |
-
if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
|
820 |
-
$v_path .= '/';
|
821 |
-
}
|
822 |
-
$v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
|
823 |
-
}
|
824 |
-
if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
|
825 |
-
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
826 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING not set.");
|
827 |
-
}
|
828 |
-
else {
|
829 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING set.");
|
830 |
-
}
|
831 |
-
}
|
832 |
-
|
833 |
-
// ----- Look for 2 args
|
834 |
-
// Here we need to support the first historic synopsis of the
|
835 |
-
// method.
|
836 |
-
else {
|
837 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
838 |
-
|
839 |
-
// ----- Get the first argument
|
840 |
-
$v_path = $v_arg_list[0];
|
841 |
-
|
842 |
-
// ----- Look for the optional second argument
|
843 |
-
if ($v_size == 2) {
|
844 |
-
$v_remove_path = $v_arg_list[1];
|
845 |
-
}
|
846 |
-
else if ($v_size > 2) {
|
847 |
-
// ----- Error log
|
848 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
849 |
-
|
850 |
-
// ----- Return
|
851 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
852 |
-
return 0;
|
853 |
-
}
|
854 |
-
}
|
855 |
-
}
|
856 |
-
|
857 |
-
// ----- Trace
|
858 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "index='$p_index', path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
|
859 |
-
|
860 |
-
// ----- Trick
|
861 |
-
// Here I want to reuse extractByRule(), so I need to parse the $p_index
|
862 |
-
// with privParseOptions()
|
863 |
-
$v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
|
864 |
-
$v_options_trick = array();
|
865 |
-
$v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
|
866 |
-
array (PCLZIP_OPT_BY_INDEX => 'optional' ));
|
867 |
-
if ($v_result != 1) {
|
868 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
869 |
-
return 0;
|
870 |
-
}
|
871 |
-
$v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
|
872 |
-
|
873 |
-
// ----- Call the extracting fct
|
874 |
-
if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
|
875 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
876 |
-
return(0);
|
877 |
-
}
|
878 |
-
|
879 |
-
// ----- Return
|
880 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
881 |
-
return $p_list;
|
882 |
-
}
|
883 |
-
// --------------------------------------------------------------------------------
|
884 |
-
|
885 |
-
// --------------------------------------------------------------------------------
|
886 |
-
// Function :
|
887 |
-
// delete([$p_option, $p_option_value, ...])
|
888 |
-
// Description :
|
889 |
-
// This method removes files from the archive.
|
890 |
-
// If no parameters are given, then all the archive is emptied.
|
891 |
-
// Parameters :
|
892 |
-
// None or optional arguments.
|
893 |
-
// Options :
|
894 |
-
// PCLZIP_OPT_BY_INDEX :
|
895 |
-
// PCLZIP_OPT_BY_NAME :
|
896 |
-
// PCLZIP_OPT_BY_EREG :
|
897 |
-
// PCLZIP_OPT_BY_PREG :
|
898 |
-
// Return Values :
|
899 |
-
// 0 on failure,
|
900 |
-
// The list of the files which are still present in the archive.
|
901 |
-
// (see PclZip::listContent() for list entry format)
|
902 |
-
// --------------------------------------------------------------------------------
|
903 |
-
function delete()
|
904 |
-
{
|
905 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::delete", "");
|
906 |
-
$v_result=1;
|
907 |
-
|
908 |
-
// ----- Reset the error handler
|
909 |
-
$this->privErrorReset();
|
910 |
-
|
911 |
-
// ----- Check archive
|
912 |
-
if (!$this->privCheckFormat()) {
|
913 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
914 |
-
return(0);
|
915 |
-
}
|
916 |
-
|
917 |
-
// ----- Set default values
|
918 |
-
$v_options = array();
|
919 |
-
|
920 |
-
// ----- Look for variable options arguments
|
921 |
-
$v_size = func_num_args();
|
922 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
923 |
-
|
924 |
-
// ----- Look for arguments
|
925 |
-
if ($v_size > 0) {
|
926 |
-
// ----- Get the arguments
|
927 |
-
$v_arg_list = func_get_args();
|
928 |
-
|
929 |
-
// ----- Parse the options
|
930 |
-
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
931 |
-
array (PCLZIP_OPT_BY_NAME => 'optional',
|
932 |
-
PCLZIP_OPT_BY_EREG => 'optional',
|
933 |
-
PCLZIP_OPT_BY_PREG => 'optional',
|
934 |
-
PCLZIP_OPT_BY_INDEX => 'optional' ));
|
935 |
-
if ($v_result != 1) {
|
936 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
937 |
-
return 0;
|
938 |
-
}
|
939 |
-
}
|
940 |
-
|
941 |
-
// ----- Magic quotes trick
|
942 |
-
$this->privDisableMagicQuotes();
|
943 |
-
|
944 |
-
// ----- Call the delete fct
|
945 |
-
$v_list = array();
|
946 |
-
if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
|
947 |
-
$this->privSwapBackMagicQuotes();
|
948 |
-
unset($v_list);
|
949 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
950 |
-
return(0);
|
951 |
-
}
|
952 |
-
|
953 |
-
// ----- Magic quotes trick
|
954 |
-
$this->privSwapBackMagicQuotes();
|
955 |
-
|
956 |
-
// ----- Return
|
957 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_list);
|
958 |
-
return $v_list;
|
959 |
-
}
|
960 |
-
// --------------------------------------------------------------------------------
|
961 |
-
|
962 |
-
// --------------------------------------------------------------------------------
|
963 |
-
// Function : deleteByIndex()
|
964 |
-
// Description :
|
965 |
-
// ***** Deprecated *****
|
966 |
-
// delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.
|
967 |
-
// --------------------------------------------------------------------------------
|
968 |
-
function deleteByIndex($p_index)
|
969 |
-
{
|
970 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
|
971 |
-
|
972 |
-
$p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
|
973 |
-
|
974 |
-
// ----- Return
|
975 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
976 |
-
return $p_list;
|
977 |
-
}
|
978 |
-
// --------------------------------------------------------------------------------
|
979 |
-
|
980 |
-
// --------------------------------------------------------------------------------
|
981 |
-
// Function : properties()
|
982 |
-
// Description :
|
983 |
-
// This method gives the properties of the archive.
|
984 |
-
// The properties are :
|
985 |
-
// nb : Number of files in the archive
|
986 |
-
// comment : Comment associated with the archive file
|
987 |
-
// status : not_exist, ok
|
988 |
-
// Parameters :
|
989 |
-
// None
|
990 |
-
// Return Values :
|
991 |
-
// 0 on failure,
|
992 |
-
// An array with the archive properties.
|
993 |
-
// --------------------------------------------------------------------------------
|
994 |
-
function properties()
|
995 |
-
{
|
996 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::properties", "");
|
997 |
-
|
998 |
-
// ----- Reset the error handler
|
999 |
-
$this->privErrorReset();
|
1000 |
-
|
1001 |
-
// ----- Magic quotes trick
|
1002 |
-
$this->privDisableMagicQuotes();
|
1003 |
-
|
1004 |
-
// ----- Check archive
|
1005 |
-
if (!$this->privCheckFormat()) {
|
1006 |
-
$this->privSwapBackMagicQuotes();
|
1007 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1008 |
-
return(0);
|
1009 |
-
}
|
1010 |
-
|
1011 |
-
// ----- Default properties
|
1012 |
-
$v_prop = array();
|
1013 |
-
$v_prop['comment'] = '';
|
1014 |
-
$v_prop['nb'] = 0;
|
1015 |
-
$v_prop['status'] = 'not_exist';
|
1016 |
-
|
1017 |
-
// ----- Look if file exists
|
1018 |
-
if (@is_file($this->zipname))
|
1019 |
-
{
|
1020 |
-
// ----- Open the zip file
|
1021 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
1022 |
-
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
|
1023 |
-
{
|
1024 |
-
$this->privSwapBackMagicQuotes();
|
1025 |
-
|
1026 |
-
// ----- Error log
|
1027 |
-
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
1028 |
-
|
1029 |
-
// ----- Return
|
1030 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), 0);
|
1031 |
-
return 0;
|
1032 |
-
}
|
1033 |
-
|
1034 |
-
// ----- Read the central directory informations
|
1035 |
-
$v_central_dir = array();
|
1036 |
-
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
1037 |
-
{
|
1038 |
-
$this->privSwapBackMagicQuotes();
|
1039 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1040 |
-
return 0;
|
1041 |
-
}
|
1042 |
-
|
1043 |
-
// ----- Close the zip file
|
1044 |
-
$this->privCloseFd();
|
1045 |
-
|
1046 |
-
// ----- Set the user attributes
|
1047 |
-
$v_prop['comment'] = $v_central_dir['comment'];
|
1048 |
-
$v_prop['nb'] = $v_central_dir['entries'];
|
1049 |
-
$v_prop['status'] = 'ok';
|
1050 |
-
}
|
1051 |
-
|
1052 |
-
// ----- Magic quotes trick
|
1053 |
-
$this->privSwapBackMagicQuotes();
|
1054 |
-
|
1055 |
-
// ----- Return
|
1056 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_prop);
|
1057 |
-
return $v_prop;
|
1058 |
-
}
|
1059 |
-
// --------------------------------------------------------------------------------
|
1060 |
-
|
1061 |
-
// --------------------------------------------------------------------------------
|
1062 |
-
// Function : duplicate()
|
1063 |
-
// Description :
|
1064 |
-
// This method creates an archive by copying the content of an other one. If
|
1065 |
-
// the archive already exist, it is replaced by the new one without any warning.
|
1066 |
-
// Parameters :
|
1067 |
-
// $p_archive : The filename of a valid archive, or
|
1068 |
-
// a valid PclZip object.
|
1069 |
-
// Return Values :
|
1070 |
-
// 1 on success.
|
1071 |
-
// 0 or a negative value on error (error code).
|
1072 |
-
// --------------------------------------------------------------------------------
|
1073 |
-
function duplicate($p_archive)
|
1074 |
-
{
|
1075 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::duplicate", "");
|
1076 |
-
$v_result = 1;
|
1077 |
-
|
1078 |
-
// ----- Reset the error handler
|
1079 |
-
$this->privErrorReset();
|
1080 |
-
|
1081 |
-
// ----- Look if the $p_archive is a PclZip object
|
1082 |
-
if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
|
1083 |
-
{
|
1084 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is valid PclZip object '".$p_archive->zipname."'");
|
1085 |
-
|
1086 |
-
// ----- Duplicate the archive
|
1087 |
-
$v_result = $this->privDuplicate($p_archive->zipname);
|
1088 |
-
}
|
1089 |
-
|
1090 |
-
// ----- Look if the $p_archive is a string (so a filename)
|
1091 |
-
else if (is_string($p_archive))
|
1092 |
-
{
|
1093 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is a filename '$p_archive'");
|
1094 |
-
|
1095 |
-
// ----- Check that $p_archive is a valid zip file
|
1096 |
-
// TBC : Should also check the archive format
|
1097 |
-
if (!is_file($p_archive)) {
|
1098 |
-
// ----- Error log
|
1099 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
|
1100 |
-
$v_result = PCLZIP_ERR_MISSING_FILE;
|
1101 |
-
}
|
1102 |
-
else {
|
1103 |
-
// ----- Duplicate the archive
|
1104 |
-
$v_result = $this->privDuplicate($p_archive);
|
1105 |
-
}
|
1106 |
-
}
|
1107 |
-
|
1108 |
-
// ----- Invalid variable
|
1109 |
-
else
|
1110 |
-
{
|
1111 |
-
// ----- Error log
|
1112 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
|
1113 |
-
$v_result = PCLZIP_ERR_INVALID_PARAMETER;
|
1114 |
-
}
|
1115 |
-
|
1116 |
-
// ----- Return
|
1117 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1118 |
-
return $v_result;
|
1119 |
-
}
|
1120 |
-
// --------------------------------------------------------------------------------
|
1121 |
-
|
1122 |
-
// --------------------------------------------------------------------------------
|
1123 |
-
// Function : merge()
|
1124 |
-
// Description :
|
1125 |
-
// This method merge the $p_archive_to_add archive at the end of the current
|
1126 |
-
// one ($this).
|
1127 |
-
// If the archive ($this) does not exist, the merge becomes a duplicate.
|
1128 |
-
// If the $p_archive_to_add archive does not exist, the merge is a success.
|
1129 |
-
// Parameters :
|
1130 |
-
// $p_archive_to_add : It can be directly the filename of a valid zip archive,
|
1131 |
-
// or a PclZip object archive.
|
1132 |
-
// Return Values :
|
1133 |
-
// 1 on success,
|
1134 |
-
// 0 or negative values on error (see below).
|
1135 |
-
// --------------------------------------------------------------------------------
|
1136 |
-
function merge($p_archive_to_add)
|
1137 |
-
{
|
1138 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::merge", "");
|
1139 |
-
$v_result = 1;
|
1140 |
-
|
1141 |
-
// ----- Reset the error handler
|
1142 |
-
$this->privErrorReset();
|
1143 |
-
|
1144 |
-
// ----- Check archive
|
1145 |
-
if (!$this->privCheckFormat()) {
|
1146 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1147 |
-
return(0);
|
1148 |
-
}
|
1149 |
-
|
1150 |
-
// ----- Look if the $p_archive_to_add is a PclZip object
|
1151 |
-
if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
|
1152 |
-
{
|
1153 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is valid PclZip object");
|
1154 |
-
|
1155 |
-
// ----- Merge the archive
|
1156 |
-
$v_result = $this->privMerge($p_archive_to_add);
|
1157 |
-
}
|
1158 |
-
|
1159 |
-
// ----- Look if the $p_archive_to_add is a string (so a filename)
|
1160 |
-
else if (is_string($p_archive_to_add))
|
1161 |
-
{
|
1162 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is a filename");
|
1163 |
-
|
1164 |
-
// ----- Create a temporary archive
|
1165 |
-
$v_object_archive = new PclZip($p_archive_to_add);
|
1166 |
-
|
1167 |
-
// ----- Merge the archive
|
1168 |
-
$v_result = $this->privMerge($v_object_archive);
|
1169 |
-
}
|
1170 |
-
|
1171 |
-
// ----- Invalid variable
|
1172 |
-
else
|
1173 |
-
{
|
1174 |
-
// ----- Error log
|
1175 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
|
1176 |
-
$v_result = PCLZIP_ERR_INVALID_PARAMETER;
|
1177 |
-
}
|
1178 |
-
|
1179 |
-
// ----- Return
|
1180 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1181 |
-
return $v_result;
|
1182 |
-
}
|
1183 |
-
// --------------------------------------------------------------------------------
|
1184 |
-
|
1185 |
-
|
1186 |
-
|
1187 |
-
// --------------------------------------------------------------------------------
|
1188 |
-
// Function : errorCode()
|
1189 |
-
// Description :
|
1190 |
-
// Parameters :
|
1191 |
-
// --------------------------------------------------------------------------------
|
1192 |
-
function errorCode()
|
1193 |
-
{
|
1194 |
-
if (PCLZIP_ERROR_EXTERNAL == 1) {
|
1195 |
-
return(PclErrorCode());
|
1196 |
-
}
|
1197 |
-
else {
|
1198 |
-
return($this->error_code);
|
1199 |
-
}
|
1200 |
-
}
|
1201 |
-
// --------------------------------------------------------------------------------
|
1202 |
-
|
1203 |
-
// --------------------------------------------------------------------------------
|
1204 |
-
// Function : errorName()
|
1205 |
-
// Description :
|
1206 |
-
// Parameters :
|
1207 |
-
// --------------------------------------------------------------------------------
|
1208 |
-
function errorName($p_with_code=false)
|
1209 |
-
{
|
1210 |
-
$v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
|
1211 |
-
PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
|
1212 |
-
PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
|
1213 |
-
PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
|
1214 |
-
PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
|
1215 |
-
PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
|
1216 |
-
PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
|
1217 |
-
PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
|
1218 |
-
PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
|
1219 |
-
PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
|
1220 |
-
PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
|
1221 |
-
PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
|
1222 |
-
PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
|
1223 |
-
PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
|
1224 |
-
PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
|
1225 |
-
PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
|
1226 |
-
PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
|
1227 |
-
PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
|
1228 |
-
PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'
|
1229 |
-
,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'
|
1230 |
-
,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'
|
1231 |
-
);
|
1232 |
-
|
1233 |
-
if (isset($v_name[$this->error_code])) {
|
1234 |
-
$v_value = $v_name[$this->error_code];
|
1235 |
-
}
|
1236 |
-
else {
|
1237 |
-
$v_value = 'NoName';
|
1238 |
-
}
|
1239 |
-
|
1240 |
-
if ($p_with_code) {
|
1241 |
-
return($v_value.' ('.$this->error_code.')');
|
1242 |
-
}
|
1243 |
-
else {
|
1244 |
-
return($v_value);
|
1245 |
-
}
|
1246 |
-
}
|
1247 |
-
// --------------------------------------------------------------------------------
|
1248 |
-
|
1249 |
-
// --------------------------------------------------------------------------------
|
1250 |
-
// Function : errorInfo()
|
1251 |
-
// Description :
|
1252 |
-
// Parameters :
|
1253 |
-
// --------------------------------------------------------------------------------
|
1254 |
-
function errorInfo($p_full=false)
|
1255 |
-
{
|
1256 |
-
if (PCLZIP_ERROR_EXTERNAL == 1) {
|
1257 |
-
return(PclErrorString());
|
1258 |
-
}
|
1259 |
-
else {
|
1260 |
-
if ($p_full) {
|
1261 |
-
return($this->errorName(true)." : ".$this->error_string);
|
1262 |
-
}
|
1263 |
-
else {
|
1264 |
-
return($this->error_string." [code ".$this->error_code."]");
|
1265 |
-
}
|
1266 |
-
}
|
1267 |
-
}
|
1268 |
-
// --------------------------------------------------------------------------------
|
1269 |
-
|
1270 |
-
|
1271 |
-
// --------------------------------------------------------------------------------
|
1272 |
-
// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
|
1273 |
-
// ***** *****
|
1274 |
-
// ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY *****
|
1275 |
-
// --------------------------------------------------------------------------------
|
1276 |
-
|
1277 |
-
|
1278 |
-
|
1279 |
-
// --------------------------------------------------------------------------------
|
1280 |
-
// Function : privCheckFormat()
|
1281 |
-
// Description :
|
1282 |
-
// This method check that the archive exists and is a valid zip archive.
|
1283 |
-
// Several level of check exists. (futur)
|
1284 |
-
// Parameters :
|
1285 |
-
// $p_level : Level of check. Default 0.
|
1286 |
-
// 0 : Check the first bytes (magic codes) (default value))
|
1287 |
-
// 1 : 0 + Check the central directory (futur)
|
1288 |
-
// 2 : 1 + Check each file header (futur)
|
1289 |
-
// Return Values :
|
1290 |
-
// true on success,
|
1291 |
-
// false on error, the error code is set.
|
1292 |
-
// --------------------------------------------------------------------------------
|
1293 |
-
function privCheckFormat($p_level=0)
|
1294 |
-
{
|
1295 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFormat", "");
|
1296 |
-
$v_result = true;
|
1297 |
-
|
1298 |
-
// ----- Reset the file system cache
|
1299 |
-
clearstatcache();
|
1300 |
-
|
1301 |
-
// ----- Reset the error handler
|
1302 |
-
$this->privErrorReset();
|
1303 |
-
|
1304 |
-
// ----- Look if the file exits
|
1305 |
-
if (!is_file($this->zipname)) {
|
1306 |
-
// ----- Error log
|
1307 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
|
1308 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
|
1309 |
-
return(false);
|
1310 |
-
}
|
1311 |
-
|
1312 |
-
// ----- Check that the file is readeable
|
1313 |
-
if (!is_readable($this->zipname)) {
|
1314 |
-
// ----- Error log
|
1315 |
-
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
|
1316 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
|
1317 |
-
return(false);
|
1318 |
-
}
|
1319 |
-
|
1320 |
-
// ----- Check the magic code
|
1321 |
-
// TBC
|
1322 |
-
|
1323 |
-
// ----- Check the central header
|
1324 |
-
// TBC
|
1325 |
-
|
1326 |
-
// ----- Check each file header
|
1327 |
-
// TBC
|
1328 |
-
|
1329 |
-
// ----- Return
|
1330 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1331 |
-
return $v_result;
|
1332 |
-
}
|
1333 |
-
// --------------------------------------------------------------------------------
|
1334 |
-
|
1335 |
-
// --------------------------------------------------------------------------------
|
1336 |
-
// Function : privParseOptions()
|
1337 |
-
// Description :
|
1338 |
-
// This internal methods reads the variable list of arguments ($p_options_list,
|
1339 |
-
// $p_size) and generate an array with the options and values ($v_result_list).
|
1340 |
-
// $v_requested_options contains the options that can be present and those that
|
1341 |
-
// must be present.
|
1342 |
-
// $v_requested_options is an array, with the option value as key, and 'optional',
|
1343 |
-
// or 'mandatory' as value.
|
1344 |
-
// Parameters :
|
1345 |
-
// See above.
|
1346 |
-
// Return Values :
|
1347 |
-
// 1 on success.
|
1348 |
-
// 0 on failure.
|
1349 |
-
// --------------------------------------------------------------------------------
|
1350 |
-
function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
|
1351 |
-
{
|
1352 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
|
1353 |
-
$v_result=1;
|
1354 |
-
|
1355 |
-
// ----- Read the options
|
1356 |
-
$i=0;
|
1357 |
-
while ($i<$p_size) {
|
1358 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Looking for table index $i, option = '".PclZipUtilOptionText($p_options_list[$i])."(".$p_options_list[$i].")'");
|
1359 |
-
|
1360 |
-
// ----- Check if the option is supported
|
1361 |
-
if (!isset($v_requested_options[$p_options_list[$i]])) {
|
1362 |
-
// ----- Error log
|
1363 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
|
1364 |
-
|
1365 |
-
// ----- Return
|
1366 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1367 |
-
return PclZip::errorCode();
|
1368 |
-
}
|
1369 |
-
|
1370 |
-
// ----- Look for next option
|
1371 |
-
switch ($p_options_list[$i]) {
|
1372 |
-
// ----- Look for options that request a path value
|
1373 |
-
case PCLZIP_OPT_PATH :
|
1374 |
-
case PCLZIP_OPT_REMOVE_PATH :
|
1375 |
-
case PCLZIP_OPT_ADD_PATH :
|
1376 |
-
// ----- Check the number of parameters
|
1377 |
-
if (($i+1) >= $p_size) {
|
1378 |
-
// ----- Error log
|
1379 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1380 |
-
|
1381 |
-
// ----- Return
|
1382 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1383 |
-
return PclZip::errorCode();
|
1384 |
-
}
|
1385 |
-
|
1386 |
-
// ----- Get the value
|
1387 |
-
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
|
1388 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1389 |
-
$i++;
|
1390 |
-
break;
|
1391 |
-
|
1392 |
-
case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
|
1393 |
-
// ----- Check the number of parameters
|
1394 |
-
if (($i+1) >= $p_size) {
|
1395 |
-
// ----- Error log
|
1396 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1397 |
-
|
1398 |
-
// ----- Return
|
1399 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1400 |
-
return PclZip::errorCode();
|
1401 |
-
}
|
1402 |
-
|
1403 |
-
// ----- Get the value
|
1404 |
-
if ( is_string($p_options_list[$i+1])
|
1405 |
-
&& ($p_options_list[$i+1] != '')) {
|
1406 |
-
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
|
1407 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1408 |
-
$i++;
|
1409 |
-
}
|
1410 |
-
else {
|
1411 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." set with an empty value is ignored.");
|
1412 |
-
}
|
1413 |
-
break;
|
1414 |
-
|
1415 |
-
// ----- Look for options that request an array of string for value
|
1416 |
-
case PCLZIP_OPT_BY_NAME :
|
1417 |
-
// ----- Check the number of parameters
|
1418 |
-
if (($i+1) >= $p_size) {
|
1419 |
-
// ----- Error log
|
1420 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1421 |
-
|
1422 |
-
// ----- Return
|
1423 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1424 |
-
return PclZip::errorCode();
|
1425 |
-
}
|
1426 |
-
|
1427 |
-
// ----- Get the value
|
1428 |
-
if (is_string($p_options_list[$i+1])) {
|
1429 |
-
$v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
|
1430 |
-
}
|
1431 |
-
else if (is_array($p_options_list[$i+1])) {
|
1432 |
-
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
|
1433 |
-
}
|
1434 |
-
else {
|
1435 |
-
// ----- Error log
|
1436 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1437 |
-
|
1438 |
-
// ----- Return
|
1439 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1440 |
-
return PclZip::errorCode();
|
1441 |
-
}
|
1442 |
-
////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1443 |
-
$i++;
|
1444 |
-
break;
|
1445 |
-
|
1446 |
-
// ----- Look for options that request an EREG or PREG expression
|
1447 |
-
case PCLZIP_OPT_BY_EREG :
|
1448 |
-
case PCLZIP_OPT_BY_PREG :
|
1449 |
-
//case PCLZIP_OPT_CRYPT :
|
1450 |
-
// ----- Check the number of parameters
|
1451 |
-
if (($i+1) >= $p_size) {
|
1452 |
-
// ----- Error log
|
1453 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1454 |
-
|
1455 |
-
// ----- Return
|
1456 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1457 |
-
return PclZip::errorCode();
|
1458 |
-
}
|
1459 |
-
|
1460 |
-
// ----- Get the value
|
1461 |
-
if (is_string($p_options_list[$i+1])) {
|
1462 |
-
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
|
1463 |
-
}
|
1464 |
-
else {
|
1465 |
-
// ----- Error log
|
1466 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1467 |
-
|
1468 |
-
// ----- Return
|
1469 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1470 |
-
return PclZip::errorCode();
|
1471 |
-
}
|
1472 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1473 |
-
$i++;
|
1474 |
-
break;
|
1475 |
-
|
1476 |
-
// ----- Look for options that takes a string
|
1477 |
-
case PCLZIP_OPT_COMMENT :
|
1478 |
-
case PCLZIP_OPT_ADD_COMMENT :
|
1479 |
-
case PCLZIP_OPT_PREPEND_COMMENT :
|
1480 |
-
// ----- Check the number of parameters
|
1481 |
-
if (($i+1) >= $p_size) {
|
1482 |
-
// ----- Error log
|
1483 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
|
1484 |
-
"Missing parameter value for option '"
|
1485 |
-
.PclZipUtilOptionText($p_options_list[$i])
|
1486 |
-
."'");
|
1487 |
-
|
1488 |
-
// ----- Return
|
1489 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1490 |
-
return PclZip::errorCode();
|
1491 |
-
}
|
1492 |
-
|
1493 |
-
// ----- Get the value
|
1494 |
-
if (is_string($p_options_list[$i+1])) {
|
1495 |
-
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
|
1496 |
-
}
|
1497 |
-
else {
|
1498 |
-
// ----- Error log
|
1499 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
|
1500 |
-
"Wrong parameter value for option '"
|
1501 |
-
.PclZipUtilOptionText($p_options_list[$i])
|
1502 |
-
."'");
|
1503 |
-
|
1504 |
-
// ----- Return
|
1505 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1506 |
-
return PclZip::errorCode();
|
1507 |
-
}
|
1508 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1509 |
-
$i++;
|
1510 |
-
break;
|
1511 |
-
|
1512 |
-
// ----- Look for options that request an array of index
|
1513 |
-
case PCLZIP_OPT_BY_INDEX :
|
1514 |
-
// ----- Check the number of parameters
|
1515 |
-
if (($i+1) >= $p_size) {
|
1516 |
-
// ----- Error log
|
1517 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1518 |
-
|
1519 |
-
// ----- Return
|
1520 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1521 |
-
return PclZip::errorCode();
|
1522 |
-
}
|
1523 |
-
|
1524 |
-
// ----- Get the value
|
1525 |
-
$v_work_list = array();
|
1526 |
-
if (is_string($p_options_list[$i+1])) {
|
1527 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is a string '".$p_options_list[$i+1]."'");
|
1528 |
-
|
1529 |
-
// ----- Remove spaces
|
1530 |
-
$p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
|
1531 |
-
|
1532 |
-
// ----- Parse items
|
1533 |
-
$v_work_list = explode(",", $p_options_list[$i+1]);
|
1534 |
-
}
|
1535 |
-
else if (is_integer($p_options_list[$i+1])) {
|
1536 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an integer '".$p_options_list[$i+1]."'");
|
1537 |
-
$v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
|
1538 |
-
}
|
1539 |
-
else if (is_array($p_options_list[$i+1])) {
|
1540 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an array");
|
1541 |
-
$v_work_list = $p_options_list[$i+1];
|
1542 |
-
}
|
1543 |
-
else {
|
1544 |
-
// ----- Error log
|
1545 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1546 |
-
|
1547 |
-
// ----- Return
|
1548 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1549 |
-
return PclZip::errorCode();
|
1550 |
-
}
|
1551 |
-
|
1552 |
-
// ----- Reduce the index list
|
1553 |
-
// each index item in the list must be a couple with a start and
|
1554 |
-
// an end value : [0,3], [5-5], [8-10], ...
|
1555 |
-
// ----- Check the format of each item
|
1556 |
-
$v_sort_flag=false;
|
1557 |
-
$v_sort_value=0;
|
1558 |
-
for ($j=0; $j<sizeof($v_work_list); $j++) {
|
1559 |
-
// ----- Explode the item
|
1560 |
-
$v_item_list = explode("-", $v_work_list[$j]);
|
1561 |
-
$v_size_item_list = sizeof($v_item_list);
|
1562 |
-
|
1563 |
-
// ----- TBC : Here we might check that each item is a
|
1564 |
-
// real integer ...
|
1565 |
-
|
1566 |
-
// ----- Look for single value
|
1567 |
-
if ($v_size_item_list == 1) {
|
1568 |
-
// ----- Set the option value
|
1569 |
-
$v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
|
1570 |
-
$v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
|
1571 |
-
}
|
1572 |
-
elseif ($v_size_item_list == 2) {
|
1573 |
-
// ----- Set the option value
|
1574 |
-
$v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
|
1575 |
-
$v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
|
1576 |
-
}
|
1577 |
-
else {
|
1578 |
-
// ----- Error log
|
1579 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1580 |
-
|
1581 |
-
// ----- Return
|
1582 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1583 |
-
return PclZip::errorCode();
|
1584 |
-
}
|
1585 |
-
|
1586 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extracted index item = [".$v_result_list[$p_options_list[$i]][$j]['start'].",".$v_result_list[$p_options_list[$i]][$j]['end']."]");
|
1587 |
-
|
1588 |
-
// ----- Look for list sort
|
1589 |
-
if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
|
1590 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The list should be sorted ...");
|
1591 |
-
$v_sort_flag=true;
|
1592 |
-
|
1593 |
-
// ----- TBC : An automatic sort should be writen ...
|
1594 |
-
// ----- Error log
|
1595 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1596 |
-
|
1597 |
-
// ----- Return
|
1598 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1599 |
-
return PclZip::errorCode();
|
1600 |
-
}
|
1601 |
-
$v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
|
1602 |
-
}
|
1603 |
-
|
1604 |
-
// ----- Sort the items
|
1605 |
-
if ($v_sort_flag) {
|
1606 |
-
// TBC : To Be Completed
|
1607 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "List sorting is not yet write ...");
|
1608 |
-
}
|
1609 |
-
|
1610 |
-
// ----- Next option
|
1611 |
-
$i++;
|
1612 |
-
break;
|
1613 |
-
|
1614 |
-
// ----- Look for options that request no value
|
1615 |
-
case PCLZIP_OPT_REMOVE_ALL_PATH :
|
1616 |
-
case PCLZIP_OPT_EXTRACT_AS_STRING :
|
1617 |
-
case PCLZIP_OPT_NO_COMPRESSION :
|
1618 |
-
case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
|
1619 |
-
case PCLZIP_OPT_REPLACE_NEWER :
|
1620 |
-
case PCLZIP_OPT_STOP_ON_ERROR :
|
1621 |
-
$v_result_list[$p_options_list[$i]] = true;
|
1622 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1623 |
-
break;
|
1624 |
-
|
1625 |
-
// ----- Look for options that request an octal value
|
1626 |
-
case PCLZIP_OPT_SET_CHMOD :
|
1627 |
-
// ----- Check the number of parameters
|
1628 |
-
if (($i+1) >= $p_size) {
|
1629 |
-
// ----- Error log
|
1630 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1631 |
-
|
1632 |
-
// ----- Return
|
1633 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1634 |
-
return PclZip::errorCode();
|
1635 |
-
}
|
1636 |
-
|
1637 |
-
// ----- Get the value
|
1638 |
-
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
|
1639 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1640 |
-
$i++;
|
1641 |
-
break;
|
1642 |
-
|
1643 |
-
// ----- Look for options that request a call-back
|
1644 |
-
case PCLZIP_CB_PRE_EXTRACT :
|
1645 |
-
case PCLZIP_CB_POST_EXTRACT :
|
1646 |
-
case PCLZIP_CB_PRE_ADD :
|
1647 |
-
case PCLZIP_CB_POST_ADD :
|
1648 |
-
/* for futur use
|
1649 |
-
case PCLZIP_CB_PRE_DELETE :
|
1650 |
-
case PCLZIP_CB_POST_DELETE :
|
1651 |
-
case PCLZIP_CB_PRE_LIST :
|
1652 |
-
case PCLZIP_CB_POST_LIST :
|
1653 |
-
*/
|
1654 |
-
// ----- Check the number of parameters
|
1655 |
-
if (($i+1) >= $p_size) {
|
1656 |
-
// ----- Error log
|
1657 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1658 |
-
|
1659 |
-
// ----- Return
|
1660 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1661 |
-
return PclZip::errorCode();
|
1662 |
-
}
|
1663 |
-
|
1664 |
-
// ----- Get the value
|
1665 |
-
$v_function_name = $p_options_list[$i+1];
|
1666 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "call-back ".PclZipUtilOptionText($p_options_list[$i])." = '".$v_function_name."'");
|
1667 |
-
|
1668 |
-
// ----- Check that the value is a valid existing function
|
1669 |
-
if (!function_exists($v_function_name)) {
|
1670 |
-
// ----- Error log
|
1671 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1672 |
-
|
1673 |
-
// ----- Return
|
1674 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1675 |
-
return PclZip::errorCode();
|
1676 |
-
}
|
1677 |
-
|
1678 |
-
// ----- Set the attribute
|
1679 |
-
$v_result_list[$p_options_list[$i]] = $v_function_name;
|
1680 |
-
$i++;
|
1681 |
-
break;
|
1682 |
-
|
1683 |
-
default :
|
1684 |
-
// ----- Error log
|
1685 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
1686 |
-
"Unknown parameter '"
|
1687 |
-
.$p_options_list[$i]."'");
|
1688 |
-
|
1689 |
-
// ----- Return
|
1690 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1691 |
-
return PclZip::errorCode();
|
1692 |
-
}
|
1693 |
-
|
1694 |
-
// ----- Next options
|
1695 |
-
$i++;
|
1696 |
-
}
|
1697 |
-
|
1698 |
-
// ----- Look for mandatory options
|
1699 |
-
if ($v_requested_options !== false) {
|
1700 |
-
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
|
1701 |
-
// ----- Look for mandatory option
|
1702 |
-
if ($v_requested_options[$key] == 'mandatory') {
|
1703 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
|
1704 |
-
// ----- Look if present
|
1705 |
-
if (!isset($v_result_list[$key])) {
|
1706 |
-
// ----- Error log
|
1707 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
|
1708 |
-
|
1709 |
-
// ----- Return
|
1710 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1711 |
-
return PclZip::errorCode();
|
1712 |
-
}
|
1713 |
-
}
|
1714 |
-
}
|
1715 |
-
}
|
1716 |
-
|
1717 |
-
// ----- Return
|
1718 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1719 |
-
return $v_result;
|
1720 |
-
}
|
1721 |
-
// --------------------------------------------------------------------------------
|
1722 |
-
|
1723 |
-
// --------------------------------------------------------------------------------
|
1724 |
-
// Function : privFileDescrParseAtt()
|
1725 |
-
// Description :
|
1726 |
-
// Parameters :
|
1727 |
-
// Return Values :
|
1728 |
-
// 1 on success.
|
1729 |
-
// 0 on failure.
|
1730 |
-
// --------------------------------------------------------------------------------
|
1731 |
-
function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
|
1732 |
-
{
|
1733 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
|
1734 |
-
$v_result=1;
|
1735 |
-
|
1736 |
-
// ----- For each file in the list check the attributes
|
1737 |
-
foreach ($p_file_list as $v_key => $v_value) {
|
1738 |
-
|
1739 |
-
// ----- Check if the option is supported
|
1740 |
-
if (!isset($v_requested_options[$v_key])) {
|
1741 |
-
// ----- Error log
|
1742 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
|
1743 |
-
|
1744 |
-
// ----- Return
|
1745 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1746 |
-
return PclZip::errorCode();
|
1747 |
-
}
|
1748 |
-
|
1749 |
-
// ----- Look for attribute
|
1750 |
-
switch ($v_key) {
|
1751 |
-
case PCLZIP_ATT_FILE_NAME :
|
1752 |
-
if (!is_string($v_value)) {
|
1753 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
1754 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1755 |
-
return PclZip::errorCode();
|
1756 |
-
}
|
1757 |
-
|
1758 |
-
$p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
|
1759 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
1760 |
-
|
1761 |
-
if ($p_filedescr['filename'] == '') {
|
1762 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
1763 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1764 |
-
return PclZip::errorCode();
|
1765 |
-
}
|
1766 |
-
|
1767 |
-
break;
|
1768 |
-
|
1769 |
-
case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
|
1770 |
-
if (!is_string($v_value)) {
|
1771 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
1772 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1773 |
-
return PclZip::errorCode();
|
1774 |
-
}
|
1775 |
-
|
1776 |
-
$p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
|
1777 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
1778 |
-
|
1779 |
-
if ($p_filedescr['new_short_name'] == '') {
|
1780 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
1781 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1782 |
-
return PclZip::errorCode();
|
1783 |
-
}
|
1784 |
-
break;
|
1785 |
-
|
1786 |
-
case PCLZIP_ATT_FILE_NEW_FULL_NAME :
|
1787 |
-
if (!is_string($v_value)) {
|
1788 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
1789 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1790 |
-
return PclZip::errorCode();
|
1791 |
-
}
|
1792 |
-
|
1793 |
-
$p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
|
1794 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
1795 |
-
|
1796 |
-
if ($p_filedescr['new_full_name'] == '') {
|
1797 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
1798 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1799 |
-
return PclZip::errorCode();
|
1800 |
-
}
|
1801 |
-
break;
|
1802 |
-
|
1803 |
-
default :
|
1804 |
-
// ----- Error log
|
1805 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
1806 |
-
"Unknown parameter '".$v_key."'");
|
1807 |
-
|
1808 |
-
// ----- Return
|
1809 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1810 |
-
return PclZip::errorCode();
|
1811 |
-
}
|
1812 |
-
|
1813 |
-
// ----- Look for mandatory options
|
1814 |
-
if ($v_requested_options !== false) {
|
1815 |
-
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
|
1816 |
-
// ----- Look for mandatory option
|
1817 |
-
if ($v_requested_options[$key] == 'mandatory') {
|
1818 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
|
1819 |
-
// ----- Look if present
|
1820 |
-
if (!isset($p_file_list[$key])) {
|
1821 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
|
1822 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1823 |
-
return PclZip::errorCode();
|
1824 |
-
}
|
1825 |
-
}
|
1826 |
-
}
|
1827 |
-
}
|
1828 |
-
|
1829 |
-
// end foreach
|
1830 |
-
}
|
1831 |
-
|
1832 |
-
// ----- Return
|
1833 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1834 |
-
return $v_result;
|
1835 |
-
}
|
1836 |
-
// --------------------------------------------------------------------------------
|
1837 |
-
|
1838 |
-
// --------------------------------------------------------------------------------
|
1839 |
-
// Function : privFileDescrExpand()
|
1840 |
-
// Description :
|
1841 |
-
// Parameters :
|
1842 |
-
// Return Values :
|
1843 |
-
// 1 on success.
|
1844 |
-
// 0 on failure.
|
1845 |
-
// --------------------------------------------------------------------------------
|
1846 |
-
function privFileDescrExpand(&$p_filedescr_list, &$p_options)
|
1847 |
-
{
|
1848 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
|
1849 |
-
$v_result=1;
|
1850 |
-
|
1851 |
-
// ----- Create a result list
|
1852 |
-
$v_result_list = array();
|
1853 |
-
|
1854 |
-
// ----- Look each entry
|
1855 |
-
for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
|
1856 |
-
// ----- Get filedescr
|
1857 |
-
$v_descr = $p_filedescr_list[$i];
|
1858 |
-
|
1859 |
-
// ----- Reduce the filename
|
1860 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
|
1861 |
-
$v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename']);
|
1862 |
-
$v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
|
1863 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
|
1864 |
-
|
1865 |
-
// ----- Get type of descr
|
1866 |
-
if (!file_exists($v_descr['filename'])) {
|
1867 |
-
// ----- Error log
|
1868 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_descr['filename']."' does not exists");
|
1869 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exists");
|
1870 |
-
|
1871 |
-
// ----- Return
|
1872 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1873 |
-
return PclZip::errorCode();
|
1874 |
-
}
|
1875 |
-
if (@is_file($v_descr['filename'])) {
|
1876 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a file");
|
1877 |
-
$v_descr['type'] = 'file';
|
1878 |
-
}
|
1879 |
-
else if (@is_dir($v_descr['filename'])) {
|
1880 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a folder");
|
1881 |
-
$v_descr['type'] = 'folder';
|
1882 |
-
}
|
1883 |
-
else if (@is_link($v_descr['filename'])) {
|
1884 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : link");
|
1885 |
-
// skip
|
1886 |
-
continue;
|
1887 |
-
}
|
1888 |
-
else {
|
1889 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : unknown type");
|
1890 |
-
// skip
|
1891 |
-
continue;
|
1892 |
-
}
|
1893 |
-
|
1894 |
-
// ----- Calculate the stored filename
|
1895 |
-
$this->privCalculateStoredFilename($v_descr, $p_options);
|
1896 |
-
|
1897 |
-
// ----- Add the descriptor in result list
|
1898 |
-
$v_result_list[sizeof($v_result_list)] = $v_descr;
|
1899 |
-
|
1900 |
-
// ----- Look for folder
|
1901 |
-
if ($v_descr['type'] == 'folder') {
|
1902 |
-
// ----- List of items in folder
|
1903 |
-
$v_dirlist_descr = array();
|
1904 |
-
$v_dirlist_nb = 0;
|
1905 |
-
if ($v_folder_handler = @opendir($v_descr['filename'])) {
|
1906 |
-
while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
|
1907 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for '".$v_item_handler."' in the directory");
|
1908 |
-
|
1909 |
-
// ----- Skip '.' and '..'
|
1910 |
-
if (($v_item_handler == '.') || ($v_item_handler == '..')) {
|
1911 |
-
continue;
|
1912 |
-
}
|
1913 |
-
|
1914 |
-
// ----- Compose the full filename
|
1915 |
-
$v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
|
1916 |
-
|
1917 |
-
// ----- Look for different stored filename
|
1918 |
-
// Because the name of the folder was changed, the name of the
|
1919 |
-
// files/sub-folders also change
|
1920 |
-
if ($v_descr['stored_filename'] != $v_descr['filename']) {
|
1921 |
-
$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
|
1922 |
-
}
|
1923 |
-
|
1924 |
-
$v_dirlist_nb++;
|
1925 |
-
}
|
1926 |
-
}
|
1927 |
-
else {
|
1928 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
|
1929 |
-
// TBC : unable to open folder in read mode
|
1930 |
-
}
|
1931 |
-
|
1932 |
-
// ----- Expand each element of the list
|
1933 |
-
if ($v_dirlist_nb != 0) {
|
1934 |
-
// ----- Expand
|
1935 |
-
if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
|
1936 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1937 |
-
return $v_result;
|
1938 |
-
}
|
1939 |
-
|
1940 |
-
// ----- Concat the resulting list
|
1941 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
|
1942 |
-
$v_result_list = array_merge($v_result_list, $v_dirlist_descr);
|
1943 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "merged result list is size '".sizeof($v_result_list)."'");
|
1944 |
-
}
|
1945 |
-
else {
|
1946 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
|
1947 |
-
}
|
1948 |
-
|
1949 |
-
// ----- Free local array
|
1950 |
-
unset($v_dirlist_descr);
|
1951 |
-
}
|
1952 |
-
}
|
1953 |
-
|
1954 |
-
// ----- Get the result list
|
1955 |
-
$p_filedescr_list = $v_result_list;
|
1956 |
-
|
1957 |
-
// ----- Return
|
1958 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1959 |
-
return $v_result;
|
1960 |
-
}
|
1961 |
-
// --------------------------------------------------------------------------------
|
1962 |
-
|
1963 |
-
// --------------------------------------------------------------------------------
|
1964 |
-
// Function : privCreate()
|
1965 |
-
// Description :
|
1966 |
-
// Parameters :
|
1967 |
-
// Return Values :
|
1968 |
-
// --------------------------------------------------------------------------------
|
1969 |
-
function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
|
1970 |
-
{
|
1971 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
|
1972 |
-
$v_result=1;
|
1973 |
-
$v_list_detail = array();
|
1974 |
-
|
1975 |
-
// ----- Magic quotes trick
|
1976 |
-
$this->privDisableMagicQuotes();
|
1977 |
-
|
1978 |
-
// ----- Open the file in write mode
|
1979 |
-
if (($v_result = $this->privOpenFd('wb')) != 1)
|
1980 |
-
{
|
1981 |
-
// ----- Return
|
1982 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1983 |
-
return $v_result;
|
1984 |
-
}
|
1985 |
-
|
1986 |
-
// ----- Add the list of files
|
1987 |
-
$v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options);
|
1988 |
-
|
1989 |
-
// ----- Close
|
1990 |
-
$this->privCloseFd();
|
1991 |
-
|
1992 |
-
// ----- Magic quotes trick
|
1993 |
-
$this->privSwapBackMagicQuotes();
|
1994 |
-
|
1995 |
-
// ----- Return
|
1996 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1997 |
-
return $v_result;
|
1998 |
-
}
|
1999 |
-
// --------------------------------------------------------------------------------
|
2000 |
-
|
2001 |
-
// --------------------------------------------------------------------------------
|
2002 |
-
// Function : privAdd()
|
2003 |
-
// Description :
|
2004 |
-
// Parameters :
|
2005 |
-
// Return Values :
|
2006 |
-
// --------------------------------------------------------------------------------
|
2007 |
-
function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
|
2008 |
-
{
|
2009 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAdd", "list");
|
2010 |
-
$v_result=1;
|
2011 |
-
$v_list_detail = array();
|
2012 |
-
|
2013 |
-
// ----- Look if the archive exists or is empty
|
2014 |
-
if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
|
2015 |
-
{
|
2016 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, or is empty, create it.");
|
2017 |
-
|
2018 |
-
// ----- Do a create
|
2019 |
-
$v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
|
2020 |
-
|
2021 |
-
// ----- Return
|
2022 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2023 |
-
return $v_result;
|
2024 |
-
}
|
2025 |
-
// ----- Magic quotes trick
|
2026 |
-
$this->privDisableMagicQuotes();
|
2027 |
-
|
2028 |
-
// ----- Open the zip file
|
2029 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
2030 |
-
if (($v_result=$this->privOpenFd('rb')) != 1)
|
2031 |
-
{
|
2032 |
-
// ----- Magic quotes trick
|
2033 |
-
$this->privSwapBackMagicQuotes();
|
2034 |
-
|
2035 |
-
// ----- Return
|
2036 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2037 |
-
return $v_result;
|
2038 |
-
}
|
2039 |
-
|
2040 |
-
// ----- Read the central directory informations
|
2041 |
-
$v_central_dir = array();
|
2042 |
-
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
2043 |
-
{
|
2044 |
-
$this->privCloseFd();
|
2045 |
-
$this->privSwapBackMagicQuotes();
|
2046 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2047 |
-
return $v_result;
|
2048 |
-
}
|
2049 |
-
|
2050 |
-
// ----- Go to beginning of File
|
2051 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
2052 |
-
@rewind($this->zip_fd);
|
2053 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
2054 |
-
|
2055 |
-
// ----- Creates a temporay file
|
2056 |
-
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
|
2057 |
-
|
2058 |
-
// ----- Open the temporary file in write mode
|
2059 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
2060 |
-
if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
|
2061 |
-
{
|
2062 |
-
$this->privCloseFd();
|
2063 |
-
$this->privSwapBackMagicQuotes();
|
2064 |
-
|
2065 |
-
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
|
2066 |
-
|
2067 |
-
// ----- Return
|
2068 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2069 |
-
return PclZip::errorCode();
|
2070 |
-
}
|
2071 |
-
|
2072 |
-
// ----- Copy the files from the archive to the temporary file
|
2073 |
-
// TBC : Here I should better append the file and go back to erase the central dir
|
2074 |
-
$v_size = $v_central_dir['offset'];
|
2075 |
-
while ($v_size != 0)
|
2076 |
-
{
|
2077 |
-
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
2078 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
2079 |
-
$v_buffer = fread($this->zip_fd, $v_read_size);
|
2080 |
-
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
2081 |
-
$v_size -= $v_read_size;
|
2082 |
-
}
|
2083 |
-
|
2084 |
-
// ----- Swap the file descriptor
|
2085 |
-
// Here is a trick : I swap the temporary fd with the zip fd, in order to use
|
2086 |
-
// the following methods on the temporary fil and not the real archive
|
2087 |
-
$v_swap = $this->zip_fd;
|
2088 |
-
$this->zip_fd = $v_zip_temp_fd;
|
2089 |
-
$v_zip_temp_fd = $v_swap;
|
2090 |
-
|
2091 |
-
// ----- Add the files
|
2092 |
-
$v_header_list = array();
|
2093 |
-
if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
|
2094 |
-
{
|
2095 |
-
fclose($v_zip_temp_fd);
|
2096 |
-
$this->privCloseFd();
|
2097 |
-
@unlink($v_zip_temp_name);
|
2098 |
-
$this->privSwapBackMagicQuotes();
|
2099 |
-
|
2100 |
-
// ----- Return
|
2101 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2102 |
-
return $v_result;
|
2103 |
-
}
|
2104 |
-
|
2105 |
-
// ----- Store the offset of the central dir
|
2106 |
-
$v_offset = @ftell($this->zip_fd);
|
2107 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
|
2108 |
-
|
2109 |
-
// ----- Copy the block of file headers from the old archive
|
2110 |
-
$v_size = $v_central_dir['size'];
|
2111 |
-
while ($v_size != 0)
|
2112 |
-
{
|
2113 |
-
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
2114 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
2115 |
-
$v_buffer = @fread($v_zip_temp_fd, $v_read_size);
|
2116 |
-
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
|
2117 |
-
$v_size -= $v_read_size;
|
2118 |
-
}
|
2119 |
-
|
2120 |
-
// ----- Create the Central Dir files header
|
2121 |
-
for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
|
2122 |
-
{
|
2123 |
-
// ----- Create the file header
|
2124 |
-
if ($v_header_list[$i]['status'] == 'ok') {
|
2125 |
-
if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
|
2126 |
-
fclose($v_zip_temp_fd);
|
2127 |
-
$this->privCloseFd();
|
2128 |
-
@unlink($v_zip_temp_name);
|
2129 |
-
$this->privSwapBackMagicQuotes();
|
2130 |
-
|
2131 |
-
// ----- Return
|
2132 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2133 |
-
return $v_result;
|
2134 |
-
}
|
2135 |
-
$v_count++;
|
2136 |
-
}
|
2137 |
-
|
2138 |
-
// ----- Transform the header to a 'usable' info
|
2139 |
-
$this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
|
2140 |
-
}
|
2141 |
-
|
2142 |
-
// ----- Zip file comment
|
2143 |
-
$v_comment = $v_central_dir['comment'];
|
2144 |
-
if (isset($p_options[PCLZIP_OPT_COMMENT])) {
|
2145 |
-
$v_comment = $p_options[PCLZIP_OPT_COMMENT];
|
2146 |
-
}
|
2147 |
-
if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {
|
2148 |
-
$v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];
|
2149 |
-
}
|
2150 |
-
if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {
|
2151 |
-
$v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;
|
2152 |
-
}
|
2153 |
-
|
2154 |
-
// ----- Calculate the size of the central header
|
2155 |
-
$v_size = @ftell($this->zip_fd)-$v_offset;
|
2156 |
-
|
2157 |
-
// ----- Create the central dir footer
|
2158 |
-
if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)
|
2159 |
-
{
|
2160 |
-
// ----- Reset the file list
|
2161 |
-
unset($v_header_list);
|
2162 |
-
$this->privSwapBackMagicQuotes();
|
2163 |
-
|
2164 |
-
// ----- Return
|
2165 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2166 |
-
return $v_result;
|
2167 |
-
}
|
2168 |
-
|
2169 |
-
// ----- Swap back the file descriptor
|
2170 |
-
$v_swap = $this->zip_fd;
|
2171 |
-
$this->zip_fd = $v_zip_temp_fd;
|
2172 |
-
$v_zip_temp_fd = $v_swap;
|
2173 |
-
|
2174 |
-
// ----- Close
|
2175 |
-
$this->privCloseFd();
|
2176 |
-
|
2177 |
-
// ----- Close the temporary file
|
2178 |
-
@fclose($v_zip_temp_fd);
|
2179 |
-
|
2180 |
-
// ----- Magic quotes trick
|
2181 |
-
$this->privSwapBackMagicQuotes();
|
2182 |
-
|
2183 |
-
// ----- Delete the zip file
|
2184 |
-
// TBC : I should test the result ...
|
2185 |
-
@unlink($this->zipname);
|
2186 |
-
|
2187 |
-
// ----- Rename the temporary file
|
2188 |
-
// TBC : I should test the result ...
|
2189 |
-
//@rename($v_zip_temp_name, $this->zipname);
|
2190 |
-
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
2191 |
-
|
2192 |
-
// ----- Return
|
2193 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2194 |
-
return $v_result;
|
2195 |
-
}
|
2196 |
-
// --------------------------------------------------------------------------------
|
2197 |
-
|
2198 |
-
// --------------------------------------------------------------------------------
|
2199 |
-
// Function : privOpenFd()
|
2200 |
-
// Description :
|
2201 |
-
// Parameters :
|
2202 |
-
// --------------------------------------------------------------------------------
|
2203 |
-
function privOpenFd($p_mode)
|
2204 |
-
{
|
2205 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOpenFd", 'mode='.$p_mode);
|
2206 |
-
$v_result=1;
|
2207 |
-
|
2208 |
-
// ----- Look if already open
|
2209 |
-
if ($this->zip_fd != 0)
|
2210 |
-
{
|
2211 |
-
// ----- Error log
|
2212 |
-
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
|
2213 |
-
|
2214 |
-
// ----- Return
|
2215 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2216 |
-
return PclZip::errorCode();
|
2217 |
-
}
|
2218 |
-
|
2219 |
-
// ----- Open the zip file
|
2220 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Open file in '.$p_mode.' mode');
|
2221 |
-
if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
|
2222 |
-
{
|
2223 |
-
// ----- Error log
|
2224 |
-
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
|
2225 |
-
|
2226 |
-
// ----- Return
|
2227 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2228 |
-
return PclZip::errorCode();
|
2229 |
-
}
|
2230 |
-
|
2231 |
-
// ----- Return
|
2232 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2233 |
-
return $v_result;
|
2234 |
-
}
|
2235 |
-
// --------------------------------------------------------------------------------
|
2236 |
-
|
2237 |
-
// --------------------------------------------------------------------------------
|
2238 |
-
// Function : privCloseFd()
|
2239 |
-
// Description :
|
2240 |
-
// Parameters :
|
2241 |
-
// --------------------------------------------------------------------------------
|
2242 |
-
function privCloseFd()
|
2243 |
-
{
|
2244 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCloseFd", "");
|
2245 |
-
$v_result=1;
|
2246 |
-
|
2247 |
-
if ($this->zip_fd != 0)
|
2248 |
-
@fclose($this->zip_fd);
|
2249 |
-
$this->zip_fd = 0;
|
2250 |
-
|
2251 |
-
// ----- Return
|
2252 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2253 |
-
return $v_result;
|
2254 |
-
}
|
2255 |
-
// --------------------------------------------------------------------------------
|
2256 |
-
|
2257 |
-
// --------------------------------------------------------------------------------
|
2258 |
-
// Function : privAddList()
|
2259 |
-
// Description :
|
2260 |
-
// $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
|
2261 |
-
// different from the real path of the file. This is usefull if you want to have PclTar
|
2262 |
-
// running in any directory, and memorize relative path from an other directory.
|
2263 |
-
// Parameters :
|
2264 |
-
// $p_list : An array containing the file or directory names to add in the tar
|
2265 |
-
// $p_result_list : list of added files with their properties (specially the status field)
|
2266 |
-
// $p_add_dir : Path to add in the filename path archived
|
2267 |
-
// $p_remove_dir : Path to remove in the filename path archived
|
2268 |
-
// Return Values :
|
2269 |
-
// --------------------------------------------------------------------------------
|
2270 |
-
// function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
|
2271 |
-
function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
|
2272 |
-
{
|
2273 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddList", "list");
|
2274 |
-
$v_result=1;
|
2275 |
-
|
2276 |
-
// ----- Add the files
|
2277 |
-
$v_header_list = array();
|
2278 |
-
if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
|
2279 |
-
{
|
2280 |
-
// ----- Return
|
2281 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2282 |
-
return $v_result;
|
2283 |
-
}
|
2284 |
-
|
2285 |
-
// ----- Store the offset of the central dir
|
2286 |
-
$v_offset = @ftell($this->zip_fd);
|
2287 |
-
|
2288 |
-
// ----- Create the Central Dir files header
|
2289 |
-
for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
|
2290 |
-
{
|
2291 |
-
// ----- Create the file header
|
2292 |
-
if ($v_header_list[$i]['status'] == 'ok') {
|
2293 |
-
if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
|
2294 |
-
// ----- Return
|
2295 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2296 |
-
return $v_result;
|
2297 |
-
}
|
2298 |
-
$v_count++;
|
2299 |
-
}
|
2300 |
-
|
2301 |
-
// ----- Transform the header to a 'usable' info
|
2302 |
-
$this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
|
2303 |
-
}
|
2304 |
-
|
2305 |
-
// ----- Zip file comment
|
2306 |
-
$v_comment = '';
|
2307 |
-
if (isset($p_options[PCLZIP_OPT_COMMENT])) {
|
2308 |
-
$v_comment = $p_options[PCLZIP_OPT_COMMENT];
|
2309 |
-
}
|
2310 |
-
|
2311 |
-
// ----- Calculate the size of the central header
|
2312 |
-
$v_size = @ftell($this->zip_fd)-$v_offset;
|
2313 |
-
|
2314 |
-
// ----- Create the central dir footer
|
2315 |
-
if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)
|
2316 |
-
{
|
2317 |
-
// ----- Reset the file list
|
2318 |
-
unset($v_header_list);
|
2319 |
-
|
2320 |
-
// ----- Return
|
2321 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2322 |
-
return $v_result;
|
2323 |
-
}
|
2324 |
-
|
2325 |
-
// ----- Return
|
2326 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2327 |
-
return $v_result;
|
2328 |
-
}
|
2329 |
-
// --------------------------------------------------------------------------------
|
2330 |
-
|
2331 |
-
// --------------------------------------------------------------------------------
|
2332 |
-
// Function : privAddFileList()
|
2333 |
-
// Description :
|
2334 |
-
// Parameters :
|
2335 |
-
// $p_filedescr_list : An array containing the file description
|
2336 |
-
// or directory names to add in the zip
|
2337 |
-
// $p_result_list : list of added files with their properties (specially the status field)
|
2338 |
-
// Return Values :
|
2339 |
-
// --------------------------------------------------------------------------------
|
2340 |
-
function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
|
2341 |
-
{
|
2342 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "filedescr_list");
|
2343 |
-
$v_result=1;
|
2344 |
-
$v_header = array();
|
2345 |
-
|
2346 |
-
// ----- Recuperate the current number of elt in list
|
2347 |
-
$v_nb = sizeof($p_result_list);
|
2348 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have ".$v_nb." elements");
|
2349 |
-
|
2350 |
-
// ----- Loop on the files
|
2351 |
-
for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
|
2352 |
-
// ----- Format the filename
|
2353 |
-
$p_filedescr_list[$j]['filename']
|
2354 |
-
= PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
|
2355 |
-
|
2356 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
|
2357 |
-
|
2358 |
-
// ----- Skip empty file names
|
2359 |
-
// TBC : Can this be possible ? not checked in DescrParseAtt ?
|
2360 |
-
if ($p_filedescr_list[$j]['filename'] == "") {
|
2361 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");
|
2362 |
-
continue;
|
2363 |
-
}
|
2364 |
-
|
2365 |
-
// ----- Check the filename
|
2366 |
-
if (!file_exists($p_filedescr_list[$j]['filename'])) {
|
2367 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
|
2368 |
-
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
|
2369 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2370 |
-
return PclZip::errorCode();
|
2371 |
-
}
|
2372 |
-
|
2373 |
-
// ----- Look if it is a file or a dir with no all path remove option
|
2374 |
-
if ( (is_file($p_filedescr_list[$j]['filename']))
|
2375 |
-
|| ( is_dir($p_filedescr_list[$j]['filename'])
|
2376 |
-
&& ( !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
|
2377 |
-
|| !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
|
2378 |
-
|
2379 |
-
// ----- Add the file
|
2380 |
-
$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
|
2381 |
-
$p_options);
|
2382 |
-
if ($v_result != 1) {
|
2383 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2384 |
-
return $v_result;
|
2385 |
-
}
|
2386 |
-
|
2387 |
-
// ----- Store the file infos
|
2388 |
-
$p_result_list[$v_nb++] = $v_header;
|
2389 |
-
}
|
2390 |
-
}
|
2391 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have ".$v_nb." elements");
|
2392 |
-
|
2393 |
-
// ----- Return
|
2394 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2395 |
-
return $v_result;
|
2396 |
-
}
|
2397 |
-
// --------------------------------------------------------------------------------
|
2398 |
-
|
2399 |
-
// --------------------------------------------------------------------------------
|
2400 |
-
// Function : privAddFile()
|
2401 |
-
// Description :
|
2402 |
-
// Parameters :
|
2403 |
-
// Return Values :
|
2404 |
-
// --------------------------------------------------------------------------------
|
2405 |
-
function privAddFile($p_filedescr, &$p_header, &$p_options)
|
2406 |
-
{
|
2407 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
|
2408 |
-
$v_result=1;
|
2409 |
-
|
2410 |
-
// ----- Working variable
|
2411 |
-
$p_filename = $p_filedescr['filename'];
|
2412 |
-
|
2413 |
-
// TBC : Already done in the fileAtt check ... ?
|
2414 |
-
if ($p_filename == "") {
|
2415 |
-
// ----- Error log
|
2416 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
|
2417 |
-
|
2418 |
-
// ----- Return
|
2419 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2420 |
-
return PclZip::errorCode();
|
2421 |
-
}
|
2422 |
-
|
2423 |
-
// ----- Look for a stored different filename
|
2424 |
-
if (isset($p_filedescr['stored_filename'])) {
|
2425 |
-
$v_stored_filename = $p_filedescr['stored_filename'];
|
2426 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"');
|
2427 |
-
}
|
2428 |
-
else {
|
2429 |
-
$v_stored_filename = $p_filedescr['stored_filename'];
|
2430 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is the same');
|
2431 |
-
}
|
2432 |
-
|
2433 |
-
// ----- Set the file properties
|
2434 |
-
clearstatcache();
|
2435 |
-
$p_header['version'] = 20;
|
2436 |
-
$p_header['version_extracted'] = 10;
|
2437 |
-
$p_header['flag'] = 0;
|
2438 |
-
$p_header['compression'] = 0;
|
2439 |
-
$p_header['mtime'] = filemtime($p_filename);
|
2440 |
-
$p_header['crc'] = 0;
|
2441 |
-
$p_header['compressed_size'] = 0;
|
2442 |
-
$p_header['size'] = filesize($p_filename);
|
2443 |
-
$p_header['filename_len'] = strlen($p_filename);
|
2444 |
-
$p_header['extra_len'] = 0;
|
2445 |
-
$p_header['comment_len'] = 0;
|
2446 |
-
$p_header['disk'] = 0;
|
2447 |
-
$p_header['internal'] = 0;
|
2448 |
-
// $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
|
2449 |
-
$p_header['external'] = (is_file($p_filename)?0x00000000:0x00000010);
|
2450 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
|
2451 |
-
$p_header['offset'] = 0;
|
2452 |
-
$p_header['filename'] = $p_filename;
|
2453 |
-
$p_header['stored_filename'] = $v_stored_filename;
|
2454 |
-
$p_header['extra'] = '';
|
2455 |
-
$p_header['comment'] = '';
|
2456 |
-
$p_header['status'] = 'ok';
|
2457 |
-
$p_header['index'] = -1;
|
2458 |
-
|
2459 |
-
// ----- Look for pre-add callback
|
2460 |
-
if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
|
2461 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the extraction");
|
2462 |
-
|
2463 |
-
// ----- Generate a local information
|
2464 |
-
$v_local_header = array();
|
2465 |
-
$this->privConvertHeader2FileInfo($p_header, $v_local_header);
|
2466 |
-
|
2467 |
-
// ----- Call the callback
|
2468 |
-
// Here I do not use call_user_func() because I need to send a reference to the
|
2469 |
-
// header.
|
2470 |
-
eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');
|
2471 |
-
if ($v_result == 0) {
|
2472 |
-
// ----- Change the file status
|
2473 |
-
$p_header['status'] = "skipped";
|
2474 |
-
$v_result = 1;
|
2475 |
-
}
|
2476 |
-
|
2477 |
-
// ----- Update the informations
|
2478 |
-
// Only some fields can be modified
|
2479 |
-
if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
|
2480 |
-
$p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
|
2481 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New stored filename is '".$p_header['stored_filename']."'");
|
2482 |
-
}
|
2483 |
-
}
|
2484 |
-
|
2485 |
-
// ----- Look for empty stored filename
|
2486 |
-
if ($p_header['stored_filename'] == "") {
|
2487 |
-
$p_header['status'] = "filtered";
|
2488 |
-
}
|
2489 |
-
|
2490 |
-
// ----- Check the path length
|
2491 |
-
if (strlen($p_header['stored_filename']) > 0xFF) {
|
2492 |
-
$p_header['status'] = 'filename_too_long';
|
2493 |
-
}
|
2494 |
-
|
2495 |
-
// ----- Look if no error, or file not skipped
|
2496 |
-
if ($p_header['status'] == 'ok') {
|
2497 |
-
|
2498 |
-
// ----- Look for a file
|
2499 |
-
if (is_file($p_filename))
|
2500 |
-
{
|
2501 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
|
2502 |
-
// ----- Open the source file
|
2503 |
-
if (($v_file = @fopen($p_filename, "rb")) == 0) {
|
2504 |
-
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
|
2505 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2506 |
-
return PclZip::errorCode();
|
2507 |
-
}
|
2508 |
-
|
2509 |
-
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
|
2510 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
|
2511 |
-
// ----- Read the file content
|
2512 |
-
$v_content_compressed = @fread($v_file, $p_header['size']);
|
2513 |
-
|
2514 |
-
// ----- Calculate the CRC
|
2515 |
-
$p_header['crc'] = @crc32($v_content_compressed);
|
2516 |
-
|
2517 |
-
// ----- Set header parameters
|
2518 |
-
$p_header['compressed_size'] = $p_header['size'];
|
2519 |
-
$p_header['compression'] = 0;
|
2520 |
-
}
|
2521 |
-
else {
|
2522 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
|
2523 |
-
// ----- Read the file content
|
2524 |
-
$v_content = @fread($v_file, $p_header['size']);
|
2525 |
-
|
2526 |
-
// ----- Calculate the CRC
|
2527 |
-
$p_header['crc'] = @crc32($v_content);
|
2528 |
-
|
2529 |
-
// ----- Compress the file
|
2530 |
-
$v_content_compressed = @gzdeflate($v_content);
|
2531 |
-
|
2532 |
-
// ----- Set header parameters
|
2533 |
-
$p_header['compressed_size'] = strlen($v_content_compressed);
|
2534 |
-
$p_header['compression'] = 8;
|
2535 |
-
}
|
2536 |
-
|
2537 |
-
// ----- Look for encryption
|
2538 |
-
/*
|
2539 |
-
if ((isset($p_options[PCLZIP_OPT_CRYPT]))
|
2540 |
-
&& ($p_options[PCLZIP_OPT_CRYPT] != "")) {
|
2541 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File need to be crypted ....");
|
2542 |
-
|
2543 |
-
// Should be a random header
|
2544 |
-
$v_header = 'xxxxxxxxxxxx';
|
2545 |
-
$v_content_compressed = PclZipUtilZipEncrypt($v_content_compressed,
|
2546 |
-
$p_header['compressed_size'],
|
2547 |
-
$v_header,
|
2548 |
-
$p_header['crc'],
|
2549 |
-
"test");
|
2550 |
-
|
2551 |
-
$p_header['compressed_size'] += 12;
|
2552 |
-
$p_header['flag'] = 1;
|
2553 |
-
|
2554 |
-
// ----- Add the header to the data
|
2555 |
-
$v_content_compressed = $v_header.$v_content_compressed;
|
2556 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size after header : ".strlen($v_content_compressed)."");
|
2557 |
-
}
|
2558 |
-
*/
|
2559 |
-
|
2560 |
-
// ----- Call the header generation
|
2561 |
-
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
2562 |
-
@fclose($v_file);
|
2563 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2564 |
-
return $v_result;
|
2565 |
-
}
|
2566 |
-
|
2567 |
-
// ----- Write the compressed (or not) content
|
2568 |
-
@fwrite($this->zip_fd,
|
2569 |
-
$v_content_compressed, $p_header['compressed_size']);
|
2570 |
-
|
2571 |
-
// ----- Close the file
|
2572 |
-
@fclose($v_file);
|
2573 |
-
}
|
2574 |
-
|
2575 |
-
// ----- Look for a directory
|
2576 |
-
else {
|
2577 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a folder");
|
2578 |
-
// ----- Look for directory last '/'
|
2579 |
-
if (@substr($p_header['stored_filename'], -1) != '/') {
|
2580 |
-
$p_header['stored_filename'] .= '/';
|
2581 |
-
}
|
2582 |
-
|
2583 |
-
// ----- Set the file properties
|
2584 |
-
$p_header['size'] = 0;
|
2585 |
-
//$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked
|
2586 |
-
$p_header['external'] = 0x00000010; // Value for a folder : to be checked
|
2587 |
-
|
2588 |
-
// ----- Call the header generation
|
2589 |
-
if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
|
2590 |
-
{
|
2591 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2592 |
-
return $v_result;
|
2593 |
-
}
|
2594 |
-
}
|
2595 |
-
}
|
2596 |
-
|
2597 |
-
// ----- Look for post-add callback
|
2598 |
-
if (isset($p_options[PCLZIP_CB_POST_ADD])) {
|
2599 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_ADD]."()') is defined for the extraction");
|
2600 |
-
|
2601 |
-
// ----- Generate a local information
|
2602 |
-
$v_local_header = array();
|
2603 |
-
$this->privConvertHeader2FileInfo($p_header, $v_local_header);
|
2604 |
-
|
2605 |
-
// ----- Call the callback
|
2606 |
-
// Here I do not use call_user_func() because I need to send a reference to the
|
2607 |
-
// header.
|
2608 |
-
eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');
|
2609 |
-
if ($v_result == 0) {
|
2610 |
-
// ----- Ignored
|
2611 |
-
$v_result = 1;
|
2612 |
-
}
|
2613 |
-
|
2614 |
-
// ----- Update the informations
|
2615 |
-
// Nothing can be modified
|
2616 |
-
}
|
2617 |
-
|
2618 |
-
// ----- Return
|
2619 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2620 |
-
return $v_result;
|
2621 |
-
}
|
2622 |
-
// --------------------------------------------------------------------------------
|
2623 |
-
|
2624 |
-
// --------------------------------------------------------------------------------
|
2625 |
-
// Function : privCalculateStoredFilename()
|
2626 |
-
// Description :
|
2627 |
-
// Based on file descriptor properties and global options, this method
|
2628 |
-
// calculate the filename that will be stored in the archive.
|
2629 |
-
// Parameters :
|
2630 |
-
// Return Values :
|
2631 |
-
// --------------------------------------------------------------------------------
|
2632 |
-
function privCalculateStoredFilename(&$p_filedescr, &$p_options)
|
2633 |
-
{
|
2634 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
|
2635 |
-
$v_result=1;
|
2636 |
-
|
2637 |
-
// ----- Working variables
|
2638 |
-
$p_filename = $p_filedescr['filename'];
|
2639 |
-
if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
|
2640 |
-
$p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
|
2641 |
-
}
|
2642 |
-
else {
|
2643 |
-
$p_add_dir = '';
|
2644 |
-
}
|
2645 |
-
if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
|
2646 |
-
$p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
|
2647 |
-
}
|
2648 |
-
else {
|
2649 |
-
$p_remove_dir = '';
|
2650 |
-
}
|
2651 |
-
if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
|
2652 |
-
$p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
|
2653 |
-
}
|
2654 |
-
else {
|
2655 |
-
$p_remove_all_dir = 0;
|
2656 |
-
}
|
2657 |
-
|
2658 |
-
// ----- Look for full name change
|
2659 |
-
if (isset($p_filedescr['new_full_name'])) {
|
2660 |
-
$v_stored_filename = $p_filedescr['new_full_name'];
|
2661 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
|
2662 |
-
}
|
2663 |
-
|
2664 |
-
// ----- Look for path and/or short name change
|
2665 |
-
else {
|
2666 |
-
|
2667 |
-
// ----- Look for short name change
|
2668 |
-
if (isset($p_filedescr['new_short_name'])) {
|
2669 |
-
$v_path_info = pathinfo($p_filename);
|
2670 |
-
$v_dir = '';
|
2671 |
-
if ($v_path_info['dirname'] != '') {
|
2672 |
-
$v_dir = $v_path_info['dirname'].'/';
|
2673 |
-
}
|
2674 |
-
$v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
|
2675 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing short name of '".$p_filename."' for '".$v_stored_filename."'");
|
2676 |
-
}
|
2677 |
-
else {
|
2678 |
-
// ----- Calculate the stored filename
|
2679 |
-
$v_stored_filename = $p_filename;
|
2680 |
-
}
|
2681 |
-
|
2682 |
-
// ----- Look for all path to remove
|
2683 |
-
if ($p_remove_all_dir) {
|
2684 |
-
$v_stored_filename = basename($p_filename);
|
2685 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove all path selected change '".$p_filename."' for '".$v_stored_filename."'");
|
2686 |
-
}
|
2687 |
-
// ----- Look for partial path remove
|
2688 |
-
else if ($p_remove_dir != "") {
|
2689 |
-
if (substr($p_remove_dir, -1) != '/')
|
2690 |
-
$p_remove_dir .= "/";
|
2691 |
-
|
2692 |
-
if ( (substr($p_filename, 0, 2) == "./")
|
2693 |
-
|| (substr($p_remove_dir, 0, 2) == "./")) {
|
2694 |
-
|
2695 |
-
if ( (substr($p_filename, 0, 2) == "./")
|
2696 |
-
&& (substr($p_remove_dir, 0, 2) != "./")) {
|
2697 |
-
$p_remove_dir = "./".$p_remove_dir;
|
2698 |
-
}
|
2699 |
-
if ( (substr($p_filename, 0, 2) != "./")
|
2700 |
-
&& (substr($p_remove_dir, 0, 2) == "./")) {
|
2701 |
-
$p_remove_dir = substr($p_remove_dir, 2);
|
2702 |
-
}
|
2703 |
-
}
|
2704 |
-
|
2705 |
-
$v_compare = PclZipUtilPathInclusion($p_remove_dir,
|
2706 |
-
$v_stored_filename);
|
2707 |
-
if ($v_compare > 0) {
|
2708 |
-
if ($v_compare == 2) {
|
2709 |
-
$v_stored_filename = "";
|
2710 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder");
|
2711 |
-
}
|
2712 |
-
else {
|
2713 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$p_remove_dir' in file '$v_stored_filename'");
|
2714 |
-
$v_stored_filename = substr($v_stored_filename,
|
2715 |
-
strlen($p_remove_dir));
|
2716 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Result is '$v_stored_filename'");
|
2717 |
-
}
|
2718 |
-
}
|
2719 |
-
}
|
2720 |
-
// ----- Look for path to add
|
2721 |
-
if ($p_add_dir != "") {
|
2722 |
-
if (substr($p_add_dir, -1) == "/")
|
2723 |
-
$v_stored_filename = $p_add_dir.$v_stored_filename;
|
2724 |
-
else
|
2725 |
-
$v_stored_filename = $p_add_dir."/".$v_stored_filename;
|
2726 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'");
|
2727 |
-
}
|
2728 |
-
}
|
2729 |
-
|
2730 |
-
// ----- Filename (reduce the path of stored name)
|
2731 |
-
$v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
|
2732 |
-
$p_filedescr['stored_filename'] = $v_stored_filename;
|
2733 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
|
2734 |
-
|
2735 |
-
// ----- Return
|
2736 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2737 |
-
return $v_result;
|
2738 |
-
}
|
2739 |
-
// --------------------------------------------------------------------------------
|
2740 |
-
|
2741 |
-
// --------------------------------------------------------------------------------
|
2742 |
-
// Function : privWriteFileHeader()
|
2743 |
-
// Description :
|
2744 |
-
// Parameters :
|
2745 |
-
// Return Values :
|
2746 |
-
// --------------------------------------------------------------------------------
|
2747 |
-
function privWriteFileHeader(&$p_header)
|
2748 |
-
{
|
2749 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
|
2750 |
-
$v_result=1;
|
2751 |
-
|
2752 |
-
// ----- Store the offset position of the file
|
2753 |
-
$p_header['offset'] = ftell($this->zip_fd);
|
2754 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File offset of the header :'.$p_header['offset']);
|
2755 |
-
|
2756 |
-
// ----- Transform UNIX mtime to DOS format mdate/mtime
|
2757 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
2758 |
-
$v_date = getdate($p_header['mtime']);
|
2759 |
-
$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
|
2760 |
-
$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
|
2761 |
-
|
2762 |
-
// ----- Packed data
|
2763 |
-
$v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
|
2764 |
-
$p_header['version_extracted'], $p_header['flag'],
|
2765 |
-
$p_header['compression'], $v_mtime, $v_mdate,
|
2766 |
-
$p_header['crc'], $p_header['compressed_size'],
|
2767 |
-
$p_header['size'],
|
2768 |
-
strlen($p_header['stored_filename']),
|
2769 |
-
$p_header['extra_len']);
|
2770 |
-
|
2771 |
-
// ----- Write the first 148 bytes of the header in the archive
|
2772 |
-
fputs($this->zip_fd, $v_binary_data, 30);
|
2773 |
-
|
2774 |
-
// ----- Write the variable fields
|
2775 |
-
if (strlen($p_header['stored_filename']) != 0)
|
2776 |
-
{
|
2777 |
-
fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
|
2778 |
-
}
|
2779 |
-
if ($p_header['extra_len'] != 0)
|
2780 |
-
{
|
2781 |
-
fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
|
2782 |
-
}
|
2783 |
-
|
2784 |
-
// ----- Return
|
2785 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2786 |
-
return $v_result;
|
2787 |
-
}
|
2788 |
-
// --------------------------------------------------------------------------------
|
2789 |
-
|
2790 |
-
// --------------------------------------------------------------------------------
|
2791 |
-
// Function : privWriteCentralFileHeader()
|
2792 |
-
// Description :
|
2793 |
-
// Parameters :
|
2794 |
-
// Return Values :
|
2795 |
-
// --------------------------------------------------------------------------------
|
2796 |
-
function privWriteCentralFileHeader(&$p_header)
|
2797 |
-
{
|
2798 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
|
2799 |
-
$v_result=1;
|
2800 |
-
|
2801 |
-
// TBC
|
2802 |
-
//for(reset($p_header); $key = key($p_header); next($p_header)) {
|
2803 |
-
// //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$p_header[$key]);
|
2804 |
-
//}
|
2805 |
-
|
2806 |
-
// ----- Transform UNIX mtime to DOS format mdate/mtime
|
2807 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
2808 |
-
$v_date = getdate($p_header['mtime']);
|
2809 |
-
$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
|
2810 |
-
$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
|
2811 |
-
|
2812 |
-
// ----- Packed data
|
2813 |
-
$v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
|
2814 |
-
$p_header['version'], $p_header['version_extracted'],
|
2815 |
-
$p_header['flag'], $p_header['compression'],
|
2816 |
-
$v_mtime, $v_mdate, $p_header['crc'],
|
2817 |
-
$p_header['compressed_size'], $p_header['size'],
|
2818 |
-
strlen($p_header['stored_filename']),
|
2819 |
-
$p_header['extra_len'], $p_header['comment_len'],
|
2820 |
-
$p_header['disk'], $p_header['internal'],
|
2821 |
-
$p_header['external'], $p_header['offset']);
|
2822 |
-
|
2823 |
-
// ----- Write the 42 bytes of the header in the zip file
|
2824 |
-
fputs($this->zip_fd, $v_binary_data, 46);
|
2825 |
-
|
2826 |
-
// ----- Write the variable fields
|
2827 |
-
if (strlen($p_header['stored_filename']) != 0)
|
2828 |
-
{
|
2829 |
-
fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
|
2830 |
-
}
|
2831 |
-
if ($p_header['extra_len'] != 0)
|
2832 |
-
{
|
2833 |
-
fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
|
2834 |
-
}
|
2835 |
-
if ($p_header['comment_len'] != 0)
|
2836 |
-
{
|
2837 |
-
fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);
|
2838 |
-
}
|
2839 |
-
|
2840 |
-
// ----- Return
|
2841 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2842 |
-
return $v_result;
|
2843 |
-
}
|
2844 |
-
// --------------------------------------------------------------------------------
|
2845 |
-
|
2846 |
-
// --------------------------------------------------------------------------------
|
2847 |
-
// Function : privWriteCentralHeader()
|
2848 |
-
// Description :
|
2849 |
-
// Parameters :
|
2850 |
-
// Return Values :
|
2851 |
-
// --------------------------------------------------------------------------------
|
2852 |
-
function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
|
2853 |
-
{
|
2854 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralHeader", 'nb_entries='.$p_nb_entries.', size='.$p_size.', offset='.$p_offset.', comment="'.$p_comment.'"');
|
2855 |
-
$v_result=1;
|
2856 |
-
|
2857 |
-
// ----- Packed data
|
2858 |
-
$v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
|
2859 |
-
$p_nb_entries, $p_size,
|
2860 |
-
$p_offset, strlen($p_comment));
|
2861 |
-
|
2862 |
-
// ----- Write the 22 bytes of the header in the zip file
|
2863 |
-
fputs($this->zip_fd, $v_binary_data, 22);
|
2864 |
-
|
2865 |
-
// ----- Write the variable fields
|
2866 |
-
if (strlen($p_comment) != 0)
|
2867 |
-
{
|
2868 |
-
fputs($this->zip_fd, $p_comment, strlen($p_comment));
|
2869 |
-
}
|
2870 |
-
|
2871 |
-
// ----- Return
|
2872 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2873 |
-
return $v_result;
|
2874 |
-
}
|
2875 |
-
// --------------------------------------------------------------------------------
|
2876 |
-
|
2877 |
-
// --------------------------------------------------------------------------------
|
2878 |
-
// Function : privList()
|
2879 |
-
// Description :
|
2880 |
-
// Parameters :
|
2881 |
-
// Return Values :
|
2882 |
-
// --------------------------------------------------------------------------------
|
2883 |
-
function privList(&$p_list)
|
2884 |
-
{
|
2885 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privList", "list");
|
2886 |
-
$v_result=1;
|
2887 |
-
|
2888 |
-
// ----- Magic quotes trick
|
2889 |
-
$this->privDisableMagicQuotes();
|
2890 |
-
|
2891 |
-
// ----- Open the zip file
|
2892 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
2893 |
-
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
|
2894 |
-
{
|
2895 |
-
// ----- Magic quotes trick
|
2896 |
-
$this->privSwapBackMagicQuotes();
|
2897 |
-
|
2898 |
-
// ----- Error log
|
2899 |
-
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
2900 |
-
|
2901 |
-
// ----- Return
|
2902 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2903 |
-
return PclZip::errorCode();
|
2904 |
-
}
|
2905 |
-
|
2906 |
-
// ----- Read the central directory informations
|
2907 |
-
$v_central_dir = array();
|
2908 |
-
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
2909 |
-
{
|
2910 |
-
$this->privSwapBackMagicQuotes();
|
2911 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2912 |
-
return $v_result;
|
2913 |
-
}
|
2914 |
-
|
2915 |
-
// ----- Go to beginning of Central Dir
|
2916 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset : ".$v_central_dir['offset']."'");
|
2917 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
|
2918 |
-
@rewind($this->zip_fd);
|
2919 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
|
2920 |
-
if (@fseek($this->zip_fd, $v_central_dir['offset']))
|
2921 |
-
{
|
2922 |
-
$this->privSwapBackMagicQuotes();
|
2923 |
-
|
2924 |
-
// ----- Error log
|
2925 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
2926 |
-
|
2927 |
-
// ----- Return
|
2928 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2929 |
-
return PclZip::errorCode();
|
2930 |
-
}
|
2931 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
|
2932 |
-
|
2933 |
-
// ----- Read each entry
|
2934 |
-
for ($i=0; $i<$v_central_dir['entries']; $i++)
|
2935 |
-
{
|
2936 |
-
// ----- Read the file header
|
2937 |
-
if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
|
2938 |
-
{
|
2939 |
-
$this->privSwapBackMagicQuotes();
|
2940 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2941 |
-
return $v_result;
|
2942 |
-
}
|
2943 |
-
$v_header['index'] = $i;
|
2944 |
-
|
2945 |
-
// ----- Get the only interesting attributes
|
2946 |
-
$this->privConvertHeader2FileInfo($v_header, $p_list[$i]);
|
2947 |
-
unset($v_header);
|
2948 |
-
}
|
2949 |
-
|
2950 |
-
// ----- Close the zip file
|
2951 |
-
$this->privCloseFd();
|
2952 |
-
|
2953 |
-
// ----- Magic quotes trick
|
2954 |
-
$this->privSwapBackMagicQuotes();
|
2955 |
-
|
2956 |
-
// ----- Return
|
2957 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2958 |
-
return $v_result;
|
2959 |
-
}
|
2960 |
-
// --------------------------------------------------------------------------------
|
2961 |
-
|
2962 |
-
// --------------------------------------------------------------------------------
|
2963 |
-
// Function : privConvertHeader2FileInfo()
|
2964 |
-
// Description :
|
2965 |
-
// This function takes the file informations from the central directory
|
2966 |
-
// entries and extract the interesting parameters that will be given back.
|
2967 |
-
// The resulting file infos are set in the array $p_info
|
2968 |
-
// $p_info['filename'] : Filename with full path. Given by user (add),
|
2969 |
-
// extracted in the filesystem (extract).
|
2970 |
-
// $p_info['stored_filename'] : Stored filename in the archive.
|
2971 |
-
// $p_info['size'] = Size of the file.
|
2972 |
-
// $p_info['compressed_size'] = Compressed size of the file.
|
2973 |
-
// $p_info['mtime'] = Last modification date of the file.
|
2974 |
-
// $p_info['comment'] = Comment associated with the file.
|
2975 |
-
// $p_info['folder'] = true/false : indicates if the entry is a folder or not.
|
2976 |
-
// $p_info['status'] = status of the action on the file.
|
2977 |
-
// Parameters :
|
2978 |
-
// Return Values :
|
2979 |
-
// --------------------------------------------------------------------------------
|
2980 |
-
function privConvertHeader2FileInfo($p_header, &$p_info)
|
2981 |
-
{
|
2982 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privConvertHeader2FileInfo", "Filename='".$p_header['filename']."'");
|
2983 |
-
$v_result=1;
|
2984 |
-
|
2985 |
-
// ----- Get the interesting attributes
|
2986 |
-
$p_info['filename'] = $p_header['filename'];
|
2987 |
-
$p_info['stored_filename'] = $p_header['stored_filename'];
|
2988 |
-
$p_info['size'] = $p_header['size'];
|
2989 |
-
$p_info['compressed_size'] = $p_header['compressed_size'];
|
2990 |
-
$p_info['mtime'] = $p_header['mtime'];
|
2991 |
-
$p_info['comment'] = $p_header['comment'];
|
2992 |
-
$p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
|
2993 |
-
$p_info['index'] = $p_header['index'];
|
2994 |
-
$p_info['status'] = $p_header['status'];
|
2995 |
-
|
2996 |
-
// ----- Return
|
2997 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2998 |
-
return $v_result;
|
2999 |
-
}
|
3000 |
-
// --------------------------------------------------------------------------------
|
3001 |
-
|
3002 |
-
// --------------------------------------------------------------------------------
|
3003 |
-
// Function : privExtractByRule()
|
3004 |
-
// Description :
|
3005 |
-
// Extract a file or directory depending of rules (by index, by name, ...)
|
3006 |
-
// Parameters :
|
3007 |
-
// $p_file_list : An array where will be placed the properties of each
|
3008 |
-
// extracted file
|
3009 |
-
// $p_path : Path to add while writing the extracted files
|
3010 |
-
// $p_remove_path : Path to remove (from the file memorized path) while writing the
|
3011 |
-
// extracted files. If the path does not match the file path,
|
3012 |
-
// the file is extracted with its memorized path.
|
3013 |
-
// $p_remove_path does not apply to 'list' mode.
|
3014 |
-
// $p_path and $p_remove_path are commulative.
|
3015 |
-
// Return Values :
|
3016 |
-
// 1 on success,0 or less on error (see error code list)
|
3017 |
-
// --------------------------------------------------------------------------------
|
3018 |
-
function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
|
3019 |
-
{
|
3020 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privExtractByRule", "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
|
3021 |
-
$v_result=1;
|
3022 |
-
|
3023 |
-
// ----- Magic quotes trick
|
3024 |
-
$this->privDisableMagicQuotes();
|
3025 |
-
|
3026 |
-
// ----- Check the path
|
3027 |
-
if ( ($p_path == "")
|
3028 |
-
|| ( (substr($p_path, 0, 1) != "/")
|
3029 |
-
&& (substr($p_path, 0, 3) != "../")
|
3030 |
-
&& (substr($p_path,1,2)!=":/")))
|
3031 |
-
$p_path = "./".$p_path;
|
3032 |
-
|
3033 |
-
// ----- Reduce the path last (and duplicated) '/'
|
3034 |
-
if (($p_path != "./") && ($p_path != "/"))
|
3035 |
-
{
|
3036 |
-
// ----- Look for the path end '/'
|
3037 |
-
while (substr($p_path, -1) == "/")
|
3038 |
-
{
|
3039 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Destination path [$p_path] ends by '/'");
|
3040 |
-
$p_path = substr($p_path, 0, strlen($p_path)-1);
|
3041 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Modified to [$p_path]");
|
3042 |
-
}
|
3043 |
-
}
|
3044 |
-
|
3045 |
-
// ----- Look for path to remove format (should end by /)
|
3046 |
-
if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
|
3047 |
-
{
|
3048 |
-
$p_remove_path .= '/';
|
3049 |
-
}
|
3050 |
-
$p_remove_path_size = strlen($p_remove_path);
|
3051 |
-
|
3052 |
-
// ----- Open the zip file
|
3053 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
3054 |
-
if (($v_result = $this->privOpenFd('rb')) != 1)
|
3055 |
-
{
|
3056 |
-
$this->privSwapBackMagicQuotes();
|
3057 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3058 |
-
return $v_result;
|
3059 |
-
}
|
3060 |
-
|
3061 |
-
// ----- Read the central directory informations
|
3062 |
-
$v_central_dir = array();
|
3063 |
-
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
3064 |
-
{
|
3065 |
-
// ----- Close the zip file
|
3066 |
-
$this->privCloseFd();
|
3067 |
-
$this->privSwapBackMagicQuotes();
|
3068 |
-
|
3069 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3070 |
-
return $v_result;
|
3071 |
-
}
|
3072 |
-
|
3073 |
-
// ----- Start at beginning of Central Dir
|
3074 |
-
$v_pos_entry = $v_central_dir['offset'];
|
3075 |
-
|
3076 |
-
// ----- Read each entry
|
3077 |
-
$j_start = 0;
|
3078 |
-
for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
|
3079 |
-
{
|
3080 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry : '$i'");
|
3081 |
-
|
3082 |
-
// ----- Read next Central dir entry
|
3083 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position before rewind : ".ftell($this->zip_fd)."'");
|
3084 |
-
@rewind($this->zip_fd);
|
3085 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position after rewind : ".ftell($this->zip_fd)."'");
|
3086 |
-
if (@fseek($this->zip_fd, $v_pos_entry))
|
3087 |
-
{
|
3088 |
-
// ----- Close the zip file
|
3089 |
-
$this->privCloseFd();
|
3090 |
-
$this->privSwapBackMagicQuotes();
|
3091 |
-
|
3092 |
-
// ----- Error log
|
3093 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3094 |
-
|
3095 |
-
// ----- Return
|
3096 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3097 |
-
return PclZip::errorCode();
|
3098 |
-
}
|
3099 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position after fseek : ".ftell($this->zip_fd)."'");
|
3100 |
-
|
3101 |
-
// ----- Read the file header
|
3102 |
-
$v_header = array();
|
3103 |
-
if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
|
3104 |
-
{
|
3105 |
-
// ----- Close the zip file
|
3106 |
-
$this->privCloseFd();
|
3107 |
-
$this->privSwapBackMagicQuotes();
|
3108 |
-
|
3109 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3110 |
-
return $v_result;
|
3111 |
-
}
|
3112 |
-
|
3113 |
-
// ----- Store the index
|
3114 |
-
$v_header['index'] = $i;
|
3115 |
-
|
3116 |
-
// ----- Store the file position
|
3117 |
-
$v_pos_entry = ftell($this->zip_fd);
|
3118 |
-
|
3119 |
-
// ----- Look for the specific extract rules
|
3120 |
-
$v_extract = false;
|
3121 |
-
|
3122 |
-
// ----- Look for extract by name rule
|
3123 |
-
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
|
3124 |
-
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
|
3125 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
|
3126 |
-
|
3127 |
-
// ----- Look if the filename is in the list
|
3128 |
-
for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
|
3129 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
|
3130 |
-
|
3131 |
-
// ----- Look for a directory
|
3132 |
-
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
|
3133 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
|
3134 |
-
|
3135 |
-
// ----- Look if the directory is in the filename path
|
3136 |
-
if ( (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
3137 |
-
&& (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
3138 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
|
3139 |
-
$v_extract = true;
|
3140 |
-
}
|
3141 |
-
}
|
3142 |
-
// ----- Look for a filename
|
3143 |
-
elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
|
3144 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
|
3145 |
-
$v_extract = true;
|
3146 |
-
}
|
3147 |
-
}
|
3148 |
-
}
|
3149 |
-
|
3150 |
-
// ----- Look for extract by ereg rule
|
3151 |
-
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
3152 |
-
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
|
3153 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
|
3154 |
-
|
3155 |
-
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
|
3156 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
3157 |
-
$v_extract = true;
|
3158 |
-
}
|
3159 |
-
}
|
3160 |
-
|
3161 |
-
// ----- Look for extract by preg rule
|
3162 |
-
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
|
3163 |
-
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
|
3164 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
|
3165 |
-
|
3166 |
-
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
|
3167 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
3168 |
-
$v_extract = true;
|
3169 |
-
}
|
3170 |
-
}
|
3171 |
-
|
3172 |
-
// ----- Look for extract by index rule
|
3173 |
-
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
3174 |
-
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
3175 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
|
3176 |
-
|
3177 |
-
// ----- Look if the index is in the list
|
3178 |
-
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
|
3179 |
-
//--(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']."]");
|
3180 |
-
|
3181 |
-
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
|
3182 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
|
3183 |
-
$v_extract = true;
|
3184 |
-
}
|
3185 |
-
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
|
3186 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
|
3187 |
-
$j_start = $j+1;
|
3188 |
-
}
|
3189 |
-
|
3190 |
-
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
|
3191 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
|
3192 |
-
break;
|
3193 |
-
}
|
3194 |
-
}
|
3195 |
-
}
|
3196 |
-
|
3197 |
-
// ----- Look for no rule, which means extract all the archive
|
3198 |
-
else {
|
3199 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with no rule (extract all)");
|
3200 |
-
$v_extract = true;
|
3201 |
-
}
|
3202 |
-
|
3203 |
-
// ----- Check compression method
|
3204 |
-
if ( ($v_extract)
|
3205 |
-
&& ( ($v_header['compression'] != 8)
|
3206 |
-
&& ($v_header['compression'] != 0))) {
|
3207 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported compression method (".$v_header['compression'].")");
|
3208 |
-
$v_header['status'] = 'unsupported_compression';
|
3209 |
-
|
3210 |
-
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3211 |
-
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3212 |
-
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3213 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3214 |
-
|
3215 |
-
$this->privSwapBackMagicQuotes();
|
3216 |
-
|
3217 |
-
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
|
3218 |
-
"Filename '".$v_header['stored_filename']."' is "
|
3219 |
-
."compressed by an unsupported compression "
|
3220 |
-
."method (".$v_header['compression'].") ");
|
3221 |
-
|
3222 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3223 |
-
return PclZip::errorCode();
|
3224 |
-
}
|
3225 |
-
}
|
3226 |
-
|
3227 |
-
// ----- Check encrypted files
|
3228 |
-
if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
|
3229 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
|
3230 |
-
$v_header['status'] = 'unsupported_encryption';
|
3231 |
-
|
3232 |
-
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3233 |
-
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3234 |
-
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3235 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3236 |
-
|
3237 |
-
$this->privSwapBackMagicQuotes();
|
3238 |
-
|
3239 |
-
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
|
3240 |
-
"Unsupported encryption for "
|
3241 |
-
." filename '".$v_header['stored_filename']
|
3242 |
-
."'");
|
3243 |
-
|
3244 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3245 |
-
return PclZip::errorCode();
|
3246 |
-
}
|
3247 |
-
}
|
3248 |
-
|
3249 |
-
// ----- Look for real extraction
|
3250 |
-
if (($v_extract) && ($v_header['status'] != 'ok')) {
|
3251 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "No need for extract");
|
3252 |
-
$v_result = $this->privConvertHeader2FileInfo($v_header,
|
3253 |
-
$p_file_list[$v_nb_extracted++]);
|
3254 |
-
if ($v_result != 1) {
|
3255 |
-
$this->privCloseFd();
|
3256 |
-
$this->privSwapBackMagicQuotes();
|
3257 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3258 |
-
return $v_result;
|
3259 |
-
}
|
3260 |
-
|
3261 |
-
$v_extract = false;
|
3262 |
-
}
|
3263 |
-
|
3264 |
-
// ----- Look for real extraction
|
3265 |
-
if ($v_extract)
|
3266 |
-
{
|
3267 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file '".$v_header['filename']."', index '$i'");
|
3268 |
-
|
3269 |
-
// ----- Go to the file position
|
3270 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
|
3271 |
-
@rewind($this->zip_fd);
|
3272 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
|
3273 |
-
if (@fseek($this->zip_fd, $v_header['offset']))
|
3274 |
-
{
|
3275 |
-
// ----- Close the zip file
|
3276 |
-
$this->privCloseFd();
|
3277 |
-
|
3278 |
-
$this->privSwapBackMagicQuotes();
|
3279 |
-
|
3280 |
-
// ----- Error log
|
3281 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3282 |
-
|
3283 |
-
// ----- Return
|
3284 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3285 |
-
return PclZip::errorCode();
|
3286 |
-
}
|
3287 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
|
3288 |
-
|
3289 |
-
// ----- Look for extraction as string
|
3290 |
-
if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
|
3291 |
-
|
3292 |
-
// ----- Extracting the file
|
3293 |
-
$v_result1 = $this->privExtractFileAsString($v_header, $v_string);
|
3294 |
-
if ($v_result1 < 1) {
|
3295 |
-
$this->privCloseFd();
|
3296 |
-
$this->privSwapBackMagicQuotes();
|
3297 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
|
3298 |
-
return $v_result1;
|
3299 |
-
}
|
3300 |
-
|
3301 |
-
// ----- Get the only interesting attributes
|
3302 |
-
if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1)
|
3303 |
-
{
|
3304 |
-
// ----- Close the zip file
|
3305 |
-
$this->privCloseFd();
|
3306 |
-
$this->privSwapBackMagicQuotes();
|
3307 |
-
|
3308 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3309 |
-
return $v_result;
|
3310 |
-
}
|
3311 |
-
|
3312 |
-
// ----- Set the file content
|
3313 |
-
$p_file_list[$v_nb_extracted]['content'] = $v_string;
|
3314 |
-
|
3315 |
-
// ----- Next extracted file
|
3316 |
-
$v_nb_extracted++;
|
3317 |
-
|
3318 |
-
// ----- Look for user callback abort
|
3319 |
-
if ($v_result1 == 2) {
|
3320 |
-
break;
|
3321 |
-
}
|
3322 |
-
}
|
3323 |
-
// ----- Look for extraction in standard output
|
3324 |
-
elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
|
3325 |
-
&& ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
|
3326 |
-
// ----- Extracting the file in standard output
|
3327 |
-
$v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
|
3328 |
-
if ($v_result1 < 1) {
|
3329 |
-
$this->privCloseFd();
|
3330 |
-
$this->privSwapBackMagicQuotes();
|
3331 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
|
3332 |
-
return $v_result1;
|
3333 |
-
}
|
3334 |
-
|
3335 |
-
// ----- Get the only interesting attributes
|
3336 |
-
if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
|
3337 |
-
$this->privCloseFd();
|
3338 |
-
$this->privSwapBackMagicQuotes();
|
3339 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3340 |
-
return $v_result;
|
3341 |
-
}
|
3342 |
-
|
3343 |
-
// ----- Look for user callback abort
|
3344 |
-
if ($v_result1 == 2) {
|
3345 |
-
break;
|
3346 |
-
}
|
3347 |
-
}
|
3348 |
-
// ----- Look for normal extraction
|
3349 |
-
else {
|
3350 |
-
// ----- Extracting the file
|
3351 |
-
$v_result1 = $this->privExtractFile($v_header,
|
3352 |
-
$p_path, $p_remove_path,
|
3353 |
-
$p_remove_all_path,
|
3354 |
-
$p_options);
|
3355 |
-
if ($v_result1 < 1) {
|
3356 |
-
$this->privCloseFd();
|
3357 |
-
$this->privSwapBackMagicQuotes();
|
3358 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
|
3359 |
-
return $v_result1;
|
3360 |
-
}
|
3361 |
-
|
3362 |
-
// ----- Get the only interesting attributes
|
3363 |
-
if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1)
|
3364 |
-
{
|
3365 |
-
// ----- Close the zip file
|
3366 |
-
$this->privCloseFd();
|
3367 |
-
$this->privSwapBackMagicQuotes();
|
3368 |
-
|
3369 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3370 |
-
return $v_result;
|
3371 |
-
}
|
3372 |
-
|
3373 |
-
// ----- Look for user callback abort
|
3374 |
-
if ($v_result1 == 2) {
|
3375 |
-
break;
|
3376 |
-
}
|
3377 |
-
}
|
3378 |
-
}
|
3379 |
-
}
|
3380 |
-
|
3381 |
-
// ----- Close the zip file
|
3382 |
-
$this->privCloseFd();
|
3383 |
-
$this->privSwapBackMagicQuotes();
|
3384 |
-
|
3385 |
-
// ----- Return
|
3386 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3387 |
-
return $v_result;
|
3388 |
-
}
|
3389 |
-
// --------------------------------------------------------------------------------
|
3390 |
-
|
3391 |
-
// --------------------------------------------------------------------------------
|
3392 |
-
// Function : privExtractFile()
|
3393 |
-
// Description :
|
3394 |
-
// Parameters :
|
3395 |
-
// Return Values :
|
3396 |
-
//
|
3397 |
-
// 1 : ... ?
|
3398 |
-
// PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback
|
3399 |
-
// --------------------------------------------------------------------------------
|
3400 |
-
function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
|
3401 |
-
{
|
3402 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFile', "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
|
3403 |
-
$v_result=1;
|
3404 |
-
|
3405 |
-
// ----- Read the file header
|
3406 |
-
if (($v_result = $this->privReadFileHeader($v_header)) != 1)
|
3407 |
-
{
|
3408 |
-
// ----- Return
|
3409 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3410 |
-
return $v_result;
|
3411 |
-
}
|
3412 |
-
|
3413 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
|
3414 |
-
|
3415 |
-
// ----- Check that the file header is coherent with $p_entry info
|
3416 |
-
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
3417 |
-
// TBC
|
3418 |
-
}
|
3419 |
-
|
3420 |
-
// ----- Look for all path to remove
|
3421 |
-
if ($p_remove_all_path == true) {
|
3422 |
-
// ----- Look for folder entry that not need to be extracted
|
3423 |
-
if (($p_entry['external']&0x00000010)==0x00000010) {
|
3424 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The entry is a folder : need to be filtered");
|
3425 |
-
|
3426 |
-
$p_entry['status'] = "filtered";
|
3427 |
-
|
3428 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3429 |
-
return $v_result;
|
3430 |
-
}
|
3431 |
-
|
3432 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "All path is removed");
|
3433 |
-
// ----- Get the basename of the path
|
3434 |
-
$p_entry['filename'] = basename($p_entry['filename']);
|
3435 |
-
}
|
3436 |
-
|
3437 |
-
// ----- Look for path to remove
|
3438 |
-
else if ($p_remove_path != "")
|
3439 |
-
{
|
3440 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look for some path to remove");
|
3441 |
-
if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
|
3442 |
-
{
|
3443 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The folder is the same as the removed path '".$p_entry['filename']."'");
|
3444 |
-
|
3445 |
-
// ----- Change the file status
|
3446 |
-
$p_entry['status'] = "filtered";
|
3447 |
-
|
3448 |
-
// ----- Return
|
3449 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3450 |
-
return $v_result;
|
3451 |
-
}
|
3452 |
-
|
3453 |
-
$p_remove_path_size = strlen($p_remove_path);
|
3454 |
-
if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
|
3455 |
-
{
|
3456 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '".$p_entry['filename']."'");
|
3457 |
-
|
3458 |
-
// ----- Remove the path
|
3459 |
-
$p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
|
3460 |
-
|
3461 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Resulting file is '".$p_entry['filename']."'");
|
3462 |
-
}
|
3463 |
-
}
|
3464 |
-
|
3465 |
-
// ----- Add the path
|
3466 |
-
if ($p_path != '') {
|
3467 |
-
$p_entry['filename'] = $p_path."/".$p_entry['filename'];
|
3468 |
-
}
|
3469 |
-
|
3470 |
-
// ----- Check a base_dir_restriction
|
3471 |
-
if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
|
3472 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
|
3473 |
-
$v_inclusion
|
3474 |
-
= PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
|
3475 |
-
$p_entry['filename']);
|
3476 |
-
if ($v_inclusion == 0) {
|
3477 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
|
3478 |
-
|
3479 |
-
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
|
3480 |
-
"Filename '".$p_entry['filename']."' is "
|
3481 |
-
."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
|
3482 |
-
|
3483 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3484 |
-
return PclZip::errorCode();
|
3485 |
-
}
|
3486 |
-
}
|
3487 |
-
|
3488 |
-
// ----- Look for pre-extract callback
|
3489 |
-
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
|
3490 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
|
3491 |
-
|
3492 |
-
// ----- Generate a local information
|
3493 |
-
$v_local_header = array();
|
3494 |
-
$this->privConvertHeader2FileInfo($p_entry, $v_local_header);
|
3495 |
-
|
3496 |
-
// ----- Call the callback
|
3497 |
-
// Here I do not use call_user_func() because I need to send a reference to the
|
3498 |
-
// header.
|
3499 |
-
eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
|
3500 |
-
if ($v_result == 0) {
|
3501 |
-
// ----- Change the file status
|
3502 |
-
$p_entry['status'] = "skipped";
|
3503 |
-
$v_result = 1;
|
3504 |
-
}
|
3505 |
-
|
3506 |
-
// ----- Look for abort result
|
3507 |
-
if ($v_result == 2) {
|
3508 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
3509 |
-
// ----- This status is internal and will be changed in 'skipped'
|
3510 |
-
$p_entry['status'] = "aborted";
|
3511 |
-
$v_result = PCLZIP_ERR_USER_ABORTED;
|
3512 |
-
}
|
3513 |
-
|
3514 |
-
// ----- Update the informations
|
3515 |
-
// Only some fields can be modified
|
3516 |
-
$p_entry['filename'] = $v_local_header['filename'];
|
3517 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
|
3518 |
-
}
|
3519 |
-
|
3520 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
|
3521 |
-
|
3522 |
-
// ----- Look if extraction should be done
|
3523 |
-
if ($p_entry['status'] == 'ok') {
|
3524 |
-
|
3525 |
-
// ----- Look for specific actions while the file exist
|
3526 |
-
if (file_exists($p_entry['filename']))
|
3527 |
-
{
|
3528 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_entry['filename']."' already exists");
|
3529 |
-
|
3530 |
-
// ----- Look if file is a directory
|
3531 |
-
if (is_dir($p_entry['filename']))
|
3532 |
-
{
|
3533 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is a directory");
|
3534 |
-
|
3535 |
-
// ----- Change the file status
|
3536 |
-
$p_entry['status'] = "already_a_directory";
|
3537 |
-
|
3538 |
-
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3539 |
-
// For historical reason first PclZip implementation does not stop
|
3540 |
-
// when this kind of error occurs.
|
3541 |
-
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3542 |
-
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3543 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3544 |
-
|
3545 |
-
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
|
3546 |
-
"Filename '".$p_entry['filename']."' is "
|
3547 |
-
."already used by an existing directory");
|
3548 |
-
|
3549 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3550 |
-
return PclZip::errorCode();
|
3551 |
-
}
|
3552 |
-
}
|
3553 |
-
// ----- Look if file is write protected
|
3554 |
-
else if (!is_writeable($p_entry['filename']))
|
3555 |
-
{
|
3556 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is write protected");
|
3557 |
-
|
3558 |
-
// ----- Change the file status
|
3559 |
-
$p_entry['status'] = "write_protected";
|
3560 |
-
|
3561 |
-
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3562 |
-
// For historical reason first PclZip implementation does not stop
|
3563 |
-
// when this kind of error occurs.
|
3564 |
-
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3565 |
-
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3566 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3567 |
-
|
3568 |
-
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
3569 |
-
"Filename '".$p_entry['filename']."' exists "
|
3570 |
-
."and is write protected");
|
3571 |
-
|
3572 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3573 |
-
return PclZip::errorCode();
|
3574 |
-
}
|
3575 |
-
}
|
3576 |
-
|
3577 |
-
// ----- Look if the extracted file is older
|
3578 |
-
else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
|
3579 |
-
{
|
3580 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is newer (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
|
3581 |
-
// ----- Change the file status
|
3582 |
-
if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
|
3583 |
-
&& ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
|
3584 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_REPLACE_NEWER is selected, file will be replaced");
|
3585 |
-
}
|
3586 |
-
else {
|
3587 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");
|
3588 |
-
$p_entry['status'] = "newer_exist";
|
3589 |
-
|
3590 |
-
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3591 |
-
// For historical reason first PclZip implementation does not stop
|
3592 |
-
// when this kind of error occurs.
|
3593 |
-
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3594 |
-
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3595 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3596 |
-
|
3597 |
-
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
3598 |
-
"Newer version of '".$p_entry['filename']."' exists "
|
3599 |
-
."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
|
3600 |
-
|
3601 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3602 |
-
return PclZip::errorCode();
|
3603 |
-
}
|
3604 |
-
}
|
3605 |
-
}
|
3606 |
-
else {
|
3607 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is older than the extrated one - will be replaced by the extracted one (".date("l dS of F Y h:i:s A", filemtime($p_entry['filename'])).") than the extracted file (".date("l dS of F Y h:i:s A", $p_entry['mtime']).")");
|
3608 |
-
}
|
3609 |
-
}
|
3610 |
-
|
3611 |
-
// ----- Check the directory availability and create it if necessary
|
3612 |
-
else {
|
3613 |
-
if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
|
3614 |
-
$v_dir_to_check = $p_entry['filename'];
|
3615 |
-
else if (!strstr($p_entry['filename'], "/"))
|
3616 |
-
$v_dir_to_check = "";
|
3617 |
-
else
|
3618 |
-
$v_dir_to_check = dirname($p_entry['filename']);
|
3619 |
-
|
3620 |
-
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
|
3621 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
|
3622 |
-
|
3623 |
-
// ----- Change the file status
|
3624 |
-
$p_entry['status'] = "path_creation_fail";
|
3625 |
-
|
3626 |
-
// ----- Return
|
3627 |
-
////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3628 |
-
//return $v_result;
|
3629 |
-
$v_result = 1;
|
3630 |
-
}
|
3631 |
-
}
|
3632 |
-
}
|
3633 |
-
|
3634 |
-
// ----- Look if extraction should be done
|
3635 |
-
if ($p_entry['status'] == 'ok') {
|
3636 |
-
|
3637 |
-
// ----- Do the extraction (if not a folder)
|
3638 |
-
if (!(($p_entry['external']&0x00000010)==0x00000010))
|
3639 |
-
{
|
3640 |
-
// ----- Look for not compressed file
|
3641 |
-
if ($p_entry['compression'] == 0) {
|
3642 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
|
3643 |
-
|
3644 |
-
// ----- Opening destination file
|
3645 |
-
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
|
3646 |
-
{
|
3647 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
|
3648 |
-
|
3649 |
-
// ----- Change the file status
|
3650 |
-
$p_entry['status'] = "write_error";
|
3651 |
-
|
3652 |
-
// ----- Return
|
3653 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3654 |
-
return $v_result;
|
3655 |
-
}
|
3656 |
-
|
3657 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read '".$p_entry['size']."' bytes");
|
3658 |
-
|
3659 |
-
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
|
3660 |
-
$v_size = $p_entry['compressed_size'];
|
3661 |
-
while ($v_size != 0)
|
3662 |
-
{
|
3663 |
-
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
3664 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read $v_read_size bytes");
|
3665 |
-
$v_buffer = @fread($this->zip_fd, $v_read_size);
|
3666 |
-
/* Try to speed up the code
|
3667 |
-
$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
3668 |
-
@fwrite($v_dest_file, $v_binary_data, $v_read_size);
|
3669 |
-
*/
|
3670 |
-
@fwrite($v_dest_file, $v_buffer, $v_read_size);
|
3671 |
-
$v_size -= $v_read_size;
|
3672 |
-
}
|
3673 |
-
|
3674 |
-
// ----- Closing the destination file
|
3675 |
-
fclose($v_dest_file);
|
3676 |
-
|
3677 |
-
// ----- Change the file mtime
|
3678 |
-
touch($p_entry['filename'], $p_entry['mtime']);
|
3679 |
-
|
3680 |
-
|
3681 |
-
}
|
3682 |
-
else {
|
3683 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (Compression method ".$p_entry['compression'].")");
|
3684 |
-
// ----- TBC
|
3685 |
-
// Need to be finished
|
3686 |
-
if (($p_entry['flag'] & 1) == 1) {
|
3687 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");
|
3688 |
-
/*
|
3689 |
-
// ----- Read the encryption header
|
3690 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 12 encryption header bytes");
|
3691 |
-
$v_encryption_header = @fread($this->zip_fd, 12);
|
3692 |
-
|
3693 |
-
// ----- Read the encrypted & compressed file in a buffer
|
3694 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".($p_entry['compressed_size']-12)."' compressed & encrypted bytes");
|
3695 |
-
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']-12);
|
3696 |
-
|
3697 |
-
// ----- Decrypt the buffer
|
3698 |
-
$this->privDecrypt($v_encryption_header, $v_buffer,
|
3699 |
-
$p_entry['compressed_size']-12, $p_entry['crc']);
|
3700 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Buffer is '".$v_buffer."'");
|
3701 |
-
*/
|
3702 |
-
}
|
3703 |
-
else {
|
3704 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
|
3705 |
-
// ----- Read the compressed file in a buffer (one shot)
|
3706 |
-
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
3707 |
-
}
|
3708 |
-
|
3709 |
-
// ----- Decompress the file
|
3710 |
-
$v_file_content = @gzinflate($v_buffer);
|
3711 |
-
unset($v_buffer);
|
3712 |
-
if ($v_file_content === FALSE) {
|
3713 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
|
3714 |
-
|
3715 |
-
// ----- Change the file status
|
3716 |
-
// TBC
|
3717 |
-
$p_entry['status'] = "error";
|
3718 |
-
|
3719 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3720 |
-
return $v_result;
|
3721 |
-
}
|
3722 |
-
|
3723 |
-
// ----- Opening destination file
|
3724 |
-
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
|
3725 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
|
3726 |
-
|
3727 |
-
// ----- Change the file status
|
3728 |
-
$p_entry['status'] = "write_error";
|
3729 |
-
|
3730 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3731 |
-
return $v_result;
|
3732 |
-
}
|
3733 |
-
|
3734 |
-
// ----- Write the uncompressed data
|
3735 |
-
@fwrite($v_dest_file, $v_file_content, $p_entry['size']);
|
3736 |
-
unset($v_file_content);
|
3737 |
-
|
3738 |
-
// ----- Closing the destination file
|
3739 |
-
@fclose($v_dest_file);
|
3740 |
-
|
3741 |
-
// ----- Change the file mtime
|
3742 |
-
@touch($p_entry['filename'], $p_entry['mtime']);
|
3743 |
-
}
|
3744 |
-
|
3745 |
-
// ----- Look for chmod option
|
3746 |
-
if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
|
3747 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "chmod option activated '".$p_options[PCLZIP_OPT_SET_CHMOD]."'");
|
3748 |
-
|
3749 |
-
// ----- Change the mode of the file
|
3750 |
-
@chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
|
3751 |
-
}
|
3752 |
-
|
3753 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
|
3754 |
-
}
|
3755 |
-
}
|
3756 |
-
|
3757 |
-
// ----- Change abort status
|
3758 |
-
if ($p_entry['status'] == "aborted") {
|
3759 |
-
$p_entry['status'] = "skipped";
|
3760 |
-
}
|
3761 |
-
|
3762 |
-
// ----- Look for post-extract callback
|
3763 |
-
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
3764 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
|
3765 |
-
|
3766 |
-
// ----- Generate a local information
|
3767 |
-
$v_local_header = array();
|
3768 |
-
$this->privConvertHeader2FileInfo($p_entry, $v_local_header);
|
3769 |
-
|
3770 |
-
// ----- Call the callback
|
3771 |
-
// Here I do not use call_user_func() because I need to send a reference to the
|
3772 |
-
// header.
|
3773 |
-
eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
|
3774 |
-
|
3775 |
-
// ----- Look for abort result
|
3776 |
-
if ($v_result == 2) {
|
3777 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
3778 |
-
$v_result = PCLZIP_ERR_USER_ABORTED;
|
3779 |
-
}
|
3780 |
-
}
|
3781 |
-
|
3782 |
-
// ----- Return
|
3783 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3784 |
-
return $v_result;
|
3785 |
-
}
|
3786 |
-
// --------------------------------------------------------------------------------
|
3787 |
-
|
3788 |
-
// --------------------------------------------------------------------------------
|
3789 |
-
// Function : privExtractFileInOutput()
|
3790 |
-
// Description :
|
3791 |
-
// Parameters :
|
3792 |
-
// Return Values :
|
3793 |
-
// --------------------------------------------------------------------------------
|
3794 |
-
function privExtractFileInOutput(&$p_entry, &$p_options)
|
3795 |
-
{
|
3796 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileInOutput', "");
|
3797 |
-
$v_result=1;
|
3798 |
-
|
3799 |
-
// ----- Read the file header
|
3800 |
-
if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
|
3801 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3802 |
-
return $v_result;
|
3803 |
-
}
|
3804 |
-
|
3805 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
|
3806 |
-
|
3807 |
-
// ----- Check that the file header is coherent with $p_entry info
|
3808 |
-
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
3809 |
-
// TBC
|
3810 |
-
}
|
3811 |
-
|
3812 |
-
// ----- Look for pre-extract callback
|
3813 |
-
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
|
3814 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
|
3815 |
-
|
3816 |
-
// ----- Generate a local information
|
3817 |
-
$v_local_header = array();
|
3818 |
-
$this->privConvertHeader2FileInfo($p_entry, $v_local_header);
|
3819 |
-
|
3820 |
-
// ----- Call the callback
|
3821 |
-
// Here I do not use call_user_func() because I need to send a reference to the
|
3822 |
-
// header.
|
3823 |
-
eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
|
3824 |
-
if ($v_result == 0) {
|
3825 |
-
// ----- Change the file status
|
3826 |
-
$p_entry['status'] = "skipped";
|
3827 |
-
$v_result = 1;
|
3828 |
-
}
|
3829 |
-
|
3830 |
-
// ----- Look for abort result
|
3831 |
-
if ($v_result == 2) {
|
3832 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
3833 |
-
// ----- This status is internal and will be changed in 'skipped'
|
3834 |
-
$p_entry['status'] = "aborted";
|
3835 |
-
$v_result = PCLZIP_ERR_USER_ABORTED;
|
3836 |
-
}
|
3837 |
-
|
3838 |
-
// ----- Update the informations
|
3839 |
-
// Only some fields can be modified
|
3840 |
-
$p_entry['filename'] = $v_local_header['filename'];
|
3841 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
|
3842 |
-
}
|
3843 |
-
|
3844 |
-
// ----- Trace
|
3845 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
|
3846 |
-
|
3847 |
-
// ----- Look if extraction should be done
|
3848 |
-
if ($p_entry['status'] == 'ok') {
|
3849 |
-
|
3850 |
-
// ----- Do the extraction (if not a folder)
|
3851 |
-
if (!(($p_entry['external']&0x00000010)==0x00000010)) {
|
3852 |
-
// ----- Look for not compressed file
|
3853 |
-
if ($p_entry['compressed_size'] == $p_entry['size']) {
|
3854 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
|
3855 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
|
3856 |
-
|
3857 |
-
// ----- Read the file in a buffer (one shot)
|
3858 |
-
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
3859 |
-
|
3860 |
-
// ----- Send the file to the output
|
3861 |
-
echo $v_buffer;
|
3862 |
-
unset($v_buffer);
|
3863 |
-
}
|
3864 |
-
else {
|
3865 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file");
|
3866 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Reading '".$p_entry['size']."' bytes");
|
3867 |
-
|
3868 |
-
// ----- Read the compressed file in a buffer (one shot)
|
3869 |
-
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
3870 |
-
|
3871 |
-
// ----- Decompress the file
|
3872 |
-
$v_file_content = gzinflate($v_buffer);
|
3873 |
-
unset($v_buffer);
|
3874 |
-
|
3875 |
-
// ----- Send the file to the output
|
3876 |
-
echo $v_file_content;
|
3877 |
-
unset($v_file_content);
|
3878 |
-
}
|
3879 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
|
3880 |
-
}
|
3881 |
-
}
|
3882 |
-
|
3883 |
-
// ----- Change abort status
|
3884 |
-
if ($p_entry['status'] == "aborted") {
|
3885 |
-
$p_entry['status'] = "skipped";
|
3886 |
-
}
|
3887 |
-
|
3888 |
-
// ----- Look for post-extract callback
|
3889 |
-
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
3890 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
|
3891 |
-
|
3892 |
-
// ----- Generate a local information
|
3893 |
-
$v_local_header = array();
|
3894 |
-
$this->privConvertHeader2FileInfo($p_entry, $v_local_header);
|
3895 |
-
|
3896 |
-
// ----- Call the callback
|
3897 |
-
// Here I do not use call_user_func() because I need to send a reference to the
|
3898 |
-
// header.
|
3899 |
-
eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
|
3900 |
-
|
3901 |
-
// ----- Look for abort result
|
3902 |
-
if ($v_result == 2) {
|
3903 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
3904 |
-
$v_result = PCLZIP_ERR_USER_ABORTED;
|
3905 |
-
}
|
3906 |
-
}
|
3907 |
-
|
3908 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3909 |
-
return $v_result;
|
3910 |
-
}
|
3911 |
-
// --------------------------------------------------------------------------------
|
3912 |
-
|
3913 |
-
// --------------------------------------------------------------------------------
|
3914 |
-
// Function : privExtractFileAsString()
|
3915 |
-
// Description :
|
3916 |
-
// Parameters :
|
3917 |
-
// Return Values :
|
3918 |
-
// --------------------------------------------------------------------------------
|
3919 |
-
function privExtractFileAsString(&$p_entry, &$p_string)
|
3920 |
-
{
|
3921 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileAsString', "p_entry['filename']='".$p_entry['filename']."'");
|
3922 |
-
$v_result=1;
|
3923 |
-
|
3924 |
-
// ----- Read the file header
|
3925 |
-
$v_header = array();
|
3926 |
-
if (($v_result = $this->privReadFileHeader($v_header)) != 1)
|
3927 |
-
{
|
3928 |
-
// ----- Return
|
3929 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3930 |
-
return $v_result;
|
3931 |
-
}
|
3932 |
-
|
3933 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
|
3934 |
-
|
3935 |
-
// ----- Check that the file header is coherent with $p_entry info
|
3936 |
-
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
3937 |
-
// TBC
|
3938 |
-
}
|
3939 |
-
|
3940 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file in string (with path) '".$p_entry['filename']."', size '$v_header[size]'");
|
3941 |
-
|
3942 |
-
// ----- Do the extraction (if not a folder)
|
3943 |
-
if (!(($p_entry['external']&0x00000010)==0x00000010))
|
3944 |
-
{
|
3945 |
-
// ----- Look for not compressed file
|
3946 |
-
// if ($p_entry['compressed_size'] == $p_entry['size'])
|
3947 |
-
if ($p_entry['compression'] == 0) {
|
3948 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
|
3949 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
|
3950 |
-
|
3951 |
-
// ----- Reading the file
|
3952 |
-
$p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
|
3953 |
-
}
|
3954 |
-
else {
|
3955 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (compression method '".$p_entry['compression']."')");
|
3956 |
-
|
3957 |
-
// ----- Reading the file
|
3958 |
-
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
|
3959 |
-
|
3960 |
-
// ----- Decompress the file
|
3961 |
-
if (($p_string = @gzinflate($v_data)) === FALSE) {
|
3962 |
-
// TBC
|
3963 |
-
}
|
3964 |
-
}
|
3965 |
-
|
3966 |
-
// ----- Trace
|
3967 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
|
3968 |
-
}
|
3969 |
-
else {
|
3970 |
-
// TBC : error : can not extract a folder in a string
|
3971 |
-
}
|
3972 |
-
|
3973 |
-
// ----- Return
|
3974 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3975 |
-
return $v_result;
|
3976 |
-
}
|
3977 |
-
// --------------------------------------------------------------------------------
|
3978 |
-
|
3979 |
-
// --------------------------------------------------------------------------------
|
3980 |
-
// Function : privReadFileHeader()
|
3981 |
-
// Description :
|
3982 |
-
// Parameters :
|
3983 |
-
// Return Values :
|
3984 |
-
// --------------------------------------------------------------------------------
|
3985 |
-
function privReadFileHeader(&$p_header)
|
3986 |
-
{
|
3987 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadFileHeader", "");
|
3988 |
-
$v_result=1;
|
3989 |
-
|
3990 |
-
// ----- Read the 4 bytes signature
|
3991 |
-
$v_binary_data = @fread($this->zip_fd, 4);
|
3992 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
|
3993 |
-
$v_data = unpack('Vid', $v_binary_data);
|
3994 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
|
3995 |
-
|
3996 |
-
// ----- Check signature
|
3997 |
-
if ($v_data['id'] != 0x04034b50)
|
3998 |
-
{
|
3999 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid File header");
|
4000 |
-
|
4001 |
-
// ----- Error log
|
4002 |
-
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
|
4003 |
-
|
4004 |
-
// ----- Return
|
4005 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4006 |
-
return PclZip::errorCode();
|
4007 |
-
}
|
4008 |
-
|
4009 |
-
// ----- Read the first 42 bytes of the header
|
4010 |
-
$v_binary_data = fread($this->zip_fd, 26);
|
4011 |
-
|
4012 |
-
// ----- Look for invalid block size
|
4013 |
-
if (strlen($v_binary_data) != 26)
|
4014 |
-
{
|
4015 |
-
$p_header['filename'] = "";
|
4016 |
-
$p_header['status'] = "invalid_header";
|
4017 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
|
4018 |
-
|
4019 |
-
// ----- Error log
|
4020 |
-
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
|
4021 |
-
|
4022 |
-
// ----- Return
|
4023 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4024 |
-
return PclZip::errorCode();
|
4025 |
-
}
|
4026 |
-
|
4027 |
-
// ----- Extract the values
|
4028 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header : '".$v_binary_data."'");
|
4029 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header (Hex) : '".bin2hex($v_binary_data)."'");
|
4030 |
-
$v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
|
4031 |
-
|
4032 |
-
// ----- Get filename
|
4033 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "File name length : ".$v_data['filename_len']);
|
4034 |
-
$p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
|
4035 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename : \''.$p_header['filename'].'\'');
|
4036 |
-
|
4037 |
-
// ----- Get extra_fields
|
4038 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extra field length : ".$v_data['extra_len']);
|
4039 |
-
if ($v_data['extra_len'] != 0) {
|
4040 |
-
$p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
|
4041 |
-
}
|
4042 |
-
else {
|
4043 |
-
$p_header['extra'] = '';
|
4044 |
-
}
|
4045 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Extra field : \''.bin2hex($p_header['extra']).'\'');
|
4046 |
-
|
4047 |
-
// ----- Extract properties
|
4048 |
-
$p_header['version_extracted'] = $v_data['version'];
|
4049 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : ('.$p_header['version_extracted'].') \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
|
4050 |
-
$p_header['compression'] = $v_data['compression'];
|
4051 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compression method : \''.$p_header['compression'].'\'');
|
4052 |
-
$p_header['size'] = $v_data['size'];
|
4053 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_header['size'].'\'');
|
4054 |
-
$p_header['compressed_size'] = $v_data['compressed_size'];
|
4055 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
|
4056 |
-
$p_header['crc'] = $v_data['crc'];
|
4057 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
|
4058 |
-
$p_header['flag'] = $v_data['flag'];
|
4059 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\'');
|
4060 |
-
$p_header['filename_len'] = $v_data['filename_len'];
|
4061 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename_len : \''.$p_header['filename_len'].'\'');
|
4062 |
-
|
4063 |
-
// ----- Recuperate date in UNIX format
|
4064 |
-
$p_header['mdate'] = $v_data['mdate'];
|
4065 |
-
$p_header['mtime'] = $v_data['mtime'];
|
4066 |
-
if ($p_header['mdate'] && $p_header['mtime'])
|
4067 |
-
{
|
4068 |
-
// ----- Extract time
|
4069 |
-
$v_hour = ($p_header['mtime'] & 0xF800) >> 11;
|
4070 |
-
$v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
|
4071 |
-
$v_seconde = ($p_header['mtime'] & 0x001F)*2;
|
4072 |
-
|
4073 |
-
// ----- Extract date
|
4074 |
-
$v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
|
4075 |
-
$v_month = ($p_header['mdate'] & 0x01E0) >> 5;
|
4076 |
-
$v_day = $p_header['mdate'] & 0x001F;
|
4077 |
-
|
4078 |
-
// ----- Get UNIX date format
|
4079 |
-
$p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
|
4080 |
-
|
4081 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4082 |
-
}
|
4083 |
-
else
|
4084 |
-
{
|
4085 |
-
$p_header['mtime'] = time();
|
4086 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4087 |
-
}
|
4088 |
-
|
4089 |
-
// TBC
|
4090 |
-
//for(reset($v_data); $key = key($v_data); next($v_data)) {
|
4091 |
-
// //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Attribut[$key] = ".$v_data[$key]);
|
4092 |
-
//}
|
4093 |
-
|
4094 |
-
// ----- Set the stored filename
|
4095 |
-
$p_header['stored_filename'] = $p_header['filename'];
|
4096 |
-
|
4097 |
-
// ----- Set the status field
|
4098 |
-
$p_header['status'] = "ok";
|
4099 |
-
|
4100 |
-
// ----- Return
|
4101 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4102 |
-
return $v_result;
|
4103 |
-
}
|
4104 |
-
// --------------------------------------------------------------------------------
|
4105 |
-
|
4106 |
-
// --------------------------------------------------------------------------------
|
4107 |
-
// Function : privReadCentralFileHeader()
|
4108 |
-
// Description :
|
4109 |
-
// Parameters :
|
4110 |
-
// Return Values :
|
4111 |
-
// --------------------------------------------------------------------------------
|
4112 |
-
function privReadCentralFileHeader(&$p_header)
|
4113 |
-
{
|
4114 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadCentralFileHeader", "");
|
4115 |
-
$v_result=1;
|
4116 |
-
|
4117 |
-
// ----- Read the 4 bytes signature
|
4118 |
-
$v_binary_data = @fread($this->zip_fd, 4);
|
4119 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
|
4120 |
-
$v_data = unpack('Vid', $v_binary_data);
|
4121 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
|
4122 |
-
|
4123 |
-
// ----- Check signature
|
4124 |
-
if ($v_data['id'] != 0x02014b50)
|
4125 |
-
{
|
4126 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid Central Dir File signature");
|
4127 |
-
|
4128 |
-
// ----- Error log
|
4129 |
-
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
|
4130 |
-
|
4131 |
-
// ----- Return
|
4132 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4133 |
-
return PclZip::errorCode();
|
4134 |
-
}
|
4135 |
-
|
4136 |
-
// ----- Read the first 42 bytes of the header
|
4137 |
-
$v_binary_data = fread($this->zip_fd, 42);
|
4138 |
-
|
4139 |
-
// ----- Look for invalid block size
|
4140 |
-
if (strlen($v_binary_data) != 42)
|
4141 |
-
{
|
4142 |
-
$p_header['filename'] = "";
|
4143 |
-
$p_header['status'] = "invalid_header";
|
4144 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
|
4145 |
-
|
4146 |
-
// ----- Error log
|
4147 |
-
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
|
4148 |
-
|
4149 |
-
// ----- Return
|
4150 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4151 |
-
return PclZip::errorCode();
|
4152 |
-
}
|
4153 |
-
|
4154 |
-
// ----- Extract the values
|
4155 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header : '".$v_binary_data."'");
|
4156 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header (Hex) : '".bin2hex($v_binary_data)."'");
|
4157 |
-
$p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);
|
4158 |
-
|
4159 |
-
// ----- Get filename
|
4160 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File name length : ".$p_header['filename_len']);
|
4161 |
-
if ($p_header['filename_len'] != 0)
|
4162 |
-
$p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
|
4163 |
-
else
|
4164 |
-
$p_header['filename'] = '';
|
4165 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Filename : \''.$p_header['filename'].'\'');
|
4166 |
-
|
4167 |
-
// ----- Get extra
|
4168 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Extra length : ".$p_header['extra_len']);
|
4169 |
-
if ($p_header['extra_len'] != 0)
|
4170 |
-
$p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
|
4171 |
-
else
|
4172 |
-
$p_header['extra'] = '';
|
4173 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Extra : \''.$p_header['extra'].'\'');
|
4174 |
-
|
4175 |
-
// ----- Get comment
|
4176 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Comment length : ".$p_header['comment_len']);
|
4177 |
-
if ($p_header['comment_len'] != 0)
|
4178 |
-
$p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
|
4179 |
-
else
|
4180 |
-
$p_header['comment'] = '';
|
4181 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Comment : \''.$p_header['comment'].'\'');
|
4182 |
-
|
4183 |
-
// ----- Extract properties
|
4184 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version : \''.($p_header['version']/10).'.'.($p_header['version']%10).'\'');
|
4185 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
|
4186 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Size : \''.$p_header['size'].'\'');
|
4187 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
|
4188 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
|
4189 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Flag : \''.$p_header['flag'].'\'');
|
4190 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$p_header['offset'].'\'');
|
4191 |
-
|
4192 |
-
// ----- Recuperate date in UNIX format
|
4193 |
-
if ($p_header['mdate'] && $p_header['mtime'])
|
4194 |
-
{
|
4195 |
-
// ----- Extract time
|
4196 |
-
$v_hour = ($p_header['mtime'] & 0xF800) >> 11;
|
4197 |
-
$v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
|
4198 |
-
$v_seconde = ($p_header['mtime'] & 0x001F)*2;
|
4199 |
-
|
4200 |
-
// ----- Extract date
|
4201 |
-
$v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
|
4202 |
-
$v_month = ($p_header['mdate'] & 0x01E0) >> 5;
|
4203 |
-
$v_day = $p_header['mdate'] & 0x001F;
|
4204 |
-
|
4205 |
-
// ----- Get UNIX date format
|
4206 |
-
$p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
|
4207 |
-
|
4208 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4209 |
-
}
|
4210 |
-
else
|
4211 |
-
{
|
4212 |
-
$p_header['mtime'] = time();
|
4213 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4214 |
-
}
|
4215 |
-
|
4216 |
-
// ----- Set the stored filename
|
4217 |
-
$p_header['stored_filename'] = $p_header['filename'];
|
4218 |
-
|
4219 |
-
// ----- Set default status to ok
|
4220 |
-
$p_header['status'] = 'ok';
|
4221 |
-
|
4222 |
-
// ----- Look if it is a directory
|
4223 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Internal (Hex) : '".sprintf("Ox%04X", $p_header['internal'])."'");
|
4224 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "External (Hex) : '".sprintf("Ox%04X", $p_header['external'])."' (".(($p_header['external']&0x00000010)==0x00000010?'is a folder':'is a file').')');
|
4225 |
-
if (substr($p_header['filename'], -1) == '/') {
|
4226 |
-
//$p_header['external'] = 0x41FF0010;
|
4227 |
-
$p_header['external'] = 0x00000010;
|
4228 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force folder external : \''.sprintf("Ox%04X", $p_header['external']).'\'');
|
4229 |
-
}
|
4230 |
-
|
4231 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Header of filename : \''.$p_header['filename'].'\'');
|
4232 |
-
|
4233 |
-
// ----- Return
|
4234 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4235 |
-
return $v_result;
|
4236 |
-
}
|
4237 |
-
// --------------------------------------------------------------------------------
|
4238 |
-
|
4239 |
-
// --------------------------------------------------------------------------------
|
4240 |
-
// Function : privCheckFileHeaders()
|
4241 |
-
// Description :
|
4242 |
-
// Parameters :
|
4243 |
-
// Return Values :
|
4244 |
-
// 1 on success,
|
4245 |
-
// 0 on error;
|
4246 |
-
// --------------------------------------------------------------------------------
|
4247 |
-
function privCheckFileHeaders(&$p_local_header, &$p_central_header)
|
4248 |
-
{
|
4249 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");
|
4250 |
-
$v_result=1;
|
4251 |
-
|
4252 |
-
// ----- Check the static values
|
4253 |
-
// TBC
|
4254 |
-
if ($p_local_header['filename'] != $p_central_header['filename']) {
|
4255 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
|
4256 |
-
}
|
4257 |
-
if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
|
4258 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
|
4259 |
-
}
|
4260 |
-
if ($p_local_header['flag'] != $p_central_header['flag']) {
|
4261 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
|
4262 |
-
}
|
4263 |
-
if ($p_local_header['compression'] != $p_central_header['compression']) {
|
4264 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
|
4265 |
-
}
|
4266 |
-
if ($p_local_header['mtime'] != $p_central_header['mtime']) {
|
4267 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
|
4268 |
-
}
|
4269 |
-
if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
|
4270 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
|
4271 |
-
}
|
4272 |
-
|
4273 |
-
// ----- Look for flag bit 3
|
4274 |
-
if (($p_local_header['flag'] & 8) == 8) {
|
4275 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
|
4276 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
|
4277 |
-
$p_local_header['size'] = $p_central_header['size'];
|
4278 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');
|
4279 |
-
$p_local_header['compressed_size'] = $p_central_header['compressed_size'];
|
4280 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');
|
4281 |
-
$p_local_header['crc'] = $p_central_header['crc'];
|
4282 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');
|
4283 |
-
}
|
4284 |
-
|
4285 |
-
// ----- Return
|
4286 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4287 |
-
return $v_result;
|
4288 |
-
}
|
4289 |
-
// --------------------------------------------------------------------------------
|
4290 |
-
|
4291 |
-
// --------------------------------------------------------------------------------
|
4292 |
-
// Function : privReadEndCentralDir()
|
4293 |
-
// Description :
|
4294 |
-
// Parameters :
|
4295 |
-
// Return Values :
|
4296 |
-
// --------------------------------------------------------------------------------
|
4297 |
-
function privReadEndCentralDir(&$p_central_dir)
|
4298 |
-
{
|
4299 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadEndCentralDir", "");
|
4300 |
-
$v_result=1;
|
4301 |
-
|
4302 |
-
// ----- Go to the end of the zip file
|
4303 |
-
$v_size = filesize($this->zipname);
|
4304 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size of the file :$v_size");
|
4305 |
-
@fseek($this->zip_fd, $v_size);
|
4306 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position at end of zip file : \''.ftell($this->zip_fd).'\'');
|
4307 |
-
if (@ftell($this->zip_fd) != $v_size)
|
4308 |
-
{
|
4309 |
-
// ----- Error log
|
4310 |
-
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
|
4311 |
-
|
4312 |
-
// ----- Return
|
4313 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4314 |
-
return PclZip::errorCode();
|
4315 |
-
}
|
4316 |
-
|
4317 |
-
// ----- First try : look if this is an archive with no commentaries (most of the time)
|
4318 |
-
// in this case the end of central dir is at 22 bytes of the file end
|
4319 |
-
$v_found = 0;
|
4320 |
-
if ($v_size > 26) {
|
4321 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Look for central dir with no comment');
|
4322 |
-
@fseek($this->zip_fd, $v_size-22);
|
4323 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after min central position : \''.ftell($this->zip_fd).'\'');
|
4324 |
-
if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
|
4325 |
-
{
|
4326 |
-
// ----- Error log
|
4327 |
-
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
|
4328 |
-
|
4329 |
-
// ----- Return
|
4330 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4331 |
-
return PclZip::errorCode();
|
4332 |
-
}
|
4333 |
-
|
4334 |
-
// ----- Read for bytes
|
4335 |
-
$v_binary_data = @fread($this->zip_fd, 4);
|
4336 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
|
4337 |
-
$v_data = @unpack('Vid', $v_binary_data);
|
4338 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
|
4339 |
-
|
4340 |
-
// ----- Check signature
|
4341 |
-
if ($v_data['id'] == 0x06054b50) {
|
4342 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found central dir at the default position.");
|
4343 |
-
$v_found = 1;
|
4344 |
-
}
|
4345 |
-
|
4346 |
-
$v_pos = ftell($this->zip_fd);
|
4347 |
-
}
|
4348 |
-
|
4349 |
-
// ----- Go back to the maximum possible size of the Central Dir End Record
|
4350 |
-
if (!$v_found) {
|
4351 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Start extended search of end central dir');
|
4352 |
-
$v_maximum_size = 65557; // 0xFFFF + 22;
|
4353 |
-
if ($v_maximum_size > $v_size)
|
4354 |
-
$v_maximum_size = $v_size;
|
4355 |
-
@fseek($this->zip_fd, $v_size-$v_maximum_size);
|
4356 |
-
if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
|
4357 |
-
{
|
4358 |
-
// ----- Error log
|
4359 |
-
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
|
4360 |
-
|
4361 |
-
// ----- Return
|
4362 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4363 |
-
return PclZip::errorCode();
|
4364 |
-
}
|
4365 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after max central position : \''.ftell($this->zip_fd).'\'');
|
4366 |
-
|
4367 |
-
// ----- Read byte per byte in order to find the signature
|
4368 |
-
$v_pos = ftell($this->zip_fd);
|
4369 |
-
$v_bytes = 0x00000000;
|
4370 |
-
while ($v_pos < $v_size)
|
4371 |
-
{
|
4372 |
-
// ----- Read a byte
|
4373 |
-
$v_byte = @fread($this->zip_fd, 1);
|
4374 |
-
|
4375 |
-
// ----- Add the byte
|
4376 |
-
$v_bytes = ($v_bytes << 8) | Ord($v_byte);
|
4377 |
-
|
4378 |
-
// ----- Compare the bytes
|
4379 |
-
if ($v_bytes == 0x504b0506)
|
4380 |
-
{
|
4381 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Found End Central Dir signature at position : \''.ftell($this->zip_fd).'\'');
|
4382 |
-
$v_pos++;
|
4383 |
-
break;
|
4384 |
-
}
|
4385 |
-
|
4386 |
-
$v_pos++;
|
4387 |
-
}
|
4388 |
-
|
4389 |
-
// ----- Look if not found end of central dir
|
4390 |
-
if ($v_pos == $v_size)
|
4391 |
-
{
|
4392 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to find End of Central Dir Record signature");
|
4393 |
-
|
4394 |
-
// ----- Error log
|
4395 |
-
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
|
4396 |
-
|
4397 |
-
// ----- Return
|
4398 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4399 |
-
return PclZip::errorCode();
|
4400 |
-
}
|
4401 |
-
}
|
4402 |
-
|
4403 |
-
// ----- Read the first 18 bytes of the header
|
4404 |
-
$v_binary_data = fread($this->zip_fd, 18);
|
4405 |
-
|
4406 |
-
// ----- Look for invalid block size
|
4407 |
-
if (strlen($v_binary_data) != 18)
|
4408 |
-
{
|
4409 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
|
4410 |
-
|
4411 |
-
// ----- Error log
|
4412 |
-
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
|
4413 |
-
|
4414 |
-
// ----- Return
|
4415 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4416 |
-
return PclZip::errorCode();
|
4417 |
-
}
|
4418 |
-
|
4419 |
-
// ----- Extract the values
|
4420 |
-
////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record : '".$v_binary_data."'");
|
4421 |
-
////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record (Hex) : '".bin2hex($v_binary_data)."'");
|
4422 |
-
$v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
|
4423 |
-
|
4424 |
-
// ----- Check the global size
|
4425 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Comment length : ".$v_data['comment_size']);
|
4426 |
-
if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
|
4427 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The central dir is not at the end of the archive. Some trailing bytes exists after the archive.");
|
4428 |
-
|
4429 |
-
// ----- Removed in release 2.2 see readme file
|
4430 |
-
// The check of the file size is a little too strict.
|
4431 |
-
// Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
|
4432 |
-
// While decrypted, zip has training 0 bytes
|
4433 |
-
if (0) {
|
4434 |
-
// ----- Error log
|
4435 |
-
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
|
4436 |
-
'The central dir is not at the end of the archive.'
|
4437 |
-
.' Some trailing bytes exists after the archive.');
|
4438 |
-
|
4439 |
-
// ----- Return
|
4440 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4441 |
-
return PclZip::errorCode();
|
4442 |
-
}
|
4443 |
-
}
|
4444 |
-
|
4445 |
-
// ----- Get comment
|
4446 |
-
if ($v_data['comment_size'] != 0)
|
4447 |
-
$p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
|
4448 |
-
else
|
4449 |
-
$p_central_dir['comment'] = '';
|
4450 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$p_central_dir['comment'].'\'');
|
4451 |
-
|
4452 |
-
$p_central_dir['entries'] = $v_data['entries'];
|
4453 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries : \''.$p_central_dir['entries'].'\'');
|
4454 |
-
$p_central_dir['disk_entries'] = $v_data['disk_entries'];
|
4455 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries for this disk : \''.$p_central_dir['disk_entries'].'\'');
|
4456 |
-
$p_central_dir['offset'] = $v_data['offset'];
|
4457 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Offset of Central Dir : \''.$p_central_dir['offset'].'\'');
|
4458 |
-
$p_central_dir['size'] = $v_data['size'];
|
4459 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size of Central Dir : \''.$p_central_dir['size'].'\'');
|
4460 |
-
$p_central_dir['disk'] = $v_data['disk'];
|
4461 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Disk number : \''.$p_central_dir['disk'].'\'');
|
4462 |
-
$p_central_dir['disk_start'] = $v_data['disk_start'];
|
4463 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Start disk number : \''.$p_central_dir['disk_start'].'\'');
|
4464 |
-
|
4465 |
-
// TBC
|
4466 |
-
//for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
|
4467 |
-
// //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "central_dir[$key] = ".$p_central_dir[$key]);
|
4468 |
-
//}
|
4469 |
-
|
4470 |
-
// ----- Return
|
4471 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4472 |
-
return $v_result;
|
4473 |
-
}
|
4474 |
-
// --------------------------------------------------------------------------------
|
4475 |
-
|
4476 |
-
// --------------------------------------------------------------------------------
|
4477 |
-
// Function : privDeleteByRule()
|
4478 |
-
// Description :
|
4479 |
-
// Parameters :
|
4480 |
-
// Return Values :
|
4481 |
-
// --------------------------------------------------------------------------------
|
4482 |
-
function privDeleteByRule(&$p_result_list, &$p_options)
|
4483 |
-
{
|
4484 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDeleteByRule", "");
|
4485 |
-
$v_result=1;
|
4486 |
-
$v_list_detail = array();
|
4487 |
-
|
4488 |
-
// ----- Open the zip file
|
4489 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
4490 |
-
if (($v_result=$this->privOpenFd('rb')) != 1)
|
4491 |
-
{
|
4492 |
-
// ----- Return
|
4493 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4494 |
-
return $v_result;
|
4495 |
-
}
|
4496 |
-
|
4497 |
-
// ----- Read the central directory informations
|
4498 |
-
$v_central_dir = array();
|
4499 |
-
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
4500 |
-
{
|
4501 |
-
$this->privCloseFd();
|
4502 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4503 |
-
return $v_result;
|
4504 |
-
}
|
4505 |
-
|
4506 |
-
// ----- Go to beginning of File
|
4507 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
4508 |
-
@rewind($this->zip_fd);
|
4509 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
4510 |
-
|
4511 |
-
// ----- Scan all the files
|
4512 |
-
// ----- Start at beginning of Central Dir
|
4513 |
-
$v_pos_entry = $v_central_dir['offset'];
|
4514 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
|
4515 |
-
@rewind($this->zip_fd);
|
4516 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
|
4517 |
-
if (@fseek($this->zip_fd, $v_pos_entry))
|
4518 |
-
{
|
4519 |
-
// ----- Close the zip file
|
4520 |
-
$this->privCloseFd();
|
4521 |
-
|
4522 |
-
// ----- Error log
|
4523 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
4524 |
-
|
4525 |
-
// ----- Return
|
4526 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4527 |
-
return PclZip::errorCode();
|
4528 |
-
}
|
4529 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
|
4530 |
-
|
4531 |
-
// ----- Read each entry
|
4532 |
-
$v_header_list = array();
|
4533 |
-
$j_start = 0;
|
4534 |
-
for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
|
4535 |
-
{
|
4536 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry (index '$i')");
|
4537 |
-
|
4538 |
-
// ----- Read the file header
|
4539 |
-
$v_header_list[$v_nb_extracted] = array();
|
4540 |
-
if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1)
|
4541 |
-
{
|
4542 |
-
// ----- Close the zip file
|
4543 |
-
$this->privCloseFd();
|
4544 |
-
|
4545 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4546 |
-
return $v_result;
|
4547 |
-
}
|
4548 |
-
|
4549 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename (index '$i') : '".$v_header_list[$v_nb_extracted]['stored_filename']."'");
|
4550 |
-
|
4551 |
-
// ----- Store the index
|
4552 |
-
$v_header_list[$v_nb_extracted]['index'] = $i;
|
4553 |
-
|
4554 |
-
// ----- Look for the specific extract rules
|
4555 |
-
$v_found = false;
|
4556 |
-
|
4557 |
-
// ----- Look for extract by name rule
|
4558 |
-
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
|
4559 |
-
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
|
4560 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
|
4561 |
-
|
4562 |
-
// ----- Look if the filename is in the list
|
4563 |
-
for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
|
4564 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
|
4565 |
-
|
4566 |
-
// ----- Look for a directory
|
4567 |
-
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
|
4568 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
|
4569 |
-
|
4570 |
-
// ----- Look if the directory is in the filename path
|
4571 |
-
if ( (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
4572 |
-
&& (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
4573 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
|
4574 |
-
$v_found = true;
|
4575 |
-
}
|
4576 |
-
elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
|
4577 |
-
&& ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
4578 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The entry is the searched directory");
|
4579 |
-
$v_found = true;
|
4580 |
-
}
|
4581 |
-
}
|
4582 |
-
// ----- Look for a filename
|
4583 |
-
elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
|
4584 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
|
4585 |
-
$v_found = true;
|
4586 |
-
}
|
4587 |
-
}
|
4588 |
-
}
|
4589 |
-
|
4590 |
-
// ----- Look for extract by ereg rule
|
4591 |
-
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
4592 |
-
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
|
4593 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
|
4594 |
-
|
4595 |
-
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
|
4596 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
4597 |
-
$v_found = true;
|
4598 |
-
}
|
4599 |
-
}
|
4600 |
-
|
4601 |
-
// ----- Look for extract by preg rule
|
4602 |
-
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
|
4603 |
-
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
|
4604 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
|
4605 |
-
|
4606 |
-
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
|
4607 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
4608 |
-
$v_found = true;
|
4609 |
-
}
|
4610 |
-
}
|
4611 |
-
|
4612 |
-
// ----- Look for extract by index rule
|
4613 |
-
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
4614 |
-
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
4615 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
|
4616 |
-
|
4617 |
-
// ----- Look if the index is in the list
|
4618 |
-
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
|
4619 |
-
//--(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']."]");
|
4620 |
-
|
4621 |
-
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
|
4622 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
|
4623 |
-
$v_found = true;
|
4624 |
-
}
|
4625 |
-
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
|
4626 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
|
4627 |
-
$j_start = $j+1;
|
4628 |
-
}
|
4629 |
-
|
4630 |
-
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
|
4631 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
|
4632 |
-
break;
|
4633 |
-
}
|
4634 |
-
}
|
4635 |
-
}
|
4636 |
-
else {
|
4637 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "No argument mean remove all file");
|
4638 |
-
$v_found = true;
|
4639 |
-
}
|
4640 |
-
|
4641 |
-
// ----- Look for deletion
|
4642 |
-
if ($v_found)
|
4643 |
-
{
|
4644 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' need to be deleted");
|
4645 |
-
unset($v_header_list[$v_nb_extracted]);
|
4646 |
-
}
|
4647 |
-
else
|
4648 |
-
{
|
4649 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' will not be deleted");
|
4650 |
-
$v_nb_extracted++;
|
4651 |
-
}
|
4652 |
-
}
|
4653 |
-
|
4654 |
-
// ----- Look if something need to be deleted
|
4655 |
-
if ($v_nb_extracted > 0) {
|
4656 |
-
|
4657 |
-
// ----- Creates a temporay file
|
4658 |
-
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
|
4659 |
-
|
4660 |
-
// ----- Creates a temporary zip archive
|
4661 |
-
$v_temp_zip = new PclZip($v_zip_temp_name);
|
4662 |
-
|
4663 |
-
// ----- Open the temporary zip file in write mode
|
4664 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary write mode");
|
4665 |
-
if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
|
4666 |
-
$this->privCloseFd();
|
4667 |
-
|
4668 |
-
// ----- Return
|
4669 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4670 |
-
return $v_result;
|
4671 |
-
}
|
4672 |
-
|
4673 |
-
// ----- Look which file need to be kept
|
4674 |
-
for ($i=0; $i<sizeof($v_header_list); $i++) {
|
4675 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry index '$i' : '".$v_header_list[$i]['filename']."'");
|
4676 |
-
|
4677 |
-
// ----- Calculate the position of the header
|
4678 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v_header_list[$i]['offset']."'");
|
4679 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
|
4680 |
-
@rewind($this->zip_fd);
|
4681 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
|
4682 |
-
if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
|
4683 |
-
// ----- Close the zip file
|
4684 |
-
$this->privCloseFd();
|
4685 |
-
$v_temp_zip->privCloseFd();
|
4686 |
-
@unlink($v_zip_temp_name);
|
4687 |
-
|
4688 |
-
// ----- Error log
|
4689 |
-
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
4690 |
-
|
4691 |
-
// ----- Return
|
4692 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4693 |
-
return PclZip::errorCode();
|
4694 |
-
}
|
4695 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
|
4696 |
-
|
4697 |
-
// ----- Read the file header
|
4698 |
-
$v_local_header = array();
|
4699 |
-
if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
|
4700 |
-
// ----- Close the zip file
|
4701 |
-
$this->privCloseFd();
|
4702 |
-
$v_temp_zip->privCloseFd();
|
4703 |
-
@unlink($v_zip_temp_name);
|
4704 |
-
|
4705 |
-
// ----- Return
|
4706 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4707 |
-
return $v_result;
|
4708 |
-
}
|
4709 |
-
|
4710 |
-
// ----- Check that local file header is same as central file header
|
4711 |
-
if ($this->privCheckFileHeaders($v_local_header,
|
4712 |
-
$v_header_list[$i]) != 1) {
|
4713 |
-
// TBC
|
4714 |
-
}
|
4715 |
-
unset($v_local_header);
|
4716 |
-
|
4717 |
-
// ----- Write the file header
|
4718 |
-
if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
|
4719 |
-
// ----- Close the zip file
|
4720 |
-
$this->privCloseFd();
|
4721 |
-
$v_temp_zip->privCloseFd();
|
4722 |
-
@unlink($v_zip_temp_name);
|
4723 |
-
|
4724 |
-
// ----- Return
|
4725 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4726 |
-
return $v_result;
|
4727 |
-
}
|
4728 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'");
|
4729 |
-
|
4730 |
-
// ----- Read/write the data block
|
4731 |
-
if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
|
4732 |
-
// ----- Close the zip file
|
4733 |
-
$this->privCloseFd();
|
4734 |
-
$v_temp_zip->privCloseFd();
|
4735 |
-
@unlink($v_zip_temp_name);
|
4736 |
-
|
4737 |
-
// ----- Return
|
4738 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4739 |
-
return $v_result;
|
4740 |
-
}
|
4741 |
-
}
|
4742 |
-
|
4743 |
-
// ----- Store the offset of the central dir
|
4744 |
-
$v_offset = @ftell($v_temp_zip->zip_fd);
|
4745 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset");
|
4746 |
-
|
4747 |
-
// ----- Re-Create the Central Dir files header
|
4748 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");
|
4749 |
-
for ($i=0; $i<sizeof($v_header_list); $i++) {
|
4750 |
-
// ----- Create the file header
|
4751 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']);
|
4752 |
-
if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
|
4753 |
-
$v_temp_zip->privCloseFd();
|
4754 |
-
$this->privCloseFd();
|
4755 |
-
@unlink($v_zip_temp_name);
|
4756 |
-
|
4757 |
-
// ----- Return
|
4758 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4759 |
-
return $v_result;
|
4760 |
-
}
|
4761 |
-
|
4762 |
-
// ----- Transform the header to a 'usable' info
|
4763 |
-
$v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
|
4764 |
-
}
|
4765 |
-
|
4766 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer");
|
4767 |
-
|
4768 |
-
// ----- Zip file comment
|
4769 |
-
$v_comment = '';
|
4770 |
-
if (isset($p_options[PCLZIP_OPT_COMMENT])) {
|
4771 |
-
$v_comment = $p_options[PCLZIP_OPT_COMMENT];
|
4772 |
-
}
|
4773 |
-
|
4774 |
-
// ----- Calculate the size of the central header
|
4775 |
-
$v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;
|
4776 |
-
|
4777 |
-
// ----- Create the central dir footer
|
4778 |
-
if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
|
4779 |
-
// ----- Reset the file list
|
4780 |
-
unset($v_header_list);
|
4781 |
-
$v_temp_zip->privCloseFd();
|
4782 |
-
$this->privCloseFd();
|
4783 |
-
@unlink($v_zip_temp_name);
|
4784 |
-
|
4785 |
-
// ----- Return
|
4786 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4787 |
-
return $v_result;
|
4788 |
-
}
|
4789 |
-
|
4790 |
-
// ----- Close
|
4791 |
-
$v_temp_zip->privCloseFd();
|
4792 |
-
$this->privCloseFd();
|
4793 |
-
|
4794 |
-
// ----- Delete the zip file
|
4795 |
-
// TBC : I should test the result ...
|
4796 |
-
@unlink($this->zipname);
|
4797 |
-
|
4798 |
-
// ----- Rename the temporary file
|
4799 |
-
// TBC : I should test the result ...
|
4800 |
-
//@rename($v_zip_temp_name, $this->zipname);
|
4801 |
-
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
4802 |
-
|
4803 |
-
// ----- Destroy the temporary archive
|
4804 |
-
unset($v_temp_zip);
|
4805 |
-
}
|
4806 |
-
|
4807 |
-
// ----- Remove every files : reset the file
|
4808 |
-
else if ($v_central_dir['entries'] != 0) {
|
4809 |
-
$this->privCloseFd();
|
4810 |
-
|
4811 |
-
if (($v_result = $this->privOpenFd('wb')) != 1) {
|
4812 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4813 |
-
return $v_result;
|
4814 |
-
}
|
4815 |
-
|
4816 |
-
if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
|
4817 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4818 |
-
return $v_result;
|
4819 |
-
}
|
4820 |
-
|
4821 |
-
$this->privCloseFd();
|
4822 |
-
}
|
4823 |
-
|
4824 |
-
// ----- Return
|
4825 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4826 |
-
return $v_result;
|
4827 |
-
}
|
4828 |
-
// --------------------------------------------------------------------------------
|
4829 |
-
|
4830 |
-
// --------------------------------------------------------------------------------
|
4831 |
-
// Function : privDirCheck()
|
4832 |
-
// Description :
|
4833 |
-
// Check if a directory exists, if not it creates it and all the parents directory
|
4834 |
-
// which may be useful.
|
4835 |
-
// Parameters :
|
4836 |
-
// $p_dir : Directory path to check.
|
4837 |
-
// Return Values :
|
4838 |
-
// 1 : OK
|
4839 |
-
// -1 : Unable to create directory
|
4840 |
-
// --------------------------------------------------------------------------------
|
4841 |
-
function privDirCheck($p_dir, $p_is_dir=false)
|
4842 |
-
{
|
4843 |
-
$v_result = 1;
|
4844 |
-
|
4845 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDirCheck", "entry='$p_dir', is_dir='".($p_is_dir?"true":"false")."'");
|
4846 |
-
|
4847 |
-
// ----- Remove the final '/'
|
4848 |
-
if (($p_is_dir) && (substr($p_dir, -1)=='/'))
|
4849 |
-
{
|
4850 |
-
$p_dir = substr($p_dir, 0, strlen($p_dir)-1);
|
4851 |
-
}
|
4852 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for entry '$p_dir'");
|
4853 |
-
|
4854 |
-
// ----- Check the directory availability
|
4855 |
-
if ((is_dir($p_dir)) || ($p_dir == ""))
|
4856 |
-
{
|
4857 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is a directory");
|
4858 |
-
return 1;
|
4859 |
-
}
|
4860 |
-
|
4861 |
-
// ----- Extract parent directory
|
4862 |
-
$p_parent_dir = dirname($p_dir);
|
4863 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");
|
4864 |
-
|
4865 |
-
// ----- Just a check
|
4866 |
-
if ($p_parent_dir != $p_dir)
|
4867 |
-
{
|
4868 |
-
// ----- Look for parent directory
|
4869 |
-
if ($p_parent_dir != "")
|
4870 |
-
{
|
4871 |
-
if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
|
4872 |
-
{
|
4873 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4874 |
-
return $v_result;
|
4875 |
-
}
|
4876 |
-
}
|
4877 |
-
}
|
4878 |
-
|
4879 |
-
// ----- Create the directory
|
4880 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
|
4881 |
-
if (!@mkdir($p_dir, 0777))
|
4882 |
-
{
|
4883 |
-
// ----- Error log
|
4884 |
-
PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
|
4885 |
-
|
4886 |
-
// ----- Return
|
4887 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4888 |
-
return PclZip::errorCode();
|
4889 |
-
}
|
4890 |
-
|
4891 |
-
// ----- Return
|
4892 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result, "Directory '$p_dir' created");
|
4893 |
-
return $v_result;
|
4894 |
-
}
|
4895 |
-
// --------------------------------------------------------------------------------
|
4896 |
-
|
4897 |
-
// --------------------------------------------------------------------------------
|
4898 |
-
// Function : privMerge()
|
4899 |
-
// Description :
|
4900 |
-
// If $p_archive_to_add does not exist, the function exit with a success result.
|
4901 |
-
// Parameters :
|
4902 |
-
// Return Values :
|
4903 |
-
// --------------------------------------------------------------------------------
|
4904 |
-
function privMerge(&$p_archive_to_add)
|
4905 |
-
{
|
4906 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privMerge", "archive='".$p_archive_to_add->zipname."'");
|
4907 |
-
$v_result=1;
|
4908 |
-
|
4909 |
-
// ----- Look if the archive_to_add exists
|
4910 |
-
if (!is_file($p_archive_to_add->zipname))
|
4911 |
-
{
|
4912 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to add does not exist. End of merge.");
|
4913 |
-
|
4914 |
-
// ----- Nothing to merge, so merge is a success
|
4915 |
-
$v_result = 1;
|
4916 |
-
|
4917 |
-
// ----- Return
|
4918 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4919 |
-
return $v_result;
|
4920 |
-
}
|
4921 |
-
|
4922 |
-
// ----- Look if the archive exists
|
4923 |
-
if (!is_file($this->zipname))
|
4924 |
-
{
|
4925 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, duplicate the archive_to_add.");
|
4926 |
-
|
4927 |
-
// ----- Do a duplicate
|
4928 |
-
$v_result = $this->privDuplicate($p_archive_to_add->zipname);
|
4929 |
-
|
4930 |
-
// ----- Return
|
4931 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4932 |
-
return $v_result;
|
4933 |
-
}
|
4934 |
-
|
4935 |
-
// ----- Open the zip file
|
4936 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
4937 |
-
if (($v_result=$this->privOpenFd('rb')) != 1)
|
4938 |
-
{
|
4939 |
-
// ----- Return
|
4940 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4941 |
-
return $v_result;
|
4942 |
-
}
|
4943 |
-
|
4944 |
-
// ----- Read the central directory informations
|
4945 |
-
$v_central_dir = array();
|
4946 |
-
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
4947 |
-
{
|
4948 |
-
$this->privCloseFd();
|
4949 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4950 |
-
return $v_result;
|
4951 |
-
}
|
4952 |
-
|
4953 |
-
// ----- Go to beginning of File
|
4954 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
|
4955 |
-
@rewind($this->zip_fd);
|
4956 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
|
4957 |
-
|
4958 |
-
// ----- Open the archive_to_add file
|
4959 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open archive_to_add in binary read mode");
|
4960 |
-
if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
|
4961 |
-
{
|
4962 |
-
$this->privCloseFd();
|
4963 |
-
|
4964 |
-
// ----- Return
|
4965 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4966 |
-
return $v_result;
|
4967 |
-
}
|
4968 |
-
|
4969 |
-
// ----- Read the central directory informations
|
4970 |
-
$v_central_dir_to_add = array();
|
4971 |
-
if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1)
|
4972 |
-
{
|
4973 |
-
$this->privCloseFd();
|
4974 |
-
$p_archive_to_add->privCloseFd();
|
4975 |
-
|
4976 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4977 |
-
return $v_result;
|
4978 |
-
}
|
4979 |
-
|
4980 |
-
// ----- Go to beginning of File
|
4981 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
|
4982 |
-
@rewind($p_archive_to_add->zip_fd);
|
4983 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
|
4984 |
-
|
4985 |
-
// ----- Creates a temporay file
|
4986 |
-
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
|
4987 |
-
|
4988 |
-
// ----- Open the temporary file in write mode
|
4989 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
4990 |
-
if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
|
4991 |
-
{
|
4992 |
-
$this->privCloseFd();
|
4993 |
-
$p_archive_to_add->privCloseFd();
|
4994 |
-
|
4995 |
-
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
|
4996 |
-
|
4997 |
-
// ----- Return
|
4998 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4999 |
-
return PclZip::errorCode();
|
5000 |
-
}
|
5001 |
-
|
5002 |
-
// ----- Copy the files from the archive to the temporary file
|
5003 |
-
// TBC : Here I should better append the file and go back to erase the central dir
|
5004 |
-
$v_size = $v_central_dir['offset'];
|
5005 |
-
while ($v_size != 0)
|
5006 |
-
{
|
5007 |
-
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5008 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5009 |
-
$v_buffer = fread($this->zip_fd, $v_read_size);
|
5010 |
-
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5011 |
-
$v_size -= $v_read_size;
|
5012 |
-
}
|
5013 |
-
|
5014 |
-
// ----- Copy the files from the archive_to_add into the temporary file
|
5015 |
-
$v_size = $v_central_dir_to_add['offset'];
|
5016 |
-
while ($v_size != 0)
|
5017 |
-
{
|
5018 |
-
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5019 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5020 |
-
$v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
|
5021 |
-
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5022 |
-
$v_size -= $v_read_size;
|
5023 |
-
}
|
5024 |
-
|
5025 |
-
// ----- Store the offset of the central dir
|
5026 |
-
$v_offset = @ftell($v_zip_temp_fd);
|
5027 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
|
5028 |
-
|
5029 |
-
// ----- Copy the block of file headers from the old archive
|
5030 |
-
$v_size = $v_central_dir['size'];
|
5031 |
-
while ($v_size != 0)
|
5032 |
-
{
|
5033 |
-
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5034 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5035 |
-
$v_buffer = @fread($this->zip_fd, $v_read_size);
|
5036 |
-
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5037 |
-
$v_size -= $v_read_size;
|
5038 |
-
}
|
5039 |
-
|
5040 |
-
// ----- Copy the block of file headers from the archive_to_add
|
5041 |
-
$v_size = $v_central_dir_to_add['size'];
|
5042 |
-
while ($v_size != 0)
|
5043 |
-
{
|
5044 |
-
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5045 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5046 |
-
$v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
|
5047 |
-
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5048 |
-
$v_size -= $v_read_size;
|
5049 |
-
}
|
5050 |
-
|
5051 |
-
// ----- Merge the file comments
|
5052 |
-
$v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];
|
5053 |
-
|
5054 |
-
// ----- Calculate the size of the (new) central header
|
5055 |
-
$v_size = @ftell($v_zip_temp_fd)-$v_offset;
|
5056 |
-
|
5057 |
-
// ----- Swap the file descriptor
|
5058 |
-
// Here is a trick : I swap the temporary fd with the zip fd, in order to use
|
5059 |
-
// the following methods on the temporary fil and not the real archive fd
|
5060 |
-
$v_swap = $this->zip_fd;
|
5061 |
-
$this->zip_fd = $v_zip_temp_fd;
|
5062 |
-
$v_zip_temp_fd = $v_swap;
|
5063 |
-
|
5064 |
-
// ----- Create the central dir footer
|
5065 |
-
if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)
|
5066 |
-
{
|
5067 |
-
$this->privCloseFd();
|
5068 |
-
$p_archive_to_add->privCloseFd();
|
5069 |
-
@fclose($v_zip_temp_fd);
|
5070 |
-
$this->zip_fd = null;
|
5071 |
-
|
5072 |
-
// ----- Reset the file list
|
5073 |
-
unset($v_header_list);
|
5074 |
-
|
5075 |
-
// ----- Return
|
5076 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5077 |
-
return $v_result;
|
5078 |
-
}
|
5079 |
-
|
5080 |
-
// ----- Swap back the file descriptor
|
5081 |
-
$v_swap = $this->zip_fd;
|
5082 |
-
$this->zip_fd = $v_zip_temp_fd;
|
5083 |
-
$v_zip_temp_fd = $v_swap;
|
5084 |
-
|
5085 |
-
// ----- Close
|
5086 |
-
$this->privCloseFd();
|
5087 |
-
$p_archive_to_add->privCloseFd();
|
5088 |
-
|
5089 |
-
// ----- Close the temporary file
|
5090 |
-
@fclose($v_zip_temp_fd);
|
5091 |
-
|
5092 |
-
// ----- Delete the zip file
|
5093 |
-
// TBC : I should test the result ...
|
5094 |
-
@unlink($this->zipname);
|
5095 |
-
|
5096 |
-
// ----- Rename the temporary file
|
5097 |
-
// TBC : I should test the result ...
|
5098 |
-
//@rename($v_zip_temp_name, $this->zipname);
|
5099 |
-
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
5100 |
-
|
5101 |
-
// ----- Return
|
5102 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5103 |
-
return $v_result;
|
5104 |
-
}
|
5105 |
-
// --------------------------------------------------------------------------------
|
5106 |
-
|
5107 |
-
// --------------------------------------------------------------------------------
|
5108 |
-
// Function : privDuplicate()
|
5109 |
-
// Description :
|
5110 |
-
// Parameters :
|
5111 |
-
// Return Values :
|
5112 |
-
// --------------------------------------------------------------------------------
|
5113 |
-
function privDuplicate($p_archive_filename)
|
5114 |
-
{
|
5115 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDuplicate", "archive_filename='$p_archive_filename'");
|
5116 |
-
$v_result=1;
|
5117 |
-
|
5118 |
-
// ----- Look if the $p_archive_filename exists
|
5119 |
-
if (!is_file($p_archive_filename))
|
5120 |
-
{
|
5121 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to duplicate does not exist. End of duplicate.");
|
5122 |
-
|
5123 |
-
// ----- Nothing to duplicate, so duplicate is a success.
|
5124 |
-
$v_result = 1;
|
5125 |
-
|
5126 |
-
// ----- Return
|
5127 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5128 |
-
return $v_result;
|
5129 |
-
}
|
5130 |
-
|
5131 |
-
// ----- Open the zip file
|
5132 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5133 |
-
if (($v_result=$this->privOpenFd('wb')) != 1)
|
5134 |
-
{
|
5135 |
-
// ----- Return
|
5136 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5137 |
-
return $v_result;
|
5138 |
-
}
|
5139 |
-
|
5140 |
-
// ----- Open the temporary file in write mode
|
5141 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5142 |
-
if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
|
5143 |
-
{
|
5144 |
-
$this->privCloseFd();
|
5145 |
-
|
5146 |
-
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
|
5147 |
-
|
5148 |
-
// ----- Return
|
5149 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5150 |
-
return PclZip::errorCode();
|
5151 |
-
}
|
5152 |
-
|
5153 |
-
// ----- Copy the files from the archive to the temporary file
|
5154 |
-
// TBC : Here I should better append the file and go back to erase the central dir
|
5155 |
-
$v_size = filesize($p_archive_filename);
|
5156 |
-
while ($v_size != 0)
|
5157 |
-
{
|
5158 |
-
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5159 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read $v_read_size bytes");
|
5160 |
-
$v_buffer = fread($v_zip_temp_fd, $v_read_size);
|
5161 |
-
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
|
5162 |
-
$v_size -= $v_read_size;
|
5163 |
-
}
|
5164 |
-
|
5165 |
-
// ----- Close
|
5166 |
-
$this->privCloseFd();
|
5167 |
-
|
5168 |
-
// ----- Close the temporary file
|
5169 |
-
@fclose($v_zip_temp_fd);
|
5170 |
-
|
5171 |
-
// ----- Return
|
5172 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5173 |
-
return $v_result;
|
5174 |
-
}
|
5175 |
-
// --------------------------------------------------------------------------------
|
5176 |
-
|
5177 |
-
// --------------------------------------------------------------------------------
|
5178 |
-
// Function : privErrorLog()
|
5179 |
-
// Description :
|
5180 |
-
// Parameters :
|
5181 |
-
// --------------------------------------------------------------------------------
|
5182 |
-
function privErrorLog($p_error_code=0, $p_error_string='')
|
5183 |
-
{
|
5184 |
-
if (PCLZIP_ERROR_EXTERNAL == 1) {
|
5185 |
-
PclError($p_error_code, $p_error_string);
|
5186 |
-
}
|
5187 |
-
else {
|
5188 |
-
$this->error_code = $p_error_code;
|
5189 |
-
$this->error_string = $p_error_string;
|
5190 |
-
}
|
5191 |
-
}
|
5192 |
-
// --------------------------------------------------------------------------------
|
5193 |
-
|
5194 |
-
// --------------------------------------------------------------------------------
|
5195 |
-
// Function : privErrorReset()
|
5196 |
-
// Description :
|
5197 |
-
// Parameters :
|
5198 |
-
// --------------------------------------------------------------------------------
|
5199 |
-
function privErrorReset()
|
5200 |
-
{
|
5201 |
-
if (PCLZIP_ERROR_EXTERNAL == 1) {
|
5202 |
-
PclErrorReset();
|
5203 |
-
}
|
5204 |
-
else {
|
5205 |
-
$this->error_code = 0;
|
5206 |
-
$this->error_string = '';
|
5207 |
-
}
|
5208 |
-
}
|
5209 |
-
// --------------------------------------------------------------------------------
|
5210 |
-
|
5211 |
-
// --------------------------------------------------------------------------------
|
5212 |
-
// Function : privDecrypt()
|
5213 |
-
// Description :
|
5214 |
-
// Parameters :
|
5215 |
-
// Return Values :
|
5216 |
-
// --------------------------------------------------------------------------------
|
5217 |
-
function privDecrypt($p_encryption_header, &$p_buffer, $p_size, $p_crc)
|
5218 |
-
{
|
5219 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDecrypt', "size=".$p_size."");
|
5220 |
-
$v_result=1;
|
5221 |
-
|
5222 |
-
// ----- To Be Modified ;-)
|
5223 |
-
$v_pwd = "test";
|
5224 |
-
|
5225 |
-
$p_buffer = PclZipUtilZipDecrypt($p_buffer, $p_size, $p_encryption_header,
|
5226 |
-
$p_crc, $v_pwd);
|
5227 |
-
|
5228 |
-
// ----- Return
|
5229 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5230 |
-
return $v_result;
|
5231 |
-
}
|
5232 |
-
// --------------------------------------------------------------------------------
|
5233 |
-
|
5234 |
-
// --------------------------------------------------------------------------------
|
5235 |
-
// Function : privDisableMagicQuotes()
|
5236 |
-
// Description :
|
5237 |
-
// Parameters :
|
5238 |
-
// Return Values :
|
5239 |
-
// --------------------------------------------------------------------------------
|
5240 |
-
function privDisableMagicQuotes()
|
5241 |
-
{
|
5242 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDisableMagicQuotes', "");
|
5243 |
-
$v_result=1;
|
5244 |
-
|
5245 |
-
// ----- Look if function exists
|
5246 |
-
if ( (!function_exists("get_magic_quotes_runtime"))
|
5247 |
-
|| (!function_exists("set_magic_quotes_runtime"))) {
|
5248 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
|
5249 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5250 |
-
return $v_result;
|
5251 |
-
}
|
5252 |
-
|
5253 |
-
// ----- Look if already done
|
5254 |
-
if ($this->magic_quotes_status != -1) {
|
5255 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote already disabled");
|
5256 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5257 |
-
return $v_result;
|
5258 |
-
}
|
5259 |
-
|
5260 |
-
// ----- Get and memorize the magic_quote value
|
5261 |
-
$this->magic_quotes_status = @get_magic_quotes_runtime();
|
5262 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Current magic_quotes_runtime status is '".($this->magic_quotes_status==0?'disable':'enable')."'");
|
5263 |
-
|
5264 |
-
// ----- Disable magic_quotes
|
5265 |
-
if ($this->magic_quotes_status == 1) {
|
5266 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Disable magic_quotes");
|
5267 |
-
@set_magic_quotes_runtime(0);
|
5268 |
-
}
|
5269 |
-
|
5270 |
-
// ----- Return
|
5271 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5272 |
-
return $v_result;
|
5273 |
-
}
|
5274 |
-
// --------------------------------------------------------------------------------
|
5275 |
-
|
5276 |
-
// --------------------------------------------------------------------------------
|
5277 |
-
// Function : privSwapBackMagicQuotes()
|
5278 |
-
// Description :
|
5279 |
-
// Parameters :
|
5280 |
-
// Return Values :
|
5281 |
-
// --------------------------------------------------------------------------------
|
5282 |
-
function privSwapBackMagicQuotes()
|
5283 |
-
{
|
5284 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privSwapBackMagicQuotes', "");
|
5285 |
-
$v_result=1;
|
5286 |
-
|
5287 |
-
// ----- Look if function exists
|
5288 |
-
if ( (!function_exists("get_magic_quotes_runtime"))
|
5289 |
-
|| (!function_exists("set_magic_quotes_runtime"))) {
|
5290 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
|
5291 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5292 |
-
return $v_result;
|
5293 |
-
}
|
5294 |
-
|
5295 |
-
// ----- Look if something to do
|
5296 |
-
if ($this->magic_quotes_status != -1) {
|
5297 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote not modified");
|
5298 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5299 |
-
return $v_result;
|
5300 |
-
}
|
5301 |
-
|
5302 |
-
// ----- Swap back magic_quotes
|
5303 |
-
if ($this->magic_quotes_status == 1) {
|
5304 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Enable back magic_quotes");
|
5305 |
-
@set_magic_quotes_runtime($this->magic_quotes_status);
|
5306 |
-
}
|
5307 |
-
|
5308 |
-
// ----- Return
|
5309 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5310 |
-
return $v_result;
|
5311 |
-
}
|
5312 |
-
// --------------------------------------------------------------------------------
|
5313 |
-
|
5314 |
-
}
|
5315 |
-
// End of class
|
5316 |
-
// --------------------------------------------------------------------------------
|
5317 |
-
|
5318 |
-
// --------------------------------------------------------------------------------
|
5319 |
-
// Function : PclZipUtilPathReduction()
|
5320 |
-
// Description :
|
5321 |
-
// Parameters :
|
5322 |
-
// Return Values :
|
5323 |
-
// --------------------------------------------------------------------------------
|
5324 |
-
function PclZipUtilPathReduction($p_dir)
|
5325 |
-
{
|
5326 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathReduction", "dir='$p_dir'");
|
5327 |
-
$v_result = "";
|
5328 |
-
|
5329 |
-
// ----- Look for not empty path
|
5330 |
-
if ($p_dir != "") {
|
5331 |
-
// ----- Explode path by directory names
|
5332 |
-
$v_list = explode("/", $p_dir);
|
5333 |
-
|
5334 |
-
// ----- Study directories from last to first
|
5335 |
-
$v_skip = 0;
|
5336 |
-
for ($i=sizeof($v_list)-1; $i>=0; $i--) {
|
5337 |
-
// ----- Look for current path
|
5338 |
-
if ($v_list[$i] == ".") {
|
5339 |
-
// ----- Ignore this directory
|
5340 |
-
// Should be the first $i=0, but no check is done
|
5341 |
-
}
|
5342 |
-
else if ($v_list[$i] == "..") {
|
5343 |
-
$v_skip++;
|
5344 |
-
}
|
5345 |
-
else if ($v_list[$i] == "") {
|
5346 |
-
// ----- First '/' i.e. root slash
|
5347 |
-
if ($i == 0) {
|
5348 |
-
$v_result = "/".$v_result;
|
5349 |
-
if ($v_skip > 0) {
|
5350 |
-
// ----- It is an invalid path, so the path is not modified
|
5351 |
-
// TBC
|
5352 |
-
$v_result = $p_dir;
|
5353 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid path is unchanged");
|
5354 |
-
$v_skip = 0;
|
5355 |
-
}
|
5356 |
-
}
|
5357 |
-
// ----- Last '/' i.e. indicates a directory
|
5358 |
-
else if ($i == (sizeof($v_list)-1)) {
|
5359 |
-
$v_result = $v_list[$i];
|
5360 |
-
}
|
5361 |
-
// ----- Double '/' inside the path
|
5362 |
-
else {
|
5363 |
-
// ----- Ignore only the double '//' in path,
|
5364 |
-
// but not the first and last '/'
|
5365 |
-
}
|
5366 |
-
}
|
5367 |
-
else {
|
5368 |
-
// ----- Look for item to skip
|
5369 |
-
if ($v_skip > 0) {
|
5370 |
-
$v_skip--;
|
5371 |
-
}
|
5372 |
-
else {
|
5373 |
-
$v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
|
5374 |
-
}
|
5375 |
-
}
|
5376 |
-
}
|
5377 |
-
|
5378 |
-
// ----- Look for skip
|
5379 |
-
if ($v_skip > 0) {
|
5380 |
-
while ($v_skip > 0) {
|
5381 |
-
$v_result = '../'.$v_result;
|
5382 |
-
$v_skip--;
|
5383 |
-
}
|
5384 |
-
}
|
5385 |
-
}
|
5386 |
-
|
5387 |
-
// ----- Return
|
5388 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5389 |
-
return $v_result;
|
5390 |
-
}
|
5391 |
-
// --------------------------------------------------------------------------------
|
5392 |
-
|
5393 |
-
// --------------------------------------------------------------------------------
|
5394 |
-
// Function : PclZipUtilPathInclusion()
|
5395 |
-
// Description :
|
5396 |
-
// This function indicates if the path $p_path is under the $p_dir tree. Or,
|
5397 |
-
// said in an other way, if the file or sub-dir $p_path is inside the dir
|
5398 |
-
// $p_dir.
|
5399 |
-
// The function indicates also if the path is exactly the same as the dir.
|
5400 |
-
// This function supports path with duplicated '/' like '//', but does not
|
5401 |
-
// support '.' or '..' statements.
|
5402 |
-
// Parameters :
|
5403 |
-
// Return Values :
|
5404 |
-
// 0 if $p_path is not inside directory $p_dir
|
5405 |
-
// 1 if $p_path is inside directory $p_dir
|
5406 |
-
// 2 if $p_path is exactly the same as $p_dir
|
5407 |
-
// --------------------------------------------------------------------------------
|
5408 |
-
function PclZipUtilPathInclusion($p_dir, $p_path)
|
5409 |
-
{
|
5410 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
|
5411 |
-
$v_result = 1;
|
5412 |
-
|
5413 |
-
// ----- Look for path beginning by ./
|
5414 |
-
if ( ($p_dir == '.')
|
5415 |
-
|| ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
|
5416 |
-
$p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
|
5417 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_dir '".$p_dir."'");
|
5418 |
-
}
|
5419 |
-
if ( ($p_path == '.')
|
5420 |
-
|| ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
|
5421 |
-
$p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
|
5422 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_path '".$p_path."'");
|
5423 |
-
}
|
5424 |
-
|
5425 |
-
// ----- Explode dir and path by directory separator
|
5426 |
-
$v_list_dir = explode("/", $p_dir);
|
5427 |
-
$v_list_dir_size = sizeof($v_list_dir);
|
5428 |
-
$v_list_path = explode("/", $p_path);
|
5429 |
-
$v_list_path_size = sizeof($v_list_path);
|
5430 |
-
|
5431 |
-
// ----- Study directories paths
|
5432 |
-
$i = 0;
|
5433 |
-
$j = 0;
|
5434 |
-
while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
|
5435 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Working on dir($i)='".$v_list_dir[$i]."' and path($j)='".$v_list_path[$j]."'");
|
5436 |
-
|
5437 |
-
// ----- Look for empty dir (path reduction)
|
5438 |
-
if ($v_list_dir[$i] == '') {
|
5439 |
-
$i++;
|
5440 |
-
continue;
|
5441 |
-
}
|
5442 |
-
if ($v_list_path[$j] == '') {
|
5443 |
-
$j++;
|
5444 |
-
continue;
|
5445 |
-
}
|
5446 |
-
|
5447 |
-
// ----- Compare the items
|
5448 |
-
if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) {
|
5449 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Items ($i,$j) are different");
|
5450 |
-
$v_result = 0;
|
5451 |
-
}
|
5452 |
-
|
5453 |
-
// ----- Next items
|
5454 |
-
$i++;
|
5455 |
-
$j++;
|
5456 |
-
}
|
5457 |
-
|
5458 |
-
// ----- Look if everything seems to be the same
|
5459 |
-
if ($v_result) {
|
5460 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Look for tie break");
|
5461 |
-
// ----- Skip all the empty items
|
5462 |
-
while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
|
5463 |
-
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
|
5464 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Looking on dir($i)='".($i < $v_list_dir_size?$v_list_dir[$i]:'')."' and path($j)='".($j < $v_list_path_size?$v_list_path[$j]:'')."'");
|
5465 |
-
|
5466 |
-
if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
|
5467 |
-
// ----- There are exactly the same
|
5468 |
-
$v_result = 2;
|
5469 |
-
}
|
5470 |
-
else if ($i < $v_list_dir_size) {
|
5471 |
-
// ----- The path is shorter than the dir
|
5472 |
-
$v_result = 0;
|
5473 |
-
}
|
5474 |
-
}
|
5475 |
-
|
5476 |
-
// ----- Return
|
5477 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5478 |
-
return $v_result;
|
5479 |
-
}
|
5480 |
-
// --------------------------------------------------------------------------------
|
5481 |
-
|
5482 |
-
// --------------------------------------------------------------------------------
|
5483 |
-
// Function : PclZipUtilCopyBlock()
|
5484 |
-
// Description :
|
5485 |
-
// Parameters :
|
5486 |
-
// $p_mode : read/write compression mode
|
5487 |
-
// 0 : src & dest normal
|
5488 |
-
// 1 : src gzip, dest normal
|
5489 |
-
// 2 : src normal, dest gzip
|
5490 |
-
// 3 : src & dest gzip
|
5491 |
-
// Return Values :
|
5492 |
-
// --------------------------------------------------------------------------------
|
5493 |
-
function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
|
5494 |
-
{
|
5495 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilCopyBlock", "size=$p_size, mode=$p_mode");
|
5496 |
-
$v_result = 1;
|
5497 |
-
|
5498 |
-
if ($p_mode==0)
|
5499 |
-
{
|
5500 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset before read :".(@ftell($p_src)));
|
5501 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset before write :".(@ftell($p_dest)));
|
5502 |
-
while ($p_size != 0)
|
5503 |
-
{
|
5504 |
-
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
5505 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5506 |
-
$v_buffer = @fread($p_src, $v_read_size);
|
5507 |
-
@fwrite($p_dest, $v_buffer, $v_read_size);
|
5508 |
-
$p_size -= $v_read_size;
|
5509 |
-
}
|
5510 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset after read :".(@ftell($p_src)));
|
5511 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset after write :".(@ftell($p_dest)));
|
5512 |
-
}
|
5513 |
-
else if ($p_mode==1)
|
5514 |
-
{
|
5515 |
-
while ($p_size != 0)
|
5516 |
-
{
|
5517 |
-
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
5518 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5519 |
-
$v_buffer = @gzread($p_src, $v_read_size);
|
5520 |
-
@fwrite($p_dest, $v_buffer, $v_read_size);
|
5521 |
-
$p_size -= $v_read_size;
|
5522 |
-
}
|
5523 |
-
}
|
5524 |
-
else if ($p_mode==2)
|
5525 |
-
{
|
5526 |
-
while ($p_size != 0)
|
5527 |
-
{
|
5528 |
-
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
5529 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5530 |
-
$v_buffer = @fread($p_src, $v_read_size);
|
5531 |
-
@gzwrite($p_dest, $v_buffer, $v_read_size);
|
5532 |
-
$p_size -= $v_read_size;
|
5533 |
-
}
|
5534 |
-
}
|
5535 |
-
else if ($p_mode==3)
|
5536 |
-
{
|
5537 |
-
while ($p_size != 0)
|
5538 |
-
{
|
5539 |
-
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
5540 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5541 |
-
$v_buffer = @gzread($p_src, $v_read_size);
|
5542 |
-
@gzwrite($p_dest, $v_buffer, $v_read_size);
|
5543 |
-
$p_size -= $v_read_size;
|
5544 |
-
}
|
5545 |
-
}
|
5546 |
-
|
5547 |
-
// ----- Return
|
5548 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5549 |
-
return $v_result;
|
5550 |
-
}
|
5551 |
-
// --------------------------------------------------------------------------------
|
5552 |
-
|
5553 |
-
// --------------------------------------------------------------------------------
|
5554 |
-
// Function : PclZipUtilRename()
|
5555 |
-
// Description :
|
5556 |
-
// This function tries to do a simple rename() function. If it fails, it
|
5557 |
-
// tries to copy the $p_src file in a new $p_dest file and then unlink the
|
5558 |
-
// first one.
|
5559 |
-
// Parameters :
|
5560 |
-
// $p_src : Old filename
|
5561 |
-
// $p_dest : New filename
|
5562 |
-
// Return Values :
|
5563 |
-
// 1 on success, 0 on failure.
|
5564 |
-
// --------------------------------------------------------------------------------
|
5565 |
-
function PclZipUtilRename($p_src, $p_dest)
|
5566 |
-
{
|
5567 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilRename", "source=$p_src, destination=$p_dest");
|
5568 |
-
$v_result = 1;
|
5569 |
-
|
5570 |
-
// ----- Try to rename the files
|
5571 |
-
if (!@rename($p_src, $p_dest)) {
|
5572 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to rename file, try copy+unlink");
|
5573 |
-
|
5574 |
-
// ----- Try to copy & unlink the src
|
5575 |
-
if (!@copy($p_src, $p_dest)) {
|
5576 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to copy file");
|
5577 |
-
$v_result = 0;
|
5578 |
-
}
|
5579 |
-
else if (!@unlink($p_src)) {
|
5580 |
-
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to unlink old filename");
|
5581 |
-
$v_result = 0;
|
5582 |
-
}
|
5583 |
-
}
|
5584 |
-
|
5585 |
-
// ----- Return
|
5586 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5587 |
-
return $v_result;
|
5588 |
-
}
|
5589 |
-
// --------------------------------------------------------------------------------
|
5590 |
-
|
5591 |
-
// --------------------------------------------------------------------------------
|
5592 |
-
// Function : PclZipUtilOptionText()
|
5593 |
-
// Description :
|
5594 |
-
// Translate option value in text. Mainly for debug purpose.
|
5595 |
-
// Parameters :
|
5596 |
-
// $p_option : the option value.
|
5597 |
-
// Return Values :
|
5598 |
-
// The option text value.
|
5599 |
-
// --------------------------------------------------------------------------------
|
5600 |
-
function PclZipUtilOptionText($p_option)
|
5601 |
-
{
|
5602 |
-
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
|
5603 |
-
|
5604 |
-
$v_list = get_defined_constants();
|
5605 |
-
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
|
5606 |
-
$v_prefix = substr($v_key, 0, 10);
|
5607 |
-
if (( ($v_prefix == 'PCLZIP_OPT')
|
5608 |
-
|| ($v_prefix == 'PCLZIP_CB_')
|
5609 |
-
|| ($v_prefix == 'PCLZIP_ATT'))
|
5610 |
-
&& ($v_list[$v_key] == $p_option)) {
|
5611 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_key);
|
5612 |
-
return $v_key;
|
5613 |
-
}
|
5614 |
-
}
|
5615 |
-
|
5616 |
-
$v_result = 'Unknown';
|
5617 |
-
|
5618 |
-
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5619 |
-
return $v_result;
|
5620 |
-
}
|
5621 |
-
// --------------------------------------------------------------------------------
|
5622 |
-
|
5623 |
-
// --------------------------------------------------------------------------------
|
5624 |
-
// Function : PclZipUtilTranslateWinPath()
|
5625 |
-
// Description :
|
5626 |
-
// Translate windows path by replacing '\' by '/' and optionally removing
|
5627 |
-
// drive letter.
|
5628 |
-
// Parameters :
|
5629 |
-
// $p_path : path to translate.
|
5630 |
-
// $p_remove_disk_letter : true | false
|
5631 |
-
// Return Values :
|
5632 |
-
// The path translated.
|
5633 |
-
// --------------------------------------------------------------------------------
|
5634 |
-
function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
|
5635 |
-
{
|
5636 |
-
if (stristr(php_uname(), 'windows')) {
|
5637 |
-
// ----- Look for potential disk letter
|
5638 |
-
if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
|
5639 |
-
$p_path = substr($p_path, $v_position+1);
|
5640 |
-
}
|
5641 |
-
// ----- Change potential windows directory separator
|
5642 |
-
if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
|
5643 |
-
$p_path = strtr($p_path, '\\', '/');
|
5644 |
-
}
|
5645 |
-
}
|
5646 |
-
return $p_path;
|
5647 |
-
}
|
5648 |
-
// --------------------------------------------------------------------------------
|
5649 |
-
|
5650 |
-
|
5651 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trunk/readme.txt
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
=== All in One SEO Pack ===
|
2 |
-
Contributors: hallsofmontezuma
|
3 |
-
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
-
Tags: post,google,seo,meta,meta keywords,meta description,title,posts,plugin, search engine optimization
|
5 |
-
Requires at least: 1.5
|
6 |
-
Tested up to: 2.8.1
|
7 |
-
Stable tag: trunk
|
8 |
-
|
9 |
-
Automatically optimizes your Wordpress blog for Search Engines (Search Engine Optimization).
|
10 |
-
|
11 |
-
== Description ==
|
12 |
-
|
13 |
-
**Optimizes** your Wordpress blog for Search Engines (**Search Engine Optimization**).
|
14 |
-
|
15 |
-
**[Download now!](http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip)**
|
16 |
-
|
17 |
-
**If upgrading, please back up your database first!**
|
18 |
-
|
19 |
-
[Support](http://semperfiwebdesign.com/forum/) |
|
20 |
-
[Change Log](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-pack-release-history/) |
|
21 |
-
[FAQ](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/)|
|
22 |
-
[Translations](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/translations-for-all-in-one-seo-pack/)
|
23 |
-
|
24 |
-
Some features:
|
25 |
-
|
26 |
-
* Canonical URLs
|
27 |
-
* Fine tune Page Navigational Links
|
28 |
-
* Built-in API so other plugins/themes can access and extend functionality
|
29 |
-
* Provides SEO Integration for WP e-Commerce sites
|
30 |
-
* Nonce Security
|
31 |
-
* Support for CMS-style WordPress installations
|
32 |
-
* Automatically optimizes your **titles** for search engines
|
33 |
-
* Generates **META tags automatically**
|
34 |
-
* Avoids the typical duplicate content found on Wordpress blogs
|
35 |
-
* For beginners, you don't even have to look at the options, it works out-of-the-box. Just install.
|
36 |
-
* For advanced users, you can fine-tune everything
|
37 |
-
* You can override any title and set any META description and any META keywords you want.
|
38 |
-
* Backward-Compatibility with many other plugins, like Auto Meta, Ultimate Tag Warrior and others.
|
39 |
-
|
40 |
-
Be sure to check out:
|
41 |
-
[WP Security Scan](http://wordpress.org/extend/plugins/wp-security-scan/)
|
42 |
-
and
|
43 |
-
[SMS Text Message](http://wordpress.org/extend/plugins/sms-text-message/)
|
44 |
-
|
45 |
-
Follow me on Twitter to keep up with the latest updates [Michael
|
46 |
-
Torbert](http://twitter.com/michaeltorbert/)
|
47 |
-
|
48 |
-
== Installation ==
|
49 |
-
|
50 |
-
You can use the built in installer and upgrader, or you can install the plugin
|
51 |
-
manually.
|
52 |
-
|
53 |
-
1. You can either use the automatic plugin installer or your FTP program to upload it to your wp-content/plugins directory
|
54 |
-
the top-level folder. Don't just upload all the php files and put them in `/wp-content/plugins/`.
|
55 |
-
1. Activate the plugin through the 'Plugins' menu in WordPress
|
56 |
-
1. Visit your SEO options (*Options - All in One SEO*) for Wordpress 2.3.x, (*Settings - All in One SEO*) for Wordpress 2.5.x-2.8.x
|
57 |
-
1. Configure any options as desired, and then enable the plugin
|
58 |
-
1. That's it!
|
59 |
-
|
60 |
-
If you have to upgrade manually simply repeat the installation steps and re-enable the plugin.
|
61 |
-
|
62 |
-
**If upgrading, please back up your database first!**
|
63 |
-
|
64 |
-
[Upgrade guide for upgrading from 1.5.x and below to
|
65 |
-
1.6.x](http://onefinejay.com/2009/07/11/a-guide-to-upgrading-to-aioseop-v1-6-1)
|
66 |
-
|
67 |
-
== Frequently Asked Questions ==
|
68 |
-
|
69 |
-
Please read these **[FAQs](http://semperfiwebdesign.com/documentation/all-in-one-seo-pack/all-in-one-seo-faq/)** before requesting
|
70 |
-
**[Support](http://semperfiwebdesign.com/forum/)**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|