Version Description
Download this release
Release Info
Developer | alexrabe |
Plugin | NextGEN Gallery – WordPress Gallery Plugin |
Version | 0.37 |
Comparing to | |
See all releases |
Version 0.37
- admin/about.php +88 -0
- admin/addgallery.php +487 -0
- admin/admin.php +37 -0
- admin/album.php +193 -0
- admin/index.html +0 -0
- admin/js/interface.js +12 -0
- admin/js/jquery.js +1 -0
- admin/js/portlets.css +65 -0
- admin/manage.php +473 -0
- admin/overview.php +177 -0
- admin/settings.php +538 -0
- admin/setup.php +53 -0
- admin/style.php +202 -0
- changelog.txt +33 -0
- css/Black_Minimalism .css +170 -0
- css/albumset.gif +0 -0
- css/ngg_shadow.css +169 -0
- css/nggallery.css +168 -0
- css/shadow.gif +0 -0
- css/shadowAlpha.png +0 -0
- fonts/arial.ttf +0 -0
- js/swfobject.js +138 -0
- lang/nggallery.po +1242 -0
- lib/pclzip.lib.php +5748 -0
- lib/thumbnail.inc.php +858 -0
- nggadmintab.php +11 -0
- nggallery.php +243 -0
- nggextractXML.php +56 -0
- nggfunctions.php +394 -0
- ngginstall.php +140 -0
- nggshow.php +61 -0
- readme.txt +93 -0
- screenshot-1.jpg +0 -0
- screenshot-2.jpg +0 -0
- screenshot-3.jpg +0 -0
- screenshot-4.jpg +0 -0
- thickbox/loadingAnimation.gif +0 -0
- thickbox/thickbox.css +133 -0
- thickbox/thickbox.js +342 -0
admin/about.php
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
3 |
+
|
4 |
+
function nggallery_admin_about() {
|
5 |
+
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div class="wrap">
|
9 |
+
<h2><?php _e('Copyright notes / Credits', 'nggallery') ;?></h2>
|
10 |
+
<fieldset class="options">
|
11 |
+
<legend><?php _e("About this plugin", 'nggallery'); ?></legend>
|
12 |
+
<p><?php _e('This plugin is written as last study on WordPress. I took the chance to learn PHP, WordPress and programming technics with this plugin.
|
13 |
+
If you study the code of this plugin, you will find out that I mixed a lot of good already existing code and ideas together.', 'nggallery') ;?></p>
|
14 |
+
<p><?php _e('So, I would like to thank the following people for their pioneer work (without this work it\'s impossible to create such a plugin so fast)', 'nggallery') ;?></p>
|
15 |
+
<ul>
|
16 |
+
<li><a href="http://wordpress.org" target="_blank">The WordPress Team</a> <?php _e('for their great documented code', 'nggallery') ;?></li>
|
17 |
+
<li><a href="http://jquery.com" target="_blank">The jQuery Team</a> <?php _e('for jQuery, which is the best Web2.0 framework', 'nggallery') ;?></li>
|
18 |
+
<li><a href="http://www.gen-x-design.com" target="_blank">Ian Selby</a> <?php _e('for the fantastic PHP Thumbnail Class', 'nggallery') ;?></li>
|
19 |
+
<li><a href="http://www.phpconcept.net" target="_blank">Vincent Blavet</a> <?php _e('for PclZip , a PHP library that manage ZIP archives', 'nggallery') ;?></li>
|
20 |
+
<li><a href="http://www.lesterchan.net/" target="_blank">GaMerZ</a> <?php _e('for a lot of very useful plugins and ideas', 'nggallery') ;?></li>
|
21 |
+
<li><a href="http://www.sargant.com/" target="_blank">Rob Sargant</a> <?php _e('for RS-Discuss, it saved me a lot of time', 'nggallery') ;?></li>
|
22 |
+
<li><a href="http://www.jeroenwijering.com/" target="_blank">Jeroen Wijering</a> <?php _e('for the best Media Flash Scripts on earth', 'nggallery') ;?></li>
|
23 |
+
<li><a href="http://watermark.malcherek.com/" target="_blank">Marek Malcherek</a> <?php _e('for the Watermark plugin', 'nggallery') ;?></li>
|
24 |
+
<li><a href="http://www.wildbits.de" target="_blank">Thomas Boley</a> <?php _e('for MyGallery, the best gallery plugin concept', 'nggallery') ;?></li>
|
25 |
+
</ul>
|
26 |
+
<p><?php _e('If you didn\'t find your name on this list and there is some code which I integrate in my plugin, don\'t hesitate to send me a mail.', 'nggallery') ;?></p>
|
27 |
+
<legend><?php _e("How to support ?", 'nggallery'); ?></legend>
|
28 |
+
<p><?php _e('There exist several ways to contribute, help or support me in this work. Non of them are mandatory.', 'nggallery') ;?></p>
|
29 |
+
<ul>
|
30 |
+
<li><strong><?php _e('Send me bugfixes / code changes', 'nggallery') ;?></strong><br /><?php _e('The most motivated support for this plugin are your ideas and brain work', 'nggallery') ;?></li>
|
31 |
+
<li><strong><?php _e('Translate my plugin', 'nggallery') ;?></strong><br /><?php _e('To help people to work with this plugin, I would like to have it in all avaivable languages', 'nggallery') ;?></li>
|
32 |
+
<li><strong><?php _e('Donate my work via paypal', 'nggallery') ;?></strong><br />
|
33 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" >
|
34 |
+
<input type="hidden" name="cmd" value="_xclick"/><input type="hidden" name="business" value="alterego@boelinger.com"/>
|
35 |
+
<input type="hidden" name="item_name" value="WordPress Plugins www.alexrabe.boelinger.com"/>
|
36 |
+
<input type="hidden" name="no_shipping" value="1"/><input type="hidden" name="return" value="http://alexrabe.boelinger.com/" />
|
37 |
+
<input type="hidden" name="cancel_return" value="http://alexrabe.boelinger.com/"/>
|
38 |
+
<input type="hidden" name="currency_code" value="USD"/>
|
39 |
+
<input type="hidden" name="tax" value="0"/>
|
40 |
+
<input type="hidden" name="bn" value="PP-DonationsBF"/>
|
41 |
+
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" style="border: none;"/>
|
42 |
+
</form><?php _e('No doubt a very usefull and easy motivation :-) I send you an email , when I can buy my first Audi S3 with this money...', 'nggallery') ;?>
|
43 |
+
</li>
|
44 |
+
<li><strong><?php _e('Place a link to my plugin in your blog/webpage', 'nggallery') ;?></strong><br /><?php _e('Yes, share and trackback is also a good support for this work ', 'nggallery') ;?></li>
|
45 |
+
</ul>
|
46 |
+
<legend><?php _e("Thanks!", 'nggallery'); ?></legend>
|
47 |
+
<p><?php _e('I would like to thank this people which support me in my work :', 'nggallery') ;?></p>
|
48 |
+
<p><a href="http://www.boelinger.com/heike/" target="_blank">HEIKE</a>, <?php ngg_list_support(); ?></p>
|
49 |
+
</fieldset>
|
50 |
+
</div>
|
51 |
+
|
52 |
+
<?php
|
53 |
+
}
|
54 |
+
|
55 |
+
function ngg_list_support() {
|
56 |
+
/* The list of my supporters. Thanks to all of them !*/
|
57 |
+
|
58 |
+
$supporter = array(
|
59 |
+
|
60 |
+
"Mike DAmbrose" => "http://www.videovisions.com/",
|
61 |
+
"Ideablogger" => "http://www.ablogofideas.net/",
|
62 |
+
"Chuck Coury" => "",
|
63 |
+
"Kelter" => "http://www.badcat.com",
|
64 |
+
"Martin Bahr" => "http://www.law-vodcast.de/",
|
65 |
+
"Marcel Kneuer" => "",
|
66 |
+
"Martin Bahr" => "http://www.law-vodcast.de/",
|
67 |
+
"Alakhnor" => "http://www.alakhnor.info",
|
68 |
+
"Rod" => "http://www.le-hiboo.com",
|
69 |
+
"Ttancm" => "http://www.ttancm.com/",
|
70 |
+
"Francoise Pescatore" => ""
|
71 |
+
);
|
72 |
+
|
73 |
+
ksort($supporter);
|
74 |
+
$i = count($supporter);
|
75 |
+
foreach ($supporter as $name => $url)
|
76 |
+
{
|
77 |
+
if ($url)
|
78 |
+
echo "<a href=\"$url\">$name</a>";
|
79 |
+
else
|
80 |
+
echo $name;
|
81 |
+
$i--;
|
82 |
+
if ($i == 1)
|
83 |
+
echo " & ";
|
84 |
+
elseif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|
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
3 |
+
|
4 |
+
include_once(NGGALLERY_ABSPATH.'/lib/thumbnail.inc.php');
|
5 |
+
|
6 |
+
function nggallery_admin_add_gallery() {
|
7 |
+
|
8 |
+
global $wpdb;
|
9 |
+
$ngg_options = get_option('ngg_options');
|
10 |
+
|
11 |
+
$defaultpath = $ngg_options[gallerypath];
|
12 |
+
|
13 |
+
if ($_POST['addgallery']){
|
14 |
+
$newgallery = $_POST['galleryname'];
|
15 |
+
if (!empty($newgallery))
|
16 |
+
$messagetext = ngg_create_gallery($newgallery, $defaultpath);
|
17 |
+
}
|
18 |
+
|
19 |
+
if ($_POST['zipupload']){
|
20 |
+
if ($_FILES['zipfile']['error'] == 0)
|
21 |
+
$messagetext = ngg_import_zipfile($defaultpath);
|
22 |
+
else
|
23 |
+
$messagetext = '<font color="res">'.__('Upload failed!','nggallery').'</font>';
|
24 |
+
}
|
25 |
+
|
26 |
+
if ($_POST['importfolder']){
|
27 |
+
$galleryfolder = $_POST['galleryfolder'];
|
28 |
+
if ((!empty($galleryfolder)) AND ($defaultpath != $galleryfolder))
|
29 |
+
$messagetext = ngg_import_gallery($galleryfolder);
|
30 |
+
}
|
31 |
+
|
32 |
+
if ($_POST['uploadimage']){
|
33 |
+
if ($_FILES['imagefiles']['error'] == 0)
|
34 |
+
$messagetext = ngg_upload_images($defaultpath);
|
35 |
+
else
|
36 |
+
$messagetext = '<font color="res">'.__('Upload failed!','nggallery').'</font>';
|
37 |
+
}
|
38 |
+
|
39 |
+
// message windows
|
40 |
+
if(!empty($messagetext)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; }
|
41 |
+
|
42 |
+
?>
|
43 |
+
<script type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/jquery.js"></script>
|
44 |
+
<script type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/interface.js"></script>
|
45 |
+
<script type="text/javascript">
|
46 |
+
var currentTab = null;
|
47 |
+
var inSlide = false;
|
48 |
+
$(document).ready(
|
49 |
+
function()
|
50 |
+
{
|
51 |
+
var url, tab = 0, tabIteration = 0;
|
52 |
+
|
53 |
+
url = window.location.href.split("#");
|
54 |
+
if (url.length == 2 && url[1].indexOf('-slider') > 0) {
|
55 |
+
currentTab = $('#' + url[1].substr(0, url[1].length-7));
|
56 |
+
if (currentTab.size() == 1) {
|
57 |
+
$('#slider div').each(
|
58 |
+
function(iteration)
|
59 |
+
{
|
60 |
+
if(this === currentTab.get(0)) {
|
61 |
+
tabIteration = iteration;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
);
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
if(!currentTab) {
|
69 |
+
currentTab = $('#slider div:first');
|
70 |
+
}
|
71 |
+
|
72 |
+
currentTab.SlideToggleUp(500);
|
73 |
+
$('#tabs a')
|
74 |
+
.eq(tabIteration).addClass('active')
|
75 |
+
.end()
|
76 |
+
.bind('click', switchTab);
|
77 |
+
}
|
78 |
+
);
|
79 |
+
|
80 |
+
var switchTab = function()
|
81 |
+
{
|
82 |
+
// get id from link
|
83 |
+
var tabName = this.href.split('#')[1];
|
84 |
+
this.blur();
|
85 |
+
if (inSlide == false && currentTab.get(0) != $('#' + tabName.substr(0, tabName.length-7)).get(0)) {
|
86 |
+
$('#tabs a').removeClass('active');
|
87 |
+
$(this).addClass('active');
|
88 |
+
inSlide = true;
|
89 |
+
currentTab.SlideToggleUp(
|
90 |
+
500,
|
91 |
+
function()
|
92 |
+
{
|
93 |
+
currentTab = $('#' + tabName.substr(0, tabName.length-7)).SlideToggleUp(500, function(){inSlide=false;});
|
94 |
+
}
|
95 |
+
);
|
96 |
+
} else {
|
97 |
+
return false;
|
98 |
+
}
|
99 |
+
};
|
100 |
+
</script>
|
101 |
+
<div class="wrap" style="text-align: center">
|
102 |
+
<div id="tabs">
|
103 |
+
<a href="#addgallery-slider"><?php _e('Add new gallery', 'nggallery') ;?></a> -
|
104 |
+
<?php if (!SAFE_MODE) { ?>
|
105 |
+
<a href="#zipupload-slider"><?php _e('Upload a Zip-File', 'nggallery') ;?></a> -
|
106 |
+
<?php } ?>
|
107 |
+
<a href="#importfolder-slider"><?php _e('Import image folder', 'nggallery') ;?></a> -
|
108 |
+
<a href="#uploadimage-slider"><?php _e('Upload Images', 'nggallery') ;?></a>
|
109 |
+
</div>
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<div id="slider">
|
113 |
+
<!-- create gallery -->
|
114 |
+
<div id="addgallery" class="wrap" style="display:none">
|
115 |
+
<h2><?php _e('Add new gallery', 'nggallery') ;?></h2>
|
116 |
+
<form name="addgallery" id="post" method="POST" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>" >
|
117 |
+
<fieldset class="options">
|
118 |
+
<table class="optiontable">
|
119 |
+
<tr valign="top">
|
120 |
+
<th scope="row"><?php _e('New Gallery', 'nggallery') ;?>:</th>
|
121 |
+
<td><input type="text" size="35" name="galleryname" value="" /><br />
|
122 |
+
<?php _e('Create a new , empty gallery below the folder', 'nggallery') ;?> <strong><?php echo $defaultpath ?></strong><br />
|
123 |
+
<i>( <?php _e('Allowed characters for file and folder names are', 'nggallery') ;?>: a-z, A-Z, 0-9, -, _ )</i></td>
|
124 |
+
</tr>
|
125 |
+
</table>
|
126 |
+
<div class="submit"><input type="submit" name= "addgallery" value="<?php _e('Add gallery', 'nggallery') ;?>"/></div>
|
127 |
+
</fieldset>
|
128 |
+
</form>
|
129 |
+
</div>
|
130 |
+
<!-- zip-file operation -->
|
131 |
+
<div id="zipupload" class="wrap" style="display:none">
|
132 |
+
<h2><?php _e('Upload a Zip-File', 'nggallery') ;?></h2>
|
133 |
+
<form name="zipupload" id="post" method="POST" enctype="multipart/form-data" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']).'#zipupload-slider'; ?>" >
|
134 |
+
<fieldset class="options">
|
135 |
+
<table class="optiontable">
|
136 |
+
<tr valign="top">
|
137 |
+
<th scope="row"><?php _e('Select Zip-File', 'nggallery') ;?>:</th>
|
138 |
+
<td><input type="file" name="zipfile" id="zipfile" size="35" class="uploadform"/><br />
|
139 |
+
<?php _e('Upload a zip file with images', 'nggallery') ;?></td>
|
140 |
+
</tr>
|
141 |
+
</table>
|
142 |
+
<div class="submit"> <input type="submit" name= "zipupload" value="<?php _e('Start upload', 'nggallery') ;?>"/></div>
|
143 |
+
</fieldset>
|
144 |
+
</form>
|
145 |
+
</div>
|
146 |
+
<!-- import folder -->
|
147 |
+
<div id="importfolder" class="wrap" style="display:none">
|
148 |
+
<h2><?php _e('Import image folder', 'nggallery') ;?></h2>
|
149 |
+
<form name="importfolder" id="post" method="POST" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']).'#importfolder-slider'; ?>" >
|
150 |
+
<fieldset class="options">
|
151 |
+
<table class="optiontable">
|
152 |
+
<tr valign="top">
|
153 |
+
<th scope="row"><?php _e('Import from Server path:', 'nggallery') ;?><br /><code><?php echo WINABSPATH; ?></code></th>
|
154 |
+
<td><br /><input type="text" size="35" name="galleryfolder" value="<?php echo$defaultpath; ?>" /><br />
|
155 |
+
<?php _e('Import a folder with images. Please note :', 'nggallery') ;?><br />
|
156 |
+
<?php _e('For save_mode = ON you need to add the subfolder thumbs manually', 'nggallery') ;?></td>
|
157 |
+
</tr>
|
158 |
+
</table>
|
159 |
+
<div class="submit"> <input type="submit" name= "importfolder" value="<?php _e('Import folder', 'nggallery') ;?>"/></div>
|
160 |
+
</fieldset>
|
161 |
+
</form>
|
162 |
+
</div>
|
163 |
+
<!-- upload images -->
|
164 |
+
<div id="uploadimage" class="wrap" style="display:none">
|
165 |
+
<h2><?php _e('Upload Images', 'nggallery') ;?></h2>
|
166 |
+
<form name="uploadimage" id="post" method="POST" enctype="multipart/form-data" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']).'#uploadimage-slider'; ?>" >
|
167 |
+
<fieldset class="options">
|
168 |
+
<table class="optiontable">
|
169 |
+
<tr valign="top">
|
170 |
+
<th scope="row"><?php _e('Upload image', 'nggallery') ;?></th>
|
171 |
+
<td><input type="file" name="imagefiles" id="imagefiles" size="35" class="uploadform"/></td>
|
172 |
+
</tr>
|
173 |
+
<tr valign="top">
|
174 |
+
<th scope="row"><?php _e('in to', 'nggallery') ;?></th>
|
175 |
+
<td><select name="galleryselect">
|
176 |
+
<option value="0" ><?php _e('Choose gallery', 'nggallery') ?></option>
|
177 |
+
<?php
|
178 |
+
$gallerylist = $wpdb->get_results("SELECT * FROM $wpdb->nggallery ORDER BY gid ASC");
|
179 |
+
if(is_array($gallerylist)) {
|
180 |
+
foreach($gallerylist as $gallery) {
|
181 |
+
echo '<option value="'.$gallery->gid.'" >'.$gallery->name.' | '.$gallery->title.'</option>'."\n";
|
182 |
+
}
|
183 |
+
}
|
184 |
+
?>
|
185 |
+
</select>
|
186 |
+
<br /><?php _e('At the moment only a single file upload is supported.', 'nggallery') ;?></td>
|
187 |
+
</tr>
|
188 |
+
</table>
|
189 |
+
<div class="submit"><input type="submit" name= "uploadimage" value="<?php _e('Upload images', 'nggallery') ;?>"/></div>
|
190 |
+
</fieldset>
|
191 |
+
</form>
|
192 |
+
</div>
|
193 |
+
</div>
|
194 |
+
|
195 |
+
<?php
|
196 |
+
}
|
197 |
+
|
198 |
+
// **************************************************************
|
199 |
+
function ngg_create_gallery($galleryname, $defaultpath) {
|
200 |
+
// create a new gallery & folder
|
201 |
+
global $wpdb;
|
202 |
+
|
203 |
+
$myabspath = str_replace("\\","/",ABSPATH); // required for windows
|
204 |
+
|
205 |
+
//cleanup pathname
|
206 |
+
$new_pathname = strtolower(preg_replace ("/(\s+)/", '-',$galleryname));
|
207 |
+
$new_pathname = preg_replace('|[^a-z0-9-]|i', '', $new_pathname);
|
208 |
+
|
209 |
+
if (empty($new_pathname)) return '<font color="red">'.__('No valid gallery name!', 'nggallery'). '</font>';
|
210 |
+
if ( substr(decoct(@fileperms($myabspath.$defaultpath)),1) != '0777' )
|
211 |
+
return '<font color="red">'.__('Directory', 'nggallery').' <strong>'.$defaultpath.'</strong> '.__('didn\'t have the permissions 777!', 'nggallery').'</font>';
|
212 |
+
|
213 |
+
$nggpath = $defaultpath.$new_pathname;
|
214 |
+
|
215 |
+
if (is_dir($myabspath.$nggpath))
|
216 |
+
return '<font color="red">'.__('Directory', 'nggallery').' <strong>'.$nggpath.'</strong> '.__('already exists!', 'nggallery').'</font>';
|
217 |
+
|
218 |
+
// create new directories
|
219 |
+
if (!SAFE_MODE) {
|
220 |
+
if (!@mkdir ($myabspath.$nggpath,0777)) return ('<font color="red">'.__('Unable to create directory ', 'nggallery').$nggpath.'!</font>');
|
221 |
+
if (!@chmod ($myabspath.$nggpath,0777)) return ('<font color="red">'.__('Unable to set directory permissions ', 'nggallery').$nggpath.'!</font>');
|
222 |
+
if (!@mkdir ($myabspath.$nggpath.'/thumbs',0777)) return ('<font color="red">'.__('Unable to create directory ', 'nggallery').$nggpath.'/thumbs !</font>');
|
223 |
+
if (!@chmod ($myabspath.$nggpath.'/thumbs',0777)) return ('<font color="red">'.__('Unable to set directory permissions', 'nggallery').$nggpath.'/thumbs !</font>');
|
224 |
+
} else {
|
225 |
+
$safemode = '<br /><font color="green">'.__('The server Safe-Mode is on !', 'nggallery');
|
226 |
+
$safemode .= '<br />'.__('Please create directory ', 'nggallery').'<strong>'.$nggpath.'</strong> ';
|
227 |
+
$safemode .= __('and the thumbnails directory ', 'nggallery').'<strong>'.$nggpath.'/thumbs</strong> '.__('with permission 777 manually !', 'nggallery').'</font>';
|
228 |
+
}
|
229 |
+
$result=$wpdb->get_var("SELECT name FROM $wpdb->nggallery WHERE name = '$galleryname' ");
|
230 |
+
if ($result) {
|
231 |
+
return '<font color="red">'.__('Gallery', 'nggallery').' <strong>'.$newgallery.'</strong> '.__('already exists', 'nggallery').'</font>';
|
232 |
+
} else {
|
233 |
+
$result = $wpdb->query("INSERT INTO $wpdb->nggallery (name, path) VALUES ('$galleryname', '$nggpath') ");
|
234 |
+
if ($result) return '<font color="green">'.__('Gallery successfully created!','nggallery').'</font>'.$safemode;
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
// **************************************************************
|
239 |
+
function ngg_import_gallery($galleryfolder) {
|
240 |
+
// ** $galleryfolder contains relative path
|
241 |
+
|
242 |
+
//TODO: Check permission of existing thumb folder & images
|
243 |
+
|
244 |
+
// import a existing folder
|
245 |
+
global $wpdb;
|
246 |
+
|
247 |
+
// remove trailing slash at the end, if somebody use it
|
248 |
+
if (substr($galleryfolder, -1) == '/') $galleryfolder = substr($galleryfolder, 0, -1);
|
249 |
+
$gallerypath = WINABSPATH.$galleryfolder;
|
250 |
+
|
251 |
+
if (!is_dir($gallerypath)) return '<font color="red">'.__('Directory', 'nggallery').' <strong>'.$gallerypath.'</strong> '.__('doesn`t exist', 'nggallery').'!</font>';
|
252 |
+
|
253 |
+
// read list of images
|
254 |
+
$imageslist = ngg_scandir($gallerypath);
|
255 |
+
if (empty($imageslist)) return '<font color="blue">'.__('Directory', 'nggallery').' <strong>'.$gallerypath.'</strong> '.__('contains no pictures', 'nggallery').'!</font>';
|
256 |
+
|
257 |
+
// create thumbnail folder
|
258 |
+
$check_thumbnail_folder = ngg_get_thumbnail_folder($gallerypath);
|
259 |
+
if (!$check_thumbnail_folder) {
|
260 |
+
if (SAFE_MODE) return '<font color="red">'.__('Thumbnail Directory', 'nggallery').' <strong>'.$gallerypath.'/thumbs</strong> '.__('doesn`t exist', 'nggallery').'!<br />'.__('Please create the folder <i>thumbs</i> in your gallery folder.', 'nggallery').'</font>';
|
261 |
+
else @mkdir ($gallerypath.'/thumbs',0777) or die ('<font color="red">'.__('Unable to create directory ', 'nggallery').$gallerypath.'/thumbs !</font>');
|
262 |
+
}
|
263 |
+
|
264 |
+
// take folder name as gallery name
|
265 |
+
$galleryname = basename($galleryfolder);
|
266 |
+
|
267 |
+
$result = $wpdb->query("INSERT INTO $wpdb->nggallery (name, path) VALUES ('$galleryname', '$galleryfolder') ");
|
268 |
+
if (!$result) return '<font color="red">'.__('Database error. Could not add gallery!','nggallery').'</font>';
|
269 |
+
$gallery_id = $wpdb->insert_id; // get index_id
|
270 |
+
|
271 |
+
//create thumbnails
|
272 |
+
ngg_generatethumbnail($gallerypath,$imageslist);
|
273 |
+
|
274 |
+
// add images to database
|
275 |
+
if (is_array($imageslist)) {
|
276 |
+
foreach($imageslist as $picture) {
|
277 |
+
$result = $wpdb->query("INSERT INTO $wpdb->nggpictures (galleryid, filename, alttext) VALUES ('$gallery_id', '$picture', '$picture') ");
|
278 |
+
if ($result) $count_pic++;
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
return '<font color="green">'.__('Gallery','nggallery').' <strong>'.$galleryname.'</strong> '.__('successfully created!','nggallery').'<br />'.$count_pic.__(' pictures added.','nggallery').'</font>';
|
283 |
+
|
284 |
+
}
|
285 |
+
// **************************************************************
|
286 |
+
function ngg_scandir($dirname=".") {
|
287 |
+
// thx to php.net :-)
|
288 |
+
$ext = array("jpg", "png", "gif");
|
289 |
+
$files = array();
|
290 |
+
if($handle = opendir($dirname)) {
|
291 |
+
while(false !== ($file = readdir($handle)))
|
292 |
+
for($i=0;$i<sizeof($ext);$i++)
|
293 |
+
if(stristr($file, ".".$ext[$i]))
|
294 |
+
$files[] = $file;
|
295 |
+
closedir($handle);
|
296 |
+
}
|
297 |
+
return($files);
|
298 |
+
}
|
299 |
+
|
300 |
+
// **************************************************************
|
301 |
+
function ngg_resizeImages($gallery_absfolder, $pictures) {
|
302 |
+
// ** $gallery_absfolder must contain abspath !!
|
303 |
+
|
304 |
+
$ngg_options = get_option('ngg_options');
|
305 |
+
|
306 |
+
if (is_array($pictures)) {
|
307 |
+
foreach($pictures as $picture) {
|
308 |
+
|
309 |
+
//TODO: Check for file permission
|
310 |
+
$thumb = new Thumbnail($gallery_absfolder."/".$picture, TRUE);
|
311 |
+
// echo $thumb->errmsg;
|
312 |
+
// skip if file is not there
|
313 |
+
if (!$thumb->error) {
|
314 |
+
echo $gallery_absfolder."/".$picture;
|
315 |
+
$thumb->resize($ngg_options[imgWidth],$ngg_options[imgHeight],$ngg_options[imgResampleMode]);
|
316 |
+
$thumb->save($gallery_absfolder."/".$picture,$ngg_options[imgQuality]);
|
317 |
+
}
|
318 |
+
$thumb->destruct();
|
319 |
+
}
|
320 |
+
}
|
321 |
+
|
322 |
+
return;
|
323 |
+
}
|
324 |
+
|
325 |
+
// **************************************************************
|
326 |
+
function ngg_generateWatermark($gallery_absfolder, $pictures) {
|
327 |
+
// ** $gallery_absfolder must contain abspath !!
|
328 |
+
|
329 |
+
$ngg_options = get_option('ngg_options');
|
330 |
+
|
331 |
+
if (is_array($pictures)) {
|
332 |
+
foreach($pictures as $picture) {
|
333 |
+
|
334 |
+
//TODO: Check for file permission
|
335 |
+
$thumb = new Thumbnail($gallery_absfolder."/".$picture, TRUE);
|
336 |
+
// echo $thumb->errmsg;
|
337 |
+
// skip if file is not there
|
338 |
+
if (!$thumb->error) {
|
339 |
+
if ($ngg_options[wmType] == 'image') {
|
340 |
+
$thumb->watermarkImgPath = $ngg_options[wmPath];
|
341 |
+
$thumb->watermarkImage($ngg_options[wmPos], $ngg_options[wmXpos], $ngg_options[wmYpos]);
|
342 |
+
}
|
343 |
+
if ($ngg_options[wmType] == 'text') {
|
344 |
+
$thumb->watermarkText = $ngg_options[wmText];
|
345 |
+
$thumb->watermarkCreateText($ngg_options[wmColor], $ngg_options[wmFont], $ngg_options[wmSize], $ngg_options[wmOpaque]);
|
346 |
+
$thumb->watermarkImage($ngg_options[wmPos], $ngg_options[wmXpos], $ngg_options[wmYpos]);
|
347 |
+
}
|
348 |
+
$thumb->save($gallery_absfolder."/".$picture,$ngg_options[imgQuality]);
|
349 |
+
}
|
350 |
+
$thumb->destruct();
|
351 |
+
}
|
352 |
+
}
|
353 |
+
|
354 |
+
return;
|
355 |
+
}
|
356 |
+
|
357 |
+
// **************************************************************
|
358 |
+
function ngg_generatethumbnail($gallery_absfolder, $pictures) {
|
359 |
+
// ** $gallery_absfolder must contain abspath !!
|
360 |
+
|
361 |
+
$ngg_options = get_option('ngg_options');
|
362 |
+
|
363 |
+
$prefix = ngg_get_thumbnail_prefix($gallery_absfolder);
|
364 |
+
$thumbfolder = ngg_get_thumbnail_folder($gallery_absfolder);
|
365 |
+
|
366 |
+
if (is_array($pictures)) {
|
367 |
+
foreach($pictures as $picture) {
|
368 |
+
|
369 |
+
$thumb = new Thumbnail($gallery_absfolder."/".$picture, TRUE);
|
370 |
+
|
371 |
+
// echo $thumb->errmsg;
|
372 |
+
// skip if file is not there
|
373 |
+
if (!$thumb->error) {
|
374 |
+
if ($ngg_options[thumbcrop]) $thumb->cropFromCenter($ngg_options[thumbwidth],$ngg_options[thumbResampleMode]);
|
375 |
+
else $thumb->resize($ngg_options[thumbwidth],$ngg_options[thumbheight],$ngg_options[thumbResampleMode]);
|
376 |
+
$thumb->save($gallery_absfolder.$thumbfolder.$prefix.$picture,$ngg_options[thumbquality]);
|
377 |
+
}
|
378 |
+
$thumb->destruct();
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
return;
|
383 |
+
}
|
384 |
+
|
385 |
+
// **************************************************************
|
386 |
+
function ngg_unzip($dir, $file) {
|
387 |
+
// thx to Gregor at http://blog.scoutpress.de/forum/topic/45
|
388 |
+
|
389 |
+
require_once(NGGALLERY_ABSPATH.'/lib/pclzip.lib.php');
|
390 |
+
|
391 |
+
$archive = new PclZip($file);
|
392 |
+
|
393 |
+
if ($archive->extract(PCLZIP_OPT_PATH, $dir) == 0) {
|
394 |
+
die("Error : ".$archive->errorInfo(true));
|
395 |
+
}
|
396 |
+
|
397 |
+
return;
|
398 |
+
}
|
399 |
+
|
400 |
+
// **************************************************************
|
401 |
+
function ngg_import_zipfile($defaultpath) {
|
402 |
+
|
403 |
+
$temp_zipfile = $_FILES['zipfile']['tmp_name'];
|
404 |
+
$filename = $_FILES['zipfile']['name'];
|
405 |
+
|
406 |
+
// check if file is a zip file
|
407 |
+
if ( $_FILES['zipfile']['type'] != "application/x-zip-compressed" ) {
|
408 |
+
@unlink($temp_zipfile); // del temp file
|
409 |
+
return '<font color="red">'.__('Uploaded file was no or a faulty zip file ! The server recognize : ','nggallery').$_FILES['zipfile']['type'].'</font>';
|
410 |
+
}
|
411 |
+
|
412 |
+
//cleanup and take the zipfile name as folder name
|
413 |
+
$foldername = preg_replace ("/(\s+)/", '-', strtolower(strtok ($filename,'.')));
|
414 |
+
$newfolder = WINABSPATH.$defaultpath.$foldername;
|
415 |
+
|
416 |
+
if (!is_dir($newfolder)) {
|
417 |
+
// create new directories
|
418 |
+
if (!@mkdir ($newfolder, 0777)) return ('<font color="red">'.__('Unable to create directory ', 'nggallery').$newfolder.'!</font>');
|
419 |
+
if (!@chmod ($newfolder, 0777)) return ('<font color="red">'.__('Unable to set directory permissions ', 'nggallery').$newfolder.'!</font>');
|
420 |
+
if (!@mkdir ($newfolder.'/thumbs', 0777)) return ('<font color="red">'.__('Unable to create directory ', 'nggallery').$newfolder.'/thumbs !</font>');
|
421 |
+
if (!@chmod ($newfolder.'/thumbs', 0777)) return ('<font color="red">'.__('Unable to set directory permissions ', 'nggallery').$newfolder.'/thumbs !</font>');
|
422 |
+
}
|
423 |
+
else {
|
424 |
+
return '<font color="red">'.__('Directory already exists, please rename zip file', 'nggallery').'!</font>';
|
425 |
+
}
|
426 |
+
|
427 |
+
// unzip and del temp file
|
428 |
+
ngg_unzip($newfolder, $temp_zipfile);
|
429 |
+
@unlink($temp_zipfile) or die ('<div class="updated"><p><strong>'.__('Unable to unlink zip file ', 'nggallery').$temp_zipfile.'!</strong></p></div>');
|
430 |
+
|
431 |
+
$messagetext = '<font color="green">'.__('Zip-File successfully unpacked','nggallery').'</font><br />';
|
432 |
+
|
433 |
+
// parse now the folder and add to database
|
434 |
+
$messagetext .= ngg_import_gallery($defaultpath.$foldername);
|
435 |
+
|
436 |
+
return $messagetext;
|
437 |
+
}
|
438 |
+
|
439 |
+
// **************************************************************
|
440 |
+
function ngg_upload_images($defaultpath) {
|
441 |
+
// upload of pictures
|
442 |
+
//TODO: Multiple upload form
|
443 |
+
|
444 |
+
global $wpdb;
|
445 |
+
|
446 |
+
$temp_file = $_FILES['imagefiles']['tmp_name'];
|
447 |
+
$filename = $_FILES['imagefiles']['name'];
|
448 |
+
|
449 |
+
$dest_gallery = $_POST['galleryselect'];
|
450 |
+
if ($dest_gallery == 0) {
|
451 |
+
@unlink($temp_file) or die ('<div class="updated"><p><strong>'.__('Unable to unlink file ', 'nggallery').$temp_zipfile.'!</strong></p></div>');
|
452 |
+
return '<font color="red">'.__('No gallery selected !','nggallery').'</font>';
|
453 |
+
}
|
454 |
+
|
455 |
+
// get the path to the gallery
|
456 |
+
$gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$dest_gallery' ");
|
457 |
+
if (!$gallerypath){
|
458 |
+
@unlink($temp_file) or die ('<div class="updated"><p><strong>'.__('Unable to unlink file ', 'nggallery').$temp_zipfile.'!</strong></p></div>');
|
459 |
+
return '<font color="red">'.__('Failure in database, no gallery path set !','nggallery').'</font>';
|
460 |
+
}
|
461 |
+
|
462 |
+
$dest_file = WINABSPATH.$gallerypath."/".$filename;
|
463 |
+
|
464 |
+
// save temp file to gallery
|
465 |
+
if (!@move_uploaded_file($_FILES['imagefiles']['tmp_name'], $dest_file)) return '<font color="red">'.__('Error, the file could not moved to : ','nggallery').$dest_file.'</font>';
|
466 |
+
if (!@chmod ($dest_file, 0666)) return '<font color="red">'.__('Error, the file permissions could not set','nggallery').'</font>';
|
467 |
+
|
468 |
+
// Images must be an array
|
469 |
+
$imageslist = array();
|
470 |
+
$imageslist[] = $filename;
|
471 |
+
|
472 |
+
//create thumbnails
|
473 |
+
ngg_generatethumbnail(WINABSPATH.$gallerypath,$imageslist);
|
474 |
+
|
475 |
+
// add images to database
|
476 |
+
if (is_array($imageslist)) {
|
477 |
+
foreach($imageslist as $picture) {
|
478 |
+
$result = $wpdb->query("INSERT INTO $wpdb->nggpictures (galleryid, filename, alttext) VALUES ('$dest_gallery', '$picture', '$picture') ");
|
479 |
+
if ($result) $count_pic++;
|
480 |
+
}
|
481 |
+
}
|
482 |
+
|
483 |
+
return '<font color="green">'.__('Images successfully added','nggallery').'</font>';
|
484 |
+
|
485 |
+
} // end function
|
486 |
+
|
487 |
+
?>
|
admin/admin.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// ************************************
|
3 |
+
// ** Admin Section for NextGEN Gallery
|
4 |
+
// ** for V 0.01
|
5 |
+
// ** by Alex Rabe
|
6 |
+
// ************************************
|
7 |
+
|
8 |
+
// add to menu
|
9 |
+
add_action('admin_menu', 'add_nextgen_gallery_menu');
|
10 |
+
|
11 |
+
function add_nextgen_gallery_menu()
|
12 |
+
{
|
13 |
+
add_menu_page(__('Gallery', 'nggallery'), __('Gallery', 'nggallery'), 'edit_others_posts', NGGFOLDER, 'nggallery_admin_overview');
|
14 |
+
add_submenu_page( NGGFOLDER , __('Add Gallery', 'nggallery'), __('Add Gallery', 'nggallery'), 'edit_others_posts', 'nggallery-add-gallery', 'nggallery_admin_add_gallery');
|
15 |
+
add_submenu_page( NGGFOLDER , __('Manage Gallery', 'nggallery'), __('Manage Gallery', 'nggallery'), 'edit_others_posts', 'nggallery-manage-gallery', 'nggallery_admin_manage_gallery');
|
16 |
+
add_submenu_page( NGGFOLDER , __('Album', 'nggallery'), __('Album', 'nggallery'), 'edit_others_posts', 'nggallery-manage-album', 'nggallery_admin_manage_album');
|
17 |
+
add_submenu_page( NGGFOLDER , __('Options', 'nggallery'), __('Options', 'nggallery'), 'manage_options', 'nggallery-options', 'nggallery_admin_options');
|
18 |
+
add_submenu_page( NGGFOLDER , __('Style', 'nggallery'), __('Style', 'nggallery'), 'manage_options', 'nggallery-style', 'nggallery_admin_style');
|
19 |
+
add_submenu_page( NGGFOLDER , __('Setup Gallery', 'nggallery'), __('Setup', 'nggallery'), 'manage_options', 'nggallery-setup', 'nggallery_admin_setup');
|
20 |
+
add_submenu_page( NGGFOLDER , __('About this Gallery', 'nggallery'), __('About', 'nggallery'), 'edit_others_posts', 'nggallery-about', 'nggallery_admin_about');
|
21 |
+
}
|
22 |
+
//TODO: Check Rights and Role
|
23 |
+
|
24 |
+
/************************************************************************/
|
25 |
+
|
26 |
+
include 'overview.php'; // nggallery_admin_overview
|
27 |
+
include 'addgallery.php'; // nggallery_admin_add_gallery
|
28 |
+
include 'manage.php'; // nggallery_admin_manage_gallery
|
29 |
+
include 'album.php'; // nggallery_admin_manage_album
|
30 |
+
include 'settings.php'; // nggallery_admin_options
|
31 |
+
include 'style.php'; // nggallery_admin_style
|
32 |
+
include 'setup.php'; // nggallery_admin_setup
|
33 |
+
include 'about.php'; // nggallery_admin_about
|
34 |
+
|
35 |
+
/**************************************************************************/
|
36 |
+
|
37 |
+
?>
|
admin/album.php
ADDED
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
function nggallery_admin_manage_album() {
|
8 |
+
global $wpdb;
|
9 |
+
|
10 |
+
if ($_POST['update']){
|
11 |
+
if ($_POST['newalbum']){
|
12 |
+
$newablum = $_POST['newalbum'];
|
13 |
+
$result = $wpdb->query(" INSERT INTO $wpdb->nggalbum (name, sortorder) VALUES ('$newablum','0')");
|
14 |
+
if ($result) $messagetext = '<font color="green">'.__('Update Successfully','nggallery').'</font>';
|
15 |
+
}
|
16 |
+
|
17 |
+
if ($_POST['act_album'] > 0){
|
18 |
+
$albumid = $_POST['act_album'];
|
19 |
+
|
20 |
+
// get variable galleryContainer
|
21 |
+
parse_str($_POST['sortorder']);
|
22 |
+
if (is_array($galleryContainer)){
|
23 |
+
$sortorder = array();
|
24 |
+
foreach($galleryContainer as $gallery) {
|
25 |
+
$gid = substr($gallery, 4); // get id from "gid-x"
|
26 |
+
$sortorder[] = $gid;
|
27 |
+
}
|
28 |
+
$serial_sort = serialize($sortorder);
|
29 |
+
$wpdb->query("UPDATE $wpdb->nggalbum SET sortorder = '$serial_sort' WHERE id = $albumid ");
|
30 |
+
} else {
|
31 |
+
$wpdb->query("UPDATE $wpdb->nggalbum SET sortorder = '0' WHERE id = $albumid ");
|
32 |
+
}
|
33 |
+
$messagetext = '<font color="green">'.__('Update Successfully','nggallery').'</font>';
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
if ($_POST['delete']){
|
38 |
+
$act_album = $_POST['act_album'];
|
39 |
+
$result = $wpdb->query("DELETE FROM $wpdb->nggalbum WHERE id = '$act_album' ");
|
40 |
+
if ($result) $messagetext = '<font color="green">'.__('Album deleted','nggallery').'</font>';
|
41 |
+
}
|
42 |
+
|
43 |
+
// message windows
|
44 |
+
if(!empty($messagetext)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; }
|
45 |
+
|
46 |
+
?>
|
47 |
+
<script type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/jquery.js"></script>
|
48 |
+
<script type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/interface.js"></script>
|
49 |
+
<style type="text/css" media="all">@import "<?php echo NGGALLERY_URLPATH ?>css/nggallery.css";</style>
|
50 |
+
<style type="text/css" media="all">@import "<?php echo NGGALLERY_URLPATH ?>admin/js/portlets.css";</style>
|
51 |
+
<script type="text/javascript">
|
52 |
+
|
53 |
+
$(document).ready(
|
54 |
+
function()
|
55 |
+
{
|
56 |
+
$('div.groupWrapper').Sortable(
|
57 |
+
{
|
58 |
+
accept: 'groupItem',
|
59 |
+
helperclass: 'sort_placeholder',
|
60 |
+
opacity: 0.7,
|
61 |
+
tolerance: 'intersect'
|
62 |
+
}
|
63 |
+
),
|
64 |
+
|
65 |
+
$('.textarea1').Autoexpand([230,400]);
|
66 |
+
}
|
67 |
+
);
|
68 |
+
|
69 |
+
function serialize(s)
|
70 |
+
{
|
71 |
+
serial = $.SortSerialize(s);
|
72 |
+
$('input[@name=sortorder]').val(serial.hash);
|
73 |
+
};
|
74 |
+
</script>
|
75 |
+
<div class="wrap">
|
76 |
+
<h2><?php _e('Manage Albums', 'nggallery') ?></h2>
|
77 |
+
<form id="selectalbum" method="POST" onsubmit="serialize('galleryContainer')">
|
78 |
+
<input name="sortorder" type="hidden" />
|
79 |
+
<table width="60%" border="0" cellspacing="3" cellpadding="3" >
|
80 |
+
<tr>
|
81 |
+
<th align="right">Select album</th>
|
82 |
+
<td>
|
83 |
+
<select id="act_album" name="act_album" onchange="this.form.submit();">
|
84 |
+
<option value="0" ><?php _e('No album selected', 'nggallery') ?></option>
|
85 |
+
<?php
|
86 |
+
$albumlist = $wpdb->get_results("SELECT * FROM $wpdb->nggalbum ORDER BY id ASC");
|
87 |
+
if(is_array($albumlist)) {
|
88 |
+
foreach($albumlist as $album) {
|
89 |
+
if ($_POST['act_album'] == $album->id) $selected = 'selected="selected" ';
|
90 |
+
else $selected = '';
|
91 |
+
echo '<option value="'.$album->id.'" '.$selected.'>'.$album->name.'</option>'."\n";
|
92 |
+
}
|
93 |
+
}
|
94 |
+
?>
|
95 |
+
</select>
|
96 |
+
</td>
|
97 |
+
<th align="right">Add new album</th>
|
98 |
+
<td><input id="newalbum" name="newalbum" value="" /></td>
|
99 |
+
</tr>
|
100 |
+
</table>
|
101 |
+
<p class="submit">
|
102 |
+
<?php if ($_POST['act_album'] > 0){ ?>
|
103 |
+
<input type="submit" name="delete" class="button delete" value="<?php _e('Delete') ?> »" onclick="javascript:check=confirm('<?php _e('Delete album ?','nggallery'); ?>');if(check==false) return false;"/>
|
104 |
+
<?php } ?>
|
105 |
+
<input type="submit" name="update" value="<?php _e('Update') ?> »" /><p>
|
106 |
+
</form>
|
107 |
+
<br class="clear"/>
|
108 |
+
<div class="container">
|
109 |
+
<div id="selectContainer" class="groupWrapper">
|
110 |
+
<h3><?php _e('Select Gallery', 'nggallery') ?></h3>
|
111 |
+
<?php
|
112 |
+
$gallerylist = $wpdb->get_results("SELECT gid FROM $wpdb->nggallery");
|
113 |
+
|
114 |
+
if(is_array($gallerylist)) {
|
115 |
+
if ( ($_POST['act_album'] == 0) or (!isset($_POST['act_album'])) ) {
|
116 |
+
foreach($gallerylist as $gallery) {
|
117 |
+
getgallerycontainer($gallery->gid);
|
118 |
+
}
|
119 |
+
} else {
|
120 |
+
$act_album = $_POST['act_album'];
|
121 |
+
$sortorder = $wpdb->get_var("SELECT sortorder FROM $wpdb->nggalbum WHERE id = '$act_album'");
|
122 |
+
if (!empty($sortorder)) {
|
123 |
+
$sort_array = unserialize($sortorder);
|
124 |
+
foreach($gallerylist as $gallery) {
|
125 |
+
if (!in_array($gallery->gid, $sort_array))
|
126 |
+
getgallerycontainer($gallery->gid);
|
127 |
+
}
|
128 |
+
} else {
|
129 |
+
foreach($gallerylist as $gallery) {
|
130 |
+
getgallerycontainer($gallery->gid);
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
?>
|
136 |
+
</div><!-- /#select container -->
|
137 |
+
|
138 |
+
<div id="galleryContainer" class="groupWrapper">
|
139 |
+
<?php
|
140 |
+
if ($_POST['act_album'] > 0){
|
141 |
+
$act_album = $_POST['act_album'];
|
142 |
+
$album = $wpdb->get_row("SELECT * FROM $wpdb->nggalbum WHERE id = '$act_album'");
|
143 |
+
echo '<h3>'.__('Album Page ID', 'nggallery').' '.$album->id.' : '.$album->name.'</h3>'."\n";
|
144 |
+
if (!empty($album->sortorder)) {
|
145 |
+
$sort_array = unserialize($album->sortorder);
|
146 |
+
if (is_array($sort_array)) {
|
147 |
+
foreach($sort_array as $galleryid) {
|
148 |
+
getgallerycontainer($galleryid);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
} else echo '<h3>'.__('No Album selected', 'nggallery').'</h3>'."\n";
|
153 |
+
?>
|
154 |
+
</div><!-- /#gallery container -->
|
155 |
+
|
156 |
+
</div><!-- /#container -->
|
157 |
+
</div><!-- /#wrap -->
|
158 |
+
|
159 |
+
<?php
|
160 |
+
}
|
161 |
+
|
162 |
+
function getgallerycontainer($galleryid = 0) {
|
163 |
+
global $wpdb;
|
164 |
+
|
165 |
+
$gallery = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$galleryid'");
|
166 |
+
|
167 |
+
if ($gallery) {
|
168 |
+
|
169 |
+
// set image url
|
170 |
+
$act_thumbnail_url = get_settings ('siteurl')."/".$gallery->path.ngg_get_thumbnail_folder($gallery->path, FALSE);
|
171 |
+
$act_thumb_prefix = ngg_get_thumbnail_prefix($gallery->path, FALSE);
|
172 |
+
|
173 |
+
$post= get_post($gallery->pageid);
|
174 |
+
$pagename = $post->post_title;
|
175 |
+
$filename = $wpdb->get_var("SELECT filename FROM $wpdb->nggpictures WHERE pid = '$gallery->previewpic'");
|
176 |
+
if ($filename) $img = '<img src="'.$act_thumbnail_url.$act_thumb_prefix.$filename.'" />';
|
177 |
+
else $img = '';
|
178 |
+
echo '
|
179 |
+
<div id="gid-'.$gallery->gid.'" class="groupItem">
|
180 |
+
<div class="innerhandle">
|
181 |
+
<div class="itemContent">
|
182 |
+
<div class="inlinepicture">'.$img.'</div>
|
183 |
+
<p><strong>'.__('ID', 'nggallery').' : </strong>'.$gallery->gid.'</p>
|
184 |
+
<p><strong>'.__('Name', 'nggallery').' : </strong>'.$gallery->name.'</p>
|
185 |
+
<p><strong>'.__('Title', 'nggallery').' : </strong>'.$gallery->title.'</p>
|
186 |
+
<p><strong>'.__('Page', 'nggallery').' : </strong>'.$pagename.'</p>
|
187 |
+
</div>
|
188 |
+
</div>
|
189 |
+
</div>
|
190 |
+
';
|
191 |
+
}
|
192 |
+
}
|
193 |
+
?>
|
admin/index.html
ADDED
File without changes
|
admin/js/interface.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Interface Elements for jQuery
|
3 |
+
*
|
4 |
+
* http://interface.eyecon.ro
|
5 |
+
*
|
6 |
+
* Copyright (c) 2006 Stefan Petre
|
7 |
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
8 |
+
* and GPL (GPL-LICENSE.txt) licenses.
|
9 |
+
*
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('k.f2={2r:u(M){E q.1E(u(){if(!M.aR||!M.aZ)E;D el=q;el.2l={aq:M.aq||cO,aR:M.aR,aZ:M.aZ,8e:M.8e||\'fV\',aJ:M.aJ||\'fV\',2Y:M.2Y&&2g M.2Y==\'u\'?M.2Y:I,3i:M.2Y&&2g M.3i==\'u\'?M.3i:I,7U:M.7U&&2g M.7U==\'u\'?M.7U:I,as:k(M.aR,q),8f:k(M.aZ,q),H:M.H||8J,67:M.67||0};el.2l.8f.2G().B(\'W\',\'9R\').eq(0).B({W:el.2l.aq+\'U\',19:\'2B\'}).2T();el.2l.as.1E(u(2N){q.7X=2N}).gC(u(){k(q).2R(el.2l.aJ)},u(){k(q).4i(el.2l.aJ)}).1J(\'5h\',u(e){if(el.2l.67==q.7X)E;el.2l.as.eq(el.2l.67).4i(el.2l.8e).2T().eq(q.7X).2R(el.2l.8e).2T();el.2l.8f.eq(el.2l.67).5w({W:0},el.2l.H,u(){q.14.19=\'1o\';if(el.2l.3i){el.2l.3i.1D(el,[q])}}).2T().eq(q.7X).1Y().5w({W:el.2l.aq},el.2l.H,u(){q.14.19=\'2B\';if(el.2l.2Y){el.2l.2Y.1D(el,[q])}}).2T();if(el.2l.7U){el.2l.7U.1D(el,[q,el.2l.8f.K(q.7X),el.2l.as.K(el.2l.67),el.2l.8f.K(el.2l.67)])}el.2l.67=q.7X}).eq(0).2R(el.2l.8e).2T();k(q).B(\'W\',k(q).B(\'W\')).B(\'2U\',\'2K\')})}};k.fn.gN=k.f2.2r;k.aA={2r:u(M){E q.1E(u(){D el=q;D 7E=2*18.2Q/f1;D an=2*18.2Q;if(k(el).B(\'Y\')!=\'2s\'&&k(el).B(\'Y\')!=\'1P\'){k(el).B(\'Y\',\'2s\')}el.1l={1R:k(M.1R,q),2F:M.2F,6q:M.6q,aD:M.aD,an:an,1N:k.1a.2o(q),Y:k.1a.3w(q),26:18.2Q/2,bi:M.bi,8p:M.6r,6r:[],aG:I,7E:2*18.2Q/f1};el.1l.fB=(el.1l.1N.w-el.1l.2F)/2;el.1l.7D=(el.1l.1N.h-el.1l.6q-el.1l.6q*el.1l.8p)/2;el.1l.2D=2*18.2Q/el.1l.1R.1N();el.1l.ba=el.1l.1N.w/2;el.1l.b9=el.1l.1N.h/2-el.1l.6q*el.1l.8p;D ak=1h.3F(\'22\');k(ak).B({Y:\'1P\',3I:1,Q:0,O:0});k(el).1S(ak);el.1l.1R.1E(u(2N){a6=k(\'1T\',q).K(0);W=T(el.1l.6q*el.1l.8p);if(k.3a.4t){3E=1h.3F(\'1T\');k(3E).B(\'Y\',\'1P\');3E.2J=a6.2J;3E.14.5E=\'gE 9n:9w.9y.cC(1G=60, 14=1, gB=0, gA=0, gv=0, gF=0)\'}P{3E=1h.3F(\'3E\');if(3E.fD){4L=3E.fD("2d");3E.14.Y=\'1P\';3E.14.W=W+\'U\';3E.14.Z=el.1l.2F+\'U\';3E.W=W;3E.Z=el.1l.2F;4L.gu();4L.gO(0,W);4L.gk(1,-1);4L.gp(a6,0,0,el.1l.2F,W);4L.6H();4L.gm="gG-4l";D ap=4L.hy(0,0,0,W);ap.fs(1,"fr(1V, 1V, 1V, 1)");ap.fs(0,"fr(1V, 1V, 1V, 0.6)");4L.hx=ap;if(hA.hB.3J(\'hw\')!=-1){4L.hv()}P{4L.hu(0,0,el.1l.2F,W)}}}el.1l.6r[2N]=3E;k(ak).1S(3E)}).1J(\'9z\',u(e){el.1l.aG=1b;el.1l.H=el.1l.7E*0.1*el.1l.H/18.3S(el.1l.H);E I}).1J(\'8B\',u(e){el.1l.aG=I;E I});k.aA.7T(el);el.1l.H=el.1l.7E*0.2;el.1l.ht=1X.6V(u(){el.1l.26+=el.1l.H;if(el.1l.26>an)el.1l.26=0;k.aA.7T(el)},20);k(el).1J(\'8B\',u(){el.1l.H=el.1l.7E*0.2*el.1l.H/18.3S(el.1l.H)}).1J(\'3D\',u(e){if(el.1l.aG==I){1s=k.1a.4a(e);fz=el.1l.1N.w-1s.x+el.1l.Y.x;el.1l.H=el.1l.bi*el.1l.7E*(el.1l.1N.w/2-fz)/(el.1l.1N.w/2)}})})},7T:u(el){el.1l.1R.1E(u(2N){b8=el.1l.26+2N*el.1l.2D;x=el.1l.fB*18.5H(b8);y=el.1l.7D*18.83(b8);f9=T(2a*(el.1l.7D+y)/(2*el.1l.7D));fk=(el.1l.7D+y)/(2*el.1l.7D);Z=T((el.1l.2F-el.1l.aD)*fk+el.1l.aD);W=T(Z*el.1l.6q/el.1l.2F);q.14.Q=el.1l.b9+y-W/2+"U";q.14.O=el.1l.ba+x-Z/2+"U";q.14.Z=Z+"U";q.14.W=W+"U";q.14.3I=f9;el.1l.6r[2N].14.Q=T(el.1l.b9+y+W-1-W/2)+"U";el.1l.6r[2N].14.O=T(el.1l.ba+x-Z/2)+"U";el.1l.6r[2N].14.Z=Z+"U";el.1l.6r[2N].14.W=T(W*el.1l.8p)+"U"})}};k.fn.hI=k.aA.2r;k.23({G:{c8:u(p,n,1W,1H,1m){E((-18.5H(p*18.2Q)/2)+0.5)*1H+1W},hK:u(p,n,1W,1H,1m){E 1H*(n/=1m)*n*n+1W},fl:u(p,n,1W,1H,1m){E-1H*((n=n/1m-1)*n*n*n-1)+1W},hm:u(p,n,1W,1H,1m){if((n/=1m/2)<1)E 1H/2*n*n*n*n+1W;E-1H/2*((n-=2)*n*n*n-2)+1W},8l:u(p,n,1W,1H,1m){if((n/=1m)<(1/2.75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51:M.51,6x:M.6x};k.6n.aH(el,0);k(1X).1J(\'gU\',u(){el.1F.1M=k.1a.3w(el);k.6n.aH(el,0);k.6n.7T(el)});k.6n.7T(el);el.1F.1R.1J(\'9z\',u(){k(el.1F.ax,q).K(0).14.19=\'2B\'}).1J(\'8B\',u(){k(el.1F.ax,q).K(0).14.19=\'1o\'});k(1h).1J(\'3D\',u(e){D 1s=k.1a.4a(e);D 5s=0;if(el.1F.51&&el.1F.51==\'cv\')D aI=1s.x-el.1F.1M.x-(el.4c-el.1F.2F*el.1F.1R.1N())/2-el.1F.2F/2;P if(el.1F.51&&el.1F.51==\'2L\')D aI=1s.x-el.1F.1M.x-el.4c+el.1F.2F*el.1F.1R.1N();P D aI=1s.x-el.1F.1M.x;D fP=18.6b(1s.y-el.1F.1M.y-el.5W/2,2);el.1F.1R.1E(u(2N){45=18.ez(18.6b(aI-2N*el.1F.2F,2)+fP);45-=el.1F.2F/2;45=45<0?0:45;45=45>el.1F.7Y?el.1F.7Y:45;45=el.1F.7Y-45;bB=el.1F.6x*45/el.1F.7Y;q.14.Z=el.1F.2F+bB+\'U\';q.14.O=el.1F.2F*2N+5s+\'U\';5s+=bB});k.6n.aH(el,5s)})})},aH:u(el,5s){if(el.1F.51)if(el.1F.51==\'cv\')el.1F.1Z.K(0).14.O=(el.4c-el.1F.2F*el.1F.1R.1N())/2-5s/2+\'U\';P if(el.1F.51==\'O\')el.1F.1Z.K(0).14.O=-5s/el.1F.1R.1N()+\'U\';P if(el.1F.51==\'2L\')el.1F.1Z.K(0).14.O=(el.4c-el.1F.2F*el.1F.1R.1N())-5s/2+\'U\';el.1F.1Z.K(0).14.Z=el.1F.2F*el.1F.1R.1N()+5s+\'U\'},7T:u(el){el.1F.1R.1E(u(2N){q.14.Z=el.1F.2F+\'U\';q.14.O=el.1F.2F*2N+\'U\'})}};k.fn.hi=k.6n.2r;k.N={1c:S,8R:S,3A:S,2I:S,4y:S,cl:S,1d:S,2h:S,1R:S,5o:u(){k.N.8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U\').B(\'O\',Y.x+\'U\').2R(1d.1f.aM);if(k.N.3A){k.N.3A.B(\'19\',\'2B\').B(\'Q\',Y.y+1N.hb+\'U\').B(\'O\',Y.x+\'U\').B(\'Z\',k.N.1c.B(\'Z\')).B(\'W\',k.N.1c.B(\'W\'))}k.N.2h=0;k.N.1R.K(0).3l=1d.1f.7H;k.N.8Q(1d,1d.1f.4e.K(0),\'7J\');if(k.N.1c.B(\'19\')==\'1o\'){if(1d.1f.bV){D cp=k.1a.aT(1d,1b);D cm=k.1a.6U(1d,1b);k.N.1c.B(\'Z\',1d.4c-(k.dF?(cp.l+cp.r+cm.l+cm.r):0)+\'U\')}if(1d.1f.fx){3m(1d.1f.fx.1u){1e\'c6\':k.N.1c.7f(1d.1f.fx.1m);1r;1e\'1z\':k.N.1c.fo(1d.1f.fx.1m);1r;1e\'a7\':k.N.1c.gb(1d.1f.fx.1m);1r}}P{k.N.1c.1Y()}if(k.N.1d.1f.2Y)k.N.1d.1f.2Y.1D(k.N.1d,[k.N.1c,k.N.3A])}},dO:u(){D 1d=q;if(1d.1f.4e){k.N.4y=1d.2y;k.N.cl=1d.2y;D 5p=\'\';1d.1f.4e.1E(u(2N){2y=k(\'2y\',q).3g().6c();fY=1d.2y.6c();if(2y.3J(fY)==0){5p+=\'<8P 4I="\'+k(\'2y\',q).3g()+\'" 8K="\'+2N+\'" 14="9b: ad;">\'+k(\'3g\',q).3g()+\'</8P>\'}});if(5p!=\'\'){k.N.cj(1d,5p);q.1f.9x=1b;E}}1d.1f.4e=S;q.1f.9x=I},6J:u(2n,26,2T){if(2n.b1){D 6t=2n.b1();6t.hp(1b);6t.dI("ck",26);6t.ha("ck",-2T+26);6t.8C()}P if(2n.aF){2n.aF(26,2T)}P{if(2n.5q){2n.5q=26;2n.dN=2T}}2n.6K()},f0:u(2n){if(2n.5q)E 2n.5q;P if(2n.b1){D 6t=1h.6J.dZ();D eX=6t.h9();E 0-eX.dI(\'ck\',-h6)}},aY:u(2n){D 4P={2y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||0).3l=q.1f.7H;if(k.N.1R.K(k.N.2h||0).7W)k.N.1R.K(k.N.2h||0).7W(I);if(q.1f.aU){D aK=k.N.1R.K(k.N.2h||0).5C(\'4I\');q.2y=1d.3j+aK+q.1f.3N+1d.66;if(k.N.4y.1g!=aK.1g)k.N.6J(q,1d.3j.1g+k.N.4y.1g,1d.3j.1g+aK.1g)}E I}k.N.dO.1D(q);if(q.1f.9x==I){if(1d.3o!=k.N.4y&&1d.3o.1g>=q.1f.aL)k.N.2I=1X.9T(k.N.dQ,q.1f.54);if(k.N.1R){k.N.4w()}}E 1b},8Q:u(2n,3o,1u){if(2n.1f[1u]){D 81={};ar=3o.f3(\'*\');24(i=0;i<ar.1g;i++){81[ar[i].4Y]=ar[i].7c.h4}2n.1f[1u].1D(2n,[81])}},di:u(e){if(k.N.1R){if(k.N.2h!=S)k.N.1R.K(k.N.2h||0).3l=\'\';k.N.1R.K(k.N.2h||0).3l=\'\';k.N.2h=T(q.5C(\'8K\'))||0;k.N.1R.K(k.N.2h||0).3l=k.N.1d.1f.7H}},dj:u(2k){1X.bH(k.N.2I);2k=2k||k.2k.gS(1X.2k);2k.aP();2k.aW();D 1d=k.N.aY(k.N.1d);D 3M=q.5C(\'4I\');k.N.1d.2y=1d.3j+3M+k.N.1d.1f.3N+1d.66;k.N.4y=q.5C(\'4I\');k.N.6J(k.N.1d,1d.3j.1g+3M.1g+k.N.1d.1f.3N.1g,1d.3j.1g+3M.1g+k.N.1d.1f.3N.1g);k.N.4w();if(k.N.1d.1f.68){4u=T(q.5C(\'8K\'))||0;k.N.8Q(k.N.1d,k.N.1d.1f.4e.K(4u),\'68\')}E I},eJ:u(e){3K=e.7L||e.7K||-1;if(/13|27|35|36|38|40/.48(3K)&&k.N.1R){if(1X.2k){1X.2k.bT=1b;1X.2k.c0=I}P{e.aP();e.aW()}E I}},2r:u(M){if(!M.aN||!k.1a){E}if(!k.N.1c){if(k.3a.4t){k(\'2e\',1h).1S(\'<3A 14="19:1o;Y:1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eG)||40)},eF:u(){24(i=0;i<k.1y.29.1g;i++){if(!k.1y.29[i].2X){k.1y.29[i].2X=k.23(k.1a.7G(k.1y.29[i]),k.1a.74(k.1y.29[i]),k.1a.6z(k.1y.29[i]))}P{k.1y.29[i].2X.t=k.1y.29[i].3d;k.1y.29[i].2X.l=k.1y.29[i].3c}if(k.1y.4Q.A&&k.1y.4Q.A.7q==1b){69={x:k.1y.4Q.A.2v,y:k.1y.4Q.A.2q,1C:k.1y.4Q.A.1B.1C,hb:k.1y.4Q.A.1B.hb}}P{69=k.23(k.1a.7G(k.1y.4Q),k.1a.74(k.1y.4Q))}if(k.1y.29[i].2X.t>0&&k.1y.29[i].2X.y+k.1y.29[i].2X.t>69.y){k.1y.29[i].3d-=k.1y.2D}P if(k.1y.29[i].2X.t<=k.1y.29[i].2X.h&&k.1y.29[i].2X.t+k.1y.29[i].2X.hb<69.y+69.hb){k.1y.29[i].3d+=k.1y.2D}if(k.1y.29[i].2X.l>0&&k.1y.29[i].2X.x+k.1y.29[i].2X.l>69.x){k.1y.29[i].3c-=k.1y.2D}P if(k.1y.29[i].2X.l<=k.1y.29[i].2X.hP&&k.1y.29[i].2X.l+k.1y.29[i].2X.1C<69.x+69.1C){k.1y.29[i].3c+=k.1y.2D}}},8o:u(){1X.5T(k.1y.2I);k.1y.4Q=S;k.1y.29=S;24(i in k.1y.29){k.1y.29[i].2X=S}}};k.11={1c:S,F:S,4U:u(){E q.1E(u(){if(q.9I){q.A.5e.3q(\'5v\',k.11.bN);q.A=S;q.9I=I;if(k.3a.4t){q.bE="eN"}P{q.14.hq=\'\';q.14.e1=\'\';q.14.e7=\'\'}}})},bN:u(e){if(k.11.F!=S){k.11.9A(e);E I}D C=q.3U;k(1h).1J(\'3D\',k.11.bX).1J(\'5P\',k.11.9A);C.A.1s=k.1a.4a(e);C.A.4B=C.A.1s;C.A.7q=I;C.A.ho=q!=q.3U;k.11.F=C;if(C.A.5i&&q!=q.3U){bS=k.1a.3w(C.31);bQ=k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1s.y-C.A.1B.y-C.A.1B.hb+C.A.2V.4D;C.A.1B.y=C.A.1s.y-C.A.1B.hb+C.A.2V.4D}}C.A.2v=C.A.2c.x;C.A.2q=C.A.2c.y;if(C.A.8s||C.A.2p==\'94\'){8U=k.1a.6U(C.31,1b);C.A.1B.x=C.8t+(k.3a.4t?0:k.3a.7I?-8U.l:8U.l);C.A.1B.y=C.8G+(k.3a.4t?0:k.3a.7I?-8U.t:8U.t);k(C.31).1S(k.11.1c.K(0))}if(C.A.2p){k.11.c5(C);C.A.5t.2p=k.11.ce}if(C.A.5i){k.3b.ct(C)}3Y.O=C.A.1B.x-C.A.9B+\'U\';3Y.Q=C.A.1B.y-C.A.ai+\'U\';3Y.Z=C.A.1B.1C+\'U\';3Y.W=C.A.1B.hb+\'U\';k.11.F.A.9E=I;if(C.A.gx){C.A.5t.6a=k.11.c7}if(C.A.3I!=I){k.11.1c.B(\'3I\',C.A.3I)}if(C.A.1G){k.11.1c.B(\'1G\',C.A.1G);if(1X.71){k.11.1c.B(\'5E\',\'8V(1G=\'+C.A.1G*2a+\')\')}}if(C.A.7O){k.11.1c.2R(C.A.7O);k.11.1c.K(0).7c.14.19=\'1o\'}if(C.A.4o)C.A.4o.1D(C,[5g,C.A.2c.x,C.A.2c.y]);if(k.1x&&k.1x.8D>0){k.1x.ed(C)}if(C.A.46==I){9G.19=\'1o\'}E I},c5:u(C){if(C.A.2p.1K==b0){if(C.A.2p==\'94\'){C.A.28=k.23({x:0,y:0},k.1a.2o(C.31));D 8S=k.1a.6U(C.31,1b);C.A.28.w=C.A.28.1C-8S.l-8S.r;C.A.28.h=C.A.28.hb-8S.t-8S.b}P if(C.A.2p==\'1h\'){D bY=k.1a.bm();C.A.28={x:0,y:0,w:bY.w,h:bY.h}}}P if(C.A.2p.1K==7F){C.A.28={x:T(C.A.2p[0])||0,y:T(C.A.2p[1])||0,w:T(C.A.2p[2])||0,h:T(C.A.2p[3])||0}}C.A.28.dx=C.A.28.x-C.A.1B.x;C.A.28.dy=C.A.28.y-C.A.1B.y},9H:u(F){if(F.A.8s||F.A.2p==\'94\'){k(\'2e\',1h).1S(k.11.1c.K(0))}k.11.1c.5o().2G().B(\'1G\',1);if(1X.71){k.11.1c.B(\'5E\',\'8V(1G=2a)\')}},9A:u(e){k(1h).3q(\'3D\',k.11.bX).3q(\'5P\',k.11.9A);if(k.11.F==S){E}D F=k.11.F;k.11.F=S;if(F.A.7q==I){E I}if(F.A.44==1b){k(F).B(\'Y\',F.A.4n)}D 9G=F.14;if(F.5i){k.11.1c.B(\'9b\',\'8j\')}if(F.A.7O){k.11.1c.4i(F.A.7O)}if(F.A.6N==I){if(F.A.fx>0){if(!F.A.1O||F.A.1O==\'4j\'){D x=12 k.fx(F,{1m:F.A.fx},\'O\');x.1L(F.A.2c.x,F.A.8y)}if(!F.A.1O||F.A.1O==\'49\'){D y=12 k.fx(F,{1m:F.A.fx},\'Q\');y.1L(F.A.2c.y,F.A.8v)}}P{if(!F.A.1O||F.A.1O==\'4j\')F.14.O=F.A.8y+\'U\';if(!F.A.1O||F.A.1O==\'49\')F.14.Q=F.A.8v+\'U\'}k.11.9H(F);if(F.A.46==I){k(F).B(\'19\',F.A.7V)}}P if(F.A.fx>0){F.A.9E=1b;D dh=I;if(k.1x&&k.1t&&F.A.44){dh=k.1a.3w(k.1t.1c.K(0))}k.11.1c.5w({O:dh?dh.x:F.A.1B.x,Q:dh?dh.y:F.A.1B.y},F.A.fx,u(){F.A.9E=I;if(F.A.46==I){F.14.19=F.A.7V}k.11.9H(F)})}P{k.11.9H(F);if(F.A.46==I){k(F).B(\'19\',F.A.7V)}}if(k.1x&&k.1x.8D>0){k.1x.eO(F)}if(k.1t&&F.A.44){k.1t.fC(F)}if(F.A.2Z&&(F.A.8y!=F.A.2c.x||F.A.8v!=F.A.2c.y)){F.A.2Z.1D(F,F.A.b3||[0,0,F.A.8y,F.A.8v])}if(F.A.3T)F.A.3T.1D(F);E I},c7:u(x,y,dx,dy){if(dx!=0)dx=T((dx+(q.A.gx*dx/18.3S(dx))/2)/q.A.gx)*q.A.gx;if(dy!=0)dy=T((dy+(q.A.gy*dy/18.3S(dy))/2)/q.A.gy)*q.A.gy;E{dx:dx,dy:dy,x:0,y:0}},ce:u(x,y,dx,dy){dx=18.3L(18.3r(dx,q.A.28.dx),q.A.28.w+q.A.28.dx-q.A.1B.1C);dy=18.3L(18.3r(dy,q.A.28.dy),q.A.28.h+q.A.28.dy-q.A.1B.hb);E{dx:dx,dy:dy,x:0,y:0}},bX:u(e){if(k.11.F==S||k.11.F.A.9E==1b){E}D F=k.11.F;F.A.4B=k.1a.4a(e);if(F.A.7q==I){45=18.ez(18.6b(F.A.1s.x-F.A.4B.x,2)+18.6b(F.A.1s.y-F.A.4B.y,2));if(45<F.A.6M){E}P{k.11.ea(e)}}D dx=F.A.4B.x-F.A.1s.x;D dy=F.A.4B.y-F.A.1s.y;24(D i in F.A.5t){D 3y=F.A.5t[i].1D(F,[F.A.2c.x+dx,F.A.2c.y+dy,dx,dy]);if(3y&&3y.1K==7M){dx=i!=\'7R\'?3y.dx:(3y.x-F.A.2c.x);dy=i!=\'7R\'?3y.dy:(3y.y-F.A.2c.y)}}F.A.2v=F.A.1B.x+dx-F.A.9B;F.A.2q=F.A.1B.y+dy-F.A.ai;if(F.A.5i&&(F.A.3H||F.A.2Z)){k.3b.3H(F,F.A.2v,F.A.2q)}if(F.A.4m)F.A.4m.1D(F,[F.A.2c.x+dx,F.A.2c.y+dy]);if(!F.A.1O||F.A.1O==\'4j\'){F.A.8y=F.A.2c.x+dx;k.11.1c.K(0).14.O=F.A.2v+\'U\'}if(!F.A.1O||F.A.1O==\'49\'){F.A.8v=F.A.2c.y+dy;k.11.1c.K(0).14.Q=F.A.2q+\'U\'}if(k.1x&&k.1x.8D>0){k.1x.al(F)}E I},2r:u(o){if(!k.11.1c){k(\'2e\',1h).1S(\'<22 id="e8"></22>\');k.11.1c=k(\'#e8\');D el=k.11.1c.K(0);D 4J=el.14;4J.Y=\'1P\';4J.19=\'1o\';4J.9b=\'8j\';4J.eu=\'1o\';4J.2U=\'2K\';if(1X.71){el.bE="e4"}P{4J.gi=\'1o\';4J.e7=\'1o\';4J.e1=\'1o\'}}if(!o){o={}}E q.1E(u(){if(q.9I||!k.1a)E;if(1X.71){q.gh=u(){E I};q.gj=u(){E I}}D el=q;D 5e=o.3v?k(q).gf(o.3v):k(q);if(k.3a.4t){5e.1E(u(){q.bE="e4"})}P{5e.B(\'-gI-7R-8C\',\'1o\');5e.B(\'7R-8C\',\'1o\');5e.B(\'-gH-7R-8C\',\'1o\')}q.A={5e:5e,6N:o.6N?1b:I,46:o.46?1b:I,44:o.44?o.44:I,5i:o.5i?o.5i:I,8s:o.8s?o.8s:I,3I:o.3I?T(o.3I)||0:I,1G:o.1G?2m(o.1G):I,fx:T(o.fx)||S,6R:o.6R?o.6R:I,5t:{},1s:{},4o:o.4o&&o.4o.1K==2A?o.4o:I,3T:o.3T&&o.3T.1K==2A?o.3T:I,2Z:o.2Z&&o.2Z.1K==2A?o.2Z:I,1O:/49|4j/.48(o.1O)?o.1O:I,6M:o.6M?T(o.6M)||0:0,2V:o.2V?o.2V:I,bD:o.bD?1b:I,7O:o.7O||I};if(o.5t&&o.5t.1K==2A)q.A.5t.7R=o.5t;if(o.4m&&o.4m.1K==2A)q.A.4m=o.4m;if(o.2p&&((o.2p.1K==b0&&(o.2p==\'94\'||o.2p==\'1h\'))||(o.2p.1K==7F&&o.2p.1g==4))){q.A.2p=o.2p}if(o.2O){q.A.2O=o.2O}if(o.6a){if(2g o.6a==\'gz\'){q.A.gx=T(o.6a)||1;q.A.gy=T(o.6a)||1}P if(o.6a.1g==2){q.A.gx=T(o.6a[0])||1;q.A.gy=T(o.6a[1])||1}}if(o.3H&&o.3H.1K==2A){q.A.3H=o.3H}q.9I=1b;5e.1E(u(){q.3U=el});5e.1J(\'5v\',k.11.bN)})}};k.fn.23({aS:k.11.4U,7t:k.11.2r});k.1x={du:u(5J,5G,7Q,7S){E 5J<=k.11.F.A.2v&&(5J+7Q)>=(k.11.F.A.2v+k.11.F.A.1B.w)&&5G<=k.11.F.A.2q&&(5G+7S)>=(k.11.F.A.2q+k.11.F.A.1B.h)?1b:I},cV:u(5J,5G,7Q,7S){E!(5J>(k.11.F.A.2v+k.11.F.A.1B.w)||(5J+7Q)<k.11.F.A.2v||5G>(k.11.F.A.2q+k.11.F.A.1B.h)||(5G+7S)<k.11.F.A.2q)?1b:I},1s:u(5J,5G,7Q,7S){E 5J<k.11.F.A.4B.x&&(5J+7Q)>k.11.F.A.4B.x&&5G<k.11.F.A.4B.y&&(5G+7S)>k.11.F.A.4B.y?1b:I},5r:I,3Q:{},8D:0,3P:{},ed:u(C){if(k.11.F==S){E}D i;k.1x.3Q={};D bJ=I;24(i in k.1x.3P){if(k.1x.3P[i]!=S){D 1j=k.1x.3P[i].K(0);if(k(k.11.F).is(\'.\'+1j.1i.a)){if(1j.1i.m==I){1j.1i.p=k.23(k.1a.7G(1j),k.1a.74(1j));1j.1i.m=1b}if(1j.1i.ac){k.1x.3P[i].2R(1j.1i.ac)}k.1x.3Q[i]=k.1x.3P[i];if(k.1t&&1j.1i.s&&k.11.F.A.44){1j.1i.el=k(\'.\'+1j.1i.a,1j);C.14.19=\'1o\';k.1t.cT(1j);1j.1i.ay=k.1t.8x(k.1p(1j,\'id\')).7l;C.14.19=C.A.7V;bJ=1b}if(1j.1i.9i){1j.1i.9i.1D(k.1x.3P[i].K(0),[k.11.F])}}}}if(bJ){k.1t.26()}},dS:u(){k.1x.3Q={};24(i in k.1x.3P){if(k.1x.3P[i]!=S){D 1j=k.1x.3P[i].K(0);if(k(k.11.F).is(\'.\'+1j.1i.a)){1j.1i.p=k.23(k.1a.7G(1j),k.1a.74(1j));if(1j.1i.ac){k.1x.3P[i].2R(1j.1i.ac)}k.1x.3Q[i]=k.1x.3P[i];if(k.1t&&1j.1i.s&&k.11.F.A.44){1j.1i.el=k(\'.\'+1j.1i.a,1j);C.14.19=\'1o\';k.1t.cT(1j);C.14.19=C.A.7V}}}}},al:u(e){if(k.11.F==S){E}k.1x.5r=I;D i;D bK=I;D eQ=0;24(i in k.1x.3Q){D 1j=k.1x.3Q[i].K(0);if(k.1x.5r==I&&k.1x[1j.1i.t](1j.1i.p.x,1j.1i.p.y,1j.1i.p.1C,1j.1i.p.hb)){if(1j.1i.hc&&1j.1i.h==I){k.1x.3Q[i].2R(1j.1i.hc)}if(1j.1i.h==I&&1j.1i.7x){bK=1b}1j.1i.h=1b;k.1x.5r=1j;if(k.1t&&1j.1i.s&&k.11.F.A.44){k.1t.1c.K(0).3l=1j.1i.eV;k.1t.al(1j)}eQ++}P if(1j.1i.h==1b){if(1j.1i.7y){1j.1i.7y.1D(1j,[e,k.11.1c.K(0).7c,1j.1i.fx])}if(1j.1i.hc){k.1x.3Q[i].4i(1j.1i.hc)}1j.1i.h=I}}if(k.1t&&!k.1x.5r&&k.11.F.44){k.1t.1c.K(0).14.19=\'1o\'}if(bK){k.1x.5r.1i.7x.1D(k.1x.5r,[e,k.11.1c.K(0).7c])}},eO:u(e){D i;24(i in k.1x.3Q){D 1j=k.1x.3Q[i].K(0);if(1j.1i.ac){k.1x.3Q[i].4i(1j.1i.ac)}if(1j.1i.hc){k.1x.3Q[i].4i(1j.1i.hc)}if(1j.1i.s){k.1t.7s[k.1t.7s.1g]=i}if(1j.1i.9l&&1j.1i.h==1b){1j.1i.h=I;1j.1i.9l.1D(1j,[e,1j.1i.fx])}1j.1i.m=I;1j.1i.h=I}k.1x.3Q={}},4U:u(){E q.1E(u(){if(q.9j){if(q.1i.s){id=k.1p(q,\'id\');k.1t.5L[id]=S;k(\'.\'+q.1i.a,q).aS()}k.1x.3P[\'d\'+q.c2]=S;q.9j=I;q.f=S}})},2r:u(o){E q.1E(u(){if(q.9j==1b||!o.3C||!k.1a||!k.11){E}q.1i={a:o.3C,ac:o.9J||I,hc:o.a5||I,eV:o.58||I,9l:o.gq||o.9l||I,7x:o.7x||o.dC||I,7y:o.7y||o.fO||I,9i:o.9i||I,t:o.6I&&(o.6I==\'du\'||o.6I==\'cV\')?o.6I:\'1s\',fx:o.fx?o.fx:I,m:I,h:I};if(o.cQ==1b&&k.1t){id=k.1p(q,\'id\');k.1t.5L[id]=q.1i.a;q.1i.s=1b;if(o.2Z){q.1i.2Z=o.2Z;q.1i.ay=k.1t.8x(id).7l}}q.9j=1b;q.c2=T(18.6o()*c9);k.1x.3P[\'d\'+q.c2]=k(q);k.1x.8D++})}};k.fn.23({dR:k.1x.4U,do:k.1x.2r});k.gD=k.1x.dS;k.3B={1c:S,8L:u(){3g=q.2y;if(!3g)E;14={dz:k(q).B(\'dz\')||\'\',4A:k(q).B(\'4A\')||\'\',8Z:k(q).B(\'8Z\')||\'\',dP:k(q).B(\'dP\')||\'\',dT:k(q).B(\'dT\')||\'\',dU:k(q).B(\'dU\')||\'\',c3:k(q).B(\'c3\')||\'\',dY:k(q).B(\'dY\')||\'\'};k.3B.1c.B(14);3x=k.3B.dX(3g);3x=3x.4E(12 bb("\\\\n","g"),"<br />");k.3B.1c.3x(\'gL\');ci=k.3B.1c.K(0).4c;k.3B.1c.3x(3x);Z=k.3B.1c.K(0).4c+ci;if(q.6l.2M&&Z>q.6l.2M[0]){Z=q.6l.2M[0]}q.14.Z=Z+\'U\';if(q.4Y==\'cf\'){W=k.3B.1c.K(0).5W+ci;if(q.6l.2M&&W>q.6l.2M[1]){W=q.6l.2M[1]}q.14.W=W+\'U\'}},dX:u(3g){cg={\'&\':\'&gK;\',\'<\':\'&gJ;\',\'>\':\'>\',\'"\':\'&gs;\'};24(i in cg){3g=3g.4E(12 bb(i,\'g\'),cg[i])}E 3g},2r:u(2M){if(k.3B.1c==S){k(\'2e\',1h).1S(\'<22 id="dE" 14="Y: 1P; Q: 0; O: 0; 3n: 2K;"></22>\');k.3B.1c=k(\'#dE\')}E q.1E(u(){if(/cf|ch/.48(q.4Y)){if(q.4Y==\'ch\'){dB=q.5C(\'1u\');if(!/3g|gr/.48(dB)){E}}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.3G.l;4h.2U=\'2K\';if(k.3a.4t){4h.ei=co}P{4h.jK=co}if(k.3a=="4t"){es.5E="8V(1G="+0.ex*2a+")"}es.1G=0.ex;e.31.ew(6u,e);6u.jF(e);es.5K=\'2P\';es.5z=\'2P\';es.5k=\'2P\';es.5j=\'2P\';es.Y=\'1P\';es.eu=\'1o\';es.Q=\'2P\';es.O=\'2P\';if(73){t.2G();es.3n=5Y}E{V:V,3p:k(6u)}};k.fx.8E={jE:[0,1V,1V],jG:[eD,1V,1V],jH:[e6,e6,jI],jP:[0,0,0],ks:[0,0,1V],jY:[dv,42,42],jZ:[0,1V,1V],k0:[0,0,7w],k1:[0,7w,7w],jX:[cn,cn,cn],jS:[0,2a,0],jR:[jT,jU,eb],jV:[7w,0,7w],kr:[85,eb,47],kP:[1V,eA,0],kN:[kO,50,kx],kF:[7w,0,0],kD:[ku,f8,kt],ky:[kH,0,9C],kL:[1V,0,1V],kM:[1V,kJ,0],kv:[0,6C,0],kA:[75,0,kE],kC:[eD,eB,eA],kG:[kI,kB,eB],kw:[e0,1V,1V],kz:[eL,kK,eL],kQ:[9C,9C,9C],jC:[1V,iy,iz],iA:[1V,1V,e0],iB:[0,1V,0],ix:[1V,0,1V],iv:[6C,0,0],iq:[0,0,6C],ip:[6C,6C,0],ir:[1V,dv,0],it:[1V,ah,iu],iC:[6C,0,6C],iD:[1V,0,0],iK:[ah,ah,ah],iL:[1V,1V,1V],iM:[1V,1V,0]};k.fx.6D=u(4x,dm){if(k.fx.8E[4x])E{r:k.fx.8E[4x][0],g:k.fx.8E[4x][1],b:k.fx.8E[4x][2]};P if(2W=/^6Y\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)$/.a4(4x))E{r:T(2W[1]),g:T(2W[2]),b:T(2W[3])};P if(2W=/6Y\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)$/.a4(4x))E{r:2m(2W[1])*2.55,g:2m(2W[2])*2.55,b:2m(2W[3])*2.55};P if(2W=/^#([a-fA-79-9])([a-fA-79-9])([a-fA-79-9])$/.a4(4x))E{r:T("77"+2W[1]+2W[1]),g:T("77"+2W[2]+2W[2]),b:T("77"+2W[3]+2W[3])};P if(2W=/^#([a-fA-79-9]{2})([a-fA-79-9]{2})([a-fA-79-9]{2})$/.a4(4x))E{r:T("77"+2W[1]),g:T("77"+2W[2]),b:T("77"+2W[3])};P E dm==1b?I:{r:1V,g:1V,b:1V}};k.fx.dD={5Q:1,5b:1,5O:1,4S:1,4D:1,4A:1,W:1,O:1,c3:1,iI:1,5k:1,5j:1,5z:1,5K:1,8b:1,6x:1,8c:1,av:1,1G:1,iE:1,iF:1,5n:1,4X:1,5U:1,5M:1,2L:1,jD:1,Q:1,Z:1,3I:1};k.fx.dA={7i:1,iG:1,iH:1,io:1,im:1,4x:1,i2:1};k.fx.8A=[\'i3\',\'i4\',\'i5\',\'i1\'];k.fx.cc={\'cd\':[\'2E\',\'dK\'],\'a8\':[\'2E\',\'bh\'],\'6w\':[\'6w\',\'\'],\'8F\':[\'8F\',\'\']};k.fn.23({5w:u(5X,H,G,J){E q.1w(u(){D a1=k.H(H,G,J);D e=12 k.dM(q,a1,5X)})},c4:u(H,J){E q.1w(u(){D a1=k.H(H,J);D e=12 k.c4(q,a1)})},8o:u(2D){E q.1E(u(){if(q.6d)k.by(q,2D)})},i0:u(2D){E q.1E(u(){if(q.6d)k.by(q,2D);if(q.1w&&q.1w[\'fx\'])q.1w.fx=[]})}});k.23({c4:u(2f,M){D z=q,3t;z.2D=u(){if(k.fQ(M.21))M.21.1D(2f)};z.2I=6V(u(){z.2D()},M.1m);2f.6d=z},G:{c8:u(p,n,1W,1H,1m){E((-18.5H(p*18.2Q)/2)+0.5)*1H+1W}},dM:u(2f,M,5X){D z=q,3t;D y=2f.14;D fR=k.B(2f,"2U");D 72=k.B(2f,"19");D 2j={};z.9O=(12 7g()).7z();M.G=M.G&&k.G[M.G]?M.G:\'c8\';z.ag=u(2w,43){if(k.fx.dD[2w]){if(43==\'1Y\'||43==\'2G\'||43==\'3R\'){if(!2f.6v)2f.6v={};D r=2m(k.6E(2f,2w));2f.6v[2w]=r&&r>-c9?r:(2m(k.B(2f,2w))||0);43=43==\'3R\'?(72==\'1o\'?\'1Y\':\'2G\'):43;M[43]=1b;2j[2w]=43==\'1Y\'?[0,2f.6v[2w]]:[2f.6v[2w],0];if(2w!=\'1G\')y[2w]=2j[2w][0]+(2w!=\'3I\'&&2w!=\'8Z\'?\'U\':\'\');P k.1p(y,"1G",2j[2w][0])}P{2j[2w]=[2m(k.6E(2f,2w)),2m(43)||0]}}P if(k.fx.dA[2w])2j[2w]=[k.fx.6D(k.6E(2f,2w)),k.fx.6D(43)];P if(/^6w$|8F$|2E$|a8$|cd$/i.48(2w)){D m=43.4E(/\\s+/g,\' \').4E(/6Y\\s*\\(\\s*/g,\'6Y(\').4E(/\\s*,\\s*/g,\',\').4E(/\\s*\\)/g,\')\').d5(/([^\\s]+)/g);3m(2w){1e\'6w\':1e\'8F\':1e\'cd\':1e\'a8\':m[3]=m[3]||m[1]||m[0];m[2]=m[2]||m[0];m[1]=m[1]||m[0];24(D i=0;i<k.fx.8A.1g;i++){D 64=k.fx.cc[2w][0]+k.fx.8A[i]+k.fx.cc[2w][1];2j[64]=2w==\'a8\'?[k.fx.6D(k.6E(2f,64)),k.fx.6D(m[i])]:[2m(k.6E(2f,64)),2m(m[i])]}1r;1e\'2E\':24(D i=0;i<m.1g;i++){D bd=2m(m[i]);D a9=!hX(bd)?\'dK\':(!/cu|1o|2K|hY|hZ|i6|i7|ii|ij|ik|il/i.48(m[i])?\'bh\':I);if(a9){24(D j=0;j<k.fx.8A.1g;j++){64=\'2E\'+k.fx.8A[j]+a9;2j[64]=a9==\'bh\'?[k.fx.6D(k.6E(2f,64)),k.fx.6D(m[i])]:[2m(k.6E(2f,64)),bd]}}P{y[\'ie\']=m[i]}}1r}}P{y[2w]=43}E I};24(p in 5X){if(p==\'14\'){D 5f=k.bl(5X[p]);24(7A in 5f){q.ag(7A,5f[7A])}}P if(p==\'3l\'){if(1h.af)24(D i=0;i<1h.af.1g;i++){D 7e=1h.af[i].7e||1h.af[i].i9||S;if(7e){24(D j=0;j<7e.1g;j++){if(7e[j].i8==\'.\'+5X[p]){D 6X=12 bb(\'\\.\'+5X[p]+\' {\');D 5Z=7e[j].14.9X;D 5f=k.bl(5Z.4E(6X,\'\').4E(/}/g,\'\'));24(7A in 5f){q.ag(7A,5f[7A])}}}}}}P{q.ag(p,5X[p])}}y.19=72==\'1o\'?\'2B\':72;y.2U=\'2K\';z.2D=u(){D t=(12 7g()).7z();if(t>M.1m+z.9O){5T(z.2I);z.2I=S;24(p in 2j){if(p=="1G")k.1p(y,"1G",2j[p][1]);P if(2g 2j[p][1]==\'8T\')y[p]=\'6Y(\'+2j[p][1].r+\',\'+2j[p][1].g+\',\'+2j[p][1].b+\')\';P y[p]=2j[p][1]+(p!=\'3I\'&&p!=\'8Z\'?\'U\':\'\')}if(M.2G||M.1Y)24(D p in 2f.6v)if(p=="1G")k.1p(y,p,2f.6v[p]);P y[p]="";y.19=M.2G?\'1o\':(72!=\'1o\'?72:\'2B\');y.2U=fR;2f.6d=S;if(k.fQ(M.21))M.21.1D(2f)}P{D n=t-q.9O;D 8w=n/M.1m;24(p in 2j){if(2g 2j[p][1]==\'8T\'){y[p]=\'6Y(\'+T(k.G[M.G](8w,n,2j[p][0].r,(2j[p][1].r-2j[p][0].r),M.1m))+\',\'+T(k.G[M.G](8w,n,2j[p][0].g,(2j[p][1].g-2j[p][0].g),M.1m))+\',\'+T(k.G[M.G](8w,n,2j[p][0].b,(2j[p][1].b-2j[p][0].b),M.1m))+\')\'}P{D bz=k.G[M.G](8w,n,2j[p][0],(2j[p][1]-2j[p][0]),M.1m);if(p=="1G")k.1p(y,"1G",bz);P y[p]=bz+(p!=\'3I\'&&p!=\'8Z\'?\'U\':\'\')}}}};z.2I=6V(u(){z.2D()},13);2f.6d=z},by:u(2f,2D){if(2D)2f.6d.9O-=iO;P{1X.5T(2f.6d.2I);2f.6d=S;k.2H(2f,"fx")}}});k.bl=u(5Z){D 5f={};if(2g 5Z==\'4V\'){5Z=5Z.6c().7C(\';\');24(D i=0;i<5Z.1g;i++){6X=5Z[i].7C(\':\');if(6X.1g==2){5f[k.g6(6X[0].4E(/\\-(\\w)/g,u(m,c){E c.jo()}))]=k.g6(6X[1])}}}E 5f};k.fn.23({g3:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'4F\',G)})},gb:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'4r\',G)})},jl:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'fJ\',G)})},jk:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'O\',G)})},jg:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'2L\',G)})},jf:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.61(q,H,J,\'fh\',G)})}});k.fx.61=u(e,H,J,2S,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;z.el=k(e);z.1N=k.1a.2o(e);z.G=2g J==\'4V\'?J:G||S;if(!e.4s)e.4s=z.el.B(\'19\');if(2S==\'fJ\'){2S=z.el.B(\'19\')==\'1o\'?\'4r\':\'4F\'}P if(2S==\'fh\'){2S=z.el.B(\'19\')==\'1o\'?\'2L\':\'O\'}z.el.1Y();z.H=H;z.J=2g J==\'u\'?J:S;z.fx=k.fx.9P(e);z.2S=2S;z.21=u(){if(z.J&&z.J.1K==2A){z.J.1D(z.el.K(0))}if(z.2S==\'4r\'||z.2S==\'2L\'){z.el.B(\'19\',z.el.K(0).4s==\'1o\'?\'2B\':z.el.K(0).4s)}P{z.el.2G()}k.fx.a0(z.fx.3p.K(0),z.fx.V);k.2H(z.el.K(0),\'1n\')};3m(z.2S){1e\'4F\':63=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'W\');63.1L(z.fx.V.1q.hb,0);1r;1e\'4r\':z.fx.3p.B(\'W\',\'9R\');z.el.1Y();63=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'W\');63.1L(0,z.fx.V.1q.hb);1r;1e\'O\':63=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'Z\');63.1L(z.fx.V.1q.1C,0);1r;1e\'2L\':z.fx.3p.B(\'Z\',\'9R\');z.el.1Y();63=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'Z\');63.1L(0,z.fx.V.1q.1C);1r}};k.fn.ji=u(5D,J){E q.1w(\'1n\',u(){if(!k.4K(q)){k.2H(q,\'1n\');E I}D e=12 k.fx.f4(q,5D,J);e.bp()})};k.fx.f4=u(e,5D,J){D z=q;z.el=k(e);z.el.1Y();z.J=J;z.5D=T(5D)||40;z.V={};z.V.Y=z.el.B(\'Y\');z.V.Q=T(z.el.B(\'Q\'))||0;z.V.O=T(z.el.B(\'O\'))||0;if(z.V.Y!=\'2s\'&&z.V.Y!=\'1P\'){z.el.B(\'Y\',\'2s\')}z.3V=5;z.5y=1;z.bp=u(){z.5y++;z.e=12 k.fx(z.el.K(0),{1m:jj,21:u(){z.e=12 k.fx(z.el.K(0),{1m:80,21:u(){z.5D=T(z.5D/2);if(z.5y<=z.3V)z.bp();P{z.el.B(\'Y\',z.V.Y).B(\'Q\',z.V.Q+\'U\').B(\'O\',z.V.O+\'U\');k.2H(z.el.K(0),\'1n\');if(z.J&&z.J.1K==2A){z.J.1D(z.el.K(0))}}}},\'Q\');z.e.1L(z.V.Q-z.5D,z.V.Q)}},\'Q\');z.e.1L(z.V.Q,z.V.Q-z.5D)}};k.fn.23({jy:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4r\',\'4l\',G)})},jz:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4r\',\'in\',G)})},jA:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4r\',\'3R\',G)})},jB:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4F\',\'4l\',G)})},jx:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4F\',\'in\',G)})},jw:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'4F\',\'3R\',G)})},js:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'O\',\'4l\',G)})},jt:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'O\',\'in\',G)})},ju:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'O\',\'3R\',G)})},jv:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'2L\',\'4l\',G)})},je:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'2L\',\'in\',G)})},jd:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.4f(q,H,J,\'2L\',\'3R\',G)})}});k.fx.4f=u(e,H,J,2S,1u,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;z.el=k(e);z.G=2g J==\'4V\'?J:G||S;z.V={};z.V.Y=z.el.B(\'Y\');z.V.Q=z.el.B(\'Q\');z.V.O=z.el.B(\'O\');if(!e.4s)e.4s=z.el.B(\'19\');if(1u==\'3R\'){1u=z.el.B(\'19\')==\'1o\'?\'in\':\'4l\'}z.el.1Y();if(z.V.Y!=\'2s\'&&z.V.Y!=\'1P\'){z.el.B(\'Y\',\'2s\')}z.1u=1u;J=2g J==\'u\'?J:S;8H=1;3m(2S){1e\'4F\':z.e=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'Q\');z.62=2m(z.V.Q)||0;z.9K=z.fG;8H=-1;1r;1e\'4r\':z.e=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'Q\');z.62=2m(z.V.Q)||0;z.9K=z.fG;1r;1e\'2L\':z.e=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'O\');z.62=2m(z.V.O)||0;z.9K=z.fy;1r;1e\'O\':z.e=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'O\');z.62=2m(z.V.O)||0;z.9K=z.fy;8H=-1;1r}z.e2=12 k.fx(z.el.K(0),k.H(H,z.G,u(){z.el.B(z.V);if(z.1u==\'4l\'){z.el.B(\'19\',\'1o\')}P z.el.B(\'19\',z.el.K(0).4s==\'1o\'?\'2B\':z.el.K(0).4s);k.2H(z.el.K(0),\'1n\')}),\'1G\');if(1u==\'in\'){z.e.1L(z.62+2a*8H,z.62);z.e2.1L(0,1)}P{z.e.1L(z.62,z.62+2a*8H);z.e2.1L(1,0)}};k.fn.23({j0:u(H,W,J,G){E q.1w(\'1n\',u(){12 k.fx.9L(q,H,W,J,\'fp\',G)})},iW:u(H,W,J,G){E q.1w(\'1n\',u(){12 k.fx.9L(q,H,W,J,\'9M\',G)})},iV:u(H,W,J,G){E q.1w(\'1n\',u(){12 k.fx.9L(q,H,W,J,\'3R\',G)})}});k.fx.9L=u(e,H,W,J,1u,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;z.el=k(e);z.G=2g J==\'4V\'?J:G||S;z.J=2g J==\'u\'?J:S;if(1u==\'3R\'){1u=z.el.B(\'19\')==\'1o\'?\'9M\':\'fp\'}z.H=H;z.W=W&&W.1K==bn?W:20;z.fx=k.fx.9P(e);z.1u=1u;z.21=u(){if(z.J&&z.J.1K==2A){z.J.1D(z.el.K(0))}if(z.1u==\'9M\'){z.el.1Y()}P{z.el.2G()}k.fx.a0(z.fx.3p.K(0),z.fx.V);k.2H(z.el.K(0),\'1n\')};if(z.1u==\'9M\'){z.el.1Y();z.fx.3p.B(\'W\',z.W+\'U\').B(\'Z\',\'9R\');z.ef=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,u(){z.ef=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'W\');z.ef.1L(z.W,z.fx.V.1q.hb)}),\'Z\');z.ef.1L(0,z.fx.V.1q.1C)}P{z.ef=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,u(){z.ef=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G,z.21),\'Z\');z.ef.1L(z.fx.V.1q.1C,0)}),\'W\');z.ef.1L(z.fx.V.1q.hb,z.W)}};k.fn.iR=u(H,4x,J,G){E q.1w(\'fv\',u(){q.6W=k(q).1p("14")||\'\';G=2g J==\'4V\'?J:G||S;J=2g J==\'u\'?J:S;D 9S=k(q).B(\'7i\');D 8I=q.31;7d(9S==\'cu\'&&8I){9S=k(8I).B(\'7i\');8I=8I.31}k(q).B(\'7i\',4x);if(2g q.6W==\'8T\')q.6W=q.6W["9X"];k(q).5w({\'7i\':9S},H,G,u(){k.2H(q,\'fv\');if(2g k(q).1p("14")==\'8T\'){k(q).1p("14")["9X"]="";k(q).1p("14")["9X"]=q.6W}P{k(q).1p("14",q.6W)}if(J)J.1D(q)})})};k.fn.23({iT:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.5m(q,H,J,\'49\',\'6g\',G)})},iU:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.5m(q,H,J,\'4j\',\'6g\',G)})},j1:u(H,J,G){E q.1w(\'1n\',u(){if(k.B(q,\'19\')==\'1o\'){12 k.fx.5m(q,H,J,\'4j\',\'6Z\',G)}P{12 k.fx.5m(q,H,J,\'4j\',\'6g\',G)}})},j2:u(H,J,G){E q.1w(\'1n\',u(){if(k.B(q,\'19\')==\'1o\'){12 k.fx.5m(q,H,J,\'49\',\'6Z\',G)}P{12 k.fx.5m(q,H,J,\'49\',\'6g\',G)}})},j9:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.5m(q,H,J,\'49\',\'6Z\',G)})},ja:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.5m(q,H,J,\'4j\',\'6Z\',G)})}});k.fx.5m=u(e,H,J,2S,1u,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;D 73=I;z.el=k(e);z.G=2g J==\'4V\'?J:G||S;z.J=2g J==\'u\'?J:S;z.1u=1u;z.H=H;z.2i=k.1a.2o(e);z.V={};z.V.Y=z.el.B(\'Y\');z.V.19=z.el.B(\'19\');if(z.V.19==\'1o\'){5Y=z.el.B(\'3n\');z.el.1Y();73=1b}z.V.Q=z.el.B(\'Q\');z.V.O=z.el.B(\'O\');if(73){z.el.2G();z.el.B(\'3n\',5Y)}z.V.Z=z.2i.w+\'U\';z.V.W=z.2i.h+\'U\';z.V.2U=z.el.B(\'2U\');z.2i.Q=T(z.V.Q)||0;z.2i.O=T(z.V.O)||0;if(z.V.Y!=\'2s\'&&z.V.Y!=\'1P\'){z.el.B(\'Y\',\'2s\')}z.el.B(\'2U\',\'2K\').B(\'W\',1u==\'6Z\'&&2S==\'49\'?1:z.2i.h+\'U\').B(\'Z\',1u==\'6Z\'&&2S==\'4j\'?1:z.2i.w+\'U\');z.21=u(){z.el.B(z.V);if(z.1u==\'6g\')z.el.2G();P z.el.1Y();k.2H(z.el.K(0),\'1n\')};3m(2S){1e\'49\':z.eh=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'W\');z.et=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'Q\');if(z.1u==\'6g\'){z.eh.1L(z.2i.h,0);z.et.1L(z.2i.Q,z.2i.Q+z.2i.h/2)}P{z.eh.1L(0,z.2i.h);z.et.1L(z.2i.Q+z.2i.h/2,z.2i.Q)}1r;1e\'4j\':z.eh=12 k.fx(z.el.K(0),k.H(H-15,z.G,J),\'Z\');z.et=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'O\');if(z.1u==\'6g\'){z.eh.1L(z.2i.w,0);z.et.1L(z.2i.O,z.2i.O+z.2i.w/2)}P{z.eh.1L(0,z.2i.w);z.et.1L(z.2i.O+z.2i.w/2,z.2i.O)}1r}};k.fn.bg=u(H,3V,J){E q.1w(\'1n\',u(){if(!k.4K(q)){k.2H(q,\'1n\');E I}D fx=12 k.fx.bg(q,H,3V,J);fx.bf()})};k.fx.bg=u(el,H,3V,J){D z=q;z.3V=3V;z.5y=1;z.el=el;z.H=H;z.J=J;k(z.el).1Y();z.bf=u(){z.5y++;z.e=12 k.fx(z.el,k.H(z.H,u(){z.ef=12 k.fx(z.el,k.H(z.H,u(){if(z.5y<=z.3V)z.bf();P{k.2H(z.el,\'1n\');if(z.J&&z.J.1K==2A){z.J.1D(z.el)}}}),\'1G\');z.ef.1L(0,1)}),\'1G\');z.e.1L(1,0)}};k.fn.23({jb:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.6G(q,H,1,2a,1b,J,\'fa\',G)})},jc:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.6G(q,H,2a,1,1b,J,\'b4\',G)})},j8:u(H,J,G){E q.1w(\'1n\',u(){D G=G||\'fl\';12 k.fx.6G(q,H,2a,f8,1b,J,\'6h\',G)})},6G:u(H,57,30,6H,J,G){E q.1w(\'1n\',u(){12 k.fx.6G(q,H,57,30,6H,J,\'6G\',G)})}});k.fx.6G=u(e,H,57,30,6H,J,1u,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;z.el=k(e);z.57=T(57)||2a;z.30=T(30)||2a;z.G=2g J==\'4V\'?J:G||S;z.J=2g J==\'u\'?J:S;z.1m=k.H(H).1m;z.6H=6H||S;z.2i=k.1a.2o(e);z.V={Z:z.el.B(\'Z\'),W:z.el.B(\'W\'),4A:z.el.B(\'4A\')||\'2a%\',Y:z.el.B(\'Y\'),19:z.el.B(\'19\'),Q:z.el.B(\'Q\'),O:z.el.B(\'O\'),2U:z.el.B(\'2U\'),4S:z.el.B(\'4S\'),5O:z.el.B(\'5O\'),5Q:z.el.B(\'5Q\'),5b:z.el.B(\'5b\'),5M:z.el.B(\'5M\'),5U:z.el.B(\'5U\'),5n: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z.30,l,t,1b,o)},13);z.4w()}P{o=1;if(!k.G||!k.G[z.G]){s=((-18.5H(p*18.2Q)/2)+0.5)*(z.30-z.57)+z.57}P{s=k.G[z.G](p,n,z.57,(z.30-z.57),z.1m)}if(z.1u){if(!k.G||!k.G[z.G]){t=((-18.5H(p*18.2Q)/2)+0.5)*(z.5a-z.4b)+z.4b;l=((-18.5H(p*18.2Q)/2)+0.5)*(z.59-z.4k)+z.4k;if(z.1u==\'6h\')o=((-18.5H(p*18.2Q)/2)+0.5)*(-0.9Y)+0.9Y}P{t=k.G[z.G](p,n,z.4b,(z.5a-z.4b),z.1m);l=k.G[z.G](p,n,z.4k,(z.59-z.4k),z.1m);if(z.1u==\'6h\')o=k.G[z.G](p,n,0.9Y,-0.9Y,z.1m)}}z.bs(s,l,t,I,o)}};z.2I=6V(u(){z.2D()},13);z.bs=u(4q,O,Q,fM,1G){z.el.B(\'W\',z.W*4q/2a+\'U\').B(\'Z\',z.Z*4q/2a+\'U\').B(\'O\',O+\'U\').B(\'Q\',Q+\'U\').B(\'4A\',z.4A*4q/2a+z.fg);if(z.bw)z.el.B(\'4S\',z.bw*4q/2a+z.fc);if(z.bc)z.el.B(\'5O\',z.bc*4q/2a+z.fe);if(z.bA)z.el.B(\'5Q\',z.bA*4q/2a+z.fL);if(z.bt)z.el.B(\'5b\',z.bt*4q/2a+z.g8);if(z.bx)z.el.B(\'5M\',z.bx*4q/2a+z.g4);if(z.bv)z.el.B(\'5U\',z.bv*4q/2a+z.g9);if(z.bj)z.el.B(\'5n\',z.bj*4q/2a+z.gc);if(z.b7)z.el.B(\'4X\',z.b7*4q/2a+z.fK);if(z.1u==\'6h\'){if(1X.71)z.el.K(0).14.5E="8V(1G="+1G*2a+")";z.el.K(0).14.1G=1G}if(fM){if(z.6H){z.el.B(z.V)}if(z.1u==\'b4\'||z.1u==\'6h\'){z.el.B(\'19\',\'1o\');if(z.1u==\'6h\'){if(1X.71)z.el.K(0).14.5E="8V(1G="+2a+")";z.el.K(0).14.1G=1}}P z.el.B(\'19\',\'2B\');if(z.J)z.J.1D(z.el.K(0));k.2H(z.el.K(0),\'1n\')}}};k.fn.23({9U:u(H,1O,G){o=k.H(H);E q.1w(\'1n\',u(){12 k.fx.9U(q,o,1O,G)})},j6:u(H,1O,G){E q.1E(u(){k(\'a[@3h*="#"]\',q).5h(u(e){fW=q.3h.7C(\'#\');k(\'#\'+fW[1]).9U(H,1O,G);E I})})}});k.fx.9U=u(e,o,1O,G){D z=q;z.o=o;z.e=e;z.1O=/fT|gd/.48(1O)?1O:I;z.G=G;p=k.1a.3w(e);s=k.1a.6z();z.4w=u(){5T(z.2I);z.2I=S;k.2H(z.e,\'1n\')};z.t=(12 7g).7z();s.h=s.h>s.ih?(s.h-s.ih):s.h;s.w=s.w>s.iw?(s.w-s.iw):s.w;z.5a=p.y>s.h?s.h:p.y;z.59=p.x>s.w?s.w:p.x;z.4b=s.t;z.4k=s.l;z.2D=u(){D t=(12 7g).7z();D n=t-z.t;D p=n/z.o.1m;if(t>=z.o.1m+z.t){z.4w();9T(u(){z.d3(z.5a,z.59)},13)}P{if(!z.1O||z.1O==\'fT\'){if(!k.G||!k.G[z.G]){9V=((-18.5H(p*18.2Q)/2)+0.5)*(z.5a-z.4b)+z.4b}P{9V=k.G[z.G](p,n,z.4b,(z.5a-z.4b),z.o.1m)}}P{9V=z.4b}if(!z.1O||z.1O==\'gd\'){if(!k.G||!k.G[z.G]){9W=((-18.5H(p*18.2Q)/2)+0.5)*(z.59-z.4k)+z.4k}P{9W=k.G[z.G](p,n,z.4k,(z.59-z.4k),z.o.1m)}}P{9W=z.4k}z.d3(9V,9W)}};z.d3=u(t,l){1X.j4(l,t)};z.2I=6V(u(){z.2D()},13)};k.fn.cY=u(3V,J){E q.1w(\'1n\',u(){if(!k.4K(q)){k.2H(q,\'1n\');E I}D e=12 k.fx.cY(q,3V,J);e.cG()})};k.fx.cY=u(e,3V,J){D z=q;z.el=k(e);z.el.1Y();z.3V=T(3V)||3;z.J=J;z.5y=1;z.V={};z.V.Y=z.el.B(\'Y\');z.V.Q=T(z.el.B(\'Q\'))||0;z.V.O=T(z.el.B(\'O\'))||0;if(z.V.Y!=\'2s\'&&z.V.Y!=\'1P\'){z.el.B(\'Y\',\'2s\')}z.cG=u(){z.5y++;z.e=12 k.fx(z.el.K(0),{1m:60,21:u(){z.e=12 k.fx(z.el.K(0),{1m:60,21:u(){z.e=12 k.fx(e,{1m:60,21:u(){if(z.5y<=z.3V)z.cG();P{z.el.B(\'Y\',z.V.Y).B(\'Q\',z.V.Q+\'U\').B(\'O\',z.V.O+\'U\');k.2H(z.el.K(0),\'1n\');if(z.J&&z.J.1K==2A){z.J.1D(z.el.K(0))}}}},\'O\');z.e.1L(z.V.O-20,z.V.O)}},\'O\');z.e.1L(z.V.O+20,z.V.O-20)}},\'O\');z.e.1L(z.V.O,z.V.O+20)}};k.fn.23({fo:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4F\',\'in\',G)})},fq:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4F\',\'4l\',G)})},iY:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4F\',\'3R\',G)})},iX:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4r\',\'in\',G)})},jr:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4r\',\'4l\',G)})},jq:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'4r\',\'3R\',G)})},jp:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'O\',\'in\',G)})},jn:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'O\',\'4l\',G)})},jm:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'O\',\'3R\',G)})},iP:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'2L\',\'in\',G)})},ic:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'2L\',\'4l\',G)})},ib:u(H,J,G){E q.1w(\'1n\',u(){12 k.fx.1z(q,H,J,\'2L\',\'3R\',G)})}});k.fx.1z=u(e,H,J,2S,1u,G){if(!k.4K(e)){k.2H(e,\'1n\');E I}D z=q;z.el=k(e);z.G=2g J==\'4V\'?J:G||S;z.J=2g J==\'u\'?J:S;if(1u==\'3R\'){1u=z.el.B(\'19\')==\'1o\'?\'in\':\'4l\'}if(!e.4s)e.4s=z.el.B(\'19\');z.el.1Y();z.H=H;z.fx=k.fx.9P(e);z.1u=1u;z.2S=2S;z.21=u(){if(z.1u==\'4l\')z.el.B(\'3n\',\'2K\');k.fx.a0(z.fx.3p.K(0),z.fx.V);if(z.1u==\'in\'){z.el.B(\'19\',z.el.K(0).4s==\'1o\'?\'2B\':z.el.K(0).4s)}P{z.el.B(\'19\',\'1o\');z.el.B(\'3n\',\'dd\')}if(z.J&&z.J.1K==2A){z.J.1D(z.el.K(0))}k.2H(z.el.K(0),\'1n\')};3m(z.2S){1e\'4F\':z.ef=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'Q\');z.7v=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G),\'W\');if(z.1u==\'in\'){z.ef.1L(-z.fx.V.1q.hb,0);z.7v.1L(0,z.fx.V.1q.hb)}P{z.ef.1L(0,-z.fx.V.1q.hb);z.7v.1L(z.fx.V.1q.hb,0)}1r;1e\'4r\':z.ef=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'Q\');if(z.1u==\'in\'){z.ef.1L(z.fx.V.1q.hb,0)}P{z.ef.1L(0,z.fx.V.1q.hb)}1r;1e\'O\':z.ef=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'O\');z.7v=12 k.fx(z.fx.3p.K(0),k.H(z.H,z.G),\'Z\');if(z.1u==\'in\'){z.ef.1L(-z.fx.V.1q.1C,0);z.7v.1L(0,z.fx.V.1q.1C)}P{z.ef.1L(0,-z.fx.V.1q.1C);z.7v.1L(z.fx.V.1q.1C,0)}1r;1e\'2L\':z.ef=12 k.fx(z.el.K(0),k.H(z.H,z.G,z.21),\'O\');if(z.1u==\'in\'){z.ef.1L(z.fx.V.1q.1C,0)}P{z.ef.1L(0,z.fx.V.1q.1C)}1r}};k.3f=S;k.fn.ig=u(o){E q.1w(\'1n\',u(){12 k.fx.dG(q,o)})};k.fx.dG=u(e,o){if(k.3f==S){k(\'2e\',1h).1S(\'<22 id="3f"></22>\');k.3f=k(\'#3f\')}k.3f.B(\'19\',\'2B\').B(\'Y\',\'1P\');D z=q;z.el=k(e);if(!o||!o.30){E}if(o.30.1K==b0&&1h.9e(o.30)){o.30=1h.9e(o.30)}P if(!o.30.dq){E}if(!o.1m){o.1m=g5}z.1m=o.1m;z.30=o.30;z.8r=o.3l;z.21=o.21;if(z.8r){k.3f.2R(z.8r)}z.a3=0;z.a2=0;if(k.dF){z.a3=(T(k.3f.B(\'5b\'))||0)+(T(k.3f.B(\'5O\'))||0)+(T(k.3f.B(\'4X\'))||0)+(T(k.3f.B(\'5U\'))||0);z.a2=(T(k.3f.B(\'4S\'))||0)+(T(k.3f.B(\'5Q\'))||0)+(T(k.3f.B(\'5M\'))||0)+(T(k.3f.B(\'5n\'))||0)}z.26=k.23(k.1a.3w(z.el.K(0)),k.1a.2o(z.el.K(0)));z.2T=k.23(k.1a.3w(z.30),k.1a.2o(z.30));z.26.1C-=z.a3;z.26.hb-=z.a2;z.2T.1C-=z.a3;z.2T.hb-=z.a2;z.J=o.21;k.3f.B(\'Z\',z.26.1C+\'U\').B(\'W\',z.26.hb+\'U\').B(\'Q\',z.26.y+\'U\').B(\'O\',z.26.x+\'U\').5w({Q:z.2T.y,O:z.2T.x,Z:z.2T.1C,W:z.2T.hb},z.1m,u(){if(z.8r)k.3f.4i(z.8r);k.3f.B(\'19\',\'1o\');if(z.21&&z.21.1K==2A){z.21.1D(z.el.K(0),[z.30])}k.2H(z.el.K(0),\'1n\')})};k.1v={M:{2E:10,ec:\'1Q/iJ.eZ\',e3:\'<1T 2J="1Q/6g.da" />\',eW:0.8,d8:\'iN a6\',dc:\'57\',3W:8J},jQ:I,jW:I,6j:S,8m:I,8k:I,d1:u(2k){if(!k.1v.8k||k.1v.8m)E;D 3K=2k.7L||2k.7K||-1;3m(3K){1e 35:if(k.1v.6j)k.1v.26(S,k(\'a[@4I=\'+k.1v.6j+\']:jJ\').K(0));1r;1e 36:if(k.1v.6j)k.1v.26(S,k(\'a[@4I=\'+k.1v.6j+\']:jL\').K(0));1r;1e 37:1e 8:1e 33:1e 80:1e kb:D 9p=k(\'#87\');if(9p.K(0).53!=S){9p.K(0).53.1D(9p.K(0))}1r;1e 38:1r;1e 39:1e 34:1e 32:1e gl:1e 78:D 9k=k(\'#88\');if(9k.K(0).53!=S){9k.K(0).53.1D(9k.K(0))}1r;1e 40:1r;1e 27:k.1v.au();1r}},7q:u(M){if(M)k.23(k.1v.M,M);if(1X.2k){k(\'2e\',1h).1J(\'6y\',k.1v.d1)}P{k(1h).1J(\'6y\',k.1v.d1)}k(\'a\').1E(u(){el=k(q);en=el.1p(\'4I\')||\'\';e9=el.1p(\'3h\')||\'\';ev=/\\.da|\\.gw|\\.8X|\\.eZ|\\.gn/g;if(e9.6c().d5(ev)!=S&&en.6c().3J(\'eU\')==0){el.1J(\'5h\',k.1v.26)}});if(k.3a.4t){3A=1h.3F(\'3A\');k(3A).1p({id:\'cN\',2J:\'ek:I;\',ej:\'cD\',ep:\'cD\'}).B({19:\'1o\',Y:\'1P\',Q:\'0\',O:\'0\',5E:\'9n:9w.9y.cC(1G=0)\'});k(\'2e\').1S(3A)}8n=1h.3F(\'22\');k(8n).1p(\'id\',\'cP\').B({Y:\'1P\',19:\'1o\',Q:\'0\',O:\'0\',1G:0}).1S(1h.8M(\' \')).1J(\'5h\',k.1v.au);6A=1h.3F(\'22\');k(6A).1p(\'id\',\'eK\').B({4X:k.1v.M.2E+\'U\'}).1S(1h.8M(\' \'));cE=1h.3F(\'22\');k(cE).1p(\'id\',\'dg\').B({4X:k.1v.M.2E+\'U\',5n:k.1v.M.2E+\'U\'}).1S(1h.8M(\' \'));cF=1h.3F(\'a\');k(cF).1p({id:\'gg\',3h:\'#\'}).B({Y:\'1P\',2L:k.1v.M.2E+\'U\',Q:\'0\'}).1S(k.1v.M.e3).1J(\'5h\',k.1v.au);7m=1h.3F(\'22\');k(7m).1p(\'id\',\'cM\').B({Y:\'2s\',cA:\'O\',6w:\'0 9F\',3I:1}).1S(6A).1S(cE).1S(cF);2b=1h.3F(\'1T\');2b.2J=k.1v.M.ec;k(2b).1p(\'id\',\'eM\').B({Y:\'1P\'});4G=1h.3F(\'a\');k(4G).1p({id:\'87\',3h:\'#\'}).B({Y:\'1P\',19:\'1o\',2U:\'2K\',ey:\'1o\'}).1S(1h.8M(\' \'));4M=1h.3F(\'a\');k(4M).1p({id:\'88\',3h:\'#\'}).B({Y:\'1P\',2U:\'2K\',ey:\'1o\'}).1S(1h.8M(\' \'));1Z=1h.3F(\'22\');k(1Z).1p(\'id\',\'eE\').B({19:\'1o\',Y:\'2s\',2U:\'2K\',cA:\'O\',6w:\'0 9F\',Q:\'0\',O:\'0\',3I:2}).1S([2b,4G,4M]);6F=1h.3F(\'22\');k(6F).1p(\'id\',\'ao\').B({19:\'1o\',Y:\'1P\',2U:\'2K\',Q:\'0\',O:\'0\',cA:\'cv\',7i:\'cu\',hC:\'0\'}).1S([1Z,7m]);k(\'2e\').1S(8n).1S(6F)},26:u(e,C){el=C?k(C):k(q);9t=el.1p(\'4I\');D 6B,4u,4G,4M;if(9t!=\'eU\'){k.1v.6j=9t;8Y=k(\'a[@4I=\'+9t+\']\');6B=8Y.1N();4u=8Y.cZ(C?C:q);4G=8Y.K(4u-1);4M=8Y.K(4u+1)}89=el.1p(\'3h\');6A=el.1p(\'4g\');3O=k.1a.6z();8n=k(\'#cP\');if(!k.1v.8k){k.1v.8k=1b;if(k.3a.4t){k(\'#cN\').B(\'W\',18.3r(3O.ih,3O.h)+\'U\').B(\'Z\',18.3r(3O.iw,3O.w)+\'U\').1Y()}8n.B(\'W\',18.3r(3O.ih,3O.h)+\'U\').B(\'Z\',18.3r(3O.iw,3O.w)+\'U\').1Y().fX(cO,k.1v.M.eW,u(){k.1v.cw(89,6A,3O,6B,4u,4G,4M)});k(\'#ao\').B(\'Z\',18.3r(3O.iw,3O.w)+\'U\')}P{k(\'#87\').K(0).53=S;k(\'#88\').K(0).53=S;k.1v.cw(89,6A,3O,6B,4u,4G,4M)}E I},cw:u(89,gP,3O,6B,4u,4G,4M){k(\'#cW\').bk();aX=k(\'#87\');aX.2G();aO=k(\'#88\');aO.2G();2b=k(\'#eM\');1Z=k(\'#eE\');6F=k(\'#ao\');7m=k(\'#cM\').B(\'3n\',\'2K\');k(\'#eK\').3x(6A);k.1v.8m=1b;if(6B)k(\'#dg\').3x(k.1v.M.d8+\' \'+(4u+1)+\' \'+k.1v.M.dc+\' \'+6B);if(4G){aX.K(0).53=u(){q.5B();k.1v.26(S,4G);E I}}if(4M){aO.K(0).53=u(){q.5B();k.1v.26(S,4M);E I}}2b.1Y();82=k.1a.2o(1Z.K(0));56=18.3r(82.1C,2b.K(0).Z+k.1v.M.2E*2);6f=18.3r(82.hb,2b.K(0).W+k.1v.M.2E*2);2b.B({O:(56-2b.K(0).Z)/2+\'U\',Q:(6f-2b.K(0).W)/2+\'U\'});1Z.B({Z:56+\'U\',W:6f+\'U\'}).1Y();dw=k.1a.bm();6F.B(\'Q\',3O.t+(dw.h/15)+\'U\');if(6F.B(\'19\')==\'1o\'){6F.1Y().7f(k.1v.M.3W)}6k=12 9s;k(6k).1p(\'id\',\'cW\').1J(\'hJ\',u(){56=6k.Z+k.1v.M.2E*2;6f=6k.W+k.1v.M.2E*2;2b.2G();1Z.5w({W:6f},82.hb!=6f?k.1v.M.3W:1,u(){1Z.5w({Z:56},82.1C!=56?k.1v.M.3W:1,u(){1Z.bG(6k);k(6k).B({Y:\'1P\',O:k.1v.M.2E+\'U\',Q:k.1v.M.2E+\'U\'}).7f(k.1v.M.3W,u(){db=k.1a.2o(7m.K(0));if(4G){aX.B({O:k.1v.M.2E+\'U\',Q:k.1v.M.2E+\'U\',Z:56/2-k.1v.M.2E*3+\'U\',W:6f-k.1v.M.2E*2+\'U\'}).1Y()}if(4M){aO.B({O:56/2+k.1v.M.2E*2+\'U\',Q:k.1v.M.2E+\'U\',Z:56/2-k.1v.M.2E*3+\'U\',W:6f-k.1v.M.2E*2+\'U\'}).1Y()}7m.B({Z:56+\'U\',Q:-db.hb+\'U\',3n:\'dd\'}).5w({Q:-1},k.1v.M.3W,u(){k.1v.8m=I})})})})});6k.2J=89},au:u(){k(\'#cW\').bk();k(\'#ao\').2G();k(\'#cM\').B(\'3n\',\'2K\');k(\'#cP\').fX(cO,0,u(){k(q).2G();if(k.3a.4t){k(\'#cN\').2G()}});k(\'#87\').K(0).53=S;k(\'#88\').K(0).53=S;k.1v.6j=S;k.1v.8k=I;k.1v.8m=I;E I}};k.R={1A:S,41:S,F:S,1s:S,1q:S,Y:S,9a:u(e){k.R.F=(q.d0)?q.d0:q;k.R.1s=k.1a.4a(e);k.R.1q={Z:T(k(k.R.F).B(\'Z\'))||0,W:T(k(k.R.F).B(\'W\'))||0};k.R.Y={Q:T(k(k.R.F).B(\'Q\'))||0,O:T(k(k.R.F).B(\'O\'))||0};k(1h).1J(\'3D\',k.R.cR).1J(\'5P\',k.R.cK);if(2g k.R.F.1k.g2===\'u\'){k.R.F.1k.g2.1D(k.R.F)}E I},cK:u(e){k(1h).3q(\'3D\',k.R.cR).3q(\'5P\',k.R.cK);if(2g k.R.F.1k.fN===\'u\'){k.R.F.1k.fN.1D(k.R.F)}k.R.F=S},cR:u(e){if(!k.R.F){E}1s=k.1a.4a(e);7p=k.R.Y.Q-k.R.1s.y+1s.y;7r=k.R.Y.O-k.R.1s.x+1s.x;7p=18.3r(18.3L(7p,k.R.F.1k.8g-k.R.1q.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.R.1A.1k.4v}}D 6p=I;if(k.R.1A.1k.f7){6p=k.R.1A.1k.f7.1D(k.R.1A,[1I,2z]);if(6p){if(6p.1q){k.23(1I,6p.1q)}if(6p.Y){k.23(2z,6p.Y)}}}8d=k.R.1A.14;8d.O=2z.O+\'U\';8d.Q=2z.Q+\'U\';8d.Z=1I.Z+\'U\';8d.W=1I.W+\'U\';E I},2r:u(M){if(!M||!M.3Z||M.3Z.1K!=7M){E}E q.1E(u(){D el=q;el.1k=M;el.1k.av=M.av||10;el.1k.8c=M.8c||10;el.1k.6x=M.6x||6P;el.1k.8b=M.8b||6P;el.1k.7h=M.7h||-aC;el.1k.70=M.70||-aC;el.1k.8h=M.8h||6P;el.1k.8g=M.8g||6P;d6=k(el).B(\'Y\');if(!(d6==\'2s\'||d6==\'1P\')){el.14.Y=\'2s\'}fS=/n|at|e|fj|s|5F|w|76/g;24(i in el.1k.3Z){if(i.6c().d5(fS)!=S){if(el.1k.3Z[i].1K==b0){3v=k(el.1k.3Z[i]);if(3v.1N()>0){el.1k.3Z[i]=3v.K(0)}}if(el.1k.3Z[i].4Y){el.1k.3Z[i].1A=el;el.1k.3Z[i].41=i;k(el.1k.3Z[i]).1J(\'5v\',k.R.26)}}}if(el.1k.5S){if(2g el.1k.5S===\'4V\'){aV=k(el.1k.5S);if(aV.1N()>0){aV.1E(u(){q.d0=el});aV.1J(\'5v\',k.R.9a)}}P if(el.1k.5S==1b){k(q).1J(\'5v\',k.R.9a)}}})},4U:u(){E q.1E(u(){D el=q;24(i in el.1k.3Z){el.1k.3Z[i].1A=S;el.1k.3Z[i].41=S;k(el.1k.3Z[i]).3q(\'5v\',k.R.26)}if(el.1k.5S){if(2g el.1k.5S===\'4V\'){3v=k(el.1k.5S);if(3v.1N()>0){3v.3q(\'5v\',k.R.9a)}}P if(el.1k.5S==1b){k(q).3q(\'5v\',k.R.9a)}}el.1k=S})}};k.fn.23({hz:k.R.2r,hs:k.R.4U});k.2C=S;k.7n=I;k.3k=S;k.7o=[];k.9v=u(e){D 3K=e.7L||e.7K||-1;if(3K==17||3K==16){k.7n=1b}};k.9u=u(e){k.7n=I};k.dL=u(e){q.f.1s=k.1a.4a(e);q.f.1M=k.23(k.1a.3w(q),k.1a.2o(q));q.f.3e=k.1a.6z(q);q.f.1s.x-=q.f.1M.x;q.f.1s.y-=q.f.1M.y;k(q).1S(k.2C.K(0));if(q.f.hc)k.2C.2R(q.f.hc).B(\'19\',\'2B\');k.2C.B({19:\'2B\',Z:\'2P\',W:\'2P\'});if(q.f.o){k.2C.B(\'1G\',q.f.o)}k.3k=q;k.96=I;k.7o=[];q.f.el.1E(u(){q.1M={x:q.8t+(q.4Z&&!k.3a.7I?T(q.4Z.5b)||0:0)+(k.3k.3c||0),y:q.8G+(q.4Z&&!k.3a.7I?T(q.4Z.4S)||0:0)+(k.3k.3d||0),1C:q.4c,hb:q.5W};if(q.s==1b){if(k.7n==I){q.s=I;k(q).4i(k.3k.f.7j)}P{k.96=1b;k.7o[k.7o.1g]=k.1p(q,\'id\')}}});k.am.1D(q,[e]);k(1h).1J(\'3D\',k.am).1J(\'5P\',k.cX);E I};k.am=u(e){if(!k.3k)E;k.fd.1D(k.3k,[e])};k.fd=u(e){if(!k.3k)E;D 1s=k.1a.4a(e);D 3e=k.1a.6z(k.3k);1s.x+=3e.l-q.f.3e.l-q.f.1M.x;1s.y+=3e.t-q.f.3e.t-q.f.1M.y;D 93=18.3L(1s.x,q.f.1s.x);D 5F=18.3L(18.3S(1s.x-q.f.1s.x),18.3S(q.f.3e.w-93));D 99=18.3L(1s.y,q.f.1s.y);D 9g=18.3L(18.3S(1s.y-q.f.1s.y),18.3S(q.f.3e.h-99));if(q.3d>0&&1s.y-20<q.3d){D 3X=18.3L(3e.t,10);99-=3X;9g+=3X;q.3d-=3X}P if(q.3d+q.f.1M.h<q.f.3e.h&&1s.y+20>q.3d+q.f.1M.h){D 3X=18.3L(q.f.3e.h-q.3d,10);q.3d+=3X;if(q.3d!=3e.t)9g+=3X}if(q.3c>0&&1s.x-20<q.3c){D 3X=18.3L(3e.l,10);93-=3X;5F+=3X;q.3c-=3X}P if(q.3c+q.f.1M.w<q.f.3e.w&&1s.x+20>q.3c+q.f.1M.w){D 3X=18.3L(q.f.3e.w-q.3c,10);q.3c+=3X;if(q.3c!=3e.l)5F+=3X}k.2C.B({O:93+\'U\',Q:99+\'U\',Z:5F+\'U\',W:9g+\'U\'});k.2C.l=93+q.f.3e.l;k.2C.t=99+q.f.3e.t;k.2C.r=k.2C.l+5F;k.2C.b=k.2C.t+9g;k.96=I;q.f.el.1E(u(){aw=k.7o.3J(k.1p(q,\'id\'));if(!(q.1M.x>k.2C.r||(q.1M.x+q.1M.1C)<k.2C.l||q.1M.y>k.2C.b||(q.1M.y+q.1M.hb)<k.2C.t)){k.96=1b;if(q.s!=1b){q.s=1b;k(q).2R(k.3k.f.7j)}if(aw!=-1){q.s=I;k(q).4i(k.3k.f.7j)}}P if((q.s==1b)&&(aw==-1)){q.s=I;k(q).4i(k.3k.f.7j)}P if((!q.s)&&(k.7n==1b)&&(aw!=-1)){q.s=1b;k(q).2R(k.3k.f.7j)}});E I};k.cX=u(e){if(!k.3k)E;k.g0.1D(k.3k,[e])};k.g0=u(e){k(1h).3q(\'3D\',k.am).3q(\'5P\',k.cX);if(!k.3k)E;k.2C.B(\'19\',\'1o\');if(q.f.hc)k.2C.4i(q.f.hc);k.3k=I;k(\'2e\').1S(k.2C.K(0));if(k.96==1b){if(q.f.98)q.f.98(k.cJ(k.1p(q,\'id\')))}P{if(q.f.9d)q.f.9d(k.cJ(k.1p(q,\'id\')))}k.7o=[]};k.cJ=u(s){D h=\'\';D o=[];if(a=k(\'#\'+s)){a.K(0).f.el.1E(u(){if(q.s==1b){if(h.1g>0){h+=\'&\'}h+=s+\'[]=\'+k.1p(q,\'id\');o[o.1g]=k.1p(q,\'id\')}})}E{7l:h,o:o}};k.fn.gZ=u(o){if(!k.2C){k(\'2e\',1h).1S(\'<22 id="2C"></22>\').1J(\'7B\',k.9v).1J(\'6y\',k.9u);k.2C=k(\'#2C\');k.2C.B({Y:\'1P\',19:\'1o\'});if(1X.2k){k(\'2e\',1h).1J(\'7B\',k.9v).1J(\'6y\',k.9u)}P{k(1h).1J(\'7B\',k.9v).1J(\'6y\',k.9u)}}if(!o){o={}}E q.1E(u(){if(q.eP)E;q.eP=1b;q.f={a:o.3C,o:o.1G?2m(o.1G):I,7j:o.eS?o.eS:I,hc:o.58?o.58:I,98:o.98?o.98:I,9d:o.9d?o.9d:I};q.f.el=k(\'.\'+o.3C);k(q).1J(\'5v\',k.dL).B(\'Y\',\'2s\')})};k.3b={bM:1,eH:u(3t){D 3t=3t;E q.1E(u(){q.4z.6s.1E(u(ab){k.3b.5c(q,3t[ab])})})},K:u(){D 3t=[];q.1E(u(cL){if(q.bI){3t[cL]=[];D C=q;D 1q=k.1a.2o(q);q.4z.6s.1E(u(ab){D x=q.8t;D y=q.8G;92=T(x*2a/(1q.w-q.4c));91=T(y*2a/(1q.h-q.5W));3t[cL][ab]=[92||0,91||0,x||0,y||0]})}});E 3t},ct:u(C){C.A.fu=C.A.28.w-C.A.1B.1C;C.A.fw=C.A.28.h-C.A.1B.hb;if(C.9r.4z.bC){9Z=C.9r.4z.6s.K(C.bF+1);if(9Z){C.A.28.w=(T(k(9Z).B(\'O\'))||0)+C.A.1B.1C;C.A.28.h=(T(k(9Z).B(\'Q\'))||0)+C.A.1B.hb}9Q=C.9r.4z.6s.K(C.bF-1);if(9Q){D cU=T(k(9Q).B(\'O\'))||0;D cH=T(k(9Q).B(\'O\'))||0;C.A.28.x+=cU;C.A.28.y+=cH;C.A.28.w-=cU;C.A.28.h-=cH}}C.A.g7=C.A.28.w-C.A.1B.1C;C.A.eC=C.A.28.h-C.A.1B.hb;if(C.A.2O){C.A.gx=((C.A.28.w-C.A.1B.1C)/C.A.2O)||1;C.A.gy=((C.A.28.h-C.A.1B.hb)/C.A.2O)||1;C.A.fU=C.A.g7/C.A.2O;C.A.fH=C.A.e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'?2q:C.A.2c.y||0;C.14.O=2v+\'U\';C.14.Q=2q+\'U\'},2r:u(o){E q.1E(u(){if(q.bI==1b||!o.3C||!k.1a||!k.11||!k.1x){E}5x=k(o.3C,q);if(5x.1N()==0){E}D 4N={2p:\'94\',5i:1b,3H:o.3H&&o.3H.1K==2A?o.3H:S,2Z:o.2Z&&o.2Z.1K==2A?o.2Z:S,3v:q,1G:o.1G||I};if(o.2O&&T(o.2O)){4N.2O=T(o.2O)||1;4N.2O=4N.2O>0?4N.2O:1}if(5x.1N()==1)5x.7t(4N);P{k(5x.K(0)).7t(4N);4N.3v=S;5x.7t(4N)}5x.7B(k.3b.eI);5x.1p(\'bM\',k.3b.bM++);q.bI=1b;q.4z={};q.4z.er=4N.er;q.4z.2O=4N.2O;q.4z.6s=5x;q.4z.bC=o.bC?1b:I;bZ=q;bZ.4z.6s.1E(u(2N){q.bF=2N;q.9r=bZ});if(o.3t&&o.3t.1K==7F){24(i=o.3t.1g-1;i>=0;i--){if(o.3t[i].1K==7F&&o.3t[i].1g==2){el=q.4z.6s.K(i);if(el.4Y){k.3b.5c(el,o.3t[i])}}}}})}};k.fn.23({hN:k.3b.2r,hS:k.3b.eH,hG:k.3b.K});k.2u={5I:[],eg:u(){q.5B();X=q.31;id=k.1p(X,\'id\');if(k.2u.5I[id]!=S){1X.5T(k.2u.5I[id])}1z=X.L.3u+1;if(X.L.1Q.1g<1z){1z=1}1Q=k(\'1T\',X.L.5u);X.L.3u=1z;if(1Q.1N()>0){1Q.7a(X.L.3W,k.2u.95)}},dp:u(){q.5B();X=q.31;id=k.1p(X,\'id\');if(k.2u.5I[id]!=S){1X.5T(k.2u.5I[id])}1z=X.L.3u-1;1Q=k(\'1T\',X.L.5u);if(1z<1){1z=X.L.1Q.1g}X.L.3u=1z;if(1Q.1N()>0){1Q.7a(X.L.3W,k.2u.95)}},2I:u(c){X=1h.9e(c);if(X.L.6o){1z=X.L.3u;7d(1z==X.L.3u){1z=1+T(18.6o()*X.L.1Q.1g)}}P{1z=X.L.3u+1;if(X.L.1Q.1g<1z){1z=1}}1Q=k(\'1T\',X.L.5u);X.L.3u=1z;if(1Q.1N()>0){1Q.7a(X.L.3W,k.2u.95)}},go:u(o){D X;if(o&&o.1K==7M){if(o.2b){X=1h.9e(o.2b.X);5N=1X.hn.3h.7C("#");o.2b.6S=S;if(5N.1g==2){1z=T(5N[1]);1Y=5N[1].4E(1z,\'\');if(k.1p(X,\'id\')!=1Y){1z=1}}P{1z=1}}if(o.90){o.90.5B();X=o.90.31.31;id=k.1p(X,\'id\');if(k.2u.5I[id]!=S){1X.5T(k.2u.5I[id])}5N=o.90.3h.7C("#");1z=T(5N[1]);1Y=5N[1].4E(1z,\'\');if(k.1p(X,\'id\')!=1Y){1z=1}}if(X.L.1Q.1g<1z||1z<1){1z=1}X.L.3u=1z;52=k.1a.2o(X);dt=k.1a.aT(X);d9=k.1a.6U(X);if(X.L.3z){X.L.3z.o.B(\'19\',\'1o\')}if(X.L.3s){X.L.3s.o.B(\'19\',\'1o\')}if(X.L.2b){y=T(dt.t)+T(d9.t);if(X.L.1U){if(X.L.1U.5A==\'Q\'){y+=X.L.1U.4C.hb}P{52.h-=X.L.1U.4C.hb}}if(X.L.2x){if(X.L.2x&&X.L.2x.6Q==\'Q\'){y+=X.L.2x.4C.hb}P{52.h-=X.L.2x.4C.hb}}if(!X.L.c1){X.L.df=o.2b?o.2b.W:(T(X.L.2b.B(\'W\'))||0);X.L.c1=o.2b?o.2b.Z:(T(X.L.2b.B(\'Z\'))||0)}X.L.2b.B(\'Q\',y+(52.h-X.L.df)/2+\'U\');X.L.2b.B(\'O\',(52.1C-X.L.c1)/2+\'U\');X.L.2b.B(\'19\',\'2B\')}1Q=k(\'1T\',X.L.5u);if(1Q.1N()>0){1Q.7a(X.L.3W,k.2u.95)}P{aj=k(\'a\',X.L.1U.o).K(1z-1);k(aj).2R(X.L.1U.5R);D 1T=12 9s();1T.X=k.1p(X,\'id\');1T.1z=1z-1;1T.2J=X.L.1Q[X.L.3u-1].2J;if(1T.21){1T.6S=S;k.2u.19.1D(1T)}P{1T.6S=k.2u.19}if(X.L.2x){X.L.2x.o.3x(X.L.1Q[1z-1].6L)}}}},95:u(){X=q.31.31;X.L.5u.B(\'19\',\'1o\');if(X.L.1U.5R){aj=k(\'a\',X.L.1U.o).4i(X.L.1U.5R).K(X.L.3u-1);k(aj).2R(X.L.1U.5R)}D 1T=12 9s();1T.X=k.1p(X,\'id\');1T.1z=X.L.3u-1;1T.2J=X.L.1Q[X.L.3u-1].2J;if(1T.21){1T.6S=S;k.2u.19.1D(1T)}P{1T.6S=k.2u.19}if(X.L.2x){X.L.2x.o.3x(X.L.1Q[X.L.3u-1].6L)}},19:u(){X=1h.9e(q.X);if(X.L.3z){X.L.3z.o.B(\'19\',\'1o\')}if(X.L.3s){X.L.3s.o.B(\'19\',\'1o\')}52=k.1a.2o(X);y=0;if(X.L.1U){if(X.L.1U.5A==\'Q\'){y+=X.L.1U.4C.hb}P{52.h-=X.L.1U.4C.hb}}if(X.L.2x){if(X.L.2x&&X.L.2x.6Q==\'Q\'){y+=X.L.2x.4C.hb}P{52.h-=X.L.2x.4C.hb}}hg=k(\'.ca\',X);y=y+(52.h-q.W)/2;x=(52.1C-q.Z)/2;X.L.5u.B(\'Q\',y+\'U\').B(\'O\',x+\'U\').3x(\'<1T 2J="\'+q.2J+\'" />\');X.L.5u.7f(X.L.3W);3s=X.L.3u+1;if(3s>X.L.1Q.1g){3s=1}3z=X.L.3u-1;if(3z<1){3z=X.L.1Q.1g}X.L.3s.o.B(\'19\',\'2B\').B(\'Q\',y+\'U\').B(\'O\',x+2*q.Z/3+\'U\').B(\'Z\',q.Z/3+\'U\').B(\'W\',q.W+\'U\').1p(\'4g\',X.L.1Q[3s-1].6L);X.L.3s.o.K(0).3h=\'#\'+3s+k.1p(X,\'id\');X.L.3z.o.B(\'19\',\'2B\').B(\'Q\',y+\'U\').B(\'O\',x+\'U\').B(\'Z\',q.Z/3+\'U\').B(\'W\',q.W+\'U\').1p(\'4g\',X.L.1Q[3z-1].6L);X.L.3z.o.K(0).3h=\'#\'+3z+k.1p(X,\'id\')},2r:u(o){if(!o||!o.1Z||k.2u.5I[o.1Z])E;D 1Z=k(\'#\'+o.1Z);D el=1Z.K(0);if(el.14.Y!=\'1P\'&&el.14.Y!=\'2s\'){el.14.Y=\'2s\'}el.14.2U=\'2K\';if(1Z.1N()==0)E;el.L={};el.L.1Q=o.1Q?o.1Q:[];el.L.6o=o.6o&&o.6o==1b||I;97=el.f3(\'hL\');24(i=0;i<97.1g;i++){7Z=el.L.1Q.1g;el.L.1Q[7Z]={2J:97[i].2J,6L:97[i].4g||97[i].hD||\'\'}}if(el.L.1Q.1g==0){E}el.L.4n=k.23(k.1a.3w(el),k.1a.2o(el));el.L.b5=k.1a.aT(el);el.L.bu=k.1a.6U(el);t=T(el.L.b5.t)+T(el.L.bu.t);b=T(el.L.b5.b)+T(el.L.bu.b);k(\'1T\',el).bk();el.L.3W=o.3W?o.3W:g5;if(o.5A||o.9f||o.5R){el.L.1U={};1Z.1S(\'<22 6T="g1"></22>\');el.L.1U.o=k(\'.g1\',el);if(o.9f){el.L.1U.9f=o.9f;el.L.1U.o.2R(o.9f)}if(o.5R){el.L.1U.5R=o.5R}el.L.1U.o.B(\'Y\',\'1P\').B(\'Z\',el.L.4n.w+\'U\');if(o.5A&&o.5A==\'Q\'){el.L.1U.5A=\'Q\';el.L.1U.o.B(\'Q\',t+\'U\')}P{el.L.1U.5A=\'4D\';el.L.1U.o.B(\'4D\',b+\'U\')}el.L.1U.aE=o.aE?o.aE:\' \';24(D i=0;i<el.L.1Q.1g;i++){7Z=T(i)+1;el.L.1U.o.1S(\'<a 3h="#\'+7Z+o.1Z+\'" 6T="gR" 4g="\'+el.L.1Q[i].6L+\'">\'+7Z+\'</a>\'+(7Z!=el.L.1Q.1g?el.L.1U.aE:\'\'))}k(\'a\',el.L.1U.o).1J(\'5h\',u(){k.2u.go({90:q})});el.L.1U.4C=k.1a.2o(el.L.1U.o.K(0))}if(o.6Q||o.9c){el.L.2x={};1Z.1S(\'<22 6T="dn">&7k;</22>\');el.L.2x.o=k(\'.dn\',el);if(o.9c){el.L.2x.9c=o.9c;el.L.2x.o.2R(o.9c)}el.L.2x.o.B(\'Y\',\'1P\').B(\'Z\',el.L.4n.w+\'U\');if(o.6Q&&o.6Q==\'Q\'){el.L.2x.6Q=\'Q\';el.L.2x.o.B(\'Q\',(el.L.1U&&el.L.1U.5A==\'Q\'?el.L.1U.4C.hb+t:t)+\'U\')}P{el.L.2x.6Q=\'4D\';el.L.2x.o.B(\'4D\',(el.L.1U&&el.L.1U.5A==\'4D\'?el.L.1U.4C.hb+b:b)+\'U\')}el.L.2x.4C=k.1a.2o(el.L.2x.o.K(0))}if(o.9D){el.L.3s={9D:o.9D};1Z.1S(\'<a 3h="#2\'+o.1Z+\'" 6T="eY">&7k;</a>\');el.L.3s.o=k(\'.eY\',el);el.L.3s.o.B(\'Y\',\'1P\').B(\'19\',\'1o\').B(\'2U\',\'2K\').B(\'4A\',\'eR\').2R(el.L.3s.9D);el.L.3s.o.1J(\'5h\',k.2u.eg)}if(o.9o){el.L.3z={9o:o.9o};1Z.1S(\'<a 3h="#0\'+o.1Z+\'" 6T="ee">&7k;</a>\');el.L.3z.o=k(\'.ee\',el);el.L.3z.o.B(\'Y\',\'1P\').B(\'19\',\'1o\').B(\'2U\',\'2K\').B(\'4A\',\'eR\').2R(el.L.3z.9o);el.L.3z.o.1J(\'5h\',k.2u.dp)}1Z.bG(\'<22 6T="ca"></22>\');el.L.5u=k(\'.ca\',el);el.L.5u.B(\'Y\',\'1P\').B(\'Q\',\'2P\').B(\'O\',\'2P\').B(\'19\',\'1o\');if(o.2b){1Z.bG(\'<22 6T="dW" 14="19: 1o;"><1T 2J="\'+o.2b+\'" /></22>\');el.L.2b=k(\'.dW\',el);el.L.2b.B(\'Y\',\'1P\');D 1T=12 9s();1T.X=o.1Z;1T.2J=o.2b;if(1T.21){1T.6S=S;k.2u.go({2b:1T})}P{1T.6S=u(){k.2u.go({2b:q})}}}P{k.2u.go({1Z:el})}if(o.cS){fi=T(o.cS)*aC}k.2u.5I[o.1Z]=o.cS?1X.6V(\'k.2u.2I(\\\'\'+o.1Z+\'\\\')\',fi):S}};k.X=k.2u.2r;k.1t={7s:[],5L:{},1c:I,7u:S,26:u(){if(k.11.F==S){E}D 4O,3G,c,cs;k.1t.1c.K(0).3l=k.11.F.A.6R;4O=k.1t.1c.K(0).14;4O.19=\'2B\';k.1t.1c.1B=k.23(k.1a.3w(k.1t.1c.K(0)),k.1a.2o(k.1t.1c.K(0)));4O.Z=k.11.F.A.1B.1C+\'U\';4O.W=k.11.F.A.1B.hb+\'U\';3G=k.1a.cy(k.11.F);4O.5K=3G.t;4O.5z=3G.r;4O.5k=3G.b;4O.5j=3G.l;if(k.11.F.A.46==1b){c=k.11.F.fI(1b);cs=c.14;cs.5K=\'2P\';cs.5z=\'2P\';cs.5k=\'2P\';cs.5j=\'2P\';cs.19=\'2B\';k.1t.1c.5o().1S(c)}k(k.11.F).f5(k.1t.1c.K(0));k.11.F.14.19=\'1o\'},fC:u(e){if(!e.A.44&&k.1x.5r.cQ){if(e.A.3T)e.A.3T.1D(F);k(e).B(\'Y\',e.A.cz||e.A.4n);k(e).aS();k(k.1x.5r).f6(e)}k.1t.1c.4i(e.A.6R).3x(\'&7k;\');k.1t.7u=S;D 4O=k.1t.1c.K(0).14;4O.19=\'1o\';k.1t.1c.f5(e);if(e.A.fx>0){k(e).7f(e.A.fx)}k(\'2e\').1S(k.1t.1c.K(0));D 86=[];D 8q=I;24(D i=0;i<k.1t.7s.1g;i++){D 1j=k.1x.3P[k.1t.7s[i]].K(0);D id=k.1p(1j,\'id\');D 8i=k.1t.8x(id);if(1j.1i.ay!=8i.7l){1j.1i.ay=8i.7l;if(8q==I&&1j.1i.2Z){8q=1j.1i.2Z}8i.id=id;86[86.1g]=8i}}k.1t.7s=[];if(8q!=I&&86.1g>0){8q(86)}},al:u(e,o){if(!k.11.F)E;D 6e=I;D i=0;if(e.1i.el.1N()>0){24(i=e.1i.el.1N();i>0;i--){if(e.1i.el.K(i-1)!=k.11.F){if(!e.5V.b2){if((e.1i.el.K(i-1).1M.y+e.1i.el.K(i-1).1M.hb/2)>k.11.F.A.2q){6e=e.1i.el.K(i-1)}P{1r}}P{if((e.1i.el.K(i-1).1M.x+e.1i.el.K(i-1).1M.1C/2)>k.11.F.A.2v&&(e.1i.el.K(i-1).1M.y+e.1i.el.K(i-1).1M.hb/2)>k.11.F.A.2q){6e=e.1i.el.K(i-1)}}}}}if(6e&&k.1t.7u!=6e){k.1t.7u=6e;k(6e).h5(k.1t.1c.K(0))}P if(!6e&&(k.1t.7u!=S||k.1t.1c.K(0).31!=e)){k.1t.7u=S;k(e).1S(k.1t.1c.K(0))}k.1t.1c.K(0).14.19=\'2B\'},cT:u(e){if(k.11.F==S){E}e.1i.el.1E(u(){q.1M=k.23(k.1a.74(q),k.1a.7G(q))})},8x:u(s){D i;D h=\'\';D o={};if(s){if(k.1t.5L[s]){o[s]=[];k(\'#\'+s+\' .\'+k.1t.5L[s]).1E(u(){if(h.1g>0){h+=\'&\'}h+=s+\'[]=\'+k.1p(q,\'id\');o[s][o[s].1g]=k.1p(q,\'id\')})}P{24(a in s){if(k.1t.5L[s[a]]){o[s[a]]=[];k(\'#\'+s[a]+\' .\'+k.1t.5L[s[a]]).1E(u(){if(h.1g>0){h+=\'&\'}h+=s[a]+\'[]=\'+k.1p(q,\'id\');o[s[a]][o[s[a]].1g]=k.1p(q,\'id\')})}}}}P{24(i in k.1t.5L){o[i]=[];k(\'#\'+i+\' .\'+k.1t.5L[i]).1E(u(){if(h.1g>0){h+=\'&\'}h+=i+\'[]=\'+k.1p(q,\'id\');o[i][o[i].1g]=k.1p(q,\'id\')})}}E{7l:h,o:o}},fF:u(e){if(!e.dq){E}E q.1E(u(){if(!q.5V||!k(e).is(\'.\'+q.5V.3C))k(e).2R(q.5V.3C);k(e).7t(q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'3h\');if(4g){k.2t.9m=4g;8u.1p(\'4g\',\'\');k(\'#eT\').3x(4g);if(3h)k(\'#bL\').3x(3h.4E(\'jh://\',\'\'));P k(\'#bL\').3x(\'\');1c=k(\'#8z\');if(el.4H.3l){1c.K(0).3l=el.4H.3l}P{1c.K(0).3l=\'\'}bo=k.1a.2o(1c.K(0));ga=7b&&el.4H.Y==\'bO\'?\'4D\':el.4H.Y;3m(ga){1e\'Q\':2q=1M.y-bo.hb;2v=1M.x;1r;1e\'O\':2q=1M.y;2v=1M.x-bo.1C;1r;1e\'2L\':2q=1M.y;2v=1M.x+1M.1C;1r;1e\'bO\':k(\'2e\').1J(\'3D\',k.2t.3D);1s=k.1a.4a(e);2q=1s.y+15;2v=1s.x+15;1r;ad:2q=1M.y+1M.hb;2v=1M.x;1r}1c.B({Q:2q+\'U\',O:2v+\'U\'});if(el.4H.54==I){1c.1Y()}P{1c.7f(el.4H.54)}if(el.4H.2Y)el.4H.2Y.1D(el);8u.1J(\'8B\',k.2t.2G).1J(\'5B\',k.2t.cq)}},3D:u(e){if(k.2t.6O==S){k(\'2e\').3q(\'3D\',k.2t.3D);E}1s=k.1a.4a(e);k(\'#8z\').B({Q:1s.y+15+\'U\',O:1s.x+15+\'U\'})},2G:u(e,el){if(!el){el=q}if(k.2t.7b!=1b&&k.2t.6O==el){k.2t.6O=S;k(\'#8z\').7a(1);k(el).1p(\'4g\',k.2t.9m).3q(\'8B\',k.2t.2G).3q(\'5B\',k.2t.cq);if(el.4H.3i)el.4H.3i.1D(el);k.2t.9m=S}},2r:u(M){if(!k.2t.1c){k(\'2e\').1S(\'<22 id="8z"><22 id="eT"></22><22 id="bL"></22></22>\');k(\'#8z\').B({Y:\'1P\',3I:6P,19:\'1o\'});k.2t.1c=1b}E q.1E(u(){if(k.1p(q,\'4g\')){q.4H={Y:/Q|4D|O|2L|bO/.48(M.Y)?M.Y:\'4D\',3l:M.3l?M.3l:I,54:M.54?M.54:I,2Y:M.2Y&&M.2Y.1K==2A?M.2Y:I,3i:M.3i&&M.3i.1K==2A?M.3i:I};D el=k(q);el.1J(\'9z\',k.2t.1Y);el.1J(\'6K\',k.2t.6K)}})}};k.fn.hO=k.2t.2r;k.84={bq:u(e){3K=e.7L||e.7K||-1;if(3K==9){if(1X.2k){1X.2k.bT=1b;1X.2k.c0=I}P{e.aP();e.aW()}if(q.b1){1h.6J.dZ().3g="\\t";q.dV=u(){q.6K();q.dV=S}}P if(q.aF){26=q.5q;2T=q.dN;q.2y=q.2y.hd(0,26)+"\\t"+q.2y.h8(2T);q.aF(26+1,26+1);q.6K()}E I}},4U:u(){E q.1E(u(){if(q.7P&&q.7P==1b){k(q).3q(\'7B\',k.84.bq);q.7P=I}})},2r:u(){E q.1E(u(){if(q.4Y==\'cf\'&&(!q.7P||q.7P==I)){k(q).1J(\'7B\',k.84.bq);q.7P=1b}})}};k.fn.23({j5:k.84.2r,hH:k.84.4U});k.1a={3w:u(e){D x=0;D y=0;D es=e.14;D bP=I;if(k(e).B(\'19\')==\'1o\'){D 5Y=es.3n;D 9q=es.Y;bP=1b;es.3n=\'2K\';es.19=\'2B\';es.Y=\'1P\'}D el=e;7d(el){x+=el.8t+(el.4Z&&!k.3a.7I?T(el.4Z.5b)||0:0);y+=el.8G+(el.4Z&&!k.3a.7I?T(el.4Z.4S)||0:0);el=el.dJ}el=e;7d(el&&el.4Y&&el.4Y.6c()!=\'2e\'){x-=el.3c||0;y-=el.3d||0;el=el.31}if(bP==1b){es.19=\'1o\';es.Y=9q;es.3n=5Y}E{x:x,y:y}},7G:u(el){D x=0,y=0;7d(el){x+=el.8t||0;y+=el.8G||0;el=el.dJ}E{x:x,y:y}},2o:u(e){D w=k.B(e,\'Z\');D h=k.B(e,\'W\');D 1C=0;D hb=0;D es=e.14;if(k(e).B(\'19\')!=\'1o\'){1C=e.4c;hb=e.5W}P{D 5Y=es.3n;D 9q=es.Y;es.3n=\'2K\';es.19=\'2B\';es.Y=\'1P\';1C=e.4c;hb=e.5W;es.19=\'1o\';es.Y=9q;es.3n=5Y}E{w:w,h:h,1C:1C,hb:hb}},74:u(el){E{1C:el.4c||0,hb:el.5W||0}},bm:u(e){D h,w,de;if(e){w=e.8W;h=e.8O}P{de=1h.5d;w=1X.d4||aa.d4||(de&&de.8W)||1h.2e.8W;h=1X.cB||aa.cB||(de&&de.8O)||1h.2e.8O}E{w:w,h:h}},6z:u(e){D t=0,l=0,w=0,h=0,iw=0,ih=0;if(e&&e.9N.6c()!=\'2e\'){t=e.3d;l=e.3c;w=e.d7;h=e.d2;iw=0;ih=0}P{if(1h.5d){t=1h.5d.3d;l=1h.5d.3c;w=1h.5d.d7;h=1h.5d.d2}P if(1h.2e){t=1h.2e.3d;l=1h.2e.3c;w=1h.2e.d7;h=1h.2e.d2}iw=aa.d4||1h.5d.8W||1h.2e.8W||0;ih=aa.cB||1h.5d.8O||1h.2e.8O||0}E{t:t,l:l,w:w,h:h,iw:iw,ih:ih}},cy:u(e,7N){D el=k(e);D t=el.B(\'5K\')||\'\';D r=el.B(\'5z\')||\'\';D b=el.B(\'5k\')||\'\';D l=el.B(\'5j\')||\'\';if(7N)E{t:T(t)||0,r:T(r)||0,b:T(b)||0,l:T(l)};P E{t:t,r:r,b:b,l:l}},aT:u(e,7N){D el=k(e);D t=el.B(\'5M\')||\'\';D r=el.B(\'5U\')||\'\';D b=el.B(\'5n\')||\'\';D l=el.B(\'4X\')||\'\';if(7N)E{t:T(t)||0,r:T(r)||0,b:T(b)||0,l:T(l)};P E{t:t,r:r,b:b,l:l}},6U:u(e,7N){D el=k(e);D t=el.B(\'4S\')||\'\';D r=el.B(\'5O\')||\'\';D b=el.B(\'5Q\')||\'\';D l=el.B(\'5b\')||\'\';if(7N)E{t:T(t)||0,r:T(r)||0,b:T(b)||0,l:T(l)||0};P E{t:t,r:r,b:b,l:l}},4a:u(2k){D x=2k.hT||(2k.gM+(1h.5d.3c||1h.2e.3c))||0;D y=2k.ki||(2k.iQ+(1h.5d.3d||1h.2e.3d))||0;E{x:x,y:y}},cI:u(4R,cx){cx(4R);4R=4R.7c;7d(4R){k.1a.cI(4R,cx);4R=4R.hQ}},h7:u(4R){k.1a.cI(4R,u(el){24(D 1p in el){if(2g el[1p]===\'u\'){el[1p]=S}}})},hV:u(el,1O){D 5l=k.1a.6z();D b6=k.1a.2o(el);if(!1O||1O==\'49\')k(el).B({Q:5l.t+((18.3r(5l.h,5l.ih)-5l.t-b6.hb)/2)+\'U\'});if(!1O||1O==\'4j\')k(el).B({O:5l.l+((18.3r(5l.w,5l.iw)-5l.l-b6.1C)/2)+\'U\'})},hW:u(el,dk){D 1Q=k(\'1T[@2J*="8X"]\',el||1h),8X;1Q.1E(u(){8X=q.2J;q.2J=dk;q.14.5E="9n:9w.9y.hE(2J=\'"+8X+"\')"})}};[].3J||(7F.hF.3J=u(v,n){n=(n==S)?0:n;D m=q.1g;24(D i=n;i<m;i++)if(q[i]==v)E i;E-1});',62,1293,'||||||||||||||||||||jQuery||||||this||||function||||||dragCfg|css|elm|var|return|dragged|easing|speed|false|callback|get|ss|options|iAuto|left|else|top|iResize|null|parseInt|px|oldStyle|height|slideshow|position|width||iDrag|new||style||||Math|display|iUtil|true|helper|subject|case|autoCFG|length|document|dropCfg|iEL|resizeOptions|carouselCfg|duration|interfaceFX|none|attr|sizes|break|pointer|iSort|type|ImageBox|queue|iDrop|iAutoscroller|slide|resizeElement|oC|wb|apply|each|fisheyeCfg|opacity|delta|newSizes|bind|constructor|custom|pos|size|axis|absolute|images|items|append|img|slideslinks|255|firstNum|window|show|container||complete|div|extend|for||start||cont|elsToScroll|100|loader|oR||body|elem|typeof|selectedItem|oldP|props|event|accordionCfg|parseFloat|field|getSize|containment|ny|build|relative|iTooltip|islideshow|nx|tp|slideCaption|value|newPosition|Function|block|selectHelper|step|border|itemWidth|hide|dequeue|timer|src|hidden|right|limit|nr|fractions|0px|PI|addClass|direction|end|overflow|cursorAt|result|parentData|onShow|onChange|to|parentNode|||||||||browser|iSlider|scrollLeft|scrollTop|scr|transferHelper|text|href|onHide|pre|selectdrug|className|switch|visibility|item|wrapper|unbind|max|nextslide|values|currentslide|handle|getPosition|html|newCoords|prevslide|iframe|iExpander|accept|mousemove|canvas|createElement|margins|onSlide|zIndex|indexOf|pressedKey|min|valueToAdd|multipleSeparator|pageSize|zones|highlighted|toggle|abs|onStop|dragElem|times|fadeDuration|diff|dhs|handlers||resizeDirection||vp|so|distance|ghosting||test|vertically|getPointer|startTop|offsetWidth|subjectValue|lastSuggestion|DropOutDirectiont|title|wrs|removeClass|horizontally|startLeft|out|onDrag|oP|onStart|nWidth|percent|down|ifxFirstDisplay|msie|iteration|ratio|clear|color|lastValue|slideCfg|fontSize|currentPointer|dimm|bottom|replace|up|prevImage|tooltipCFG|rel|els|fxCheckTag|context|nextImage|params|shs|fieldData|elToScroll|nodeEl|borderTopWidth|chunks|destroy|string|nHeight|paddingLeft|tagName|currentStyle||halign|slidePos|onclick|delay||containerW|from|helperclass|endLeft|endTop|borderLeftWidth|dragmoveBy|documentElement|dhe|newStyles|clonedEl|click|si|marginLeft|marginBottom|clientScroll|OpenClose|paddingBottom|empty|toWrite|selectionStart|overzone|toAdd|onDragModifier|holder|mousedown|animate|toDrag|cnt|marginRight|linksPosition|blur|getAttribute|hight|filter|sw|zoney|cos|slideshows|zonex|marginTop|collected|paddingTop|url|borderRightWidth|mouseup|borderBottomWidth|activeLinkClass|dragHandle|clearInterval|paddingRight|sortCfg|offsetHeight|prop|oldVisibility|styles||BlindDirection|point|fxh|nmp|old|post|currentPanel|onSelect|elementData|grid|pow|toLowerCase|animationHandler|cur|containerH|close|puff|getWidth|currentRel|imageEl|Expander|getHeight|iFisheye|random|newDimensions|itemHeight|reflections|sliders|selRange|wr|orig|margin|maxWidth|keyup|getScroll|captionText|totalImages|128|parseColor|curCSS|outerContainer|Scale|restore|tolerance|selection|focus|caption|snapDistance|revert|current|3000|captionPosition|hpc|onload|class|getBorder|setInterval|oldStyleAttr|rule|rgb|open|minLeft|ActiveXObject|oldDisplay|restoreStyle|getSizeLite||nw|0x||F0|fadeOut|focused|firstChild|while|cssRules|fadeIn|Date|minTop|backgroundColor|sc|nbsp|hash|captionEl|selectKeyHelper|selectCurrent|newTop|init|newLeft|changed|Draggable|inFrontOf|efx|139|onHover|onOut|getTime|np|keydown|split|radiusY|increment|Array|getPositionLite|selectClass|opera|onHighlight|keyCode|charCode|Object|toInteger|frameClass|hasTabsEnabled|zonew|user|zoneh|positionItems|onClick|oD|scrollIntoView|accordionPos|proximity|indic||data|containerSize|sin|iTTabs||ts|ImageBoxPrevImage|ImageBoxNextImage|imageSrc|newPos|maxHeight|minHeight|elS|activeClass|panels|maxBottom|maxRight|ser|move|opened|bounceout|animationInProgress|overlay|stop|reflectionSize|fnc|classname|insideParent|offsetLeft|jEl|nRy|pr|serialize|nRx|tooltipHelper|cssSides|mouseout|select|count|namedColors|padding|offsetTop|directionIncrement|parentEl|400|dir|expand|createTextNode|finishedPre|clientHeight|li|applyOn|content|contBorders|object|parentBorders|alpha|clientWidth|png|gallery|fontWeight|link|yproc|xproc|sx|parent|showImage|selectedone|imgs|onselect|sy|startDrag|cursor|captionClass|onselectstop|getElementById|linksClass|sh|ul|onActivate|isDroppable|nextEl|onDrop|oldTitle|progid|prevslideClass|prevEl|oldPosition|SliderContainer|Image|linkRel|selectKeyUp|selectKeyDown|DXImageTransform|inCache|Microsoft|mouseover|dragstop|diffX|211|nextslideClass|prot|auto|dEs|hidehelper|isDraggable|activeclass|unit|DoFold|unfold|nodeName|startTime|buildWrapper|prev|1px|oldColor|setTimeout|ScrollTo|st|sl|cssText|9999|next|destroyWrapper|opt|diffHeight|diffWidth|exec|hoverclass|image|blind|borderColor|sideEnd|self|key||default|2000|styleSheets|getValues|192|diffY|lnk|reflexions|checkhover|selectcheck|maxRotation|ImageBoxOuterContainer|gradient|panelHeight|childs|headers|ne|hideImage|minWidth|iIndex|itemsText|os|side|iCarousel|5625|1000|itemMinWidth|linksSeparator|setSelectionRange|protectRotation|positionContainer|posx|hoverClass|valToAdd|minchars|helperClass|source|nextImageEl|preventDefault|multiple|headerSelector|DraggableDestroy|getPadding|autofill|handleEl|stopPropagation|prevImageEl|getFieldValues|panelSelector|String|createTextRange|floats|lastSi|shrink|oPad|windowSize|paddingLeftSize|angle|paddingY|paddingX|RegExp|borderRightSize|floatVal|firstStep|pulse|Pulsate|Color|rotationSpeed|paddingBottomSize|remove|parseStyle|getClient|Number|helperSize|bounce|doTab||zoom|borderLeftSize|oBor|paddingRightSize|borderTopSize|paddingTopSize|stopAnim|pValue|borderBottomSize|extraWidth|restricted|autoSize|unselectable|SliderIteration|prepend|clearTimeout|isSlider|oneIsSortable|applyOnHover|tooltipURL|tabindex|draginit|mouse|restoreStyles|sliderSize|sliderPos|parentPos|cancelBubble|autocomplete|inputWidth|oldBorder|dragmove|clnt|sliderEl|returnValue|loaderWidth|idsa|letterSpacing|pause|getContainment|fade|snapToGrid|linear|10000|slideshowHolder|asin|cssSidesEnd|borderWidth|fitToContainer|TEXTAREA|entities|INPUT|spacer|writeItems|character|currentValue|paddings|169|oldFloat|borders|hidefocused|bouncein||modifyContainer|transparent|center|loadImage|func|getMargins|initialPosition|textAlign|innerHeight|Alpha|no|captionImages|closeEl|shake|prevTop|traverseDOM|Selectserialize|stopDrag|slider|ImageBoxCaption|ImageBoxIframe|300|ImageBoxOverlay|sortable|moveDrag|autoplay|measure|prevLeft|intersect|ImageBoxCurrentImage|selectstop|Shake|index|dragEl|keyPressed|scrollHeight|scroll|innerWidth|match|elPosition|scrollWidth|textImage|slideBor|jpg|captionSize|textImageFrom|visible||loaderHeight|ImageBoxCaptionImages||hoverItem|clickItem|emptyGIF||notColor|slideshowCaption|Droppable|goprev|childNodes|autocompleteHelper|autocompleteIframe|slidePad|fit|165|clientSize|||fontFamily|colorCssProps|elType|onhover|cssProps|expanderHelper|boxModel|itransferTo|keypress|moveStart|offsetParent|Width|selectstart|fxe|selectionEnd|checkCache|fontStyle|update|DroppableDestroy|remeasure|fontStretch|fontVariant|onblur|slideshowLoader|htmlEntities|wordSpacing|createRange|224|KhtmlUserSelect||closeHTML|on|sortHelper|245|userSelect|dragHelper|hrefAttr|dragstart|107|loaderSRC|highlight|slideshowPrevslide||gonext||styleFloat|frameborder|javascript|||relAttr|wid|scrolling||onslide|||listStyle|imageTypes|insertBefore|999|textDecoration|sqrt|140|230|maxy|240|ImageBoxContainer|doScroll|interval|set|dragmoveByKey|protect|ImageBoxCaptionText|144|ImageBoxLoader|off|checkdrop|isSelectable|hlt|30px|selectedclass|tooltipTitle|imagebox|shc|overlayOpacity|selRange2|slideshowNextSlide|gif|getSelectionStart|360|iAccordion|getElementsByTagName|iBounce|after|SortableAddItem|onResize|150|itemZIndex|grow|getHeightMinMax|borderTopUnit|selectcheckApply|borderRightUnit|zindex|fontUnit|togglehor|time|se|parte|easeout|isSortable||SlideInUp|fold|SlideOutUp|rgba|addColorStop|yfrac|containerMaxx|interfaceColorFX|containerMaxy||leftUnit|mousex||radiusX|check|getContext|xfrac|addItem|topUnit|fracH|cloneNode|togglever|paddingLeftUnit|borderBottomUnit|finish|onDragStop|onout|posy|isFunction|oldOverflow|directions|vertical|fracW|fakeAccordionClass|parts|fadeTo|inputValue|xml|selectstopApply|slideshowLinks|onDragStart|BlindUp|paddingTopUnit|500|trim|maxx|borderLeftUnit|paddingRightUnit|filteredPosition|BlindDown|paddingBottomUnit|horizontal|valign|find|ImageBoxClose|onselectstart|mozUserSelect|ondragstart|scale|110|globalCompositeOperation|bmp||drawImage|ondrop|password|quot||save|starty|jpeg|||number|startx|finishOpacity|hover|recallDroppables|flipv|finishx|destination|khtml|moz|lt|amp|pW|clientX|Accordion|translate|captiontext|elasticin|slideshowLink|fix|elasticout|resize|elasticboth|bounceboth|984375|9375|Selectable|30002|list|625|30001|nodeValue|before|100000|purgeEvents|substr|duplicate|moveEnd|||substring|success|param|par|array|Fisheye|name|POST|ajax|easeboth|location|fromHandler|collapse|MozUserSelect||ResizableDestroy|rotationTimer|fillRect|fill|WebKit|fillStyle|createLinearGradient|Resizable|navigator|appVersion|lineHeigt|alt|AlphaImageLoader|prototype|SliderGetValues|DisableTabs|Carousel|load|easein|IMG|200|Slider|ToolTip|wh|nextSibling|Autocomplete|SliderSetValues|pageX|float|centerEl|fixPNG|isNaN|dotted|dashed|stopAll|Left|outlineColor|Top|Right|Bottom|solid|double|selectorText|rules|onchange|SlideToggleRight|SlideOutRight||borderStyle||TransferTo||groove|ridge|inset|outset|borderTopColor||borderRightColor|olive|navy|orange||pink|203|maroon||magenta|182|193|lightyellow|lime|purple|red|outlineOffset|outlineWidth|borderBottomColor|borderLeftColor|lineHeight|loading|silver|white|yellow|Showing|100000000|SlideInRight|clientY|Highlight|SortableDestroy|CloseVertically|CloseHorizontally|FoldToggle|UnFold|SlideInDown|SlideToggleUp|SortSerialize|Fold|SwitchHorizontally|SwitchVertically|Sortable|scrollTo|EnableTabs|ScrollToAnchors|pt|Puff|OpenVertically|OpenHorizontally|Grow|Shrink|DropToggleRight|DropInRight|BlindToggleHorizontally|BlindRight|http|Bounce|120|BlindLeft|BlindToggleVertically|SlideToggleLeft|SlideOutLeft|toUpperCase|SlideInLeft|SlideToggleDown|SlideOutDown|DropOutLeft|DropInLeft|DropToggleLeft|DropOutRight|DropToggleUp|DropInUp|DropOutDown|DropInDown|DropToggleDown|DropOutUp|lightpink|textIndent|aqua|appendChild|azure|beige|220|last|cssFloat|first|ol|wrapEl|fxWrapper|black|imageLoaded|darkkhaki|darkgreen|189|183|darkmagenta|firstResize|darkgrey|brown|cyan|darkblue|darkcyan|table|form|col|tfoot|colgroup|th|header|thead|tbody|112|Autoexpand|tr|td|script|frame|input|pageY|textarea|button|w_|removeChild|frameset|option|optgroup|meta|darkolivegreen|blue|122|233|green|lightcyan|204|darkviolet|lightgreen|indigo|216|khaki|darksalmon|130|darkred|lightblue|148|173|215|238|fuchsia|gold|darkorchid|153|darkorange|lightgrey'.split('|'),0,{}))
|
admin/js/jquery.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('7(1C 1w.6=="T"){1w.T=1w.T;B 6=u(a,c){7(1w==q)v 1p 6(a,c);a=a||17;7(6.1t(a))v 1p 6(17)[6.E.27?"27":"2O"](a);7(1C a=="23"){B m=/^[^<]*(<(.|\\s)+>)[^>]*$/.2Q(a);7(m)a=6.3k([m[1]]);J v 1p 6(c).2o(a)}v q.6r(a.1l==2y&&a||(a.3Y||a.I&&a!=1w&&!a.24&&a[0]!=T&&a[0].24)&&6.3M(a)||[a])};7(1C $!="T")6.2S$=$;B $=6;6.E=6.8p={3Y:"1.1.2",8q:u(){v q.I},I:0,2b:u(1T){v 1T==T?6.3M(q):q[1T]},2r:u(a){B L=6(a);L.6p=q;v L},6r:u(a){q.I=0;[].1g.14(q,a);v q},K:u(E,1E){v 6.K(q,E,1E)},2h:u(1c){B 4c=-1;q.K(u(i){7(q==1c)4c=i});v 4c},1I:u(1Y,O,C){B 1c=1Y;7(1Y.1l==3t)7(O==T)v q.I&&6[C||"1I"](q[0],1Y)||T;J{1c={};1c[1Y]=O}v q.K(u(2h){P(B H 1x 1c)6.1I(C?q.1q:q,H,6.H(q,1c[H],C,2h,H))})},1m:u(1Y,O){v q.1I(1Y,O,"30")},2L:u(e){7(1C e=="23")v q.3u().3r(17.8t(e));B t="";6.K(e||q,u(){6.K(q.2I,u(){7(q.24!=8)t+=q.24!=1?q.60:6.E.2L([q])})});v t},2K:u(){B a=6.3k(1A);v q.K(u(){B b=a[0].3l(U);q.11.2X(b,q);22(b.1b)b=b.1b;b.4C(q)})},3r:u(){v q.3j(1A,U,1,u(a){q.4C(a)})},5i:u(){v q.3j(1A,U,-1,u(a){q.2X(a,q.1b)})},5j:u(){v q.3j(1A,12,1,u(a){q.11.2X(a,q)})},5t:u(){v q.3j(1A,12,-1,u(a){q.11.2X(a,q.2e)})},4g:u(){v q.6p||6([])},2o:u(t){v q.2r(6.31(q,u(a){v 6.2o(t,a)}),t)},4Y:u(4N){v q.2r(6.31(q,u(a){B a=a.3l(4N!=T?4N:U);a.$1H=16;v a}))},1D:u(t){v q.2r(6.1t(t)&&6.2q(q,u(2z,2h){v t.14(2z,[2h])})||6.3z(t,q))},2g:u(t){v q.2r(t.1l==3t&&6.3z(t,q,U)||6.2q(q,u(a){v(t.1l==2y||t.3Y)?6.3y(a,t)<0:a!=t}))},1M:u(t){v q.2r(6.2k(q.2b(),t.1l==3t?6(t).2b():t.I!=T&&(!t.1f||t.1f=="8v")?t:[t]))},4l:u(1s){v 1s?6.1D(1s,q).r.I>0:12},1a:u(1a){v 1a==T?(q.I?q[0].O:16):q.1I("O",1a)},4U:u(1a){v 1a==T?(q.I?q[0].2t:16):q.3u().3r(1a)},3j:u(1E,1P,3Z,E){B 4Y=q.I>1;B a=6.3k(1E);7(3Z<0)a.8w();v q.K(u(){B 1c=q;7(1P&&6.1f(q,"1P")&&6.1f(a[0],"3m"))1c=q.5J("20")[0]||q.4C(17.6n("20"));6.K(a,u(){E.14(1c,[4Y?q.3l(U):q])})})}};6.1z=6.E.1z=u(){B 1O=1A[0],a=1;7(1A.I==1){1O=q;a=0}B H;22(H=1A[a++])P(B i 1x H)1O[i]=H[i];v 1O};6.1z({8x:u(){7(6.2S$)$=6.2S$;v 6},1t:u(E){v!!E&&1C E!="23"&&!E.1f&&1C E[0]=="T"&&/u/i.1n(E+"")},4B:u(D){v D.66&&D.5I&&!D.5I.64},1f:u(D,Y){v D.1f&&D.1f.3K()==Y.3K()},K:u(1c,E,1E){7(1c.I==T)P(B i 1x 1c)E.14(1c[i],1E||[i,1c[i]]);J P(B i=0,6q=1c.I;i<6q;i++)7(E.14(1c[i],1E||[i,1c[i]])===12)3O;v 1c},H:u(D,O,C,2h,H){7(6.1t(O))O=O.3n(D,[2h]);B 6s=/z-?2h|7P-?8A|1d|58|8B-?28/i;v O&&O.1l==3Q&&C=="30"&&!6s.1n(H)?O+"4S":O},19:{1M:u(D,c){6.K(c.3o(/\\s+/),u(i,Q){7(!6.19.2V(D.19,Q))D.19+=(D.19?" ":"")+Q})},2f:u(D,c){D.19=c?6.2q(D.19.3o(/\\s+/),u(Q){v!6.19.2V(c,Q)}).6t(" "):""},2V:u(t,c){t=t.19||t;c=c.1R(/([\\.\\\\\\+\\*\\?\\[\\^\\]\\$\\(\\)\\{\\}\\=\\!\\<\\>\\|\\:])/g,"\\\\$1");v t&&1p 4v("(^|\\\\s)"+c+"(\\\\s|$)").1n(t)}},4d:u(e,o,f){P(B i 1x o){e.1q["1N"+i]=e.1q[i];e.1q[i]=o[i]}f.14(e,[]);P(B i 1x o)e.1q[i]=e.1q["1N"+i]},1m:u(e,p){7(p=="28"||p=="3V"){B 1N={},46,3P,d=["7d","8C","8D","8E"];6.K(d,u(){1N["8F"+q]=0;1N["8G"+q+"8H"]=0});6.4d(e,1N,u(){7(6.1m(e,"1h")!="1Z"){46=e.8I;3P=e.8J}J{e=6(e.3l(U)).2o(":4j").5l("2Z").4g().1m({4n:"1G",45:"8K",1h:"2D",7I:"0",8M:"0"}).5z(e.11)[0];B 3d=6.1m(e.11,"45");7(3d==""||3d=="4b")e.11.1q.45="6x";46=e.6y;3P=e.6z;7(3d==""||3d=="4b")e.11.1q.45="4b";e.11.33(e)}});v p=="28"?46:3P}v 6.30(e,p)},30:u(D,H,53){B L;7(H=="1d"&&6.W.1j)v 6.1I(D.1q,"1d");7(H=="4h"||H=="2v")H=6.W.1j?"3T":"2v";7(!53&&D.1q[H])L=D.1q[H];J 7(17.44&&17.44.4W){7(H=="2v"||H=="3T")H="4h";H=H.1R(/([A-Z])/g,"-$1").4m();B Q=17.44.4W(D,16);7(Q)L=Q.55(H);J 7(H=="1h")L="1Z";J 6.4d(D,{1h:"2D"},u(){B c=17.44.4W(q,"");L=c&&c.55(H)||""})}J 7(D.51){B 56=H.1R(/\\-(\\w)/g,u(m,c){v c.3K()});L=D.51[H]||D.51[56]}v L},3k:u(a){B r=[];6.K(a,u(i,1r){7(!1r)v;7(1r.1l==3Q)1r=1r.6C();7(1C 1r=="23"){B s=6.35(1r),1V=17.6n("1V"),2i=[];B 2K=!s.18("<1u")&&[1,"<42>","</42>"]||(!s.18("<6D")||!s.18("<20")||!s.18("<6E"))&&[1,"<1P>","</1P>"]||!s.18("<3m")&&[2,"<1P><20>","</20></1P>"]||(!s.18("<6F")||!s.18("<6G"))&&[3,"<1P><20><3m>","</3m></20></1P>"]||[0,"",""];1V.2t=2K[1]+s+2K[2];22(2K[0]--)1V=1V.1b;7(6.W.1j){7(!s.18("<1P")&&s.18("<20")<0)2i=1V.1b&&1V.1b.2I;J 7(2K[1]=="<1P>"&&s.18("<20")<0)2i=1V.2I;P(B n=2i.I-1;n>=0;--n)7(6.1f(2i[n],"20")&&!2i[n].2I.I)2i[n].11.33(2i[n])}1r=[];P(B i=0,l=1V.2I.I;i<l;i++)1r.1g(1V.2I[i])}7(1r.I===0&&!6.1f(1r,"3w"))v;7(1r[0]==T||6.1f(1r,"3w"))r.1g(1r);J r=6.2k(r,1r)});v r},1I:u(D,Y,O){B 2j=6.4B(D)?{}:{"P":"6J","6L":"19","4h":6.W.1j?"3T":"2v",2v:6.W.1j?"3T":"2v",2t:"2t",19:"19",O:"O",2W:"2W",2Z:"2Z",89:"6N",2Y:"2Y"};7(Y=="1d"&&6.W.1j&&O!=T){D.58=1;v D.1D=D.1D.1R(/4i\\([^\\)]*\\)/6O,"")+(O==1?"":"4i(1d="+O*6g+")")}J 7(Y=="1d"&&6.W.1j)v D.1D?4T(D.1D.6P(/4i\\(1d=(.*)\\)/)[1])/6g:1;7(Y=="1d"&&6.W.3h&&O==1)O=0.6R;7(2j[Y]){7(O!=T)D[2j[Y]]=O;v D[2j[Y]]}J 7(O==T&&6.W.1j&&6.1f(D,"3w")&&(Y=="81"||Y=="80"))v D.6T(Y).60;J 7(D.66){7(O!=T)D.6V(Y,O);7(6.W.1j&&/5E|3e/.1n(Y)&&!6.4B(D))v D.36(Y,2);v D.36(Y)}J{Y=Y.1R(/-([a-z])/6W,u(z,b){v b.3K()});7(O!=T)D[Y]=O;v D[Y]}},35:u(t){v t.1R(/^\\s+|\\s+$/g,"")},3M:u(a){B r=[];7(a.1l!=2y)P(B i=0,2R=a.I;i<2R;i++)r.1g(a[i]);J r=a.3N(0);v r},3y:u(b,a){P(B i=0,2R=a.I;i<2R;i++)7(a[i]==b)v i;v-1},2k:u(2u,3H){B r=[].3N.3n(2u,0);P(B i=0,5b=3H.I;i<5b;i++)7(6.3y(3H[i],r)==-1)2u.1g(3H[i]);v 2u},2q:u(1U,E,4k){7(1C E=="23")E=1p 4w("a","i","v "+E);B 1i=[];P(B i=0,2z=1U.I;i<2z;i++)7(!4k&&E(1U[i],i)||4k&&!E(1U[i],i))1i.1g(1U[i]);v 1i},31:u(1U,E){7(1C E=="23")E=1p 4w("a","v "+E);B 1i=[],r=[];P(B i=0,2z=1U.I;i<2z;i++){B 1a=E(1U[i],i);7(1a!==16&&1a!=T){7(1a.1l!=2y)1a=[1a];1i=1i.6Z(1a)}}B r=1i.I?[1i[0]]:[];5f:P(B i=1,5e=1i.I;i<5e;i++){P(B j=0;j<i;j++)7(1i[i]==r[j])5F 5f;r.1g(1i[i])}v r}});1p u(){B b=7L.71.4m();6.W={2N:/5D/.1n(b),3f:/3f/.1n(b),1j:/1j/.1n(b)&&!/3f/.1n(b),3h:/3h/.1n(b)&&!/(72|5D)/.1n(b)};6.7H=!6.W.1j||17.74=="75"};6.K({5u:"a.11",4z:"6.4z(a)",76:"6.2a(a,2,\'2e\')",7D:"6.2a(a,2,\'5s\')",78:"6.2B(a.11.1b,a)",79:"6.2B(a.1b)"},u(i,n){6.E[i]=u(a){B L=6.31(q,n);7(a&&1C a=="23")L=6.3z(a,L);v q.2r(L)}});6.K({5z:"3r",7b:"5i",2X:"5j",7e:"5t"},u(i,n){6.E[i]=u(){B a=1A;v q.K(u(){P(B j=0,2R=a.I;j<2R;j++)6(a[j])[n](q)})}});6.K({5l:u(1Y){6.1I(q,1Y,"");q.7g(1Y)},7h:u(c){6.19.1M(q,c)},7i:u(c){6.19.2f(q,c)},7k:u(c){6.19[6.19.2V(q,c)?"2f":"1M"](q,c)},2f:u(a){7(!a||6.1D(a,[q]).r.I)q.11.33(q)},3u:u(){22(q.1b)q.33(q.1b)}},u(i,n){6.E[i]=u(){v q.K(n,1A)}});6.K(["5q","5n","5p","5v"],u(i,n){6.E[n]=u(1T,E){v q.1D(":"+n+"("+1T+")",E)}});6.K(["28","3V"],u(i,n){6.E[n]=u(h){v h==T?(q.I?6.1m(q[0],n):16):q.1m(n,h.1l==3t?h:h+"4S")}});6.1z({1s:{"":"m[2]==\'*\'||6.1f(a,m[2])","#":"a.36(\'2J\')==m[2]",":":{5n:"i<m[3]-0",5p:"i>m[3]-0",2a:"m[3]-0==i",5q:"m[3]-0==i",2u:"i==0",2T:"i==r.I-1",5R:"i%2==0",5S:"i%2","2a-3s":"6.2a(a.11.1b,m[3],\'2e\',a)==a","2u-3s":"6.2a(a.11.1b,1,\'2e\')==a","2T-3s":"6.2a(a.11.7n,1,\'5s\')==a","7p-3s":"6.2B(a.11.1b).I==1",5u:"a.1b",3u:"!a.1b",5v:"6.E.2L.14([a]).18(m[3])>=0",3i:\'a.C!="1G"&&6.1m(a,"1h")!="1Z"&&6.1m(a,"4n")!="1G"\',1G:\'a.C=="1G"||6.1m(a,"1h")=="1Z"||6.1m(a,"4n")=="1G"\',7v:"!a.2W",2W:"a.2W",2Z:"a.2Z",2Y:"a.2Y||6.1I(a,\'2Y\')",2L:"a.C==\'2L\'",4j:"a.C==\'4j\'",5x:"a.C==\'5x\'",4G:"a.C==\'4G\'",5y:"a.C==\'5y\'",4R:"a.C==\'4R\'",5A:"a.C==\'5A\'",5B:"a.C==\'5B\'",3x:\'a.C=="3x"||6.1f(a,"3x")\',5C:"/5C|42|7A|3x/i.1n(a.1f)"},".":"6.19.2V(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z&&!z.18(m[4])","$=":"z&&z.2U(z.I - m[4].I,m[4].I)==m[4]","*=":"z&&z.18(m[4])>=0","":"z",4u:u(m){v["",m[1],m[3],m[2],m[5]]},5P:"z=a[m[3]];7(!z||/5E|3e/.1n(m[3]))z=6.1I(a,m[3]);"},"[":"6.2o(m[2],a).I"},5M:[/^\\[ *(@)([a-2m-3C-]*) *([!*$^=]*) *(\'?"?)(.*?)\\4 *\\]/i,/^(\\[)\\s*(.*?(\\[.*?\\])?[^[]*?)\\s*\\]/,/^(:)([a-2m-3C-]*)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/i,/^([:.#]*)([a-2m-3C*-]*)/i],1Q:[/^(\\/?\\.\\.)/,"a.11",/^(>|\\/)/,"6.2B(a.1b)",/^(\\+)/,"6.2a(a,2,\'2e\')",/^(~)/,u(a){B s=6.2B(a.11.1b);v s.3N(6.3y(a,s)+1)}],3z:u(1s,1U,2g){B 1N,Q=[];22(1s&&1s!=1N){1N=1s;B f=6.1D(1s,1U,2g);1s=f.t.1R(/^\\s*,\\s*/,"");Q=2g?1U=f.r:6.2k(Q,f.r)}v Q},2o:u(t,1B){7(1C t!="23")v[t];7(1B&&!1B.24)1B=16;1B=1B||17;7(!t.18("//")){1B=1B.4H;t=t.2U(2,t.I)}J 7(!t.18("/")){1B=1B.4H;t=t.2U(1,t.I);7(t.18("/")>=1)t=t.2U(t.18("/"),t.I)}B L=[1B],2c=[],2T=16;22(t&&2T!=t){B r=[];2T=t;t=6.35(t).1R(/^\\/\\//i,"");B 3B=12;B 1J=/^[\\/>]\\s*([a-2m-9*-]+)/i;B m=1J.2Q(t);7(m){6.K(L,u(){P(B c=q.1b;c;c=c.2e)7(c.24==1&&(6.1f(c,m[1])||m[1]=="*"))r.1g(c)});L=r;t=t.1R(1J,"");7(t.18(" ")==0)5F;3B=U}J{P(B i=0;i<6.1Q.I;i+=2){B 1J=6.1Q[i];B m=1J.2Q(t);7(m){r=L=6.31(L,6.1t(6.1Q[i+1])?6.1Q[i+1]:u(a){v 40(6.1Q[i+1])});t=6.35(t.1R(1J,""));3B=U;3O}}}7(t&&!3B){7(!t.18(",")){7(L[0]==1B)L.4L();6.2k(2c,L);r=L=[1B];t=" "+t.2U(1,t.I)}J{B 34=/^([a-2m-3C-]+)(#)([a-2m-9\\\\*2S-]*)/i;B m=34.2Q(t);7(m){m=[0,m[2],m[3],m[1]]}J{34=/^([#.]?)([a-2m-9\\\\*2S-]*)/i;m=34.2Q(t)}7(m[1]=="#"&&L[L.I-1].4X){B 2l=L[L.I-1].4X(m[2]);7(6.W.1j&&2l&&2l.2J!=m[2])2l=6(\'[@2J="\'+m[2]+\'"]\',L[L.I-1])[0];L=r=2l&&(!m[3]||6.1f(2l,m[3]))?[2l]:[]}J{7(m[1]==".")B 4r=1p 4v("(^|\\\\s)"+m[2]+"(\\\\s|$)");6.K(L,u(){B 3E=m[1]!=""||m[0]==""?"*":m[2];7(6.1f(q,"7J")&&3E=="*")3E="3g";6.2k(r,m[1]!=""&&L.I!=1?6.4x(q,[],m[1],m[2],4r):q.5J(3E))});7(m[1]=="."&&L.I==1)r=6.2q(r,u(e){v 4r.1n(e.19)});7(m[1]=="#"&&L.I==1){B 5K=r;r=[];6.K(5K,u(){7(q.36("2J")==m[2]){r=[q];v 12}})}L=r}t=t.1R(34,"")}}7(t){B 1a=6.1D(t,r);L=r=1a.r;t=6.35(1a.t)}}7(L&&L[0]==1B)L.4L();6.2k(2c,L);v 2c},1D:u(t,r,2g){22(t&&/^[a-z[({<*:.#]/i.1n(t)){B p=6.5M,m;6.K(p,u(i,1J){m=1J.2Q(t);7(m){t=t.7M(m[0].I);7(6.1s[m[1]].4u)m=6.1s[m[1]].4u(m);v 12}});7(m[1]==":"&&m[2]=="2g")r=6.1D(m[3],r,U).r;J 7(m[1]=="."){B 1J=1p 4v("(^|\\\\s)"+m[2]+"(\\\\s|$)");r=6.2q(r,u(e){v 1J.1n(e.19||"")},2g)}J{B f=6.1s[m[1]];7(1C f!="23")f=6.1s[m[1]][m[2]];40("f = u(a,i){"+(6.1s[m[1]].5P||"")+"v "+f+"}");r=6.2q(r,f,2g)}}v{r:r,t:t}},4x:u(o,r,1Q,Y,1J){P(B s=o.1b;s;s=s.2e)7(s.24==1){B 1M=U;7(1Q==".")1M=s.19&&1J.1n(s.19);J 7(1Q=="#")1M=s.36("2J")==Y;7(1M)r.1g(s);7(1Q=="#"&&r.I)3O;7(s.1b)6.4x(s,r,1Q,Y,1J)}v r},4z:u(D){B 4A=[];B Q=D.11;22(Q&&Q!=17){4A.1g(Q);Q=Q.11}v 4A},2a:u(Q,1i,3Z,D){1i=1i||1;B 1T=0;P(;Q;Q=Q[3Z]){7(Q.24==1)1T++;7(1T==1i||1i=="5R"&&1T%2==0&&1T>1&&Q==D||1i=="5S"&&1T%2==1&&Q==D)v Q}},2B:u(n,D){B r=[];P(;n;n=n.2e){7(n.24==1&&(!D||n!=D))r.1g(n)}v r}});6.G={1M:u(S,C,1o,F){7(6.W.1j&&S.3L!=T)S=1w;7(F)1o.F=F;7(!1o.2A)1o.2A=q.2A++;7(!S.$1H)S.$1H={};B 38=S.$1H[C];7(!38){38=S.$1H[C]={};7(S["39"+C])38[0]=S["39"+C]}38[1o.2A]=1o;S["39"+C]=q.5Y;7(!q.1k[C])q.1k[C]=[];q.1k[C].1g(S)},2A:1,1k:{},2f:u(S,C,1o){7(S.$1H){B i,j,k;7(C&&C.C){1o=C.1o;C=C.C}7(C&&S.$1H[C])7(1o)5U S.$1H[C][1o.2A];J P(i 1x S.$1H[C])5U S.$1H[C][i];J P(j 1x S.$1H)q.2f(S,j);P(k 1x S.$1H[C])7(k){k=U;3O}7(!k)S["39"+C]=16}},1S:u(C,F,S){F=6.3M(F||[]);7(!S)6.K(q.1k[C]||[],u(){6.G.1S(C,F,q)});J{B 1o=S["39"+C],1a,E=6.1t(S[C]);7(1o){F.61(q.2j({C:C,1O:S}));7((1a=1o.14(S,F))!==12)q.4F=U}7(E&&1a!==12)S[C]();q.4F=12}},5Y:u(G){7(1C 6=="T"||6.G.4F)v;G=6.G.2j(G||1w.G||{});B 3R;B c=q.$1H[G.C];B 1E=[].3N.3n(1A,1);1E.61(G);P(B j 1x c){1E[0].1o=c[j];1E[0].F=c[j].F;7(c[j].14(q,1E)===12){G.2n();G.2H();3R=12}}7(6.W.1j)G.1O=G.2n=G.2H=G.1o=G.F=16;v 3R},2j:u(G){7(!G.1O&&G.63)G.1O=G.63;7(G.65==T&&G.67!=T){B e=17.4H,b=17.64;G.65=G.67+(e.68||b.68);G.7Y=G.7Z+(e.6c||b.6c)}7(6.W.2N&&G.1O.24==3){B 3a=G;G=6.1z({},3a);G.1O=3a.1O.11;G.2n=u(){v 3a.2n()};G.2H=u(){v 3a.2H()}}7(!G.2n)G.2n=u(){q.3R=12};7(!G.2H)G.2H=u(){q.82=U};v G}};6.E.1z({3U:u(C,F,E){v q.K(u(){6.G.1M(q,C,E||F,F)})},6u:u(C,F,E){v q.K(u(){6.G.1M(q,C,u(G){6(q).6f(G);v(E||F).14(q,1A)},F)})},6f:u(C,E){v q.K(u(){6.G.2f(q,C,E)})},1S:u(C,F){v q.K(u(){6.G.1S(C,F,q)})},3X:u(){B a=1A;v q.6j(u(e){q.4M=q.4M==0?1:0;e.2n();v a[q.4M].14(q,[e])||12})},83:u(f,g){u 4O(e){B p=(e.C=="41"?e.84:e.85)||e.86;22(p&&p!=q)2G{p=p.11}2w(e){p=q};7(p==q)v 12;v(e.C=="41"?f:g).14(q,[e])}v q.41(4O).6k(4O)},27:u(f){7(6.3W)f.14(17,[6]);J{6.3c.1g(u(){v f.14(q,[6])})}v q}});6.1z({3W:12,3c:[],27:u(){7(!6.3W){6.3W=U;7(6.3c){6.K(6.3c,u(){q.14(17)});6.3c=16}7(6.W.3h||6.W.3f)17.87("6o",6.27,12)}}});1p u(){6.K(("88,8a,2O,8b,8d,52,6j,8e,"+"8f,8g,8h,41,6k,8j,42,"+"4R,8k,8l,8m,2C").3o(","),u(i,o){6.E[o]=u(f){v f?q.3U(o,f):q.1S(o)}});7(6.W.3h||6.W.3f)17.8n("6o",6.27,12);J 7(6.W.1j){17.8o("<8r"+"8s 2J=62 8u=U "+"3e=//:><\\/2d>");B 2d=17.4X("62");7(2d)2d.37=u(){7(q.3D!="1X")v;q.11.33(q);6.27()};2d=16}J 7(6.W.2N)6.50=3L(u(){7(17.3D=="8y"||17.3D=="1X"){4p(6.50);6.50=16;6.27()}},10);6.G.1M(1w,"2O",6.27)};7(6.W.1j)6(1w).6u("52",u(){B 1k=6.G.1k;P(B C 1x 1k){B 4Z=1k[C],i=4Z.I;7(i&&C!=\'52\')6w 6.G.2f(4Z[i-1],C);22(--i)}});6.E.1z({6A:u(V,21,M){q.2O(V,21,M,1)},2O:u(V,21,M,1W){7(6.1t(V))v q.3U("2O",V);M=M||u(){};B C="5d";7(21)7(6.1t(21)){M=21;21=16}J{21=6.3g(21);C="5V"}B 4e=q;6.3v({V:V,C:C,F:21,1W:1W,1X:u(2P,15){7(15=="2M"||!1W&&15=="5L")4e.1I("2t",2P.3G).4V().K(M,[2P.3G,15,2P]);J M.14(4e,[2P.3G,15,2P])}});v q},6B:u(){v 6.3g(q)},4V:u(){v q.2o("2d").K(u(){7(q.3e)6.59(q.3e);J 6.4a(q.2L||q.6H||q.2t||"")}).4g()}});7(!1w.3p)3p=u(){v 1p 6I("6K.6M")};6.K("5m,5Q,5O,5W,5N,5H".3o(","),u(i,o){6.E[o]=u(f){v q.3U(o,f)}});6.1z({2b:u(V,F,M,C,1W){7(6.1t(F)){M=F;F=16}v 6.3v({V:V,F:F,2M:M,4t:C,1W:1W})},6Q:u(V,F,M,C){v 6.2b(V,F,M,C,1)},59:u(V,M){v 6.2b(V,16,M,"2d")},6S:u(V,F,M){v 6.2b(V,F,M,"6m")},6U:u(V,F,M,C){7(6.1t(F)){M=F;F={}}v 6.3v({C:"5V",V:V,F:F,2M:M,4t:C})},6X:u(29){6.3q.29=29},6Y:u(5c){6.1z(6.3q,5c)},3q:{1k:U,C:"5d",29:0,5r:"70/x-73-3w-77",5h:U,48:U,F:16},3S:{},3v:u(s){s=6.1z({},6.3q,s);7(s.F){7(s.5h&&1C s.F!="23")s.F=6.3g(s.F);7(s.C.4m()=="2b"){s.V+=((s.V.18("?")>-1)?"&":"?")+s.F;s.F=16}}7(s.1k&&!6.4E++)6.G.1S("5m");B 4y=12;B N=1p 3p();N.7j(s.C,s.V,s.48);7(s.F)N.3A("7l-7m",s.5r);7(s.1W)N.3A("7o-4K-7q",6.3S[s.V]||"7s, 7t 7w 7x 4o:4o:4o 7z");N.3A("X-7B-7C","3p");7(N.7E)N.3A("7F","7G");7(s.5G)s.5G(N);7(s.1k)6.G.1S("5H",[N,s]);B 37=u(4s){7(N&&(N.3D==4||4s=="29")){4y=U;7(3I){4p(3I);3I=16}B 15;2G{15=6.5Z(N)&&4s!="29"?s.1W&&6.69(N,s.V)?"5L":"2M":"2C";7(15!="2C"){B 3F;2G{3F=N.4P("6b-4K")}2w(e){}7(s.1W&&3F)6.3S[s.V]=3F;B F=6.6i(N,s.4t);7(s.2M)s.2M(F,15);7(s.1k)6.G.1S("5N",[N,s])}J 6.3J(s,N,15)}2w(e){15="2C";6.3J(s,N,15,e)}7(s.1k)6.G.1S("5O",[N,s]);7(s.1k&&!--6.4E)6.G.1S("5Q");7(s.1X)s.1X(N,15);7(s.48)N=16}};B 3I=3L(37,13);7(s.29>0)57(u(){7(N){N.7N();7(!4y)37("29")}},s.29);2G{N.7Q(s.F)}2w(e){6.3J(s,N,16,e)}7(!s.48)37();v N},3J:u(s,N,15,e){7(s.2C)s.2C(N,15,e);7(s.1k)6.G.1S("5W",[N,s,e])},4E:0,5Z:u(r){2G{v!r.15&&7V.7W=="4G:"||(r.15>=5X&&r.15<7X)||r.15==6d||6.W.2N&&r.15==T}2w(e){}v 12},69:u(N,V){2G{B 6e=N.4P("6b-4K");v N.15==6d||6e==6.3S[V]||6.W.2N&&N.15==T}2w(e){}v 12},6i:u(r,C){B 4Q=r.4P("8c-C");B F=!C&&4Q&&4Q.18("N")>=0;F=C=="N"||F?r.8i:r.3G;7(C=="2d")6.4a(F);7(C=="6m")40("F = "+F);7(C=="4U")6("<1V>").4U(F).4V();v F},3g:u(a){B s=[];7(a.1l==2y||a.3Y)6.K(a,u(){s.1g(2x(q.Y)+"="+2x(q.O))});J P(B j 1x a)7(a[j]&&a[j].1l==2y)6.K(a[j],u(){s.1g(2x(j)+"="+2x(q))});J s.1g(2x(j)+"="+2x(a[j]));v s.6t("&")},4a:u(F){7(1w.54)1w.54(F);J 7(6.W.2N)1w.57(F,0);J 40.3n(1w,F)}});6.E.1z({1L:u(R,M){B 1G=q.1D(":1G");R?1G.26({28:"1L",3V:"1L",1d:"1L"},R,M):1G.K(u(){q.1q.1h=q.2E?q.2E:"";7(6.1m(q,"1h")=="1Z")q.1q.1h="2D"});v q},1K:u(R,M){B 3i=q.1D(":3i");R?3i.26({28:"1K",3V:"1K",1d:"1K"},R,M):3i.K(u(){q.2E=q.2E||6.1m(q,"1h");7(q.2E=="1Z")q.2E="2D";q.1q.1h="1Z"});v q},5g:6.E.3X,3X:u(E,4I){B 1E=1A;v 6.1t(E)&&6.1t(4I)?q.5g(E,4I):q.K(u(){6(q)[6(q).4l(":1G")?"1L":"1K"].14(6(q),1E)})},7a:u(R,M){v q.26({28:"1L"},R,M)},7c:u(R,M){v q.26({28:"1K"},R,M)},7f:u(R,M){v q.K(u(){B 5k=6(q).4l(":1G")?"1L":"1K";6(q).26({28:5k},R,M)})},7r:u(R,M){v q.26({1d:"1L"},R,M)},7u:u(R,M){v q.26({1d:"1K"},R,M)},7y:u(R,43,M){v q.26({1d:43},R,M)},26:u(H,R,1v,M){v q.1F(u(){q.2F=6.1z({},H);B 1u=6.R(R,1v,M);P(B p 1x H){B e=1p 6.3b(q,1u,p);7(H[p].1l==3Q)e.2s(e.Q(),H[p]);J e[H[p]](H)}})},1F:u(C,E){7(!E){E=C;C="3b"}v q.K(u(){7(!q.1F)q.1F={};7(!q.1F[C])q.1F[C]=[];q.1F[C].1g(E);7(q.1F[C].I==1)E.14(q)})}});6.1z({R:u(R,1v,E){B 1u=R&&R.1l==7K?R:{1X:E||!E&&1v||6.1t(R)&&R,25:R,1v:E&&1v||1v&&1v.1l!=4w&&1v};1u.25=(1u.25&&1u.25.1l==3Q?1u.25:{7R:7S,7T:5X}[1u.25])||7U;1u.1N=1u.1X;1u.1X=u(){6.6a(q,"3b");7(6.1t(1u.1N))1u.1N.14(q)};v 1u},1v:{},1F:{},6a:u(D,C){C=C||"3b";7(D.1F&&D.1F[C]){D.1F[C].4L();B f=D.1F[C][0];7(f)f.14(D)}},3b:u(D,1e,H){B z=q;B y=D.1q;B 4D=6.1m(D,"1h");y.5T="1G";z.a=u(){7(1e.49)1e.49.14(D,[z.2p]);7(H=="1d")6.1I(y,"1d",z.2p);J 7(6l(z.2p))y[H]=6l(z.2p)+"4S";y.1h="2D"};z.6v=u(){v 4T(6.1m(D,H))};z.Q=u(){B r=4T(6.30(D,H));v r&&r>-8z?r:z.6v()};z.2s=u(4f,43){z.4J=(1p 5o()).5w();z.2p=4f;z.a();z.4q=3L(u(){z.49(4f,43)},13)};z.1L=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();1e.1L=U;z.2s(0,D.1y[H]);7(H!="1d")y[H]="5a"};z.1K=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();1e.1K=U;z.2s(D.1y[H],0)};z.3X=u(){7(!D.1y)D.1y={};D.1y[H]=q.Q();7(4D=="1Z"){1e.1L=U;7(H!="1d")y[H]="5a";z.2s(0,D.1y[H])}J{1e.1K=U;z.2s(D.1y[H],0)}};z.49=u(32,47){B t=(1p 5o()).5w();7(t>1e.25+z.4J){4p(z.4q);z.4q=16;z.2p=47;z.a();7(D.2F)D.2F[H]=U;B 2c=U;P(B i 1x D.2F)7(D.2F[i]!==U)2c=12;7(2c){y.5T="";y.1h=4D;7(6.1m(D,"1h")=="1Z")y.1h="2D";7(1e.1K)y.1h="1Z";7(1e.1K||1e.1L)P(B p 1x D.2F)7(p=="1d")6.1I(y,p,D.1y[p]);J y[p]=""}7(2c&&6.1t(1e.1X))1e.1X.14(D)}J{B n=t-q.4J;B p=n/1e.25;z.2p=1e.1v&&6.1v[1e.1v]?6.1v[1e.1v](p,n,32,(47-32),1e.25):((-6h.7O(p*6h.8L)/2)+0.5)*(47-32)+32;z.a()}}}})}',62,545,'||||||jQuery|if|||||||||||||||||||this||||function|return||||||var|type|elem|fn|data|event|prop|length|else|each|ret|callback|xml|value|for|cur|speed|element|undefined|true|url|browser||name|||parentNode|false||apply|status|null|document|indexOf|className|val|firstChild|obj|opacity|options|nodeName|push|display|result|msie|global|constructor|css|test|handler|new|style|arg|expr|isFunction|opt|easing|window|in|orig|extend|arguments|context|typeof|filter|args|queue|hidden|events|attr|re|hide|show|add|old|target|table|token|replace|trigger|num|elems|div|ifModified|complete|key|none|tbody|params|while|string|nodeType|duration|animate|ready|height|timeout|nth|get|done|script|nextSibling|remove|not|index|tb|fix|merge|oid|z0|preventDefault|find|now|grep|pushStack|custom|innerHTML|first|cssFloat|catch|encodeURIComponent|Array|el|guid|sibling|error|block|oldblock|curAnim|try|stopPropagation|childNodes|id|wrap|text|success|safari|load|res|exec|al|_|last|substr|has|disabled|insertBefore|selected|checked|curCSS|map|firstNum|removeChild|re2|trim|getAttribute|onreadystatechange|handlers|on|originalEvent|fx|readyList|parPos|src|opera|param|mozilla|visible|domManip|clean|cloneNode|tr|call|split|XMLHttpRequest|ajaxSettings|append|child|String|empty|ajax|form|button|inArray|multiFilter|setRequestHeader|foundToken|9_|readyState|tag|modRes|responseText|second|ival|handleError|toUpperCase|setInterval|makeArray|slice|break|oWidth|Number|returnValue|lastModified|styleFloat|bind|width|isReady|toggle|jquery|dir|eval|mouseover|select|to|defaultView|position|oHeight|lastNum|async|step|globalEval|static|pos|swap|self|from|end|float|alpha|radio|inv|is|toLowerCase|visibility|00|clearInterval|timer|rec|isTimeout|dataType|_resort|RegExp|Function|getAll|requestDone|parents|matched|isXMLDoc|appendChild|oldDisplay|active|triggered|file|documentElement|fn2|startTime|Modified|shift|lastToggle|deep|handleHover|getResponseHeader|ct|submit|px|parseFloat|html|evalScripts|getComputedStyle|getElementById|clone|els|safariTimer|currentStyle|unload|force|execScript|getPropertyValue|newProp|setTimeout|zoom|getScript|1px|sl|settings|GET|rl|check|_toggle|processData|prepend|before|state|removeAttr|ajaxStart|lt|Date|gt|eq|contentType|previousSibling|after|parent|contains|getTime|checkbox|password|appendTo|image|reset|input|webkit|href|continue|beforeSend|ajaxSend|ownerDocument|getElementsByTagName|tmp|notmodified|parse|ajaxSuccess|ajaxComplete|_prefix|ajaxStop|even|odd|overflow|delete|POST|ajaxError|200|handle|httpSuccess|nodeValue|unshift|__ie_init|srcElement|body|pageX|tagName|clientX|scrollLeft|httpNotModified|dequeue|Last|scrollTop|304|xmlRes|unbind|100|Math|httpData|click|mouseout|parseInt|json|createElement|DOMContentLoaded|prevObject|ol|setArray|exclude|join|one|max|do|relative|clientHeight|clientWidth|loadIfModified|serialize|toString|thead|tfoot|td|th|textContent|ActiveXObject|htmlFor|Microsoft|class|XMLHTTP|readOnly|gi|match|getIfModified|9999|getJSON|getAttributeNode|post|setAttribute|ig|ajaxTimeout|ajaxSetup|concat|application|userAgent|compatible|www|compatMode|CSS1Compat|next|urlencoded|siblings|children|slideDown|prependTo|slideUp|Top|insertAfter|slideToggle|removeAttribute|addClass|removeClass|open|toggleClass|Content|Type|lastChild|If|only|Since|fadeIn|Thu|01|fadeOut|enabled|Jan|1970|fadeTo|GMT|textarea|Requested|With|prev|overrideMimeType|Connection|close|boxModel|right|object|Object|navigator|substring|abort|cos|font|send|slow|600|fast|400|location|protocol|300|pageY|clientY|method|action|cancelBubble|hover|fromElement|toElement|relatedTarget|removeEventListener|blur|readonly|focus|resize|content|scroll|dblclick|mousedown|mouseup|mousemove|responseXML|change|keydown|keypress|keyup|addEventListener|write|prototype|size|scr|ipt|createTextNode|defer|FORM|reverse|noConflict|loaded|10000|weight|line|Bottom|Right|Left|padding|border|Width|offsetHeight|offsetWidth|absolute|PI|left'.split('|'),0,{}))
|
admin/js/portlets.css
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.groupItem
|
2 |
+
{
|
3 |
+
background-color:#FBFBFB;
|
4 |
+
border:1px solid #CCCCCC;
|
5 |
+
cursor:move;
|
6 |
+
display:block;
|
7 |
+
line-height:75px;
|
8 |
+
cursor: move;
|
9 |
+
margin: 0 0 10px;
|
10 |
+
width: 390px;
|
11 |
+
}
|
12 |
+
|
13 |
+
.innerhandle {
|
14 |
+
border-color:#F2F2F2 rgb(232, 232, 232) rgb(232, 232, 232) rgb(242, 242, 242);
|
15 |
+
border-style:solid;
|
16 |
+
border-width:1px;
|
17 |
+
display:block;
|
18 |
+
}
|
19 |
+
|
20 |
+
.itemContent {
|
21 |
+
padding: 5px;
|
22 |
+
}
|
23 |
+
|
24 |
+
.itemContent p {
|
25 |
+
border: 0;
|
26 |
+
margin: 0;
|
27 |
+
padding: 0;
|
28 |
+
}
|
29 |
+
|
30 |
+
.inlinepicture
|
31 |
+
{
|
32 |
+
float:left;
|
33 |
+
display:inline;
|
34 |
+
margin:0pt;
|
35 |
+
padding:0pt 3px 1px;
|
36 |
+
}
|
37 |
+
|
38 |
+
.sort_placeholder
|
39 |
+
{
|
40 |
+
border:1px dashed #bba !important;
|
41 |
+
background: #F9F9F9;
|
42 |
+
}
|
43 |
+
|
44 |
+
#galleryContainer {
|
45 |
+
background-color:#F0F8FF;
|
46 |
+
border:1px solid #BBBBBB;
|
47 |
+
margin:10px 440px 10px 10px;
|
48 |
+
padding:0px 10px 10px 10px;
|
49 |
+
height:500px;
|
50 |
+
}
|
51 |
+
|
52 |
+
#selectContainer {
|
53 |
+
float:right;
|
54 |
+
background:#F0F8FF none repeat scroll 0%;
|
55 |
+
border:1px solid #BBBBBB;
|
56 |
+
margin:0pt 10px 10px;
|
57 |
+
padding:0px 5px 5px 10px;
|
58 |
+
width:395px;
|
59 |
+
}
|
60 |
+
|
61 |
+
#galleryContainer h3, #selectContainer h3 {
|
62 |
+
color:#333333;
|
63 |
+
text-align:center;
|
64 |
+
line-height:25px;
|
65 |
+
}
|
admin/manage.php
ADDED
@@ -0,0 +1,473 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
4 |
+
|
5 |
+
function nggallery_admin_manage_gallery() {
|
6 |
+
global $wpdb;
|
7 |
+
|
8 |
+
// GET variables
|
9 |
+
$act_gid = trim($_GET['gid']);
|
10 |
+
$act_pid = trim($_GET['pid']);
|
11 |
+
$mode = trim($_GET['mode']);
|
12 |
+
|
13 |
+
// get the options
|
14 |
+
$ngg_options=get_option('ngg_options');
|
15 |
+
|
16 |
+
if ($mode == 'delete') {
|
17 |
+
// Delete a gallery
|
18 |
+
|
19 |
+
// get the path to the gallery
|
20 |
+
$gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$act_gid' ");
|
21 |
+
if ($gallerypath){
|
22 |
+
$thumb_folder = ngg_get_thumbnail_folder($gallerypath, FALSE);
|
23 |
+
$thumb_prefix = ngg_get_thumbnail_prefix($gallerypath, FALSE);
|
24 |
+
|
25 |
+
// delete pictures
|
26 |
+
$imagelist = $wpdb->get_col("SELECT filename FROM $wpdb->nggpictures WHERE galleryid = '$act_gid' ");
|
27 |
+
if ($ngg_options[deleteImg]) {
|
28 |
+
if (is_array($imagelist)) {
|
29 |
+
foreach ($imagelist as $filename) {
|
30 |
+
unlink(WINABSPATH.$gallerypath.'/'.$thumb_folder.'/'.$thumb_prefix.$filename);
|
31 |
+
unlink(WINABSPATH.$gallerypath.'/'.$filename);
|
32 |
+
}
|
33 |
+
}
|
34 |
+
// delete folder
|
35 |
+
@rmdir(WINABSPATH.$gallerypath.'/'.$thumb_folder);
|
36 |
+
@rmdir(WINABSPATH.$gallerypath);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
$delete_pic = $wpdb->query("DELETE FROM $wpdb->nggpictures WHERE galleryid = $act_gid");
|
41 |
+
$delete_galllery = $wpdb->query("DELETE FROM $wpdb->nggallery WHERE gid = $act_gid");
|
42 |
+
|
43 |
+
if($delete_galllery)
|
44 |
+
$messagetext = '<font color="green">'.__('Gallery','nggallery').' \''.$act_gid.'\' '.__('deleted successfully','nggallery').'</font>';
|
45 |
+
$mode = 'main'; // show mainpage
|
46 |
+
}
|
47 |
+
|
48 |
+
if ($mode == 'delpic') {
|
49 |
+
// Delete a picture
|
50 |
+
$gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$act_gid' ");
|
51 |
+
if ($gallerypath){
|
52 |
+
$thumb_folder = ngg_get_thumbnail_folder($gallerypath, FALSE);
|
53 |
+
$thumb_prefix = ngg_get_thumbnail_prefix($gallerypath, FALSE);
|
54 |
+
$filename = $wpdb->get_var("SELECT filename FROM $wpdb->nggpictures WHERE pid = '$act_pid' ");
|
55 |
+
if ($ngg_options[deleteImg]) {
|
56 |
+
unlink(WINABSPATH.$gallerypath.'/'.$thumb_folder.'/'.$thumb_prefix.$filename);
|
57 |
+
unlink(WINABSPATH.$gallerypath.'/'.$filename);
|
58 |
+
}
|
59 |
+
}
|
60 |
+
$delete_pic = $wpdb->query("DELETE FROM $wpdb->nggpictures WHERE pid = $act_pid");
|
61 |
+
|
62 |
+
if($delete_pic)
|
63 |
+
$messagetext = '<font color="green">'.__('Picture','nggallery').' \''.$act_pid.'\' '.__('deleted successfully','nggallery').'</font>';
|
64 |
+
$mode = 'edit'; // show pictures
|
65 |
+
}
|
66 |
+
|
67 |
+
if (isset($_POST['bulkaction'])) {
|
68 |
+
// do bulk update
|
69 |
+
|
70 |
+
$gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$act_gid' ");
|
71 |
+
$imageslist = array();
|
72 |
+
|
73 |
+
if ( is_array($_POST['doaction']) ) {
|
74 |
+
foreach ( $_POST['doaction'] as $imageID ) {
|
75 |
+
$imageslist[] = $wpdb->get_var("SELECT filename FROM $wpdb->nggpictures WHERE pid = '$imageID' ");
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
switch ($_POST['bulkaction']) {
|
80 |
+
case 0;
|
81 |
+
// No action
|
82 |
+
break;
|
83 |
+
case 1:
|
84 |
+
// Set watermark
|
85 |
+
ngg_generateWatermark(WINABSPATH.$gallerypath,$imageslist);
|
86 |
+
$messagetext = '<font color="green">'.__('Watermark successfully added','nggallery').'</font>';
|
87 |
+
break;
|
88 |
+
case 2:
|
89 |
+
// Create new thumbnails
|
90 |
+
ngg_generatethumbnail(WINABSPATH.$gallerypath,$imageslist);
|
91 |
+
$messagetext = '<font color="green">'.__('Thumbnails successfully created. Please refresh your browser cache.','nggallery').'</font>';
|
92 |
+
break;
|
93 |
+
case 3:
|
94 |
+
// Resample images
|
95 |
+
ngg_resizeImages(WINABSPATH.$gallerypath,$imageslist);
|
96 |
+
$messagetext = '<font color="green">'.__('Images successfully resized','nggallery').'</font>';
|
97 |
+
break;
|
98 |
+
case 4:
|
99 |
+
// Delete images
|
100 |
+
if ( is_array($_POST['doaction']) ) {
|
101 |
+
if ($gallerypath){
|
102 |
+
$thumb_folder = ngg_get_thumbnail_folder($gallerypath, FALSE);
|
103 |
+
$thumb_prefix = ngg_get_thumbnail_prefix($gallerypath, FALSE);
|
104 |
+
foreach ( $_POST['doaction'] as $imageID ) {
|
105 |
+
$filename = $wpdb->get_var("SELECT filename FROM $wpdb->nggpictures WHERE pid = '$imageID' ");
|
106 |
+
if ($ngg_options[deleteImg]) {
|
107 |
+
unlink(WINABSPATH.$gallerypath.'/'.$thumb_folder.'/'.$thumb_prefix.$filename);
|
108 |
+
unlink(WINABSPATH.$gallerypath.'/'.$filename);
|
109 |
+
}
|
110 |
+
$delete_pic = $wpdb->query("DELETE FROM $wpdb->nggpictures WHERE pid = $imageID");
|
111 |
+
}
|
112 |
+
}
|
113 |
+
if($delete_pic)
|
114 |
+
$messagetext = '<font color="green">'.__('Pictures deleted successfully ','nggallery').'</font>';
|
115 |
+
}
|
116 |
+
break;
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
if ($_POST['updatepictures']) {
|
121 |
+
// Update pictures
|
122 |
+
|
123 |
+
$gallery_title=$_POST[title];
|
124 |
+
$gallery_path=$_POST[path];
|
125 |
+
$gallery_desc=$_POST[gallerydesc];
|
126 |
+
$gallery_pageid=$_POST[pageid];
|
127 |
+
$gallery_preview=$_POST[previewpic];
|
128 |
+
|
129 |
+
$result = $wpdb->query("UPDATE $wpdb->nggallery SET title= '$gallery_title', path= '$gallery_path', description = '$gallery_desc', pageid = '$gallery_pageid', previewpic = '$gallery_preview' WHERE gid = '$act_gid'");
|
130 |
+
$result = ngg_update_pictures($_POST[description], $_POST[alttext], $_POST[exclude], $act_gid );
|
131 |
+
|
132 |
+
$messagetext = '<font color="green">'.__('Update successfully','nggallery').'</font>';
|
133 |
+
}
|
134 |
+
|
135 |
+
if ($_POST['scanfolder']) {
|
136 |
+
// Rescan folder
|
137 |
+
//TODO: Wenn keine bilder vorhanden sind , fehler beim scannen
|
138 |
+
$gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$act_gid' ");
|
139 |
+
$old_imageslist = $wpdb->get_col("SELECT filename FROM $wpdb->nggpictures WHERE galleryid = '$act_gid' ");
|
140 |
+
// read list of images in folder
|
141 |
+
$new_imageslist = ngg_scandir(WINABSPATH.$gallerypath);
|
142 |
+
// check difference
|
143 |
+
$imageslist = array_diff($new_imageslist, $old_imageslist);
|
144 |
+
//create thumbnails
|
145 |
+
ngg_generatethumbnail(WINABSPATH.$gallerypath,$imageslist);
|
146 |
+
// add images to database
|
147 |
+
$count_pic = 0;
|
148 |
+
if (is_array($imageslist)) {
|
149 |
+
foreach($imageslist as $picture) {
|
150 |
+
$result = $wpdb->query("INSERT INTO $wpdb->nggpictures (galleryid, filename, alttext) VALUES ('$act_gid', '$picture', '$picture') ");
|
151 |
+
if ($result) $count_pic++;
|
152 |
+
}
|
153 |
+
$messagetext = '<font color="green">'.$count_pic.__(' picture(s) successfully added','nggallery').'</font>';
|
154 |
+
}
|
155 |
+
}
|
156 |
+
|
157 |
+
// message windows
|
158 |
+
if(!empty($messagetext)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; }
|
159 |
+
|
160 |
+
if (($mode == '') or ($mode == "main"))
|
161 |
+
nggallery_manage_gallery_main();
|
162 |
+
|
163 |
+
if ($mode == 'edit')
|
164 |
+
nggallery_pciturelist();
|
165 |
+
|
166 |
+
}//nggallery_admin_manage_gallery
|
167 |
+
|
168 |
+
function nggallery_manage_gallery_main() {
|
169 |
+
// *** show main gallery list
|
170 |
+
|
171 |
+
global $wpdb;
|
172 |
+
|
173 |
+
?>
|
174 |
+
<div class="wrap">
|
175 |
+
<h2><?php _e('Gallery Overview', 'nggallery') ?></h2>
|
176 |
+
<table id="the-list-x" width="100%" cellspacing="3" cellpadding="3" >
|
177 |
+
<thead>
|
178 |
+
<tr>
|
179 |
+
<th scope="col" ><?php _e('ID') ?></th>
|
180 |
+
<th scope="col" ><?php _e('Gallery name', 'nggallery') ?></th>
|
181 |
+
<th scope="col" ><?php _e('Title', 'nggallery') ?></th>
|
182 |
+
<th scope="col" ><?php _e('Description', 'nggallery') ?></th>
|
183 |
+
<th scope="col" ><?php _e('Page ID', 'nggallery') ?></th>
|
184 |
+
<th scope="col" ><?php _e('Quantity', 'nggallery') ?></th>
|
185 |
+
<th scope="col" colspan="2"><?php _e('Action'); ?></th>
|
186 |
+
</tr>
|
187 |
+
</thead>
|
188 |
+
<tbody>
|
189 |
+
<?php
|
190 |
+
$gallerylist = $wpdb->get_results("SELECT * FROM $wpdb->nggallery ");
|
191 |
+
if($gallerylist) {
|
192 |
+
foreach($gallerylist as $gallery) {
|
193 |
+
$class = ( $class == 'class="alternate"' ) ? '' : 'class="alternate"';
|
194 |
+
$gid = $gallery->gid;
|
195 |
+
$counter = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = '$gid'");
|
196 |
+
?>
|
197 |
+
<tr id="gallery-<?php echo $gid ?>" <?php echo $class; ?> style="text-align:center">
|
198 |
+
<th scope="row" style="text-align: center"><?php echo $gid; ?></th>
|
199 |
+
<td><?php echo $gallery->name; ?></td>
|
200 |
+
<td><?php echo $gallery->title; ?></td>
|
201 |
+
<td><?php echo $gallery->description; ?></td>
|
202 |
+
<td><?php echo $gallery->pageid; ?></td>
|
203 |
+
<td><?php echo $counter; ?></td>
|
204 |
+
<td><a href="admin.php?page=nggallery-manage-gallery&mode=edit&gid=<?php echo $gid; ?>" class='edit'> <?php _e('Edit') ?></a></td>
|
205 |
+
<td><a href="admin.php?page=nggallery-manage-gallery&mode=delete&gid=<?php echo $gid; ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this file ?",'nggallery')?>');if(check==false) return false;"><?php _e('Delete') ?></a></td>
|
206 |
+
</tr>
|
207 |
+
<?php
|
208 |
+
}
|
209 |
+
} else {
|
210 |
+
echo '<tr><td colspan="7" align="center"><strong>'.__('No entries found','nggallery').'</strong></td></tr>';
|
211 |
+
}
|
212 |
+
?>
|
213 |
+
</tbody>
|
214 |
+
</table>
|
215 |
+
</div>
|
216 |
+
<?php
|
217 |
+
} //nggallery_manage_gallery_main
|
218 |
+
|
219 |
+
function nggallery_pciturelist() {
|
220 |
+
// *** show picture list
|
221 |
+
global $wpdb;
|
222 |
+
|
223 |
+
// GET variables
|
224 |
+
$act_gid = trim($_GET['gid']);
|
225 |
+
|
226 |
+
// get the options
|
227 |
+
$ngg_options=get_option('ngg_options');
|
228 |
+
|
229 |
+
// get gallery values
|
230 |
+
$act_gallery = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$act_gid' ");
|
231 |
+
|
232 |
+
// set gallery url
|
233 |
+
$act_gallery_url = get_settings ('siteurl')."/".$act_gallery->path."/";
|
234 |
+
$act_thumbnail_url = get_settings ('siteurl')."/".$act_gallery->path.ngg_get_thumbnail_folder($act_gallery->path, FALSE);
|
235 |
+
$act_thumb_prefix = ngg_get_thumbnail_prefix($act_gallery->path, FALSE);
|
236 |
+
|
237 |
+
//TODO: Do with wp_register_script
|
238 |
+
?>
|
239 |
+
|
240 |
+
<script type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/jquery.js"></script>
|
241 |
+
<script type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/interface.js"></script>
|
242 |
+
<script type="text/javascript"> $(document).ready(
|
243 |
+
function() {
|
244 |
+
$('.textarea1').Autoexpand([230,400]);
|
245 |
+
/* $("input:checkbox").click(
|
246 |
+
function() {
|
247 |
+
$(this).parents('tr').Highlight(500, '#ff0', function(){$(this).parents('tr').css('backgroundColor', 'transparent');});
|
248 |
+
// $(this).parents('tr').('#td.img').fadeOut(2000);
|
249 |
+
}
|
250 |
+
);
|
251 |
+
*/
|
252 |
+
});
|
253 |
+
</script>
|
254 |
+
<script type="text/javascript"> var LoadingImage = '<?php echo NGGALLERY_URLPATH ?>thickbox/loadingAnimation.gif';</script>
|
255 |
+
<script type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>thickbox/thickbox.js"></script>
|
256 |
+
<style type="text/css" media="all">@import "<?php echo NGGALLERY_URLPATH ?>thickbox/thickbox.css";</style>
|
257 |
+
<style type="text/css" media="all">
|
258 |
+
/** required for view button **/
|
259 |
+
a.thickbox:hover {
|
260 |
+
|
261 |
+
background:#CCCCCC none repeat scroll 0% 50%;
|
262 |
+
color:#003366;
|
263 |
+
|
264 |
+
}
|
265 |
+
|
266 |
+
a.thickbox, a.thickbox:hover {
|
267 |
+
border-bottom:medium none;
|
268 |
+
display:block;
|
269 |
+
padding:5px 0pt;
|
270 |
+
text-align:center;
|
271 |
+
}
|
272 |
+
</style>
|
273 |
+
<script type="text/javascript">
|
274 |
+
<!--
|
275 |
+
function checkAll(form)
|
276 |
+
{
|
277 |
+
for (i = 0, n = form.elements.length; i < n; i++) {
|
278 |
+
if(form.elements[i].type == "checkbox") {
|
279 |
+
if(form.elements[i].name == "doaction[]") {
|
280 |
+
if(form.elements[i].checked == true)
|
281 |
+
form.elements[i].checked = false;
|
282 |
+
else
|
283 |
+
form.elements[i].checked = true;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
}
|
287 |
+
}
|
288 |
+
|
289 |
+
function getNumChecked(form)
|
290 |
+
{
|
291 |
+
var num = 0;
|
292 |
+
for (i = 0, n = form.elements.length; i < n; i++) {
|
293 |
+
if(form.elements[i].type == "checkbox") {
|
294 |
+
if(form.elements[i].name == "doaction[]")
|
295 |
+
if(form.elements[i].checked == true)
|
296 |
+
num++;
|
297 |
+
}
|
298 |
+
}
|
299 |
+
return num;
|
300 |
+
}
|
301 |
+
//-->
|
302 |
+
</script>
|
303 |
+
<div class="wrap">
|
304 |
+
<h2><?php _e('Gallery', 'nggallery') ?> : <?php echo $act_gallery->name; ?></h2>
|
305 |
+
|
306 |
+
<form id="updategallery" method="POST">
|
307 |
+
|
308 |
+
<fieldset class="options">
|
309 |
+
<table width="100%" border="0" cellspacing="3" cellpadding="3" >
|
310 |
+
<tr>
|
311 |
+
<th align="left"><?php _e('Title') ?>:</th>
|
312 |
+
<th align="left"><input type="text" size="50" name="title" value="<?php echo $act_gallery->title; ?>" /></th>
|
313 |
+
<th align="right"><?php _e('Page Link to', 'nggallery') ?>:</th>
|
314 |
+
<th align="left">
|
315 |
+
<select name="pageid" style="width:95%">
|
316 |
+
<option value="0" ><?php _e('Not linked', 'nggallery') ?></option>
|
317 |
+
<?php
|
318 |
+
$pageids = get_all_page_ids();
|
319 |
+
foreach($pageids as $pageid) {
|
320 |
+
$post= get_post($pageid);
|
321 |
+
if ($pageid == $act_gallery->pageid) $selected = 'selected="selected" ';
|
322 |
+
else $selected = '';
|
323 |
+
echo '<option value="'.$pageid.'" '.$selected.'>'.$post->post_title.'</option>'."\n";
|
324 |
+
}
|
325 |
+
?>
|
326 |
+
</select>
|
327 |
+
</th>
|
328 |
+
</tr>
|
329 |
+
<tr>
|
330 |
+
<th align="left"><?php _e('Description') ?>:</th>
|
331 |
+
<th align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php echo $act_gallery->description; ?></textarea></th>
|
332 |
+
<th align="right"><?php _e('Preview image', 'nggallery') ?>:</th>
|
333 |
+
<th align="left">
|
334 |
+
<select name="previewpic" >
|
335 |
+
<option value="0" ><?php _e('No Picture', 'nggallery') ?></option>
|
336 |
+
<?php
|
337 |
+
$picturelist = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures WHERE galleryid = '$act_gid' ORDER BY '$ngg_options[galSort]' ASC");
|
338 |
+
if(is_array($picturelist)) {
|
339 |
+
foreach($picturelist as $picture) {
|
340 |
+
if ($picture->pid == $act_gallery->previewpic) $selected = 'selected="selected" ';
|
341 |
+
else $selected = '';
|
342 |
+
echo '<option value="'.$picture->pid.'" '.$selected.'>'.$picture->filename.'</option>'."\n";
|
343 |
+
}
|
344 |
+
}
|
345 |
+
?>
|
346 |
+
</select>
|
347 |
+
</th>
|
348 |
+
</tr>
|
349 |
+
<tr>
|
350 |
+
<th align="left"><?php _e('Path', 'nggallery') ?>:</th>
|
351 |
+
<th align="left"><input type="text" size="50" name="path" value="<?php echo $act_gallery->path; ?>" /></th>
|
352 |
+
<th></th>
|
353 |
+
<th></th>
|
354 |
+
</tr>
|
355 |
+
|
356 |
+
</table>
|
357 |
+
<p class="submit">
|
358 |
+
<input type="submit" name="scanfolder" value="<?php _e("Scan Folder for new images",'nggallery')?> " />
|
359 |
+
<input type="submit" name="updatepictures" value="<?php _e("Save Changes",'nggallery')?> »" />
|
360 |
+
<p>
|
361 |
+
</fieldset>
|
362 |
+
<fieldset class="options">
|
363 |
+
<p><select id="bulkaction" name="bulkaction" >
|
364 |
+
<option value="0" ><?php _e("No action",'nggallery')?></option>
|
365 |
+
<option value="1" ><?php _e("Set watermark",'nggallery')?></option>
|
366 |
+
<option value="2" ><?php _e("Create new thumbnails",'nggallery')?></option>
|
367 |
+
<option value="3" ><?php _e("Resize images",'nggallery')?></option>
|
368 |
+
<option value="4" ><?php _e("Delete images",'nggallery')?></option>
|
369 |
+
</select>
|
370 |
+
<input type="submit" name="doaction" value="<?php _e("OK",'nggallery')?>" onclick="var numchecked = getNumChecked(document.getElementById('updategallery')); if(numchecked < 1) { alert('<?php echo js_escape(__("No images selected",'nggallery')); ?>'); return false } return confirm('<?php echo sprintf(js_escape(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.",'nggallery')), "' + numchecked + '") ; ?>')" />
|
371 |
+
</p>
|
372 |
+
<table id="listimages" width="100%" cellspacing="2" cellpadding="5" class="widefat" >
|
373 |
+
<thead>
|
374 |
+
<tr>
|
375 |
+
<th scope="col" style="text-align: center"><input name="checkall" type="checkbox" onclick="checkAll(document.getElementById('updategallery'));" /></th>
|
376 |
+
<th scope="col" style="text-align: center"><?php _e('ID') ?></th>
|
377 |
+
<th scope="col" style="text-align: center"><?php _e('File name', 'nggallery') ?></th>
|
378 |
+
<th scope="col" style="text-align: center"><?php _e('Thumbnail', 'nggallery') ?></th>
|
379 |
+
<th scope="col" style="text-align: center"><?php _e('Description', 'nggallery') ?></th>
|
380 |
+
<th scope="col" style="text-align: center"><?php _e('Alt & Title Text', 'nggallery') ?></th>
|
381 |
+
<th scope="col" style="text-align: center"><?php _e('exclude', 'nggallery') ?></th>
|
382 |
+
<th scope="col" colspan="2" style="text-align: center"><?php _e('Action') ?></th>
|
383 |
+
</tr>
|
384 |
+
</thead>
|
385 |
+
<tbody>
|
386 |
+
<?php
|
387 |
+
|
388 |
+
if($picturelist) {
|
389 |
+
foreach($picturelist as $picture) {
|
390 |
+
//TODO: Ajax delete version , looks better
|
391 |
+
//TODO: Use effect for inactive pic : style="filter:alpha(opacity=30); -moz-opacity:0.3"
|
392 |
+
|
393 |
+
$pid = $picture->pid;
|
394 |
+
$class = ( $class == 'class="alternate"' ) ? '' : 'class="alternate"';
|
395 |
+
if ($picture->exclude) {
|
396 |
+
$exclude='checked="checked"';
|
397 |
+
} else {
|
398 |
+
$exclude='';
|
399 |
+
}
|
400 |
+
|
401 |
+
?>
|
402 |
+
<tr id="picture-<?php echo $pid ?>" <?php echo $class ?> style="text-align:center">
|
403 |
+
<td><input name="doaction[]" type="checkbox" value="<?php echo $pid ?>" /></td>
|
404 |
+
<th scope="row" style="text-align: center"><?php echo $pid ?></th>
|
405 |
+
<td><?php echo $picture->filename ?></td>
|
406 |
+
<td><img class="thumb" src="<?php echo $act_thumbnail_url.$act_thumb_prefix.$picture->filename ?>" /></td>
|
407 |
+
<td><textarea name="description[<?php echo $pid ?>]" class="textarea1" cols="30" rows="3" ><?php echo stripslashes($picture->description) ?></textarea></td>
|
408 |
+
<td><input name="alttext[<?php echo $pid ?>]" type="text" size="20" value="<?php echo $picture->alttext ?>" /></td>
|
409 |
+
<td><input name="exclude[<?php echo $pid ?>]" type="checkbox" value="1" <?php echo $exclude ?> /></td>
|
410 |
+
<td><a href="<?php echo $act_gallery_url.$picture->filename ?>" class="thickbox" title="<?php echo $picture->alttext ?>" ><?php _e('View') ?></a></td>
|
411 |
+
<td><a href="admin.php?page=nggallery-manage-gallery&mode=delpic&gid=<?php echo $act_gid ?>&pid=<?php echo $pid ?>" class="delete" onclick="javascript:check=confirm( '<?php _e("Delete this file ?",'nggallery')?>');if(check==false) return false;" ><?php _e('Delete') ?></a></td>
|
412 |
+
</tr>
|
413 |
+
<?php
|
414 |
+
}
|
415 |
+
} else {
|
416 |
+
echo '<tr><td colspan="8" align="center"><strong>'.__('No entries found','nggallery').'</strong></td></tr>';
|
417 |
+
}
|
418 |
+
?>
|
419 |
+
|
420 |
+
</tbody>
|
421 |
+
</table>
|
422 |
+
</fieldset>
|
423 |
+
<p class="submit"><input type="submit" name="updatepictures" value="<?php _e("Save Changes",'nggallery')?> »" /><p>
|
424 |
+
</form>
|
425 |
+
<br class="clear"/>
|
426 |
+
</div><!-- /#wrap -->
|
427 |
+
<?php
|
428 |
+
|
429 |
+
} //nggallery_pciturelist
|
430 |
+
|
431 |
+
/**************************************************************************/
|
432 |
+
function ngg_update_pictures( $nggdescription, $nggalttext, $nggexclude, $nggalleryid ) {
|
433 |
+
// update all pictures
|
434 |
+
|
435 |
+
global $wpdb,$act_gid;
|
436 |
+
|
437 |
+
if (is_array($nggdescription)) {
|
438 |
+
foreach($nggdescription as $key=>$value) {
|
439 |
+
$result=$wpdb->query( "UPDATE $wpdb->nggpictures SET description = '$value' WHERE pid = $key");
|
440 |
+
if($result) $update_ok = $result;
|
441 |
+
}
|
442 |
+
}
|
443 |
+
if (is_array($nggalttext)){
|
444 |
+
foreach($nggalttext as $key=>$value) {
|
445 |
+
$result=$wpdb->query( "UPDATE $wpdb->nggpictures SET alttext = '$value' WHERE pid = $key");
|
446 |
+
if($result) $update_ok = $result;
|
447 |
+
}
|
448 |
+
}
|
449 |
+
|
450 |
+
$nggpictures = $wpdb->get_results("SELECT pid FROM $wpdb->nggpictures WHERE galleryid = '$act_gid'");
|
451 |
+
|
452 |
+
if (is_array($nggpictures)){
|
453 |
+
foreach($nggpictures as $picture){
|
454 |
+
if (is_array($nggexclude)){
|
455 |
+
if (array_key_exists($picture->pid, $nggexclude)) {
|
456 |
+
$result=$wpdb->query("UPDATE $wpdb->nggpictures SET exclude = 1 WHERE pid = '$picture->pid'");
|
457 |
+
if($result) $update_ok = $result;
|
458 |
+
}
|
459 |
+
else {
|
460 |
+
$result=$wpdb->query("UPDATE $wpdb->nggpictures SET exclude = 0 WHERE pid = '$picture->pid'");
|
461 |
+
if($result) $update_ok = $result;
|
462 |
+
}
|
463 |
+
} else {
|
464 |
+
$result=$wpdb->query("UPDATE $wpdb->nggpictures SET exclude = 0 WHERE pid = '$picture->pid'");
|
465 |
+
if($result) $update_ok = $result;
|
466 |
+
}
|
467 |
+
}
|
468 |
+
}
|
469 |
+
|
470 |
+
return $update_ok;
|
471 |
+
}
|
472 |
+
|
473 |
+
?>
|
admin/overview.php
ADDED
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
3 |
+
|
4 |
+
require_once(ABSPATH . WPINC . '/rss.php');
|
5 |
+
require_once(ABSPATH . WPINC . '/class-snoopy.php');
|
6 |
+
|
7 |
+
function nggallery_admin_overview() {
|
8 |
+
global $wpdb;
|
9 |
+
|
10 |
+
?>
|
11 |
+
<div class="wrap">
|
12 |
+
<h2><?php _e('NextGEN Gallery Overview', 'nggallery') ?></h2>
|
13 |
+
|
14 |
+
<div id="zeitgeist">
|
15 |
+
<h2><?php _e('Summary', 'nggallery') ?></h2>
|
16 |
+
<p>
|
17 |
+
<?php
|
18 |
+
$replace = array
|
19 |
+
(
|
20 |
+
'<strong>'.$wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures").'</strong>',
|
21 |
+
'<strong>'.$wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggallery").'</strong>',
|
22 |
+
'<strong>'.$wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggalbum").'</strong>'
|
23 |
+
);
|
24 |
+
vprintf(__('There are totally %1$s pictures in %2$s gallerys, which are spread across %3$s albums.', 'nggallery'), $replace);
|
25 |
+
?>
|
26 |
+
</p>
|
27 |
+
<?php if (ngg_version_check()) { ?>
|
28 |
+
<h3><font color="red"><?php _e('New Version available', 'nggallery') ?></font></h3>
|
29 |
+
<p><?php _e('The server reports that a new NextGEN Gallery Version is now available. Please visit the plugin homepage for more information.', 'nggallery') ?></p>
|
30 |
+
<?php } ?>
|
31 |
+
<h3><?php _e('Server Settings', 'nggallery') ?></h3>
|
32 |
+
<ul>
|
33 |
+
<?php ngg_get_serverinfo(); ?>
|
34 |
+
</ul>
|
35 |
+
<?php ngg_gd_info(); ?>
|
36 |
+
</div>
|
37 |
+
|
38 |
+
<h3><?php _e('Welcome', 'nggallery') ?></h3>
|
39 |
+
|
40 |
+
<p>
|
41 |
+
<?php
|
42 |
+
$userlevel = '<strong>' . (current_user_can('manage_options') ? __('forum administrator', 'nggallery') : __('forum moderator', 'nggallery')) . '</strong>';
|
43 |
+
printf(__('Welcome to NextGEN Gallery. Here you can control your images, galleries and albums. You currently have %s rights.', 'nggallery'), $userlevel);
|
44 |
+
?>
|
45 |
+
</p>
|
46 |
+
|
47 |
+
<ul>
|
48 |
+
<?php if(current_user_can('manage_options')): ?><li><a href="admin.php?page=nggallery-add-gallery"><?php _e('Add a new gallery or import pictures', 'nggallery') ?></a></li><?php endif; ?>
|
49 |
+
<li><a href="admin.php?page=nggallery-manage-gallery"><?php _e('Manage galleries and images', 'nggallery') ?></a></li>
|
50 |
+
<?php if(current_user_can('manage_options')): ?><li><a href="admin.php?page=nggallery-manage-album"><?php _e('Create and manage albums', 'nggallery') ?></a></li><?php endif; ?>
|
51 |
+
<?php if(current_user_can('manage_options')): ?><li><a href="admin.php?page=nggallery-options"><?php _e('Change the settings of NextGEN Gallery', 'nggallery') ?></a></li><?php endif; ?>
|
52 |
+
</ul>
|
53 |
+
<div id="devnews">
|
54 |
+
<h3><?php _e('Latest News', 'nggallery') ?></h3>
|
55 |
+
|
56 |
+
<?php
|
57 |
+
$rss = fetch_rss('http://alexrabe.boelinger.com/?tag=nextgen-gallery&feed=rss2');
|
58 |
+
|
59 |
+
if ( isset($rss->items) && 0 != count($rss->items) )
|
60 |
+
{
|
61 |
+
$rss->items = array_slice($rss->items, 0, 3);
|
62 |
+
foreach ($rss->items as $item)
|
63 |
+
{
|
64 |
+
?>
|
65 |
+
<h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> — <?php echo human_time_diff(strtotime($item['pubdate'], time())); ?></h4>
|
66 |
+
<p><?php echo '<strong>'.date("F, jS", strtotime($item['pubdate'])).'</strong> - '.$item['description']; ?></p>
|
67 |
+
<?php
|
68 |
+
}
|
69 |
+
}
|
70 |
+
else
|
71 |
+
{
|
72 |
+
?>
|
73 |
+
<p><?php printf(__('Newsfeed could not be loaded. Check the <a href="%s">front page</a> to check for updates.', 'nggallery'), 'http://alexrabe.boelinger.com/') ?></p>
|
74 |
+
<?php
|
75 |
+
}
|
76 |
+
?>
|
77 |
+
</div>
|
78 |
+
<br style="clear: both" />
|
79 |
+
</div>
|
80 |
+
<?php
|
81 |
+
}
|
82 |
+
|
83 |
+
// ***************************************************************
|
84 |
+
function ngg_gd_info() {
|
85 |
+
if(function_exists("gd_info")){
|
86 |
+
echo '<div><h3>'.__('GD support', 'nggallery').'</h3><ul>';
|
87 |
+
$info = gd_info();
|
88 |
+
$keys = array_keys($info);
|
89 |
+
for($i=0; $i<count($keys); $i++) {
|
90 |
+
if(is_bool($info[$keys[$i]]))
|
91 |
+
echo "<li> " . $keys[$i] ." : <strong>" . ngg_gd_yesNo($info[$keys[$i]]) . "</strong></li>\n";
|
92 |
+
else
|
93 |
+
echo "<li> " . $keys[$i] ." : <strong>" . $info[$keys[$i]] . "</strong></li>\n";
|
94 |
+
}
|
95 |
+
}
|
96 |
+
else {
|
97 |
+
echo '<div><h3>'.__('No GD support', 'nggallery').'!</h3><ul>';
|
98 |
+
}
|
99 |
+
echo '</ul></div>';
|
100 |
+
}
|
101 |
+
|
102 |
+
// ***************************************************************
|
103 |
+
function ngg_gd_yesNo($bool){
|
104 |
+
if($bool) return __('Yes', 'nggallery');
|
105 |
+
else return __('No', 'nggallery');
|
106 |
+
}
|
107 |
+
|
108 |
+
// ***************************************************************
|
109 |
+
function ngg_get_serverinfo() {
|
110 |
+
// thx to GaMerZ for WP-ServerInfo
|
111 |
+
// http://www.lesterchan.net
|
112 |
+
|
113 |
+
global $wpdb;
|
114 |
+
// Get MYSQL Version
|
115 |
+
$sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
|
116 |
+
// GET SQL Mode
|
117 |
+
$mysqlinfo = $wpdb->get_results("SHOW VARIABLES LIKE 'sql_mode'");
|
118 |
+
if (is_array($mysqlinfo)) $sql_mode = $mysqlinfo[0]->Value;
|
119 |
+
if (empty($sql_mode)) $sql_mode = __('Not set', 'nggallery');
|
120 |
+
// Get PHP Safe Mode
|
121 |
+
if(ini_get('safe_mode')) $safe_mode = __('On', 'nggallery');
|
122 |
+
else $safe_mode = __('Off', 'nggallery');
|
123 |
+
// Get PHP Max Upload Size
|
124 |
+
if(ini_get('upload_max_filesize')) $upload_max = ini_get('upload_max_filesize');
|
125 |
+
else $upload_max = __('N/A', 'nggallery');
|
126 |
+
// Get PHP Max Post Size
|
127 |
+
if(ini_get('post_max_size')) $post_max = ini_get('post_max_size');
|
128 |
+
else $post_max = __('N/A', 'nggallery');
|
129 |
+
// Get PHP Max execution time
|
130 |
+
if(ini_get('max_execution_time')) $max_execute = ini_get('max_execution_time');
|
131 |
+
else $max_execute = __('N/A', 'nggallery');
|
132 |
+
// Get PHP Memory Limit
|
133 |
+
if(ini_get('memory_limit')) $memory_limit = ini_get('memory_limit');
|
134 |
+
else $memory_limit = __('N/A', 'nggallery');
|
135 |
+
?>
|
136 |
+
<li><?php _e('Operating System', 'nggallery'); ?> : <strong><?php echo PHP_OS; ?></strong></li>
|
137 |
+
<li><?php _e('Server', 'nggallery'); ?> : <strong><?php echo $_SERVER["SERVER_SOFTWARE"]; ?></strong></li>
|
138 |
+
<li><?php _e('MYSQL Version', 'nggallery'); ?> : <strong><?php echo $sqlversion; ?></strong></li>
|
139 |
+
<li><?php _e('SQL Mode', 'nggallery'); ?> : <strong><?php echo $sql_mode; ?></strong></li>
|
140 |
+
<li><?php _e('PHP Version', 'nggallery'); ?> : <strong><?php echo PHP_VERSION; ?></strong></li>
|
141 |
+
<li><?php _e('PHP Safe Mode', 'nggallery'); ?> : <strong><?php echo $safe_mode; ?></strong></li>
|
142 |
+
<li><?php _e('PHP Memory Limit', 'nggallery'); ?> : <strong><?php echo $memory_limit; ?></strong></li>
|
143 |
+
<li><?php _e('PHP Max Upload Size', 'nggallery'); ?> : <strong><?php echo $upload_max; ?></strong></li>
|
144 |
+
<li><?php _e('PHP Max Post Size', 'nggallery'); ?> : <strong><?php echo $post_max; ?></strong></li>
|
145 |
+
<li><?php _e('PHP Max Script Execute Time', 'nggallery'); ?> : <strong><?php echo $max_execute; ?>s</strong></li>
|
146 |
+
<?php
|
147 |
+
}
|
148 |
+
|
149 |
+
// ***************************************************************
|
150 |
+
function ngg_version_check() {
|
151 |
+
// check for a new version
|
152 |
+
$check_intervall = get_option( "ngg_next_update" );
|
153 |
+
|
154 |
+
if ( ($check_intervall < time() ) or (empty($check_intervall)) ) {
|
155 |
+
if (class_exists(snoopy)) {
|
156 |
+
$client = new Snoopy();
|
157 |
+
$client->_fp_timeout = 10;
|
158 |
+
if (@$client->fetch(NGGURL) === false) {
|
159 |
+
return false;
|
160 |
+
}
|
161 |
+
|
162 |
+
$remote = $client->results;
|
163 |
+
|
164 |
+
$server_version = unserialize($remote);
|
165 |
+
if (is_array($server_version)) {
|
166 |
+
if ( version_compare($server_version[0], NGGVERSION, '>') )
|
167 |
+
return true;
|
168 |
+
}
|
169 |
+
// come back in 24 hours :-)
|
170 |
+
$check_intervall = time() + 86400;
|
171 |
+
update_option( "ngg_next_update", $check_intervall );
|
172 |
+
return false;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}
|
176 |
+
|
177 |
+
?>
|
admin/settings.php
ADDED
@@ -0,0 +1,538 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
3 |
+
|
4 |
+
function nggallery_admin_options() {
|
5 |
+
|
6 |
+
global $wpdb;
|
7 |
+
|
8 |
+
// get the options
|
9 |
+
$ngg_options=get_option('ngg_options');
|
10 |
+
|
11 |
+
if ( isset($_POST['updateoption']) ) {
|
12 |
+
// get the hidden option fields, taken from WP core
|
13 |
+
if ( $_POST['page_options'] )
|
14 |
+
$options = explode(',', stripslashes($_POST['page_options']));
|
15 |
+
if ($options) {
|
16 |
+
foreach ($options as $option) {
|
17 |
+
$option = trim($option);
|
18 |
+
$value = trim($_POST[$option]);
|
19 |
+
// $value = sanitize_option($option, $value); // This does stripslashes on those that need it
|
20 |
+
$ngg_options[$option] = $value;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
update_option('ngg_options', $ngg_options);
|
25 |
+
$messagetext = '<font color="green">'.__('Update successfully','nggallery').'</font>';
|
26 |
+
}
|
27 |
+
|
28 |
+
// message windows
|
29 |
+
if(!empty($messagetext)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; }
|
30 |
+
|
31 |
+
?>
|
32 |
+
<script type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/jquery.js"></script>
|
33 |
+
<script type="text/javascript" src="<?php echo NGGALLERY_URLPATH ?>admin/js/interface.js"></script>
|
34 |
+
<script type="text/javascript">
|
35 |
+
var currentTab = null;
|
36 |
+
var inSlide = false;
|
37 |
+
$(document).ready(
|
38 |
+
function()
|
39 |
+
{
|
40 |
+
var url, tab = 0, tabIteration = 0;
|
41 |
+
|
42 |
+
url = window.location.href.split("#");
|
43 |
+
if (url.length == 2 && url[1].indexOf('-slider') > 0) {
|
44 |
+
currentTab = $('#' + url[1].substr(0, url[1].length-7));
|
45 |
+
if (currentTab.size() == 1) {
|
46 |
+
$('#slider div').each(
|
47 |
+
function(iteration)
|
48 |
+
{
|
49 |
+
if(this === currentTab.get(0)) {
|
50 |
+
tabIteration = iteration;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
if(!currentTab) {
|
58 |
+
currentTab = $('#slider div:first');
|
59 |
+
}
|
60 |
+
//Nicer, but buggy: DropToggleRight
|
61 |
+
currentTab.SlideToggleUp(500);
|
62 |
+
$('#tabs a')
|
63 |
+
.eq(tabIteration).addClass('active')
|
64 |
+
.end()
|
65 |
+
.bind('click', switchTab);
|
66 |
+
}
|
67 |
+
);
|
68 |
+
|
69 |
+
var switchTab = function()
|
70 |
+
{
|
71 |
+
// get id from link
|
72 |
+
var tabName = this.href.split('#')[1];
|
73 |
+
this.blur();
|
74 |
+
if (inSlide == false && currentTab.get(0) != $('#' + tabName.substr(0, tabName.length-7)).get(0)) {
|
75 |
+
$('#tabs a').removeClass('active');
|
76 |
+
$(this).addClass('active');
|
77 |
+
inSlide = true;
|
78 |
+
currentTab.SlideToggleUp(
|
79 |
+
500,
|
80 |
+
function()
|
81 |
+
{
|
82 |
+
currentTab = $('#' + tabName.substr(0, tabName.length-7)).SlideToggleUp(500, function(){inSlide=false;});
|
83 |
+
}
|
84 |
+
);
|
85 |
+
} else {
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
};
|
89 |
+
|
90 |
+
function insertcode(value) {
|
91 |
+
var effectcode;
|
92 |
+
switch (value) {
|
93 |
+
case "none":
|
94 |
+
effectcode = "";
|
95 |
+
break;
|
96 |
+
case "thickbox":
|
97 |
+
effectcode = 'class="thickbox" rel="%GALLERY_NAME%"';
|
98 |
+
break;
|
99 |
+
case "lightbox":
|
100 |
+
effectcode = 'rel="lightbox[%GALLERY_NAME%]"';
|
101 |
+
break;
|
102 |
+
case "highslide":
|
103 |
+
effectcode = 'class="highslide" onclick="return hs.expand(this, { slideshowGroup: %GALLERY_NAME% })"';
|
104 |
+
break;
|
105 |
+
default:
|
106 |
+
break;
|
107 |
+
}
|
108 |
+
$("#thumbCode").val(effectcode);
|
109 |
+
};
|
110 |
+
function setcolor(fileid,color) {
|
111 |
+
$(fileid).css("background", color );
|
112 |
+
};
|
113 |
+
</script>
|
114 |
+
<div class="wrap" style="text-align: center">
|
115 |
+
<div id="tabs">
|
116 |
+
<a href="#generaloptions-slider"><?php _e('General Options', 'nggallery') ;?></a> -
|
117 |
+
<a href="#thumbnails-slider"><?php _e('Thumbnails', 'nggallery') ;?></a> -
|
118 |
+
<a href="#images-slider"><?php _e('Images', 'nggallery') ;?></a> -
|
119 |
+
<a href="#gallery-slider"><?php _e('Gallery', 'nggallery') ;?></a> -
|
120 |
+
<a href="#effects-slider"><?php _e('Effects', 'nggallery') ;?></a> -
|
121 |
+
<a href="#watermark-slider"><?php _e('Watermark', 'nggallery') ;?></a> -
|
122 |
+
<a href="#slideshow-slider"><?php _e('Slideshow', 'nggallery') ;?></a>
|
123 |
+
</div>
|
124 |
+
</div>
|
125 |
+
|
126 |
+
<div class="wrap">
|
127 |
+
<div id="slider">
|
128 |
+
|
129 |
+
<!-- General Options -->
|
130 |
+
|
131 |
+
<div id="generaloptions" style="display:none">
|
132 |
+
<h2><?php _e('General Options','nggallery'); ?></h2>
|
133 |
+
<form name="generaloptions" method="post">
|
134 |
+
<input type="hidden" name="page_options" value="gallerypath,scanfolder,deleteImg" />
|
135 |
+
<fieldset class="options">
|
136 |
+
<table class="optiontable editform">
|
137 |
+
<tr valign="top">
|
138 |
+
<th align="left"><?php _e('Gallery path','nggallery') ?></th>
|
139 |
+
<td><input type="text" size="35" name="gallerypath" value="<?php echo $ngg_options[gallerypath]; ?>" title="TEST" /><br />
|
140 |
+
<?php _e('This is the default path for all galleries','nggallery') ?></td>
|
141 |
+
</tr>
|
142 |
+
<tr valign="top">
|
143 |
+
<th align="left"><?php _e('Scan folders during runtime','nggallery') ?></th>
|
144 |
+
<td><input type="checkbox" name="scanfolder" value="1" <?php checked('1', $ngg_options[scanfolder]); ?> /><br />
|
145 |
+
<?php _e('Search automatic in the folders for new images (not working)','nggallery') ?></td>
|
146 |
+
</tr>
|
147 |
+
<tr valign="top">
|
148 |
+
<th align="left"><?php _e('Delete image files','nggallery') ?></th>
|
149 |
+
<td><input type="checkbox" name="deleteImg" value="1" <?php checked('1', $ngg_options[deleteImg]); ?> /><br />
|
150 |
+
<?php _e('Delete files, when removing a gallery in the database','nggallery') ?></td>
|
151 |
+
</tr>
|
152 |
+
</table>
|
153 |
+
<div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?> »"/></div>
|
154 |
+
</fieldset>
|
155 |
+
</form>
|
156 |
+
</div>
|
157 |
+
|
158 |
+
<!-- Thumbnail settings -->
|
159 |
+
|
160 |
+
<div id="thumbnails" style="display:none">
|
161 |
+
<h2><?php _e('Thumbnail settings','nggallery'); ?></h2>
|
162 |
+
<form name="thumbnailsettings" method="POST" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']).'#thumbnails-slider'; ?>" >
|
163 |
+
<input type="hidden" name="page_options" value="thumbwidth,thumbheight,thumbfix,thumbcrop,thumbquality,thumbResampleMode" />
|
164 |
+
<fieldset class="options">
|
165 |
+
<table class="optiontable editform">
|
166 |
+
<tr valign="top">
|
167 |
+
<th align="left"><?php _e('Width x height (in pixel)','nggallery') ?></th>
|
168 |
+
<td><input type="text" size="4" maxlength="4" name="thumbwidth" value="<?php echo $ngg_options[thumbwidth]; ?>" /> x <input type="text" size="4" maxlength="4" name="thumbheight" value="<?php echo $ngg_options[thumbheight]; ?>" /><br />
|
169 |
+
<?php _e('This values are maxium values ','nggallery') ?></td>
|
170 |
+
</tr>
|
171 |
+
<tr valign="top">
|
172 |
+
<th align="left"><?php _e('Set fix dimension','nggallery') ?></th>
|
173 |
+
<td><input type="checkbox" name="thumbfix" value="1" <?php checked('1', $ngg_options[thumbfix]); ?> /><br />
|
174 |
+
<?php _e('Ignore the aspect ratio, no portrait thumbnails','nggallery') ?></td>
|
175 |
+
</tr>
|
176 |
+
<tr valign="top">
|
177 |
+
<th align="left"><?php _e('Crop thumbnail from image','nggallery') ?></th>
|
178 |
+
<td><input type="checkbox" name="thumbcrop" value="1" <?php checked('1', $ngg_options[thumbcrop]); ?> /><br />
|
179 |
+
<?php _e('Create square thumbnails from the center','nggallery') ?></td>
|
180 |
+
</tr>
|
181 |
+
<tr valign="top">
|
182 |
+
<th align="left"><?php _e('Thumbnail quality','nggallery') ?></th>
|
183 |
+
<td><input type="text" size="3" maxlength="3" name="thumbquality" value="<?php echo $ngg_options[thumbquality]; ?>" /> %</td>
|
184 |
+
</tr>
|
185 |
+
<tr valign="top">
|
186 |
+
<th align="left"><?php _e('Resample Mode','nggallery') ?></th>
|
187 |
+
<td><input type="text" size="1" maxlength="1" name="thumbResampleMode" value="<?php echo $ngg_options[thumbResampleMode]; ?>" /><br />
|
188 |
+
<?php _e('Value between 1-5 (higher value, more CPU load)','nggallery') ?></td>
|
189 |
+
</tr>
|
190 |
+
</table>
|
191 |
+
<div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?> »"/></div>
|
192 |
+
</fieldset>
|
193 |
+
</form>
|
194 |
+
</div>
|
195 |
+
|
196 |
+
<!-- Image settings -->
|
197 |
+
|
198 |
+
<div id="images" style="display:none">
|
199 |
+
<h2><?php _e('Image settings','nggallery'); ?></h2>
|
200 |
+
<form name="imagesettings" method="POST" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']).'#images-slider'; ?>" >
|
201 |
+
<input type="hidden" name="page_options" value="imgResize,imgWidth,imgHeight,imgQuality,imgResampleMode,imgSinglePicLink" />
|
202 |
+
<fieldset class="options">
|
203 |
+
<table class="optiontable">
|
204 |
+
<tr valign="top">
|
205 |
+
<th scope="row"><label for="fixratio"><?php _e('Resize Images','nggallery') ?></label></th>
|
206 |
+
<td><input id="fixratio" type="checkbox" name="imgResize" value="1" <?php checked('1', $ngg_options[imgResize]); ?> /> </td>
|
207 |
+
<td><input type="text" size="5" name="imgWidth" value="<?php echo $ngg_options[imgWidth]; ?>" /> x <input type="text" size="5" name="imgHeight" value="<?php echo $ngg_options[imgHeight]; ?>" /><br />
|
208 |
+
<?php _e('Width x height (in pixel). NextGEN Gallery will keep ratio size','nggallery') ?></td>
|
209 |
+
</tr>
|
210 |
+
<tr valign="top">
|
211 |
+
<th align="left"><?php _e('Image quality','nggallery') ?></th>
|
212 |
+
<td></td>
|
213 |
+
<td><input type="text" size="3" maxlength="3" name="imgQuality" value="<?php echo $ngg_options[imgQuality]; ?>" /> %</td>
|
214 |
+
</tr>
|
215 |
+
<tr valign="top">
|
216 |
+
<th align="left"><?php _e('Resample Mode','nggallery') ?></th>
|
217 |
+
<td></td>
|
218 |
+
<td><input type="text" size="1" maxlength="1" name="imgResampleMode" value="<?php echo $ngg_options[imgResampleMode]; ?>" /><br />
|
219 |
+
<?php _e('Value between 1-5 (higher value, more CPU load)','nggallery') ?></td>
|
220 |
+
</tr>
|
221 |
+
<tr valign="top">
|
222 |
+
<th align="left"><?php _e('Add link in [singlepic] tag ','nggallery') ?></th>
|
223 |
+
<td></td>
|
224 |
+
<td><input type="checkbox" name="imgSinglePicLink" value="1" <?php checked('1', $ngg_options[imgSinglePicLink]); ?> /><br />
|
225 |
+
<?php _e('Add the fullsize picture as link. Didn\'t support watermark mode on the fly.','nggallery') ?></td>
|
226 |
+
</tr>
|
227 |
+
</table>
|
228 |
+
<div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?> »"/></div>
|
229 |
+
</fieldset>
|
230 |
+
</form>
|
231 |
+
</div>
|
232 |
+
|
233 |
+
<!-- Gallery settings -->
|
234 |
+
|
235 |
+
<div id="gallery" style="display:none">
|
236 |
+
<h2><?php _e('Gallery settings','nggallery'); ?></h2>
|
237 |
+
<form name="galleryform" method="POST" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']).'#gallery-slider'; ?>" >
|
238 |
+
<input type="hidden" name="page_options" value="galImages,galShowSlide,galTextSlide,galTextGallery,galShowOrder,galSort" />
|
239 |
+
<fieldset class="options">
|
240 |
+
<table class="optiontable">
|
241 |
+
<tr>
|
242 |
+
<th valign="top"><?php _e('Number of images per page','nggallery') ?>:</th>
|
243 |
+
<td><input type="text" name="galImages" value="<?php echo $ngg_options[galImages] ?>" size="3" maxlength="3" /><br />
|
244 |
+
<?php _e('Value 0 = No Navigation, all images on one page','nggallery') ?></td>
|
245 |
+
</tr>
|
246 |
+
<tr>
|
247 |
+
<th valign="top"><?php _e('Integrate slideshow','nggallery') ?>:</th>
|
248 |
+
<td><input name="galShowSlide" type="checkbox" value="1" <?php checked('1', $ngg_options[galShowSlide]); ?> />
|
249 |
+
<input type="text" name="galTextSlide" value="<?php echo $ngg_options[galTextSlide] ?>" size="20" />
|
250 |
+
<input type="text" name="galTextGallery" value="<?php echo $ngg_options[galTextGallery] ?>" size="20" />
|
251 |
+
</td>
|
252 |
+
</tr>
|
253 |
+
<tr>
|
254 |
+
<th valign="top"><?php _e('Show first','nggallery') ?>:</th>
|
255 |
+
<td><label><input name="galShowOrder" type="radio" value="gallery" <?php checked('gallery', $ngg_options[galShowOrder]); ?> /> <?php _e('Thumbnails', 'nggallery') ;?></label><br />
|
256 |
+
<label><input name="galShowOrder" type="radio" value="slide" <?php checked('slide', $ngg_options[galShowOrder]); ?> /> <?php _e('Slideshow', 'nggallery') ;?></label></td>
|
257 |
+
</tr>
|
258 |
+
<tr>
|
259 |
+
<th valign="top"><?php _e('Sort thumbnails','nggallery') ?>:</th>
|
260 |
+
<td><label><input name="galSort" type="radio" value="pid" <?php checked('pid', $ngg_options[galSort]); ?> /> <?php _e('Image ID', 'nggallery') ;?></label><br />
|
261 |
+
<label><input name="galSort" type="radio" value="filename" <?php checked('filename', $ngg_options[galSort]); ?> /> <?php _e('File name', 'nggallery') ;?></label><br />
|
262 |
+
<label><input name="galSort" type="radio" value="alttext" <?php checked('alttext', $ngg_options[galSort]); ?> /> <?php _e('Alt / Title text', 'nggallery') ;?></label></td>
|
263 |
+
</tr>
|
264 |
+
</table>
|
265 |
+
<div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?> »"/></div>
|
266 |
+
</fieldset>
|
267 |
+
</form>
|
268 |
+
</div>
|
269 |
+
|
270 |
+
<!-- Effects settings -->
|
271 |
+
|
272 |
+
<div id="effects" style="display:none">
|
273 |
+
<h2><?php _e('Effects','nggallery'); ?></h2>
|
274 |
+
<form name="effectsform" method="POST" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']).'#effects-slider'; ?>" >
|
275 |
+
<input type="hidden" name="page_options" value="thumbEffect,thumbCode" />
|
276 |
+
<p><?php _e('Here you can select the thumbnail effect, NextGEN Gallery will integrate the required HTML code in the images. Please note that only the Thickbox effect will automatic added to your theme.','nggallery'); ?>
|
277 |
+
<?php _e('With the placeholder','nggallery'); ?><strong> %GALLERY_NAME% </strong> <?php _e('you can activate a navigation through the images (depend on the effect). Change the code line only , when you use a different thumbnail effect or you know what you do.','nggallery'); ?></p>
|
278 |
+
<fieldset class="options">
|
279 |
+
<table class="optiontable">
|
280 |
+
<tr valign="top">
|
281 |
+
<th><?php _e('JavaScript Thumbnail effect','nggallery') ?>:</th>
|
282 |
+
<td>
|
283 |
+
<select size="1" id="thumbEffect" name="thumbEffect" onchange="insertcode(this.value)">
|
284 |
+
<option value="none" <?php selected('none', $ngg_options[thumbEffect]); ?> ><?php _e('None', 'nggallery') ;?></option>
|
285 |
+
<option value="thickbox" <?php selected('thickbox', $ngg_options[thumbEffect]); ?> ><?php _e('Thickbox', 'nggallery') ;?></option>
|
286 |
+
<option value="lightbox" <?php selected('lightbox', $ngg_options[thumbEffect]); ?> ><?php _e('Lightbox', 'nggallery') ;?></option>
|
287 |
+
<option value="highslide" <?php selected('highslide', $ngg_options[thumbEffect]); ?> ><?php _e('Highslide', 'nggallery') ;?></option>
|
288 |
+
<option value="custom" <?php selected('custom', $ngg_options[thumbEffect]); ?> ><?php _e('Custom', 'nggallery') ;?></option>
|
289 |
+
</select>
|
290 |
+
</tr>
|
291 |
+
<tr valign="top">
|
292 |
+
<th><?php _e('Link Code line','nggallery') ?> :</th>
|
293 |
+
<td><textarea id="thumbCode" name="thumbCode" cols="50" rows="5"><?php echo htmlspecialchars(stripslashes($ngg_options[thumbCode])); ?></textarea></td>
|
294 |
+
</tr>
|
295 |
+
</table>
|
296 |
+
<div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?> »"/></div>
|
297 |
+
</fieldset>
|
298 |
+
</form>
|
299 |
+
</div>
|
300 |
+
|
301 |
+
<!-- Watermark settings -->
|
302 |
+
|
303 |
+
<?php
|
304 |
+
$imageID = $wpdb->get_var("SELECT MIN(pid) FROM $wpdb->nggpictures");
|
305 |
+
$imageID = $wpdb->get_row("SELECT * FROM $wpdb->nggpictures WHERE pid = '$imageID'");
|
306 |
+
if ($imageID) $imageURL = '<img width="75%" src="'.NGGALLERY_URLPATH.'nggshow.php?pid='.$imageID->pid.'&mode=watermark&width=320&height=240" alt="'.$imageID->alttext.'" title="'.$imageID->alttext.'" />';
|
307 |
+
|
308 |
+
?>
|
309 |
+
<div id="watermark" style="display:none">
|
310 |
+
<h2><?php _e('Watermark','nggallery'); ?></h2>
|
311 |
+
<form name="watermarkform" method="POST" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']).'#watermark-slider'; ?>" >
|
312 |
+
<input type="hidden" name="page_options" value="wmPos,wmXpos,wmYpos,wmType,wmPath,wmFont,wmSize,wmColor,wmText,wmOpaque" />
|
313 |
+
<div id="zeitgeist">
|
314 |
+
<h3><?php _e('Preview','nggallery') ?></h3>
|
315 |
+
<p><center><?php echo $imageURL; ?></center></p>
|
316 |
+
<h3><?php _e('Position','nggallery') ?></h3>
|
317 |
+
<table width="80%" border="0">
|
318 |
+
<tr>
|
319 |
+
<td valign="top">
|
320 |
+
<strong><?php _e('Position','nggallery') ?></strong><br />
|
321 |
+
<table border="1">
|
322 |
+
<tr>
|
323 |
+
<td><input type="radio" name="wmPos" value="topLeft" <?php checked('topLeft', $ngg_options[wmPos]); ?> /></td>
|
324 |
+
<td><input type="radio" name="wmPos" value="topCenter" <?php checked('topCenter', $ngg_options[wmPos]); ?> /></td>
|
325 |
+
<td><input type="radio" name="wmPos" value="topRight" <?php checked('topRight', $ngg_options[wmPos]); ?> /></td>
|
326 |
+
</tr>
|
327 |
+
<tr>
|
328 |
+
<td><input type="radio" name="wmPos" value="midLeft" <?php checked('midLeft', $ngg_options[wmPos]); ?> /></td>
|
329 |
+
<td><input type="radio" name="wmPos" value="midCenter" <?php checked('midCenter', $ngg_options[wmPos]); ?> /></td>
|
330 |
+
<td><input type="radio" name="wmPos" value="midRight" <?php checked('midRight', $ngg_options[wmPos]); ?> /></td>
|
331 |
+
</tr>
|
332 |
+
<tr>
|
333 |
+
<td><input type="radio" name="wmPos" value="botLeft" <?php checked('botLeft', $ngg_options[wmPos]); ?> /></td>
|
334 |
+
<td><input type="radio" name="wmPos" value="botCenter" <?php checked('botCenter', $ngg_options[wmPos]); ?> /></td>
|
335 |
+
<td><input type="radio" name="wmPos" value="botRight" <?php checked('botRight', $ngg_options[wmPos]); ?> /></td>
|
336 |
+
</tr>
|
337 |
+
</table>
|
338 |
+
</td>
|
339 |
+
<td valign="top">
|
340 |
+
<strong><?php _e('Offset','nggallery') ?></strong><br />
|
341 |
+
<table border="0">
|
342 |
+
<tr>
|
343 |
+
<td>x</td>
|
344 |
+
<td><input type="text" name="wmXpos" value="<?php echo $ngg_options[wmXpos] ?>" size="4" /> px</td>
|
345 |
+
</tr>
|
346 |
+
<tr>
|
347 |
+
<td>y</td>
|
348 |
+
<td><input type="text" name="wmYpos" value="<?php echo $ngg_options[wmYpos] ?>" size="4" /> px</td>
|
349 |
+
</tr>
|
350 |
+
</table>
|
351 |
+
</td>
|
352 |
+
</tr>
|
353 |
+
</table>
|
354 |
+
</div>
|
355 |
+
<fieldset class="options">
|
356 |
+
<table class="optiontable" border="0">
|
357 |
+
<tr>
|
358 |
+
<td align="left" colspan="2"><label><input type="radio" name="wmType" value="image" <?php checked('image', $ngg_options[wmType]); ?> /> <?php _e('Use image as watermark','nggallery') ?></label></td>
|
359 |
+
</tr>
|
360 |
+
<tr>
|
361 |
+
<th><?php _e('URL to file','nggallery') ?> :</th>
|
362 |
+
<td><input type="text" size="40" name="wmPath" value="<?php echo $ngg_options[wmPath]; ?>" /></td>
|
363 |
+
</tr>
|
364 |
+
<tr>
|
365 |
+
<td colspan="2"><hr /></td>
|
366 |
+
</tr>
|
367 |
+
<tr>
|
368 |
+
<td align="left" colspan="2"><label><input type="radio" name="wmType" value="text" <?php checked('text', $ngg_options[wmType]); ?> /> <?php _e('Use text as watermark','nggallery') ?></label></td>
|
369 |
+
</tr>
|
370 |
+
<tr>
|
371 |
+
<th><?php _e('Font','nggallery') ?>:</th>
|
372 |
+
<td><select name="wmFont" size="1"> <?php
|
373 |
+
$fontlist = ngg_get_TTFfont();
|
374 |
+
foreach ( $fontlist as $fontfile ) {
|
375 |
+
echo "\n".'<option value="'.$fontfile.'" '.ngg_input_selected($fontfile, $ngg_options[wmFont]).' >'.$fontfile.'</option>';
|
376 |
+
}
|
377 |
+
?>
|
378 |
+
</select><br />
|
379 |
+
<?php _e('You can upload more fonts in the folder <strong>nggallery/fonts</strong>','nggallery') ?>
|
380 |
+
</td>
|
381 |
+
</tr>
|
382 |
+
<tr>
|
383 |
+
<th><?php _e('Size','nggallery') ?>:</th>
|
384 |
+
<td><input type="text" name="wmSize" value="<?php echo $ngg_options[wmSize] ?>" size="4" maxlength="2" /> px</td>
|
385 |
+
</tr>
|
386 |
+
<tr>
|
387 |
+
<th><?php _e('Color','nggallery') ?>:</th>
|
388 |
+
<td><input type="text" size="6" maxlength="6" id="wmColor" name="wmColor" onchange="setcolor('#previewText', this.value)" value="<?php echo $ngg_options[wmColor] ?>" />
|
389 |
+
<input type="text" size="1" readonly="readonly" id="previewText" style="background-color: #<?php echo $ngg_options[wmColor] ?>" /> <?php _e('(hex w/o #)','nggallery') ?></td>
|
390 |
+
</tr>
|
391 |
+
<tr>
|
392 |
+
<th valign="top"><?php _e('Text','nggallery') ?>:</th>
|
393 |
+
<td><textarea name="wmText" cols="40" rows="4"><?php echo $ngg_options[wmText] ?></textarea></td>
|
394 |
+
</tr>
|
395 |
+
<tr>
|
396 |
+
<th><?php _e('Opaque','nggallery') ?>:</th>
|
397 |
+
<td><input type="text" name="wmOpaque" value="<?php echo $ngg_options[wmOpaque] ?>" size="3" maxlength="3" /> % </td>
|
398 |
+
</tr>
|
399 |
+
</table>
|
400 |
+
</fieldset>
|
401 |
+
<div class="clear"> </div>
|
402 |
+
<div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?> »"/></div>
|
403 |
+
</form>
|
404 |
+
<center>Based on Marekki's Watermark plugin</center>
|
405 |
+
</div>
|
406 |
+
|
407 |
+
<!-- Slideshow settings -->
|
408 |
+
|
409 |
+
<div id="slideshow" style="display:none">
|
410 |
+
<form name="player_options" method="POST" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']).'#slideshow-slider'; ?>" >
|
411 |
+
<input type="hidden" name="page_options" value="irWidth,irHeight,irShuffle,irLinkfromdisplay,irShownavigation,irShowicons,irOverstretch,irRotatetime,irTransition,irBackcolor,irFrontcolor,irLightcolor" />
|
412 |
+
<h2><?php _e('Slideshow','nggallery'); ?></h2>
|
413 |
+
<fieldset class="options">
|
414 |
+
<?php if (!NGGALLERY_IREXIST) { ?><p><div id="message" class="error fade"><p><?php _e('The imagerotator.swf is not in the nggallery folder, the slideshow will not work.','nggallery') ?></p></div></p><?php }?>
|
415 |
+
<p><?php _e('The settings are used in the Flash Image Rotator Version 3.2 .', 'nggallery') ?>
|
416 |
+
<?php _e('See more information for the Flash Player on the web page', 'nggallery') ?> <a href="http://www.jeroenwijering.com/?item=Flash_Image_Rotator" target="_blank">Flash Image Rotator from Jeroen Wijering</a>.<br />
|
417 |
+
<table class="optiontable" border="0" >
|
418 |
+
<tr>
|
419 |
+
<th><?php _e('Default size (W x H)','nggallery') ?>:</th>
|
420 |
+
<td><input type="text" size="3" maxlength="4" name="irWidth" value="<?php echo $ngg_options[irWidth] ?>" /> x
|
421 |
+
<input type="text" size="3" maxlength="4" name="irHeight" value="<?php echo $ngg_options[irHeight] ?>" /></td>
|
422 |
+
</tr>
|
423 |
+
<tr>
|
424 |
+
<th><?php _e('Shuffle mode','nggallery') ?>:</th>
|
425 |
+
<td><input name="irShuffle" type="checkbox" value="1" <?php checked('1', $ngg_options[irShuffle]); ?> /></td>
|
426 |
+
</tr>
|
427 |
+
<tr>
|
428 |
+
<th><?php _e('Show next image on click','nggallery') ?>:</th>
|
429 |
+
<td><input name="irLinkfromdisplay" type="checkbox" value="1" <?php checked('1', $ngg_options[irLinkfromdisplay]); ?> /></td>
|
430 |
+
</tr>
|
431 |
+
<tr>
|
432 |
+
<th><?php _e('Show navigation bar','nggallery') ?>:</th>
|
433 |
+
<td><input name="irShownavigation" type="checkbox" value="1" <?php checked('1', $ngg_options[irShownavigation]); ?> /></td>
|
434 |
+
</tr>
|
435 |
+
<tr>
|
436 |
+
<th><?php _e('Show loading icon','nggallery') ?>:</th>
|
437 |
+
<td><input name="irShowicons" type="checkbox" value="1" <?php checked('1', $ngg_options[irShowicons]); ?> /></td>
|
438 |
+
</tr>
|
439 |
+
<tr>
|
440 |
+
<th><?php _e('Stretch image','nggallery') ?>:</th>
|
441 |
+
<td>
|
442 |
+
<select size="1" name="irOverstretch">
|
443 |
+
<option value="true" <?php selected('true', $ngg_options[irOverstretch]); ?> ><?php _e('true', 'nggallery') ;?></option>
|
444 |
+
<option value="false" <?php selected('false', $ngg_options[irOverstretch]); ?> ><?php _e('false', 'nggallery') ;?></option>
|
445 |
+
<option value="fit" <?php selected('fit', $ngg_options[irOverstretch]); ?> ><?php _e('fit', 'nggallery') ;?></option>
|
446 |
+
<option value="none" <?php selected('none', $ngg_options[irOverstretch]); ?> ><?php _e('none', 'nggallery') ;?></option>
|
447 |
+
</select>
|
448 |
+
</td>
|
449 |
+
</tr>
|
450 |
+
<tr>
|
451 |
+
<th><?php _e('Duration time','nggallery') ?>:</th>
|
452 |
+
<td><input type="text" size="3" maxlength="3" name="irRotatetime" value="<?php echo $ngg_options[irRotatetime] ?>" /> <?php _e('sec.', 'nggallery') ;?></td>
|
453 |
+
</tr>
|
454 |
+
<tr>
|
455 |
+
<th><?php _e('Transition / Fade effect','nggallery') ?>:</th>
|
456 |
+
<td>
|
457 |
+
<select size="1" name="irTransition">
|
458 |
+
<option value="fade" <?php selected('fade', $ngg_options[irTransition]); ?> ><?php _e('fade', 'nggallery') ;?></option>
|
459 |
+
<option value="bgfade" <?php selected('bgfade', $ngg_options[irTransition]); ?> ><?php _e('bgfade', 'nggallery') ;?></option>
|
460 |
+
<option value="circles" <?php selected('circles', $ngg_options[irTransition]); ?> ><?php _e('circles', 'nggallery') ;?></option>
|
461 |
+
<option value="blocks" <?php selected('blocks', $ngg_options[irTransition]); ?> ><?php _e('blocks', 'nggallery') ;?></option>
|
462 |
+
<option value="fluids" <?php selected('fluids', $ngg_options[irTransition]); ?> ><?php _e('fluids', 'nggallery') ;?></option>
|
463 |
+
<option value="lines" <?php selected('lines', $ngg_options[irTransition]); ?> ><?php _e('lines', 'nggallery') ;?></option>
|
464 |
+
<option value="random" <?php selected('random', $ngg_options[irTransition]); ?> ><?php _e('random', 'nggallery') ;?></option>
|
465 |
+
</select>
|
466 |
+
</tr>
|
467 |
+
<tr>
|
468 |
+
<th><?php _e('Background Color','nggallery') ?>:</th>
|
469 |
+
<td><input type="text" size="6" maxlength="6" id="irBackcolor" name="irBackcolor" onchange="setcolor('#previewBack', this.value)" value="<?php echo $ngg_options[irBackcolor] ?>" />
|
470 |
+
<input type="text" size="1" readonly="readonly" id="previewBack" style="background-color: #<?php echo $ngg_options[irBackcolor] ?>" /></td>
|
471 |
+
</tr>
|
472 |
+
<tr>
|
473 |
+
<th><?php _e('Texts / Buttons Color','nggallery') ?>:</th>
|
474 |
+
<td><input type="text" size="6" maxlength="6" id="irFrontcolor" name="irFrontcolor" onchange="setcolor('#previewFront', this.value)" value="<?php echo $ngg_options[irFrontcolor] ?>" />
|
475 |
+
<input type="text" size="1" readonly="readonly" id="previewFront" style="background-color: #<?php echo $ngg_options[irFrontcolor] ?>" /></td>
|
476 |
+
</tr>
|
477 |
+
<tr>
|
478 |
+
<th><?php _e('Rollover / Active Color','nggallery') ?>:</th>
|
479 |
+
<td><input type="text" size="6" maxlength="6" id="irLightcolor" name="irLightcolor" onchange="setcolor('#previewLight', this.value)" value="<?php echo $ngg_options[irLightcolor] ?>" />
|
480 |
+
<input type="text" size="1" readonly="readonly" id="previewLight" style="background-color: #<?php echo $ngg_options[irLightcolor] ?>" /></td>
|
481 |
+
</tr>
|
482 |
+
</table>
|
483 |
+
<div class="clear"> </div>
|
484 |
+
<div class="submit"><input type="submit" name="updateoption" value="<?php _e('Update') ;?> »"/></div>
|
485 |
+
</fieldset>
|
486 |
+
</form>
|
487 |
+
</div>
|
488 |
+
</div>
|
489 |
+
</div>
|
490 |
+
|
491 |
+
<?php
|
492 |
+
}
|
493 |
+
|
494 |
+
function ngg_get_TTFfont() {
|
495 |
+
|
496 |
+
$ttf_fonts = array ();
|
497 |
+
|
498 |
+
// Files in wp-content/plugins/nggallery/fonts directory
|
499 |
+
$plugin_root = NGGALLERY_ABSPATH."fonts";
|
500 |
+
|
501 |
+
$plugins_dir = @ dir($plugin_root);
|
502 |
+
if ($plugins_dir) {
|
503 |
+
while (($file = $plugins_dir->read()) !== false) {
|
504 |
+
if (preg_match('|^\.+$|', $file))
|
505 |
+
continue;
|
506 |
+
if (is_dir($plugin_root.'/'.$file)) {
|
507 |
+
$plugins_subdir = @ dir($plugin_root.'/'.$file);
|
508 |
+
if ($plugins_subdir) {
|
509 |
+
while (($subfile = $plugins_subdir->read()) !== false) {
|
510 |
+
if (preg_match('|^\.+$|', $subfile))
|
511 |
+
continue;
|
512 |
+
if (preg_match('|\.ttf$|', $subfile))
|
513 |
+
$ttf_fonts[] = "$file/$subfile";
|
514 |
+
}
|
515 |
+
}
|
516 |
+
} else {
|
517 |
+
if (preg_match('|\.ttf$|', $file))
|
518 |
+
$ttf_fonts[] = $file;
|
519 |
+
}
|
520 |
+
}
|
521 |
+
}
|
522 |
+
|
523 |
+
return $ttf_fonts;
|
524 |
+
}
|
525 |
+
|
526 |
+
/**********************************************************/
|
527 |
+
// taken from WP Core
|
528 |
+
|
529 |
+
function ngg_input_selected( $selected, $current) {
|
530 |
+
if ( $selected == $current)
|
531 |
+
return ' selected="selected"';
|
532 |
+
}
|
533 |
+
|
534 |
+
function ngg_input_checked( $checked, $current) {
|
535 |
+
if ( $checked == $current)
|
536 |
+
return ' checked="checked"';
|
537 |
+
}
|
538 |
+
?>
|
admin/setup.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
3 |
+
|
4 |
+
function nggallery_admin_setup() {
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
if (isset($_POST['resetdefault'])) {
|
8 |
+
ngg_default_options();
|
9 |
+
|
10 |
+
$messagetext = '<font color="green">'.__('Reset all settings to default parameter','nggallery').'</font>';
|
11 |
+
}
|
12 |
+
|
13 |
+
if (isset($_POST['uninstall'])) {
|
14 |
+
|
15 |
+
$wpdb->query("DROP TABLE $wpdb->nggpictures");
|
16 |
+
$wpdb->query("DROP TABLE $wpdb->nggallery");
|
17 |
+
$wpdb->query("DROP TABLE $wpdb->nggalbum");
|
18 |
+
|
19 |
+
delete_option( "ngg_options" );
|
20 |
+
delete_option( "ngg_db_version");
|
21 |
+
|
22 |
+
$messagetext = '<font color="green">'.__('Uninstall sucessfull ! Now delete the plugin and enjoy your life ! Good luck !','nggallery').'</font>';
|
23 |
+
}
|
24 |
+
|
25 |
+
// message windows
|
26 |
+
if(!empty($messagetext)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; }
|
27 |
+
|
28 |
+
?>
|
29 |
+
|
30 |
+
<div class="wrap">
|
31 |
+
<h2><?php _e('Reset options', 'nggallery') ;?></h2>
|
32 |
+
<form name="resetsettings" method="post">
|
33 |
+
<p><?php _e('Reset all options/settings to the default installation.', 'nggallery') ;?></p>
|
34 |
+
<div align="center"><input type="submit" class="button" name="resetdefault" value="<?php _e('Reset settings') ;?>" onclick="javascript:check=confirm('<?php _e('Reset all options to default settings ?\n\nChoose [Cancel] to Stop, [OK] to proceed.\n','nggallery'); ?>');if(check==false) return false;" /></div>
|
35 |
+
</form>
|
36 |
+
</div>
|
37 |
+
<div class="wrap">
|
38 |
+
<h2><?php _e('Uninstall plugin tables', 'nggallery') ;?></h2>
|
39 |
+
<form name="resetsettings" method="post">
|
40 |
+
<p><?php _e('You don\'t like NextGEN Gallery ?', 'nggallery') ;?></p>
|
41 |
+
<p><?php _e('No problem, before you deactivate this plugin press the Uninstall Button, because deactivating NextGEN Gallery does not remove any data that may have been created. ', 'nggallery') ;?>
|
42 |
+
<p ><font color="red"><strong><?php _e('WARNING:', 'nggallery') ;?></strong><br />
|
43 |
+
<?php _e('Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to backup all the tables first. NextGEN gallery is stored in the tables', 'nggallery') ;?> <strong><?php echo $wpdb->nggpictures; ?></strong>, <strong><?php echo $wpdb->nggallery; ?></strong> <?php _e('and', 'nggallery') ;?> <strong><?php echo $wpdb->nggalbum; ?></strong>.</font></p>
|
44 |
+
<div align="center">
|
45 |
+
<input type="submit" name="uninstall" class="button delete" value="<?php _e('Uninstall plugin') ?>" onclick="javascript:check=confirm('<?php _e('You are about to Uninstall this plugin from WordPress.\nThis action is not reversible.\n\nChoose [Cancel] to Stop, [OK] to Uninstall.\n','nggallery'); ?>');if(check==false) return false;"/>
|
46 |
+
</div>
|
47 |
+
</form>
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<?php
|
51 |
+
}
|
52 |
+
|
53 |
+
?>
|
admin/style.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
3 |
+
|
4 |
+
function nggallery_admin_style() {
|
5 |
+
|
6 |
+
$ngg_options = get_option('ngg_options');
|
7 |
+
|
8 |
+
if (isset($_POST['css'])) {
|
9 |
+
$act_cssfile = $_POST['css'];
|
10 |
+
if (isset($_POST['activate'])) {
|
11 |
+
// save option now
|
12 |
+
$ngg_options[activateCSS] = $_POST['activateCSS'];
|
13 |
+
$ngg_options[CSSfile] = $act_cssfile;
|
14 |
+
update_option('ngg_options', $ngg_options);
|
15 |
+
$messagetext = '<font color="green">'.__('Update successfully','nggallery').'</font>';
|
16 |
+
}
|
17 |
+
} else {
|
18 |
+
// get the options
|
19 |
+
$act_cssfile = $ngg_options[CSSfile];
|
20 |
+
}
|
21 |
+
|
22 |
+
// set the path
|
23 |
+
$real_file = NGGALLERY_ABSPATH."css/".$act_cssfile;
|
24 |
+
|
25 |
+
if (isset($_POST['updatecss'])) {
|
26 |
+
|
27 |
+
if ( !current_user_can('edit_themes') )
|
28 |
+
wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
|
29 |
+
|
30 |
+
$newcontent = stripslashes($_POST['newcontent']);
|
31 |
+
if (is_writeable($real_file)) {
|
32 |
+
$f = fopen($real_file, 'w+');
|
33 |
+
fwrite($f, $newcontent);
|
34 |
+
|
35 |
+
fclose($f);
|
36 |
+
$messagetext = '<font color="green">'.__('CSS file successfully updated','nggallery').'</font>';
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
// get the content of the file
|
41 |
+
if (!is_file($real_file))
|
42 |
+
$error = 1;
|
43 |
+
|
44 |
+
if (!$error && filesize($real_file) > 0) {
|
45 |
+
$f = fopen($real_file, 'r');
|
46 |
+
$content = fread($f, filesize($real_file));
|
47 |
+
$content = htmlspecialchars($content);
|
48 |
+
}
|
49 |
+
|
50 |
+
// message window
|
51 |
+
if(!empty($messagetext)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$messagetext.'</p></div>'; }
|
52 |
+
|
53 |
+
?>
|
54 |
+
<div class="wrap">
|
55 |
+
<form name="cssfiles" method="post">
|
56 |
+
<input type="checkbox" name="activateCSS" value="1" <?php checked('1', $ngg_options[activateCSS]); ?> />
|
57 |
+
<?php _e('Activate and use style sheet:','nggallery') ?>
|
58 |
+
<select name="css" id="css" onchange="this.form.submit();">
|
59 |
+
<?php
|
60 |
+
$csslist = ngg_get_cssfiles();
|
61 |
+
foreach ($csslist as $key =>$a_cssfile) {
|
62 |
+
$css_name = $a_cssfile['Name'];
|
63 |
+
if ($key == $act_cssfile) {
|
64 |
+
$file_show = $key;
|
65 |
+
$selected = " selected='selected'";
|
66 |
+
$act_css_description = $a_cssfile['Description'];
|
67 |
+
$act_css_author = $a_cssfile['Author'];
|
68 |
+
$act_css_version = $a_cssfile['Version'];
|
69 |
+
}
|
70 |
+
else $selected = '';
|
71 |
+
$css_name = attribute_escape($css_name);
|
72 |
+
echo "\n\t<option value=\"$key\" $selected>$css_name</option>";
|
73 |
+
}
|
74 |
+
?>
|
75 |
+
</select>
|
76 |
+
<input type="submit" name="activate" value="<?php _e('Activate','nggallery') ?> »" class="button" />
|
77 |
+
</form>
|
78 |
+
</div>
|
79 |
+
|
80 |
+
<div class="wrap">
|
81 |
+
<?php
|
82 |
+
if ( is_writeable($real_file) ) {
|
83 |
+
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file_show) . '</h2>';
|
84 |
+
} else {
|
85 |
+
echo '<h2>' . sprintf(__('Browsing <strong>%s</strong>'), $file_show) . '</h2>';
|
86 |
+
}
|
87 |
+
?>
|
88 |
+
<div id="templateside">
|
89 |
+
<ul>
|
90 |
+
<li><strong><?php _e('Author','nggallery') ?> :</strong> <?php echo $act_css_author ?></li>
|
91 |
+
<li><strong><?php _e('Version','nggallery') ?> :</strong> <?php echo $act_css_version ?></li>
|
92 |
+
<li><strong><?php _e('Description','nggallery') ?> :<br /></strong> <?php echo $act_css_description ?></li>
|
93 |
+
</ul>
|
94 |
+
|
95 |
+
</div>
|
96 |
+
<?php
|
97 |
+
if (!$error) {
|
98 |
+
?>
|
99 |
+
<form name="template" id="template" method="post">
|
100 |
+
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
|
101 |
+
<input type="hidden" name="updatecss" value="updatecss" />
|
102 |
+
<input type="hidden" name="file" value="<?php echo $file_show ?>" />
|
103 |
+
</div>
|
104 |
+
<?php if ( is_writeable($real_file) ) : ?>
|
105 |
+
<p class="submit">
|
106 |
+
<?php
|
107 |
+
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
108 |
+
?>
|
109 |
+
</p>
|
110 |
+
<?php else : ?>
|
111 |
+
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
|
112 |
+
<?php endif; ?>
|
113 |
+
</form>
|
114 |
+
<?php
|
115 |
+
} else {
|
116 |
+
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
|
117 |
+
}
|
118 |
+
?>
|
119 |
+
<div class="clear"> </div>
|
120 |
+
</div>
|
121 |
+
|
122 |
+
<?php
|
123 |
+
}
|
124 |
+
|
125 |
+
/**********************************************************/
|
126 |
+
// ### Code from wordpress plugin import
|
127 |
+
// read in the css files
|
128 |
+
function ngg_get_cssfiles() {
|
129 |
+
global $cssfiles;
|
130 |
+
|
131 |
+
if (isset ($cssfiles)) {
|
132 |
+
return $cssfiles;
|
133 |
+
}
|
134 |
+
|
135 |
+
$cssfiles = array ();
|
136 |
+
|
137 |
+
// Files in wp-content/plugins/nggallery/css directory
|
138 |
+
$plugin_root = NGGALLERY_ABSPATH."css";
|
139 |
+
|
140 |
+
$plugins_dir = @ dir($plugin_root);
|
141 |
+
if ($plugins_dir) {
|
142 |
+
while (($file = $plugins_dir->read()) !== false) {
|
143 |
+
if (preg_match('|^\.+$|', $file))
|
144 |
+
continue;
|
145 |
+
if (is_dir($plugin_root.'/'.$file)) {
|
146 |
+
$plugins_subdir = @ dir($plugin_root.'/'.$file);
|
147 |
+
if ($plugins_subdir) {
|
148 |
+
while (($subfile = $plugins_subdir->read()) !== false) {
|
149 |
+
if (preg_match('|^\.+$|', $subfile))
|
150 |
+
continue;
|
151 |
+
if (preg_match('|\.css$|', $subfile))
|
152 |
+
$plugin_files[] = "$file/$subfile";
|
153 |
+
}
|
154 |
+
}
|
155 |
+
} else {
|
156 |
+
if (preg_match('|\.css$|', $file))
|
157 |
+
$plugin_files[] = $file;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
}
|
161 |
+
|
162 |
+
if ( !$plugins_dir || !$plugin_files )
|
163 |
+
return $cssfiles;
|
164 |
+
|
165 |
+
foreach ( $plugin_files as $plugin_file ) {
|
166 |
+
if ( !is_readable("$plugin_root/$plugin_file"))
|
167 |
+
continue;
|
168 |
+
|
169 |
+
$plugin_data = ngg_get_cssfiles_data("$plugin_root/$plugin_file");
|
170 |
+
|
171 |
+
if ( empty ($plugin_data['Name']) )
|
172 |
+
continue;
|
173 |
+
|
174 |
+
$cssfiles[plugin_basename($plugin_file)] = $plugin_data;
|
175 |
+
}
|
176 |
+
|
177 |
+
uasort($cssfiles, create_function('$a, $b', 'return strnatcasecmp($a["Name"], $b["Name"]);'));
|
178 |
+
|
179 |
+
return $cssfiles;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**********************************************************/
|
183 |
+
// parse the Header information
|
184 |
+
function ngg_get_cssfiles_data($plugin_file) {
|
185 |
+
$plugin_data = implode('', file($plugin_file));
|
186 |
+
preg_match("|CSS Name:(.*)|i", $plugin_data, $plugin_name);
|
187 |
+
preg_match("|Description:(.*)|i", $plugin_data, $description);
|
188 |
+
preg_match("|Author:(.*)|i", $plugin_data, $author_name);
|
189 |
+
if (preg_match("|Version:(.*)|i", $plugin_data, $version))
|
190 |
+
$version = trim($version[1]);
|
191 |
+
else
|
192 |
+
$version = '';
|
193 |
+
|
194 |
+
$description = wptexturize(trim($description[1]));
|
195 |
+
|
196 |
+
$name = trim($plugin_name[1]);
|
197 |
+
$author = trim($author_name[1]);
|
198 |
+
|
199 |
+
return array ('Name' => $name, 'Description' => $description, 'Author' => $author, 'Version' => $version );
|
200 |
+
}
|
201 |
+
|
202 |
+
?>
|
changelog.txt
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
NextGEN Gallery
|
2 |
+
by Alex Rabe
|
3 |
+
|
4 |
+
V0.37 - 28.04.2007
|
5 |
+
- Bugfix for $_GET in Manage gallery
|
6 |
+
- Bugfix in installation routine
|
7 |
+
|
8 |
+
V0.36 - 26.04.2007
|
9 |
+
- Stupid PHP beginner failure in album management
|
10 |
+
|
11 |
+
V0.35 - 26.04.2007
|
12 |
+
- Remove get_settings
|
13 |
+
- Folder name can be flexible
|
14 |
+
- Correction for Safe-Mode ON
|
15 |
+
- New option : Fullsize pic for Singlepic mode
|
16 |
+
- New option : Select show order
|
17 |
+
- Add Check for WP2.1
|
18 |
+
- Bugfix for sort order
|
19 |
+
- Check for permission for default folder
|
20 |
+
- Set Default '0' for table album.sortorder
|
21 |
+
|
22 |
+
V0.34 - 24.04.2007
|
23 |
+
- Bugfix for Album
|
24 |
+
- Add fix ration setting
|
25 |
+
- Change link in Album to get_bloginfo('wpurl')
|
26 |
+
- Add language file file
|
27 |
+
|
28 |
+
V0.33 - 23.04.2007
|
29 |
+
- Overview Page
|
30 |
+
- Core function
|
31 |
+
- Slideshow
|
32 |
+
|
33 |
+
|
css/Black_Minimalism .css
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
CSS Name: Black Minimalism Theme
|
3 |
+
Description: For Black Minimalism Theme
|
4 |
+
Author: Alex Rabe
|
5 |
+
Version: 1.00
|
6 |
+
|
7 |
+
This is a template stylesheet that can be used with NextGEN Gallery. I tested the
|
8 |
+
styles with a default theme Kubrick. Modify it when your theme struggle with it,
|
9 |
+
it's only a template design
|
10 |
+
|
11 |
+
*/
|
12 |
+
|
13 |
+
/* ----------- Album Styles Extend -------------*/
|
14 |
+
|
15 |
+
.ngg-albumoverview {
|
16 |
+
margin-top: 10px;
|
17 |
+
width: 100%;
|
18 |
+
clear:both;
|
19 |
+
display:block !important;
|
20 |
+
}
|
21 |
+
|
22 |
+
.ngg-album {
|
23 |
+
height: 130px;
|
24 |
+
padding: 5px;
|
25 |
+
margin-bottom: 5px;
|
26 |
+
border: 1px solid #cccccc;
|
27 |
+
}
|
28 |
+
|
29 |
+
.ngg-albumtitle {
|
30 |
+
text-align: left;
|
31 |
+
font-weight: bold;
|
32 |
+
margin:0px;
|
33 |
+
padding:0px;
|
34 |
+
font-size: 1.4em;
|
35 |
+
margin-bottom: 10px;
|
36 |
+
}
|
37 |
+
|
38 |
+
.ngg-thumbnail {
|
39 |
+
float: left;
|
40 |
+
margin-right: 12px;
|
41 |
+
}
|
42 |
+
|
43 |
+
.ngg-thumbnail img {
|
44 |
+
background-color:#FFFFFF;
|
45 |
+
border:1px solid #A9A9A9;
|
46 |
+
margin:4px 0px 4px 5px;
|
47 |
+
padding:4px;
|
48 |
+
position:relative;
|
49 |
+
width:100px;
|
50 |
+
height:75px;
|
51 |
+
}
|
52 |
+
|
53 |
+
.ngg-thumbnail img:hover {
|
54 |
+
background-color: #A9A9A9;
|
55 |
+
}
|
56 |
+
|
57 |
+
.ngg-description {
|
58 |
+
text-align: left;
|
59 |
+
}
|
60 |
+
|
61 |
+
/* ----------- Album Styles Compact -------------*/
|
62 |
+
|
63 |
+
.ngg-album-compact {
|
64 |
+
float:left;
|
65 |
+
height:180px;
|
66 |
+
padding-right:6px !important;
|
67 |
+
margin:0px !important;
|
68 |
+
text-align:left;
|
69 |
+
width:120px;
|
70 |
+
}
|
71 |
+
|
72 |
+
.ngg-album-compactbox {
|
73 |
+
background:transparent url(albumset.gif) no-repeat scroll 0%;
|
74 |
+
height:86px;
|
75 |
+
margin:0pt 0pt 6px !important;
|
76 |
+
padding:12px 0pt 0pt 7px !important;
|
77 |
+
width:120px;
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
.ngg-album-compactbox .Thumb {
|
82 |
+
border:1px solid #000000;
|
83 |
+
margin:0px !important;
|
84 |
+
padding:0px !important;
|
85 |
+
}
|
86 |
+
|
87 |
+
.ngg-album-compact h4 {
|
88 |
+
font-size:15px;
|
89 |
+
font-weight:bold;
|
90 |
+
margin-bottom:0px;
|
91 |
+
margin-top:0px;
|
92 |
+
width:110px;
|
93 |
+
}
|
94 |
+
|
95 |
+
.ngg-album-compact p {
|
96 |
+
font-size:11px;
|
97 |
+
margin-top:2px;
|
98 |
+
}
|
99 |
+
|
100 |
+
/* ----------- Gallery style -------------*/
|
101 |
+
|
102 |
+
.ngg-galleryoverview {
|
103 |
+
margin-top: 10px;
|
104 |
+
width: 100%;
|
105 |
+
clear:both;
|
106 |
+
display:block !important;
|
107 |
+
}
|
108 |
+
|
109 |
+
.ngg-gallery-thumbnail-box {
|
110 |
+
float: left;
|
111 |
+
width: 20%;
|
112 |
+
}
|
113 |
+
|
114 |
+
.ngg-gallery-thumbnail {
|
115 |
+
float: left;
|
116 |
+
background: url(shadowAlpha.png) no-repeat bottom right !important;
|
117 |
+
background: url(shadow.gif) no-repeat bottom right;
|
118 |
+
margin: 10px 0 0 10px !important;
|
119 |
+
}
|
120 |
+
|
121 |
+
.ngg-gallery-thumbnail img {
|
122 |
+
margin: -6px 6px 6px -6px;
|
123 |
+
background-color:#FFFFFF;
|
124 |
+
border:1px solid #A9A9A9;
|
125 |
+
display:block;
|
126 |
+
padding:4px;
|
127 |
+
position:relative;
|
128 |
+
}
|
129 |
+
|
130 |
+
.ngg-gallery-thumbnail img:hover {
|
131 |
+
background-color: #A9A9A9;
|
132 |
+
}
|
133 |
+
|
134 |
+
/* ----------- Gallery navigation -------------*/
|
135 |
+
|
136 |
+
.ngg-navigation {
|
137 |
+
font-size:0.9em !important;
|
138 |
+
clear:both !important;
|
139 |
+
display:block !important;
|
140 |
+
padding-top:15px;
|
141 |
+
text-align:center;
|
142 |
+
}
|
143 |
+
|
144 |
+
.ngg-navigation span {
|
145 |
+
font-weight:bold;
|
146 |
+
margin:0pt 6px;
|
147 |
+
}
|
148 |
+
|
149 |
+
.ngg-navigation a.page-numbers, a.next, a.prev {
|
150 |
+
border:1px solid #660000;
|
151 |
+
margin-right:3px;
|
152 |
+
padding:3px 7px;
|
153 |
+
}
|
154 |
+
|
155 |
+
.ngg-navigation a.page-numbers:hover, a.next:hover, a.prev:hover {
|
156 |
+
background-color: #660000;
|
157 |
+
color: #FFFFFF;
|
158 |
+
text-decoration: none;
|
159 |
+
}
|
160 |
+
|
161 |
+
/* ----------- Slideshow -------------*/
|
162 |
+
.slideshow {
|
163 |
+
margin-left: auto;
|
164 |
+
margin-right: auto;
|
165 |
+
text-align:center;
|
166 |
+
}
|
167 |
+
|
168 |
+
.slideshowlink {
|
169 |
+
|
170 |
+
}
|
css/albumset.gif
ADDED
Binary file
|
css/ngg_shadow.css
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
CSS Name: Shadow Effect
|
3 |
+
Description: NextGEN Default Style with a Shadow effect
|
4 |
+
Author: Alex Rabe
|
5 |
+
Version: 1.00
|
6 |
+
|
7 |
+
This is a template stylesheet that can be used with NextGEN Gallery. I tested the
|
8 |
+
styles with a default theme Kubrick. Modify it when your theme struggle with it,
|
9 |
+
it's only a template design
|
10 |
+
|
11 |
+
*/
|
12 |
+
|
13 |
+
/* ----------- Album Styles Extend -------------*/
|
14 |
+
|
15 |
+
.ngg-albumoverview {
|
16 |
+
margin-top: 10px;
|
17 |
+
width: 100%;
|
18 |
+
clear:both;
|
19 |
+
display:block !important;
|
20 |
+
}
|
21 |
+
|
22 |
+
.ngg-album {
|
23 |
+
height: 130px;
|
24 |
+
padding: 5px;
|
25 |
+
margin-bottom: 5px;
|
26 |
+
border: 1px solid #cccccc;
|
27 |
+
}
|
28 |
+
|
29 |
+
.ngg-albumtitle {
|
30 |
+
text-align: left;
|
31 |
+
font-weight: bold;
|
32 |
+
margin:0px;
|
33 |
+
padding:0px;
|
34 |
+
font-size: 1.4em;
|
35 |
+
margin-bottom: 10px;
|
36 |
+
}
|
37 |
+
|
38 |
+
.ngg-thumbnail {
|
39 |
+
float: left;
|
40 |
+
margin-right: 12px;
|
41 |
+
}
|
42 |
+
|
43 |
+
.ngg-thumbnail img {
|
44 |
+
background-color:#FFFFFF;
|
45 |
+
border:1px solid #A9A9A9;
|
46 |
+
margin:4px 0px 4px 5px;
|
47 |
+
padding:4px;
|
48 |
+
position:relative;
|
49 |
+
width:100px;
|
50 |
+
height:75px;
|
51 |
+
}
|
52 |
+
|
53 |
+
.ngg-thumbnail img:hover {
|
54 |
+
background-color: #A9A9A9;
|
55 |
+
}
|
56 |
+
|
57 |
+
.ngg-description {
|
58 |
+
text-align: left;
|
59 |
+
}
|
60 |
+
|
61 |
+
/* ----------- Album Styles Compact -------------*/
|
62 |
+
|
63 |
+
.ngg-album-compact {
|
64 |
+
float:left;
|
65 |
+
height:180px;
|
66 |
+
padding-right:6px !important;
|
67 |
+
margin:0px !important;
|
68 |
+
text-align:left;
|
69 |
+
width:120px;
|
70 |
+
}
|
71 |
+
|
72 |
+
.ngg-album-compactbox {
|
73 |
+
background:transparent url(albumset.gif) no-repeat scroll 0%;
|
74 |
+
height:86px;
|
75 |
+
margin:0pt 0pt 6px !important;
|
76 |
+
padding:12px 0pt 0pt 7px !important;
|
77 |
+
width:120px;
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
.ngg-album-compactbox .Thumb {
|
82 |
+
border:1px solid #000000;
|
83 |
+
margin:0px !important;
|
84 |
+
padding:0px !important;
|
85 |
+
}
|
86 |
+
|
87 |
+
.ngg-album-compact h4 {
|
88 |
+
font-size:15px;
|
89 |
+
font-weight:bold;
|
90 |
+
margin-bottom:0px;
|
91 |
+
margin-top:0px;
|
92 |
+
width:110px;
|
93 |
+
}
|
94 |
+
|
95 |
+
.ngg-album-compact p {
|
96 |
+
font-size:11px;
|
97 |
+
margin-top:2px;
|
98 |
+
}
|
99 |
+
|
100 |
+
/* ----------- Gallery style -------------*/
|
101 |
+
|
102 |
+
.ngg-galleryoverview {
|
103 |
+
margin-top: 10px;
|
104 |
+
width: 100%;
|
105 |
+
clear:both;
|
106 |
+
display:block !important;
|
107 |
+
}
|
108 |
+
|
109 |
+
.ngg-gallery-thumbnail-box {
|
110 |
+
float: left;
|
111 |
+
}
|
112 |
+
|
113 |
+
.ngg-gallery-thumbnail {
|
114 |
+
float: left;
|
115 |
+
background: url(shadowAlpha.png) no-repeat bottom right !important;
|
116 |
+
background: url(shadow.gif) no-repeat bottom right;
|
117 |
+
margin: 10px 0 0 10px !important;
|
118 |
+
}
|
119 |
+
|
120 |
+
.ngg-gallery-thumbnail img {
|
121 |
+
margin: -6px 6px 6px -6px;
|
122 |
+
background-color:#FFFFFF;
|
123 |
+
border:1px solid #A9A9A9;
|
124 |
+
display:block;
|
125 |
+
padding:4px;
|
126 |
+
position:relative;
|
127 |
+
}
|
128 |
+
|
129 |
+
.ngg-gallery-thumbnail img:hover {
|
130 |
+
background-color: #A9A9A9;
|
131 |
+
}
|
132 |
+
|
133 |
+
/* ----------- Gallery navigation -------------*/
|
134 |
+
|
135 |
+
.ngg-navigation {
|
136 |
+
font-size:0.9em !important;
|
137 |
+
clear:both !important;
|
138 |
+
display:block !important;
|
139 |
+
padding-top:15px;
|
140 |
+
text-align:center;
|
141 |
+
}
|
142 |
+
|
143 |
+
.ngg-navigation span {
|
144 |
+
font-weight:bold;
|
145 |
+
margin:0pt 6px;
|
146 |
+
}
|
147 |
+
|
148 |
+
.ngg-navigation a.page-numbers, a.next, a.prev {
|
149 |
+
border:1px solid #DDDDDD;
|
150 |
+
margin-right:3px;
|
151 |
+
padding:3px 7px;
|
152 |
+
}
|
153 |
+
|
154 |
+
.ngg-navigation a.page-numbers:hover, a.next:hover, a.prev:hover {
|
155 |
+
background-color: #0066CC;
|
156 |
+
color: #FFFFFF;
|
157 |
+
text-decoration: none;
|
158 |
+
}
|
159 |
+
|
160 |
+
/* ----------- Slideshow -------------*/
|
161 |
+
.slideshow {
|
162 |
+
margin-left: auto;
|
163 |
+
margin-right: auto;
|
164 |
+
text-align:center;
|
165 |
+
}
|
166 |
+
|
167 |
+
.slideshowlink {
|
168 |
+
|
169 |
+
}
|
css/nggallery.css
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
CSS Name: Default Style
|
3 |
+
Description: NextGEN Default Gallery Stylesheet
|
4 |
+
Author: Alex Rabe
|
5 |
+
Version: 1.000
|
6 |
+
|
7 |
+
This is a template stylesheet that can be used with NextGEN Gallery. I tested the
|
8 |
+
styles with a default theme Kubrick. Modify it when your theme struggle with it,
|
9 |
+
it's only a template design
|
10 |
+
|
11 |
+
*/
|
12 |
+
|
13 |
+
/* ----------- Album Styles Extend -------------*/
|
14 |
+
|
15 |
+
.ngg-albumoverview {
|
16 |
+
margin-top: 10px;
|
17 |
+
width: 100%;
|
18 |
+
clear:both;
|
19 |
+
display:block !important;
|
20 |
+
}
|
21 |
+
|
22 |
+
.ngg-album {
|
23 |
+
height: 130px;
|
24 |
+
padding: 5px;
|
25 |
+
margin-bottom: 5px;
|
26 |
+
border: 1px solid #cccccc;
|
27 |
+
}
|
28 |
+
|
29 |
+
.ngg-albumtitle {
|
30 |
+
text-align: left;
|
31 |
+
font-weight: bold;
|
32 |
+
margin:0px;
|
33 |
+
padding:0px;
|
34 |
+
font-size: 1.4em;
|
35 |
+
margin-bottom: 10px;
|
36 |
+
}
|
37 |
+
|
38 |
+
.ngg-thumbnail {
|
39 |
+
float: left;
|
40 |
+
margin-right: 12px;
|
41 |
+
}
|
42 |
+
|
43 |
+
.ngg-thumbnail img {
|
44 |
+
background-color:#FFFFFF;
|
45 |
+
border:1px solid #A9A9A9;
|
46 |
+
margin:4px 0px 4px 5px;
|
47 |
+
padding:4px;
|
48 |
+
position:relative;
|
49 |
+
width:100px;
|
50 |
+
height:75px;
|
51 |
+
}
|
52 |
+
|
53 |
+
.ngg-thumbnail img:hover {
|
54 |
+
background-color: #A9A9A9;
|
55 |
+
}
|
56 |
+
|
57 |
+
.ngg-description {
|
58 |
+
text-align: left;
|
59 |
+
}
|
60 |
+
|
61 |
+
/* ----------- Album Styles Compact -------------*/
|
62 |
+
|
63 |
+
.ngg-album-compact {
|
64 |
+
float:left;
|
65 |
+
height:180px;
|
66 |
+
padding-right:6px !important;
|
67 |
+
margin:0px !important;
|
68 |
+
text-align:left;
|
69 |
+
width:120px;
|
70 |
+
}
|
71 |
+
|
72 |
+
.ngg-album-compactbox {
|
73 |
+
background:transparent url(albumset.gif) no-repeat scroll 0%;
|
74 |
+
height:86px;
|
75 |
+
margin:0pt 0pt 6px !important;
|
76 |
+
padding:12px 0pt 0pt 7px !important;
|
77 |
+
width:120px;
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
.ngg-album-compactbox .Thumb {
|
82 |
+
border:1px solid #000000;
|
83 |
+
margin:0px !important;
|
84 |
+
padding:0px !important;
|
85 |
+
}
|
86 |
+
|
87 |
+
.ngg-album-compact h4 {
|
88 |
+
font-size:15px;
|
89 |
+
font-weight:bold;
|
90 |
+
margin-bottom:0px;
|
91 |
+
margin-top:0px;
|
92 |
+
width:110px;
|
93 |
+
}
|
94 |
+
|
95 |
+
.ngg-album-compact p {
|
96 |
+
font-size:11px;
|
97 |
+
margin-top:2px;
|
98 |
+
}
|
99 |
+
|
100 |
+
/* ----------- Gallery style -------------*/
|
101 |
+
|
102 |
+
.ngg-galleryoverview {
|
103 |
+
margin-top: 10px;
|
104 |
+
width: 100%;
|
105 |
+
clear:both;
|
106 |
+
display:block !important;
|
107 |
+
}
|
108 |
+
|
109 |
+
.ngg-gallery-thumbnail-box {
|
110 |
+
float: left;
|
111 |
+
}
|
112 |
+
|
113 |
+
.ngg-gallery-thumbnail {
|
114 |
+
float: left;
|
115 |
+
margin-right: 5px;
|
116 |
+
}
|
117 |
+
|
118 |
+
.ngg-gallery-thumbnail img {
|
119 |
+
background-color:#FFFFFF;
|
120 |
+
border:1px solid #A9A9A9;
|
121 |
+
display:block;
|
122 |
+
margin:4px 0px 4px 5px;
|
123 |
+
padding:4px;
|
124 |
+
position:relative;
|
125 |
+
}
|
126 |
+
|
127 |
+
.ngg-gallery-thumbnail img:hover {
|
128 |
+
background-color: #A9A9A9;
|
129 |
+
}
|
130 |
+
|
131 |
+
/* ----------- Gallery navigation -------------*/
|
132 |
+
|
133 |
+
.ngg-navigation {
|
134 |
+
font-size:0.9em !important;
|
135 |
+
clear:both !important;
|
136 |
+
display:block !important;
|
137 |
+
padding-top:15px;
|
138 |
+
text-align:center;
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
.ngg-navigation span {
|
143 |
+
font-weight:bold;
|
144 |
+
margin:0pt 6px;
|
145 |
+
}
|
146 |
+
|
147 |
+
.ngg-navigation a.page-numbers, a.next, a.prev {
|
148 |
+
border:1px solid #DDDDDD;
|
149 |
+
margin-right:3px;
|
150 |
+
padding:3px 7px;
|
151 |
+
}
|
152 |
+
|
153 |
+
.ngg-navigation a.page-numbers:hover, a.next:hover, a.prev:hover {
|
154 |
+
background-color: #0066CC;
|
155 |
+
color: #FFFFFF;
|
156 |
+
text-decoration: none;
|
157 |
+
}
|
158 |
+
|
159 |
+
/* ----------- Slideshow -------------*/
|
160 |
+
.slideshow {
|
161 |
+
margin-left: auto;
|
162 |
+
margin-right: auto;
|
163 |
+
text-align:center;
|
164 |
+
}
|
165 |
+
|
166 |
+
.slideshowlink {
|
167 |
+
|
168 |
+
}
|
css/shadow.gif
ADDED
Binary file
|
css/shadowAlpha.png
ADDED
Binary file
|
fonts/arial.ttf
ADDED
Binary file
|
js/swfobject.js
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
|
3 |
+
*
|
4 |
+
* SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
|
5 |
+
* http://www.opensource.org/licenses/mit-license.php
|
6 |
+
*
|
7 |
+
* **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
|
8 |
+
* legal reasons.
|
9 |
+
*/
|
10 |
+
if(typeof deconcept=="undefined"){var deconcept=new Object();}
|
11 |
+
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
|
12 |
+
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
|
13 |
+
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.getElementById){return;}
|
14 |
+
this.DETECT_KEY=_b?_b:"detectflash";
|
15 |
+
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
|
16 |
+
this.params=new Object();
|
17 |
+
this.variables=new Object();
|
18 |
+
this.attributes=new Array();
|
19 |
+
if(_1){this.setAttribute("swf",_1);}
|
20 |
+
if(id){this.setAttribute("id",id);}
|
21 |
+
if(w){this.setAttribute("width",w);}
|
22 |
+
if(h){this.setAttribute("height",h);}
|
23 |
+
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
|
24 |
+
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
|
25 |
+
if(c){this.addParam("bgcolor",c);}
|
26 |
+
var q=_8?_8:"high";
|
27 |
+
this.addParam("quality",q);
|
28 |
+
this.setAttribute("useExpressInstall",_7);
|
29 |
+
this.setAttribute("doExpressInstall",false);
|
30 |
+
var _d=(_9)?_9:window.location;
|
31 |
+
this.setAttribute("xiRedirectUrl",_d);
|
32 |
+
this.setAttribute("redirectUrl","");
|
33 |
+
if(_a){this.setAttribute("redirectUrl",_a);}};
|
34 |
+
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
|
35 |
+
this.attributes[_e]=_f;
|
36 |
+
},getAttribute:function(_10){
|
37 |
+
return this.attributes[_10];
|
38 |
+
},addParam:function(_11,_12){
|
39 |
+
this.params[_11]=_12;
|
40 |
+
},getParams:function(){
|
41 |
+
return this.params;
|
42 |
+
},addVariable:function(_13,_14){
|
43 |
+
this.variables[_13]=_14;
|
44 |
+
},getVariable:function(_15){
|
45 |
+
return this.variables[_15];
|
46 |
+
},getVariables:function(){
|
47 |
+
return this.variables;
|
48 |
+
},getVariablePairs:function(){
|
49 |
+
var _16=new Array();
|
50 |
+
var key;
|
51 |
+
var _18=this.getVariables();
|
52 |
+
for(key in _18){_16.push(key+"="+_18[key]);}
|
53 |
+
return _16;},getSWFHTML:function(){var _19="";
|
54 |
+
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
|
55 |
+
if(this.getAttribute("doExpressInstall")){
|
56 |
+
this.addVariable("MMplayerType","PlugIn");}
|
57 |
+
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
|
58 |
+
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
|
59 |
+
var _1a=this.getParams();
|
60 |
+
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
|
61 |
+
var _1c=this.getVariablePairs().join("&");
|
62 |
+
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
|
63 |
+
}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
|
64 |
+
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
|
65 |
+
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
|
66 |
+
var _1d=this.getParams();
|
67 |
+
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
|
68 |
+
var _1f=this.getVariablePairs().join("&");
|
69 |
+
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
|
70 |
+
return _19;
|
71 |
+
},write:function(_20){
|
72 |
+
if(this.getAttribute("useExpressInstall")){
|
73 |
+
var _21=new deconcept.PlayerVersion([6,0,65]);
|
74 |
+
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
|
75 |
+
this.setAttribute("doExpressInstall",true);
|
76 |
+
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
|
77 |
+
document.title=document.title.slice(0,47)+" - Flash Player Installation";
|
78 |
+
this.addVariable("MMdoctitle",document.title);}}
|
79 |
+
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
|
80 |
+
var n=(typeof _20=="string")?document.getElementById(_20):_20;
|
81 |
+
n.innerHTML=this.getSWFHTML();return true;
|
82 |
+
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
|
83 |
+
return false;}};
|
84 |
+
deconcept.SWFObjectUtil.getPlayerVersion=function(){
|
85 |
+
var _23=new deconcept.PlayerVersion([0,0,0]);
|
86 |
+
if(navigator.plugins&&navigator.mimeTypes.length){
|
87 |
+
var x=navigator.plugins["Shockwave Flash"];
|
88 |
+
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
|
89 |
+
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
|
90 |
+
catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
|
91 |
+
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
|
92 |
+
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
|
93 |
+
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
|
94 |
+
return _23;};
|
95 |
+
deconcept.PlayerVersion=function(_27){
|
96 |
+
this.major=_27[0]!=null?parseInt(_27[0]):0;
|
97 |
+
this.minor=_27[1]!=null?parseInt(_27[1]):0;
|
98 |
+
this.rev=_27[2]!=null?parseInt(_27[2]):0;
|
99 |
+
};
|
100 |
+
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
|
101 |
+
if(this.major<fv.major){return false;}
|
102 |
+
if(this.major>fv.major){return true;}
|
103 |
+
if(this.minor<fv.minor){return false;}
|
104 |
+
if(this.minor>fv.minor){return true;}
|
105 |
+
if(this.rev<fv.rev){
|
106 |
+
return false;
|
107 |
+
}return true;};
|
108 |
+
deconcept.util={getRequestParameter:function(_29){
|
109 |
+
var q=document.location.search||document.location.hash;
|
110 |
+
if(q){var _2b=q.substring(1).split("&");
|
111 |
+
for(var i=0;i<_2b.length;i++){
|
112 |
+
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
|
113 |
+
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
|
114 |
+
return "";}};
|
115 |
+
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
|
116 |
+
var _2d=document.getElementsByTagName("OBJECT");
|
117 |
+
for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
|
118 |
+
if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
|
119 |
+
deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
|
120 |
+
__flash_savedUnloadHandler=function(){};
|
121 |
+
if(typeof window.onunload=="function"){
|
122 |
+
var _30=window.onunload;
|
123 |
+
window.onunload=function(){
|
124 |
+
deconcept.SWFObjectUtil.cleanupSWFs();_30();};
|
125 |
+
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
|
126 |
+
if(typeof window.onbeforeunload=="function"){
|
127 |
+
var oldBeforeUnload=window.onbeforeunload;
|
128 |
+
window.onbeforeunload=function(){
|
129 |
+
deconcept.SWFObjectUtil.prepUnload();
|
130 |
+
oldBeforeUnload();};
|
131 |
+
}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
|
132 |
+
if(Array.prototype.push==null){
|
133 |
+
Array.prototype.push=function(_31){
|
134 |
+
this[this.length]=_31;
|
135 |
+
return this.length;};}
|
136 |
+
var getQueryParamValue=deconcept.util.getRequestParameter;
|
137 |
+
var FlashObject=deconcept.SWFObject;
|
138 |
+
var SWFObject=deconcept.SWFObject;
|
lang/nggallery.po
ADDED
@@ -0,0 +1,1242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: NextGEN Gallery\n"
|
4 |
+
"POT-Creation-Date: \n"
|
5 |
+
"PO-Revision-Date: 2007-04-26 21:07+0100\n"
|
6 |
+
"Last-Translator: Alex Rabe\n"
|
7 |
+
"Language-Team: Alex Rabe\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Poedit-KeywordsList: __;_e\n"
|
12 |
+
"X-Poedit-Basepath: .\n"
|
13 |
+
"X-Poedit-Country: GERMANY\n"
|
14 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
+
"X-Poedit-SearchPath-0: .\n"
|
16 |
+
"X-Poedit-SearchPath-1: ..\n"
|
17 |
+
|
18 |
+
#: ../nggallery.php:241
|
19 |
+
msgid "Sorry, NextGEN Gallery works only under WordPress 2.1 or higher"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: ../nggfunctions.php:267
|
23 |
+
#: ../nggfunctions.php:283
|
24 |
+
msgid "Watch gallery"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: ../nggfunctions.php:277
|
28 |
+
msgid "Photos"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: ../ngginstall.php:97
|
32 |
+
msgid "[Show as slideshow]"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: ../ngginstall.php:98
|
36 |
+
msgid "[Show picture list]"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: ../admin/about.php:9
|
40 |
+
msgid "Copyright notes / Credits"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: ../admin/about.php:11
|
44 |
+
msgid "About this plugin"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#: ../admin/about.php:12
|
48 |
+
msgid ""
|
49 |
+
"This plugin is written as last study on WordPress. I took the chance to learn PHP, WordPress and programming technics with this plugin.\n"
|
50 |
+
"\t\tIf you study the code of this plugin, you will find out that I mixed a lot of good already existing code and ideas together."
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: ../admin/about.php:14
|
54 |
+
msgid "So, I would like to thank the following people for their pioneer work (without this work it's impossible to create such a plugin so fast)"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: ../admin/about.php:16
|
58 |
+
msgid "for their great documented code"
|
59 |
+
msgstr ""
|
60 |
+
|
61 |
+
#: ../admin/about.php:17
|
62 |
+
msgid "for jQuery, which is the best Web2.0 framework"
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: ../admin/about.php:18
|
66 |
+
msgid "for the fantastic PHP Thumbnail Class"
|
67 |
+
msgstr ""
|
68 |
+
|
69 |
+
#: ../admin/about.php:19
|
70 |
+
msgid "for PclZip , a PHP library that manage ZIP archives"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
#: ../admin/about.php:20
|
74 |
+
msgid "for a lot of very useful plugins and ideas"
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: ../admin/about.php:21
|
78 |
+
msgid "for RS-Discuss, it saved me a lot of time"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: ../admin/about.php:22
|
82 |
+
msgid "for the best Media Flash Scripts on earth"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
#: ../admin/about.php:23
|
86 |
+
msgid "for the Watermark plugin"
|
87 |
+
msgstr ""
|
88 |
+
|
89 |
+
#: ../admin/about.php:24
|
90 |
+
msgid "for MyGallery, the best gallery plugin concept"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: ../admin/about.php:26
|
94 |
+
msgid "If you didn't find your name on this list and there is some code which I integrate in my plugin, don't hesitate to send me a mail."
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: ../admin/about.php:27
|
98 |
+
msgid "How to support ?"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: ../admin/about.php:28
|
102 |
+
msgid "There exist several ways to contribute, help or support me in this work. Non of them are mandatory."
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: ../admin/about.php:30
|
106 |
+
msgid "Send me bugfixes / code changes"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: ../admin/about.php:30
|
110 |
+
msgid "The most motivated support for this plugin are your ideas and brain work"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: ../admin/about.php:31
|
114 |
+
msgid "Translate my plugin"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: ../admin/about.php:31
|
118 |
+
msgid "To help people to work with this plugin, I would like to have it in all avaivable languages"
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: ../admin/about.php:32
|
122 |
+
msgid "Donate my work via paypal"
|
123 |
+
msgstr ""
|
124 |
+
|
125 |
+
#: ../admin/about.php:42
|
126 |
+
msgid "No doubt a very usefull and easy motivation :-) I send you an email , when I can buy my first Audi S3 with this money..."
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: ../admin/about.php:44
|
130 |
+
msgid "Place a link to my plugin in your blog/webpage"
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: ../admin/about.php:44
|
134 |
+
msgid "Yes, share and trackback is also a good support for this work "
|
135 |
+
msgstr ""
|
136 |
+
|
137 |
+
#: ../admin/about.php:46
|
138 |
+
msgid "Thanks!"
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: ../admin/about.php:47
|
142 |
+
msgid "I would like to thank this people which support me in my work :"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: ../admin/addgallery.php:23
|
146 |
+
#: ../admin/addgallery.php:36
|
147 |
+
msgid "Upload failed!"
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: ../admin/addgallery.php:103
|
151 |
+
#: ../admin/addgallery.php:115
|
152 |
+
msgid "Add new gallery"
|
153 |
+
msgstr ""
|
154 |
+
|
155 |
+
#: ../admin/addgallery.php:105
|
156 |
+
#: ../admin/addgallery.php:132
|
157 |
+
msgid "Upload a Zip-File"
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: ../admin/addgallery.php:107
|
161 |
+
#: ../admin/addgallery.php:148
|
162 |
+
msgid "Import image folder"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: ../admin/addgallery.php:108
|
166 |
+
#: ../admin/addgallery.php:165
|
167 |
+
msgid "Upload Images"
|
168 |
+
msgstr ""
|
169 |
+
|
170 |
+
#: ../admin/addgallery.php:120
|
171 |
+
msgid "New Gallery"
|
172 |
+
msgstr ""
|
173 |
+
|
174 |
+
#: ../admin/addgallery.php:122
|
175 |
+
msgid "Create a new , empty gallery below the folder"
|
176 |
+
msgstr ""
|
177 |
+
|
178 |
+
#: ../admin/addgallery.php:123
|
179 |
+
msgid "Allowed characters for file and folder names are"
|
180 |
+
msgstr ""
|
181 |
+
|
182 |
+
#: ../admin/addgallery.php:126
|
183 |
+
msgid "Add gallery"
|
184 |
+
msgstr ""
|
185 |
+
|
186 |
+
#: ../admin/addgallery.php:137
|
187 |
+
msgid "Select Zip-File"
|
188 |
+
msgstr ""
|
189 |
+
|
190 |
+
#: ../admin/addgallery.php:139
|
191 |
+
msgid "Upload a zip file with images"
|
192 |
+
msgstr ""
|
193 |
+
|
194 |
+
#: ../admin/addgallery.php:142
|
195 |
+
msgid "Start upload"
|
196 |
+
msgstr ""
|
197 |
+
|
198 |
+
#: ../admin/addgallery.php:153
|
199 |
+
msgid "Import from Server path:"
|
200 |
+
msgstr ""
|
201 |
+
|
202 |
+
#: ../admin/addgallery.php:155
|
203 |
+
msgid "Import a folder with images. Please note :"
|
204 |
+
msgstr ""
|
205 |
+
|
206 |
+
#: ../admin/addgallery.php:156
|
207 |
+
msgid "For save_mode = ON you need to add the subfolder thumbs manually"
|
208 |
+
msgstr ""
|
209 |
+
|
210 |
+
#: ../admin/addgallery.php:159
|
211 |
+
msgid "Import folder"
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
#: ../admin/addgallery.php:170
|
215 |
+
msgid "Upload image"
|
216 |
+
msgstr ""
|
217 |
+
|
218 |
+
#: ../admin/addgallery.php:174
|
219 |
+
msgid "in to"
|
220 |
+
msgstr ""
|
221 |
+
|
222 |
+
#: ../admin/addgallery.php:176
|
223 |
+
msgid "Choose gallery"
|
224 |
+
msgstr ""
|
225 |
+
|
226 |
+
#: ../admin/addgallery.php:186
|
227 |
+
msgid "At the moment only a single file upload is supported."
|
228 |
+
msgstr ""
|
229 |
+
|
230 |
+
#: ../admin/addgallery.php:189
|
231 |
+
msgid "Upload images"
|
232 |
+
msgstr ""
|
233 |
+
|
234 |
+
#: ../admin/addgallery.php:209
|
235 |
+
msgid "No valid gallery name!"
|
236 |
+
msgstr ""
|
237 |
+
|
238 |
+
#: ../admin/addgallery.php:211
|
239 |
+
#: ../admin/addgallery.php:216
|
240 |
+
#: ../admin/addgallery.php:251
|
241 |
+
#: ../admin/addgallery.php:255
|
242 |
+
msgid "Directory"
|
243 |
+
msgstr ""
|
244 |
+
|
245 |
+
#: ../admin/addgallery.php:211
|
246 |
+
msgid "didn't have the permissions 777!"
|
247 |
+
msgstr ""
|
248 |
+
|
249 |
+
#: ../admin/addgallery.php:216
|
250 |
+
msgid "already exists!"
|
251 |
+
msgstr ""
|
252 |
+
|
253 |
+
#: ../admin/addgallery.php:220
|
254 |
+
#: ../admin/addgallery.php:222
|
255 |
+
#: ../admin/addgallery.php:261
|
256 |
+
#: ../admin/addgallery.php:418
|
257 |
+
#: ../admin/addgallery.php:420
|
258 |
+
msgid "Unable to create directory "
|
259 |
+
msgstr ""
|
260 |
+
|
261 |
+
#: ../admin/addgallery.php:221
|
262 |
+
#: ../admin/addgallery.php:419
|
263 |
+
#: ../admin/addgallery.php:421
|
264 |
+
msgid "Unable to set directory permissions "
|
265 |
+
msgstr ""
|
266 |
+
|
267 |
+
#: ../admin/addgallery.php:223
|
268 |
+
msgid "Unable to set directory permissions"
|
269 |
+
msgstr ""
|
270 |
+
|
271 |
+
#: ../admin/addgallery.php:225
|
272 |
+
msgid "The server Safe-Mode is on !"
|
273 |
+
msgstr ""
|
274 |
+
|
275 |
+
#: ../admin/addgallery.php:226
|
276 |
+
msgid "Please create directory "
|
277 |
+
msgstr ""
|
278 |
+
|
279 |
+
#: ../admin/addgallery.php:227
|
280 |
+
msgid "and the thumbnails directory "
|
281 |
+
msgstr ""
|
282 |
+
|
283 |
+
#: ../admin/addgallery.php:227
|
284 |
+
msgid "with permission 777 manually !"
|
285 |
+
msgstr ""
|
286 |
+
|
287 |
+
#: ../admin/addgallery.php:231
|
288 |
+
#: ../admin/addgallery.php:282
|
289 |
+
#: ../admin/admin.php:13
|
290 |
+
#: ../admin/manage.php:44
|
291 |
+
#: ../admin/manage.php:298
|
292 |
+
#: ../admin/settings.php:119
|
293 |
+
msgid "Gallery"
|
294 |
+
msgstr ""
|
295 |
+
|
296 |
+
#: ../admin/addgallery.php:231
|
297 |
+
msgid "already exists"
|
298 |
+
msgstr ""
|
299 |
+
|
300 |
+
#: ../admin/addgallery.php:234
|
301 |
+
msgid "Gallery successfully created!"
|
302 |
+
msgstr ""
|
303 |
+
|
304 |
+
#: ../admin/addgallery.php:251
|
305 |
+
#: ../admin/addgallery.php:260
|
306 |
+
msgid "doesn`t exist"
|
307 |
+
msgstr ""
|
308 |
+
|
309 |
+
#: ../admin/addgallery.php:255
|
310 |
+
msgid "contains no pictures"
|
311 |
+
msgstr ""
|
312 |
+
|
313 |
+
#: ../admin/addgallery.php:260
|
314 |
+
msgid "Thumbnail Directory"
|
315 |
+
msgstr ""
|
316 |
+
|
317 |
+
#: ../admin/addgallery.php:260
|
318 |
+
msgid "Please create the folder <i>thumbs</i> in your gallery folder."
|
319 |
+
msgstr ""
|
320 |
+
|
321 |
+
#: ../admin/addgallery.php:268
|
322 |
+
msgid "Database error. Could not add gallery!"
|
323 |
+
msgstr ""
|
324 |
+
|
325 |
+
#: ../admin/addgallery.php:282
|
326 |
+
msgid "successfully created!"
|
327 |
+
msgstr ""
|
328 |
+
|
329 |
+
#: ../admin/addgallery.php:282
|
330 |
+
msgid " pictures added."
|
331 |
+
msgstr ""
|
332 |
+
|
333 |
+
#: ../admin/addgallery.php:409
|
334 |
+
msgid "Uploaded file was no or a faulty zip file ! The server recognize : "
|
335 |
+
msgstr ""
|
336 |
+
|
337 |
+
#: ../admin/addgallery.php:424
|
338 |
+
msgid "Directory already exists, please rename zip file"
|
339 |
+
msgstr ""
|
340 |
+
|
341 |
+
#: ../admin/addgallery.php:429
|
342 |
+
msgid "Unable to unlink zip file "
|
343 |
+
msgstr ""
|
344 |
+
|
345 |
+
#: ../admin/addgallery.php:431
|
346 |
+
msgid "Zip-File successfully unpacked"
|
347 |
+
msgstr ""
|
348 |
+
|
349 |
+
#: ../admin/addgallery.php:451
|
350 |
+
#: ../admin/addgallery.php:458
|
351 |
+
msgid "Unable to unlink file "
|
352 |
+
msgstr ""
|
353 |
+
|
354 |
+
#: ../admin/addgallery.php:452
|
355 |
+
msgid "No gallery selected !"
|
356 |
+
msgstr ""
|
357 |
+
|
358 |
+
#: ../admin/addgallery.php:459
|
359 |
+
msgid "Failure in database, no gallery path set !"
|
360 |
+
msgstr ""
|
361 |
+
|
362 |
+
#: ../admin/addgallery.php:465
|
363 |
+
msgid "Error, the file could not moved to : "
|
364 |
+
msgstr ""
|
365 |
+
|
366 |
+
#: ../admin/addgallery.php:466
|
367 |
+
msgid "Error, the file permissions could not set"
|
368 |
+
msgstr ""
|
369 |
+
|
370 |
+
#: ../admin/addgallery.php:483
|
371 |
+
msgid "Images successfully added"
|
372 |
+
msgstr ""
|
373 |
+
|
374 |
+
#: ../admin/admin.php:14
|
375 |
+
msgid "Add Gallery"
|
376 |
+
msgstr ""
|
377 |
+
|
378 |
+
#: ../admin/admin.php:15
|
379 |
+
msgid "Manage Gallery"
|
380 |
+
msgstr ""
|
381 |
+
|
382 |
+
#: ../admin/admin.php:16
|
383 |
+
msgid "Album"
|
384 |
+
msgstr ""
|
385 |
+
|
386 |
+
#: ../admin/admin.php:17
|
387 |
+
msgid "Options"
|
388 |
+
msgstr ""
|
389 |
+
|
390 |
+
#: ../admin/admin.php:18
|
391 |
+
msgid "Style"
|
392 |
+
msgstr ""
|
393 |
+
|
394 |
+
#: ../admin/admin.php:19
|
395 |
+
msgid "Setup Gallery"
|
396 |
+
msgstr ""
|
397 |
+
|
398 |
+
#: ../admin/admin.php:19
|
399 |
+
msgid "Setup"
|
400 |
+
msgstr ""
|
401 |
+
|
402 |
+
#: ../admin/admin.php:20
|
403 |
+
msgid "About this Gallery"
|
404 |
+
msgstr ""
|
405 |
+
|
406 |
+
#: ../admin/admin.php:20
|
407 |
+
msgid "About"
|
408 |
+
msgstr ""
|
409 |
+
|
410 |
+
#: ../admin/album.php:36
|
411 |
+
#: ../admin/album.php:37
|
412 |
+
msgid "Update Successfully"
|
413 |
+
msgstr ""
|
414 |
+
|
415 |
+
#: ../admin/album.php:43
|
416 |
+
msgid "Album deleted"
|
417 |
+
msgstr ""
|
418 |
+
|
419 |
+
#: ../admin/album.php:84
|
420 |
+
msgid "Manage Albums"
|
421 |
+
msgstr ""
|
422 |
+
|
423 |
+
#: ../admin/album.php:91
|
424 |
+
msgid "No album selected"
|
425 |
+
msgstr ""
|
426 |
+
|
427 |
+
#: ../admin/album.php:110
|
428 |
+
#: ../admin/manage.php:205
|
429 |
+
#: ../admin/manage.php:405
|
430 |
+
msgid "Delete"
|
431 |
+
msgstr ""
|
432 |
+
|
433 |
+
#: ../admin/album.php:110
|
434 |
+
msgid "Delete album ?"
|
435 |
+
msgstr ""
|
436 |
+
|
437 |
+
#: ../admin/album.php:112
|
438 |
+
#: ../admin/settings.php:153
|
439 |
+
#: ../admin/settings.php:191
|
440 |
+
#: ../admin/settings.php:228
|
441 |
+
#: ../admin/settings.php:265
|
442 |
+
#: ../admin/settings.php:296
|
443 |
+
#: ../admin/settings.php:402
|
444 |
+
#: ../admin/settings.php:484
|
445 |
+
msgid "Update"
|
446 |
+
msgstr ""
|
447 |
+
|
448 |
+
#: ../admin/album.php:117
|
449 |
+
msgid "Select Gallery"
|
450 |
+
msgstr ""
|
451 |
+
|
452 |
+
#: ../admin/album.php:150
|
453 |
+
msgid "Album Page ID"
|
454 |
+
msgstr ""
|
455 |
+
|
456 |
+
#: ../admin/album.php:159
|
457 |
+
msgid "No Album selected"
|
458 |
+
msgstr ""
|
459 |
+
|
460 |
+
#: ../admin/album.php:190
|
461 |
+
#: ../admin/manage.php:179
|
462 |
+
#: ../admin/manage.php:370
|
463 |
+
msgid "ID"
|
464 |
+
msgstr ""
|
465 |
+
|
466 |
+
#: ../admin/album.php:191
|
467 |
+
msgid "Name"
|
468 |
+
msgstr ""
|
469 |
+
|
470 |
+
#: ../admin/album.php:192
|
471 |
+
#: ../admin/manage.php:181
|
472 |
+
#: ../admin/manage.php:305
|
473 |
+
msgid "Title"
|
474 |
+
msgstr ""
|
475 |
+
|
476 |
+
#: ../admin/album.php:193
|
477 |
+
msgid "Page"
|
478 |
+
msgstr ""
|
479 |
+
|
480 |
+
#: ../admin/manage.php:44
|
481 |
+
#: ../admin/manage.php:63
|
482 |
+
msgid "deleted successfully"
|
483 |
+
msgstr ""
|
484 |
+
|
485 |
+
#: ../admin/manage.php:63
|
486 |
+
msgid "Picture"
|
487 |
+
msgstr ""
|
488 |
+
|
489 |
+
#: ../admin/manage.php:86
|
490 |
+
msgid "Watermark successfully added"
|
491 |
+
msgstr ""
|
492 |
+
|
493 |
+
#: ../admin/manage.php:91
|
494 |
+
msgid "Thumbnails successfully created. Please refresh your browser cache."
|
495 |
+
msgstr ""
|
496 |
+
|
497 |
+
#: ../admin/manage.php:96
|
498 |
+
msgid "Images successfully resized"
|
499 |
+
msgstr ""
|
500 |
+
|
501 |
+
#: ../admin/manage.php:114
|
502 |
+
msgid "Pictures deleted successfully "
|
503 |
+
msgstr ""
|
504 |
+
|
505 |
+
#: ../admin/manage.php:132
|
506 |
+
#: ../admin/settings.php:25
|
507 |
+
#: ../admin/style.php:15
|
508 |
+
msgid "Update successfully"
|
509 |
+
msgstr ""
|
510 |
+
|
511 |
+
#: ../admin/manage.php:153
|
512 |
+
msgid " picture(s) successfully added"
|
513 |
+
msgstr ""
|
514 |
+
|
515 |
+
#: ../admin/manage.php:175
|
516 |
+
msgid "Gallery Overview"
|
517 |
+
msgstr ""
|
518 |
+
|
519 |
+
#: ../admin/manage.php:180
|
520 |
+
msgid "Gallery name"
|
521 |
+
msgstr ""
|
522 |
+
|
523 |
+
#: ../admin/manage.php:182
|
524 |
+
#: ../admin/manage.php:324
|
525 |
+
#: ../admin/manage.php:373
|
526 |
+
#: ../admin/style.php:92
|
527 |
+
msgid "Description"
|
528 |
+
msgstr ""
|
529 |
+
|
530 |
+
#: ../admin/manage.php:183
|
531 |
+
msgid "Page ID"
|
532 |
+
msgstr ""
|
533 |
+
|
534 |
+
#: ../admin/manage.php:184
|
535 |
+
msgid "Quantity"
|
536 |
+
msgstr ""
|
537 |
+
|
538 |
+
#: ../admin/manage.php:185
|
539 |
+
#: ../admin/manage.php:376
|
540 |
+
msgid "Action"
|
541 |
+
msgstr ""
|
542 |
+
|
543 |
+
#: ../admin/manage.php:204
|
544 |
+
msgid "Edit"
|
545 |
+
msgstr ""
|
546 |
+
|
547 |
+
#: ../admin/manage.php:205
|
548 |
+
#: ../admin/manage.php:405
|
549 |
+
msgid "Delete this file ?"
|
550 |
+
msgstr ""
|
551 |
+
|
552 |
+
#: ../admin/manage.php:210
|
553 |
+
#: ../admin/manage.php:410
|
554 |
+
msgid "No entries found"
|
555 |
+
msgstr ""
|
556 |
+
|
557 |
+
#: ../admin/manage.php:307
|
558 |
+
msgid "Page Link to"
|
559 |
+
msgstr ""
|
560 |
+
|
561 |
+
#: ../admin/manage.php:310
|
562 |
+
msgid "Not linked"
|
563 |
+
msgstr ""
|
564 |
+
|
565 |
+
#: ../admin/manage.php:326
|
566 |
+
msgid "Preview image"
|
567 |
+
msgstr ""
|
568 |
+
|
569 |
+
#: ../admin/manage.php:329
|
570 |
+
msgid "No Picture"
|
571 |
+
msgstr ""
|
572 |
+
|
573 |
+
#: ../admin/manage.php:344
|
574 |
+
msgid "Path"
|
575 |
+
msgstr ""
|
576 |
+
|
577 |
+
#: ../admin/manage.php:352
|
578 |
+
msgid "Scan Folder for new images"
|
579 |
+
msgstr ""
|
580 |
+
|
581 |
+
#: ../admin/manage.php:353
|
582 |
+
#: ../admin/manage.php:417
|
583 |
+
msgid "Save Changes"
|
584 |
+
msgstr ""
|
585 |
+
|
586 |
+
#: ../admin/manage.php:358
|
587 |
+
msgid "No action"
|
588 |
+
msgstr ""
|
589 |
+
|
590 |
+
#: ../admin/manage.php:359
|
591 |
+
msgid "Set watermark"
|
592 |
+
msgstr ""
|
593 |
+
|
594 |
+
#: ../admin/manage.php:360
|
595 |
+
msgid "Create new thumbnails"
|
596 |
+
msgstr ""
|
597 |
+
|
598 |
+
#: ../admin/manage.php:361
|
599 |
+
msgid "Resize images"
|
600 |
+
msgstr ""
|
601 |
+
|
602 |
+
#: ../admin/manage.php:362
|
603 |
+
msgid "Delete images"
|
604 |
+
msgstr ""
|
605 |
+
|
606 |
+
#: ../admin/manage.php:364
|
607 |
+
msgid "OK"
|
608 |
+
msgstr ""
|
609 |
+
|
610 |
+
#: ../admin/manage.php:364
|
611 |
+
msgid "No images selected"
|
612 |
+
msgstr ""
|
613 |
+
|
614 |
+
#: ../admin/manage.php:364
|
615 |
+
#, php-format
|
616 |
+
msgid ""
|
617 |
+
"You are about to start the bulk edit for %s images \n"
|
618 |
+
" \n"
|
619 |
+
" 'Cancel' to stop, 'OK' to proceed."
|
620 |
+
msgstr ""
|
621 |
+
|
622 |
+
#: ../admin/manage.php:371
|
623 |
+
#: ../admin/settings.php:261
|
624 |
+
msgid "File name"
|
625 |
+
msgstr ""
|
626 |
+
|
627 |
+
#: ../admin/manage.php:372
|
628 |
+
msgid "Thumbnail"
|
629 |
+
msgstr ""
|
630 |
+
|
631 |
+
#: ../admin/manage.php:374
|
632 |
+
msgid "Alt & Title Text"
|
633 |
+
msgstr ""
|
634 |
+
|
635 |
+
#: ../admin/manage.php:375
|
636 |
+
msgid "exclude"
|
637 |
+
msgstr ""
|
638 |
+
|
639 |
+
#: ../admin/manage.php:404
|
640 |
+
msgid "View"
|
641 |
+
msgstr ""
|
642 |
+
|
643 |
+
#: ../admin/overview.php:12
|
644 |
+
msgid "NextGEN Gallery Overview"
|
645 |
+
msgstr ""
|
646 |
+
|
647 |
+
#: ../admin/overview.php:15
|
648 |
+
msgid "Summary"
|
649 |
+
msgstr ""
|
650 |
+
|
651 |
+
#: ../admin/overview.php:24
|
652 |
+
#, php-format
|
653 |
+
msgid "There are totally %1$s pictures in %2$s gallerys, which are spread across %3$s albums."
|
654 |
+
msgstr ""
|
655 |
+
|
656 |
+
#: ../admin/overview.php:28
|
657 |
+
msgid "New Version available"
|
658 |
+
msgstr ""
|
659 |
+
|
660 |
+
#: ../admin/overview.php:29
|
661 |
+
msgid "The server reports that a new NextGEN Gallery Version is now available. Please visit the plugin homepage for more information."
|
662 |
+
msgstr ""
|
663 |
+
|
664 |
+
#: ../admin/overview.php:31
|
665 |
+
msgid "Server Settings"
|
666 |
+
msgstr ""
|
667 |
+
|
668 |
+
#: ../admin/overview.php:38
|
669 |
+
msgid "Welcome"
|
670 |
+
msgstr ""
|
671 |
+
|
672 |
+
#: ../admin/overview.php:42
|
673 |
+
msgid "forum administrator"
|
674 |
+
msgstr ""
|
675 |
+
|
676 |
+
#: ../admin/overview.php:42
|
677 |
+
msgid "forum moderator"
|
678 |
+
msgstr ""
|
679 |
+
|
680 |
+
#: ../admin/overview.php:43
|
681 |
+
#, php-format
|
682 |
+
msgid "Welcome to NextGEN Gallery. Here you can control your images, galleries and albums. You currently have %s rights."
|
683 |
+
msgstr ""
|
684 |
+
|
685 |
+
#: ../admin/overview.php:48
|
686 |
+
msgid "Add a new gallery or import pictures"
|
687 |
+
msgstr ""
|
688 |
+
|
689 |
+
#: ../admin/overview.php:49
|
690 |
+
msgid "Manage galleries and images"
|
691 |
+
msgstr ""
|
692 |
+
|
693 |
+
#: ../admin/overview.php:50
|
694 |
+
msgid "Create and manage albums"
|
695 |
+
msgstr ""
|
696 |
+
|
697 |
+
#: ../admin/overview.php:51
|
698 |
+
msgid "Change the settings of NextGEN Gallery"
|
699 |
+
msgstr ""
|
700 |
+
|
701 |
+
#: ../admin/overview.php:54
|
702 |
+
msgid "Latest News"
|
703 |
+
msgstr ""
|
704 |
+
|
705 |
+
#: ../admin/overview.php:73
|
706 |
+
#, php-format
|
707 |
+
msgid "Newsfeed could not be loaded. Check the <a href=\"%s\">front page</a> to check for updates."
|
708 |
+
msgstr ""
|
709 |
+
|
710 |
+
#: ../admin/overview.php:86
|
711 |
+
msgid "GD support"
|
712 |
+
msgstr ""
|
713 |
+
|
714 |
+
#: ../admin/overview.php:97
|
715 |
+
msgid "No GD support"
|
716 |
+
msgstr ""
|
717 |
+
|
718 |
+
#: ../admin/overview.php:104
|
719 |
+
msgid "Yes"
|
720 |
+
msgstr ""
|
721 |
+
|
722 |
+
#: ../admin/overview.php:105
|
723 |
+
msgid "No"
|
724 |
+
msgstr ""
|
725 |
+
|
726 |
+
#: ../admin/overview.php:119
|
727 |
+
msgid "Not set"
|
728 |
+
msgstr ""
|
729 |
+
|
730 |
+
#: ../admin/overview.php:121
|
731 |
+
msgid "On"
|
732 |
+
msgstr ""
|
733 |
+
|
734 |
+
#: ../admin/overview.php:122
|
735 |
+
msgid "Off"
|
736 |
+
msgstr ""
|
737 |
+
|
738 |
+
#: ../admin/overview.php:125
|
739 |
+
#: ../admin/overview.php:128
|
740 |
+
#: ../admin/overview.php:131
|
741 |
+
#: ../admin/overview.php:134
|
742 |
+
msgid "N/A"
|
743 |
+
msgstr ""
|
744 |
+
|
745 |
+
#: ../admin/overview.php:136
|
746 |
+
msgid "Operating System"
|
747 |
+
msgstr ""
|
748 |
+
|
749 |
+
#: ../admin/overview.php:137
|
750 |
+
msgid "Server"
|
751 |
+
msgstr ""
|
752 |
+
|
753 |
+
#: ../admin/overview.php:138
|
754 |
+
msgid "MYSQL Version"
|
755 |
+
msgstr ""
|
756 |
+
|
757 |
+
#: ../admin/overview.php:139
|
758 |
+
msgid "SQL Mode"
|
759 |
+
msgstr ""
|
760 |
+
|
761 |
+
#: ../admin/overview.php:140
|
762 |
+
msgid "PHP Version"
|
763 |
+
msgstr ""
|
764 |
+
|
765 |
+
#: ../admin/overview.php:141
|
766 |
+
msgid "PHP Safe Mode"
|
767 |
+
msgstr ""
|
768 |
+
|
769 |
+
#: ../admin/overview.php:142
|
770 |
+
msgid "PHP Memory Limit"
|
771 |
+
msgstr ""
|
772 |
+
|
773 |
+
#: ../admin/overview.php:143
|
774 |
+
msgid "PHP Max Upload Size"
|
775 |
+
msgstr ""
|
776 |
+
|
777 |
+
#: ../admin/overview.php:144
|
778 |
+
msgid "PHP Max Post Size"
|
779 |
+
msgstr ""
|
780 |
+
|
781 |
+
#: ../admin/overview.php:145
|
782 |
+
msgid "PHP Max Script Execute Time"
|
783 |
+
msgstr ""
|
784 |
+
|
785 |
+
#: ../admin/settings.php:116
|
786 |
+
#: ../admin/settings.php:132
|
787 |
+
msgid "General Options"
|
788 |
+
msgstr ""
|
789 |
+
|
790 |
+
#: ../admin/settings.php:117
|
791 |
+
#: ../admin/settings.php:255
|
792 |
+
msgid "Thumbnails"
|
793 |
+
msgstr ""
|
794 |
+
|
795 |
+
#: ../admin/settings.php:118
|
796 |
+
msgid "Images"
|
797 |
+
msgstr ""
|
798 |
+
|
799 |
+
#: ../admin/settings.php:120
|
800 |
+
#: ../admin/settings.php:273
|
801 |
+
msgid "Effects"
|
802 |
+
msgstr ""
|
803 |
+
|
804 |
+
#: ../admin/settings.php:121
|
805 |
+
#: ../admin/settings.php:310
|
806 |
+
msgid "Watermark"
|
807 |
+
msgstr ""
|
808 |
+
|
809 |
+
#: ../admin/settings.php:122
|
810 |
+
#: ../admin/settings.php:256
|
811 |
+
#: ../admin/settings.php:412
|
812 |
+
msgid "Slideshow"
|
813 |
+
msgstr ""
|
814 |
+
|
815 |
+
#: ../admin/settings.php:138
|
816 |
+
msgid "Gallery path"
|
817 |
+
msgstr ""
|
818 |
+
|
819 |
+
#: ../admin/settings.php:140
|
820 |
+
msgid "This is the default path for all galleries"
|
821 |
+
msgstr ""
|
822 |
+
|
823 |
+
#: ../admin/settings.php:143
|
824 |
+
msgid "Scan folders during runtime"
|
825 |
+
msgstr ""
|
826 |
+
|
827 |
+
#: ../admin/settings.php:145
|
828 |
+
msgid "Search automatic in the folders for new images (not working)"
|
829 |
+
msgstr ""
|
830 |
+
|
831 |
+
#: ../admin/settings.php:148
|
832 |
+
msgid "Delete image files"
|
833 |
+
msgstr ""
|
834 |
+
|
835 |
+
#: ../admin/settings.php:150
|
836 |
+
msgid "Delete files, when removing a gallery in the database"
|
837 |
+
msgstr ""
|
838 |
+
|
839 |
+
#: ../admin/settings.php:161
|
840 |
+
msgid "Thumbnail settings"
|
841 |
+
msgstr ""
|
842 |
+
|
843 |
+
#: ../admin/settings.php:167
|
844 |
+
msgid "Width x height (in pixel)"
|
845 |
+
msgstr ""
|
846 |
+
|
847 |
+
#: ../admin/settings.php:169
|
848 |
+
msgid "This values are maxium values "
|
849 |
+
msgstr ""
|
850 |
+
|
851 |
+
#: ../admin/settings.php:172
|
852 |
+
msgid "Set fix dimension"
|
853 |
+
msgstr ""
|
854 |
+
|
855 |
+
#: ../admin/settings.php:174
|
856 |
+
msgid "Ignore the aspect ratio, no portrait thumbnails"
|
857 |
+
msgstr ""
|
858 |
+
|
859 |
+
#: ../admin/settings.php:177
|
860 |
+
msgid "Crop thumbnail from image"
|
861 |
+
msgstr ""
|
862 |
+
|
863 |
+
#: ../admin/settings.php:179
|
864 |
+
msgid "Create square thumbnails from the center"
|
865 |
+
msgstr ""
|
866 |
+
|
867 |
+
#: ../admin/settings.php:182
|
868 |
+
msgid "Thumbnail quality"
|
869 |
+
msgstr ""
|
870 |
+
|
871 |
+
#: ../admin/settings.php:186
|
872 |
+
#: ../admin/settings.php:216
|
873 |
+
msgid "Resample Mode"
|
874 |
+
msgstr ""
|
875 |
+
|
876 |
+
#: ../admin/settings.php:188
|
877 |
+
#: ../admin/settings.php:219
|
878 |
+
msgid "Value between 1-5 (higher value, more CPU load)"
|
879 |
+
msgstr ""
|
880 |
+
|
881 |
+
#: ../admin/settings.php:199
|
882 |
+
msgid "Image settings"
|
883 |
+
msgstr ""
|
884 |
+
|
885 |
+
#: ../admin/settings.php:205
|
886 |
+
msgid "Resize Images"
|
887 |
+
msgstr ""
|
888 |
+
|
889 |
+
#: ../admin/settings.php:208
|
890 |
+
msgid "Width x height (in pixel). NextGEN Gallery will keep ratio size"
|
891 |
+
msgstr ""
|
892 |
+
|
893 |
+
#: ../admin/settings.php:211
|
894 |
+
msgid "Image quality"
|
895 |
+
msgstr ""
|
896 |
+
|
897 |
+
#: ../admin/settings.php:222
|
898 |
+
msgid "Add link in [singlepic] tag "
|
899 |
+
msgstr ""
|
900 |
+
|
901 |
+
#: ../admin/settings.php:225
|
902 |
+
msgid "Add the fullsize picture as link. Didn't support watermark mode on the fly."
|
903 |
+
msgstr ""
|
904 |
+
|
905 |
+
#: ../admin/settings.php:236
|
906 |
+
msgid "Gallery settings"
|
907 |
+
msgstr ""
|
908 |
+
|
909 |
+
#: ../admin/settings.php:242
|
910 |
+
msgid "Number of images per page"
|
911 |
+
msgstr ""
|
912 |
+
|
913 |
+
#: ../admin/settings.php:244
|
914 |
+
msgid "Value 0 = No Navigation, all images on one page"
|
915 |
+
msgstr ""
|
916 |
+
|
917 |
+
#: ../admin/settings.php:247
|
918 |
+
msgid "Integrate slideshow"
|
919 |
+
msgstr ""
|
920 |
+
|
921 |
+
#: ../admin/settings.php:254
|
922 |
+
msgid "Show first"
|
923 |
+
msgstr ""
|
924 |
+
|
925 |
+
#: ../admin/settings.php:259
|
926 |
+
msgid "Sort thumbnails"
|
927 |
+
msgstr ""
|
928 |
+
|
929 |
+
#: ../admin/settings.php:260
|
930 |
+
msgid "Image ID"
|
931 |
+
msgstr ""
|
932 |
+
|
933 |
+
#: ../admin/settings.php:262
|
934 |
+
msgid "Alt / Title text"
|
935 |
+
msgstr ""
|
936 |
+
|
937 |
+
#: ../admin/settings.php:276
|
938 |
+
msgid "Here you can select the thumbnail effect, NextGEN Gallery will integrate the required HTML code in the images. Please note that only the Thickbox effect will automatic added to your theme."
|
939 |
+
msgstr ""
|
940 |
+
|
941 |
+
#: ../admin/settings.php:277
|
942 |
+
msgid "With the placeholder"
|
943 |
+
msgstr ""
|
944 |
+
|
945 |
+
#: ../admin/settings.php:277
|
946 |
+
msgid "you can activate a navigation through the images (depend on the effect). Change the code line only , when you use a different thumbnail effect or you know what you do."
|
947 |
+
msgstr ""
|
948 |
+
|
949 |
+
#: ../admin/settings.php:281
|
950 |
+
msgid "JavaScript Thumbnail effect"
|
951 |
+
msgstr ""
|
952 |
+
|
953 |
+
#: ../admin/settings.php:284
|
954 |
+
msgid "None"
|
955 |
+
msgstr ""
|
956 |
+
|
957 |
+
#: ../admin/settings.php:285
|
958 |
+
msgid "Thickbox"
|
959 |
+
msgstr ""
|
960 |
+
|
961 |
+
#: ../admin/settings.php:286
|
962 |
+
msgid "Lightbox"
|
963 |
+
msgstr ""
|
964 |
+
|
965 |
+
#: ../admin/settings.php:287
|
966 |
+
msgid "Highslide"
|
967 |
+
msgstr ""
|
968 |
+
|
969 |
+
#: ../admin/settings.php:288
|
970 |
+
msgid "Custom"
|
971 |
+
msgstr ""
|
972 |
+
|
973 |
+
#: ../admin/settings.php:292
|
974 |
+
msgid "Link Code line"
|
975 |
+
msgstr ""
|
976 |
+
|
977 |
+
#: ../admin/settings.php:314
|
978 |
+
msgid "Preview"
|
979 |
+
msgstr ""
|
980 |
+
|
981 |
+
#: ../admin/settings.php:316
|
982 |
+
#: ../admin/settings.php:320
|
983 |
+
msgid "Position"
|
984 |
+
msgstr ""
|
985 |
+
|
986 |
+
#: ../admin/settings.php:340
|
987 |
+
msgid "Offset"
|
988 |
+
msgstr ""
|
989 |
+
|
990 |
+
#: ../admin/settings.php:358
|
991 |
+
msgid "Use image as watermark"
|
992 |
+
msgstr ""
|
993 |
+
|
994 |
+
#: ../admin/settings.php:361
|
995 |
+
msgid "URL to file"
|
996 |
+
msgstr ""
|
997 |
+
|
998 |
+
#: ../admin/settings.php:368
|
999 |
+
msgid "Use text as watermark"
|
1000 |
+
msgstr ""
|
1001 |
+
|
1002 |
+
#: ../admin/settings.php:371
|
1003 |
+
msgid "Font"
|
1004 |
+
msgstr ""
|
1005 |
+
|
1006 |
+
#: ../admin/settings.php:379
|
1007 |
+
msgid "You can upload more fonts in the folder <strong>nggallery/fonts</strong>"
|
1008 |
+
msgstr ""
|
1009 |
+
|
1010 |
+
#: ../admin/settings.php:383
|
1011 |
+
msgid "Size"
|
1012 |
+
msgstr ""
|
1013 |
+
|
1014 |
+
#: ../admin/settings.php:387
|
1015 |
+
msgid "Color"
|
1016 |
+
msgstr ""
|
1017 |
+
|
1018 |
+
#: ../admin/settings.php:389
|
1019 |
+
msgid "(hex w/o #)"
|
1020 |
+
msgstr ""
|
1021 |
+
|
1022 |
+
#: ../admin/settings.php:392
|
1023 |
+
msgid "Text"
|
1024 |
+
msgstr ""
|
1025 |
+
|
1026 |
+
#: ../admin/settings.php:396
|
1027 |
+
msgid "Opaque"
|
1028 |
+
msgstr ""
|
1029 |
+
|
1030 |
+
#: ../admin/settings.php:414
|
1031 |
+
msgid "The imagerotator.swf is not in the nggallery folder, the slideshow will not work."
|
1032 |
+
msgstr ""
|
1033 |
+
|
1034 |
+
#: ../admin/settings.php:415
|
1035 |
+
msgid "The settings are used in the Flash Image Rotator Version 3.2 ."
|
1036 |
+
msgstr ""
|
1037 |
+
|
1038 |
+
#: ../admin/settings.php:416
|
1039 |
+
msgid "See more information for the Flash Player on the web page"
|
1040 |
+
msgstr ""
|
1041 |
+
|
1042 |
+
#: ../admin/settings.php:419
|
1043 |
+
msgid "Default size (W x H)"
|
1044 |
+
msgstr ""
|
1045 |
+
|
1046 |
+
#: ../admin/settings.php:424
|
1047 |
+
msgid "Shuffle mode"
|
1048 |
+
msgstr ""
|
1049 |
+
|
1050 |
+
#: ../admin/settings.php:428
|
1051 |
+
msgid "Show next image on click"
|
1052 |
+
msgstr ""
|
1053 |
+
|
1054 |
+
#: ../admin/settings.php:432
|
1055 |
+
msgid "Show navigation bar"
|
1056 |
+
msgstr ""
|
1057 |
+
|
1058 |
+
#: ../admin/settings.php:436
|
1059 |
+
msgid "Show loading icon"
|
1060 |
+
msgstr ""
|
1061 |
+
|
1062 |
+
#: ../admin/settings.php:440
|
1063 |
+
msgid "Stretch image"
|
1064 |
+
msgstr ""
|
1065 |
+
|
1066 |
+
#: ../admin/settings.php:443
|
1067 |
+
msgid "true"
|
1068 |
+
msgstr ""
|
1069 |
+
|
1070 |
+
#: ../admin/settings.php:444
|
1071 |
+
msgid "false"
|
1072 |
+
msgstr ""
|
1073 |
+
|
1074 |
+
#: ../admin/settings.php:445
|
1075 |
+
msgid "fit"
|
1076 |
+
msgstr ""
|
1077 |
+
|
1078 |
+
#: ../admin/settings.php:446
|
1079 |
+
msgid "none"
|
1080 |
+
msgstr ""
|
1081 |
+
|
1082 |
+
#: ../admin/settings.php:451
|
1083 |
+
msgid "Duration time"
|
1084 |
+
msgstr ""
|
1085 |
+
|
1086 |
+
#: ../admin/settings.php:452
|
1087 |
+
msgid "sec."
|
1088 |
+
msgstr ""
|
1089 |
+
|
1090 |
+
#: ../admin/settings.php:455
|
1091 |
+
msgid "Transition / Fade effect"
|
1092 |
+
msgstr ""
|
1093 |
+
|
1094 |
+
#: ../admin/settings.php:458
|
1095 |
+
msgid "fade"
|
1096 |
+
msgstr ""
|
1097 |
+
|
1098 |
+
#: ../admin/settings.php:459
|
1099 |
+
msgid "bgfade"
|
1100 |
+
msgstr ""
|
1101 |
+
|
1102 |
+
#: ../admin/settings.php:460
|
1103 |
+
msgid "circles"
|
1104 |
+
msgstr ""
|
1105 |
+
|
1106 |
+
#: ../admin/settings.php:461
|
1107 |
+
msgid "blocks"
|
1108 |
+
msgstr ""
|
1109 |
+
|
1110 |
+
#: ../admin/settings.php:462
|
1111 |
+
msgid "fluids"
|
1112 |
+
msgstr ""
|
1113 |
+
|
1114 |
+
#: ../admin/settings.php:463
|
1115 |
+
msgid "lines"
|
1116 |
+
msgstr ""
|
1117 |
+
|
1118 |
+
#: ../admin/settings.php:464
|
1119 |
+
msgid "random"
|
1120 |
+
msgstr ""
|
1121 |
+
|
1122 |
+
#: ../admin/settings.php:468
|
1123 |
+
msgid "Background Color"
|
1124 |
+
msgstr ""
|
1125 |
+
|
1126 |
+
#: ../admin/settings.php:473
|
1127 |
+
msgid "Texts / Buttons Color"
|
1128 |
+
msgstr ""
|
1129 |
+
|
1130 |
+
#: ../admin/settings.php:478
|
1131 |
+
msgid "Rollover / Active Color"
|
1132 |
+
msgstr ""
|
1133 |
+
|
1134 |
+
#: ../admin/setup.php:10
|
1135 |
+
msgid "Reset all settings to default parameter"
|
1136 |
+
msgstr ""
|
1137 |
+
|
1138 |
+
#: ../admin/setup.php:22
|
1139 |
+
msgid "Uninstall sucessfull ! Now delete the plugin and Enjoy your life ! Godd luck !"
|
1140 |
+
msgstr ""
|
1141 |
+
|
1142 |
+
#: ../admin/setup.php:31
|
1143 |
+
msgid "Reset options"
|
1144 |
+
msgstr ""
|
1145 |
+
|
1146 |
+
#: ../admin/setup.php:33
|
1147 |
+
msgid "Reset all options/settings to the default installation."
|
1148 |
+
msgstr ""
|
1149 |
+
|
1150 |
+
#: ../admin/setup.php:34
|
1151 |
+
msgid "Reset settings"
|
1152 |
+
msgstr ""
|
1153 |
+
|
1154 |
+
#: ../admin/setup.php:34
|
1155 |
+
msgid ""
|
1156 |
+
"Reset all options to default settings ?\\n"
|
1157 |
+
"\\n"
|
1158 |
+
"Choose [Cancel] to Stop, [OK] to proceed.\\n"
|
1159 |
+
msgstr ""
|
1160 |
+
|
1161 |
+
#: ../admin/setup.php:38
|
1162 |
+
msgid "Uninstall plugin tables"
|
1163 |
+
msgstr ""
|
1164 |
+
|
1165 |
+
#: ../admin/setup.php:40
|
1166 |
+
msgid "You don't like NextGEN Gallery ?"
|
1167 |
+
msgstr ""
|
1168 |
+
|
1169 |
+
#: ../admin/setup.php:41
|
1170 |
+
msgid "No problem, before you deactivate this plugin press the Uninstall Button, because deactivating NextGEN Gallery does not remove any data that may have been created. "
|
1171 |
+
msgstr ""
|
1172 |
+
|
1173 |
+
#: ../admin/setup.php:42
|
1174 |
+
msgid "WARNING:"
|
1175 |
+
msgstr ""
|
1176 |
+
|
1177 |
+
#: ../admin/setup.php:43
|
1178 |
+
msgid "Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to backup all the tables first. NextGEN gallery is stored in the tables"
|
1179 |
+
msgstr ""
|
1180 |
+
|
1181 |
+
#: ../admin/setup.php:43
|
1182 |
+
msgid "and"
|
1183 |
+
msgstr ""
|
1184 |
+
|
1185 |
+
#: ../admin/setup.php:45
|
1186 |
+
msgid "Uninstall plugin"
|
1187 |
+
msgstr ""
|
1188 |
+
|
1189 |
+
#: ../admin/setup.php:45
|
1190 |
+
msgid ""
|
1191 |
+
"You are about to Uninstall this plugin from WordPress.\\n"
|
1192 |
+
"This action is not reversible.\\n"
|
1193 |
+
"\\n"
|
1194 |
+
"Choose [Cancel] to Stop, [OK] to Uninstall.\\n"
|
1195 |
+
msgstr ""
|
1196 |
+
|
1197 |
+
#: ../admin/style.php:28
|
1198 |
+
msgid "You do not have sufficient permissions to edit templates for this blog."
|
1199 |
+
msgstr ""
|
1200 |
+
|
1201 |
+
#: ../admin/style.php:36
|
1202 |
+
msgid "CSS file successfully updated"
|
1203 |
+
msgstr ""
|
1204 |
+
|
1205 |
+
#: ../admin/style.php:57
|
1206 |
+
msgid "Activate and use style sheet:"
|
1207 |
+
msgstr ""
|
1208 |
+
|
1209 |
+
#: ../admin/style.php:76
|
1210 |
+
msgid "Activate"
|
1211 |
+
msgstr ""
|
1212 |
+
|
1213 |
+
#: ../admin/style.php:83
|
1214 |
+
#, php-format
|
1215 |
+
msgid "Editing <strong>%s</strong>"
|
1216 |
+
msgstr ""
|
1217 |
+
|
1218 |
+
#: ../admin/style.php:85
|
1219 |
+
#, php-format
|
1220 |
+
msgid "Browsing <strong>%s</strong>"
|
1221 |
+
msgstr ""
|
1222 |
+
|
1223 |
+
#: ../admin/style.php:90
|
1224 |
+
msgid "Author"
|
1225 |
+
msgstr ""
|
1226 |
+
|
1227 |
+
#: ../admin/style.php:91
|
1228 |
+
msgid "Version"
|
1229 |
+
msgstr ""
|
1230 |
+
|
1231 |
+
#: ../admin/style.php:107
|
1232 |
+
msgid "Update File »"
|
1233 |
+
msgstr ""
|
1234 |
+
|
1235 |
+
#: ../admin/style.php:111
|
1236 |
+
msgid "If this file were writable you could edit it."
|
1237 |
+
msgstr ""
|
1238 |
+
|
1239 |
+
#: ../admin/style.php:116
|
1240 |
+
msgid "Oops, no such file exists! Double check the name and try again, merci."
|
1241 |
+
msgstr ""
|
1242 |
+
|
lib/pclzip.lib.php
ADDED
@@ -0,0 +1,5748 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
// ----- File list separator
|
32 |
+
// In version 1.x of PclZip, the separator for file list is a space
|
33 |
+
// (which is not a very smart choice, specifically for windows paths !).
|
34 |
+
// A better separator should be a comma (,). This constant gives you the
|
35 |
+
// abilty to change that.
|
36 |
+
// However notice that changing this value, may have impact on existing
|
37 |
+
// scripts, using space separated filenames.
|
38 |
+
// Recommanded values for compatibility with older versions :
|
39 |
+
//define( 'PCLZIP_SEPARATOR', ' ' );
|
40 |
+
// Recommanded values for smart separation of filenames.
|
41 |
+
define( 'PCLZIP_SEPARATOR', ',' );
|
42 |
+
|
43 |
+
// ----- Error configuration
|
44 |
+
// 0 : PclZip Class integrated error handling
|
45 |
+
// 1 : PclError external library error handling. By enabling this
|
46 |
+
// you must ensure that you have included PclError library.
|
47 |
+
// [2,...] : reserved for futur use
|
48 |
+
define( 'PCLZIP_ERROR_EXTERNAL', 0 );
|
49 |
+
|
50 |
+
// ----- Optional static temporary directory
|
51 |
+
// By default temporary files are generated in the script current
|
52 |
+
// path.
|
53 |
+
// If defined :
|
54 |
+
// - MUST BE terminated by a '/'.
|
55 |
+
// - MUST be a valid, already created directory
|
56 |
+
// Samples :
|
57 |
+
// define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
|
58 |
+
// define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
|
59 |
+
define( 'PCLZIP_TEMPORARY_DIR', '' );
|
60 |
+
|
61 |
+
// --------------------------------------------------------------------------------
|
62 |
+
// ***** UNDER THIS LINE NOTHING NEEDS TO BE MODIFIED *****
|
63 |
+
// --------------------------------------------------------------------------------
|
64 |
+
|
65 |
+
// ----- Global variables
|
66 |
+
$g_pclzip_version = "2.5";
|
67 |
+
|
68 |
+
// ----- Error codes
|
69 |
+
// -1 : Unable to open file in binary write mode
|
70 |
+
// -2 : Unable to open file in binary read mode
|
71 |
+
// -3 : Invalid parameters
|
72 |
+
// -4 : File does not exist
|
73 |
+
// -5 : Filename is too long (max. 255)
|
74 |
+
// -6 : Not a valid zip file
|
75 |
+
// -7 : Invalid extracted file size
|
76 |
+
// -8 : Unable to create directory
|
77 |
+
// -9 : Invalid archive extension
|
78 |
+
// -10 : Invalid archive format
|
79 |
+
// -11 : Unable to delete file (unlink)
|
80 |
+
// -12 : Unable to rename file (rename)
|
81 |
+
// -13 : Invalid header checksum
|
82 |
+
// -14 : Invalid archive size
|
83 |
+
define( 'PCLZIP_ERR_USER_ABORTED', 2 );
|
84 |
+
define( 'PCLZIP_ERR_NO_ERROR', 0 );
|
85 |
+
define( 'PCLZIP_ERR_WRITE_OPEN_FAIL', -1 );
|
86 |
+
define( 'PCLZIP_ERR_READ_OPEN_FAIL', -2 );
|
87 |
+
define( 'PCLZIP_ERR_INVALID_PARAMETER', -3 );
|
88 |
+
define( 'PCLZIP_ERR_MISSING_FILE', -4 );
|
89 |
+
define( 'PCLZIP_ERR_FILENAME_TOO_LONG', -5 );
|
90 |
+
define( 'PCLZIP_ERR_INVALID_ZIP', -6 );
|
91 |
+
define( 'PCLZIP_ERR_BAD_EXTRACTED_FILE', -7 );
|
92 |
+
define( 'PCLZIP_ERR_DIR_CREATE_FAIL', -8 );
|
93 |
+
define( 'PCLZIP_ERR_BAD_EXTENSION', -9 );
|
94 |
+
define( 'PCLZIP_ERR_BAD_FORMAT', -10 );
|
95 |
+
define( 'PCLZIP_ERR_DELETE_FILE_FAIL', -11 );
|
96 |
+
define( 'PCLZIP_ERR_RENAME_FILE_FAIL', -12 );
|
97 |
+
define( 'PCLZIP_ERR_BAD_CHECKSUM', -13 );
|
98 |
+
define( 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', -14 );
|
99 |
+
define( 'PCLZIP_ERR_MISSING_OPTION_VALUE', -15 );
|
100 |
+
define( 'PCLZIP_ERR_INVALID_OPTION_VALUE', -16 );
|
101 |
+
define( 'PCLZIP_ERR_ALREADY_A_DIRECTORY', -17 );
|
102 |
+
define( 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', -18 );
|
103 |
+
define( 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', -19 );
|
104 |
+
define( 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', -20 );
|
105 |
+
define( 'PCLZIP_ERR_DIRECTORY_RESTRICTION', -21 );
|
106 |
+
|
107 |
+
// ----- Options values
|
108 |
+
define( 'PCLZIP_OPT_PATH', 77001 );
|
109 |
+
define( 'PCLZIP_OPT_ADD_PATH', 77002 );
|
110 |
+
define( 'PCLZIP_OPT_REMOVE_PATH', 77003 );
|
111 |
+
define( 'PCLZIP_OPT_REMOVE_ALL_PATH', 77004 );
|
112 |
+
define( 'PCLZIP_OPT_SET_CHMOD', 77005 );
|
113 |
+
define( 'PCLZIP_OPT_EXTRACT_AS_STRING', 77006 );
|
114 |
+
define( 'PCLZIP_OPT_NO_COMPRESSION', 77007 );
|
115 |
+
define( 'PCLZIP_OPT_BY_NAME', 77008 );
|
116 |
+
define( 'PCLZIP_OPT_BY_INDEX', 77009 );
|
117 |
+
define( 'PCLZIP_OPT_BY_EREG', 77010 );
|
118 |
+
define( 'PCLZIP_OPT_BY_PREG', 77011 );
|
119 |
+
define( 'PCLZIP_OPT_COMMENT', 77012 );
|
120 |
+
define( 'PCLZIP_OPT_ADD_COMMENT', 77013 );
|
121 |
+
define( 'PCLZIP_OPT_PREPEND_COMMENT', 77014 );
|
122 |
+
define( 'PCLZIP_OPT_EXTRACT_IN_OUTPUT', 77015 );
|
123 |
+
define( 'PCLZIP_OPT_REPLACE_NEWER', 77016 );
|
124 |
+
define( 'PCLZIP_OPT_STOP_ON_ERROR', 77017 );
|
125 |
+
// Having big trouble with crypt. Need to multiply 2 long int
|
126 |
+
// which is not correctly supported by PHP ...
|
127 |
+
//define( 'PCLZIP_OPT_CRYPT', 77018 );
|
128 |
+
define( 'PCLZIP_OPT_EXTRACT_DIR_RESTRICTION', 77019 );
|
129 |
+
|
130 |
+
// ----- File description attributes
|
131 |
+
define( 'PCLZIP_ATT_FILE_NAME', 79001 );
|
132 |
+
define( 'PCLZIP_ATT_FILE_NEW_SHORT_NAME', 79002 );
|
133 |
+
define( 'PCLZIP_ATT_FILE_NEW_FULL_NAME', 79003 );
|
134 |
+
|
135 |
+
// ----- Call backs values
|
136 |
+
define( 'PCLZIP_CB_PRE_EXTRACT', 78001 );
|
137 |
+
define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
|
138 |
+
define( 'PCLZIP_CB_PRE_ADD', 78003 );
|
139 |
+
define( 'PCLZIP_CB_POST_ADD', 78004 );
|
140 |
+
/* For futur use
|
141 |
+
define( 'PCLZIP_CB_PRE_LIST', 78005 );
|
142 |
+
define( 'PCLZIP_CB_POST_LIST', 78006 );
|
143 |
+
define( 'PCLZIP_CB_PRE_DELETE', 78007 );
|
144 |
+
define( 'PCLZIP_CB_POST_DELETE', 78008 );
|
145 |
+
*/
|
146 |
+
|
147 |
+
// --------------------------------------------------------------------------------
|
148 |
+
// Class : PclZip
|
149 |
+
// Description :
|
150 |
+
// PclZip is the class that represent a Zip archive.
|
151 |
+
// The public methods allow the manipulation of the archive.
|
152 |
+
// Attributes :
|
153 |
+
// Attributes must not be accessed directly.
|
154 |
+
// Methods :
|
155 |
+
// PclZip() : Object creator
|
156 |
+
// create() : Creates the Zip archive
|
157 |
+
// listContent() : List the content of the Zip archive
|
158 |
+
// extract() : Extract the content of the archive
|
159 |
+
// properties() : List the properties of the archive
|
160 |
+
// --------------------------------------------------------------------------------
|
161 |
+
class PclZip
|
162 |
+
{
|
163 |
+
// ----- Filename of the zip file
|
164 |
+
var $zipname = '';
|
165 |
+
|
166 |
+
// ----- File descriptor of the zip file
|
167 |
+
var $zip_fd = 0;
|
168 |
+
|
169 |
+
// ----- Internal error handling
|
170 |
+
var $error_code = 1;
|
171 |
+
var $error_string = '';
|
172 |
+
|
173 |
+
// ----- Current status of the magic_quotes_runtime
|
174 |
+
// This value store the php configuration for magic_quotes
|
175 |
+
// The class can then disable the magic_quotes and reset it after
|
176 |
+
var $magic_quotes_status;
|
177 |
+
|
178 |
+
// --------------------------------------------------------------------------------
|
179 |
+
// Function : PclZip()
|
180 |
+
// Description :
|
181 |
+
// Creates a PclZip object and set the name of the associated Zip archive
|
182 |
+
// filename.
|
183 |
+
// Note that no real action is taken, if the archive does not exist it is not
|
184 |
+
// created. Use create() for that.
|
185 |
+
// --------------------------------------------------------------------------------
|
186 |
+
function PclZip($p_zipname)
|
187 |
+
{
|
188 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::PclZip', "zipname=$p_zipname");
|
189 |
+
|
190 |
+
// ----- Tests the zlib
|
191 |
+
if (!function_exists('gzopen'))
|
192 |
+
{
|
193 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 1, "zlib extension seems to be missing");
|
194 |
+
die('Abort '.basename(__FILE__).' : Missing zlib extensions');
|
195 |
+
}
|
196 |
+
|
197 |
+
// ----- Set the attributes
|
198 |
+
$this->zipname = $p_zipname;
|
199 |
+
$this->zip_fd = 0;
|
200 |
+
$this->magic_quotes_status = -1;
|
201 |
+
|
202 |
+
// ----- Return
|
203 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 1);
|
204 |
+
return;
|
205 |
+
}
|
206 |
+
// --------------------------------------------------------------------------------
|
207 |
+
|
208 |
+
// --------------------------------------------------------------------------------
|
209 |
+
// Function :
|
210 |
+
// create($p_filelist, $p_add_dir="", $p_remove_dir="")
|
211 |
+
// create($p_filelist, $p_option, $p_option_value, ...)
|
212 |
+
// Description :
|
213 |
+
// This method supports two different synopsis. The first one is historical.
|
214 |
+
// This method creates a Zip Archive. The Zip file is created in the
|
215 |
+
// filesystem. The files and directories indicated in $p_filelist
|
216 |
+
// are added in the archive. See the parameters description for the
|
217 |
+
// supported format of $p_filelist.
|
218 |
+
// When a directory is in the list, the directory and its content is added
|
219 |
+
// in the archive.
|
220 |
+
// In this synopsis, the function takes an optional variable list of
|
221 |
+
// options. See bellow the supported options.
|
222 |
+
// Parameters :
|
223 |
+
// $p_filelist : An array containing file or directory names, or
|
224 |
+
// a string containing one filename or one directory name, or
|
225 |
+
// a string containing a list of filenames and/or directory
|
226 |
+
// names separated by spaces.
|
227 |
+
// $p_add_dir : A path to add before the real path of the archived file,
|
228 |
+
// in order to have it memorized in the archive.
|
229 |
+
// $p_remove_dir : A path to remove from the real path of the file to archive,
|
230 |
+
// in order to have a shorter path memorized in the archive.
|
231 |
+
// When $p_add_dir and $p_remove_dir are set, $p_remove_dir
|
232 |
+
// is removed first, before $p_add_dir is added.
|
233 |
+
// Options :
|
234 |
+
// PCLZIP_OPT_ADD_PATH :
|
235 |
+
// PCLZIP_OPT_REMOVE_PATH :
|
236 |
+
// PCLZIP_OPT_REMOVE_ALL_PATH :
|
237 |
+
// PCLZIP_OPT_COMMENT :
|
238 |
+
// PCLZIP_CB_PRE_ADD :
|
239 |
+
// PCLZIP_CB_POST_ADD :
|
240 |
+
// Return Values :
|
241 |
+
// 0 on failure,
|
242 |
+
// The list of the added files, with a status of the add action.
|
243 |
+
// (see PclZip::listContent() for list entry format)
|
244 |
+
// --------------------------------------------------------------------------------
|
245 |
+
function create($p_filelist)
|
246 |
+
{
|
247 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::create', "filelist='$p_filelist', ...");
|
248 |
+
$v_result=1;
|
249 |
+
|
250 |
+
// ----- Reset the error handler
|
251 |
+
$this->privErrorReset();
|
252 |
+
|
253 |
+
// ----- Set default values
|
254 |
+
$v_options = array();
|
255 |
+
$v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
|
256 |
+
|
257 |
+
// ----- Look for variable options arguments
|
258 |
+
$v_size = func_num_args();
|
259 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
260 |
+
|
261 |
+
// ----- Look for arguments
|
262 |
+
if ($v_size > 1) {
|
263 |
+
// ----- Get the arguments
|
264 |
+
$v_arg_list = func_get_args();
|
265 |
+
|
266 |
+
// ----- Remove from the options list the first argument
|
267 |
+
array_shift($v_arg_list);
|
268 |
+
$v_size--;
|
269 |
+
|
270 |
+
// ----- Look for first arg
|
271 |
+
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
272 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
|
273 |
+
|
274 |
+
// ----- Parse the options
|
275 |
+
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
276 |
+
array (PCLZIP_OPT_REMOVE_PATH => 'optional',
|
277 |
+
PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
|
278 |
+
PCLZIP_OPT_ADD_PATH => 'optional',
|
279 |
+
PCLZIP_CB_PRE_ADD => 'optional',
|
280 |
+
PCLZIP_CB_POST_ADD => 'optional',
|
281 |
+
PCLZIP_OPT_NO_COMPRESSION => 'optional',
|
282 |
+
PCLZIP_OPT_COMMENT => 'optional'
|
283 |
+
//, PCLZIP_OPT_CRYPT => 'optional'
|
284 |
+
));
|
285 |
+
if ($v_result != 1) {
|
286 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
287 |
+
return 0;
|
288 |
+
}
|
289 |
+
}
|
290 |
+
|
291 |
+
// ----- Look for 2 args
|
292 |
+
// Here we need to support the first historic synopsis of the
|
293 |
+
// method.
|
294 |
+
else {
|
295 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
296 |
+
|
297 |
+
// ----- Get the first argument
|
298 |
+
$v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0];
|
299 |
+
|
300 |
+
// ----- Look for the optional second argument
|
301 |
+
if ($v_size == 2) {
|
302 |
+
$v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
|
303 |
+
}
|
304 |
+
else if ($v_size > 2) {
|
305 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
306 |
+
"Invalid number / type of arguments");
|
307 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
308 |
+
return 0;
|
309 |
+
}
|
310 |
+
}
|
311 |
+
}
|
312 |
+
|
313 |
+
// ----- Init
|
314 |
+
$v_string_list = array();
|
315 |
+
$v_att_list = array();
|
316 |
+
$v_filedescr_list = array();
|
317 |
+
$p_result_list = array();
|
318 |
+
|
319 |
+
// ----- Look if the $p_filelist is really an array
|
320 |
+
if (is_array($p_filelist)) {
|
321 |
+
|
322 |
+
// ----- Look if the first element is also an array
|
323 |
+
// This will mean that this is a file description entry
|
324 |
+
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
|
325 |
+
$v_att_list = $p_filelist;
|
326 |
+
}
|
327 |
+
|
328 |
+
// ----- The list is a list of string names
|
329 |
+
else {
|
330 |
+
$v_string_list = $p_filelist;
|
331 |
+
}
|
332 |
+
}
|
333 |
+
|
334 |
+
// ----- Look if the $p_filelist is a string
|
335 |
+
else if (is_string($p_filelist)) {
|
336 |
+
// ----- Create a list from the string
|
337 |
+
$v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
|
338 |
+
}
|
339 |
+
|
340 |
+
// ----- Invalid variable type for $p_filelist
|
341 |
+
else {
|
342 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist");
|
343 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
344 |
+
return 0;
|
345 |
+
}
|
346 |
+
|
347 |
+
// ----- Reformat the string list
|
348 |
+
if (sizeof($v_string_list) != 0) {
|
349 |
+
foreach ($v_string_list as $v_string) {
|
350 |
+
if ($v_string != '') {
|
351 |
+
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
|
352 |
+
}
|
353 |
+
else {
|
354 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Ignore an empty filename");
|
355 |
+
}
|
356 |
+
}
|
357 |
+
}
|
358 |
+
|
359 |
+
// ----- For each file in the list check the attributes
|
360 |
+
$v_supported_attributes
|
361 |
+
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
|
362 |
+
,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
|
363 |
+
,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
|
364 |
+
);
|
365 |
+
foreach ($v_att_list as $v_entry) {
|
366 |
+
$v_result = $this->privFileDescrParseAtt($v_entry,
|
367 |
+
$v_filedescr_list[],
|
368 |
+
$v_options,
|
369 |
+
$v_supported_attributes);
|
370 |
+
if ($v_result != 1) {
|
371 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
372 |
+
return 0;
|
373 |
+
}
|
374 |
+
}
|
375 |
+
|
376 |
+
// ----- Expand the filelist (expand directories)
|
377 |
+
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
|
378 |
+
if ($v_result != 1) {
|
379 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
380 |
+
return 0;
|
381 |
+
}
|
382 |
+
|
383 |
+
// ----- Call the create fct
|
384 |
+
$v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options);
|
385 |
+
if ($v_result != 1) {
|
386 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
387 |
+
return 0;
|
388 |
+
}
|
389 |
+
|
390 |
+
// ----- Return
|
391 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
|
392 |
+
return $p_result_list;
|
393 |
+
}
|
394 |
+
// --------------------------------------------------------------------------------
|
395 |
+
|
396 |
+
// --------------------------------------------------------------------------------
|
397 |
+
// Function :
|
398 |
+
// add($p_filelist, $p_add_dir="", $p_remove_dir="")
|
399 |
+
// add($p_filelist, $p_option, $p_option_value, ...)
|
400 |
+
// Description :
|
401 |
+
// This method supports two synopsis. The first one is historical.
|
402 |
+
// This methods add the list of files in an existing archive.
|
403 |
+
// If a file with the same name already exists, it is added at the end of the
|
404 |
+
// archive, the first one is still present.
|
405 |
+
// If the archive does not exist, it is created.
|
406 |
+
// Parameters :
|
407 |
+
// $p_filelist : An array containing file or directory names, or
|
408 |
+
// a string containing one filename or one directory name, or
|
409 |
+
// a string containing a list of filenames and/or directory
|
410 |
+
// names separated by spaces.
|
411 |
+
// $p_add_dir : A path to add before the real path of the archived file,
|
412 |
+
// in order to have it memorized in the archive.
|
413 |
+
// $p_remove_dir : A path to remove from the real path of the file to archive,
|
414 |
+
// in order to have a shorter path memorized in the archive.
|
415 |
+
// When $p_add_dir and $p_remove_dir are set, $p_remove_dir
|
416 |
+
// is removed first, before $p_add_dir is added.
|
417 |
+
// Options :
|
418 |
+
// PCLZIP_OPT_ADD_PATH :
|
419 |
+
// PCLZIP_OPT_REMOVE_PATH :
|
420 |
+
// PCLZIP_OPT_REMOVE_ALL_PATH :
|
421 |
+
// PCLZIP_OPT_COMMENT :
|
422 |
+
// PCLZIP_OPT_ADD_COMMENT :
|
423 |
+
// PCLZIP_OPT_PREPEND_COMMENT :
|
424 |
+
// PCLZIP_CB_PRE_ADD :
|
425 |
+
// PCLZIP_CB_POST_ADD :
|
426 |
+
// Return Values :
|
427 |
+
// 0 on failure,
|
428 |
+
// The list of the added files, with a status of the add action.
|
429 |
+
// (see PclZip::listContent() for list entry format)
|
430 |
+
// --------------------------------------------------------------------------------
|
431 |
+
function add($p_filelist)
|
432 |
+
{
|
433 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::add', "filelist='$p_filelist', ...");
|
434 |
+
$v_result=1;
|
435 |
+
|
436 |
+
// ----- Reset the error handler
|
437 |
+
$this->privErrorReset();
|
438 |
+
|
439 |
+
// ----- Set default values
|
440 |
+
$v_options = array();
|
441 |
+
$v_options[PCLZIP_OPT_NO_COMPRESSION] = FALSE;
|
442 |
+
|
443 |
+
// ----- Look for variable options arguments
|
444 |
+
$v_size = func_num_args();
|
445 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
446 |
+
|
447 |
+
// ----- Look for arguments
|
448 |
+
if ($v_size > 1) {
|
449 |
+
// ----- Get the arguments
|
450 |
+
$v_arg_list = func_get_args();
|
451 |
+
|
452 |
+
// ----- Remove form the options list the first argument
|
453 |
+
array_shift($v_arg_list);
|
454 |
+
$v_size--;
|
455 |
+
|
456 |
+
// ----- Look for first arg
|
457 |
+
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
458 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options detected");
|
459 |
+
|
460 |
+
// ----- Parse the options
|
461 |
+
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
462 |
+
array (PCLZIP_OPT_REMOVE_PATH => 'optional',
|
463 |
+
PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
|
464 |
+
PCLZIP_OPT_ADD_PATH => 'optional',
|
465 |
+
PCLZIP_CB_PRE_ADD => 'optional',
|
466 |
+
PCLZIP_CB_POST_ADD => 'optional',
|
467 |
+
PCLZIP_OPT_NO_COMPRESSION => 'optional',
|
468 |
+
PCLZIP_OPT_COMMENT => 'optional',
|
469 |
+
PCLZIP_OPT_ADD_COMMENT => 'optional',
|
470 |
+
PCLZIP_OPT_PREPEND_COMMENT => 'optional'
|
471 |
+
//, PCLZIP_OPT_CRYPT => 'optional'
|
472 |
+
));
|
473 |
+
if ($v_result != 1) {
|
474 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
475 |
+
return 0;
|
476 |
+
}
|
477 |
+
}
|
478 |
+
|
479 |
+
// ----- Look for 2 args
|
480 |
+
// Here we need to support the first historic synopsis of the
|
481 |
+
// method.
|
482 |
+
else {
|
483 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
484 |
+
|
485 |
+
// ----- Get the first argument
|
486 |
+
$v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0];
|
487 |
+
|
488 |
+
// ----- Look for the optional second argument
|
489 |
+
if ($v_size == 2) {
|
490 |
+
$v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1];
|
491 |
+
}
|
492 |
+
else if ($v_size > 2) {
|
493 |
+
// ----- Error log
|
494 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
495 |
+
|
496 |
+
// ----- Return
|
497 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
498 |
+
return 0;
|
499 |
+
}
|
500 |
+
}
|
501 |
+
}
|
502 |
+
|
503 |
+
// ----- Init
|
504 |
+
$v_string_list = array();
|
505 |
+
$v_att_list = array();
|
506 |
+
$v_filedescr_list = array();
|
507 |
+
$p_result_list = array();
|
508 |
+
|
509 |
+
// ----- Look if the $p_filelist is really an array
|
510 |
+
if (is_array($p_filelist)) {
|
511 |
+
|
512 |
+
// ----- Look if the first element is also an array
|
513 |
+
// This will mean that this is a file description entry
|
514 |
+
if (isset($p_filelist[0]) && is_array($p_filelist[0])) {
|
515 |
+
$v_att_list = $p_filelist;
|
516 |
+
}
|
517 |
+
|
518 |
+
// ----- The list is a list of string names
|
519 |
+
else {
|
520 |
+
$v_string_list = $p_filelist;
|
521 |
+
}
|
522 |
+
}
|
523 |
+
|
524 |
+
// ----- Look if the $p_filelist is a string
|
525 |
+
else if (is_string($p_filelist)) {
|
526 |
+
// ----- Create a list from the string
|
527 |
+
$v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist);
|
528 |
+
}
|
529 |
+
|
530 |
+
// ----- Invalid variable type for $p_filelist
|
531 |
+
else {
|
532 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '".gettype($p_filelist)."' for p_filelist");
|
533 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
534 |
+
return 0;
|
535 |
+
}
|
536 |
+
|
537 |
+
// ----- Reformat the string list
|
538 |
+
if (sizeof($v_string_list) != 0) {
|
539 |
+
foreach ($v_string_list as $v_string) {
|
540 |
+
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
|
541 |
+
}
|
542 |
+
}
|
543 |
+
|
544 |
+
// ----- For each file in the list check the attributes
|
545 |
+
$v_supported_attributes
|
546 |
+
= array ( PCLZIP_ATT_FILE_NAME => 'mandatory'
|
547 |
+
,PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional'
|
548 |
+
,PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional'
|
549 |
+
);
|
550 |
+
foreach ($v_att_list as $v_entry) {
|
551 |
+
$v_result = $this->privFileDescrParseAtt($v_entry,
|
552 |
+
$v_filedescr_list[],
|
553 |
+
$v_options,
|
554 |
+
$v_supported_attributes);
|
555 |
+
if ($v_result != 1) {
|
556 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
557 |
+
return 0;
|
558 |
+
}
|
559 |
+
}
|
560 |
+
|
561 |
+
// ----- Expand the filelist (expand directories)
|
562 |
+
$v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options);
|
563 |
+
if ($v_result != 1) {
|
564 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
565 |
+
return 0;
|
566 |
+
}
|
567 |
+
|
568 |
+
// ----- Call the create fct
|
569 |
+
$v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options);
|
570 |
+
if ($v_result != 1) {
|
571 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
572 |
+
return 0;
|
573 |
+
}
|
574 |
+
|
575 |
+
// ----- Return
|
576 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_result_list);
|
577 |
+
return $p_result_list;
|
578 |
+
}
|
579 |
+
// --------------------------------------------------------------------------------
|
580 |
+
|
581 |
+
// --------------------------------------------------------------------------------
|
582 |
+
// Function : listContent()
|
583 |
+
// Description :
|
584 |
+
// This public method, gives the list of the files and directories, with their
|
585 |
+
// properties.
|
586 |
+
// The properties of each entries in the list are (used also in other functions) :
|
587 |
+
// filename : Name of the file. For a create or add action it is the filename
|
588 |
+
// given by the user. For an extract function it is the filename
|
589 |
+
// of the extracted file.
|
590 |
+
// stored_filename : Name of the file / directory stored in the archive.
|
591 |
+
// size : Size of the stored file.
|
592 |
+
// compressed_size : Size of the file's data compressed in the archive
|
593 |
+
// (without the headers overhead)
|
594 |
+
// mtime : Last known modification date of the file (UNIX timestamp)
|
595 |
+
// comment : Comment associated with the file
|
596 |
+
// folder : true | false
|
597 |
+
// index : index of the file in the archive
|
598 |
+
// status : status of the action (depending of the action) :
|
599 |
+
// Values are :
|
600 |
+
// ok : OK !
|
601 |
+
// filtered : the file / dir is not extracted (filtered by user)
|
602 |
+
// already_a_directory : the file can not be extracted because a
|
603 |
+
// directory with the same name already exists
|
604 |
+
// write_protected : the file can not be extracted because a file
|
605 |
+
// with the same name already exists and is
|
606 |
+
// write protected
|
607 |
+
// newer_exist : the file was not extracted because a newer file exists
|
608 |
+
// path_creation_fail : the file is not extracted because the folder
|
609 |
+
// does not exists and can not be created
|
610 |
+
// write_error : the file was not extracted because there was a
|
611 |
+
// error while writing the file
|
612 |
+
// read_error : the file was not extracted because there was a error
|
613 |
+
// while reading the file
|
614 |
+
// invalid_header : the file was not extracted because of an archive
|
615 |
+
// format error (bad file header)
|
616 |
+
// Note that each time a method can continue operating when there
|
617 |
+
// is an action error on a file, the error is only logged in the file status.
|
618 |
+
// Return Values :
|
619 |
+
// 0 on an unrecoverable failure,
|
620 |
+
// The list of the files in the archive.
|
621 |
+
// --------------------------------------------------------------------------------
|
622 |
+
function listContent()
|
623 |
+
{
|
624 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::listContent', "");
|
625 |
+
$v_result=1;
|
626 |
+
|
627 |
+
// ----- Reset the error handler
|
628 |
+
$this->privErrorReset();
|
629 |
+
|
630 |
+
// ----- Check archive
|
631 |
+
if (!$this->privCheckFormat()) {
|
632 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
633 |
+
return(0);
|
634 |
+
}
|
635 |
+
|
636 |
+
// ----- Call the extracting fct
|
637 |
+
$p_list = array();
|
638 |
+
if (($v_result = $this->privList($p_list)) != 1)
|
639 |
+
{
|
640 |
+
unset($p_list);
|
641 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
642 |
+
return(0);
|
643 |
+
}
|
644 |
+
|
645 |
+
// ----- Return
|
646 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
647 |
+
return $p_list;
|
648 |
+
}
|
649 |
+
// --------------------------------------------------------------------------------
|
650 |
+
|
651 |
+
// --------------------------------------------------------------------------------
|
652 |
+
// Function :
|
653 |
+
// extract($p_path="./", $p_remove_path="")
|
654 |
+
// extract([$p_option, $p_option_value, ...])
|
655 |
+
// Description :
|
656 |
+
// This method supports two synopsis. The first one is historical.
|
657 |
+
// This method extract all the files / directories from the archive to the
|
658 |
+
// folder indicated in $p_path.
|
659 |
+
// If you want to ignore the 'root' part of path of the memorized files
|
660 |
+
// you can indicate this in the optional $p_remove_path parameter.
|
661 |
+
// By default, if a newer file with the same name already exists, the
|
662 |
+
// file is not extracted.
|
663 |
+
//
|
664 |
+
// If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions
|
665 |
+
// are used, the path indicated in PCLZIP_OPT_ADD_PATH is append
|
666 |
+
// at the end of the path value of PCLZIP_OPT_PATH.
|
667 |
+
// Parameters :
|
668 |
+
// $p_path : Path where the files and directories are to be extracted
|
669 |
+
// $p_remove_path : First part ('root' part) of the memorized path
|
670 |
+
// (if any similar) to remove while extracting.
|
671 |
+
// Options :
|
672 |
+
// PCLZIP_OPT_PATH :
|
673 |
+
// PCLZIP_OPT_ADD_PATH :
|
674 |
+
// PCLZIP_OPT_REMOVE_PATH :
|
675 |
+
// PCLZIP_OPT_REMOVE_ALL_PATH :
|
676 |
+
// PCLZIP_CB_PRE_EXTRACT :
|
677 |
+
// PCLZIP_CB_POST_EXTRACT :
|
678 |
+
// Return Values :
|
679 |
+
// 0 or a negative value on failure,
|
680 |
+
// The list of the extracted files, with a status of the action.
|
681 |
+
// (see PclZip::listContent() for list entry format)
|
682 |
+
// --------------------------------------------------------------------------------
|
683 |
+
function extract()
|
684 |
+
{
|
685 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extract", "");
|
686 |
+
$v_result=1;
|
687 |
+
|
688 |
+
// ----- Reset the error handler
|
689 |
+
$this->privErrorReset();
|
690 |
+
|
691 |
+
// ----- Check archive
|
692 |
+
if (!$this->privCheckFormat()) {
|
693 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
694 |
+
return(0);
|
695 |
+
}
|
696 |
+
|
697 |
+
// ----- Set default values
|
698 |
+
$v_options = array();
|
699 |
+
// $v_path = "./";
|
700 |
+
$v_path = '';
|
701 |
+
$v_remove_path = "";
|
702 |
+
$v_remove_all_path = false;
|
703 |
+
|
704 |
+
// ----- Look for variable options arguments
|
705 |
+
$v_size = func_num_args();
|
706 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
707 |
+
|
708 |
+
// ----- Default values for option
|
709 |
+
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
710 |
+
|
711 |
+
// ----- Look for arguments
|
712 |
+
if ($v_size > 0) {
|
713 |
+
// ----- Get the arguments
|
714 |
+
$v_arg_list = func_get_args();
|
715 |
+
|
716 |
+
// ----- Look for first arg
|
717 |
+
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
718 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
|
719 |
+
|
720 |
+
// ----- Parse the options
|
721 |
+
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
722 |
+
array (PCLZIP_OPT_PATH => 'optional',
|
723 |
+
PCLZIP_OPT_REMOVE_PATH => 'optional',
|
724 |
+
PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
|
725 |
+
PCLZIP_OPT_ADD_PATH => 'optional',
|
726 |
+
PCLZIP_CB_PRE_EXTRACT => 'optional',
|
727 |
+
PCLZIP_CB_POST_EXTRACT => 'optional',
|
728 |
+
PCLZIP_OPT_SET_CHMOD => 'optional',
|
729 |
+
PCLZIP_OPT_BY_NAME => 'optional',
|
730 |
+
PCLZIP_OPT_BY_EREG => 'optional',
|
731 |
+
PCLZIP_OPT_BY_PREG => 'optional',
|
732 |
+
PCLZIP_OPT_BY_INDEX => 'optional',
|
733 |
+
PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
|
734 |
+
PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional',
|
735 |
+
PCLZIP_OPT_REPLACE_NEWER => 'optional'
|
736 |
+
,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
|
737 |
+
,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'
|
738 |
+
));
|
739 |
+
if ($v_result != 1) {
|
740 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
741 |
+
return 0;
|
742 |
+
}
|
743 |
+
|
744 |
+
// ----- Set the arguments
|
745 |
+
if (isset($v_options[PCLZIP_OPT_PATH])) {
|
746 |
+
$v_path = $v_options[PCLZIP_OPT_PATH];
|
747 |
+
}
|
748 |
+
if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
|
749 |
+
$v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
|
750 |
+
}
|
751 |
+
if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
|
752 |
+
$v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
|
753 |
+
}
|
754 |
+
if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
|
755 |
+
// ----- Check for '/' in last path char
|
756 |
+
if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
|
757 |
+
$v_path .= '/';
|
758 |
+
}
|
759 |
+
$v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
|
760 |
+
}
|
761 |
+
}
|
762 |
+
|
763 |
+
// ----- Look for 2 args
|
764 |
+
// Here we need to support the first historic synopsis of the
|
765 |
+
// method.
|
766 |
+
else {
|
767 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
768 |
+
|
769 |
+
// ----- Get the first argument
|
770 |
+
$v_path = $v_arg_list[0];
|
771 |
+
|
772 |
+
// ----- Look for the optional second argument
|
773 |
+
if ($v_size == 2) {
|
774 |
+
$v_remove_path = $v_arg_list[1];
|
775 |
+
}
|
776 |
+
else if ($v_size > 2) {
|
777 |
+
// ----- Error log
|
778 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
779 |
+
|
780 |
+
// ----- Return
|
781 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
782 |
+
return 0;
|
783 |
+
}
|
784 |
+
}
|
785 |
+
}
|
786 |
+
|
787 |
+
// ----- Trace
|
788 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "path='$v_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_path?'true':'false')."'");
|
789 |
+
|
790 |
+
// ----- Call the extracting fct
|
791 |
+
$p_list = array();
|
792 |
+
$v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path,
|
793 |
+
$v_remove_all_path, $v_options);
|
794 |
+
if ($v_result < 1) {
|
795 |
+
unset($p_list);
|
796 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
797 |
+
return(0);
|
798 |
+
}
|
799 |
+
|
800 |
+
// ----- Return
|
801 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
802 |
+
return $p_list;
|
803 |
+
}
|
804 |
+
// --------------------------------------------------------------------------------
|
805 |
+
|
806 |
+
|
807 |
+
// --------------------------------------------------------------------------------
|
808 |
+
// Function :
|
809 |
+
// extractByIndex($p_index, $p_path="./", $p_remove_path="")
|
810 |
+
// extractByIndex($p_index, [$p_option, $p_option_value, ...])
|
811 |
+
// Description :
|
812 |
+
// This method supports two synopsis. The first one is historical.
|
813 |
+
// This method is doing a partial extract of the archive.
|
814 |
+
// The extracted files or folders are identified by their index in the
|
815 |
+
// archive (from 0 to n).
|
816 |
+
// Note that if the index identify a folder, only the folder entry is
|
817 |
+
// extracted, not all the files included in the archive.
|
818 |
+
// Parameters :
|
819 |
+
// $p_index : A single index (integer) or a string of indexes of files to
|
820 |
+
// extract. The form of the string is "0,4-6,8-12" with only numbers
|
821 |
+
// and '-' for range or ',' to separate ranges. No spaces or ';'
|
822 |
+
// are allowed.
|
823 |
+
// $p_path : Path where the files and directories are to be extracted
|
824 |
+
// $p_remove_path : First part ('root' part) of the memorized path
|
825 |
+
// (if any similar) to remove while extracting.
|
826 |
+
// Options :
|
827 |
+
// PCLZIP_OPT_PATH :
|
828 |
+
// PCLZIP_OPT_ADD_PATH :
|
829 |
+
// PCLZIP_OPT_REMOVE_PATH :
|
830 |
+
// PCLZIP_OPT_REMOVE_ALL_PATH :
|
831 |
+
// PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and
|
832 |
+
// not as files.
|
833 |
+
// The resulting content is in a new field 'content' in the file
|
834 |
+
// structure.
|
835 |
+
// This option must be used alone (any other options are ignored).
|
836 |
+
// PCLZIP_CB_PRE_EXTRACT :
|
837 |
+
// PCLZIP_CB_POST_EXTRACT :
|
838 |
+
// Return Values :
|
839 |
+
// 0 on failure,
|
840 |
+
// The list of the extracted files, with a status of the action.
|
841 |
+
// (see PclZip::listContent() for list entry format)
|
842 |
+
// --------------------------------------------------------------------------------
|
843 |
+
//function extractByIndex($p_index, options...)
|
844 |
+
function extractByIndex($p_index)
|
845 |
+
{
|
846 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::extractByIndex", "index='$p_index', ...");
|
847 |
+
$v_result=1;
|
848 |
+
|
849 |
+
// ----- Reset the error handler
|
850 |
+
$this->privErrorReset();
|
851 |
+
|
852 |
+
// ----- Check archive
|
853 |
+
if (!$this->privCheckFormat()) {
|
854 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
855 |
+
return(0);
|
856 |
+
}
|
857 |
+
|
858 |
+
// ----- Set default values
|
859 |
+
$v_options = array();
|
860 |
+
// $v_path = "./";
|
861 |
+
$v_path = '';
|
862 |
+
$v_remove_path = "";
|
863 |
+
$v_remove_all_path = false;
|
864 |
+
|
865 |
+
// ----- Look for variable options arguments
|
866 |
+
$v_size = func_num_args();
|
867 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
868 |
+
|
869 |
+
// ----- Default values for option
|
870 |
+
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
871 |
+
|
872 |
+
// ----- Look for arguments
|
873 |
+
if ($v_size > 1) {
|
874 |
+
// ----- Get the arguments
|
875 |
+
$v_arg_list = func_get_args();
|
876 |
+
|
877 |
+
// ----- Remove form the options list the first argument
|
878 |
+
array_shift($v_arg_list);
|
879 |
+
$v_size--;
|
880 |
+
|
881 |
+
// ----- Look for first arg
|
882 |
+
if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) {
|
883 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Variable list of options");
|
884 |
+
|
885 |
+
// ----- Parse the options
|
886 |
+
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
887 |
+
array (PCLZIP_OPT_PATH => 'optional',
|
888 |
+
PCLZIP_OPT_REMOVE_PATH => 'optional',
|
889 |
+
PCLZIP_OPT_REMOVE_ALL_PATH => 'optional',
|
890 |
+
PCLZIP_OPT_EXTRACT_AS_STRING => 'optional',
|
891 |
+
PCLZIP_OPT_ADD_PATH => 'optional',
|
892 |
+
PCLZIP_CB_PRE_EXTRACT => 'optional',
|
893 |
+
PCLZIP_CB_POST_EXTRACT => 'optional',
|
894 |
+
PCLZIP_OPT_SET_CHMOD => 'optional',
|
895 |
+
PCLZIP_OPT_REPLACE_NEWER => 'optional'
|
896 |
+
,PCLZIP_OPT_STOP_ON_ERROR => 'optional'
|
897 |
+
,PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional'
|
898 |
+
));
|
899 |
+
if ($v_result != 1) {
|
900 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
901 |
+
return 0;
|
902 |
+
}
|
903 |
+
|
904 |
+
// ----- Set the arguments
|
905 |
+
if (isset($v_options[PCLZIP_OPT_PATH])) {
|
906 |
+
$v_path = $v_options[PCLZIP_OPT_PATH];
|
907 |
+
}
|
908 |
+
if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) {
|
909 |
+
$v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH];
|
910 |
+
}
|
911 |
+
if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
|
912 |
+
$v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH];
|
913 |
+
}
|
914 |
+
if (isset($v_options[PCLZIP_OPT_ADD_PATH])) {
|
915 |
+
// ----- Check for '/' in last path char
|
916 |
+
if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) {
|
917 |
+
$v_path .= '/';
|
918 |
+
}
|
919 |
+
$v_path .= $v_options[PCLZIP_OPT_ADD_PATH];
|
920 |
+
}
|
921 |
+
if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) {
|
922 |
+
$v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = FALSE;
|
923 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING not set.");
|
924 |
+
}
|
925 |
+
else {
|
926 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Option PCLZIP_OPT_EXTRACT_AS_STRING set.");
|
927 |
+
}
|
928 |
+
}
|
929 |
+
|
930 |
+
// ----- Look for 2 args
|
931 |
+
// Here we need to support the first historic synopsis of the
|
932 |
+
// method.
|
933 |
+
else {
|
934 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Static synopsis");
|
935 |
+
|
936 |
+
// ----- Get the first argument
|
937 |
+
$v_path = $v_arg_list[0];
|
938 |
+
|
939 |
+
// ----- Look for the optional second argument
|
940 |
+
if ($v_size == 2) {
|
941 |
+
$v_remove_path = $v_arg_list[1];
|
942 |
+
}
|
943 |
+
else if ($v_size > 2) {
|
944 |
+
// ----- Error log
|
945 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments");
|
946 |
+
|
947 |
+
// ----- Return
|
948 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
949 |
+
return 0;
|
950 |
+
}
|
951 |
+
}
|
952 |
+
}
|
953 |
+
|
954 |
+
// ----- Trace
|
955 |
+
//--(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')."'");
|
956 |
+
|
957 |
+
// ----- Trick
|
958 |
+
// Here I want to reuse extractByRule(), so I need to parse the $p_index
|
959 |
+
// with privParseOptions()
|
960 |
+
$v_arg_trick = array (PCLZIP_OPT_BY_INDEX, $p_index);
|
961 |
+
$v_options_trick = array();
|
962 |
+
$v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick,
|
963 |
+
array (PCLZIP_OPT_BY_INDEX => 'optional' ));
|
964 |
+
if ($v_result != 1) {
|
965 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
966 |
+
return 0;
|
967 |
+
}
|
968 |
+
$v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX];
|
969 |
+
|
970 |
+
// ----- Call the extracting fct
|
971 |
+
if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) {
|
972 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
973 |
+
return(0);
|
974 |
+
}
|
975 |
+
|
976 |
+
// ----- Return
|
977 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
978 |
+
return $p_list;
|
979 |
+
}
|
980 |
+
// --------------------------------------------------------------------------------
|
981 |
+
|
982 |
+
// --------------------------------------------------------------------------------
|
983 |
+
// Function :
|
984 |
+
// delete([$p_option, $p_option_value, ...])
|
985 |
+
// Description :
|
986 |
+
// This method removes files from the archive.
|
987 |
+
// If no parameters are given, then all the archive is emptied.
|
988 |
+
// Parameters :
|
989 |
+
// None or optional arguments.
|
990 |
+
// Options :
|
991 |
+
// PCLZIP_OPT_BY_INDEX :
|
992 |
+
// PCLZIP_OPT_BY_NAME :
|
993 |
+
// PCLZIP_OPT_BY_EREG :
|
994 |
+
// PCLZIP_OPT_BY_PREG :
|
995 |
+
// Return Values :
|
996 |
+
// 0 on failure,
|
997 |
+
// The list of the files which are still present in the archive.
|
998 |
+
// (see PclZip::listContent() for list entry format)
|
999 |
+
// --------------------------------------------------------------------------------
|
1000 |
+
function delete()
|
1001 |
+
{
|
1002 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::delete", "");
|
1003 |
+
$v_result=1;
|
1004 |
+
|
1005 |
+
// ----- Reset the error handler
|
1006 |
+
$this->privErrorReset();
|
1007 |
+
|
1008 |
+
// ----- Check archive
|
1009 |
+
if (!$this->privCheckFormat()) {
|
1010 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1011 |
+
return(0);
|
1012 |
+
}
|
1013 |
+
|
1014 |
+
// ----- Set default values
|
1015 |
+
$v_options = array();
|
1016 |
+
|
1017 |
+
// ----- Look for variable options arguments
|
1018 |
+
$v_size = func_num_args();
|
1019 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");
|
1020 |
+
|
1021 |
+
// ----- Look for arguments
|
1022 |
+
if ($v_size > 0) {
|
1023 |
+
// ----- Get the arguments
|
1024 |
+
$v_arg_list = func_get_args();
|
1025 |
+
|
1026 |
+
// ----- Parse the options
|
1027 |
+
$v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options,
|
1028 |
+
array (PCLZIP_OPT_BY_NAME => 'optional',
|
1029 |
+
PCLZIP_OPT_BY_EREG => 'optional',
|
1030 |
+
PCLZIP_OPT_BY_PREG => 'optional',
|
1031 |
+
PCLZIP_OPT_BY_INDEX => 'optional' ));
|
1032 |
+
if ($v_result != 1) {
|
1033 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1034 |
+
return 0;
|
1035 |
+
}
|
1036 |
+
}
|
1037 |
+
|
1038 |
+
// ----- Magic quotes trick
|
1039 |
+
$this->privDisableMagicQuotes();
|
1040 |
+
|
1041 |
+
// ----- Call the delete fct
|
1042 |
+
$v_list = array();
|
1043 |
+
if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) {
|
1044 |
+
$this->privSwapBackMagicQuotes();
|
1045 |
+
unset($v_list);
|
1046 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
|
1047 |
+
return(0);
|
1048 |
+
}
|
1049 |
+
|
1050 |
+
// ----- Magic quotes trick
|
1051 |
+
$this->privSwapBackMagicQuotes();
|
1052 |
+
|
1053 |
+
// ----- Return
|
1054 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_list);
|
1055 |
+
return $v_list;
|
1056 |
+
}
|
1057 |
+
// --------------------------------------------------------------------------------
|
1058 |
+
|
1059 |
+
// --------------------------------------------------------------------------------
|
1060 |
+
// Function : deleteByIndex()
|
1061 |
+
// Description :
|
1062 |
+
// ***** Deprecated *****
|
1063 |
+
// delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered.
|
1064 |
+
// --------------------------------------------------------------------------------
|
1065 |
+
function deleteByIndex($p_index)
|
1066 |
+
{
|
1067 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::deleteByIndex", "index='$p_index'");
|
1068 |
+
|
1069 |
+
$p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index);
|
1070 |
+
|
1071 |
+
// ----- Return
|
1072 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $p_list);
|
1073 |
+
return $p_list;
|
1074 |
+
}
|
1075 |
+
// --------------------------------------------------------------------------------
|
1076 |
+
|
1077 |
+
// --------------------------------------------------------------------------------
|
1078 |
+
// Function : properties()
|
1079 |
+
// Description :
|
1080 |
+
// This method gives the properties of the archive.
|
1081 |
+
// The properties are :
|
1082 |
+
// nb : Number of files in the archive
|
1083 |
+
// comment : Comment associated with the archive file
|
1084 |
+
// status : not_exist, ok
|
1085 |
+
// Parameters :
|
1086 |
+
// None
|
1087 |
+
// Return Values :
|
1088 |
+
// 0 on failure,
|
1089 |
+
// An array with the archive properties.
|
1090 |
+
// --------------------------------------------------------------------------------
|
1091 |
+
function properties()
|
1092 |
+
{
|
1093 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::properties", "");
|
1094 |
+
|
1095 |
+
// ----- Reset the error handler
|
1096 |
+
$this->privErrorReset();
|
1097 |
+
|
1098 |
+
// ----- Magic quotes trick
|
1099 |
+
$this->privDisableMagicQuotes();
|
1100 |
+
|
1101 |
+
// ----- Check archive
|
1102 |
+
if (!$this->privCheckFormat()) {
|
1103 |
+
$this->privSwapBackMagicQuotes();
|
1104 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1105 |
+
return(0);
|
1106 |
+
}
|
1107 |
+
|
1108 |
+
// ----- Default properties
|
1109 |
+
$v_prop = array();
|
1110 |
+
$v_prop['comment'] = '';
|
1111 |
+
$v_prop['nb'] = 0;
|
1112 |
+
$v_prop['status'] = 'not_exist';
|
1113 |
+
|
1114 |
+
// ----- Look if file exists
|
1115 |
+
if (@is_file($this->zipname))
|
1116 |
+
{
|
1117 |
+
// ----- Open the zip file
|
1118 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
1119 |
+
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
|
1120 |
+
{
|
1121 |
+
$this->privSwapBackMagicQuotes();
|
1122 |
+
|
1123 |
+
// ----- Error log
|
1124 |
+
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
1125 |
+
|
1126 |
+
// ----- Return
|
1127 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), 0);
|
1128 |
+
return 0;
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
// ----- Read the central directory informations
|
1132 |
+
$v_central_dir = array();
|
1133 |
+
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
1134 |
+
{
|
1135 |
+
$this->privSwapBackMagicQuotes();
|
1136 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1137 |
+
return 0;
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
// ----- Close the zip file
|
1141 |
+
$this->privCloseFd();
|
1142 |
+
|
1143 |
+
// ----- Set the user attributes
|
1144 |
+
$v_prop['comment'] = $v_central_dir['comment'];
|
1145 |
+
$v_prop['nb'] = $v_central_dir['entries'];
|
1146 |
+
$v_prop['status'] = 'ok';
|
1147 |
+
}
|
1148 |
+
|
1149 |
+
// ----- Magic quotes trick
|
1150 |
+
$this->privSwapBackMagicQuotes();
|
1151 |
+
|
1152 |
+
// ----- Return
|
1153 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_prop);
|
1154 |
+
return $v_prop;
|
1155 |
+
}
|
1156 |
+
// --------------------------------------------------------------------------------
|
1157 |
+
|
1158 |
+
// --------------------------------------------------------------------------------
|
1159 |
+
// Function : duplicate()
|
1160 |
+
// Description :
|
1161 |
+
// This method creates an archive by copying the content of an other one. If
|
1162 |
+
// the archive already exist, it is replaced by the new one without any warning.
|
1163 |
+
// Parameters :
|
1164 |
+
// $p_archive : The filename of a valid archive, or
|
1165 |
+
// a valid PclZip object.
|
1166 |
+
// Return Values :
|
1167 |
+
// 1 on success.
|
1168 |
+
// 0 or a negative value on error (error code).
|
1169 |
+
// --------------------------------------------------------------------------------
|
1170 |
+
function duplicate($p_archive)
|
1171 |
+
{
|
1172 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::duplicate", "");
|
1173 |
+
$v_result = 1;
|
1174 |
+
|
1175 |
+
// ----- Reset the error handler
|
1176 |
+
$this->privErrorReset();
|
1177 |
+
|
1178 |
+
// ----- Look if the $p_archive is a PclZip object
|
1179 |
+
if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip'))
|
1180 |
+
{
|
1181 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is valid PclZip object '".$p_archive->zipname."'");
|
1182 |
+
|
1183 |
+
// ----- Duplicate the archive
|
1184 |
+
$v_result = $this->privDuplicate($p_archive->zipname);
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
// ----- Look if the $p_archive is a string (so a filename)
|
1188 |
+
else if (is_string($p_archive))
|
1189 |
+
{
|
1190 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The parameter is a filename '$p_archive'");
|
1191 |
+
|
1192 |
+
// ----- Check that $p_archive is a valid zip file
|
1193 |
+
// TBC : Should also check the archive format
|
1194 |
+
if (!is_file($p_archive)) {
|
1195 |
+
// ----- Error log
|
1196 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '".$p_archive."'");
|
1197 |
+
$v_result = PCLZIP_ERR_MISSING_FILE;
|
1198 |
+
}
|
1199 |
+
else {
|
1200 |
+
// ----- Duplicate the archive
|
1201 |
+
$v_result = $this->privDuplicate($p_archive);
|
1202 |
+
}
|
1203 |
+
}
|
1204 |
+
|
1205 |
+
// ----- Invalid variable
|
1206 |
+
else
|
1207 |
+
{
|
1208 |
+
// ----- Error log
|
1209 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
|
1210 |
+
$v_result = PCLZIP_ERR_INVALID_PARAMETER;
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
// ----- Return
|
1214 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1215 |
+
return $v_result;
|
1216 |
+
}
|
1217 |
+
// --------------------------------------------------------------------------------
|
1218 |
+
|
1219 |
+
// --------------------------------------------------------------------------------
|
1220 |
+
// Function : merge()
|
1221 |
+
// Description :
|
1222 |
+
// This method merge the $p_archive_to_add archive at the end of the current
|
1223 |
+
// one ($this).
|
1224 |
+
// If the archive ($this) does not exist, the merge becomes a duplicate.
|
1225 |
+
// If the $p_archive_to_add archive does not exist, the merge is a success.
|
1226 |
+
// Parameters :
|
1227 |
+
// $p_archive_to_add : It can be directly the filename of a valid zip archive,
|
1228 |
+
// or a PclZip object archive.
|
1229 |
+
// Return Values :
|
1230 |
+
// 1 on success,
|
1231 |
+
// 0 or negative values on error (see below).
|
1232 |
+
// --------------------------------------------------------------------------------
|
1233 |
+
function merge($p_archive_to_add)
|
1234 |
+
{
|
1235 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::merge", "");
|
1236 |
+
$v_result = 1;
|
1237 |
+
|
1238 |
+
// ----- Reset the error handler
|
1239 |
+
$this->privErrorReset();
|
1240 |
+
|
1241 |
+
// ----- Check archive
|
1242 |
+
if (!$this->privCheckFormat()) {
|
1243 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
|
1244 |
+
return(0);
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
// ----- Look if the $p_archive_to_add is a PclZip object
|
1248 |
+
if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip'))
|
1249 |
+
{
|
1250 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is valid PclZip object");
|
1251 |
+
|
1252 |
+
// ----- Merge the archive
|
1253 |
+
$v_result = $this->privMerge($p_archive_to_add);
|
1254 |
+
}
|
1255 |
+
|
1256 |
+
// ----- Look if the $p_archive_to_add is a string (so a filename)
|
1257 |
+
else if (is_string($p_archive_to_add))
|
1258 |
+
{
|
1259 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The parameter is a filename");
|
1260 |
+
|
1261 |
+
// ----- Create a temporary archive
|
1262 |
+
$v_object_archive = new PclZip($p_archive_to_add);
|
1263 |
+
|
1264 |
+
// ----- Merge the archive
|
1265 |
+
$v_result = $this->privMerge($v_object_archive);
|
1266 |
+
}
|
1267 |
+
|
1268 |
+
// ----- Invalid variable
|
1269 |
+
else
|
1270 |
+
{
|
1271 |
+
// ----- Error log
|
1272 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add");
|
1273 |
+
$v_result = PCLZIP_ERR_INVALID_PARAMETER;
|
1274 |
+
}
|
1275 |
+
|
1276 |
+
// ----- Return
|
1277 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1278 |
+
return $v_result;
|
1279 |
+
}
|
1280 |
+
// --------------------------------------------------------------------------------
|
1281 |
+
|
1282 |
+
|
1283 |
+
|
1284 |
+
// --------------------------------------------------------------------------------
|
1285 |
+
// Function : errorCode()
|
1286 |
+
// Description :
|
1287 |
+
// Parameters :
|
1288 |
+
// --------------------------------------------------------------------------------
|
1289 |
+
function errorCode()
|
1290 |
+
{
|
1291 |
+
if (PCLZIP_ERROR_EXTERNAL == 1) {
|
1292 |
+
return(PclErrorCode());
|
1293 |
+
}
|
1294 |
+
else {
|
1295 |
+
return($this->error_code);
|
1296 |
+
}
|
1297 |
+
}
|
1298 |
+
// --------------------------------------------------------------------------------
|
1299 |
+
|
1300 |
+
// --------------------------------------------------------------------------------
|
1301 |
+
// Function : errorName()
|
1302 |
+
// Description :
|
1303 |
+
// Parameters :
|
1304 |
+
// --------------------------------------------------------------------------------
|
1305 |
+
function errorName($p_with_code=false)
|
1306 |
+
{
|
1307 |
+
$v_name = array ( PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR',
|
1308 |
+
PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL',
|
1309 |
+
PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL',
|
1310 |
+
PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER',
|
1311 |
+
PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE',
|
1312 |
+
PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG',
|
1313 |
+
PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP',
|
1314 |
+
PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE',
|
1315 |
+
PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL',
|
1316 |
+
PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION',
|
1317 |
+
PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT',
|
1318 |
+
PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL',
|
1319 |
+
PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL',
|
1320 |
+
PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM',
|
1321 |
+
PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP',
|
1322 |
+
PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE',
|
1323 |
+
PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE',
|
1324 |
+
PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION',
|
1325 |
+
PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION'
|
1326 |
+
,PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE'
|
1327 |
+
,PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION'
|
1328 |
+
);
|
1329 |
+
|
1330 |
+
if (isset($v_name[$this->error_code])) {
|
1331 |
+
$v_value = $v_name[$this->error_code];
|
1332 |
+
}
|
1333 |
+
else {
|
1334 |
+
$v_value = 'NoName';
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
if ($p_with_code) {
|
1338 |
+
return($v_value.' ('.$this->error_code.')');
|
1339 |
+
}
|
1340 |
+
else {
|
1341 |
+
return($v_value);
|
1342 |
+
}
|
1343 |
+
}
|
1344 |
+
// --------------------------------------------------------------------------------
|
1345 |
+
|
1346 |
+
// --------------------------------------------------------------------------------
|
1347 |
+
// Function : errorInfo()
|
1348 |
+
// Description :
|
1349 |
+
// Parameters :
|
1350 |
+
// --------------------------------------------------------------------------------
|
1351 |
+
function errorInfo($p_full=false)
|
1352 |
+
{
|
1353 |
+
if (PCLZIP_ERROR_EXTERNAL == 1) {
|
1354 |
+
return(PclErrorString());
|
1355 |
+
}
|
1356 |
+
else {
|
1357 |
+
if ($p_full) {
|
1358 |
+
return($this->errorName(true)." : ".$this->error_string);
|
1359 |
+
}
|
1360 |
+
else {
|
1361 |
+
return($this->error_string." [code ".$this->error_code."]");
|
1362 |
+
}
|
1363 |
+
}
|
1364 |
+
}
|
1365 |
+
// --------------------------------------------------------------------------------
|
1366 |
+
|
1367 |
+
|
1368 |
+
// --------------------------------------------------------------------------------
|
1369 |
+
// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS *****
|
1370 |
+
// ***** *****
|
1371 |
+
// ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY *****
|
1372 |
+
// --------------------------------------------------------------------------------
|
1373 |
+
|
1374 |
+
|
1375 |
+
|
1376 |
+
// --------------------------------------------------------------------------------
|
1377 |
+
// Function : privCheckFormat()
|
1378 |
+
// Description :
|
1379 |
+
// This method check that the archive exists and is a valid zip archive.
|
1380 |
+
// Several level of check exists. (futur)
|
1381 |
+
// Parameters :
|
1382 |
+
// $p_level : Level of check. Default 0.
|
1383 |
+
// 0 : Check the first bytes (magic codes) (default value))
|
1384 |
+
// 1 : 0 + Check the central directory (futur)
|
1385 |
+
// 2 : 1 + Check each file header (futur)
|
1386 |
+
// Return Values :
|
1387 |
+
// true on success,
|
1388 |
+
// false on error, the error code is set.
|
1389 |
+
// --------------------------------------------------------------------------------
|
1390 |
+
function privCheckFormat($p_level=0)
|
1391 |
+
{
|
1392 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFormat", "");
|
1393 |
+
$v_result = true;
|
1394 |
+
|
1395 |
+
// ----- Reset the file system cache
|
1396 |
+
clearstatcache();
|
1397 |
+
|
1398 |
+
// ----- Reset the error handler
|
1399 |
+
$this->privErrorReset();
|
1400 |
+
|
1401 |
+
// ----- Look if the file exits
|
1402 |
+
if (!is_file($this->zipname)) {
|
1403 |
+
// ----- Error log
|
1404 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '".$this->zipname."'");
|
1405 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
|
1406 |
+
return(false);
|
1407 |
+
}
|
1408 |
+
|
1409 |
+
// ----- Check that the file is readeable
|
1410 |
+
if (!is_readable($this->zipname)) {
|
1411 |
+
// ----- Error log
|
1412 |
+
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '".$this->zipname."'");
|
1413 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, false, PclZip::errorInfo());
|
1414 |
+
return(false);
|
1415 |
+
}
|
1416 |
+
|
1417 |
+
// ----- Check the magic code
|
1418 |
+
// TBC
|
1419 |
+
|
1420 |
+
// ----- Check the central header
|
1421 |
+
// TBC
|
1422 |
+
|
1423 |
+
// ----- Check each file header
|
1424 |
+
// TBC
|
1425 |
+
|
1426 |
+
// ----- Return
|
1427 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1428 |
+
return $v_result;
|
1429 |
+
}
|
1430 |
+
// --------------------------------------------------------------------------------
|
1431 |
+
|
1432 |
+
// --------------------------------------------------------------------------------
|
1433 |
+
// Function : privParseOptions()
|
1434 |
+
// Description :
|
1435 |
+
// This internal methods reads the variable list of arguments ($p_options_list,
|
1436 |
+
// $p_size) and generate an array with the options and values ($v_result_list).
|
1437 |
+
// $v_requested_options contains the options that can be present and those that
|
1438 |
+
// must be present.
|
1439 |
+
// $v_requested_options is an array, with the option value as key, and 'optional',
|
1440 |
+
// or 'mandatory' as value.
|
1441 |
+
// Parameters :
|
1442 |
+
// See above.
|
1443 |
+
// Return Values :
|
1444 |
+
// 1 on success.
|
1445 |
+
// 0 on failure.
|
1446 |
+
// --------------------------------------------------------------------------------
|
1447 |
+
function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options=false)
|
1448 |
+
{
|
1449 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privParseOptions", "");
|
1450 |
+
$v_result=1;
|
1451 |
+
|
1452 |
+
// ----- Read the options
|
1453 |
+
$i=0;
|
1454 |
+
while ($i<$p_size) {
|
1455 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Looking for table index $i, option = '".PclZipUtilOptionText($p_options_list[$i])."(".$p_options_list[$i].")'");
|
1456 |
+
|
1457 |
+
// ----- Check if the option is supported
|
1458 |
+
if (!isset($v_requested_options[$p_options_list[$i]])) {
|
1459 |
+
// ----- Error log
|
1460 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '".$p_options_list[$i]."' for this method");
|
1461 |
+
|
1462 |
+
// ----- Return
|
1463 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1464 |
+
return PclZip::errorCode();
|
1465 |
+
}
|
1466 |
+
|
1467 |
+
// ----- Look for next option
|
1468 |
+
switch ($p_options_list[$i]) {
|
1469 |
+
// ----- Look for options that request a path value
|
1470 |
+
case PCLZIP_OPT_PATH :
|
1471 |
+
case PCLZIP_OPT_REMOVE_PATH :
|
1472 |
+
case PCLZIP_OPT_ADD_PATH :
|
1473 |
+
// ----- Check the number of parameters
|
1474 |
+
if (($i+1) >= $p_size) {
|
1475 |
+
// ----- Error log
|
1476 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1477 |
+
|
1478 |
+
// ----- Return
|
1479 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1480 |
+
return PclZip::errorCode();
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
// ----- Get the value
|
1484 |
+
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
|
1485 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1486 |
+
$i++;
|
1487 |
+
break;
|
1488 |
+
|
1489 |
+
case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION :
|
1490 |
+
// ----- Check the number of parameters
|
1491 |
+
if (($i+1) >= $p_size) {
|
1492 |
+
// ----- Error log
|
1493 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1494 |
+
|
1495 |
+
// ----- Return
|
1496 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1497 |
+
return PclZip::errorCode();
|
1498 |
+
}
|
1499 |
+
|
1500 |
+
// ----- Get the value
|
1501 |
+
if ( is_string($p_options_list[$i+1])
|
1502 |
+
&& ($p_options_list[$i+1] != '')) {
|
1503 |
+
$v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i+1], false);
|
1504 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1505 |
+
$i++;
|
1506 |
+
}
|
1507 |
+
else {
|
1508 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." set with an empty value is ignored.");
|
1509 |
+
}
|
1510 |
+
break;
|
1511 |
+
|
1512 |
+
// ----- Look for options that request an array of string for value
|
1513 |
+
case PCLZIP_OPT_BY_NAME :
|
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 |
+
if (is_string($p_options_list[$i+1])) {
|
1526 |
+
$v_result_list[$p_options_list[$i]][0] = $p_options_list[$i+1];
|
1527 |
+
}
|
1528 |
+
else if (is_array($p_options_list[$i+1])) {
|
1529 |
+
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
|
1530 |
+
}
|
1531 |
+
else {
|
1532 |
+
// ----- Error log
|
1533 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1534 |
+
|
1535 |
+
// ----- Return
|
1536 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1537 |
+
return PclZip::errorCode();
|
1538 |
+
}
|
1539 |
+
////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1540 |
+
$i++;
|
1541 |
+
break;
|
1542 |
+
|
1543 |
+
// ----- Look for options that request an EREG or PREG expression
|
1544 |
+
case PCLZIP_OPT_BY_EREG :
|
1545 |
+
case PCLZIP_OPT_BY_PREG :
|
1546 |
+
//case PCLZIP_OPT_CRYPT :
|
1547 |
+
// ----- Check the number of parameters
|
1548 |
+
if (($i+1) >= $p_size) {
|
1549 |
+
// ----- Error log
|
1550 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1551 |
+
|
1552 |
+
// ----- Return
|
1553 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1554 |
+
return PclZip::errorCode();
|
1555 |
+
}
|
1556 |
+
|
1557 |
+
// ----- Get the value
|
1558 |
+
if (is_string($p_options_list[$i+1])) {
|
1559 |
+
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
|
1560 |
+
}
|
1561 |
+
else {
|
1562 |
+
// ----- Error log
|
1563 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1564 |
+
|
1565 |
+
// ----- Return
|
1566 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1567 |
+
return PclZip::errorCode();
|
1568 |
+
}
|
1569 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1570 |
+
$i++;
|
1571 |
+
break;
|
1572 |
+
|
1573 |
+
// ----- Look for options that takes a string
|
1574 |
+
case PCLZIP_OPT_COMMENT :
|
1575 |
+
case PCLZIP_OPT_ADD_COMMENT :
|
1576 |
+
case PCLZIP_OPT_PREPEND_COMMENT :
|
1577 |
+
// ----- Check the number of parameters
|
1578 |
+
if (($i+1) >= $p_size) {
|
1579 |
+
// ----- Error log
|
1580 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE,
|
1581 |
+
"Missing parameter value for option '"
|
1582 |
+
.PclZipUtilOptionText($p_options_list[$i])
|
1583 |
+
."'");
|
1584 |
+
|
1585 |
+
// ----- Return
|
1586 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1587 |
+
return PclZip::errorCode();
|
1588 |
+
}
|
1589 |
+
|
1590 |
+
// ----- Get the value
|
1591 |
+
if (is_string($p_options_list[$i+1])) {
|
1592 |
+
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
|
1593 |
+
}
|
1594 |
+
else {
|
1595 |
+
// ----- Error log
|
1596 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE,
|
1597 |
+
"Wrong parameter value for option '"
|
1598 |
+
.PclZipUtilOptionText($p_options_list[$i])
|
1599 |
+
."'");
|
1600 |
+
|
1601 |
+
// ----- Return
|
1602 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1603 |
+
return PclZip::errorCode();
|
1604 |
+
}
|
1605 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1606 |
+
$i++;
|
1607 |
+
break;
|
1608 |
+
|
1609 |
+
// ----- Look for options that request an array of index
|
1610 |
+
case PCLZIP_OPT_BY_INDEX :
|
1611 |
+
// ----- Check the number of parameters
|
1612 |
+
if (($i+1) >= $p_size) {
|
1613 |
+
// ----- Error log
|
1614 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1615 |
+
|
1616 |
+
// ----- Return
|
1617 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1618 |
+
return PclZip::errorCode();
|
1619 |
+
}
|
1620 |
+
|
1621 |
+
// ----- Get the value
|
1622 |
+
$v_work_list = array();
|
1623 |
+
if (is_string($p_options_list[$i+1])) {
|
1624 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is a string '".$p_options_list[$i+1]."'");
|
1625 |
+
|
1626 |
+
// ----- Remove spaces
|
1627 |
+
$p_options_list[$i+1] = strtr($p_options_list[$i+1], ' ', '');
|
1628 |
+
|
1629 |
+
// ----- Parse items
|
1630 |
+
$v_work_list = explode(",", $p_options_list[$i+1]);
|
1631 |
+
}
|
1632 |
+
else if (is_integer($p_options_list[$i+1])) {
|
1633 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an integer '".$p_options_list[$i+1]."'");
|
1634 |
+
$v_work_list[0] = $p_options_list[$i+1].'-'.$p_options_list[$i+1];
|
1635 |
+
}
|
1636 |
+
else if (is_array($p_options_list[$i+1])) {
|
1637 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Index value is an array");
|
1638 |
+
$v_work_list = $p_options_list[$i+1];
|
1639 |
+
}
|
1640 |
+
else {
|
1641 |
+
// ----- Error log
|
1642 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1643 |
+
|
1644 |
+
// ----- Return
|
1645 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1646 |
+
return PclZip::errorCode();
|
1647 |
+
}
|
1648 |
+
|
1649 |
+
// ----- Reduce the index list
|
1650 |
+
// each index item in the list must be a couple with a start and
|
1651 |
+
// an end value : [0,3], [5-5], [8-10], ...
|
1652 |
+
// ----- Check the format of each item
|
1653 |
+
$v_sort_flag=false;
|
1654 |
+
$v_sort_value=0;
|
1655 |
+
for ($j=0; $j<sizeof($v_work_list); $j++) {
|
1656 |
+
// ----- Explode the item
|
1657 |
+
$v_item_list = explode("-", $v_work_list[$j]);
|
1658 |
+
$v_size_item_list = sizeof($v_item_list);
|
1659 |
+
|
1660 |
+
// ----- TBC : Here we might check that each item is a
|
1661 |
+
// real integer ...
|
1662 |
+
|
1663 |
+
// ----- Look for single value
|
1664 |
+
if ($v_size_item_list == 1) {
|
1665 |
+
// ----- Set the option value
|
1666 |
+
$v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
|
1667 |
+
$v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0];
|
1668 |
+
}
|
1669 |
+
elseif ($v_size_item_list == 2) {
|
1670 |
+
// ----- Set the option value
|
1671 |
+
$v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0];
|
1672 |
+
$v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1];
|
1673 |
+
}
|
1674 |
+
else {
|
1675 |
+
// ----- Error log
|
1676 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1677 |
+
|
1678 |
+
// ----- Return
|
1679 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1680 |
+
return PclZip::errorCode();
|
1681 |
+
}
|
1682 |
+
|
1683 |
+
//--(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']."]");
|
1684 |
+
|
1685 |
+
// ----- Look for list sort
|
1686 |
+
if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) {
|
1687 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The list should be sorted ...");
|
1688 |
+
$v_sort_flag=true;
|
1689 |
+
|
1690 |
+
// ----- TBC : An automatic sort should be writen ...
|
1691 |
+
// ----- Error log
|
1692 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1693 |
+
|
1694 |
+
// ----- Return
|
1695 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1696 |
+
return PclZip::errorCode();
|
1697 |
+
}
|
1698 |
+
$v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start'];
|
1699 |
+
}
|
1700 |
+
|
1701 |
+
// ----- Sort the items
|
1702 |
+
if ($v_sort_flag) {
|
1703 |
+
// TBC : To Be Completed
|
1704 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "List sorting is not yet write ...");
|
1705 |
+
}
|
1706 |
+
|
1707 |
+
// ----- Next option
|
1708 |
+
$i++;
|
1709 |
+
break;
|
1710 |
+
|
1711 |
+
// ----- Look for options that request no value
|
1712 |
+
case PCLZIP_OPT_REMOVE_ALL_PATH :
|
1713 |
+
case PCLZIP_OPT_EXTRACT_AS_STRING :
|
1714 |
+
case PCLZIP_OPT_NO_COMPRESSION :
|
1715 |
+
case PCLZIP_OPT_EXTRACT_IN_OUTPUT :
|
1716 |
+
case PCLZIP_OPT_REPLACE_NEWER :
|
1717 |
+
case PCLZIP_OPT_STOP_ON_ERROR :
|
1718 |
+
$v_result_list[$p_options_list[$i]] = true;
|
1719 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1720 |
+
break;
|
1721 |
+
|
1722 |
+
// ----- Look for options that request an octal value
|
1723 |
+
case PCLZIP_OPT_SET_CHMOD :
|
1724 |
+
// ----- Check the number of parameters
|
1725 |
+
if (($i+1) >= $p_size) {
|
1726 |
+
// ----- Error log
|
1727 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1728 |
+
|
1729 |
+
// ----- Return
|
1730 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1731 |
+
return PclZip::errorCode();
|
1732 |
+
}
|
1733 |
+
|
1734 |
+
// ----- Get the value
|
1735 |
+
$v_result_list[$p_options_list[$i]] = $p_options_list[$i+1];
|
1736 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($p_options_list[$i])." = '".$v_result_list[$p_options_list[$i]]."'");
|
1737 |
+
$i++;
|
1738 |
+
break;
|
1739 |
+
|
1740 |
+
// ----- Look for options that request a call-back
|
1741 |
+
case PCLZIP_CB_PRE_EXTRACT :
|
1742 |
+
case PCLZIP_CB_POST_EXTRACT :
|
1743 |
+
case PCLZIP_CB_PRE_ADD :
|
1744 |
+
case PCLZIP_CB_POST_ADD :
|
1745 |
+
/* for futur use
|
1746 |
+
case PCLZIP_CB_PRE_DELETE :
|
1747 |
+
case PCLZIP_CB_POST_DELETE :
|
1748 |
+
case PCLZIP_CB_PRE_LIST :
|
1749 |
+
case PCLZIP_CB_POST_LIST :
|
1750 |
+
*/
|
1751 |
+
// ----- Check the number of parameters
|
1752 |
+
if (($i+1) >= $p_size) {
|
1753 |
+
// ----- Error log
|
1754 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1755 |
+
|
1756 |
+
// ----- Return
|
1757 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1758 |
+
return PclZip::errorCode();
|
1759 |
+
}
|
1760 |
+
|
1761 |
+
// ----- Get the value
|
1762 |
+
$v_function_name = $p_options_list[$i+1];
|
1763 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "call-back ".PclZipUtilOptionText($p_options_list[$i])." = '".$v_function_name."'");
|
1764 |
+
|
1765 |
+
// ----- Check that the value is a valid existing function
|
1766 |
+
if (!function_exists($v_function_name)) {
|
1767 |
+
// ----- Error log
|
1768 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '".$v_function_name."()' is not an existing function for option '".PclZipUtilOptionText($p_options_list[$i])."'");
|
1769 |
+
|
1770 |
+
// ----- Return
|
1771 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1772 |
+
return PclZip::errorCode();
|
1773 |
+
}
|
1774 |
+
|
1775 |
+
// ----- Set the attribute
|
1776 |
+
$v_result_list[$p_options_list[$i]] = $v_function_name;
|
1777 |
+
$i++;
|
1778 |
+
break;
|
1779 |
+
|
1780 |
+
default :
|
1781 |
+
// ----- Error log
|
1782 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
1783 |
+
"Unknown parameter '"
|
1784 |
+
.$p_options_list[$i]."'");
|
1785 |
+
|
1786 |
+
// ----- Return
|
1787 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1788 |
+
return PclZip::errorCode();
|
1789 |
+
}
|
1790 |
+
|
1791 |
+
// ----- Next options
|
1792 |
+
$i++;
|
1793 |
+
}
|
1794 |
+
|
1795 |
+
// ----- Look for mandatory options
|
1796 |
+
if ($v_requested_options !== false) {
|
1797 |
+
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
|
1798 |
+
// ----- Look for mandatory option
|
1799 |
+
if ($v_requested_options[$key] == 'mandatory') {
|
1800 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
|
1801 |
+
// ----- Look if present
|
1802 |
+
if (!isset($v_result_list[$key])) {
|
1803 |
+
// ----- Error log
|
1804 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
|
1805 |
+
|
1806 |
+
// ----- Return
|
1807 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1808 |
+
return PclZip::errorCode();
|
1809 |
+
}
|
1810 |
+
}
|
1811 |
+
}
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
// ----- Return
|
1815 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1816 |
+
return $v_result;
|
1817 |
+
}
|
1818 |
+
// --------------------------------------------------------------------------------
|
1819 |
+
|
1820 |
+
// --------------------------------------------------------------------------------
|
1821 |
+
// Function : privFileDescrParseAtt()
|
1822 |
+
// Description :
|
1823 |
+
// Parameters :
|
1824 |
+
// Return Values :
|
1825 |
+
// 1 on success.
|
1826 |
+
// 0 on failure.
|
1827 |
+
// --------------------------------------------------------------------------------
|
1828 |
+
function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options=false)
|
1829 |
+
{
|
1830 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrParseAtt", "");
|
1831 |
+
$v_result=1;
|
1832 |
+
|
1833 |
+
// ----- For each file in the list check the attributes
|
1834 |
+
foreach ($p_file_list as $v_key => $v_value) {
|
1835 |
+
|
1836 |
+
// ----- Check if the option is supported
|
1837 |
+
if (!isset($v_requested_options[$v_key])) {
|
1838 |
+
// ----- Error log
|
1839 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '".$v_key."' for this file");
|
1840 |
+
|
1841 |
+
// ----- Return
|
1842 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1843 |
+
return PclZip::errorCode();
|
1844 |
+
}
|
1845 |
+
|
1846 |
+
// ----- Look for attribute
|
1847 |
+
switch ($v_key) {
|
1848 |
+
case PCLZIP_ATT_FILE_NAME :
|
1849 |
+
if (!is_string($v_value)) {
|
1850 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
1851 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1852 |
+
return PclZip::errorCode();
|
1853 |
+
}
|
1854 |
+
|
1855 |
+
$p_filedescr['filename'] = PclZipUtilPathReduction($v_value);
|
1856 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
1857 |
+
|
1858 |
+
if ($p_filedescr['filename'] == '') {
|
1859 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
1860 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1861 |
+
return PclZip::errorCode();
|
1862 |
+
}
|
1863 |
+
|
1864 |
+
break;
|
1865 |
+
|
1866 |
+
case PCLZIP_ATT_FILE_NEW_SHORT_NAME :
|
1867 |
+
if (!is_string($v_value)) {
|
1868 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
1869 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1870 |
+
return PclZip::errorCode();
|
1871 |
+
}
|
1872 |
+
|
1873 |
+
$p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value);
|
1874 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
1875 |
+
|
1876 |
+
if ($p_filedescr['new_short_name'] == '') {
|
1877 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
1878 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1879 |
+
return PclZip::errorCode();
|
1880 |
+
}
|
1881 |
+
break;
|
1882 |
+
|
1883 |
+
case PCLZIP_ATT_FILE_NEW_FULL_NAME :
|
1884 |
+
if (!is_string($v_value)) {
|
1885 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type ".gettype($v_value).". String expected for attribute '".PclZipUtilOptionText($v_key)."'");
|
1886 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1887 |
+
return PclZip::errorCode();
|
1888 |
+
}
|
1889 |
+
|
1890 |
+
$p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value);
|
1891 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "".PclZipUtilOptionText($v_key)." = '".$v_value."'");
|
1892 |
+
|
1893 |
+
if ($p_filedescr['new_full_name'] == '') {
|
1894 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '".PclZipUtilOptionText($v_key)."'");
|
1895 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1896 |
+
return PclZip::errorCode();
|
1897 |
+
}
|
1898 |
+
break;
|
1899 |
+
|
1900 |
+
default :
|
1901 |
+
// ----- Error log
|
1902 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER,
|
1903 |
+
"Unknown parameter '".$v_key."'");
|
1904 |
+
|
1905 |
+
// ----- Return
|
1906 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1907 |
+
return PclZip::errorCode();
|
1908 |
+
}
|
1909 |
+
|
1910 |
+
// ----- Look for mandatory options
|
1911 |
+
if ($v_requested_options !== false) {
|
1912 |
+
for ($key=reset($v_requested_options); $key=key($v_requested_options); $key=next($v_requested_options)) {
|
1913 |
+
// ----- Look for mandatory option
|
1914 |
+
if ($v_requested_options[$key] == 'mandatory') {
|
1915 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Detect a mandatory option : ".PclZipUtilOptionText($key)."(".$key.")");
|
1916 |
+
// ----- Look if present
|
1917 |
+
if (!isset($p_file_list[$key])) {
|
1918 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter ".PclZipUtilOptionText($key)."(".$key.")");
|
1919 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1920 |
+
return PclZip::errorCode();
|
1921 |
+
}
|
1922 |
+
}
|
1923 |
+
}
|
1924 |
+
}
|
1925 |
+
|
1926 |
+
// end foreach
|
1927 |
+
}
|
1928 |
+
|
1929 |
+
// ----- Return
|
1930 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
1931 |
+
return $v_result;
|
1932 |
+
}
|
1933 |
+
// --------------------------------------------------------------------------------
|
1934 |
+
|
1935 |
+
// --------------------------------------------------------------------------------
|
1936 |
+
// Function : privFileDescrExpand()
|
1937 |
+
// Description :
|
1938 |
+
// Parameters :
|
1939 |
+
// Return Values :
|
1940 |
+
// 1 on success.
|
1941 |
+
// 0 on failure.
|
1942 |
+
// --------------------------------------------------------------------------------
|
1943 |
+
function privFileDescrExpand(&$p_filedescr_list, &$p_options)
|
1944 |
+
{
|
1945 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privFileDescrExpand", "");
|
1946 |
+
$v_result=1;
|
1947 |
+
|
1948 |
+
// ----- Create a result list
|
1949 |
+
$v_result_list = array();
|
1950 |
+
|
1951 |
+
// ----- Look each entry
|
1952 |
+
for ($i=0; $i<sizeof($p_filedescr_list); $i++) {
|
1953 |
+
// ----- Get filedescr
|
1954 |
+
$v_descr = $p_filedescr_list[$i];
|
1955 |
+
|
1956 |
+
// ----- Reduce the filename
|
1957 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr before reduction :'".$v_descr['filename']."'");
|
1958 |
+
$v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename']);
|
1959 |
+
$v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']);
|
1960 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filedescr after reduction :'".$v_descr['filename']."'");
|
1961 |
+
|
1962 |
+
// ----- Get type of descr
|
1963 |
+
if (!file_exists($v_descr['filename'])) {
|
1964 |
+
// ----- Error log
|
1965 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_descr['filename']."' does not exists");
|
1966 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$v_descr['filename']."' does not exists");
|
1967 |
+
|
1968 |
+
// ----- Return
|
1969 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
1970 |
+
return PclZip::errorCode();
|
1971 |
+
}
|
1972 |
+
if (@is_file($v_descr['filename'])) {
|
1973 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a file");
|
1974 |
+
$v_descr['type'] = 'file';
|
1975 |
+
}
|
1976 |
+
else if (@is_dir($v_descr['filename'])) {
|
1977 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "This is a folder");
|
1978 |
+
$v_descr['type'] = 'folder';
|
1979 |
+
}
|
1980 |
+
else if (@is_link($v_descr['filename'])) {
|
1981 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : link");
|
1982 |
+
// skip
|
1983 |
+
continue;
|
1984 |
+
}
|
1985 |
+
else {
|
1986 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Unsupported file type : unknown type");
|
1987 |
+
// skip
|
1988 |
+
continue;
|
1989 |
+
}
|
1990 |
+
|
1991 |
+
// ----- Calculate the stored filename
|
1992 |
+
$this->privCalculateStoredFilename($v_descr, $p_options);
|
1993 |
+
|
1994 |
+
// ----- Add the descriptor in result list
|
1995 |
+
$v_result_list[sizeof($v_result_list)] = $v_descr;
|
1996 |
+
|
1997 |
+
// ----- Look for folder
|
1998 |
+
if ($v_descr['type'] == 'folder') {
|
1999 |
+
// ----- List of items in folder
|
2000 |
+
$v_dirlist_descr = array();
|
2001 |
+
$v_dirlist_nb = 0;
|
2002 |
+
if ($v_folder_handler = @opendir($v_descr['filename'])) {
|
2003 |
+
while (($v_item_handler = @readdir($v_folder_handler)) !== false) {
|
2004 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for '".$v_item_handler."' in the directory");
|
2005 |
+
|
2006 |
+
// ----- Skip '.' and '..'
|
2007 |
+
if (($v_item_handler == '.') || ($v_item_handler == '..')) {
|
2008 |
+
continue;
|
2009 |
+
}
|
2010 |
+
|
2011 |
+
// ----- Compose the full filename
|
2012 |
+
$v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'].'/'.$v_item_handler;
|
2013 |
+
|
2014 |
+
// ----- Look for different stored filename
|
2015 |
+
// Because the name of the folder was changed, the name of the
|
2016 |
+
// files/sub-folders also change
|
2017 |
+
if ($v_descr['stored_filename'] != $v_descr['filename']) {
|
2018 |
+
$v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'].'/'.$v_item_handler;
|
2019 |
+
}
|
2020 |
+
|
2021 |
+
$v_dirlist_nb++;
|
2022 |
+
}
|
2023 |
+
}
|
2024 |
+
else {
|
2025 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to open dir '".$v_descr['filename']."' in read mode. Skipped.");
|
2026 |
+
// TBC : unable to open folder in read mode
|
2027 |
+
}
|
2028 |
+
|
2029 |
+
// ----- Expand each element of the list
|
2030 |
+
if ($v_dirlist_nb != 0) {
|
2031 |
+
// ----- Expand
|
2032 |
+
if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) {
|
2033 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2034 |
+
return $v_result;
|
2035 |
+
}
|
2036 |
+
|
2037 |
+
// ----- Concat the resulting list
|
2038 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Merging result list (size '".sizeof($v_result_list)."') with dirlist (size '".sizeof($v_dirlist_descr)."')");
|
2039 |
+
$v_result_list = array_merge($v_result_list, $v_dirlist_descr);
|
2040 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "merged result list is size '".sizeof($v_result_list)."'");
|
2041 |
+
}
|
2042 |
+
else {
|
2043 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Nothing in this folder to expand.");
|
2044 |
+
}
|
2045 |
+
|
2046 |
+
// ----- Free local array
|
2047 |
+
unset($v_dirlist_descr);
|
2048 |
+
}
|
2049 |
+
}
|
2050 |
+
|
2051 |
+
// ----- Get the result list
|
2052 |
+
$p_filedescr_list = $v_result_list;
|
2053 |
+
|
2054 |
+
// ----- Return
|
2055 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2056 |
+
return $v_result;
|
2057 |
+
}
|
2058 |
+
// --------------------------------------------------------------------------------
|
2059 |
+
|
2060 |
+
// --------------------------------------------------------------------------------
|
2061 |
+
// Function : privCreate()
|
2062 |
+
// Description :
|
2063 |
+
// Parameters :
|
2064 |
+
// Return Values :
|
2065 |
+
// --------------------------------------------------------------------------------
|
2066 |
+
function privCreate($p_filedescr_list, &$p_result_list, &$p_options)
|
2067 |
+
{
|
2068 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list");
|
2069 |
+
$v_result=1;
|
2070 |
+
$v_list_detail = array();
|
2071 |
+
|
2072 |
+
// ----- Magic quotes trick
|
2073 |
+
$this->privDisableMagicQuotes();
|
2074 |
+
|
2075 |
+
// ----- Open the file in write mode
|
2076 |
+
if (($v_result = $this->privOpenFd('wb')) != 1)
|
2077 |
+
{
|
2078 |
+
// ----- Return
|
2079 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2080 |
+
return $v_result;
|
2081 |
+
}
|
2082 |
+
|
2083 |
+
// ----- Add the list of files
|
2084 |
+
$v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options);
|
2085 |
+
|
2086 |
+
// ----- Close
|
2087 |
+
$this->privCloseFd();
|
2088 |
+
|
2089 |
+
// ----- Magic quotes trick
|
2090 |
+
$this->privSwapBackMagicQuotes();
|
2091 |
+
|
2092 |
+
// ----- Return
|
2093 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2094 |
+
return $v_result;
|
2095 |
+
}
|
2096 |
+
// --------------------------------------------------------------------------------
|
2097 |
+
|
2098 |
+
// --------------------------------------------------------------------------------
|
2099 |
+
// Function : privAdd()
|
2100 |
+
// Description :
|
2101 |
+
// Parameters :
|
2102 |
+
// Return Values :
|
2103 |
+
// --------------------------------------------------------------------------------
|
2104 |
+
function privAdd($p_filedescr_list, &$p_result_list, &$p_options)
|
2105 |
+
{
|
2106 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAdd", "list");
|
2107 |
+
$v_result=1;
|
2108 |
+
$v_list_detail = array();
|
2109 |
+
|
2110 |
+
// ----- Look if the archive exists or is empty
|
2111 |
+
if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0))
|
2112 |
+
{
|
2113 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, or is empty, create it.");
|
2114 |
+
|
2115 |
+
// ----- Do a create
|
2116 |
+
$v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options);
|
2117 |
+
|
2118 |
+
// ----- Return
|
2119 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2120 |
+
return $v_result;
|
2121 |
+
}
|
2122 |
+
// ----- Magic quotes trick
|
2123 |
+
$this->privDisableMagicQuotes();
|
2124 |
+
|
2125 |
+
// ----- Open the zip file
|
2126 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
2127 |
+
if (($v_result=$this->privOpenFd('rb')) != 1)
|
2128 |
+
{
|
2129 |
+
// ----- Magic quotes trick
|
2130 |
+
$this->privSwapBackMagicQuotes();
|
2131 |
+
|
2132 |
+
// ----- Return
|
2133 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2134 |
+
return $v_result;
|
2135 |
+
}
|
2136 |
+
|
2137 |
+
// ----- Read the central directory informations
|
2138 |
+
$v_central_dir = array();
|
2139 |
+
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
2140 |
+
{
|
2141 |
+
$this->privCloseFd();
|
2142 |
+
$this->privSwapBackMagicQuotes();
|
2143 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2144 |
+
return $v_result;
|
2145 |
+
}
|
2146 |
+
|
2147 |
+
// ----- Go to beginning of File
|
2148 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
2149 |
+
@rewind($this->zip_fd);
|
2150 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
2151 |
+
|
2152 |
+
// ----- Creates a temporay file
|
2153 |
+
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
|
2154 |
+
|
2155 |
+
// ----- Open the temporary file in write mode
|
2156 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
2157 |
+
if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
|
2158 |
+
{
|
2159 |
+
$this->privCloseFd();
|
2160 |
+
$this->privSwapBackMagicQuotes();
|
2161 |
+
|
2162 |
+
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
|
2163 |
+
|
2164 |
+
// ----- Return
|
2165 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2166 |
+
return PclZip::errorCode();
|
2167 |
+
}
|
2168 |
+
|
2169 |
+
// ----- Copy the files from the archive to the temporary file
|
2170 |
+
// TBC : Here I should better append the file and go back to erase the central dir
|
2171 |
+
$v_size = $v_central_dir['offset'];
|
2172 |
+
while ($v_size != 0)
|
2173 |
+
{
|
2174 |
+
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
2175 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
2176 |
+
$v_buffer = fread($this->zip_fd, $v_read_size);
|
2177 |
+
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
2178 |
+
$v_size -= $v_read_size;
|
2179 |
+
}
|
2180 |
+
|
2181 |
+
// ----- Swap the file descriptor
|
2182 |
+
// Here is a trick : I swap the temporary fd with the zip fd, in order to use
|
2183 |
+
// the following methods on the temporary fil and not the real archive
|
2184 |
+
$v_swap = $this->zip_fd;
|
2185 |
+
$this->zip_fd = $v_zip_temp_fd;
|
2186 |
+
$v_zip_temp_fd = $v_swap;
|
2187 |
+
|
2188 |
+
// ----- Add the files
|
2189 |
+
$v_header_list = array();
|
2190 |
+
if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
|
2191 |
+
{
|
2192 |
+
fclose($v_zip_temp_fd);
|
2193 |
+
$this->privCloseFd();
|
2194 |
+
@unlink($v_zip_temp_name);
|
2195 |
+
$this->privSwapBackMagicQuotes();
|
2196 |
+
|
2197 |
+
// ----- Return
|
2198 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2199 |
+
return $v_result;
|
2200 |
+
}
|
2201 |
+
|
2202 |
+
// ----- Store the offset of the central dir
|
2203 |
+
$v_offset = @ftell($this->zip_fd);
|
2204 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
|
2205 |
+
|
2206 |
+
// ----- Copy the block of file headers from the old archive
|
2207 |
+
$v_size = $v_central_dir['size'];
|
2208 |
+
while ($v_size != 0)
|
2209 |
+
{
|
2210 |
+
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
2211 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
2212 |
+
$v_buffer = @fread($v_zip_temp_fd, $v_read_size);
|
2213 |
+
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
|
2214 |
+
$v_size -= $v_read_size;
|
2215 |
+
}
|
2216 |
+
|
2217 |
+
// ----- Create the Central Dir files header
|
2218 |
+
for ($i=0, $v_count=0; $i<sizeof($v_header_list); $i++)
|
2219 |
+
{
|
2220 |
+
// ----- Create the file header
|
2221 |
+
if ($v_header_list[$i]['status'] == 'ok') {
|
2222 |
+
if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
|
2223 |
+
fclose($v_zip_temp_fd);
|
2224 |
+
$this->privCloseFd();
|
2225 |
+
@unlink($v_zip_temp_name);
|
2226 |
+
$this->privSwapBackMagicQuotes();
|
2227 |
+
|
2228 |
+
// ----- Return
|
2229 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2230 |
+
return $v_result;
|
2231 |
+
}
|
2232 |
+
$v_count++;
|
2233 |
+
}
|
2234 |
+
|
2235 |
+
// ----- Transform the header to a 'usable' info
|
2236 |
+
$this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
|
2237 |
+
}
|
2238 |
+
|
2239 |
+
// ----- Zip file comment
|
2240 |
+
$v_comment = $v_central_dir['comment'];
|
2241 |
+
if (isset($p_options[PCLZIP_OPT_COMMENT])) {
|
2242 |
+
$v_comment = $p_options[PCLZIP_OPT_COMMENT];
|
2243 |
+
}
|
2244 |
+
if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) {
|
2245 |
+
$v_comment = $v_comment.$p_options[PCLZIP_OPT_ADD_COMMENT];
|
2246 |
+
}
|
2247 |
+
if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) {
|
2248 |
+
$v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT].$v_comment;
|
2249 |
+
}
|
2250 |
+
|
2251 |
+
// ----- Calculate the size of the central header
|
2252 |
+
$v_size = @ftell($this->zip_fd)-$v_offset;
|
2253 |
+
|
2254 |
+
// ----- Create the central dir footer
|
2255 |
+
if (($v_result = $this->privWriteCentralHeader($v_count+$v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1)
|
2256 |
+
{
|
2257 |
+
// ----- Reset the file list
|
2258 |
+
unset($v_header_list);
|
2259 |
+
$this->privSwapBackMagicQuotes();
|
2260 |
+
|
2261 |
+
// ----- Return
|
2262 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2263 |
+
return $v_result;
|
2264 |
+
}
|
2265 |
+
|
2266 |
+
// ----- Swap back the file descriptor
|
2267 |
+
$v_swap = $this->zip_fd;
|
2268 |
+
$this->zip_fd = $v_zip_temp_fd;
|
2269 |
+
$v_zip_temp_fd = $v_swap;
|
2270 |
+
|
2271 |
+
// ----- Close
|
2272 |
+
$this->privCloseFd();
|
2273 |
+
|
2274 |
+
// ----- Close the temporary file
|
2275 |
+
@fclose($v_zip_temp_fd);
|
2276 |
+
|
2277 |
+
// ----- Magic quotes trick
|
2278 |
+
$this->privSwapBackMagicQuotes();
|
2279 |
+
|
2280 |
+
// ----- Delete the zip file
|
2281 |
+
// TBC : I should test the result ...
|
2282 |
+
@unlink($this->zipname);
|
2283 |
+
|
2284 |
+
// ----- Rename the temporary file
|
2285 |
+
// TBC : I should test the result ...
|
2286 |
+
//@rename($v_zip_temp_name, $this->zipname);
|
2287 |
+
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
2288 |
+
|
2289 |
+
// ----- Return
|
2290 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2291 |
+
return $v_result;
|
2292 |
+
}
|
2293 |
+
// --------------------------------------------------------------------------------
|
2294 |
+
|
2295 |
+
// --------------------------------------------------------------------------------
|
2296 |
+
// Function : privOpenFd()
|
2297 |
+
// Description :
|
2298 |
+
// Parameters :
|
2299 |
+
// --------------------------------------------------------------------------------
|
2300 |
+
function privOpenFd($p_mode)
|
2301 |
+
{
|
2302 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privOpenFd", 'mode='.$p_mode);
|
2303 |
+
$v_result=1;
|
2304 |
+
|
2305 |
+
// ----- Look if already open
|
2306 |
+
if ($this->zip_fd != 0)
|
2307 |
+
{
|
2308 |
+
// ----- Error log
|
2309 |
+
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \''.$this->zipname.'\' already open');
|
2310 |
+
|
2311 |
+
// ----- Return
|
2312 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2313 |
+
return PclZip::errorCode();
|
2314 |
+
}
|
2315 |
+
|
2316 |
+
// ----- Open the zip file
|
2317 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Open file in '.$p_mode.' mode');
|
2318 |
+
if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0)
|
2319 |
+
{
|
2320 |
+
// ----- Error log
|
2321 |
+
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in '.$p_mode.' mode');
|
2322 |
+
|
2323 |
+
// ----- Return
|
2324 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2325 |
+
return PclZip::errorCode();
|
2326 |
+
}
|
2327 |
+
|
2328 |
+
// ----- Return
|
2329 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2330 |
+
return $v_result;
|
2331 |
+
}
|
2332 |
+
// --------------------------------------------------------------------------------
|
2333 |
+
|
2334 |
+
// --------------------------------------------------------------------------------
|
2335 |
+
// Function : privCloseFd()
|
2336 |
+
// Description :
|
2337 |
+
// Parameters :
|
2338 |
+
// --------------------------------------------------------------------------------
|
2339 |
+
function privCloseFd()
|
2340 |
+
{
|
2341 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCloseFd", "");
|
2342 |
+
$v_result=1;
|
2343 |
+
|
2344 |
+
if ($this->zip_fd != 0)
|
2345 |
+
@fclose($this->zip_fd);
|
2346 |
+
$this->zip_fd = 0;
|
2347 |
+
|
2348 |
+
// ----- Return
|
2349 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2350 |
+
return $v_result;
|
2351 |
+
}
|
2352 |
+
// --------------------------------------------------------------------------------
|
2353 |
+
|
2354 |
+
// --------------------------------------------------------------------------------
|
2355 |
+
// Function : privAddList()
|
2356 |
+
// Description :
|
2357 |
+
// $p_add_dir and $p_remove_dir will give the ability to memorize a path which is
|
2358 |
+
// different from the real path of the file. This is usefull if you want to have PclTar
|
2359 |
+
// running in any directory, and memorize relative path from an other directory.
|
2360 |
+
// Parameters :
|
2361 |
+
// $p_list : An array containing the file or directory names to add in the tar
|
2362 |
+
// $p_result_list : list of added files with their properties (specially the status field)
|
2363 |
+
// $p_add_dir : Path to add in the filename path archived
|
2364 |
+
// $p_remove_dir : Path to remove in the filename path archived
|
2365 |
+
// Return Values :
|
2366 |
+
// --------------------------------------------------------------------------------
|
2367 |
+
// function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)
|
2368 |
+
function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
|
2369 |
+
{
|
2370 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddList", "list");
|
2371 |
+
$v_result=1;
|
2372 |
+
|
2373 |
+
// ----- Add the files
|
2374 |
+
$v_header_list = array();
|
2375 |
+
if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
|
2376 |
+
{
|
2377 |
+
// ----- Return
|
2378 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2379 |
+
return $v_result;
|
2380 |
+
}
|
2381 |
+
|
2382 |
+
// ----- Store the offset of the central dir
|
2383 |
+
$v_offset = @ftell($this->zip_fd);
|
2384 |
+
|
2385 |
+
// ----- Create the Central Dir files header
|
2386 |
+
for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
|
2387 |
+
{
|
2388 |
+
// ----- Create the file header
|
2389 |
+
if ($v_header_list[$i]['status'] == 'ok') {
|
2390 |
+
if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
|
2391 |
+
// ----- Return
|
2392 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2393 |
+
return $v_result;
|
2394 |
+
}
|
2395 |
+
$v_count++;
|
2396 |
+
}
|
2397 |
+
|
2398 |
+
// ----- Transform the header to a 'usable' info
|
2399 |
+
$this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
|
2400 |
+
}
|
2401 |
+
|
2402 |
+
// ----- Zip file comment
|
2403 |
+
$v_comment = '';
|
2404 |
+
if (isset($p_options[PCLZIP_OPT_COMMENT])) {
|
2405 |
+
$v_comment = $p_options[PCLZIP_OPT_COMMENT];
|
2406 |
+
}
|
2407 |
+
|
2408 |
+
// ----- Calculate the size of the central header
|
2409 |
+
$v_size = @ftell($this->zip_fd)-$v_offset;
|
2410 |
+
|
2411 |
+
// ----- Create the central dir footer
|
2412 |
+
if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)
|
2413 |
+
{
|
2414 |
+
// ----- Reset the file list
|
2415 |
+
unset($v_header_list);
|
2416 |
+
|
2417 |
+
// ----- Return
|
2418 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2419 |
+
return $v_result;
|
2420 |
+
}
|
2421 |
+
|
2422 |
+
// ----- Return
|
2423 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2424 |
+
return $v_result;
|
2425 |
+
}
|
2426 |
+
// --------------------------------------------------------------------------------
|
2427 |
+
|
2428 |
+
// --------------------------------------------------------------------------------
|
2429 |
+
// Function : privAddFileList()
|
2430 |
+
// Description :
|
2431 |
+
// Parameters :
|
2432 |
+
// $p_filedescr_list : An array containing the file description
|
2433 |
+
// or directory names to add in the zip
|
2434 |
+
// $p_result_list : list of added files with their properties (specially the status field)
|
2435 |
+
// Return Values :
|
2436 |
+
// --------------------------------------------------------------------------------
|
2437 |
+
function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options)
|
2438 |
+
{
|
2439 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "filedescr_list");
|
2440 |
+
$v_result=1;
|
2441 |
+
$v_header = array();
|
2442 |
+
|
2443 |
+
// ----- Recuperate the current number of elt in list
|
2444 |
+
$v_nb = sizeof($p_result_list);
|
2445 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Before add, list have ".$v_nb." elements");
|
2446 |
+
|
2447 |
+
// ----- Loop on the files
|
2448 |
+
for ($j=0; ($j<sizeof($p_filedescr_list)) && ($v_result==1); $j++) {
|
2449 |
+
// ----- Format the filename
|
2450 |
+
$p_filedescr_list[$j]['filename']
|
2451 |
+
= PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false);
|
2452 |
+
|
2453 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for file '".$p_filedescr_list[$j]['filename']."'");
|
2454 |
+
|
2455 |
+
// ----- Skip empty file names
|
2456 |
+
// TBC : Can this be possible ? not checked in DescrParseAtt ?
|
2457 |
+
if ($p_filedescr_list[$j]['filename'] == "") {
|
2458 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Skip empty filename");
|
2459 |
+
continue;
|
2460 |
+
}
|
2461 |
+
|
2462 |
+
// ----- Check the filename
|
2463 |
+
if (!file_exists($p_filedescr_list[$j]['filename'])) {
|
2464 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
|
2465 |
+
PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '".$p_filedescr_list[$j]['filename']."' does not exists");
|
2466 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2467 |
+
return PclZip::errorCode();
|
2468 |
+
}
|
2469 |
+
|
2470 |
+
// ----- Look if it is a file or a dir with no all path remove option
|
2471 |
+
if ( (is_file($p_filedescr_list[$j]['filename']))
|
2472 |
+
|| ( is_dir($p_filedescr_list[$j]['filename'])
|
2473 |
+
&& ( !isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])
|
2474 |
+
|| !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) {
|
2475 |
+
|
2476 |
+
// ----- Add the file
|
2477 |
+
$v_result = $this->privAddFile($p_filedescr_list[$j], $v_header,
|
2478 |
+
$p_options);
|
2479 |
+
if ($v_result != 1) {
|
2480 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2481 |
+
return $v_result;
|
2482 |
+
}
|
2483 |
+
|
2484 |
+
// ----- Store the file infos
|
2485 |
+
$p_result_list[$v_nb++] = $v_header;
|
2486 |
+
}
|
2487 |
+
}
|
2488 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "After add, list have ".$v_nb." elements");
|
2489 |
+
|
2490 |
+
// ----- Return
|
2491 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2492 |
+
return $v_result;
|
2493 |
+
}
|
2494 |
+
// --------------------------------------------------------------------------------
|
2495 |
+
|
2496 |
+
// --------------------------------------------------------------------------------
|
2497 |
+
// Function : privAddFile()
|
2498 |
+
// Description :
|
2499 |
+
// Parameters :
|
2500 |
+
// Return Values :
|
2501 |
+
// --------------------------------------------------------------------------------
|
2502 |
+
function privAddFile($p_filedescr, &$p_header, &$p_options)
|
2503 |
+
{
|
2504 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='".$p_filedescr['filename']."'");
|
2505 |
+
$v_result=1;
|
2506 |
+
|
2507 |
+
// ----- Working variable
|
2508 |
+
$p_filename = $p_filedescr['filename'];
|
2509 |
+
|
2510 |
+
// TBC : Already done in the fileAtt check ... ?
|
2511 |
+
if ($p_filename == "") {
|
2512 |
+
// ----- Error log
|
2513 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)");
|
2514 |
+
|
2515 |
+
// ----- Return
|
2516 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2517 |
+
return PclZip::errorCode();
|
2518 |
+
}
|
2519 |
+
|
2520 |
+
// ----- Look for a stored different filename
|
2521 |
+
if (isset($p_filedescr['stored_filename'])) {
|
2522 |
+
$v_stored_filename = $p_filedescr['stored_filename'];
|
2523 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is NOT the same "'.$v_stored_filename.'"');
|
2524 |
+
}
|
2525 |
+
else {
|
2526 |
+
$v_stored_filename = $p_filedescr['stored_filename'];
|
2527 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'Stored filename is the same');
|
2528 |
+
}
|
2529 |
+
|
2530 |
+
// ----- Set the file properties
|
2531 |
+
clearstatcache();
|
2532 |
+
$p_header['version'] = 20;
|
2533 |
+
$p_header['version_extracted'] = 10;
|
2534 |
+
$p_header['flag'] = 0;
|
2535 |
+
$p_header['compression'] = 0;
|
2536 |
+
$p_header['mtime'] = filemtime($p_filename);
|
2537 |
+
$p_header['crc'] = 0;
|
2538 |
+
$p_header['compressed_size'] = 0;
|
2539 |
+
$p_header['size'] = filesize($p_filename);
|
2540 |
+
$p_header['filename_len'] = strlen($p_filename);
|
2541 |
+
$p_header['extra_len'] = 0;
|
2542 |
+
$p_header['comment_len'] = 0;
|
2543 |
+
$p_header['disk'] = 0;
|
2544 |
+
$p_header['internal'] = 0;
|
2545 |
+
// $p_header['external'] = (is_file($p_filename)?0xFE49FFE0:0x41FF0010);
|
2546 |
+
$p_header['external'] = (is_file($p_filename)?0x00000000:0x00000010);
|
2547 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header external extension '".sprintf("0x%X",$p_header['external'])."'");
|
2548 |
+
$p_header['offset'] = 0;
|
2549 |
+
$p_header['filename'] = $p_filename;
|
2550 |
+
$p_header['stored_filename'] = $v_stored_filename;
|
2551 |
+
$p_header['extra'] = '';
|
2552 |
+
$p_header['comment'] = '';
|
2553 |
+
$p_header['status'] = 'ok';
|
2554 |
+
$p_header['index'] = -1;
|
2555 |
+
|
2556 |
+
// ----- Look for pre-add callback
|
2557 |
+
if (isset($p_options[PCLZIP_CB_PRE_ADD])) {
|
2558 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_ADD]."()') is defined for the extraction");
|
2559 |
+
|
2560 |
+
// ----- Generate a local information
|
2561 |
+
$v_local_header = array();
|
2562 |
+
$this->privConvertHeader2FileInfo($p_header, $v_local_header);
|
2563 |
+
|
2564 |
+
// ----- Call the callback
|
2565 |
+
// Here I do not use call_user_func() because I need to send a reference to the
|
2566 |
+
// header.
|
2567 |
+
eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);');
|
2568 |
+
if ($v_result == 0) {
|
2569 |
+
// ----- Change the file status
|
2570 |
+
$p_header['status'] = "skipped";
|
2571 |
+
$v_result = 1;
|
2572 |
+
}
|
2573 |
+
|
2574 |
+
// ----- Update the informations
|
2575 |
+
// Only some fields can be modified
|
2576 |
+
if ($p_header['stored_filename'] != $v_local_header['stored_filename']) {
|
2577 |
+
$p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']);
|
2578 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New stored filename is '".$p_header['stored_filename']."'");
|
2579 |
+
}
|
2580 |
+
}
|
2581 |
+
|
2582 |
+
// ----- Look for empty stored filename
|
2583 |
+
if ($p_header['stored_filename'] == "") {
|
2584 |
+
$p_header['status'] = "filtered";
|
2585 |
+
}
|
2586 |
+
|
2587 |
+
// ----- Check the path length
|
2588 |
+
if (strlen($p_header['stored_filename']) > 0xFF) {
|
2589 |
+
$p_header['status'] = 'filename_too_long';
|
2590 |
+
}
|
2591 |
+
|
2592 |
+
// ----- Look if no error, or file not skipped
|
2593 |
+
if ($p_header['status'] == 'ok') {
|
2594 |
+
|
2595 |
+
// ----- Look for a file
|
2596 |
+
if (is_file($p_filename))
|
2597 |
+
{
|
2598 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a file");
|
2599 |
+
// ----- Open the source file
|
2600 |
+
if (($v_file = @fopen($p_filename, "rb")) == 0) {
|
2601 |
+
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
|
2602 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
2603 |
+
return PclZip::errorCode();
|
2604 |
+
}
|
2605 |
+
|
2606 |
+
if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) {
|
2607 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be compressed");
|
2608 |
+
// ----- Read the file content
|
2609 |
+
$v_content_compressed = @fread($v_file, $p_header['size']);
|
2610 |
+
|
2611 |
+
// ----- Calculate the CRC
|
2612 |
+
$p_header['crc'] = @crc32($v_content_compressed);
|
2613 |
+
|
2614 |
+
// ----- Set header parameters
|
2615 |
+
$p_header['compressed_size'] = $p_header['size'];
|
2616 |
+
$p_header['compression'] = 0;
|
2617 |
+
}
|
2618 |
+
else {
|
2619 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will be compressed");
|
2620 |
+
// ----- Read the file content
|
2621 |
+
$v_content = @fread($v_file, $p_header['size']);
|
2622 |
+
|
2623 |
+
// ----- Calculate the CRC
|
2624 |
+
$p_header['crc'] = @crc32($v_content);
|
2625 |
+
|
2626 |
+
// ----- Compress the file
|
2627 |
+
$v_content_compressed = @gzdeflate($v_content);
|
2628 |
+
|
2629 |
+
// ----- Set header parameters
|
2630 |
+
$p_header['compressed_size'] = strlen($v_content_compressed);
|
2631 |
+
$p_header['compression'] = 8;
|
2632 |
+
}
|
2633 |
+
|
2634 |
+
// ----- Look for encryption
|
2635 |
+
/*
|
2636 |
+
if ((isset($p_options[PCLZIP_OPT_CRYPT]))
|
2637 |
+
&& ($p_options[PCLZIP_OPT_CRYPT] != "")) {
|
2638 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File need to be crypted ....");
|
2639 |
+
|
2640 |
+
// Should be a random header
|
2641 |
+
$v_header = 'xxxxxxxxxxxx';
|
2642 |
+
$v_content_compressed = PclZipUtilZipEncrypt($v_content_compressed,
|
2643 |
+
$p_header['compressed_size'],
|
2644 |
+
$v_header,
|
2645 |
+
$p_header['crc'],
|
2646 |
+
"test");
|
2647 |
+
|
2648 |
+
$p_header['compressed_size'] += 12;
|
2649 |
+
$p_header['flag'] = 1;
|
2650 |
+
|
2651 |
+
// ----- Add the header to the data
|
2652 |
+
$v_content_compressed = $v_header.$v_content_compressed;
|
2653 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size after header : ".strlen($v_content_compressed)."");
|
2654 |
+
}
|
2655 |
+
*/
|
2656 |
+
|
2657 |
+
// ----- Call the header generation
|
2658 |
+
if (($v_result = $this->privWriteFileHeader($p_header)) != 1) {
|
2659 |
+
@fclose($v_file);
|
2660 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2661 |
+
return $v_result;
|
2662 |
+
}
|
2663 |
+
|
2664 |
+
// ----- Write the compressed (or not) content
|
2665 |
+
@fwrite($this->zip_fd,
|
2666 |
+
$v_content_compressed, $p_header['compressed_size']);
|
2667 |
+
|
2668 |
+
// ----- Close the file
|
2669 |
+
@fclose($v_file);
|
2670 |
+
}
|
2671 |
+
|
2672 |
+
// ----- Look for a directory
|
2673 |
+
else {
|
2674 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "'".$p_filename."' is a folder");
|
2675 |
+
// ----- Look for directory last '/'
|
2676 |
+
if (@substr($p_header['stored_filename'], -1) != '/') {
|
2677 |
+
$p_header['stored_filename'] .= '/';
|
2678 |
+
}
|
2679 |
+
|
2680 |
+
// ----- Set the file properties
|
2681 |
+
$p_header['size'] = 0;
|
2682 |
+
//$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked
|
2683 |
+
$p_header['external'] = 0x00000010; // Value for a folder : to be checked
|
2684 |
+
|
2685 |
+
// ----- Call the header generation
|
2686 |
+
if (($v_result = $this->privWriteFileHeader($p_header)) != 1)
|
2687 |
+
{
|
2688 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2689 |
+
return $v_result;
|
2690 |
+
}
|
2691 |
+
}
|
2692 |
+
}
|
2693 |
+
|
2694 |
+
// ----- Look for post-add callback
|
2695 |
+
if (isset($p_options[PCLZIP_CB_POST_ADD])) {
|
2696 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_ADD]."()') is defined for the extraction");
|
2697 |
+
|
2698 |
+
// ----- Generate a local information
|
2699 |
+
$v_local_header = array();
|
2700 |
+
$this->privConvertHeader2FileInfo($p_header, $v_local_header);
|
2701 |
+
|
2702 |
+
// ----- Call the callback
|
2703 |
+
// Here I do not use call_user_func() because I need to send a reference to the
|
2704 |
+
// header.
|
2705 |
+
eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);');
|
2706 |
+
if ($v_result == 0) {
|
2707 |
+
// ----- Ignored
|
2708 |
+
$v_result = 1;
|
2709 |
+
}
|
2710 |
+
|
2711 |
+
// ----- Update the informations
|
2712 |
+
// Nothing can be modified
|
2713 |
+
}
|
2714 |
+
|
2715 |
+
// ----- Return
|
2716 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2717 |
+
return $v_result;
|
2718 |
+
}
|
2719 |
+
// --------------------------------------------------------------------------------
|
2720 |
+
|
2721 |
+
// --------------------------------------------------------------------------------
|
2722 |
+
// Function : privCalculateStoredFilename()
|
2723 |
+
// Description :
|
2724 |
+
// Based on file descriptor properties and global options, this method
|
2725 |
+
// calculate the filename that will be stored in the archive.
|
2726 |
+
// Parameters :
|
2727 |
+
// Return Values :
|
2728 |
+
// --------------------------------------------------------------------------------
|
2729 |
+
function privCalculateStoredFilename(&$p_filedescr, &$p_options)
|
2730 |
+
{
|
2731 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCalculateStoredFilename", "filename='".$p_filedescr['filename']."'");
|
2732 |
+
$v_result=1;
|
2733 |
+
|
2734 |
+
// ----- Working variables
|
2735 |
+
$p_filename = $p_filedescr['filename'];
|
2736 |
+
if (isset($p_options[PCLZIP_OPT_ADD_PATH])) {
|
2737 |
+
$p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH];
|
2738 |
+
}
|
2739 |
+
else {
|
2740 |
+
$p_add_dir = '';
|
2741 |
+
}
|
2742 |
+
if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) {
|
2743 |
+
$p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH];
|
2744 |
+
}
|
2745 |
+
else {
|
2746 |
+
$p_remove_dir = '';
|
2747 |
+
}
|
2748 |
+
if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) {
|
2749 |
+
$p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH];
|
2750 |
+
}
|
2751 |
+
else {
|
2752 |
+
$p_remove_all_dir = 0;
|
2753 |
+
}
|
2754 |
+
|
2755 |
+
// ----- Look for full name change
|
2756 |
+
if (isset($p_filedescr['new_full_name'])) {
|
2757 |
+
$v_stored_filename = $p_filedescr['new_full_name'];
|
2758 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing full name of '".$p_filename."' for '".$v_stored_filename."'");
|
2759 |
+
}
|
2760 |
+
|
2761 |
+
// ----- Look for path and/or short name change
|
2762 |
+
else {
|
2763 |
+
|
2764 |
+
// ----- Look for short name change
|
2765 |
+
if (isset($p_filedescr['new_short_name'])) {
|
2766 |
+
$v_path_info = pathinfo($p_filename);
|
2767 |
+
$v_dir = '';
|
2768 |
+
if ($v_path_info['dirname'] != '') {
|
2769 |
+
$v_dir = $v_path_info['dirname'].'/';
|
2770 |
+
}
|
2771 |
+
$v_stored_filename = $v_dir.$p_filedescr['new_short_name'];
|
2772 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Changing short name of '".$p_filename."' for '".$v_stored_filename."'");
|
2773 |
+
}
|
2774 |
+
else {
|
2775 |
+
// ----- Calculate the stored filename
|
2776 |
+
$v_stored_filename = $p_filename;
|
2777 |
+
}
|
2778 |
+
|
2779 |
+
// ----- Look for all path to remove
|
2780 |
+
if ($p_remove_all_dir) {
|
2781 |
+
$v_stored_filename = basename($p_filename);
|
2782 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove all path selected change '".$p_filename."' for '".$v_stored_filename."'");
|
2783 |
+
}
|
2784 |
+
// ----- Look for partial path remove
|
2785 |
+
else if ($p_remove_dir != "") {
|
2786 |
+
if (substr($p_remove_dir, -1) != '/')
|
2787 |
+
$p_remove_dir .= "/";
|
2788 |
+
|
2789 |
+
if ( (substr($p_filename, 0, 2) == "./")
|
2790 |
+
|| (substr($p_remove_dir, 0, 2) == "./")) {
|
2791 |
+
|
2792 |
+
if ( (substr($p_filename, 0, 2) == "./")
|
2793 |
+
&& (substr($p_remove_dir, 0, 2) != "./")) {
|
2794 |
+
$p_remove_dir = "./".$p_remove_dir;
|
2795 |
+
}
|
2796 |
+
if ( (substr($p_filename, 0, 2) != "./")
|
2797 |
+
&& (substr($p_remove_dir, 0, 2) == "./")) {
|
2798 |
+
$p_remove_dir = substr($p_remove_dir, 2);
|
2799 |
+
}
|
2800 |
+
}
|
2801 |
+
|
2802 |
+
$v_compare = PclZipUtilPathInclusion($p_remove_dir,
|
2803 |
+
$v_stored_filename);
|
2804 |
+
if ($v_compare > 0) {
|
2805 |
+
if ($v_compare == 2) {
|
2806 |
+
$v_stored_filename = "";
|
2807 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder");
|
2808 |
+
}
|
2809 |
+
else {
|
2810 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$p_remove_dir' in file '$v_stored_filename'");
|
2811 |
+
$v_stored_filename = substr($v_stored_filename,
|
2812 |
+
strlen($p_remove_dir));
|
2813 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Result is '$v_stored_filename'");
|
2814 |
+
}
|
2815 |
+
}
|
2816 |
+
}
|
2817 |
+
// ----- Look for path to add
|
2818 |
+
if ($p_add_dir != "") {
|
2819 |
+
if (substr($p_add_dir, -1) == "/")
|
2820 |
+
$v_stored_filename = $p_add_dir.$v_stored_filename;
|
2821 |
+
else
|
2822 |
+
$v_stored_filename = $p_add_dir."/".$v_stored_filename;
|
2823 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'");
|
2824 |
+
}
|
2825 |
+
}
|
2826 |
+
|
2827 |
+
// ----- Filename (reduce the path of stored name)
|
2828 |
+
$v_stored_filename = PclZipUtilPathReduction($v_stored_filename);
|
2829 |
+
$p_filedescr['stored_filename'] = $v_stored_filename;
|
2830 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Stored filename will be '".$p_filedescr['stored_filename']."', strlen ".strlen($p_filedescr['stored_filename']));
|
2831 |
+
|
2832 |
+
// ----- Return
|
2833 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2834 |
+
return $v_result;
|
2835 |
+
}
|
2836 |
+
// --------------------------------------------------------------------------------
|
2837 |
+
|
2838 |
+
// --------------------------------------------------------------------------------
|
2839 |
+
// Function : privWriteFileHeader()
|
2840 |
+
// Description :
|
2841 |
+
// Parameters :
|
2842 |
+
// Return Values :
|
2843 |
+
// --------------------------------------------------------------------------------
|
2844 |
+
function privWriteFileHeader(&$p_header)
|
2845 |
+
{
|
2846 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
|
2847 |
+
$v_result=1;
|
2848 |
+
|
2849 |
+
// ----- Store the offset position of the file
|
2850 |
+
$p_header['offset'] = ftell($this->zip_fd);
|
2851 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, 'File offset of the header :'.$p_header['offset']);
|
2852 |
+
|
2853 |
+
// ----- Transform UNIX mtime to DOS format mdate/mtime
|
2854 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
2855 |
+
$v_date = getdate($p_header['mtime']);
|
2856 |
+
$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
|
2857 |
+
$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
|
2858 |
+
|
2859 |
+
// ----- Packed data
|
2860 |
+
$v_binary_data = pack("VvvvvvVVVvv", 0x04034b50,
|
2861 |
+
$p_header['version_extracted'], $p_header['flag'],
|
2862 |
+
$p_header['compression'], $v_mtime, $v_mdate,
|
2863 |
+
$p_header['crc'], $p_header['compressed_size'],
|
2864 |
+
$p_header['size'],
|
2865 |
+
strlen($p_header['stored_filename']),
|
2866 |
+
$p_header['extra_len']);
|
2867 |
+
|
2868 |
+
// ----- Write the first 148 bytes of the header in the archive
|
2869 |
+
fputs($this->zip_fd, $v_binary_data, 30);
|
2870 |
+
|
2871 |
+
// ----- Write the variable fields
|
2872 |
+
if (strlen($p_header['stored_filename']) != 0)
|
2873 |
+
{
|
2874 |
+
fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
|
2875 |
+
}
|
2876 |
+
if ($p_header['extra_len'] != 0)
|
2877 |
+
{
|
2878 |
+
fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
|
2879 |
+
}
|
2880 |
+
|
2881 |
+
// ----- Return
|
2882 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2883 |
+
return $v_result;
|
2884 |
+
}
|
2885 |
+
// --------------------------------------------------------------------------------
|
2886 |
+
|
2887 |
+
// --------------------------------------------------------------------------------
|
2888 |
+
// Function : privWriteCentralFileHeader()
|
2889 |
+
// Description :
|
2890 |
+
// Parameters :
|
2891 |
+
// Return Values :
|
2892 |
+
// --------------------------------------------------------------------------------
|
2893 |
+
function privWriteCentralFileHeader(&$p_header)
|
2894 |
+
{
|
2895 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralFileHeader", 'file="'.$p_header['filename'].'", stored as "'.$p_header['stored_filename'].'"');
|
2896 |
+
$v_result=1;
|
2897 |
+
|
2898 |
+
// TBC
|
2899 |
+
//for(reset($p_header); $key = key($p_header); next($p_header)) {
|
2900 |
+
// //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$p_header[$key]);
|
2901 |
+
//}
|
2902 |
+
|
2903 |
+
// ----- Transform UNIX mtime to DOS format mdate/mtime
|
2904 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
2905 |
+
$v_date = getdate($p_header['mtime']);
|
2906 |
+
$v_mtime = ($v_date['hours']<<11) + ($v_date['minutes']<<5) + $v_date['seconds']/2;
|
2907 |
+
$v_mdate = (($v_date['year']-1980)<<9) + ($v_date['mon']<<5) + $v_date['mday'];
|
2908 |
+
|
2909 |
+
// ----- Packed data
|
2910 |
+
$v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50,
|
2911 |
+
$p_header['version'], $p_header['version_extracted'],
|
2912 |
+
$p_header['flag'], $p_header['compression'],
|
2913 |
+
$v_mtime, $v_mdate, $p_header['crc'],
|
2914 |
+
$p_header['compressed_size'], $p_header['size'],
|
2915 |
+
strlen($p_header['stored_filename']),
|
2916 |
+
$p_header['extra_len'], $p_header['comment_len'],
|
2917 |
+
$p_header['disk'], $p_header['internal'],
|
2918 |
+
$p_header['external'], $p_header['offset']);
|
2919 |
+
|
2920 |
+
// ----- Write the 42 bytes of the header in the zip file
|
2921 |
+
fputs($this->zip_fd, $v_binary_data, 46);
|
2922 |
+
|
2923 |
+
// ----- Write the variable fields
|
2924 |
+
if (strlen($p_header['stored_filename']) != 0)
|
2925 |
+
{
|
2926 |
+
fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename']));
|
2927 |
+
}
|
2928 |
+
if ($p_header['extra_len'] != 0)
|
2929 |
+
{
|
2930 |
+
fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']);
|
2931 |
+
}
|
2932 |
+
if ($p_header['comment_len'] != 0)
|
2933 |
+
{
|
2934 |
+
fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']);
|
2935 |
+
}
|
2936 |
+
|
2937 |
+
// ----- Return
|
2938 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2939 |
+
return $v_result;
|
2940 |
+
}
|
2941 |
+
// --------------------------------------------------------------------------------
|
2942 |
+
|
2943 |
+
// --------------------------------------------------------------------------------
|
2944 |
+
// Function : privWriteCentralHeader()
|
2945 |
+
// Description :
|
2946 |
+
// Parameters :
|
2947 |
+
// Return Values :
|
2948 |
+
// --------------------------------------------------------------------------------
|
2949 |
+
function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment)
|
2950 |
+
{
|
2951 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privWriteCentralHeader", 'nb_entries='.$p_nb_entries.', size='.$p_size.', offset='.$p_offset.', comment="'.$p_comment.'"');
|
2952 |
+
$v_result=1;
|
2953 |
+
|
2954 |
+
// ----- Packed data
|
2955 |
+
$v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries,
|
2956 |
+
$p_nb_entries, $p_size,
|
2957 |
+
$p_offset, strlen($p_comment));
|
2958 |
+
|
2959 |
+
// ----- Write the 22 bytes of the header in the zip file
|
2960 |
+
fputs($this->zip_fd, $v_binary_data, 22);
|
2961 |
+
|
2962 |
+
// ----- Write the variable fields
|
2963 |
+
if (strlen($p_comment) != 0)
|
2964 |
+
{
|
2965 |
+
fputs($this->zip_fd, $p_comment, strlen($p_comment));
|
2966 |
+
}
|
2967 |
+
|
2968 |
+
// ----- Return
|
2969 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
2970 |
+
return $v_result;
|
2971 |
+
}
|
2972 |
+
// --------------------------------------------------------------------------------
|
2973 |
+
|
2974 |
+
// --------------------------------------------------------------------------------
|
2975 |
+
// Function : privList()
|
2976 |
+
// Description :
|
2977 |
+
// Parameters :
|
2978 |
+
// Return Values :
|
2979 |
+
// --------------------------------------------------------------------------------
|
2980 |
+
function privList(&$p_list)
|
2981 |
+
{
|
2982 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privList", "list");
|
2983 |
+
$v_result=1;
|
2984 |
+
|
2985 |
+
// ----- Magic quotes trick
|
2986 |
+
$this->privDisableMagicQuotes();
|
2987 |
+
|
2988 |
+
// ----- Open the zip file
|
2989 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
2990 |
+
if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0)
|
2991 |
+
{
|
2992 |
+
// ----- Magic quotes trick
|
2993 |
+
$this->privSwapBackMagicQuotes();
|
2994 |
+
|
2995 |
+
// ----- Error log
|
2996 |
+
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \''.$this->zipname.'\' in binary read mode');
|
2997 |
+
|
2998 |
+
// ----- Return
|
2999 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3000 |
+
return PclZip::errorCode();
|
3001 |
+
}
|
3002 |
+
|
3003 |
+
// ----- Read the central directory informations
|
3004 |
+
$v_central_dir = array();
|
3005 |
+
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
3006 |
+
{
|
3007 |
+
$this->privSwapBackMagicQuotes();
|
3008 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3009 |
+
return $v_result;
|
3010 |
+
}
|
3011 |
+
|
3012 |
+
// ----- Go to beginning of Central Dir
|
3013 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Offset : ".$v_central_dir['offset']."'");
|
3014 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
|
3015 |
+
@rewind($this->zip_fd);
|
3016 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
|
3017 |
+
if (@fseek($this->zip_fd, $v_central_dir['offset']))
|
3018 |
+
{
|
3019 |
+
$this->privSwapBackMagicQuotes();
|
3020 |
+
|
3021 |
+
// ----- Error log
|
3022 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3023 |
+
|
3024 |
+
// ----- Return
|
3025 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3026 |
+
return PclZip::errorCode();
|
3027 |
+
}
|
3028 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position in file : ".ftell($this->zip_fd)."'");
|
3029 |
+
|
3030 |
+
// ----- Read each entry
|
3031 |
+
for ($i=0; $i<$v_central_dir['entries']; $i++)
|
3032 |
+
{
|
3033 |
+
// ----- Read the file header
|
3034 |
+
if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
|
3035 |
+
{
|
3036 |
+
$this->privSwapBackMagicQuotes();
|
3037 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3038 |
+
return $v_result;
|
3039 |
+
}
|
3040 |
+
$v_header['index'] = $i;
|
3041 |
+
|
3042 |
+
// ----- Get the only interesting attributes
|
3043 |
+
$this->privConvertHeader2FileInfo($v_header, $p_list[$i]);
|
3044 |
+
unset($v_header);
|
3045 |
+
}
|
3046 |
+
|
3047 |
+
// ----- Close the zip file
|
3048 |
+
$this->privCloseFd();
|
3049 |
+
|
3050 |
+
// ----- Magic quotes trick
|
3051 |
+
$this->privSwapBackMagicQuotes();
|
3052 |
+
|
3053 |
+
// ----- Return
|
3054 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3055 |
+
return $v_result;
|
3056 |
+
}
|
3057 |
+
// --------------------------------------------------------------------------------
|
3058 |
+
|
3059 |
+
// --------------------------------------------------------------------------------
|
3060 |
+
// Function : privConvertHeader2FileInfo()
|
3061 |
+
// Description :
|
3062 |
+
// This function takes the file informations from the central directory
|
3063 |
+
// entries and extract the interesting parameters that will be given back.
|
3064 |
+
// The resulting file infos are set in the array $p_info
|
3065 |
+
// $p_info['filename'] : Filename with full path. Given by user (add),
|
3066 |
+
// extracted in the filesystem (extract).
|
3067 |
+
// $p_info['stored_filename'] : Stored filename in the archive.
|
3068 |
+
// $p_info['size'] = Size of the file.
|
3069 |
+
// $p_info['compressed_size'] = Compressed size of the file.
|
3070 |
+
// $p_info['mtime'] = Last modification date of the file.
|
3071 |
+
// $p_info['comment'] = Comment associated with the file.
|
3072 |
+
// $p_info['folder'] = true/false : indicates if the entry is a folder or not.
|
3073 |
+
// $p_info['status'] = status of the action on the file.
|
3074 |
+
// Parameters :
|
3075 |
+
// Return Values :
|
3076 |
+
// --------------------------------------------------------------------------------
|
3077 |
+
function privConvertHeader2FileInfo($p_header, &$p_info)
|
3078 |
+
{
|
3079 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privConvertHeader2FileInfo", "Filename='".$p_header['filename']."'");
|
3080 |
+
$v_result=1;
|
3081 |
+
|
3082 |
+
// ----- Get the interesting attributes
|
3083 |
+
$p_info['filename'] = $p_header['filename'];
|
3084 |
+
$p_info['stored_filename'] = $p_header['stored_filename'];
|
3085 |
+
$p_info['size'] = $p_header['size'];
|
3086 |
+
$p_info['compressed_size'] = $p_header['compressed_size'];
|
3087 |
+
$p_info['mtime'] = $p_header['mtime'];
|
3088 |
+
$p_info['comment'] = $p_header['comment'];
|
3089 |
+
$p_info['folder'] = (($p_header['external']&0x00000010)==0x00000010);
|
3090 |
+
$p_info['index'] = $p_header['index'];
|
3091 |
+
$p_info['status'] = $p_header['status'];
|
3092 |
+
|
3093 |
+
// ----- Return
|
3094 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3095 |
+
return $v_result;
|
3096 |
+
}
|
3097 |
+
// --------------------------------------------------------------------------------
|
3098 |
+
|
3099 |
+
// --------------------------------------------------------------------------------
|
3100 |
+
// Function : privExtractByRule()
|
3101 |
+
// Description :
|
3102 |
+
// Extract a file or directory depending of rules (by index, by name, ...)
|
3103 |
+
// Parameters :
|
3104 |
+
// $p_file_list : An array where will be placed the properties of each
|
3105 |
+
// extracted file
|
3106 |
+
// $p_path : Path to add while writing the extracted files
|
3107 |
+
// $p_remove_path : Path to remove (from the file memorized path) while writing the
|
3108 |
+
// extracted files. If the path does not match the file path,
|
3109 |
+
// the file is extracted with its memorized path.
|
3110 |
+
// $p_remove_path does not apply to 'list' mode.
|
3111 |
+
// $p_path and $p_remove_path are commulative.
|
3112 |
+
// Return Values :
|
3113 |
+
// 1 on success,0 or less on error (see error code list)
|
3114 |
+
// --------------------------------------------------------------------------------
|
3115 |
+
function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
|
3116 |
+
{
|
3117 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privExtractByRule", "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
|
3118 |
+
$v_result=1;
|
3119 |
+
|
3120 |
+
// ----- Magic quotes trick
|
3121 |
+
$this->privDisableMagicQuotes();
|
3122 |
+
|
3123 |
+
// ----- Check the path
|
3124 |
+
if ( ($p_path == "")
|
3125 |
+
|| ( (substr($p_path, 0, 1) != "/")
|
3126 |
+
&& (substr($p_path, 0, 3) != "../")
|
3127 |
+
&& (substr($p_path,1,2)!=":/")))
|
3128 |
+
$p_path = "./".$p_path;
|
3129 |
+
|
3130 |
+
// ----- Reduce the path last (and duplicated) '/'
|
3131 |
+
if (($p_path != "./") && ($p_path != "/"))
|
3132 |
+
{
|
3133 |
+
// ----- Look for the path end '/'
|
3134 |
+
while (substr($p_path, -1) == "/")
|
3135 |
+
{
|
3136 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Destination path [$p_path] ends by '/'");
|
3137 |
+
$p_path = substr($p_path, 0, strlen($p_path)-1);
|
3138 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Modified to [$p_path]");
|
3139 |
+
}
|
3140 |
+
}
|
3141 |
+
|
3142 |
+
// ----- Look for path to remove format (should end by /)
|
3143 |
+
if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
|
3144 |
+
{
|
3145 |
+
$p_remove_path .= '/';
|
3146 |
+
}
|
3147 |
+
$p_remove_path_size = strlen($p_remove_path);
|
3148 |
+
|
3149 |
+
// ----- Open the zip file
|
3150 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
3151 |
+
if (($v_result = $this->privOpenFd('rb')) != 1)
|
3152 |
+
{
|
3153 |
+
$this->privSwapBackMagicQuotes();
|
3154 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3155 |
+
return $v_result;
|
3156 |
+
}
|
3157 |
+
|
3158 |
+
// ----- Read the central directory informations
|
3159 |
+
$v_central_dir = array();
|
3160 |
+
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
3161 |
+
{
|
3162 |
+
// ----- Close the zip file
|
3163 |
+
$this->privCloseFd();
|
3164 |
+
$this->privSwapBackMagicQuotes();
|
3165 |
+
|
3166 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3167 |
+
return $v_result;
|
3168 |
+
}
|
3169 |
+
|
3170 |
+
// ----- Start at beginning of Central Dir
|
3171 |
+
$v_pos_entry = $v_central_dir['offset'];
|
3172 |
+
|
3173 |
+
// ----- Read each entry
|
3174 |
+
$j_start = 0;
|
3175 |
+
for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
|
3176 |
+
{
|
3177 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry : '$i'");
|
3178 |
+
|
3179 |
+
// ----- Read next Central dir entry
|
3180 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position before rewind : ".ftell($this->zip_fd)."'");
|
3181 |
+
@rewind($this->zip_fd);
|
3182 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Position after rewind : ".ftell($this->zip_fd)."'");
|
3183 |
+
if (@fseek($this->zip_fd, $v_pos_entry))
|
3184 |
+
{
|
3185 |
+
// ----- Close the zip file
|
3186 |
+
$this->privCloseFd();
|
3187 |
+
$this->privSwapBackMagicQuotes();
|
3188 |
+
|
3189 |
+
// ----- Error log
|
3190 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3191 |
+
|
3192 |
+
// ----- Return
|
3193 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3194 |
+
return PclZip::errorCode();
|
3195 |
+
}
|
3196 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Position after fseek : ".ftell($this->zip_fd)."'");
|
3197 |
+
|
3198 |
+
// ----- Read the file header
|
3199 |
+
$v_header = array();
|
3200 |
+
if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1)
|
3201 |
+
{
|
3202 |
+
// ----- Close the zip file
|
3203 |
+
$this->privCloseFd();
|
3204 |
+
$this->privSwapBackMagicQuotes();
|
3205 |
+
|
3206 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3207 |
+
return $v_result;
|
3208 |
+
}
|
3209 |
+
|
3210 |
+
// ----- Store the index
|
3211 |
+
$v_header['index'] = $i;
|
3212 |
+
|
3213 |
+
// ----- Store the file position
|
3214 |
+
$v_pos_entry = ftell($this->zip_fd);
|
3215 |
+
|
3216 |
+
// ----- Look for the specific extract rules
|
3217 |
+
$v_extract = false;
|
3218 |
+
|
3219 |
+
// ----- Look for extract by name rule
|
3220 |
+
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
|
3221 |
+
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
|
3222 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
|
3223 |
+
|
3224 |
+
// ----- Look if the filename is in the list
|
3225 |
+
for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) {
|
3226 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
|
3227 |
+
|
3228 |
+
// ----- Look for a directory
|
3229 |
+
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
|
3230 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
|
3231 |
+
|
3232 |
+
// ----- Look if the directory is in the filename path
|
3233 |
+
if ( (strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
3234 |
+
&& (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
3235 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
|
3236 |
+
$v_extract = true;
|
3237 |
+
}
|
3238 |
+
}
|
3239 |
+
// ----- Look for a filename
|
3240 |
+
elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
|
3241 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
|
3242 |
+
$v_extract = true;
|
3243 |
+
}
|
3244 |
+
}
|
3245 |
+
}
|
3246 |
+
|
3247 |
+
// ----- Look for extract by ereg rule
|
3248 |
+
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
3249 |
+
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
|
3250 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
|
3251 |
+
|
3252 |
+
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) {
|
3253 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
3254 |
+
$v_extract = true;
|
3255 |
+
}
|
3256 |
+
}
|
3257 |
+
|
3258 |
+
// ----- Look for extract by preg rule
|
3259 |
+
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
|
3260 |
+
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
|
3261 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
|
3262 |
+
|
3263 |
+
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) {
|
3264 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
3265 |
+
$v_extract = true;
|
3266 |
+
}
|
3267 |
+
}
|
3268 |
+
|
3269 |
+
// ----- Look for extract by index rule
|
3270 |
+
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
3271 |
+
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
3272 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
|
3273 |
+
|
3274 |
+
// ----- Look if the index is in the list
|
3275 |
+
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) {
|
3276 |
+
//--(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']."]");
|
3277 |
+
|
3278 |
+
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
|
3279 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
|
3280 |
+
$v_extract = true;
|
3281 |
+
}
|
3282 |
+
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
|
3283 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
|
3284 |
+
$j_start = $j+1;
|
3285 |
+
}
|
3286 |
+
|
3287 |
+
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
|
3288 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
|
3289 |
+
break;
|
3290 |
+
}
|
3291 |
+
}
|
3292 |
+
}
|
3293 |
+
|
3294 |
+
// ----- Look for no rule, which means extract all the archive
|
3295 |
+
else {
|
3296 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with no rule (extract all)");
|
3297 |
+
$v_extract = true;
|
3298 |
+
}
|
3299 |
+
|
3300 |
+
// ----- Check compression method
|
3301 |
+
if ( ($v_extract)
|
3302 |
+
&& ( ($v_header['compression'] != 8)
|
3303 |
+
&& ($v_header['compression'] != 0))) {
|
3304 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported compression method (".$v_header['compression'].")");
|
3305 |
+
$v_header['status'] = 'unsupported_compression';
|
3306 |
+
|
3307 |
+
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3308 |
+
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3309 |
+
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3310 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3311 |
+
|
3312 |
+
$this->privSwapBackMagicQuotes();
|
3313 |
+
|
3314 |
+
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION,
|
3315 |
+
"Filename '".$v_header['stored_filename']."' is "
|
3316 |
+
."compressed by an unsupported compression "
|
3317 |
+
."method (".$v_header['compression'].") ");
|
3318 |
+
|
3319 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3320 |
+
return PclZip::errorCode();
|
3321 |
+
}
|
3322 |
+
}
|
3323 |
+
|
3324 |
+
// ----- Check encrypted files
|
3325 |
+
if (($v_extract) && (($v_header['flag'] & 1) == 1)) {
|
3326 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unsupported file encryption");
|
3327 |
+
$v_header['status'] = 'unsupported_encryption';
|
3328 |
+
|
3329 |
+
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3330 |
+
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3331 |
+
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3332 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3333 |
+
|
3334 |
+
$this->privSwapBackMagicQuotes();
|
3335 |
+
|
3336 |
+
PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION,
|
3337 |
+
"Unsupported encryption for "
|
3338 |
+
." filename '".$v_header['stored_filename']
|
3339 |
+
."'");
|
3340 |
+
|
3341 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3342 |
+
return PclZip::errorCode();
|
3343 |
+
}
|
3344 |
+
}
|
3345 |
+
|
3346 |
+
// ----- Look for real extraction
|
3347 |
+
if (($v_extract) && ($v_header['status'] != 'ok')) {
|
3348 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "No need for extract");
|
3349 |
+
$v_result = $this->privConvertHeader2FileInfo($v_header,
|
3350 |
+
$p_file_list[$v_nb_extracted++]);
|
3351 |
+
if ($v_result != 1) {
|
3352 |
+
$this->privCloseFd();
|
3353 |
+
$this->privSwapBackMagicQuotes();
|
3354 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3355 |
+
return $v_result;
|
3356 |
+
}
|
3357 |
+
|
3358 |
+
$v_extract = false;
|
3359 |
+
}
|
3360 |
+
|
3361 |
+
// ----- Look for real extraction
|
3362 |
+
if ($v_extract)
|
3363 |
+
{
|
3364 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file '".$v_header['filename']."', index '$i'");
|
3365 |
+
|
3366 |
+
// ----- Go to the file position
|
3367 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
|
3368 |
+
@rewind($this->zip_fd);
|
3369 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
|
3370 |
+
if (@fseek($this->zip_fd, $v_header['offset']))
|
3371 |
+
{
|
3372 |
+
// ----- Close the zip file
|
3373 |
+
$this->privCloseFd();
|
3374 |
+
|
3375 |
+
$this->privSwapBackMagicQuotes();
|
3376 |
+
|
3377 |
+
// ----- Error log
|
3378 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
3379 |
+
|
3380 |
+
// ----- Return
|
3381 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3382 |
+
return PclZip::errorCode();
|
3383 |
+
}
|
3384 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
|
3385 |
+
|
3386 |
+
// ----- Look for extraction as string
|
3387 |
+
if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) {
|
3388 |
+
|
3389 |
+
// ----- Extracting the file
|
3390 |
+
$v_result1 = $this->privExtractFileAsString($v_header, $v_string);
|
3391 |
+
if ($v_result1 < 1) {
|
3392 |
+
$this->privCloseFd();
|
3393 |
+
$this->privSwapBackMagicQuotes();
|
3394 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
|
3395 |
+
return $v_result1;
|
3396 |
+
}
|
3397 |
+
|
3398 |
+
// ----- Get the only interesting attributes
|
3399 |
+
if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1)
|
3400 |
+
{
|
3401 |
+
// ----- Close the zip file
|
3402 |
+
$this->privCloseFd();
|
3403 |
+
$this->privSwapBackMagicQuotes();
|
3404 |
+
|
3405 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3406 |
+
return $v_result;
|
3407 |
+
}
|
3408 |
+
|
3409 |
+
// ----- Set the file content
|
3410 |
+
$p_file_list[$v_nb_extracted]['content'] = $v_string;
|
3411 |
+
|
3412 |
+
// ----- Next extracted file
|
3413 |
+
$v_nb_extracted++;
|
3414 |
+
|
3415 |
+
// ----- Look for user callback abort
|
3416 |
+
if ($v_result1 == 2) {
|
3417 |
+
break;
|
3418 |
+
}
|
3419 |
+
}
|
3420 |
+
// ----- Look for extraction in standard output
|
3421 |
+
elseif ( (isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT]))
|
3422 |
+
&& ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) {
|
3423 |
+
// ----- Extracting the file in standard output
|
3424 |
+
$v_result1 = $this->privExtractFileInOutput($v_header, $p_options);
|
3425 |
+
if ($v_result1 < 1) {
|
3426 |
+
$this->privCloseFd();
|
3427 |
+
$this->privSwapBackMagicQuotes();
|
3428 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
|
3429 |
+
return $v_result1;
|
3430 |
+
}
|
3431 |
+
|
3432 |
+
// ----- Get the only interesting attributes
|
3433 |
+
if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) {
|
3434 |
+
$this->privCloseFd();
|
3435 |
+
$this->privSwapBackMagicQuotes();
|
3436 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3437 |
+
return $v_result;
|
3438 |
+
}
|
3439 |
+
|
3440 |
+
// ----- Look for user callback abort
|
3441 |
+
if ($v_result1 == 2) {
|
3442 |
+
break;
|
3443 |
+
}
|
3444 |
+
}
|
3445 |
+
// ----- Look for normal extraction
|
3446 |
+
else {
|
3447 |
+
// ----- Extracting the file
|
3448 |
+
$v_result1 = $this->privExtractFile($v_header,
|
3449 |
+
$p_path, $p_remove_path,
|
3450 |
+
$p_remove_all_path,
|
3451 |
+
$p_options);
|
3452 |
+
if ($v_result1 < 1) {
|
3453 |
+
$this->privCloseFd();
|
3454 |
+
$this->privSwapBackMagicQuotes();
|
3455 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result1);
|
3456 |
+
return $v_result1;
|
3457 |
+
}
|
3458 |
+
|
3459 |
+
// ----- Get the only interesting attributes
|
3460 |
+
if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1)
|
3461 |
+
{
|
3462 |
+
// ----- Close the zip file
|
3463 |
+
$this->privCloseFd();
|
3464 |
+
$this->privSwapBackMagicQuotes();
|
3465 |
+
|
3466 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3467 |
+
return $v_result;
|
3468 |
+
}
|
3469 |
+
|
3470 |
+
// ----- Look for user callback abort
|
3471 |
+
if ($v_result1 == 2) {
|
3472 |
+
break;
|
3473 |
+
}
|
3474 |
+
}
|
3475 |
+
}
|
3476 |
+
}
|
3477 |
+
|
3478 |
+
// ----- Close the zip file
|
3479 |
+
$this->privCloseFd();
|
3480 |
+
$this->privSwapBackMagicQuotes();
|
3481 |
+
|
3482 |
+
// ----- Return
|
3483 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3484 |
+
return $v_result;
|
3485 |
+
}
|
3486 |
+
// --------------------------------------------------------------------------------
|
3487 |
+
|
3488 |
+
// --------------------------------------------------------------------------------
|
3489 |
+
// Function : privExtractFile()
|
3490 |
+
// Description :
|
3491 |
+
// Parameters :
|
3492 |
+
// Return Values :
|
3493 |
+
//
|
3494 |
+
// 1 : ... ?
|
3495 |
+
// PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback
|
3496 |
+
// --------------------------------------------------------------------------------
|
3497 |
+
function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options)
|
3498 |
+
{
|
3499 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFile', "path='$p_path', remove_path='$p_remove_path', remove_all_path='".($p_remove_all_path?'true':'false')."'");
|
3500 |
+
$v_result=1;
|
3501 |
+
|
3502 |
+
// ----- Read the file header
|
3503 |
+
if (($v_result = $this->privReadFileHeader($v_header)) != 1)
|
3504 |
+
{
|
3505 |
+
// ----- Return
|
3506 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3507 |
+
return $v_result;
|
3508 |
+
}
|
3509 |
+
|
3510 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
|
3511 |
+
|
3512 |
+
// ----- Check that the file header is coherent with $p_entry info
|
3513 |
+
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
3514 |
+
// TBC
|
3515 |
+
}
|
3516 |
+
|
3517 |
+
// ----- Look for all path to remove
|
3518 |
+
if ($p_remove_all_path == true) {
|
3519 |
+
// ----- Look for folder entry that not need to be extracted
|
3520 |
+
if (($p_entry['external']&0x00000010)==0x00000010) {
|
3521 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The entry is a folder : need to be filtered");
|
3522 |
+
|
3523 |
+
$p_entry['status'] = "filtered";
|
3524 |
+
|
3525 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3526 |
+
return $v_result;
|
3527 |
+
}
|
3528 |
+
|
3529 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "All path is removed");
|
3530 |
+
// ----- Get the basename of the path
|
3531 |
+
$p_entry['filename'] = basename($p_entry['filename']);
|
3532 |
+
}
|
3533 |
+
|
3534 |
+
// ----- Look for path to remove
|
3535 |
+
else if ($p_remove_path != "")
|
3536 |
+
{
|
3537 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Look for some path to remove");
|
3538 |
+
if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2)
|
3539 |
+
{
|
3540 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The folder is the same as the removed path '".$p_entry['filename']."'");
|
3541 |
+
|
3542 |
+
// ----- Change the file status
|
3543 |
+
$p_entry['status'] = "filtered";
|
3544 |
+
|
3545 |
+
// ----- Return
|
3546 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3547 |
+
return $v_result;
|
3548 |
+
}
|
3549 |
+
|
3550 |
+
$p_remove_path_size = strlen($p_remove_path);
|
3551 |
+
if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path)
|
3552 |
+
{
|
3553 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '".$p_entry['filename']."'");
|
3554 |
+
|
3555 |
+
// ----- Remove the path
|
3556 |
+
$p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size);
|
3557 |
+
|
3558 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Resulting file is '".$p_entry['filename']."'");
|
3559 |
+
}
|
3560 |
+
}
|
3561 |
+
|
3562 |
+
// ----- Add the path
|
3563 |
+
if ($p_path != '') {
|
3564 |
+
$p_entry['filename'] = $p_path."/".$p_entry['filename'];
|
3565 |
+
}
|
3566 |
+
|
3567 |
+
// ----- Check a base_dir_restriction
|
3568 |
+
if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) {
|
3569 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Check the extract directory restriction");
|
3570 |
+
$v_inclusion
|
3571 |
+
= PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION],
|
3572 |
+
$p_entry['filename']);
|
3573 |
+
if ($v_inclusion == 0) {
|
3574 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_EXTRACT_DIR_RESTRICTION is selected, file is outside restriction");
|
3575 |
+
|
3576 |
+
PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION,
|
3577 |
+
"Filename '".$p_entry['filename']."' is "
|
3578 |
+
."outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION");
|
3579 |
+
|
3580 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3581 |
+
return PclZip::errorCode();
|
3582 |
+
}
|
3583 |
+
}
|
3584 |
+
|
3585 |
+
// ----- Look for pre-extract callback
|
3586 |
+
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
|
3587 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
|
3588 |
+
|
3589 |
+
// ----- Generate a local information
|
3590 |
+
$v_local_header = array();
|
3591 |
+
$this->privConvertHeader2FileInfo($p_entry, $v_local_header);
|
3592 |
+
|
3593 |
+
// ----- Call the callback
|
3594 |
+
// Here I do not use call_user_func() because I need to send a reference to the
|
3595 |
+
// header.
|
3596 |
+
eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
|
3597 |
+
if ($v_result == 0) {
|
3598 |
+
// ----- Change the file status
|
3599 |
+
$p_entry['status'] = "skipped";
|
3600 |
+
$v_result = 1;
|
3601 |
+
}
|
3602 |
+
|
3603 |
+
// ----- Look for abort result
|
3604 |
+
if ($v_result == 2) {
|
3605 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
3606 |
+
// ----- This status is internal and will be changed in 'skipped'
|
3607 |
+
$p_entry['status'] = "aborted";
|
3608 |
+
$v_result = PCLZIP_ERR_USER_ABORTED;
|
3609 |
+
}
|
3610 |
+
|
3611 |
+
// ----- Update the informations
|
3612 |
+
// Only some fields can be modified
|
3613 |
+
$p_entry['filename'] = $v_local_header['filename'];
|
3614 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
|
3615 |
+
}
|
3616 |
+
|
3617 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
|
3618 |
+
|
3619 |
+
// ----- Look if extraction should be done
|
3620 |
+
if ($p_entry['status'] == 'ok') {
|
3621 |
+
|
3622 |
+
// ----- Look for specific actions while the file exist
|
3623 |
+
if (file_exists($p_entry['filename']))
|
3624 |
+
{
|
3625 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$p_entry['filename']."' already exists");
|
3626 |
+
|
3627 |
+
// ----- Look if file is a directory
|
3628 |
+
if (is_dir($p_entry['filename']))
|
3629 |
+
{
|
3630 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is a directory");
|
3631 |
+
|
3632 |
+
// ----- Change the file status
|
3633 |
+
$p_entry['status'] = "already_a_directory";
|
3634 |
+
|
3635 |
+
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3636 |
+
// For historical reason first PclZip implementation does not stop
|
3637 |
+
// when this kind of error occurs.
|
3638 |
+
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3639 |
+
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3640 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3641 |
+
|
3642 |
+
PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY,
|
3643 |
+
"Filename '".$p_entry['filename']."' is "
|
3644 |
+
."already used by an existing directory");
|
3645 |
+
|
3646 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3647 |
+
return PclZip::errorCode();
|
3648 |
+
}
|
3649 |
+
}
|
3650 |
+
// ----- Look if file is write protected
|
3651 |
+
else if (!is_writeable($p_entry['filename']))
|
3652 |
+
{
|
3653 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Existing file '".$p_entry['filename']."' is write protected");
|
3654 |
+
|
3655 |
+
// ----- Change the file status
|
3656 |
+
$p_entry['status'] = "write_protected";
|
3657 |
+
|
3658 |
+
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3659 |
+
// For historical reason first PclZip implementation does not stop
|
3660 |
+
// when this kind of error occurs.
|
3661 |
+
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3662 |
+
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3663 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3664 |
+
|
3665 |
+
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
3666 |
+
"Filename '".$p_entry['filename']."' exists "
|
3667 |
+
."and is write protected");
|
3668 |
+
|
3669 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3670 |
+
return PclZip::errorCode();
|
3671 |
+
}
|
3672 |
+
}
|
3673 |
+
|
3674 |
+
// ----- Look if the extracted file is older
|
3675 |
+
else if (filemtime($p_entry['filename']) > $p_entry['mtime'])
|
3676 |
+
{
|
3677 |
+
//--(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']).")");
|
3678 |
+
// ----- Change the file status
|
3679 |
+
if ( (isset($p_options[PCLZIP_OPT_REPLACE_NEWER]))
|
3680 |
+
&& ($p_options[PCLZIP_OPT_REPLACE_NEWER]===true)) {
|
3681 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_REPLACE_NEWER is selected, file will be replaced");
|
3682 |
+
}
|
3683 |
+
else {
|
3684 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File will not be replaced");
|
3685 |
+
$p_entry['status'] = "newer_exist";
|
3686 |
+
|
3687 |
+
// ----- Look for PCLZIP_OPT_STOP_ON_ERROR
|
3688 |
+
// For historical reason first PclZip implementation does not stop
|
3689 |
+
// when this kind of error occurs.
|
3690 |
+
if ( (isset($p_options[PCLZIP_OPT_STOP_ON_ERROR]))
|
3691 |
+
&& ($p_options[PCLZIP_OPT_STOP_ON_ERROR]===true)) {
|
3692 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "PCLZIP_OPT_STOP_ON_ERROR is selected, extraction will be stopped");
|
3693 |
+
|
3694 |
+
PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL,
|
3695 |
+
"Newer version of '".$p_entry['filename']."' exists "
|
3696 |
+
."and option PCLZIP_OPT_REPLACE_NEWER is not selected");
|
3697 |
+
|
3698 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
3699 |
+
return PclZip::errorCode();
|
3700 |
+
}
|
3701 |
+
}
|
3702 |
+
}
|
3703 |
+
else {
|
3704 |
+
//--(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']).")");
|
3705 |
+
}
|
3706 |
+
}
|
3707 |
+
|
3708 |
+
// ----- Check the directory availability and create it if necessary
|
3709 |
+
else {
|
3710 |
+
if ((($p_entry['external']&0x00000010)==0x00000010) || (substr($p_entry['filename'], -1) == '/'))
|
3711 |
+
$v_dir_to_check = $p_entry['filename'];
|
3712 |
+
else if (!strstr($p_entry['filename'], "/"))
|
3713 |
+
$v_dir_to_check = "";
|
3714 |
+
else
|
3715 |
+
$v_dir_to_check = dirname($p_entry['filename']);
|
3716 |
+
|
3717 |
+
if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external']&0x00000010)==0x00000010))) != 1) {
|
3718 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '".$p_entry['filename']."'");
|
3719 |
+
|
3720 |
+
// ----- Change the file status
|
3721 |
+
$p_entry['status'] = "path_creation_fail";
|
3722 |
+
|
3723 |
+
// ----- Return
|
3724 |
+
////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3725 |
+
//return $v_result;
|
3726 |
+
$v_result = 1;
|
3727 |
+
}
|
3728 |
+
}
|
3729 |
+
}
|
3730 |
+
|
3731 |
+
// ----- Look if extraction should be done
|
3732 |
+
if ($p_entry['status'] == 'ok') {
|
3733 |
+
|
3734 |
+
// ----- Do the extraction (if not a folder)
|
3735 |
+
if (!(($p_entry['external']&0x00000010)==0x00000010))
|
3736 |
+
{
|
3737 |
+
// ----- Look for not compressed file
|
3738 |
+
if ($p_entry['compression'] == 0) {
|
3739 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
|
3740 |
+
|
3741 |
+
// ----- Opening destination file
|
3742 |
+
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0)
|
3743 |
+
{
|
3744 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
|
3745 |
+
|
3746 |
+
// ----- Change the file status
|
3747 |
+
$p_entry['status'] = "write_error";
|
3748 |
+
|
3749 |
+
// ----- Return
|
3750 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3751 |
+
return $v_result;
|
3752 |
+
}
|
3753 |
+
|
3754 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read '".$p_entry['size']."' bytes");
|
3755 |
+
|
3756 |
+
// ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks
|
3757 |
+
$v_size = $p_entry['compressed_size'];
|
3758 |
+
while ($v_size != 0)
|
3759 |
+
{
|
3760 |
+
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
3761 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Read $v_read_size bytes");
|
3762 |
+
$v_buffer = @fread($this->zip_fd, $v_read_size);
|
3763 |
+
/* Try to speed up the code
|
3764 |
+
$v_binary_data = pack('a'.$v_read_size, $v_buffer);
|
3765 |
+
@fwrite($v_dest_file, $v_binary_data, $v_read_size);
|
3766 |
+
*/
|
3767 |
+
@fwrite($v_dest_file, $v_buffer, $v_read_size);
|
3768 |
+
$v_size -= $v_read_size;
|
3769 |
+
}
|
3770 |
+
|
3771 |
+
// ----- Closing the destination file
|
3772 |
+
fclose($v_dest_file);
|
3773 |
+
|
3774 |
+
// ----- Change the file mtime
|
3775 |
+
touch($p_entry['filename'], $p_entry['mtime']);
|
3776 |
+
|
3777 |
+
|
3778 |
+
}
|
3779 |
+
else {
|
3780 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (Compression method ".$p_entry['compression'].")");
|
3781 |
+
// ----- TBC
|
3782 |
+
// Need to be finished
|
3783 |
+
if (($p_entry['flag'] & 1) == 1) {
|
3784 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File is encrypted");
|
3785 |
+
/*
|
3786 |
+
// ----- Read the encryption header
|
3787 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read 12 encryption header bytes");
|
3788 |
+
$v_encryption_header = @fread($this->zip_fd, 12);
|
3789 |
+
|
3790 |
+
// ----- Read the encrypted & compressed file in a buffer
|
3791 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".($p_entry['compressed_size']-12)."' compressed & encrypted bytes");
|
3792 |
+
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']-12);
|
3793 |
+
|
3794 |
+
// ----- Decrypt the buffer
|
3795 |
+
$this->privDecrypt($v_encryption_header, $v_buffer,
|
3796 |
+
$p_entry['compressed_size']-12, $p_entry['crc']);
|
3797 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Buffer is '".$v_buffer."'");
|
3798 |
+
*/
|
3799 |
+
}
|
3800 |
+
else {
|
3801 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read '".$p_entry['compressed_size']."' compressed bytes");
|
3802 |
+
// ----- Read the compressed file in a buffer (one shot)
|
3803 |
+
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
3804 |
+
}
|
3805 |
+
|
3806 |
+
// ----- Decompress the file
|
3807 |
+
$v_file_content = @gzinflate($v_buffer);
|
3808 |
+
unset($v_buffer);
|
3809 |
+
if ($v_file_content === FALSE) {
|
3810 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to inflate compressed file");
|
3811 |
+
|
3812 |
+
// ----- Change the file status
|
3813 |
+
// TBC
|
3814 |
+
$p_entry['status'] = "error";
|
3815 |
+
|
3816 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3817 |
+
return $v_result;
|
3818 |
+
}
|
3819 |
+
|
3820 |
+
// ----- Opening destination file
|
3821 |
+
if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) {
|
3822 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Error while opening '".$p_entry['filename']."' in write binary mode");
|
3823 |
+
|
3824 |
+
// ----- Change the file status
|
3825 |
+
$p_entry['status'] = "write_error";
|
3826 |
+
|
3827 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3828 |
+
return $v_result;
|
3829 |
+
}
|
3830 |
+
|
3831 |
+
// ----- Write the uncompressed data
|
3832 |
+
@fwrite($v_dest_file, $v_file_content, $p_entry['size']);
|
3833 |
+
unset($v_file_content);
|
3834 |
+
|
3835 |
+
// ----- Closing the destination file
|
3836 |
+
@fclose($v_dest_file);
|
3837 |
+
|
3838 |
+
// ----- Change the file mtime
|
3839 |
+
@touch($p_entry['filename'], $p_entry['mtime']);
|
3840 |
+
}
|
3841 |
+
|
3842 |
+
// ----- Look for chmod option
|
3843 |
+
if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) {
|
3844 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "chmod option activated '".$p_options[PCLZIP_OPT_SET_CHMOD]."'");
|
3845 |
+
|
3846 |
+
// ----- Change the mode of the file
|
3847 |
+
@chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]);
|
3848 |
+
}
|
3849 |
+
|
3850 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
|
3851 |
+
}
|
3852 |
+
}
|
3853 |
+
|
3854 |
+
// ----- Change abort status
|
3855 |
+
if ($p_entry['status'] == "aborted") {
|
3856 |
+
$p_entry['status'] = "skipped";
|
3857 |
+
}
|
3858 |
+
|
3859 |
+
// ----- Look for post-extract callback
|
3860 |
+
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
3861 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
|
3862 |
+
|
3863 |
+
// ----- Generate a local information
|
3864 |
+
$v_local_header = array();
|
3865 |
+
$this->privConvertHeader2FileInfo($p_entry, $v_local_header);
|
3866 |
+
|
3867 |
+
// ----- Call the callback
|
3868 |
+
// Here I do not use call_user_func() because I need to send a reference to the
|
3869 |
+
// header.
|
3870 |
+
eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
|
3871 |
+
|
3872 |
+
// ----- Look for abort result
|
3873 |
+
if ($v_result == 2) {
|
3874 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
3875 |
+
$v_result = PCLZIP_ERR_USER_ABORTED;
|
3876 |
+
}
|
3877 |
+
}
|
3878 |
+
|
3879 |
+
// ----- Return
|
3880 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3881 |
+
return $v_result;
|
3882 |
+
}
|
3883 |
+
// --------------------------------------------------------------------------------
|
3884 |
+
|
3885 |
+
// --------------------------------------------------------------------------------
|
3886 |
+
// Function : privExtractFileInOutput()
|
3887 |
+
// Description :
|
3888 |
+
// Parameters :
|
3889 |
+
// Return Values :
|
3890 |
+
// --------------------------------------------------------------------------------
|
3891 |
+
function privExtractFileInOutput(&$p_entry, &$p_options)
|
3892 |
+
{
|
3893 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileInOutput', "");
|
3894 |
+
$v_result=1;
|
3895 |
+
|
3896 |
+
// ----- Read the file header
|
3897 |
+
if (($v_result = $this->privReadFileHeader($v_header)) != 1) {
|
3898 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
3899 |
+
return $v_result;
|
3900 |
+
}
|
3901 |
+
|
3902 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
|
3903 |
+
|
3904 |
+
// ----- Check that the file header is coherent with $p_entry info
|
3905 |
+
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
3906 |
+
// TBC
|
3907 |
+
}
|
3908 |
+
|
3909 |
+
// ----- Look for pre-extract callback
|
3910 |
+
if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) {
|
3911 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A pre-callback '".$p_options[PCLZIP_CB_PRE_EXTRACT]."()') is defined for the extraction");
|
3912 |
+
|
3913 |
+
// ----- Generate a local information
|
3914 |
+
$v_local_header = array();
|
3915 |
+
$this->privConvertHeader2FileInfo($p_entry, $v_local_header);
|
3916 |
+
|
3917 |
+
// ----- Call the callback
|
3918 |
+
// Here I do not use call_user_func() because I need to send a reference to the
|
3919 |
+
// header.
|
3920 |
+
eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);');
|
3921 |
+
if ($v_result == 0) {
|
3922 |
+
// ----- Change the file status
|
3923 |
+
$p_entry['status'] = "skipped";
|
3924 |
+
$v_result = 1;
|
3925 |
+
}
|
3926 |
+
|
3927 |
+
// ----- Look for abort result
|
3928 |
+
if ($v_result == 2) {
|
3929 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
3930 |
+
// ----- This status is internal and will be changed in 'skipped'
|
3931 |
+
$p_entry['status'] = "aborted";
|
3932 |
+
$v_result = PCLZIP_ERR_USER_ABORTED;
|
3933 |
+
}
|
3934 |
+
|
3935 |
+
// ----- Update the informations
|
3936 |
+
// Only some fields can be modified
|
3937 |
+
$p_entry['filename'] = $v_local_header['filename'];
|
3938 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "New filename is '".$p_entry['filename']."'");
|
3939 |
+
}
|
3940 |
+
|
3941 |
+
// ----- Trace
|
3942 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '".$p_entry['filename']."', size '$v_header[size]'");
|
3943 |
+
|
3944 |
+
// ----- Look if extraction should be done
|
3945 |
+
if ($p_entry['status'] == 'ok') {
|
3946 |
+
|
3947 |
+
// ----- Do the extraction (if not a folder)
|
3948 |
+
if (!(($p_entry['external']&0x00000010)==0x00000010)) {
|
3949 |
+
// ----- Look for not compressed file
|
3950 |
+
if ($p_entry['compressed_size'] == $p_entry['size']) {
|
3951 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
|
3952 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
|
3953 |
+
|
3954 |
+
// ----- Read the file in a buffer (one shot)
|
3955 |
+
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
3956 |
+
|
3957 |
+
// ----- Send the file to the output
|
3958 |
+
echo $v_buffer;
|
3959 |
+
unset($v_buffer);
|
3960 |
+
}
|
3961 |
+
else {
|
3962 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file");
|
3963 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Reading '".$p_entry['size']."' bytes");
|
3964 |
+
|
3965 |
+
// ----- Read the compressed file in a buffer (one shot)
|
3966 |
+
$v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']);
|
3967 |
+
|
3968 |
+
// ----- Decompress the file
|
3969 |
+
$v_file_content = gzinflate($v_buffer);
|
3970 |
+
unset($v_buffer);
|
3971 |
+
|
3972 |
+
// ----- Send the file to the output
|
3973 |
+
echo $v_file_content;
|
3974 |
+
unset($v_file_content);
|
3975 |
+
}
|
3976 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
|
3977 |
+
}
|
3978 |
+
}
|
3979 |
+
|
3980 |
+
// ----- Change abort status
|
3981 |
+
if ($p_entry['status'] == "aborted") {
|
3982 |
+
$p_entry['status'] = "skipped";
|
3983 |
+
}
|
3984 |
+
|
3985 |
+
// ----- Look for post-extract callback
|
3986 |
+
elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) {
|
3987 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "A post-callback '".$p_options[PCLZIP_CB_POST_EXTRACT]."()') is defined for the extraction");
|
3988 |
+
|
3989 |
+
// ----- Generate a local information
|
3990 |
+
$v_local_header = array();
|
3991 |
+
$this->privConvertHeader2FileInfo($p_entry, $v_local_header);
|
3992 |
+
|
3993 |
+
// ----- Call the callback
|
3994 |
+
// Here I do not use call_user_func() because I need to send a reference to the
|
3995 |
+
// header.
|
3996 |
+
eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);');
|
3997 |
+
|
3998 |
+
// ----- Look for abort result
|
3999 |
+
if ($v_result == 2) {
|
4000 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "User callback abort the extraction");
|
4001 |
+
$v_result = PCLZIP_ERR_USER_ABORTED;
|
4002 |
+
}
|
4003 |
+
}
|
4004 |
+
|
4005 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4006 |
+
return $v_result;
|
4007 |
+
}
|
4008 |
+
// --------------------------------------------------------------------------------
|
4009 |
+
|
4010 |
+
// --------------------------------------------------------------------------------
|
4011 |
+
// Function : privExtractFileAsString()
|
4012 |
+
// Description :
|
4013 |
+
// Parameters :
|
4014 |
+
// Return Values :
|
4015 |
+
// --------------------------------------------------------------------------------
|
4016 |
+
function privExtractFileAsString(&$p_entry, &$p_string)
|
4017 |
+
{
|
4018 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privExtractFileAsString', "p_entry['filename']='".$p_entry['filename']."'");
|
4019 |
+
$v_result=1;
|
4020 |
+
|
4021 |
+
// ----- Read the file header
|
4022 |
+
$v_header = array();
|
4023 |
+
if (($v_result = $this->privReadFileHeader($v_header)) != 1)
|
4024 |
+
{
|
4025 |
+
// ----- Return
|
4026 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4027 |
+
return $v_result;
|
4028 |
+
}
|
4029 |
+
|
4030 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found file '".$v_header['filename']."', size '".$v_header['size']."'");
|
4031 |
+
|
4032 |
+
// ----- Check that the file header is coherent with $p_entry info
|
4033 |
+
if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) {
|
4034 |
+
// TBC
|
4035 |
+
}
|
4036 |
+
|
4037 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting file in string (with path) '".$p_entry['filename']."', size '$v_header[size]'");
|
4038 |
+
|
4039 |
+
// ----- Do the extraction (if not a folder)
|
4040 |
+
if (!(($p_entry['external']&0x00000010)==0x00000010))
|
4041 |
+
{
|
4042 |
+
// ----- Look for not compressed file
|
4043 |
+
// if ($p_entry['compressed_size'] == $p_entry['size'])
|
4044 |
+
if ($p_entry['compression'] == 0) {
|
4045 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting an un-compressed file");
|
4046 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Reading '".$p_entry['size']."' bytes");
|
4047 |
+
|
4048 |
+
// ----- Reading the file
|
4049 |
+
$p_string = @fread($this->zip_fd, $p_entry['compressed_size']);
|
4050 |
+
}
|
4051 |
+
else {
|
4052 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file (compression method '".$p_entry['compression']."')");
|
4053 |
+
|
4054 |
+
// ----- Reading the file
|
4055 |
+
$v_data = @fread($this->zip_fd, $p_entry['compressed_size']);
|
4056 |
+
|
4057 |
+
// ----- Decompress the file
|
4058 |
+
if (($p_string = @gzinflate($v_data)) === FALSE) {
|
4059 |
+
// TBC
|
4060 |
+
}
|
4061 |
+
}
|
4062 |
+
|
4063 |
+
// ----- Trace
|
4064 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extraction done");
|
4065 |
+
}
|
4066 |
+
else {
|
4067 |
+
// TBC : error : can not extract a folder in a string
|
4068 |
+
}
|
4069 |
+
|
4070 |
+
// ----- Return
|
4071 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4072 |
+
return $v_result;
|
4073 |
+
}
|
4074 |
+
// --------------------------------------------------------------------------------
|
4075 |
+
|
4076 |
+
// --------------------------------------------------------------------------------
|
4077 |
+
// Function : privReadFileHeader()
|
4078 |
+
// Description :
|
4079 |
+
// Parameters :
|
4080 |
+
// Return Values :
|
4081 |
+
// --------------------------------------------------------------------------------
|
4082 |
+
function privReadFileHeader(&$p_header)
|
4083 |
+
{
|
4084 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadFileHeader", "");
|
4085 |
+
$v_result=1;
|
4086 |
+
|
4087 |
+
// ----- Read the 4 bytes signature
|
4088 |
+
$v_binary_data = @fread($this->zip_fd, 4);
|
4089 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
|
4090 |
+
$v_data = unpack('Vid', $v_binary_data);
|
4091 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
|
4092 |
+
|
4093 |
+
// ----- Check signature
|
4094 |
+
if ($v_data['id'] != 0x04034b50)
|
4095 |
+
{
|
4096 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid File header");
|
4097 |
+
|
4098 |
+
// ----- Error log
|
4099 |
+
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
|
4100 |
+
|
4101 |
+
// ----- Return
|
4102 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4103 |
+
return PclZip::errorCode();
|
4104 |
+
}
|
4105 |
+
|
4106 |
+
// ----- Read the first 42 bytes of the header
|
4107 |
+
$v_binary_data = fread($this->zip_fd, 26);
|
4108 |
+
|
4109 |
+
// ----- Look for invalid block size
|
4110 |
+
if (strlen($v_binary_data) != 26)
|
4111 |
+
{
|
4112 |
+
$p_header['filename'] = "";
|
4113 |
+
$p_header['status'] = "invalid_header";
|
4114 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
|
4115 |
+
|
4116 |
+
// ----- Error log
|
4117 |
+
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
|
4118 |
+
|
4119 |
+
// ----- Return
|
4120 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4121 |
+
return PclZip::errorCode();
|
4122 |
+
}
|
4123 |
+
|
4124 |
+
// ----- Extract the values
|
4125 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header : '".$v_binary_data."'");
|
4126 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Header (Hex) : '".bin2hex($v_binary_data)."'");
|
4127 |
+
$v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);
|
4128 |
+
|
4129 |
+
// ----- Get filename
|
4130 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "File name length : ".$v_data['filename_len']);
|
4131 |
+
$p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);
|
4132 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename : \''.$p_header['filename'].'\'');
|
4133 |
+
|
4134 |
+
// ----- Get extra_fields
|
4135 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extra field length : ".$v_data['extra_len']);
|
4136 |
+
if ($v_data['extra_len'] != 0) {
|
4137 |
+
$p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
|
4138 |
+
}
|
4139 |
+
else {
|
4140 |
+
$p_header['extra'] = '';
|
4141 |
+
}
|
4142 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Extra field : \''.bin2hex($p_header['extra']).'\'');
|
4143 |
+
|
4144 |
+
// ----- Extract properties
|
4145 |
+
$p_header['version_extracted'] = $v_data['version'];
|
4146 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : ('.$p_header['version_extracted'].') \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
|
4147 |
+
$p_header['compression'] = $v_data['compression'];
|
4148 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compression method : \''.$p_header['compression'].'\'');
|
4149 |
+
$p_header['size'] = $v_data['size'];
|
4150 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_header['size'].'\'');
|
4151 |
+
$p_header['compressed_size'] = $v_data['compressed_size'];
|
4152 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
|
4153 |
+
$p_header['crc'] = $v_data['crc'];
|
4154 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
|
4155 |
+
$p_header['flag'] = $v_data['flag'];
|
4156 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\'');
|
4157 |
+
$p_header['filename_len'] = $v_data['filename_len'];
|
4158 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Filename_len : \''.$p_header['filename_len'].'\'');
|
4159 |
+
|
4160 |
+
// ----- Recuperate date in UNIX format
|
4161 |
+
$p_header['mdate'] = $v_data['mdate'];
|
4162 |
+
$p_header['mtime'] = $v_data['mtime'];
|
4163 |
+
if ($p_header['mdate'] && $p_header['mtime'])
|
4164 |
+
{
|
4165 |
+
// ----- Extract time
|
4166 |
+
$v_hour = ($p_header['mtime'] & 0xF800) >> 11;
|
4167 |
+
$v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
|
4168 |
+
$v_seconde = ($p_header['mtime'] & 0x001F)*2;
|
4169 |
+
|
4170 |
+
// ----- Extract date
|
4171 |
+
$v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
|
4172 |
+
$v_month = ($p_header['mdate'] & 0x01E0) >> 5;
|
4173 |
+
$v_day = $p_header['mdate'] & 0x001F;
|
4174 |
+
|
4175 |
+
// ----- Get UNIX date format
|
4176 |
+
$p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
|
4177 |
+
|
4178 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4179 |
+
}
|
4180 |
+
else
|
4181 |
+
{
|
4182 |
+
$p_header['mtime'] = time();
|
4183 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4184 |
+
}
|
4185 |
+
|
4186 |
+
// TBC
|
4187 |
+
//for(reset($v_data); $key = key($v_data); next($v_data)) {
|
4188 |
+
// //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Attribut[$key] = ".$v_data[$key]);
|
4189 |
+
//}
|
4190 |
+
|
4191 |
+
// ----- Set the stored filename
|
4192 |
+
$p_header['stored_filename'] = $p_header['filename'];
|
4193 |
+
|
4194 |
+
// ----- Set the status field
|
4195 |
+
$p_header['status'] = "ok";
|
4196 |
+
|
4197 |
+
// ----- Return
|
4198 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4199 |
+
return $v_result;
|
4200 |
+
}
|
4201 |
+
// --------------------------------------------------------------------------------
|
4202 |
+
|
4203 |
+
// --------------------------------------------------------------------------------
|
4204 |
+
// Function : privReadCentralFileHeader()
|
4205 |
+
// Description :
|
4206 |
+
// Parameters :
|
4207 |
+
// Return Values :
|
4208 |
+
// --------------------------------------------------------------------------------
|
4209 |
+
function privReadCentralFileHeader(&$p_header)
|
4210 |
+
{
|
4211 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadCentralFileHeader", "");
|
4212 |
+
$v_result=1;
|
4213 |
+
|
4214 |
+
// ----- Read the 4 bytes signature
|
4215 |
+
$v_binary_data = @fread($this->zip_fd, 4);
|
4216 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
|
4217 |
+
$v_data = unpack('Vid', $v_binary_data);
|
4218 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
|
4219 |
+
|
4220 |
+
// ----- Check signature
|
4221 |
+
if ($v_data['id'] != 0x02014b50)
|
4222 |
+
{
|
4223 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid Central Dir File signature");
|
4224 |
+
|
4225 |
+
// ----- Error log
|
4226 |
+
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');
|
4227 |
+
|
4228 |
+
// ----- Return
|
4229 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4230 |
+
return PclZip::errorCode();
|
4231 |
+
}
|
4232 |
+
|
4233 |
+
// ----- Read the first 42 bytes of the header
|
4234 |
+
$v_binary_data = fread($this->zip_fd, 42);
|
4235 |
+
|
4236 |
+
// ----- Look for invalid block size
|
4237 |
+
if (strlen($v_binary_data) != 42)
|
4238 |
+
{
|
4239 |
+
$p_header['filename'] = "";
|
4240 |
+
$p_header['status'] = "invalid_header";
|
4241 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid block size : ".strlen($v_binary_data));
|
4242 |
+
|
4243 |
+
// ----- Error log
|
4244 |
+
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));
|
4245 |
+
|
4246 |
+
// ----- Return
|
4247 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4248 |
+
return PclZip::errorCode();
|
4249 |
+
}
|
4250 |
+
|
4251 |
+
// ----- Extract the values
|
4252 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header : '".$v_binary_data."'");
|
4253 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Header (Hex) : '".bin2hex($v_binary_data)."'");
|
4254 |
+
$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);
|
4255 |
+
|
4256 |
+
// ----- Get filename
|
4257 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "File name length : ".$p_header['filename_len']);
|
4258 |
+
if ($p_header['filename_len'] != 0)
|
4259 |
+
$p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
|
4260 |
+
else
|
4261 |
+
$p_header['filename'] = '';
|
4262 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Filename : \''.$p_header['filename'].'\'');
|
4263 |
+
|
4264 |
+
// ----- Get extra
|
4265 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Extra length : ".$p_header['extra_len']);
|
4266 |
+
if ($p_header['extra_len'] != 0)
|
4267 |
+
$p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']);
|
4268 |
+
else
|
4269 |
+
$p_header['extra'] = '';
|
4270 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Extra : \''.$p_header['extra'].'\'');
|
4271 |
+
|
4272 |
+
// ----- Get comment
|
4273 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Comment length : ".$p_header['comment_len']);
|
4274 |
+
if ($p_header['comment_len'] != 0)
|
4275 |
+
$p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
|
4276 |
+
else
|
4277 |
+
$p_header['comment'] = '';
|
4278 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Comment : \''.$p_header['comment'].'\'');
|
4279 |
+
|
4280 |
+
// ----- Extract properties
|
4281 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version : \''.($p_header['version']/10).'.'.($p_header['version']%10).'\'');
|
4282 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Version need to extract : \''.($p_header['version_extracted']/10).'.'.($p_header['version_extracted']%10).'\'');
|
4283 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Size : \''.$p_header['size'].'\'');
|
4284 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Compressed Size : \''.$p_header['compressed_size'].'\'');
|
4285 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'CRC : \''.sprintf("0x%X", $p_header['crc']).'\'');
|
4286 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Flag : \''.$p_header['flag'].'\'');
|
4287 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Offset : \''.$p_header['offset'].'\'');
|
4288 |
+
|
4289 |
+
// ----- Recuperate date in UNIX format
|
4290 |
+
if ($p_header['mdate'] && $p_header['mtime'])
|
4291 |
+
{
|
4292 |
+
// ----- Extract time
|
4293 |
+
$v_hour = ($p_header['mtime'] & 0xF800) >> 11;
|
4294 |
+
$v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
|
4295 |
+
$v_seconde = ($p_header['mtime'] & 0x001F)*2;
|
4296 |
+
|
4297 |
+
// ----- Extract date
|
4298 |
+
$v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
|
4299 |
+
$v_month = ($p_header['mdate'] & 0x01E0) >> 5;
|
4300 |
+
$v_day = $p_header['mdate'] & 0x001F;
|
4301 |
+
|
4302 |
+
// ----- Get UNIX date format
|
4303 |
+
$p_header['mtime'] = mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);
|
4304 |
+
|
4305 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4306 |
+
}
|
4307 |
+
else
|
4308 |
+
{
|
4309 |
+
$p_header['mtime'] = time();
|
4310 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Date is actual : \''.date("d/m/y H:i:s", $p_header['mtime']).'\'');
|
4311 |
+
}
|
4312 |
+
|
4313 |
+
// ----- Set the stored filename
|
4314 |
+
$p_header['stored_filename'] = $p_header['filename'];
|
4315 |
+
|
4316 |
+
// ----- Set default status to ok
|
4317 |
+
$p_header['status'] = 'ok';
|
4318 |
+
|
4319 |
+
// ----- Look if it is a directory
|
4320 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Internal (Hex) : '".sprintf("Ox%04X", $p_header['internal'])."'");
|
4321 |
+
//--(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').')');
|
4322 |
+
if (substr($p_header['filename'], -1) == '/') {
|
4323 |
+
//$p_header['external'] = 0x41FF0010;
|
4324 |
+
$p_header['external'] = 0x00000010;
|
4325 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force folder external : \''.sprintf("Ox%04X", $p_header['external']).'\'');
|
4326 |
+
}
|
4327 |
+
|
4328 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Header of filename : \''.$p_header['filename'].'\'');
|
4329 |
+
|
4330 |
+
// ----- Return
|
4331 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4332 |
+
return $v_result;
|
4333 |
+
}
|
4334 |
+
// --------------------------------------------------------------------------------
|
4335 |
+
|
4336 |
+
// --------------------------------------------------------------------------------
|
4337 |
+
// Function : privCheckFileHeaders()
|
4338 |
+
// Description :
|
4339 |
+
// Parameters :
|
4340 |
+
// Return Values :
|
4341 |
+
// 1 on success,
|
4342 |
+
// 0 on error;
|
4343 |
+
// --------------------------------------------------------------------------------
|
4344 |
+
function privCheckFileHeaders(&$p_local_header, &$p_central_header)
|
4345 |
+
{
|
4346 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCheckFileHeaders", "");
|
4347 |
+
$v_result=1;
|
4348 |
+
|
4349 |
+
// ----- Check the static values
|
4350 |
+
// TBC
|
4351 |
+
if ($p_local_header['filename'] != $p_central_header['filename']) {
|
4352 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename" : TBC To Be Completed');
|
4353 |
+
}
|
4354 |
+
if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) {
|
4355 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "version_extracted" : TBC To Be Completed');
|
4356 |
+
}
|
4357 |
+
if ($p_local_header['flag'] != $p_central_header['flag']) {
|
4358 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "flag" : TBC To Be Completed');
|
4359 |
+
}
|
4360 |
+
if ($p_local_header['compression'] != $p_central_header['compression']) {
|
4361 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "compression" : TBC To Be Completed');
|
4362 |
+
}
|
4363 |
+
if ($p_local_header['mtime'] != $p_central_header['mtime']) {
|
4364 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "mtime" : TBC To Be Completed');
|
4365 |
+
}
|
4366 |
+
if ($p_local_header['filename_len'] != $p_central_header['filename_len']) {
|
4367 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Bad check "filename_len" : TBC To Be Completed');
|
4368 |
+
}
|
4369 |
+
|
4370 |
+
// ----- Look for flag bit 3
|
4371 |
+
if (($p_local_header['flag'] & 8) == 8) {
|
4372 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Purpose bit flag bit 3 set !');
|
4373 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'File size, compression size and crc found in central header');
|
4374 |
+
$p_local_header['size'] = $p_central_header['size'];
|
4375 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size : \''.$p_local_header['size'].'\'');
|
4376 |
+
$p_local_header['compressed_size'] = $p_central_header['compressed_size'];
|
4377 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compressed Size : \''.$p_local_header['compressed_size'].'\'');
|
4378 |
+
$p_local_header['crc'] = $p_central_header['crc'];
|
4379 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'CRC : \''.sprintf("0x%X", $p_local_header['crc']).'\'');
|
4380 |
+
}
|
4381 |
+
|
4382 |
+
// ----- Return
|
4383 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4384 |
+
return $v_result;
|
4385 |
+
}
|
4386 |
+
// --------------------------------------------------------------------------------
|
4387 |
+
|
4388 |
+
// --------------------------------------------------------------------------------
|
4389 |
+
// Function : privReadEndCentralDir()
|
4390 |
+
// Description :
|
4391 |
+
// Parameters :
|
4392 |
+
// Return Values :
|
4393 |
+
// --------------------------------------------------------------------------------
|
4394 |
+
function privReadEndCentralDir(&$p_central_dir)
|
4395 |
+
{
|
4396 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privReadEndCentralDir", "");
|
4397 |
+
$v_result=1;
|
4398 |
+
|
4399 |
+
// ----- Go to the end of the zip file
|
4400 |
+
$v_size = filesize($this->zipname);
|
4401 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Size of the file :$v_size");
|
4402 |
+
@fseek($this->zip_fd, $v_size);
|
4403 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position at end of zip file : \''.ftell($this->zip_fd).'\'');
|
4404 |
+
if (@ftell($this->zip_fd) != $v_size)
|
4405 |
+
{
|
4406 |
+
// ----- Error log
|
4407 |
+
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \''.$this->zipname.'\'');
|
4408 |
+
|
4409 |
+
// ----- Return
|
4410 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4411 |
+
return PclZip::errorCode();
|
4412 |
+
}
|
4413 |
+
|
4414 |
+
// ----- First try : look if this is an archive with no commentaries (most of the time)
|
4415 |
+
// in this case the end of central dir is at 22 bytes of the file end
|
4416 |
+
$v_found = 0;
|
4417 |
+
if ($v_size > 26) {
|
4418 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Look for central dir with no comment');
|
4419 |
+
@fseek($this->zip_fd, $v_size-22);
|
4420 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after min central position : \''.ftell($this->zip_fd).'\'');
|
4421 |
+
if (($v_pos = @ftell($this->zip_fd)) != ($v_size-22))
|
4422 |
+
{
|
4423 |
+
// ----- Error log
|
4424 |
+
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
|
4425 |
+
|
4426 |
+
// ----- Return
|
4427 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4428 |
+
return PclZip::errorCode();
|
4429 |
+
}
|
4430 |
+
|
4431 |
+
// ----- Read for bytes
|
4432 |
+
$v_binary_data = @fread($this->zip_fd, 4);
|
4433 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Binary data is : '".sprintf("%08x", $v_binary_data)."'");
|
4434 |
+
$v_data = @unpack('Vid', $v_binary_data);
|
4435 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Binary signature is : '".sprintf("0x%08x", $v_data['id'])."'");
|
4436 |
+
|
4437 |
+
// ----- Check signature
|
4438 |
+
if ($v_data['id'] == 0x06054b50) {
|
4439 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Found central dir at the default position.");
|
4440 |
+
$v_found = 1;
|
4441 |
+
}
|
4442 |
+
|
4443 |
+
$v_pos = ftell($this->zip_fd);
|
4444 |
+
}
|
4445 |
+
|
4446 |
+
// ----- Go back to the maximum possible size of the Central Dir End Record
|
4447 |
+
if (!$v_found) {
|
4448 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Start extended search of end central dir');
|
4449 |
+
$v_maximum_size = 65557; // 0xFFFF + 22;
|
4450 |
+
if ($v_maximum_size > $v_size)
|
4451 |
+
$v_maximum_size = $v_size;
|
4452 |
+
@fseek($this->zip_fd, $v_size-$v_maximum_size);
|
4453 |
+
if (@ftell($this->zip_fd) != ($v_size-$v_maximum_size))
|
4454 |
+
{
|
4455 |
+
// ----- Error log
|
4456 |
+
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \''.$this->zipname.'\'');
|
4457 |
+
|
4458 |
+
// ----- Return
|
4459 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4460 |
+
return PclZip::errorCode();
|
4461 |
+
}
|
4462 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Position after max central position : \''.ftell($this->zip_fd).'\'');
|
4463 |
+
|
4464 |
+
// ----- Read byte per byte in order to find the signature
|
4465 |
+
$v_pos = ftell($this->zip_fd);
|
4466 |
+
$v_bytes = 0x00000000;
|
4467 |
+
while ($v_pos < $v_size)
|
4468 |
+
{
|
4469 |
+
// ----- Read a byte
|
4470 |
+
$v_byte = @fread($this->zip_fd, 1);
|
4471 |
+
|
4472 |
+
// ----- Add the byte
|
4473 |
+
$v_bytes = ($v_bytes << 8) | Ord($v_byte);
|
4474 |
+
|
4475 |
+
// ----- Compare the bytes
|
4476 |
+
if ($v_bytes == 0x504b0506)
|
4477 |
+
{
|
4478 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Found End Central Dir signature at position : \''.ftell($this->zip_fd).'\'');
|
4479 |
+
$v_pos++;
|
4480 |
+
break;
|
4481 |
+
}
|
4482 |
+
|
4483 |
+
$v_pos++;
|
4484 |
+
}
|
4485 |
+
|
4486 |
+
// ----- Look if not found end of central dir
|
4487 |
+
if ($v_pos == $v_size)
|
4488 |
+
{
|
4489 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Unable to find End of Central Dir Record signature");
|
4490 |
+
|
4491 |
+
// ----- Error log
|
4492 |
+
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature");
|
4493 |
+
|
4494 |
+
// ----- Return
|
4495 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4496 |
+
return PclZip::errorCode();
|
4497 |
+
}
|
4498 |
+
}
|
4499 |
+
|
4500 |
+
// ----- Read the first 18 bytes of the header
|
4501 |
+
$v_binary_data = fread($this->zip_fd, 18);
|
4502 |
+
|
4503 |
+
// ----- Look for invalid block size
|
4504 |
+
if (strlen($v_binary_data) != 18)
|
4505 |
+
{
|
4506 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
|
4507 |
+
|
4508 |
+
// ----- Error log
|
4509 |
+
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : ".strlen($v_binary_data));
|
4510 |
+
|
4511 |
+
// ----- Return
|
4512 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4513 |
+
return PclZip::errorCode();
|
4514 |
+
}
|
4515 |
+
|
4516 |
+
// ----- Extract the values
|
4517 |
+
////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record : '".$v_binary_data."'");
|
4518 |
+
////--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Central Dir Record (Hex) : '".bin2hex($v_binary_data)."'");
|
4519 |
+
$v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data);
|
4520 |
+
|
4521 |
+
// ----- Check the global size
|
4522 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Comment length : ".$v_data['comment_size']);
|
4523 |
+
if (($v_pos + $v_data['comment_size'] + 18) != $v_size) {
|
4524 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "The central dir is not at the end of the archive. Some trailing bytes exists after the archive.");
|
4525 |
+
|
4526 |
+
// ----- Removed in release 2.2 see readme file
|
4527 |
+
// The check of the file size is a little too strict.
|
4528 |
+
// Some bugs where found when a zip is encrypted/decrypted with 'crypt'.
|
4529 |
+
// While decrypted, zip has training 0 bytes
|
4530 |
+
if (0) {
|
4531 |
+
// ----- Error log
|
4532 |
+
PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT,
|
4533 |
+
'The central dir is not at the end of the archive.'
|
4534 |
+
.' Some trailing bytes exists after the archive.');
|
4535 |
+
|
4536 |
+
// ----- Return
|
4537 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4538 |
+
return PclZip::errorCode();
|
4539 |
+
}
|
4540 |
+
}
|
4541 |
+
|
4542 |
+
// ----- Get comment
|
4543 |
+
if ($v_data['comment_size'] != 0)
|
4544 |
+
$p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']);
|
4545 |
+
else
|
4546 |
+
$p_central_dir['comment'] = '';
|
4547 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Comment : \''.$p_central_dir['comment'].'\'');
|
4548 |
+
|
4549 |
+
$p_central_dir['entries'] = $v_data['entries'];
|
4550 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries : \''.$p_central_dir['entries'].'\'');
|
4551 |
+
$p_central_dir['disk_entries'] = $v_data['disk_entries'];
|
4552 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Nb of entries for this disk : \''.$p_central_dir['disk_entries'].'\'');
|
4553 |
+
$p_central_dir['offset'] = $v_data['offset'];
|
4554 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Offset of Central Dir : \''.$p_central_dir['offset'].'\'');
|
4555 |
+
$p_central_dir['size'] = $v_data['size'];
|
4556 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Size of Central Dir : \''.$p_central_dir['size'].'\'');
|
4557 |
+
$p_central_dir['disk'] = $v_data['disk'];
|
4558 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Disk number : \''.$p_central_dir['disk'].'\'');
|
4559 |
+
$p_central_dir['disk_start'] = $v_data['disk_start'];
|
4560 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Start disk number : \''.$p_central_dir['disk_start'].'\'');
|
4561 |
+
|
4562 |
+
// TBC
|
4563 |
+
//for(reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) {
|
4564 |
+
// //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "central_dir[$key] = ".$p_central_dir[$key]);
|
4565 |
+
//}
|
4566 |
+
|
4567 |
+
// ----- Return
|
4568 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4569 |
+
return $v_result;
|
4570 |
+
}
|
4571 |
+
// --------------------------------------------------------------------------------
|
4572 |
+
|
4573 |
+
// --------------------------------------------------------------------------------
|
4574 |
+
// Function : privDeleteByRule()
|
4575 |
+
// Description :
|
4576 |
+
// Parameters :
|
4577 |
+
// Return Values :
|
4578 |
+
// --------------------------------------------------------------------------------
|
4579 |
+
function privDeleteByRule(&$p_result_list, &$p_options)
|
4580 |
+
{
|
4581 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDeleteByRule", "");
|
4582 |
+
$v_result=1;
|
4583 |
+
$v_list_detail = array();
|
4584 |
+
|
4585 |
+
// ----- Open the zip file
|
4586 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
4587 |
+
if (($v_result=$this->privOpenFd('rb')) != 1)
|
4588 |
+
{
|
4589 |
+
// ----- Return
|
4590 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4591 |
+
return $v_result;
|
4592 |
+
}
|
4593 |
+
|
4594 |
+
// ----- Read the central directory informations
|
4595 |
+
$v_central_dir = array();
|
4596 |
+
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
4597 |
+
{
|
4598 |
+
$this->privCloseFd();
|
4599 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4600 |
+
return $v_result;
|
4601 |
+
}
|
4602 |
+
|
4603 |
+
// ----- Go to beginning of File
|
4604 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
4605 |
+
@rewind($this->zip_fd);
|
4606 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in file : ".ftell($this->zip_fd)."'");
|
4607 |
+
|
4608 |
+
// ----- Scan all the files
|
4609 |
+
// ----- Start at beginning of Central Dir
|
4610 |
+
$v_pos_entry = $v_central_dir['offset'];
|
4611 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
|
4612 |
+
@rewind($this->zip_fd);
|
4613 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
|
4614 |
+
if (@fseek($this->zip_fd, $v_pos_entry))
|
4615 |
+
{
|
4616 |
+
// ----- Close the zip file
|
4617 |
+
$this->privCloseFd();
|
4618 |
+
|
4619 |
+
// ----- Error log
|
4620 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
4621 |
+
|
4622 |
+
// ----- Return
|
4623 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4624 |
+
return PclZip::errorCode();
|
4625 |
+
}
|
4626 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
|
4627 |
+
|
4628 |
+
// ----- Read each entry
|
4629 |
+
$v_header_list = array();
|
4630 |
+
$j_start = 0;
|
4631 |
+
for ($i=0, $v_nb_extracted=0; $i<$v_central_dir['entries']; $i++)
|
4632 |
+
{
|
4633 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Read next file header entry (index '$i')");
|
4634 |
+
|
4635 |
+
// ----- Read the file header
|
4636 |
+
$v_header_list[$v_nb_extracted] = array();
|
4637 |
+
if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1)
|
4638 |
+
{
|
4639 |
+
// ----- Close the zip file
|
4640 |
+
$this->privCloseFd();
|
4641 |
+
|
4642 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4643 |
+
return $v_result;
|
4644 |
+
}
|
4645 |
+
|
4646 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename (index '$i') : '".$v_header_list[$v_nb_extracted]['stored_filename']."'");
|
4647 |
+
|
4648 |
+
// ----- Store the index
|
4649 |
+
$v_header_list[$v_nb_extracted]['index'] = $i;
|
4650 |
+
|
4651 |
+
// ----- Look for the specific extract rules
|
4652 |
+
$v_found = false;
|
4653 |
+
|
4654 |
+
// ----- Look for extract by name rule
|
4655 |
+
if ( (isset($p_options[PCLZIP_OPT_BY_NAME]))
|
4656 |
+
&& ($p_options[PCLZIP_OPT_BY_NAME] != 0)) {
|
4657 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByName'");
|
4658 |
+
|
4659 |
+
// ----- Look if the filename is in the list
|
4660 |
+
for ($j=0; ($j<sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) {
|
4661 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compare with file '".$p_options[PCLZIP_OPT_BY_NAME][$j]."'");
|
4662 |
+
|
4663 |
+
// ----- Look for a directory
|
4664 |
+
if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") {
|
4665 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The searched item is a directory");
|
4666 |
+
|
4667 |
+
// ----- Look if the directory is in the filename path
|
4668 |
+
if ( (strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j]))
|
4669 |
+
&& (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])) {
|
4670 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The directory is in the file path");
|
4671 |
+
$v_found = true;
|
4672 |
+
}
|
4673 |
+
elseif ( (($v_header_list[$v_nb_extracted]['external']&0x00000010)==0x00000010) /* Indicates a folder */
|
4674 |
+
&& ($v_header_list[$v_nb_extracted]['stored_filename'].'/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) {
|
4675 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The entry is the searched directory");
|
4676 |
+
$v_found = true;
|
4677 |
+
}
|
4678 |
+
}
|
4679 |
+
// ----- Look for a filename
|
4680 |
+
elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) {
|
4681 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "The file is the right one.");
|
4682 |
+
$v_found = true;
|
4683 |
+
}
|
4684 |
+
}
|
4685 |
+
}
|
4686 |
+
|
4687 |
+
// ----- Look for extract by ereg rule
|
4688 |
+
else if ( (isset($p_options[PCLZIP_OPT_BY_EREG]))
|
4689 |
+
&& ($p_options[PCLZIP_OPT_BY_EREG] != "")) {
|
4690 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract by ereg '".$p_options[PCLZIP_OPT_BY_EREG]."'");
|
4691 |
+
|
4692 |
+
if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
|
4693 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
4694 |
+
$v_found = true;
|
4695 |
+
}
|
4696 |
+
}
|
4697 |
+
|
4698 |
+
// ----- Look for extract by preg rule
|
4699 |
+
else if ( (isset($p_options[PCLZIP_OPT_BY_PREG]))
|
4700 |
+
&& ($p_options[PCLZIP_OPT_BY_PREG] != "")) {
|
4701 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByEreg'");
|
4702 |
+
|
4703 |
+
if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) {
|
4704 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Filename match the regular expression");
|
4705 |
+
$v_found = true;
|
4706 |
+
}
|
4707 |
+
}
|
4708 |
+
|
4709 |
+
// ----- Look for extract by index rule
|
4710 |
+
else if ( (isset($p_options[PCLZIP_OPT_BY_INDEX]))
|
4711 |
+
&& ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) {
|
4712 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Extract with rule 'ByIndex'");
|
4713 |
+
|
4714 |
+
// ----- Look if the index is in the list
|
4715 |
+
for ($j=$j_start; ($j<sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) {
|
4716 |
+
//--(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']."]");
|
4717 |
+
|
4718 |
+
if (($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i<=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) {
|
4719 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Found as part of an index range");
|
4720 |
+
$v_found = true;
|
4721 |
+
}
|
4722 |
+
if ($i>=$p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) {
|
4723 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Do not look this index range for next loop");
|
4724 |
+
$j_start = $j+1;
|
4725 |
+
}
|
4726 |
+
|
4727 |
+
if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start']>$i) {
|
4728 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Index range is greater than index, stop loop");
|
4729 |
+
break;
|
4730 |
+
}
|
4731 |
+
}
|
4732 |
+
}
|
4733 |
+
else {
|
4734 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "No argument mean remove all file");
|
4735 |
+
$v_found = true;
|
4736 |
+
}
|
4737 |
+
|
4738 |
+
// ----- Look for deletion
|
4739 |
+
if ($v_found)
|
4740 |
+
{
|
4741 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' need to be deleted");
|
4742 |
+
unset($v_header_list[$v_nb_extracted]);
|
4743 |
+
}
|
4744 |
+
else
|
4745 |
+
{
|
4746 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "File '".$v_header_list[$v_nb_extracted]['stored_filename']."', index '$i' will not be deleted");
|
4747 |
+
$v_nb_extracted++;
|
4748 |
+
}
|
4749 |
+
}
|
4750 |
+
|
4751 |
+
// ----- Look if something need to be deleted
|
4752 |
+
if ($v_nb_extracted > 0) {
|
4753 |
+
|
4754 |
+
// ----- Creates a temporay file
|
4755 |
+
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
|
4756 |
+
|
4757 |
+
// ----- Creates a temporary zip archive
|
4758 |
+
$v_temp_zip = new PclZip($v_zip_temp_name);
|
4759 |
+
|
4760 |
+
// ----- Open the temporary zip file in write mode
|
4761 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary write mode");
|
4762 |
+
if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) {
|
4763 |
+
$this->privCloseFd();
|
4764 |
+
|
4765 |
+
// ----- Return
|
4766 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4767 |
+
return $v_result;
|
4768 |
+
}
|
4769 |
+
|
4770 |
+
// ----- Look which file need to be kept
|
4771 |
+
for ($i=0; $i<sizeof($v_header_list); $i++) {
|
4772 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Keep entry index '$i' : '".$v_header_list[$i]['filename']."'");
|
4773 |
+
|
4774 |
+
// ----- Calculate the position of the header
|
4775 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset='". $v_header_list[$i]['offset']."'");
|
4776 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position before rewind : ".ftell($this->zip_fd)."'");
|
4777 |
+
@rewind($this->zip_fd);
|
4778 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after rewind : ".ftell($this->zip_fd)."'");
|
4779 |
+
if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) {
|
4780 |
+
// ----- Close the zip file
|
4781 |
+
$this->privCloseFd();
|
4782 |
+
$v_temp_zip->privCloseFd();
|
4783 |
+
@unlink($v_zip_temp_name);
|
4784 |
+
|
4785 |
+
// ----- Error log
|
4786 |
+
PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size');
|
4787 |
+
|
4788 |
+
// ----- Return
|
4789 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4790 |
+
return PclZip::errorCode();
|
4791 |
+
}
|
4792 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position after fseek : ".ftell($this->zip_fd)."'");
|
4793 |
+
|
4794 |
+
// ----- Read the file header
|
4795 |
+
$v_local_header = array();
|
4796 |
+
if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) {
|
4797 |
+
// ----- Close the zip file
|
4798 |
+
$this->privCloseFd();
|
4799 |
+
$v_temp_zip->privCloseFd();
|
4800 |
+
@unlink($v_zip_temp_name);
|
4801 |
+
|
4802 |
+
// ----- Return
|
4803 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4804 |
+
return $v_result;
|
4805 |
+
}
|
4806 |
+
|
4807 |
+
// ----- Check that local file header is same as central file header
|
4808 |
+
if ($this->privCheckFileHeaders($v_local_header,
|
4809 |
+
$v_header_list[$i]) != 1) {
|
4810 |
+
// TBC
|
4811 |
+
}
|
4812 |
+
unset($v_local_header);
|
4813 |
+
|
4814 |
+
// ----- Write the file header
|
4815 |
+
if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) {
|
4816 |
+
// ----- Close the zip file
|
4817 |
+
$this->privCloseFd();
|
4818 |
+
$v_temp_zip->privCloseFd();
|
4819 |
+
@unlink($v_zip_temp_name);
|
4820 |
+
|
4821 |
+
// ----- Return
|
4822 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4823 |
+
return $v_result;
|
4824 |
+
}
|
4825 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset for this file is '".$v_header_list[$i]['offset']."'");
|
4826 |
+
|
4827 |
+
// ----- Read/write the data block
|
4828 |
+
if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) {
|
4829 |
+
// ----- Close the zip file
|
4830 |
+
$this->privCloseFd();
|
4831 |
+
$v_temp_zip->privCloseFd();
|
4832 |
+
@unlink($v_zip_temp_name);
|
4833 |
+
|
4834 |
+
// ----- Return
|
4835 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4836 |
+
return $v_result;
|
4837 |
+
}
|
4838 |
+
}
|
4839 |
+
|
4840 |
+
// ----- Store the offset of the central dir
|
4841 |
+
$v_offset = @ftell($v_temp_zip->zip_fd);
|
4842 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "New offset of central dir : $v_offset");
|
4843 |
+
|
4844 |
+
// ----- Re-Create the Central Dir files header
|
4845 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the new central directory");
|
4846 |
+
for ($i=0; $i<sizeof($v_header_list); $i++) {
|
4847 |
+
// ----- Create the file header
|
4848 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Offset of file : ".$v_header_list[$i]['offset']);
|
4849 |
+
if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
|
4850 |
+
$v_temp_zip->privCloseFd();
|
4851 |
+
$this->privCloseFd();
|
4852 |
+
@unlink($v_zip_temp_name);
|
4853 |
+
|
4854 |
+
// ----- Return
|
4855 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4856 |
+
return $v_result;
|
4857 |
+
}
|
4858 |
+
|
4859 |
+
// ----- Transform the header to a 'usable' info
|
4860 |
+
$v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
|
4861 |
+
}
|
4862 |
+
|
4863 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Creates the central directory footer");
|
4864 |
+
|
4865 |
+
// ----- Zip file comment
|
4866 |
+
$v_comment = '';
|
4867 |
+
if (isset($p_options[PCLZIP_OPT_COMMENT])) {
|
4868 |
+
$v_comment = $p_options[PCLZIP_OPT_COMMENT];
|
4869 |
+
}
|
4870 |
+
|
4871 |
+
// ----- Calculate the size of the central header
|
4872 |
+
$v_size = @ftell($v_temp_zip->zip_fd)-$v_offset;
|
4873 |
+
|
4874 |
+
// ----- Create the central dir footer
|
4875 |
+
if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) {
|
4876 |
+
// ----- Reset the file list
|
4877 |
+
unset($v_header_list);
|
4878 |
+
$v_temp_zip->privCloseFd();
|
4879 |
+
$this->privCloseFd();
|
4880 |
+
@unlink($v_zip_temp_name);
|
4881 |
+
|
4882 |
+
// ----- Return
|
4883 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4884 |
+
return $v_result;
|
4885 |
+
}
|
4886 |
+
|
4887 |
+
// ----- Close
|
4888 |
+
$v_temp_zip->privCloseFd();
|
4889 |
+
$this->privCloseFd();
|
4890 |
+
|
4891 |
+
// ----- Delete the zip file
|
4892 |
+
// TBC : I should test the result ...
|
4893 |
+
@unlink($this->zipname);
|
4894 |
+
|
4895 |
+
// ----- Rename the temporary file
|
4896 |
+
// TBC : I should test the result ...
|
4897 |
+
//@rename($v_zip_temp_name, $this->zipname);
|
4898 |
+
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
4899 |
+
|
4900 |
+
// ----- Destroy the temporary archive
|
4901 |
+
unset($v_temp_zip);
|
4902 |
+
}
|
4903 |
+
|
4904 |
+
// ----- Remove every files : reset the file
|
4905 |
+
else if ($v_central_dir['entries'] != 0) {
|
4906 |
+
$this->privCloseFd();
|
4907 |
+
|
4908 |
+
if (($v_result = $this->privOpenFd('wb')) != 1) {
|
4909 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4910 |
+
return $v_result;
|
4911 |
+
}
|
4912 |
+
|
4913 |
+
if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) {
|
4914 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4915 |
+
return $v_result;
|
4916 |
+
}
|
4917 |
+
|
4918 |
+
$this->privCloseFd();
|
4919 |
+
}
|
4920 |
+
|
4921 |
+
// ----- Return
|
4922 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4923 |
+
return $v_result;
|
4924 |
+
}
|
4925 |
+
// --------------------------------------------------------------------------------
|
4926 |
+
|
4927 |
+
// --------------------------------------------------------------------------------
|
4928 |
+
// Function : privDirCheck()
|
4929 |
+
// Description :
|
4930 |
+
// Check if a directory exists, if not it creates it and all the parents directory
|
4931 |
+
// which may be useful.
|
4932 |
+
// Parameters :
|
4933 |
+
// $p_dir : Directory path to check.
|
4934 |
+
// Return Values :
|
4935 |
+
// 1 : OK
|
4936 |
+
// -1 : Unable to create directory
|
4937 |
+
// --------------------------------------------------------------------------------
|
4938 |
+
function privDirCheck($p_dir, $p_is_dir=false)
|
4939 |
+
{
|
4940 |
+
$v_result = 1;
|
4941 |
+
|
4942 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDirCheck", "entry='$p_dir', is_dir='".($p_is_dir?"true":"false")."'");
|
4943 |
+
|
4944 |
+
// ----- Remove the final '/'
|
4945 |
+
if (($p_is_dir) && (substr($p_dir, -1)=='/'))
|
4946 |
+
{
|
4947 |
+
$p_dir = substr($p_dir, 0, strlen($p_dir)-1);
|
4948 |
+
}
|
4949 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Looking for entry '$p_dir'");
|
4950 |
+
|
4951 |
+
// ----- Check the directory availability
|
4952 |
+
if ((is_dir($p_dir)) || ($p_dir == ""))
|
4953 |
+
{
|
4954 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, "'$p_dir' is a directory");
|
4955 |
+
return 1;
|
4956 |
+
}
|
4957 |
+
|
4958 |
+
// ----- Extract parent directory
|
4959 |
+
$p_parent_dir = dirname($p_dir);
|
4960 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Parent directory is '$p_parent_dir'");
|
4961 |
+
|
4962 |
+
// ----- Just a check
|
4963 |
+
if ($p_parent_dir != $p_dir)
|
4964 |
+
{
|
4965 |
+
// ----- Look for parent directory
|
4966 |
+
if ($p_parent_dir != "")
|
4967 |
+
{
|
4968 |
+
if (($v_result = $this->privDirCheck($p_parent_dir)) != 1)
|
4969 |
+
{
|
4970 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
4971 |
+
return $v_result;
|
4972 |
+
}
|
4973 |
+
}
|
4974 |
+
}
|
4975 |
+
|
4976 |
+
// ----- Create the directory
|
4977 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Create directory '$p_dir'");
|
4978 |
+
if (!@mkdir($p_dir, 0777))
|
4979 |
+
{
|
4980 |
+
// ----- Error log
|
4981 |
+
PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'");
|
4982 |
+
|
4983 |
+
// ----- Return
|
4984 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
4985 |
+
return PclZip::errorCode();
|
4986 |
+
}
|
4987 |
+
|
4988 |
+
// ----- Return
|
4989 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result, "Directory '$p_dir' created");
|
4990 |
+
return $v_result;
|
4991 |
+
}
|
4992 |
+
// --------------------------------------------------------------------------------
|
4993 |
+
|
4994 |
+
// --------------------------------------------------------------------------------
|
4995 |
+
// Function : privMerge()
|
4996 |
+
// Description :
|
4997 |
+
// If $p_archive_to_add does not exist, the function exit with a success result.
|
4998 |
+
// Parameters :
|
4999 |
+
// Return Values :
|
5000 |
+
// --------------------------------------------------------------------------------
|
5001 |
+
function privMerge(&$p_archive_to_add)
|
5002 |
+
{
|
5003 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privMerge", "archive='".$p_archive_to_add->zipname."'");
|
5004 |
+
$v_result=1;
|
5005 |
+
|
5006 |
+
// ----- Look if the archive_to_add exists
|
5007 |
+
if (!is_file($p_archive_to_add->zipname))
|
5008 |
+
{
|
5009 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to add does not exist. End of merge.");
|
5010 |
+
|
5011 |
+
// ----- Nothing to merge, so merge is a success
|
5012 |
+
$v_result = 1;
|
5013 |
+
|
5014 |
+
// ----- Return
|
5015 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5016 |
+
return $v_result;
|
5017 |
+
}
|
5018 |
+
|
5019 |
+
// ----- Look if the archive exists
|
5020 |
+
if (!is_file($this->zipname))
|
5021 |
+
{
|
5022 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive does not exist, duplicate the archive_to_add.");
|
5023 |
+
|
5024 |
+
// ----- Do a duplicate
|
5025 |
+
$v_result = $this->privDuplicate($p_archive_to_add->zipname);
|
5026 |
+
|
5027 |
+
// ----- Return
|
5028 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5029 |
+
return $v_result;
|
5030 |
+
}
|
5031 |
+
|
5032 |
+
// ----- Open the zip file
|
5033 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5034 |
+
if (($v_result=$this->privOpenFd('rb')) != 1)
|
5035 |
+
{
|
5036 |
+
// ----- Return
|
5037 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5038 |
+
return $v_result;
|
5039 |
+
}
|
5040 |
+
|
5041 |
+
// ----- Read the central directory informations
|
5042 |
+
$v_central_dir = array();
|
5043 |
+
if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1)
|
5044 |
+
{
|
5045 |
+
$this->privCloseFd();
|
5046 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5047 |
+
return $v_result;
|
5048 |
+
}
|
5049 |
+
|
5050 |
+
// ----- Go to beginning of File
|
5051 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
|
5052 |
+
@rewind($this->zip_fd);
|
5053 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in zip : ".ftell($this->zip_fd)."'");
|
5054 |
+
|
5055 |
+
// ----- Open the archive_to_add file
|
5056 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open archive_to_add in binary read mode");
|
5057 |
+
if (($v_result=$p_archive_to_add->privOpenFd('rb')) != 1)
|
5058 |
+
{
|
5059 |
+
$this->privCloseFd();
|
5060 |
+
|
5061 |
+
// ----- Return
|
5062 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5063 |
+
return $v_result;
|
5064 |
+
}
|
5065 |
+
|
5066 |
+
// ----- Read the central directory informations
|
5067 |
+
$v_central_dir_to_add = array();
|
5068 |
+
if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1)
|
5069 |
+
{
|
5070 |
+
$this->privCloseFd();
|
5071 |
+
$p_archive_to_add->privCloseFd();
|
5072 |
+
|
5073 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5074 |
+
return $v_result;
|
5075 |
+
}
|
5076 |
+
|
5077 |
+
// ----- Go to beginning of File
|
5078 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
|
5079 |
+
@rewind($p_archive_to_add->zip_fd);
|
5080 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Position in archive_to_add : ".ftell($p_archive_to_add->zip_fd)."'");
|
5081 |
+
|
5082 |
+
// ----- Creates a temporay file
|
5083 |
+
$v_zip_temp_name = PCLZIP_TEMPORARY_DIR.uniqid('pclzip-').'.tmp';
|
5084 |
+
|
5085 |
+
// ----- Open the temporary file in write mode
|
5086 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5087 |
+
if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0)
|
5088 |
+
{
|
5089 |
+
$this->privCloseFd();
|
5090 |
+
$p_archive_to_add->privCloseFd();
|
5091 |
+
|
5092 |
+
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \''.$v_zip_temp_name.'\' in binary write mode');
|
5093 |
+
|
5094 |
+
// ----- Return
|
5095 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5096 |
+
return PclZip::errorCode();
|
5097 |
+
}
|
5098 |
+
|
5099 |
+
// ----- Copy the files from the archive to the temporary file
|
5100 |
+
// TBC : Here I should better append the file and go back to erase the central dir
|
5101 |
+
$v_size = $v_central_dir['offset'];
|
5102 |
+
while ($v_size != 0)
|
5103 |
+
{
|
5104 |
+
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5105 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5106 |
+
$v_buffer = fread($this->zip_fd, $v_read_size);
|
5107 |
+
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5108 |
+
$v_size -= $v_read_size;
|
5109 |
+
}
|
5110 |
+
|
5111 |
+
// ----- Copy the files from the archive_to_add into the temporary file
|
5112 |
+
$v_size = $v_central_dir_to_add['offset'];
|
5113 |
+
while ($v_size != 0)
|
5114 |
+
{
|
5115 |
+
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5116 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5117 |
+
$v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size);
|
5118 |
+
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5119 |
+
$v_size -= $v_read_size;
|
5120 |
+
}
|
5121 |
+
|
5122 |
+
// ----- Store the offset of the central dir
|
5123 |
+
$v_offset = @ftell($v_zip_temp_fd);
|
5124 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "New offset of central dir : $v_offset");
|
5125 |
+
|
5126 |
+
// ----- Copy the block of file headers from the old archive
|
5127 |
+
$v_size = $v_central_dir['size'];
|
5128 |
+
while ($v_size != 0)
|
5129 |
+
{
|
5130 |
+
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5131 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5132 |
+
$v_buffer = @fread($this->zip_fd, $v_read_size);
|
5133 |
+
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5134 |
+
$v_size -= $v_read_size;
|
5135 |
+
}
|
5136 |
+
|
5137 |
+
// ----- Copy the block of file headers from the archive_to_add
|
5138 |
+
$v_size = $v_central_dir_to_add['size'];
|
5139 |
+
while ($v_size != 0)
|
5140 |
+
{
|
5141 |
+
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5142 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5143 |
+
$v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size);
|
5144 |
+
@fwrite($v_zip_temp_fd, $v_buffer, $v_read_size);
|
5145 |
+
$v_size -= $v_read_size;
|
5146 |
+
}
|
5147 |
+
|
5148 |
+
// ----- Merge the file comments
|
5149 |
+
$v_comment = $v_central_dir['comment'].' '.$v_central_dir_to_add['comment'];
|
5150 |
+
|
5151 |
+
// ----- Calculate the size of the (new) central header
|
5152 |
+
$v_size = @ftell($v_zip_temp_fd)-$v_offset;
|
5153 |
+
|
5154 |
+
// ----- Swap the file descriptor
|
5155 |
+
// Here is a trick : I swap the temporary fd with the zip fd, in order to use
|
5156 |
+
// the following methods on the temporary fil and not the real archive fd
|
5157 |
+
$v_swap = $this->zip_fd;
|
5158 |
+
$this->zip_fd = $v_zip_temp_fd;
|
5159 |
+
$v_zip_temp_fd = $v_swap;
|
5160 |
+
|
5161 |
+
// ----- Create the central dir footer
|
5162 |
+
if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries']+$v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1)
|
5163 |
+
{
|
5164 |
+
$this->privCloseFd();
|
5165 |
+
$p_archive_to_add->privCloseFd();
|
5166 |
+
@fclose($v_zip_temp_fd);
|
5167 |
+
$this->zip_fd = null;
|
5168 |
+
|
5169 |
+
// ----- Reset the file list
|
5170 |
+
unset($v_header_list);
|
5171 |
+
|
5172 |
+
// ----- Return
|
5173 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5174 |
+
return $v_result;
|
5175 |
+
}
|
5176 |
+
|
5177 |
+
// ----- Swap back the file descriptor
|
5178 |
+
$v_swap = $this->zip_fd;
|
5179 |
+
$this->zip_fd = $v_zip_temp_fd;
|
5180 |
+
$v_zip_temp_fd = $v_swap;
|
5181 |
+
|
5182 |
+
// ----- Close
|
5183 |
+
$this->privCloseFd();
|
5184 |
+
$p_archive_to_add->privCloseFd();
|
5185 |
+
|
5186 |
+
// ----- Close the temporary file
|
5187 |
+
@fclose($v_zip_temp_fd);
|
5188 |
+
|
5189 |
+
// ----- Delete the zip file
|
5190 |
+
// TBC : I should test the result ...
|
5191 |
+
@unlink($this->zipname);
|
5192 |
+
|
5193 |
+
// ----- Rename the temporary file
|
5194 |
+
// TBC : I should test the result ...
|
5195 |
+
//@rename($v_zip_temp_name, $this->zipname);
|
5196 |
+
PclZipUtilRename($v_zip_temp_name, $this->zipname);
|
5197 |
+
|
5198 |
+
// ----- Return
|
5199 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5200 |
+
return $v_result;
|
5201 |
+
}
|
5202 |
+
// --------------------------------------------------------------------------------
|
5203 |
+
|
5204 |
+
// --------------------------------------------------------------------------------
|
5205 |
+
// Function : privDuplicate()
|
5206 |
+
// Description :
|
5207 |
+
// Parameters :
|
5208 |
+
// Return Values :
|
5209 |
+
// --------------------------------------------------------------------------------
|
5210 |
+
function privDuplicate($p_archive_filename)
|
5211 |
+
{
|
5212 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privDuplicate", "archive_filename='$p_archive_filename'");
|
5213 |
+
$v_result=1;
|
5214 |
+
|
5215 |
+
// ----- Look if the $p_archive_filename exists
|
5216 |
+
if (!is_file($p_archive_filename))
|
5217 |
+
{
|
5218 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Archive to duplicate does not exist. End of duplicate.");
|
5219 |
+
|
5220 |
+
// ----- Nothing to duplicate, so duplicate is a success.
|
5221 |
+
$v_result = 1;
|
5222 |
+
|
5223 |
+
// ----- Return
|
5224 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5225 |
+
return $v_result;
|
5226 |
+
}
|
5227 |
+
|
5228 |
+
// ----- Open the zip file
|
5229 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5230 |
+
if (($v_result=$this->privOpenFd('wb')) != 1)
|
5231 |
+
{
|
5232 |
+
// ----- Return
|
5233 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5234 |
+
return $v_result;
|
5235 |
+
}
|
5236 |
+
|
5237 |
+
// ----- Open the temporary file in write mode
|
5238 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode");
|
5239 |
+
if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0)
|
5240 |
+
{
|
5241 |
+
$this->privCloseFd();
|
5242 |
+
|
5243 |
+
PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \''.$p_archive_filename.'\' in binary write mode');
|
5244 |
+
|
5245 |
+
// ----- Return
|
5246 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo());
|
5247 |
+
return PclZip::errorCode();
|
5248 |
+
}
|
5249 |
+
|
5250 |
+
// ----- Copy the files from the archive to the temporary file
|
5251 |
+
// TBC : Here I should better append the file and go back to erase the central dir
|
5252 |
+
$v_size = filesize($p_archive_filename);
|
5253 |
+
while ($v_size != 0)
|
5254 |
+
{
|
5255 |
+
$v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE);
|
5256 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Read $v_read_size bytes");
|
5257 |
+
$v_buffer = fread($v_zip_temp_fd, $v_read_size);
|
5258 |
+
@fwrite($this->zip_fd, $v_buffer, $v_read_size);
|
5259 |
+
$v_size -= $v_read_size;
|
5260 |
+
}
|
5261 |
+
|
5262 |
+
// ----- Close
|
5263 |
+
$this->privCloseFd();
|
5264 |
+
|
5265 |
+
// ----- Close the temporary file
|
5266 |
+
@fclose($v_zip_temp_fd);
|
5267 |
+
|
5268 |
+
// ----- Return
|
5269 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5270 |
+
return $v_result;
|
5271 |
+
}
|
5272 |
+
// --------------------------------------------------------------------------------
|
5273 |
+
|
5274 |
+
// --------------------------------------------------------------------------------
|
5275 |
+
// Function : privErrorLog()
|
5276 |
+
// Description :
|
5277 |
+
// Parameters :
|
5278 |
+
// --------------------------------------------------------------------------------
|
5279 |
+
function privErrorLog($p_error_code=0, $p_error_string='')
|
5280 |
+
{
|
5281 |
+
if (PCLZIP_ERROR_EXTERNAL == 1) {
|
5282 |
+
PclError($p_error_code, $p_error_string);
|
5283 |
+
}
|
5284 |
+
else {
|
5285 |
+
$this->error_code = $p_error_code;
|
5286 |
+
$this->error_string = $p_error_string;
|
5287 |
+
}
|
5288 |
+
}
|
5289 |
+
// --------------------------------------------------------------------------------
|
5290 |
+
|
5291 |
+
// --------------------------------------------------------------------------------
|
5292 |
+
// Function : privErrorReset()
|
5293 |
+
// Description :
|
5294 |
+
// Parameters :
|
5295 |
+
// --------------------------------------------------------------------------------
|
5296 |
+
function privErrorReset()
|
5297 |
+
{
|
5298 |
+
if (PCLZIP_ERROR_EXTERNAL == 1) {
|
5299 |
+
PclErrorReset();
|
5300 |
+
}
|
5301 |
+
else {
|
5302 |
+
$this->error_code = 0;
|
5303 |
+
$this->error_string = '';
|
5304 |
+
}
|
5305 |
+
}
|
5306 |
+
// --------------------------------------------------------------------------------
|
5307 |
+
|
5308 |
+
// --------------------------------------------------------------------------------
|
5309 |
+
// Function : privDecrypt()
|
5310 |
+
// Description :
|
5311 |
+
// Parameters :
|
5312 |
+
// Return Values :
|
5313 |
+
// --------------------------------------------------------------------------------
|
5314 |
+
function privDecrypt($p_encryption_header, &$p_buffer, $p_size, $p_crc)
|
5315 |
+
{
|
5316 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDecrypt', "size=".$p_size."");
|
5317 |
+
$v_result=1;
|
5318 |
+
|
5319 |
+
// ----- To Be Modified ;-)
|
5320 |
+
$v_pwd = "test";
|
5321 |
+
|
5322 |
+
$p_buffer = PclZipUtilZipDecrypt($p_buffer, $p_size, $p_encryption_header,
|
5323 |
+
$p_crc, $v_pwd);
|
5324 |
+
|
5325 |
+
// ----- Return
|
5326 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5327 |
+
return $v_result;
|
5328 |
+
}
|
5329 |
+
// --------------------------------------------------------------------------------
|
5330 |
+
|
5331 |
+
// --------------------------------------------------------------------------------
|
5332 |
+
// Function : privDisableMagicQuotes()
|
5333 |
+
// Description :
|
5334 |
+
// Parameters :
|
5335 |
+
// Return Values :
|
5336 |
+
// --------------------------------------------------------------------------------
|
5337 |
+
function privDisableMagicQuotes()
|
5338 |
+
{
|
5339 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privDisableMagicQuotes', "");
|
5340 |
+
$v_result=1;
|
5341 |
+
|
5342 |
+
// ----- Look if function exists
|
5343 |
+
if ( (!function_exists("get_magic_quotes_runtime"))
|
5344 |
+
|| (!function_exists("set_magic_quotes_runtime"))) {
|
5345 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
|
5346 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5347 |
+
return $v_result;
|
5348 |
+
}
|
5349 |
+
|
5350 |
+
// ----- Look if already done
|
5351 |
+
if ($this->magic_quotes_status != -1) {
|
5352 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote already disabled");
|
5353 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5354 |
+
return $v_result;
|
5355 |
+
}
|
5356 |
+
|
5357 |
+
// ----- Get and memorize the magic_quote value
|
5358 |
+
$this->magic_quotes_status = @get_magic_quotes_runtime();
|
5359 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Current magic_quotes_runtime status is '".($this->magic_quotes_status==0?'disable':'enable')."'");
|
5360 |
+
|
5361 |
+
// ----- Disable magic_quotes
|
5362 |
+
if ($this->magic_quotes_status == 1) {
|
5363 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Disable magic_quotes");
|
5364 |
+
@set_magic_quotes_runtime(0);
|
5365 |
+
}
|
5366 |
+
|
5367 |
+
// ----- Return
|
5368 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5369 |
+
return $v_result;
|
5370 |
+
}
|
5371 |
+
// --------------------------------------------------------------------------------
|
5372 |
+
|
5373 |
+
// --------------------------------------------------------------------------------
|
5374 |
+
// Function : privSwapBackMagicQuotes()
|
5375 |
+
// Description :
|
5376 |
+
// Parameters :
|
5377 |
+
// Return Values :
|
5378 |
+
// --------------------------------------------------------------------------------
|
5379 |
+
function privSwapBackMagicQuotes()
|
5380 |
+
{
|
5381 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, 'PclZip::privSwapBackMagicQuotes', "");
|
5382 |
+
$v_result=1;
|
5383 |
+
|
5384 |
+
// ----- Look if function exists
|
5385 |
+
if ( (!function_exists("get_magic_quotes_runtime"))
|
5386 |
+
|| (!function_exists("set_magic_quotes_runtime"))) {
|
5387 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Functions *et_magic_quotes_runtime are not supported");
|
5388 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5389 |
+
return $v_result;
|
5390 |
+
}
|
5391 |
+
|
5392 |
+
// ----- Look if something to do
|
5393 |
+
if ($this->magic_quotes_status != -1) {
|
5394 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "magic_quote not modified");
|
5395 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5396 |
+
return $v_result;
|
5397 |
+
}
|
5398 |
+
|
5399 |
+
// ----- Swap back magic_quotes
|
5400 |
+
if ($this->magic_quotes_status == 1) {
|
5401 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Enable back magic_quotes");
|
5402 |
+
@set_magic_quotes_runtime($this->magic_quotes_status);
|
5403 |
+
}
|
5404 |
+
|
5405 |
+
// ----- Return
|
5406 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5407 |
+
return $v_result;
|
5408 |
+
}
|
5409 |
+
// --------------------------------------------------------------------------------
|
5410 |
+
|
5411 |
+
}
|
5412 |
+
// End of class
|
5413 |
+
// --------------------------------------------------------------------------------
|
5414 |
+
|
5415 |
+
// --------------------------------------------------------------------------------
|
5416 |
+
// Function : PclZipUtilPathReduction()
|
5417 |
+
// Description :
|
5418 |
+
// Parameters :
|
5419 |
+
// Return Values :
|
5420 |
+
// --------------------------------------------------------------------------------
|
5421 |
+
function PclZipUtilPathReduction($p_dir)
|
5422 |
+
{
|
5423 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathReduction", "dir='$p_dir'");
|
5424 |
+
$v_result = "";
|
5425 |
+
|
5426 |
+
// ----- Look for not empty path
|
5427 |
+
if ($p_dir != "") {
|
5428 |
+
// ----- Explode path by directory names
|
5429 |
+
$v_list = explode("/", $p_dir);
|
5430 |
+
|
5431 |
+
// ----- Study directories from last to first
|
5432 |
+
$v_skip = 0;
|
5433 |
+
for ($i=sizeof($v_list)-1; $i>=0; $i--) {
|
5434 |
+
// ----- Look for current path
|
5435 |
+
if ($v_list[$i] == ".") {
|
5436 |
+
// ----- Ignore this directory
|
5437 |
+
// Should be the first $i=0, but no check is done
|
5438 |
+
}
|
5439 |
+
else if ($v_list[$i] == "..") {
|
5440 |
+
$v_skip++;
|
5441 |
+
}
|
5442 |
+
else if ($v_list[$i] == "") {
|
5443 |
+
// ----- First '/' i.e. root slash
|
5444 |
+
if ($i == 0) {
|
5445 |
+
$v_result = "/".$v_result;
|
5446 |
+
if ($v_skip > 0) {
|
5447 |
+
// ----- It is an invalid path, so the path is not modified
|
5448 |
+
// TBC
|
5449 |
+
$v_result = $p_dir;
|
5450 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Invalid path is unchanged");
|
5451 |
+
$v_skip = 0;
|
5452 |
+
}
|
5453 |
+
}
|
5454 |
+
// ----- Last '/' i.e. indicates a directory
|
5455 |
+
else if ($i == (sizeof($v_list)-1)) {
|
5456 |
+
$v_result = $v_list[$i];
|
5457 |
+
}
|
5458 |
+
// ----- Double '/' inside the path
|
5459 |
+
else {
|
5460 |
+
// ----- Ignore only the double '//' in path,
|
5461 |
+
// but not the first and last '/'
|
5462 |
+
}
|
5463 |
+
}
|
5464 |
+
else {
|
5465 |
+
// ----- Look for item to skip
|
5466 |
+
if ($v_skip > 0) {
|
5467 |
+
$v_skip--;
|
5468 |
+
}
|
5469 |
+
else {
|
5470 |
+
$v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
|
5471 |
+
}
|
5472 |
+
}
|
5473 |
+
}
|
5474 |
+
|
5475 |
+
// ----- Look for skip
|
5476 |
+
if ($v_skip > 0) {
|
5477 |
+
while ($v_skip > 0) {
|
5478 |
+
$v_result = '../'.$v_result;
|
5479 |
+
$v_skip--;
|
5480 |
+
}
|
5481 |
+
}
|
5482 |
+
}
|
5483 |
+
|
5484 |
+
// ----- Return
|
5485 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5486 |
+
return $v_result;
|
5487 |
+
}
|
5488 |
+
// --------------------------------------------------------------------------------
|
5489 |
+
|
5490 |
+
// --------------------------------------------------------------------------------
|
5491 |
+
// Function : PclZipUtilPathInclusion()
|
5492 |
+
// Description :
|
5493 |
+
// This function indicates if the path $p_path is under the $p_dir tree. Or,
|
5494 |
+
// said in an other way, if the file or sub-dir $p_path is inside the dir
|
5495 |
+
// $p_dir.
|
5496 |
+
// The function indicates also if the path is exactly the same as the dir.
|
5497 |
+
// This function supports path with duplicated '/' like '//', but does not
|
5498 |
+
// support '.' or '..' statements.
|
5499 |
+
// Parameters :
|
5500 |
+
// Return Values :
|
5501 |
+
// 0 if $p_path is not inside directory $p_dir
|
5502 |
+
// 1 if $p_path is inside directory $p_dir
|
5503 |
+
// 2 if $p_path is exactly the same as $p_dir
|
5504 |
+
// --------------------------------------------------------------------------------
|
5505 |
+
function PclZipUtilPathInclusion($p_dir, $p_path)
|
5506 |
+
{
|
5507 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilPathInclusion", "dir='$p_dir', path='$p_path'");
|
5508 |
+
$v_result = 1;
|
5509 |
+
|
5510 |
+
// ----- Look for path beginning by ./
|
5511 |
+
if ( ($p_dir == '.')
|
5512 |
+
|| ((strlen($p_dir) >=2) && (substr($p_dir, 0, 2) == './'))) {
|
5513 |
+
$p_dir = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_dir, 1);
|
5514 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_dir '".$p_dir."'");
|
5515 |
+
}
|
5516 |
+
if ( ($p_path == '.')
|
5517 |
+
|| ((strlen($p_path) >=2) && (substr($p_path, 0, 2) == './'))) {
|
5518 |
+
$p_path = PclZipUtilTranslateWinPath(getcwd(), FALSE).'/'.substr($p_path, 1);
|
5519 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Replacing ./ by full path in p_path '".$p_path."'");
|
5520 |
+
}
|
5521 |
+
|
5522 |
+
// ----- Explode dir and path by directory separator
|
5523 |
+
$v_list_dir = explode("/", $p_dir);
|
5524 |
+
$v_list_dir_size = sizeof($v_list_dir);
|
5525 |
+
$v_list_path = explode("/", $p_path);
|
5526 |
+
$v_list_path_size = sizeof($v_list_path);
|
5527 |
+
|
5528 |
+
// ----- Study directories paths
|
5529 |
+
$i = 0;
|
5530 |
+
$j = 0;
|
5531 |
+
while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) {
|
5532 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Working on dir($i)='".$v_list_dir[$i]."' and path($j)='".$v_list_path[$j]."'");
|
5533 |
+
|
5534 |
+
// ----- Look for empty dir (path reduction)
|
5535 |
+
if ($v_list_dir[$i] == '') {
|
5536 |
+
$i++;
|
5537 |
+
continue;
|
5538 |
+
}
|
5539 |
+
if ($v_list_path[$j] == '') {
|
5540 |
+
$j++;
|
5541 |
+
continue;
|
5542 |
+
}
|
5543 |
+
|
5544 |
+
// ----- Compare the items
|
5545 |
+
if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ( $v_list_path[$j] != '')) {
|
5546 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Items ($i,$j) are different");
|
5547 |
+
$v_result = 0;
|
5548 |
+
}
|
5549 |
+
|
5550 |
+
// ----- Next items
|
5551 |
+
$i++;
|
5552 |
+
$j++;
|
5553 |
+
}
|
5554 |
+
|
5555 |
+
// ----- Look if everything seems to be the same
|
5556 |
+
if ($v_result) {
|
5557 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Look for tie break");
|
5558 |
+
// ----- Skip all the empty items
|
5559 |
+
while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) $j++;
|
5560 |
+
while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) $i++;
|
5561 |
+
//--(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]:'')."'");
|
5562 |
+
|
5563 |
+
if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) {
|
5564 |
+
// ----- There are exactly the same
|
5565 |
+
$v_result = 2;
|
5566 |
+
}
|
5567 |
+
else if ($i < $v_list_dir_size) {
|
5568 |
+
// ----- The path is shorter than the dir
|
5569 |
+
$v_result = 0;
|
5570 |
+
}
|
5571 |
+
}
|
5572 |
+
|
5573 |
+
// ----- Return
|
5574 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5575 |
+
return $v_result;
|
5576 |
+
}
|
5577 |
+
// --------------------------------------------------------------------------------
|
5578 |
+
|
5579 |
+
// --------------------------------------------------------------------------------
|
5580 |
+
// Function : PclZipUtilCopyBlock()
|
5581 |
+
// Description :
|
5582 |
+
// Parameters :
|
5583 |
+
// $p_mode : read/write compression mode
|
5584 |
+
// 0 : src & dest normal
|
5585 |
+
// 1 : src gzip, dest normal
|
5586 |
+
// 2 : src normal, dest gzip
|
5587 |
+
// 3 : src & dest gzip
|
5588 |
+
// Return Values :
|
5589 |
+
// --------------------------------------------------------------------------------
|
5590 |
+
function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode=0)
|
5591 |
+
{
|
5592 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilCopyBlock", "size=$p_size, mode=$p_mode");
|
5593 |
+
$v_result = 1;
|
5594 |
+
|
5595 |
+
if ($p_mode==0)
|
5596 |
+
{
|
5597 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset before read :".(@ftell($p_src)));
|
5598 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset before write :".(@ftell($p_dest)));
|
5599 |
+
while ($p_size != 0)
|
5600 |
+
{
|
5601 |
+
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
5602 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5603 |
+
$v_buffer = @fread($p_src, $v_read_size);
|
5604 |
+
@fwrite($p_dest, $v_buffer, $v_read_size);
|
5605 |
+
$p_size -= $v_read_size;
|
5606 |
+
}
|
5607 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Src offset after read :".(@ftell($p_src)));
|
5608 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Dest offset after write :".(@ftell($p_dest)));
|
5609 |
+
}
|
5610 |
+
else if ($p_mode==1)
|
5611 |
+
{
|
5612 |
+
while ($p_size != 0)
|
5613 |
+
{
|
5614 |
+
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
5615 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5616 |
+
$v_buffer = @gzread($p_src, $v_read_size);
|
5617 |
+
@fwrite($p_dest, $v_buffer, $v_read_size);
|
5618 |
+
$p_size -= $v_read_size;
|
5619 |
+
}
|
5620 |
+
}
|
5621 |
+
else if ($p_mode==2)
|
5622 |
+
{
|
5623 |
+
while ($p_size != 0)
|
5624 |
+
{
|
5625 |
+
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
5626 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5627 |
+
$v_buffer = @fread($p_src, $v_read_size);
|
5628 |
+
@gzwrite($p_dest, $v_buffer, $v_read_size);
|
5629 |
+
$p_size -= $v_read_size;
|
5630 |
+
}
|
5631 |
+
}
|
5632 |
+
else if ($p_mode==3)
|
5633 |
+
{
|
5634 |
+
while ($p_size != 0)
|
5635 |
+
{
|
5636 |
+
$v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE);
|
5637 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Read $v_read_size bytes");
|
5638 |
+
$v_buffer = @gzread($p_src, $v_read_size);
|
5639 |
+
@gzwrite($p_dest, $v_buffer, $v_read_size);
|
5640 |
+
$p_size -= $v_read_size;
|
5641 |
+
}
|
5642 |
+
}
|
5643 |
+
|
5644 |
+
// ----- Return
|
5645 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5646 |
+
return $v_result;
|
5647 |
+
}
|
5648 |
+
// --------------------------------------------------------------------------------
|
5649 |
+
|
5650 |
+
// --------------------------------------------------------------------------------
|
5651 |
+
// Function : PclZipUtilRename()
|
5652 |
+
// Description :
|
5653 |
+
// This function tries to do a simple rename() function. If it fails, it
|
5654 |
+
// tries to copy the $p_src file in a new $p_dest file and then unlink the
|
5655 |
+
// first one.
|
5656 |
+
// Parameters :
|
5657 |
+
// $p_src : Old filename
|
5658 |
+
// $p_dest : New filename
|
5659 |
+
// Return Values :
|
5660 |
+
// 1 on success, 0 on failure.
|
5661 |
+
// --------------------------------------------------------------------------------
|
5662 |
+
function PclZipUtilRename($p_src, $p_dest)
|
5663 |
+
{
|
5664 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilRename", "source=$p_src, destination=$p_dest");
|
5665 |
+
$v_result = 1;
|
5666 |
+
|
5667 |
+
// ----- Try to rename the files
|
5668 |
+
if (!@rename($p_src, $p_dest)) {
|
5669 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to rename file, try copy+unlink");
|
5670 |
+
|
5671 |
+
// ----- Try to copy & unlink the src
|
5672 |
+
if (!@copy($p_src, $p_dest)) {
|
5673 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to copy file");
|
5674 |
+
$v_result = 0;
|
5675 |
+
}
|
5676 |
+
else if (!@unlink($p_src)) {
|
5677 |
+
//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 5, "Fail to unlink old filename");
|
5678 |
+
$v_result = 0;
|
5679 |
+
}
|
5680 |
+
}
|
5681 |
+
|
5682 |
+
// ----- Return
|
5683 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5684 |
+
return $v_result;
|
5685 |
+
}
|
5686 |
+
// --------------------------------------------------------------------------------
|
5687 |
+
|
5688 |
+
// --------------------------------------------------------------------------------
|
5689 |
+
// Function : PclZipUtilOptionText()
|
5690 |
+
// Description :
|
5691 |
+
// Translate option value in text. Mainly for debug purpose.
|
5692 |
+
// Parameters :
|
5693 |
+
// $p_option : the option value.
|
5694 |
+
// Return Values :
|
5695 |
+
// The option text value.
|
5696 |
+
// --------------------------------------------------------------------------------
|
5697 |
+
function PclZipUtilOptionText($p_option)
|
5698 |
+
{
|
5699 |
+
//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZipUtilOptionText", "option='".$p_option."'");
|
5700 |
+
|
5701 |
+
$v_list = get_defined_constants();
|
5702 |
+
for (reset($v_list); $v_key = key($v_list); next($v_list)) {
|
5703 |
+
$v_prefix = substr($v_key, 0, 10);
|
5704 |
+
if (( ($v_prefix == 'PCLZIP_OPT')
|
5705 |
+
|| ($v_prefix == 'PCLZIP_CB_')
|
5706 |
+
|| ($v_prefix == 'PCLZIP_ATT'))
|
5707 |
+
&& ($v_list[$v_key] == $p_option)) {
|
5708 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_key);
|
5709 |
+
return $v_key;
|
5710 |
+
}
|
5711 |
+
}
|
5712 |
+
|
5713 |
+
$v_result = 'Unknown';
|
5714 |
+
|
5715 |
+
//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result);
|
5716 |
+
return $v_result;
|
5717 |
+
}
|
5718 |
+
// --------------------------------------------------------------------------------
|
5719 |
+
|
5720 |
+
// --------------------------------------------------------------------------------
|
5721 |
+
// Function : PclZipUtilTranslateWinPath()
|
5722 |
+
// Description :
|
5723 |
+
// Translate windows path by replacing '\' by '/' and optionally removing
|
5724 |
+
// drive letter.
|
5725 |
+
// Parameters :
|
5726 |
+
// $p_path : path to translate.
|
5727 |
+
// $p_remove_disk_letter : true | false
|
5728 |
+
// Return Values :
|
5729 |
+
// The path translated.
|
5730 |
+
// --------------------------------------------------------------------------------
|
5731 |
+
function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter=true)
|
5732 |
+
{
|
5733 |
+
if (stristr(php_uname(), 'windows')) {
|
5734 |
+
// ----- Look for potential disk letter
|
5735 |
+
if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) {
|
5736 |
+
$p_path = substr($p_path, $v_position+1);
|
5737 |
+
}
|
5738 |
+
// ----- Change potential windows directory separator
|
5739 |
+
if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0,1) == '\\')) {
|
5740 |
+
$p_path = strtr($p_path, '\\', '/');
|
5741 |
+
}
|
5742 |
+
}
|
5743 |
+
return $p_path;
|
5744 |
+
}
|
5745 |
+
// --------------------------------------------------------------------------------
|
5746 |
+
|
5747 |
+
|
5748 |
+
?>
|
lib/thumbnail.inc.php
ADDED
@@ -0,0 +1,858 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* thumbnail.inc.php
|
4 |
+
*
|
5 |
+
* @author Ian Selby (ian@gen-x-design.com)
|
6 |
+
* @copyright Copyright 2006
|
7 |
+
* @version 1.1.1 (PHP4)
|
8 |
+
* @modded by Alex Rabe
|
9 |
+
*
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* PHP class for dynamically resizing, cropping, and rotating images for thumbnail purposes and either displaying them on-the-fly or saving them.
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class Thumbnail {
|
17 |
+
/**
|
18 |
+
* Error message to display, if any
|
19 |
+
*
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
var $errmsg;
|
23 |
+
/**
|
24 |
+
* Whether or not there is an error
|
25 |
+
*
|
26 |
+
* @var boolean
|
27 |
+
*/
|
28 |
+
var $error;
|
29 |
+
/**
|
30 |
+
* Format of the image file
|
31 |
+
*
|
32 |
+
* @var string
|
33 |
+
*/
|
34 |
+
var $format;
|
35 |
+
/**
|
36 |
+
* File name and path of the image file
|
37 |
+
*
|
38 |
+
* @var string
|
39 |
+
*/
|
40 |
+
var $fileName;
|
41 |
+
/**
|
42 |
+
* Image meta data if any is available (jpeg/tiff) via the exif library
|
43 |
+
*
|
44 |
+
* @var array
|
45 |
+
*/
|
46 |
+
var $imageMeta;
|
47 |
+
/**
|
48 |
+
* Current dimensions of working image
|
49 |
+
*
|
50 |
+
* @var array
|
51 |
+
*/
|
52 |
+
var $currentDimensions;
|
53 |
+
/**
|
54 |
+
* New dimensions of working image
|
55 |
+
*
|
56 |
+
* @var array
|
57 |
+
*/
|
58 |
+
var $newDimensions;
|
59 |
+
/**
|
60 |
+
* Image resource for newly manipulated image
|
61 |
+
*
|
62 |
+
* @var resource
|
63 |
+
* @access private
|
64 |
+
*/
|
65 |
+
var $newImage;
|
66 |
+
/**
|
67 |
+
* Image resource for image before previous manipulation
|
68 |
+
*
|
69 |
+
* @var resource
|
70 |
+
* @access private
|
71 |
+
*/
|
72 |
+
var $oldImage;
|
73 |
+
/**
|
74 |
+
* Image resource for image being currently manipulated
|
75 |
+
*
|
76 |
+
* @var resource
|
77 |
+
* @access private
|
78 |
+
*/
|
79 |
+
var $workingImage;
|
80 |
+
/**
|
81 |
+
* Percentage to resize image by
|
82 |
+
*
|
83 |
+
* @var int
|
84 |
+
* @access private
|
85 |
+
*/
|
86 |
+
var $percent;
|
87 |
+
/**
|
88 |
+
* Maximum width of image during resize
|
89 |
+
*
|
90 |
+
* @var int
|
91 |
+
* @access private
|
92 |
+
*/
|
93 |
+
var $maxWidth;
|
94 |
+
/**
|
95 |
+
* Maximum height of image during resize
|
96 |
+
*
|
97 |
+
* @var int
|
98 |
+
* @access private
|
99 |
+
*/
|
100 |
+
var $maxHeight;
|
101 |
+
/**
|
102 |
+
* Image for Watermark
|
103 |
+
*
|
104 |
+
* @var string
|
105 |
+
*
|
106 |
+
*/
|
107 |
+
var $watermarkImgPath;
|
108 |
+
/**
|
109 |
+
* Text for Watermark
|
110 |
+
*
|
111 |
+
* @var string
|
112 |
+
*
|
113 |
+
*/
|
114 |
+
var $watermarkText;
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Class constructor
|
118 |
+
*
|
119 |
+
* @param string $fileName
|
120 |
+
* @return Thumbnail
|
121 |
+
*/
|
122 |
+
function Thumbnail($fileName,$no_ErrorImage = false) {
|
123 |
+
//make sure the GD library is installed
|
124 |
+
if(!function_exists("gd_info")) {
|
125 |
+
echo 'You do not have the GD Library installed. This class requires the GD library to function properly.' . "\n";
|
126 |
+
echo 'visit http://us2.php.net/manual/en/ref.image.php for more information';
|
127 |
+
exit;
|
128 |
+
}
|
129 |
+
//initialize variables
|
130 |
+
$this->errmsg = '';
|
131 |
+
$this->error = false;
|
132 |
+
$this->currentDimensions = array();
|
133 |
+
$this->newDimensions = array();
|
134 |
+
$this->fileName = $fileName;
|
135 |
+
$this->imageMeta = array();
|
136 |
+
$this->percent = 100;
|
137 |
+
$this->maxWidth = 0;
|
138 |
+
$this->maxHeight = 0;
|
139 |
+
$this->watermarkImgPath = '';
|
140 |
+
$this->watermarkText = '';
|
141 |
+
|
142 |
+
//check to see if file exists
|
143 |
+
if(!file_exists($this->fileName)) {
|
144 |
+
$this->errmsg = 'File not found';
|
145 |
+
$this->error = true;
|
146 |
+
}
|
147 |
+
//check to see if file is readable
|
148 |
+
elseif(!is_readable($this->fileName)) {
|
149 |
+
$this->errmsg = 'File is not readable';
|
150 |
+
$this->error = true;
|
151 |
+
}
|
152 |
+
|
153 |
+
//if there are no errors, determine the file format
|
154 |
+
if($this->error == false) {
|
155 |
+
//check if gif
|
156 |
+
if(stristr(strtolower($this->fileName),'.gif')) $this->format = 'GIF';
|
157 |
+
//check if jpg
|
158 |
+
elseif(stristr(strtolower($this->fileName),'.jpg') || stristr(strtolower($this->fileName),'.jpeg')) $this->format = 'JPG';
|
159 |
+
//check if png
|
160 |
+
elseif(stristr(strtolower($this->fileName),'.png')) $this->format = 'PNG';
|
161 |
+
//unknown file format
|
162 |
+
else {
|
163 |
+
$this->errmsg = 'Unknown file format';
|
164 |
+
$this->error = true;
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
//initialize resources if no errors
|
169 |
+
if($this->error == false) {
|
170 |
+
switch($this->format) {
|
171 |
+
case 'GIF':
|
172 |
+
$this->oldImage = ImageCreateFromGif($this->fileName);
|
173 |
+
break;
|
174 |
+
case 'JPG':
|
175 |
+
$this->oldImage = ImageCreateFromJpeg($this->fileName);
|
176 |
+
break;
|
177 |
+
case 'PNG':
|
178 |
+
$this->oldImage = ImageCreateFromPng($this->fileName);
|
179 |
+
break;
|
180 |
+
}
|
181 |
+
|
182 |
+
$size = GetImageSize($this->fileName);
|
183 |
+
$this->currentDimensions = array('width'=>$size[0],'height'=>$size[1]);
|
184 |
+
$this->newImage = $this->oldImage;
|
185 |
+
$this->gatherImageMeta();
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
if($this->error == true) {
|
190 |
+
if(!$no_ErrorImage)
|
191 |
+
$this->showErrorImage();
|
192 |
+
return;
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Must be called to free up allocated memory after all manipulations are done
|
198 |
+
*
|
199 |
+
*/
|
200 |
+
function destruct() {
|
201 |
+
if(is_resource($this->newImage)) @ImageDestroy($this->newImage);
|
202 |
+
if(is_resource($this->oldImage)) @ImageDestroy($this->oldImage);
|
203 |
+
if(is_resource($this->workingImage)) @ImageDestroy($this->workingImage);
|
204 |
+
}
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Returns the current width of the image
|
208 |
+
*
|
209 |
+
* @return int
|
210 |
+
*/
|
211 |
+
function getCurrentWidth() {
|
212 |
+
return $this->currentDimensions['width'];
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Returns the current height of the image
|
217 |
+
*
|
218 |
+
* @return int
|
219 |
+
*/
|
220 |
+
function getCurrentHeight() {
|
221 |
+
return $this->currentDimensions['height'];
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Calculates new image width
|
226 |
+
*
|
227 |
+
* @param int $width
|
228 |
+
* @param int $height
|
229 |
+
* @return array
|
230 |
+
*/
|
231 |
+
function calcWidth($width,$height) {
|
232 |
+
$newWp = (100 * $this->maxWidth) / $width;
|
233 |
+
$newHeight = ($height * $newWp) / 100;
|
234 |
+
return array('newWidth'=>intval($this->maxWidth),'newHeight'=>intval($newHeight));
|
235 |
+
}
|
236 |
+
|
237 |
+
/**
|
238 |
+
* Calculates new image height
|
239 |
+
*
|
240 |
+
* @param int $width
|
241 |
+
* @param int $height
|
242 |
+
* @return array
|
243 |
+
*/
|
244 |
+
function calcHeight($width,$height) {
|
245 |
+
$newHp = (100 * $this->maxHeight) / $height;
|
246 |
+
$newWidth = ($width * $newHp) / 100;
|
247 |
+
return array('newWidth'=>intval($newWidth),'newHeight'=>intval($this->maxHeight));
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Calculates new image size based on percentage
|
252 |
+
*
|
253 |
+
* @param int $width
|
254 |
+
* @param int $height
|
255 |
+
* @return array
|
256 |
+
*/
|
257 |
+
function calcPercent($width,$height) {
|
258 |
+
$newWidth = ($width * $this->percent) / 100;
|
259 |
+
$newHeight = ($height * $this->percent) / 100;
|
260 |
+
return array('newWidth'=>intval($newWidth),'newHeight'=>intval($newHeight));
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Calculates new image size based on width and height, while constraining to maxWidth and maxHeight
|
265 |
+
*
|
266 |
+
* @param int $width
|
267 |
+
* @param int $height
|
268 |
+
*/
|
269 |
+
function calcImageSize($width,$height) {
|
270 |
+
$newSize = array('newWidth'=>$width,'newHeight'=>$height);
|
271 |
+
|
272 |
+
if($this->maxWidth > 0) {
|
273 |
+
|
274 |
+
$newSize = $this->calcWidth($width,$height);
|
275 |
+
|
276 |
+
if($this->maxHeight > 0 && $newSize['newHeight'] > $this->maxHeight) {
|
277 |
+
$newSize = $this->calcHeight($newSize['newWidth'],$newSize['newHeight']);
|
278 |
+
}
|
279 |
+
|
280 |
+
//$this->newDimensions = $newSize;
|
281 |
+
}
|
282 |
+
|
283 |
+
if($this->maxHeight > 0) {
|
284 |
+
$newSize = $this->calcHeight($width,$height);
|
285 |
+
|
286 |
+
if($this->maxWidth > 0 && $newSize['newWidth'] > $this->maxWidth) {
|
287 |
+
$newSize = $this->calcWidth($newSize['newWidth'],$newSize['newHeight']);
|
288 |
+
}
|
289 |
+
|
290 |
+
//$this->newDimensions = $newSize;
|
291 |
+
}
|
292 |
+
|
293 |
+
$this->newDimensions = $newSize;
|
294 |
+
}
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Calculates new image size based percentage
|
298 |
+
*
|
299 |
+
* @param int $width
|
300 |
+
* @param int $height
|
301 |
+
*/
|
302 |
+
function calcImageSizePercent($width,$height) {
|
303 |
+
if($this->percent > 0) {
|
304 |
+
$this->newDimensions = $this->calcPercent($width,$height);
|
305 |
+
}
|
306 |
+
}
|
307 |
+
|
308 |
+
/**
|
309 |
+
* Displays error image
|
310 |
+
*
|
311 |
+
*/
|
312 |
+
function showErrorImage() {
|
313 |
+
header('Content-type: image/png');
|
314 |
+
$errImg = ImageCreate(220,25);
|
315 |
+
$bgColor = imagecolorallocate($errImg,0,0,0);
|
316 |
+
$fgColor1 = imagecolorallocate($errImg,255,255,255);
|
317 |
+
$fgColor2 = imagecolorallocate($errImg,255,0,0);
|
318 |
+
imagestring($errImg,3,6,6,'Error:',$fgColor2);
|
319 |
+
imagestring($errImg,3,55,6,$this->errmsg,$fgColor1);
|
320 |
+
imagepng($errImg);
|
321 |
+
imagedestroy($errImg);
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Resizes image to fixed Width x Height
|
326 |
+
*
|
327 |
+
* @param int $Width
|
328 |
+
* @param int $Height
|
329 |
+
*/
|
330 |
+
function resizeFix($Width = 0, $Height = 0, $resampleMode = 3) {
|
331 |
+
$this->newWidth = $Width;
|
332 |
+
$this->newHeight = $Height;
|
333 |
+
|
334 |
+
if(function_exists("ImageCreateTrueColor")) {
|
335 |
+
$this->workingImage = ImageCreateTrueColor($this->newWidth,$this->newHeight);
|
336 |
+
}
|
337 |
+
else {
|
338 |
+
$this->workingImage = ImageCreate($this->newWidth,$this->newHeight);
|
339 |
+
}
|
340 |
+
|
341 |
+
// ImageCopyResampled(
|
342 |
+
$this->fastimagecopyresampled(
|
343 |
+
$this->workingImage,
|
344 |
+
$this->oldImage,
|
345 |
+
0,
|
346 |
+
0,
|
347 |
+
0,
|
348 |
+
0,
|
349 |
+
$this->newWidth,
|
350 |
+
$this->newHeight,
|
351 |
+
$this->currentDimensions['width'],
|
352 |
+
$this->currentDimensions['height'],
|
353 |
+
$resampleMode
|
354 |
+
);
|
355 |
+
|
356 |
+
$this->oldImage = $this->workingImage;
|
357 |
+
$this->newImage = $this->workingImage;
|
358 |
+
$this->currentDimensions['width'] = $this->newWidth;
|
359 |
+
$this->currentDimensions['height'] = $this->newHeight;
|
360 |
+
}
|
361 |
+
|
362 |
+
|
363 |
+
/**
|
364 |
+
* Resizes image to maxWidth x maxHeight
|
365 |
+
*
|
366 |
+
* @param int $maxWidth
|
367 |
+
* @param int $maxHeight
|
368 |
+
*/
|
369 |
+
function resize($maxWidth = 0, $maxHeight = 0, $resampleMode = 3) {
|
370 |
+
$this->maxWidth = $maxWidth;
|
371 |
+
$this->maxHeight = $maxHeight;
|
372 |
+
|
373 |
+
$this->calcImageSize($this->currentDimensions['width'],$this->currentDimensions['height']);
|
374 |
+
|
375 |
+
if(function_exists("ImageCreateTrueColor")) {
|
376 |
+
$this->workingImage = ImageCreateTrueColor($this->newDimensions['newWidth'],$this->newDimensions['newHeight']);
|
377 |
+
}
|
378 |
+
else {
|
379 |
+
$this->workingImage = ImageCreate($this->newDimensions['newWidth'],$this->newDimensions['newHeight']);
|
380 |
+
}
|
381 |
+
|
382 |
+
// ImageCopyResampled(
|
383 |
+
$this->fastimagecopyresampled(
|
384 |
+
$this->workingImage,
|
385 |
+
$this->oldImage,
|
386 |
+
0,
|
387 |
+
0,
|
388 |
+
0,
|
389 |
+
0,
|
390 |
+
$this->newDimensions['newWidth'],
|
391 |
+
$this->newDimensions['newHeight'],
|
392 |
+
$this->currentDimensions['width'],
|
393 |
+
$this->currentDimensions['height'],
|
394 |
+
$resampleMode
|
395 |
+
);
|
396 |
+
|
397 |
+
$this->oldImage = $this->workingImage;
|
398 |
+
$this->newImage = $this->workingImage;
|
399 |
+
$this->currentDimensions['width'] = $this->newDimensions['newWidth'];
|
400 |
+
$this->currentDimensions['height'] = $this->newDimensions['newHeight'];
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* Resizes the image by $percent percent
|
405 |
+
*
|
406 |
+
* @param int $percent
|
407 |
+
*/
|
408 |
+
function resizePercent($percent = 0) {
|
409 |
+
$this->percent = $percent;
|
410 |
+
|
411 |
+
$this->calcImageSizePercent($this->currentDimensions['width'],$this->currentDimensions['height']);
|
412 |
+
|
413 |
+
if(function_exists("ImageCreateTrueColor")) {
|
414 |
+
$this->workingImage = ImageCreateTrueColor($this->newDimensions['newWidth'],$this->newDimensions['newHeight']);
|
415 |
+
}
|
416 |
+
else {
|
417 |
+
$this->workingImage = ImageCreate($this->newDimensions['newWidth'],$this->newDimensions['newHeight']);
|
418 |
+
}
|
419 |
+
|
420 |
+
ImageCopyResampled(
|
421 |
+
$this->workingImage,
|
422 |
+
$this->oldImage,
|
423 |
+
0,
|
424 |
+
0,
|
425 |
+
0,
|
426 |
+
0,
|
427 |
+
$this->newDimensions['newWidth'],
|
428 |
+
$this->newDimensions['newHeight'],
|
429 |
+
$this->currentDimensions['width'],
|
430 |
+
$this->currentDimensions['height']
|
431 |
+
);
|
432 |
+
|
433 |
+
$this->oldImage = $this->workingImage;
|
434 |
+
$this->newImage = $this->workingImage;
|
435 |
+
$this->currentDimensions['width'] = $this->newDimensions['newWidth'];
|
436 |
+
$this->currentDimensions['height'] = $this->newDimensions['newHeight'];
|
437 |
+
}
|
438 |
+
|
439 |
+
/**
|
440 |
+
* Crops the image from calculated center in a square of $cropSize pixels
|
441 |
+
*
|
442 |
+
* @param int $cropSize
|
443 |
+
*/
|
444 |
+
function cropFromCenter($cropSize, $resampleMode = 3) {
|
445 |
+
if($cropSize > $this->currentDimensions['width']) $cropSize = $this->currentDimensions['width'];
|
446 |
+
if($cropSize > $this->currentDimensions['height']) $cropSize = $this->currentDimensions['height'];
|
447 |
+
|
448 |
+
$cropX = intval(($this->currentDimensions['width'] - $cropSize) / 2);
|
449 |
+
$cropY = intval(($this->currentDimensions['height'] - $cropSize) / 2);
|
450 |
+
|
451 |
+
if(function_exists("ImageCreateTrueColor")) {
|
452 |
+
$this->workingImage = ImageCreateTrueColor($cropSize,$cropSize);
|
453 |
+
}
|
454 |
+
else {
|
455 |
+
$this->workingImage = ImageCreate($cropSize,$cropSize);
|
456 |
+
}
|
457 |
+
|
458 |
+
// imagecopyresampled(
|
459 |
+
$this->fastimagecopyresampled(
|
460 |
+
$this->workingImage,
|
461 |
+
$this->oldImage,
|
462 |
+
0,
|
463 |
+
0,
|
464 |
+
$cropX,
|
465 |
+
$cropY,
|
466 |
+
$cropSize,
|
467 |
+
$cropSize,
|
468 |
+
$cropSize,
|
469 |
+
$cropSize,
|
470 |
+
$resampleMode
|
471 |
+
);
|
472 |
+
|
473 |
+
$this->oldImage = $this->workingImage;
|
474 |
+
$this->newImage = $this->workingImage;
|
475 |
+
$this->currentDimensions['width'] = $cropSize;
|
476 |
+
$this->currentDimensions['height'] = $cropSize;
|
477 |
+
}
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Advanced cropping function that crops an image using $startX and $startY as the upper-left hand corner.
|
481 |
+
*
|
482 |
+
* @param int $startX
|
483 |
+
* @param int $startY
|
484 |
+
* @param int $width
|
485 |
+
* @param int $height
|
486 |
+
*/
|
487 |
+
function crop($startX,$startY,$width,$height) {
|
488 |
+
//make sure the cropped area is not greater than the size of the image
|
489 |
+
if($width > $this->currentDimensions['width']) $width = $this->currentDimensions['width'];
|
490 |
+
if($height > $this->currentDimensions['height']) $height = $this->currentDimensions['height'];
|
491 |
+
//make sure not starting outside the image
|
492 |
+
if(($startX + $width) > $this->currentDimensions['width']) $startX = ($this->currentDimensions['width'] - $width);
|
493 |
+
if(($startY + $height) > $this->currentDimensions['height']) $startY = ($this->currentDimensions['height'] - $height);
|
494 |
+
if($startX < 0) $startX = 0;
|
495 |
+
if($startY < 0) $startY = 0;
|
496 |
+
|
497 |
+
if(function_exists("ImageCreateTrueColor")) {
|
498 |
+
$this->workingImage = ImageCreateTrueColor($width,$height);
|
499 |
+
}
|
500 |
+
else {
|
501 |
+
$this->workingImage = ImageCreate($width,$height);
|
502 |
+
}
|
503 |
+
|
504 |
+
imagecopyresampled(
|
505 |
+
$this->workingImage,
|
506 |
+
$this->oldImage,
|
507 |
+
0,
|
508 |
+
0,
|
509 |
+
$startX,
|
510 |
+
$startY,
|
511 |
+
$width,
|
512 |
+
$height,
|
513 |
+
$width,
|
514 |
+
$height
|
515 |
+
);
|
516 |
+
|
517 |
+
$this->oldImage = $this->workingImage;
|
518 |
+
$this->newImage = $this->workingImage;
|
519 |
+
$this->currentDimensions['width'] = $width;
|
520 |
+
$this->currentDimensions['height'] = $height;
|
521 |
+
}
|
522 |
+
|
523 |
+
/**
|
524 |
+
* Outputs the image to the screen, or saves to $name if supplied. Quality of JPEG images can be controlled with the $quality variable
|
525 |
+
*
|
526 |
+
* @param int $quality
|
527 |
+
* @param string $name
|
528 |
+
*/
|
529 |
+
function show($quality=100,$name = '') {
|
530 |
+
switch($this->format) {
|
531 |
+
case 'GIF':
|
532 |
+
if($name != '') {
|
533 |
+
ImageGif($this->newImage,$name);
|
534 |
+
}
|
535 |
+
else {
|
536 |
+
header('Content-type: image/gif');
|
537 |
+
ImageGif($this->newImage);
|
538 |
+
}
|
539 |
+
break;
|
540 |
+
case 'JPG':
|
541 |
+
if($name != '') {
|
542 |
+
ImageJpeg($this->newImage,$name,$quality);
|
543 |
+
}
|
544 |
+
else {
|
545 |
+
header('Content-type: image/jpeg');
|
546 |
+
ImageJpeg($this->newImage,'',$quality);
|
547 |
+
}
|
548 |
+
break;
|
549 |
+
case 'PNG':
|
550 |
+
if($name != '') {
|
551 |
+
ImagePng($this->newImage,$name);
|
552 |
+
}
|
553 |
+
else {
|
554 |
+
header('Content-type: image/png');
|
555 |
+
ImagePng($this->newImage);
|
556 |
+
}
|
557 |
+
break;
|
558 |
+
}
|
559 |
+
}
|
560 |
+
|
561 |
+
/**
|
562 |
+
* Saves image as $name (can include file path), with quality of # percent if file is a jpeg
|
563 |
+
*
|
564 |
+
* @param string $name
|
565 |
+
* @param int $quality
|
566 |
+
*/
|
567 |
+
function save($name,$quality=100) {
|
568 |
+
$this->show($quality,$name);
|
569 |
+
}
|
570 |
+
|
571 |
+
/**
|
572 |
+
* Creates Apple-style reflection under image, optionally adding a border to main image
|
573 |
+
*
|
574 |
+
* @param int $percent
|
575 |
+
* @param int $reflection
|
576 |
+
* @param int $white
|
577 |
+
* @param bool $border
|
578 |
+
* @param string $borderColor
|
579 |
+
*/
|
580 |
+
function createReflection($percent,$reflection,$white,$border = true,$borderColor = '#a4a4a4') {
|
581 |
+
$width = $this->currentDimensions['width'];
|
582 |
+
$height = $this->currentDimensions['height'];
|
583 |
+
|
584 |
+
$reflectionHeight = intval($height * ($reflection / 100));
|
585 |
+
$newHeight = $height + $reflectionHeight;
|
586 |
+
$reflectedPart = $height * ($percent / 100);
|
587 |
+
|
588 |
+
$this->workingImage = ImageCreateTrueColor($width,$newHeight);
|
589 |
+
|
590 |
+
ImageAlphaBlending($this->workingImage,true);
|
591 |
+
|
592 |
+
$colorToPaint = ImageColorAllocateAlpha($this->workingImage,255,255,255,0);
|
593 |
+
ImageFilledRectangle($this->workingImage,0,0,$width,$newHeight,$colorToPaint);
|
594 |
+
|
595 |
+
imagecopyresampled(
|
596 |
+
$this->workingImage,
|
597 |
+
$this->newImage,
|
598 |
+
0,
|
599 |
+
0,
|
600 |
+
0,
|
601 |
+
$reflectedPart,
|
602 |
+
$width,
|
603 |
+
$reflectionHeight,
|
604 |
+
$width,
|
605 |
+
($height - $reflectedPart));
|
606 |
+
$this->imageFlipVertical();
|
607 |
+
|
608 |
+
imagecopy($this->workingImage,$this->newImage,0,0,0,0,$width,$height);
|
609 |
+
|
610 |
+
imagealphablending($this->workingImage,true);
|
611 |
+
|
612 |
+
for($i=0;$i<$reflectionHeight;$i++) {
|
613 |
+
$colorToPaint = imagecolorallocatealpha($this->workingImage,255,255,255,($i/$reflectionHeight*-1+1)*$white);
|
614 |
+
imagefilledrectangle($this->workingImage,0,$height+$i,$width,$height+$i,$colorToPaint);
|
615 |
+
}
|
616 |
+
|
617 |
+
if($border == true) {
|
618 |
+
$rgb = $this->hex2rgb($borderColor,false);
|
619 |
+
$colorToPaint = imagecolorallocate($this->workingImage,$rgb[0],$rgb[1],$rgb[2]);
|
620 |
+
imageline($this->workingImage,0,0,$width,0,$colorToPaint); //top line
|
621 |
+
imageline($this->workingImage,0,$height,$width,$height,$colorToPaint); //bottom line
|
622 |
+
imageline($this->workingImage,0,0,0,$height,$colorToPaint); //left line
|
623 |
+
imageline($this->workingImage,$width-1,0,$width-1,$height,$colorToPaint); //right line
|
624 |
+
}
|
625 |
+
|
626 |
+
$this->oldImage = $this->workingImage;
|
627 |
+
$this->newImage = $this->workingImage;
|
628 |
+
$this->currentDimensions['width'] = $width;
|
629 |
+
$this->currentDimensions['height'] = $newHeight;
|
630 |
+
}
|
631 |
+
|
632 |
+
/**
|
633 |
+
* Inverts working image, used by reflection function
|
634 |
+
*
|
635 |
+
* @access private
|
636 |
+
*/
|
637 |
+
function imageFlipVertical() {
|
638 |
+
$x_i = imagesx($this->workingImage);
|
639 |
+
$y_i = imagesy($this->workingImage);
|
640 |
+
|
641 |
+
for($x = 0; $x < $x_i; $x++) {
|
642 |
+
for($y = 0; $y < $y_i; $y++) {
|
643 |
+
imagecopy($this->workingImage,$this->workingImage,$x,$y_i - $y - 1, $x, $y, 1, 1);
|
644 |
+
}
|
645 |
+
}
|
646 |
+
}
|
647 |
+
|
648 |
+
/**
|
649 |
+
* Converts hexidecimal color value to rgb values and returns as array/string
|
650 |
+
*
|
651 |
+
* @param string $hex
|
652 |
+
* @param bool $asString
|
653 |
+
* @return array|string
|
654 |
+
*/
|
655 |
+
function hex2rgb($hex, $asString = false) {
|
656 |
+
// strip off any leading #
|
657 |
+
if (0 === strpos($hex, '#')) {
|
658 |
+
$hex = substr($hex, 1);
|
659 |
+
} else if (0 === strpos($hex, '&H')) {
|
660 |
+
$hex = substr($hex, 2);
|
661 |
+
}
|
662 |
+
|
663 |
+
// break into hex 3-tuple
|
664 |
+
$cutpoint = ceil(strlen($hex) / 2)-1;
|
665 |
+
$rgb = explode(':', wordwrap($hex, $cutpoint, ':', $cutpoint), 3);
|
666 |
+
|
667 |
+
// convert each tuple to decimal
|
668 |
+
$rgb[0] = (isset($rgb[0]) ? hexdec($rgb[0]) : 0);
|
669 |
+
$rgb[1] = (isset($rgb[1]) ? hexdec($rgb[1]) : 0);
|
670 |
+
$rgb[2] = (isset($rgb[2]) ? hexdec($rgb[2]) : 0);
|
671 |
+
|
672 |
+
return ($asString ? "{$rgb[0]} {$rgb[1]} {$rgb[2]}" : $rgb);
|
673 |
+
}
|
674 |
+
|
675 |
+
/**
|
676 |
+
* Reads selected exif meta data from jpg images and populates $this->imageMeta with appropriate values if found
|
677 |
+
*
|
678 |
+
*/
|
679 |
+
function gatherImageMeta() {
|
680 |
+
//only attempt to retrieve info if exif exists
|
681 |
+
if(function_exists("exif_read_data") && $this->format == 'JPG') {
|
682 |
+
$imageData = exif_read_data($this->fileName);
|
683 |
+
if(isset($imageData['Make']))
|
684 |
+
$this->imageMeta['make'] = ucwords(strtolower($imageData['Make']));
|
685 |
+
if(isset($imageData['Model']))
|
686 |
+
$this->imageMeta['model'] = $imageData['Model'];
|
687 |
+
if(isset($imageData['COMPUTED']['ApertureFNumber'])) {
|
688 |
+
$this->imageMeta['aperture'] = $imageData['COMPUTED']['ApertureFNumber'];
|
689 |
+
$this->imageMeta['aperture'] = str_replace('/','',$this->imageMeta['aperture']);
|
690 |
+
}
|
691 |
+
if(isset($imageData['ExposureTime'])) {
|
692 |
+
$exposure = explode('/',$imageData['ExposureTime']);
|
693 |
+
$exposure = round($exposure[1]/$exposure[0],-1);
|
694 |
+
$this->imageMeta['exposure'] = '1/' . $exposure . ' second';
|
695 |
+
}
|
696 |
+
if(isset($imageData['Flash'])) {
|
697 |
+
if($imageData['Flash'] > 0) {
|
698 |
+
$this->imageMeta['flash'] = 'Yes';
|
699 |
+
}
|
700 |
+
else {
|
701 |
+
$this->imageMeta['flash'] = 'No';
|
702 |
+
}
|
703 |
+
}
|
704 |
+
if(isset($imageData['FocalLength'])) {
|
705 |
+
$focus = explode('/',$imageData['FocalLength']);
|
706 |
+
$this->imageMeta['focalLength'] = round($focus[0]/$focus[1],2) . ' mm';
|
707 |
+
}
|
708 |
+
if(isset($imageData['DateTime'])) {
|
709 |
+
$date = $imageData['DateTime'];
|
710 |
+
$date = explode(' ',$date);
|
711 |
+
$date = str_replace(':','-',$date[0]) . ' ' . $date[1];
|
712 |
+
$this->imageMeta['dateTaken'] = date('m/d/Y g:i A',strtotime($date));
|
713 |
+
}
|
714 |
+
}
|
715 |
+
}
|
716 |
+
|
717 |
+
/**
|
718 |
+
* Rotates image either 90 degrees clockwise or counter-clockwise
|
719 |
+
*
|
720 |
+
* @param string $direction
|
721 |
+
*/
|
722 |
+
function rotateImage($direction = 'CW') {
|
723 |
+
if($direction == 'CW') {
|
724 |
+
$this->workingImage = imagerotate($this->workingImage,-90,0);
|
725 |
+
}
|
726 |
+
else {
|
727 |
+
$this->workingImage = imagerotate($this->workingImage,90,0);
|
728 |
+
}
|
729 |
+
$newWidth = $this->currentDimensions['height'];
|
730 |
+
$newHeight = $this->currentDimensions['width'];
|
731 |
+
$this->oldImage = $this->workingImage;
|
732 |
+
$this->newImage = $this->workingImage;
|
733 |
+
$this->currentDimensions['width'] = $newWidth;
|
734 |
+
$this->currentDimensions['height'] = $newHeight;
|
735 |
+
}
|
736 |
+
|
737 |
+
/**
|
738 |
+
* Based on the Watermark function by Marek Malcherek
|
739 |
+
* http://www.malcherek.de
|
740 |
+
*
|
741 |
+
* @param string $color
|
742 |
+
* @param string $wmFont
|
743 |
+
* @param int $wmSize
|
744 |
+
* @param int $wmOpaque
|
745 |
+
*/
|
746 |
+
function watermarkCreateText($color = '000000',$wmFont, $wmSize = 10, $wmOpaque = 90 ){
|
747 |
+
// set font path
|
748 |
+
$wmFontPath = NGGALLERY_ABSPATH."fonts/".$wmFont;
|
749 |
+
if ( !is_readable($wmFontPath))
|
750 |
+
return;
|
751 |
+
|
752 |
+
$TextSize = ImageTTFBBox($wmSize, 0, $wmFontPath, $this->watermarkText);
|
753 |
+
$TextWidth = abs($TextSize[2]) + abs($TextSize[0]);
|
754 |
+
$TextHeight = abs($TextSize[7]) + abs($TextSize[1]);
|
755 |
+
// Create Image for Text
|
756 |
+
$this->workingImage = ImageCreateTrueColor($TextWidth, $TextHeight);
|
757 |
+
ImageSaveAlpha($this->workingImage, true);
|
758 |
+
ImageAlphaBlending($this->workingImage, false);
|
759 |
+
$bgText = imagecolorallocatealpha($this->workingImage, 255, 255, 255, 127);
|
760 |
+
imagefill($this->workingImage, 0, 0, $bgText);
|
761 |
+
$wmTransp = 127 -( $wmOpaque * 1.27 );
|
762 |
+
$rgb = $this->hex2rgb($color,false);
|
763 |
+
$TextColor = imagecolorallocatealpha($this->workingImage, $rgb[0], $rgb[1], $rgb[2], $wmTransp);
|
764 |
+
|
765 |
+
// Create Text on image
|
766 |
+
imagettftext($this->workingImage, $wmSize, 0, 0, abs($TextSize[5]), $TextColor, $wmFontPath, $this->watermarkText);
|
767 |
+
$this->watermarkImgPath = $this->workingImage;
|
768 |
+
|
769 |
+
return;
|
770 |
+
}
|
771 |
+
|
772 |
+
/**
|
773 |
+
* Modfied Watermark function by Steve Peart
|
774 |
+
* http://parasitehosting.com/
|
775 |
+
*
|
776 |
+
* @param string $relPOS
|
777 |
+
* @param int $xPOS
|
778 |
+
* @param int $yPOS
|
779 |
+
*/
|
780 |
+
function watermarkImage( $relPOS = 'botRight', $xPOS = 0, $yPOS = 0) {
|
781 |
+
|
782 |
+
// Would you really want to use anything other than a png?
|
783 |
+
$this->workingImage = @imagecreatefrompng($this->watermarkImgPath);
|
784 |
+
if (empty($this->workingImage))
|
785 |
+
$this->workingImage = $this->watermarkImgPath;
|
786 |
+
|
787 |
+
imagealphablending($this->workingImage, false);
|
788 |
+
imagesavealpha($this->workingImage, true);
|
789 |
+
$sourcefile_width=imageSX($this->oldImage);
|
790 |
+
$sourcefile_height=imageSY($this->oldImage);
|
791 |
+
$watermarkfile_width=imageSX($this->workingImage);
|
792 |
+
$watermarkfile_height=imageSY($this->workingImage);
|
793 |
+
switch(substr($relPOS, 0, 3)){
|
794 |
+
case 'top': $dest_y = 0 + $yPOS; break;
|
795 |
+
case 'mid': $dest_y = ($sourcefile_height / 2) - ($watermarkfile_height / 2); break;
|
796 |
+
case 'bot': $dest_y = $sourcefile_height - $watermarkfile_height - $yPOS; break;
|
797 |
+
default : $dest_y = 0; break;
|
798 |
+
}
|
799 |
+
switch(substr($relPOS, 3)){
|
800 |
+
case 'Left' : $dest_x = 0 + $xPOS; break;
|
801 |
+
case 'Center': $dest_x = ($sourcefile_width / 2) - ($watermarkfile_width / 2); break;
|
802 |
+
case 'Right': $dest_x = $sourcefile_width - $watermarkfile_width - $xPOS; break;
|
803 |
+
default : $dest_x = 0; break;
|
804 |
+
}
|
805 |
+
|
806 |
+
// debug
|
807 |
+
// $this->errmsg = 'X '.$dest_x.' Y '.$dest_y;
|
808 |
+
// $this->showErrorImage();
|
809 |
+
|
810 |
+
// if a gif, we have to upsample it to a truecolor image
|
811 |
+
if($this->format == 'GIF') {
|
812 |
+
$tempimage = imagecreatetruecolor($sourcefile_width,$sourcefile_height);
|
813 |
+
imagecopy($tempimage, $this->oldImage, 0, 0, 0, 0,$sourcefile_width, $sourcefile_height);
|
814 |
+
$this->workingImage = $tempimage;
|
815 |
+
}
|
816 |
+
|
817 |
+
imagecopy($this->newImage, $this->workingImage, $dest_x, $dest_y, 0, 0,$watermarkfile_width, $watermarkfile_height);
|
818 |
+
}
|
819 |
+
|
820 |
+
/**
|
821 |
+
* Fast imagecopyresampled
|
822 |
+
* by tim@leethost.com
|
823 |
+
*
|
824 |
+
*/
|
825 |
+
function fastimagecopyresampled (&$dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 3) {
|
826 |
+
// Plug-and-Play fastimagecopyresampled function replaces much slower imagecopyresampled.
|
827 |
+
// Just include this function and change all "imagecopyresampled" references to "fastimagecopyresampled".
|
828 |
+
// Typically from 30 to 60 times faster when reducing high resolution images down to thumbnail size using the default quality setting.
|
829 |
+
// Author: Tim Eckel - Date: 12/17/04 - Project: FreeRingers.net - Freely distributable.
|
830 |
+
//
|
831 |
+
// Optional "quality" parameter (defaults is 3). Fractional values are allowed, for example 1.5.
|
832 |
+
// 1 = Up to 600 times faster. Poor results, just uses imagecopyresized but removes black edges.
|
833 |
+
// 2 = Up to 95 times faster. Images may appear too sharp, some people may prefer it.
|
834 |
+
// 3 = Up to 60 times faster. Will give high quality smooth results very close to imagecopyresampled.
|
835 |
+
// 4 = Up to 25 times faster. Almost identical to imagecopyresampled for most images.
|
836 |
+
// 5 = No speedup. Just uses imagecopyresampled, highest quality but no advantage over imagecopyresampled.
|
837 |
+
|
838 |
+
if (empty($src_image) || empty($dst_image)) { return false; }
|
839 |
+
|
840 |
+
if ($quality <= 1) {
|
841 |
+
$temp = imagecreatetruecolor ($dst_w + 1, $dst_h + 1);
|
842 |
+
imagecopyresized ($temp, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w + 1, $dst_h + 1, $src_w, $src_h);
|
843 |
+
imagecopyresized ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $dst_w, $dst_h);
|
844 |
+
imagedestroy ($temp);
|
845 |
+
} elseif ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h)) {
|
846 |
+
$tmp_w = $dst_w * $quality;
|
847 |
+
$tmp_h = $dst_h * $quality;
|
848 |
+
$temp = imagecreatetruecolor ($tmp_w + 1, $tmp_h + 1);
|
849 |
+
imagecopyresized ($temp, $src_image, $dst_x * $quality, $dst_y * $quality, $src_x, $src_y, $tmp_w + 1, $tmp_h + 1, $src_w, $src_h);
|
850 |
+
imagecopyresampled ($dst_image, $temp, 0, 0, 0, 0, $dst_w, $dst_h, $tmp_w, $tmp_h);
|
851 |
+
imagedestroy ($temp);
|
852 |
+
} else {
|
853 |
+
imagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
|
854 |
+
}
|
855 |
+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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: NextGEN Gallery
|
4 |
+
Plugin URI: http://alexrabe.boelinger.com/?page_id=80
|
5 |
+
Description: A NextGENeration Photo gallery for the WEB2.0(beta). At the moment only poor Web1.0 :-(
|
6 |
+
Author: Alex Rabe
|
7 |
+
Version: 0.37a
|
8 |
+
|
9 |
+
Author URI: http://alexrabe.boelinger.com/
|
10 |
+
|
11 |
+
Copyright 2007 by Alex Rabe
|
12 |
+
|
13 |
+
The NextGEN button is taken from the Silk set of FamFamFam. See more at
|
14 |
+
http://www.famfamfam.com/lab/icons/silk/
|
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 2 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, write to the Free Software
|
28 |
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
29 |
+
|
30 |
+
*/
|
31 |
+
|
32 |
+
//#################################################################
|
33 |
+
// Stop direct call
|
34 |
+
if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) { die('You are not allowed to call this page directly.'); }
|
35 |
+
|
36 |
+
//#################################################################
|
37 |
+
// Let's Go
|
38 |
+
|
39 |
+
global $wpdb, $wp_version;
|
40 |
+
|
41 |
+
//This work only in WP2.1
|
42 |
+
if (version_compare($wp_version, '2.1', '>=')) {
|
43 |
+
|
44 |
+
// Version and path to check version
|
45 |
+
define('NGGVERSION', "0.37");
|
46 |
+
define('NGGURL', "http://nextgen.boelinger.com/version.php");
|
47 |
+
|
48 |
+
// define URL
|
49 |
+
$myabspath = str_replace("\\","/",ABSPATH); // required for Windows & XAMPP
|
50 |
+
define('WINABSPATH', $myabspath);
|
51 |
+
define('NGGFOLDER', dirname(plugin_basename(__FILE__)));
|
52 |
+
define('NGGALLERY_ABSPATH', $myabspath.'wp-content/plugins/' . NGGFOLDER .'/');
|
53 |
+
define('NGGALLERY_URLPATH', get_option('siteurl').'/wp-content/plugins/' . NGGFOLDER.'/');
|
54 |
+
|
55 |
+
// look for imagerotator
|
56 |
+
define('NGGALLERY_IREXIST', file_exists(NGGALLERY_ABSPATH.'imagerotator.swf'));
|
57 |
+
|
58 |
+
//get value for safe mode
|
59 |
+
define('SAFE_MODE', ini_get('safe_mode'));
|
60 |
+
|
61 |
+
//read the options
|
62 |
+
$ngg_options = get_option('ngg_options');
|
63 |
+
|
64 |
+
// database
|
65 |
+
$wpdb->nggpictures = $wpdb->prefix . 'ngg_pictures';
|
66 |
+
$wpdb->nggallery = $wpdb->prefix . 'ngg_gallery';
|
67 |
+
$wpdb->nggalbum = $wpdb->prefix . 'ngg_album';
|
68 |
+
|
69 |
+
// Load language
|
70 |
+
function nggallery_init ()
|
71 |
+
{
|
72 |
+
load_plugin_textdomain('nggallery','wp-content/plugins/' . NGGFOLDER.'/lang');
|
73 |
+
}
|
74 |
+
|
75 |
+
// Load admin panel
|
76 |
+
include_once ("ngginstall.php");
|
77 |
+
include_once ("nggfunctions.php");
|
78 |
+
include_once ("admin/admin.php");
|
79 |
+
|
80 |
+
// add header to theme
|
81 |
+
function integrate_nggheader() {
|
82 |
+
global $ngg_options;
|
83 |
+
echo "<meta name='NextGEN' content='".NGGVERSION."' />\n";
|
84 |
+
echo "\n".'<style type="text/css" media="screen">@import "'.NGGALLERY_URLPATH.'css/'.$ngg_options[CSSfile].'";</style>';
|
85 |
+
if ($ngg_options[thumbEffect] == "thickbox") {
|
86 |
+
echo "\n".'<script type="text/javascript" src="'.NGGALLERY_URLPATH.'admin/js/jquery.js"></script>';
|
87 |
+
echo "\n".'<script type="text/javascript"> var LoadingImage = "'.NGGALLERY_URLPATH.'thickbox/loadingAnimation.gif";</script>';
|
88 |
+
echo "\n".'<script type="text/javascript" src="'.NGGALLERY_URLPATH.'thickbox/thickbox.js"></script>';
|
89 |
+
echo "\n".'<style type="text/css" media="screen">@import "'.NGGALLERY_URLPATH.'thickbox/thickbox.css";</style>'."\n";
|
90 |
+
if (!function_exists('integrate_swfobject'))
|
91 |
+
echo "\n".'<script type="text/javascript" src="'.NGGALLERY_URLPATH.'js/swfobject.js'.'"></script>'."\n";
|
92 |
+
}
|
93 |
+
}
|
94 |
+
// Filter hook to activate CSS in header
|
95 |
+
if ($ngg_options[activateCSS]) add_filter('wp_head', 'integrate_nggheader');
|
96 |
+
|
97 |
+
add_action('admin_head', 'ngg_nocache');
|
98 |
+
// add header to theme
|
99 |
+
function ngg_nocache() {
|
100 |
+
echo "\n".'<meta name="NextGEN" content="'.NGGVERSION.'" />';
|
101 |
+
echo "\n".'<meta http-equiv="pragma" content="no-cache" />'."\n";
|
102 |
+
}
|
103 |
+
|
104 |
+
// load language file
|
105 |
+
add_action('init', 'nggallery_init');
|
106 |
+
|
107 |
+
add_action('activate_' . NGGFOLDER.'/nggallery.php', 'ngg_install');
|
108 |
+
// init wpTable in wp-database if plugin is activated
|
109 |
+
function ngg_install() {
|
110 |
+
nggallery_install();
|
111 |
+
}
|
112 |
+
|
113 |
+
// Action calls for all functions
|
114 |
+
add_filter('the_content', 'searchnggallerytags');
|
115 |
+
add_filter('the_excerpt', 'searchnggallerytags');
|
116 |
+
|
117 |
+
//#################################################################
|
118 |
+
/*
|
119 |
+
upload_files_(tab)
|
120 |
+
Runs to print a screen on the upload files admin screen;
|
121 |
+
"tab" is the name of the custom action tab.
|
122 |
+
Define custom tabs using the wp_upload_tabs filter
|
123 |
+
|
124 |
+
wp_upload_tabs
|
125 |
+
applied to the list of custom tabs to display on the upload management admin screen.
|
126 |
+
Use action upload_files_(tab) to display a page for your custom tab
|
127 |
+
*/
|
128 |
+
|
129 |
+
//TODO: Integrate all galleries in Upload panel
|
130 |
+
// add_action('upload_files_ngg_test', 'ngg_action_upload_Tab');
|
131 |
+
// add_filter('wp_upload_tabs', 'ngg_wp_upload_tabs');
|
132 |
+
|
133 |
+
function ngg_action_upload_Tab() {
|
134 |
+
// execute when click on the tab
|
135 |
+
add_action('admin_print_scripts', 'ngg_upload_tabs_script');
|
136 |
+
}
|
137 |
+
|
138 |
+
function ngg_upload_tabs_script() {
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
function ngg_wp_upload_tabs ($array) {
|
143 |
+
|
144 |
+
/* THX to SilasFlickrPlugin
|
145 |
+
0 => tab display name,
|
146 |
+
1 => required cap / role,
|
147 |
+
2 => function that produces tab content,
|
148 |
+
3 => total number objects OR array(total, objects per page),
|
149 |
+
4 => add_query_args
|
150 |
+
*/
|
151 |
+
|
152 |
+
include_once ("nggadmintab.php");
|
153 |
+
|
154 |
+
$tab = array(
|
155 |
+
'ngg_test' => array('Gallery', 'upload_files', 'ngg_upload_tab_content', 0)
|
156 |
+
);
|
157 |
+
|
158 |
+
return array_merge($array,$tab);
|
159 |
+
}
|
160 |
+
//#################################################################
|
161 |
+
// TinyMCE Button Integration
|
162 |
+
|
163 |
+
// Load the Script for the Button
|
164 |
+
function insert_nextgen_script() {
|
165 |
+
|
166 |
+
//TODO: Do with WP2.1 Script Loader
|
167 |
+
// thanks for this idea to www.jovelstefan.de
|
168 |
+
echo "\n"."
|
169 |
+
<script type='text/javascript'>
|
170 |
+
function ngg_buttonscript() {
|
171 |
+
if(window.tinyMCE) {
|
172 |
+
|
173 |
+
var template = new Array();
|
174 |
+
|
175 |
+
template['file'] = '".NGGALLERY_URLPATH."nggbutton.php';
|
176 |
+
template['width'] = 360;
|
177 |
+
template['height'] = 220;
|
178 |
+
|
179 |
+
args = {
|
180 |
+
resizable : 'no',
|
181 |
+
scrollbars : 'no',
|
182 |
+
inline : 'yes'
|
183 |
+
};
|
184 |
+
|
185 |
+
tinyMCE.openWindow(template, args);
|
186 |
+
return true;
|
187 |
+
}
|
188 |
+
}
|
189 |
+
</script>";
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
|
193 |
+
function ngg_addbuttons() {
|
194 |
+
|
195 |
+
global $wp_db_version;
|
196 |
+
|
197 |
+
// Don't bother doing this stuff if the current user lacks permissions
|
198 |
+
if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
|
199 |
+
|
200 |
+
// Add only in Rich Editor mode
|
201 |
+
if ( get_user_option('rich_editing') == 'true') {
|
202 |
+
|
203 |
+
// add the button for wp21 in a new way
|
204 |
+
add_filter("mce_plugins", "nextgen_button_plugin", 5);
|
205 |
+
add_filter('mce_buttons', 'nextgen_button', 5);
|
206 |
+
add_action('tinymce_before_init','nextgen_button_script');
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
// used to insert button in wordpress 2.1x editor
|
211 |
+
function nextgen_button($buttons) {
|
212 |
+
|
213 |
+
array_push($buttons, "separator", "NextGEN");
|
214 |
+
return $buttons;
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
// Tell TinyMCE that there is a plugin (wp2.1)
|
219 |
+
function nextgen_button_plugin($plugins) {
|
220 |
+
|
221 |
+
array_push($plugins, "-NextGEN");
|
222 |
+
return $plugins;
|
223 |
+
}
|
224 |
+
|
225 |
+
// Load the TinyMCE plugin : editor_plugin.js (wp2.1)
|
226 |
+
function nextgen_button_script() {
|
227 |
+
|
228 |
+
$pluginURL = NGGALLERY_URLPATH.'js/';
|
229 |
+
echo 'tinyMCE.loadPlugin("NextGEN", "'.$pluginURL.'");' . "\n";
|
230 |
+
return;
|
231 |
+
}
|
232 |
+
|
233 |
+
// init process for button control
|
234 |
+
// add_action('init', 'ngg_addbuttons');
|
235 |
+
// add_action('edit_page_form', 'insert_nextgen_script');
|
236 |
+
// add_action('edit_form_advanced', 'insert_nextgen_script');
|
237 |
+
|
238 |
+
//#################################################################
|
239 |
+
|
240 |
+
} else {
|
241 |
+
add_action('admin_notices', create_function('', 'echo \'<div id="message" class="error fade"><p><strong>' . __('Sorry, NextGEN Gallery works only under WordPress 2.1 or higher',"nggallery") . '</strong></p></div>\';'));
|
242 |
+
}// End Check for WP 2.1
|
243 |
+
?>
|
nggextractXML.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
+----------------------------------------------------------------+
|
5 |
+
+ imageRotartor-XML V1.00
|
6 |
+
+ by Alex Rabe
|
7 |
+
+ required for NextGEN Gallery
|
8 |
+
+----------------------------------------------------------------+
|
9 |
+
*/
|
10 |
+
|
11 |
+
// get the gallery id
|
12 |
+
$galleryID = $_GET['gid'];
|
13 |
+
|
14 |
+
$wpconfig = realpath("../../../wp-config.php");
|
15 |
+
if (!file_exists($wpconfig)) die; // stop when wp-config is not there
|
16 |
+
|
17 |
+
require_once($wpconfig);
|
18 |
+
|
19 |
+
function get_out_now() { exit; }
|
20 |
+
add_action('shutdown', 'get_out_now', -1);
|
21 |
+
|
22 |
+
global $wpdb;
|
23 |
+
$ngg_options = get_option('ngg_options');
|
24 |
+
|
25 |
+
// get gallery values
|
26 |
+
$act_gallery = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$galleryID' ");
|
27 |
+
$thepictures = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures WHERE galleryid = '$galleryID' AND exclude = 0 ORDER BY '$ngg_options[galSort]' ASC");
|
28 |
+
|
29 |
+
// set gallery url
|
30 |
+
$folder_url = get_option ('siteurl')."/".$act_gallery->path."/";
|
31 |
+
|
32 |
+
// Create XML output
|
33 |
+
header("content-type:text/xml;charset=utf-8");
|
34 |
+
|
35 |
+
echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
|
36 |
+
echo " <title>".$act_gallery->name."</title>\n";
|
37 |
+
echo " <trackList>\n";
|
38 |
+
|
39 |
+
if (is_array ($thepictures)){
|
40 |
+
foreach ($thepictures as $picture) {
|
41 |
+
echo " <track>\n";
|
42 |
+
if (!empty($picture->description))
|
43 |
+
echo " <title>".$picture->description."</title>\n";
|
44 |
+
else if (!empty($picture->alttext))
|
45 |
+
echo " <title>".$picture->alttext."</title>\n";
|
46 |
+
else
|
47 |
+
echo " <title>".$picture->filename."</title>\n";
|
48 |
+
echo " <location>".$folder_url.$picture->filename."</location>\n";
|
49 |
+
echo " </track>\n";
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
echo " </trackList>\n";
|
54 |
+
echo "</playlist>\n";
|
55 |
+
|
56 |
+
?>
|
nggfunctions.php
ADDED
@@ -0,0 +1,394 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function searchnggallerytags($content) {
|
4 |
+
|
5 |
+
global $wpdb;
|
6 |
+
|
7 |
+
$search = "/\[singlepic=(\d+)(|,\d+|,)(|,\d+|,)(|,watermark|,web20|,)\]/i";
|
8 |
+
|
9 |
+
if (preg_match_all($search, $content, $matches)) {
|
10 |
+
|
11 |
+
if (is_array($matches)) {
|
12 |
+
foreach ($matches[1] as $key =>$v0) {
|
13 |
+
// check for correct id
|
14 |
+
$result = $wpdb->get_var("SELECT filename FROM $wpdb->nggpictures WHERE pid = '$v0' ");
|
15 |
+
if($result){
|
16 |
+
$search = $matches[0][$key];
|
17 |
+
$replace= nggSinglePicture($v0,$matches[2][$key],$matches[3][$key],$matches[4][$key]);
|
18 |
+
$content= str_replace ($search, $replace, $content);
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}// end singelpic
|
23 |
+
|
24 |
+
$search = "/\[album\s*=\s*(\w+|^\+)(|,extend|,compact)\]/i";
|
25 |
+
|
26 |
+
if (preg_match_all($search, $content, $matches)) {
|
27 |
+
if (is_array($matches)) {
|
28 |
+
foreach ($matches[1] as $key =>$v0) {
|
29 |
+
// check for album id
|
30 |
+
$albumID = $wpdb->get_var("SELECT id FROM $wpdb->nggalbum WHERE id = '$v0' ");
|
31 |
+
if(!$albumID) $albumID = $wpdb->get_var("SELECT id FROM $wpdb->nggalbum WHERE name = '$v0' ");
|
32 |
+
if($albumID) {
|
33 |
+
$search = $matches[0][$key];
|
34 |
+
$replace= nggShowAlbum($albumID,$matches[2][$key]);
|
35 |
+
$content= str_replace ($search, $replace, $content);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}// end album
|
40 |
+
|
41 |
+
$search = "/\[gallery\s*=\s*(\w+|^\+)\]/i";
|
42 |
+
|
43 |
+
if (preg_match_all($search, $content, $matches)) {
|
44 |
+
if (is_array($matches)) {
|
45 |
+
foreach ($matches[1] as $key =>$v0) {
|
46 |
+
// check for gallery id
|
47 |
+
$galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$v0' ");
|
48 |
+
if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$v0' ");
|
49 |
+
if($galleryID) {
|
50 |
+
$search = $matches[0][$key];
|
51 |
+
$replace= nggShowGallery($galleryID);
|
52 |
+
$content= str_replace ($search, $replace, $content);
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}// end gallery
|
57 |
+
|
58 |
+
$search = "/\[slideshow\s*=\s*(\w+|^\+)(|,(\d+)|,)(|,(\d+))\]/i";
|
59 |
+
|
60 |
+
if (preg_match_all($search, $content, $matches)) {
|
61 |
+
if (is_array($matches)) {
|
62 |
+
foreach ($matches[1] as $key =>$v0) {
|
63 |
+
// check for gallery id
|
64 |
+
$galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE gid = '$v0' ");
|
65 |
+
if(!$galleryID) $galleryID = $wpdb->get_var("SELECT gid FROM $wpdb->nggallery WHERE name = '$v0' ");
|
66 |
+
if($galleryID) {
|
67 |
+
$search = $matches[0][$key];
|
68 |
+
// get the size if they are set
|
69 |
+
$ssWidth = $matches[3][$key];
|
70 |
+
$ssHeight = $matches[5][$key];
|
71 |
+
$replace= nggShowSlideshow($galleryID,$irWidth,$irHeight);
|
72 |
+
$content= str_replace ($search, $replace, $content);
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
}// end slideshow
|
77 |
+
|
78 |
+
return $content;
|
79 |
+
}// end search content
|
80 |
+
|
81 |
+
/**********************************************************/
|
82 |
+
function nggShowSlideshow($galleryID,$irWidth,$irHeight) {
|
83 |
+
|
84 |
+
global $wpdb;
|
85 |
+
$ngg_options = get_option('ngg_options');
|
86 |
+
|
87 |
+
if (empty($irWidth) ) $irWidth = $ngg_options[irWidth];
|
88 |
+
if (empty($irHeight)) $irHeight = $ngg_options[irHeight];
|
89 |
+
|
90 |
+
$replace .= "\n".'<div class="slideshow" id="ngg_slideshow'.$galleryID.'">';
|
91 |
+
$replace .= '<a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see the slideshow.</p>';
|
92 |
+
$replace .= "\n\t".'<script type="text/javascript">';
|
93 |
+
// $replace .= "\n\t".'<!--';
|
94 |
+
$replace .= "\n\t".'//<![CDATA[';
|
95 |
+
$replace .= "\n\t\t".'var so = new SWFObject("'.NGGALLERY_URLPATH.'imagerotator.swf", "ngg_slideshow'.$galleryID.'", "'.$irWidth.'", "'.$irHeight.'", "7", "#'.$ngg_options[irBackcolor].'");';
|
96 |
+
$replace .= "\n\t\t".'so.addParam("wmode", "opaque");';
|
97 |
+
$replace .= "\n\t\t".'so.addVariable("file", "'.NGGALLERY_URLPATH.'nggextractXML.php?gid='.$galleryID.'");';
|
98 |
+
if (!$ngg_options[irShuffle]) $replace .= "\n\t\t".'so.addVariable("shuffle", "false");';
|
99 |
+
if ($ngg_options[irLinkfromdisplay]) $replace .= "\n\t\t".'so.addVariable("linkfromdisplay", "false");';
|
100 |
+
if ($ngg_options[irShownavigation]) $replace .= "\n\t\t".'so.addVariable("shownavigation", "true");';
|
101 |
+
if ($ngg_options[irShowicons]) $replace .= "\n\t\t".'so.addVariable("showicons", "true");';
|
102 |
+
$replace .= "\n\t\t".'so.addVariable("overstretch", "'.$ngg_options[irOverstretch].'");';
|
103 |
+
$replace .= "\n\t\t".'so.addVariable("backcolor", "0x'.$ngg_options[irBackcolor].'");';
|
104 |
+
$replace .= "\n\t\t".'so.addVariable("frontcolor", "0x'.$ngg_options[irFrontcolor].'");';
|
105 |
+
$replace .= "\n\t\t".'so.addVariable("lightcolor", "0x'.$ngg_options[irLightcolor].'");';
|
106 |
+
$replace .= "\n\t\t".'so.addVariable("rotatetime", "'.$ngg_options[irRotatetime].'");';
|
107 |
+
$replace .= "\n\t\t".'so.addVariable("transition", "'.$ngg_options[irTransition].'");';
|
108 |
+
$replace .= "\n\t\t".'so.addVariable("width", "'.$irWidth.'");';
|
109 |
+
$replace .= "\n\t\t".'so.addVariable("height", "'.$irHeight.'");';
|
110 |
+
$replace .= "\n\t\t".'so.write("ngg_slideshow'.$galleryID.'");';
|
111 |
+
$replace .= "\n\t".'//]]>';
|
112 |
+
// $replace .= "\n\t".'-->';
|
113 |
+
$replace .= "\n\t".'</script>';
|
114 |
+
$replace .= '</div>'."\n";
|
115 |
+
|
116 |
+
return $replace;
|
117 |
+
}
|
118 |
+
|
119 |
+
/**********************************************************/
|
120 |
+
function nggShowGallery($galleryID) {
|
121 |
+
|
122 |
+
global $wpdb;
|
123 |
+
$ngg_options = get_option('ngg_options');
|
124 |
+
|
125 |
+
// Get option
|
126 |
+
$maxElement = $ngg_options[galImages];
|
127 |
+
$thumbwidth = $ngg_options[thumbwidth];
|
128 |
+
$thumbheight = $ngg_options[thumbheight];
|
129 |
+
|
130 |
+
// set thumb size
|
131 |
+
$thumbsize = "";
|
132 |
+
if ($ngg_options[thumbfix]) $thumbsize = 'style="width:'.$thumbwidth.'px; height:'.$thumbheight.'px;"';
|
133 |
+
if ($ngg_options[thumbcrop]) $thumbsize = 'style="width:'.$thumbwidth.'px; height:'.$thumbwidth.'px;"';
|
134 |
+
|
135 |
+
// get gallery values
|
136 |
+
$act_gallery = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$galleryID' ");
|
137 |
+
|
138 |
+
// get the effect code
|
139 |
+
if ($ngg_options[thumbEffect] != "none") $thumbcode = stripslashes($ngg_options[thumbCode]);
|
140 |
+
if ($ngg_options[thumbEffect] == "highslide") $thumbcode = str_replace("%GALLERY_NAME%", "'".$act_gallery->name."'", $thumbcode);
|
141 |
+
else $thumbcode = str_replace("%GALLERY_NAME%", $act_gallery->name, $thumbcode);
|
142 |
+
|
143 |
+
// set gallery url
|
144 |
+
$folder_url = get_option ('siteurl')."/".$act_gallery->path."/";
|
145 |
+
$thumbnailURL = get_option ('siteurl')."/".$act_gallery->path.ngg_get_thumbnail_folder($act_gallery->path, FALSE);
|
146 |
+
$thumb_prefix = ngg_get_thumbnail_prefix($act_gallery->path, FALSE);
|
147 |
+
|
148 |
+
// slideshow first
|
149 |
+
if ( !isset( $_GET['show'] ) AND ($ngg_options[galShowOrder] == 'slide')) $_GET['show'] = slide;
|
150 |
+
// show a slide show
|
151 |
+
if ( isset( $_GET['show'] ) AND ($_GET['show'] == slide) ) {
|
152 |
+
$getvalue['show'] = "gallery";
|
153 |
+
$gallerycontent = '<div class="ngg-galleryoverview">';
|
154 |
+
$gallerycontent .= '<a class="slideshowlink" href="' . add_query_arg($getvalue) . '">'.$ngg_options[galTextGallery].'</a>';
|
155 |
+
$gallerycontent .= nggShowSlideshow($galleryID,$ngg_options[irWidth],$ngg_options[irHeight]);
|
156 |
+
$gallerycontent .= '</div>'."\n";
|
157 |
+
$gallerycontent .= '<div style="clear:both;"></div>'."\n";
|
158 |
+
return $gallerycontent;
|
159 |
+
}
|
160 |
+
|
161 |
+
// check for page navigation
|
162 |
+
if ($maxElement > 0) {
|
163 |
+
if ( isset( $_GET['nggpage'] ) ) $page = (int) $_GET['nggpage'];
|
164 |
+
else $page = 1;
|
165 |
+
$start = $offset = ( $page - 1 ) * $maxElement;
|
166 |
+
|
167 |
+
$picturelist = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures WHERE galleryid = '$galleryID' AND exclude = 0 ORDER BY $ngg_options[galSort] ASC LIMIT $start, $maxElement ");
|
168 |
+
$total = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = '$galleryID' AND exclude = 0 ");
|
169 |
+
} else {
|
170 |
+
$picturelist = $wpdb->get_results("SELECT * FROM $wpdb->nggpictures WHERE galleryid = '$galleryID' AND alttext = 0 ORDER BY $ngg_options[galSort] ASC ");
|
171 |
+
}
|
172 |
+
|
173 |
+
if (is_array($picturelist)) {
|
174 |
+
|
175 |
+
// create navigation
|
176 |
+
if ( $total > $maxElement ) {
|
177 |
+
$total_pages = ceil( $total / $maxElement );
|
178 |
+
$r = '';
|
179 |
+
if ( 1 < $page ) {
|
180 |
+
$args['nggpage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1;
|
181 |
+
$r .= '<a class="prev" href="'. add_query_arg( $args ) . '">◄</a>';
|
182 |
+
}
|
183 |
+
if ( ( $total_pages = ceil( $total / $maxElement ) ) > 1 ) {
|
184 |
+
for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) {
|
185 |
+
if ( $page == $page_num ) {
|
186 |
+
$r .= '<span>' . $page_num . '</span>';
|
187 |
+
} else {
|
188 |
+
$p = false;
|
189 |
+
if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) {
|
190 |
+
$args['nggpage'] = ( 1 == $page_num ) ? FALSE : $page_num;
|
191 |
+
$r .= '<a class="page-numbers" href="' . add_query_arg($args) . '">' . ( $page_num ) . '</a>';
|
192 |
+
$in = true;
|
193 |
+
} elseif ( $in == true ) {
|
194 |
+
$r .= '<span>...</span>';
|
195 |
+
$in = false;
|
196 |
+
}
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
if ( ( $page ) * $maxElement < $total || -1 == $total ) {
|
201 |
+
$args['nggpage'] = $page + 1;
|
202 |
+
$r .= '<a class="next" href="' . add_query_arg($args) . '">►</a>';
|
203 |
+
}
|
204 |
+
|
205 |
+
$navigation = "<div class='ngg-navigation'>$r</div>";
|
206 |
+
}
|
207 |
+
|
208 |
+
$gallerycontent = '<div class="ngg-galleryoverview">';
|
209 |
+
if (($ngg_options[galShowSlide]) AND (NGGALLERY_IREXIST)) {
|
210 |
+
$getvalue['show'] = "slide";
|
211 |
+
$gallerycontent .= '<a class="slideshowlink" href="' . add_query_arg($getvalue) . '">'.$ngg_options[galTextSlide].'</a>';
|
212 |
+
}
|
213 |
+
|
214 |
+
foreach ($picturelist as $picture) {
|
215 |
+
|
216 |
+
$gallerycontent .= '<div class="ngg-gallery-thumbnail-box">'."\n\t";
|
217 |
+
$gallerycontent .= '<div class="ngg-gallery-thumbnail">'."\n\t";
|
218 |
+
$gallerycontent .= '<a href="'.$folder_url.$picture->filename.'" title="'.$picture->alttext.'" '.$thumbcode.' >';
|
219 |
+
$gallerycontent .= '<img title="'.$picture->alttext.'" alt="'.$picture->alttext.'" src="'.$thumbnailURL.$thumb_prefix.$picture->filename.'" '.$thumbsize.' />';
|
220 |
+
$gallerycontent .= '</a>'."\n".'</div>'."\n".'</div>'."\n";
|
221 |
+
}
|
222 |
+
$gallerycontent .= '</div>'."\n";
|
223 |
+
$gallerycontent .= '<div style="clear:both;"></div>'."\n";
|
224 |
+
$gallerycontent .= $navigation;
|
225 |
+
}
|
226 |
+
|
227 |
+
return $gallerycontent;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**********************************************************/
|
231 |
+
function nggShowAlbum($albumID,$mode = "extend") {
|
232 |
+
|
233 |
+
global $wpdb;
|
234 |
+
|
235 |
+
$mode = ltrim($mode,',');
|
236 |
+
$sortorder = $wpdb->get_var("SELECT sortorder FROM $wpdb->nggalbum WHERE id = '$albumID' ");
|
237 |
+
if (!empty($sortorder)) {
|
238 |
+
$gallery_array = unserialize($sortorder);
|
239 |
+
// $gallery_array = $wpdb->get_col("SELECT gid FROM $wpdb->nggallery ");
|
240 |
+
}
|
241 |
+
|
242 |
+
$albumcontent = '<div class="ngg-albumoverview">';
|
243 |
+
if (is_array($gallery_array)) {
|
244 |
+
foreach ($gallery_array as $galleryID) {
|
245 |
+
$albumcontent .= nggCreateGalleryDiv($galleryID,$mode);
|
246 |
+
}
|
247 |
+
}
|
248 |
+
$albumcontent .= '</div>'."\n";
|
249 |
+
$albumcontent .= '<div style="clear:both;"></div>'."\n";
|
250 |
+
|
251 |
+
return $albumcontent;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**********************************************************/
|
255 |
+
function nggCreateGalleryDiv($galleryID,$mode = "extend") {
|
256 |
+
// create a gallery overview div
|
257 |
+
|
258 |
+
global $wpdb;
|
259 |
+
|
260 |
+
$gallerycontent = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$galleryID' ");
|
261 |
+
|
262 |
+
if ($gallerycontent) {
|
263 |
+
if ($mode == "compact") {
|
264 |
+
if ($gallerycontent->previewpic != 0)
|
265 |
+
$insertpic = '<img class="Thumb" width="91" height="68" alt="'.$gallerycontent->title.'" src="'.ngg_get_thumbnail_url($gallerycontent->previewpic).'"/>';
|
266 |
+
else
|
267 |
+
$insertpic = __('Watch gallery', 'nggallery');
|
268 |
+
$counter = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = '$galleryID'");
|
269 |
+
$galleryoutput = '
|
270 |
+
<div class="ngg-album-compact">
|
271 |
+
<div class="ngg-album-compactbox">
|
272 |
+
<div class="setLinkDiv">
|
273 |
+
<a class="Link" href="'.get_bloginfo('wpurl').'/?page_id='.$gallerycontent->pageid.'">'.$insertpic.'</a>
|
274 |
+
</div>
|
275 |
+
</div>
|
276 |
+
<h4><a class="Seta" title="'.$gallerycontent->title.'" href="'.get_bloginfo('wpurl').'/?page_id='.$gallerycontent->pageid.'">'.$gallerycontent->title.'</a></h4>
|
277 |
+
<p><b>'.$counter.'</b> '.__('Photos', 'nggallery').'</p></div>';
|
278 |
+
} else {
|
279 |
+
// mode extend
|
280 |
+
if ($gallerycontent->previewpic != 0)
|
281 |
+
$insertpic = '<img src="'.ngg_get_thumbnail_url($gallerycontent->previewpic).'" alt="'.$gallerycontent->title.'" title="'.$gallerycontent->title.'"/>';
|
282 |
+
else
|
283 |
+
$insertpic = __('Watch gallery', 'nggallery');
|
284 |
+
$galleryoutput = '
|
285 |
+
<div class="ngg-album">
|
286 |
+
<div class="ngg-albumtitle"><a href="'.get_bloginfo('wpurl').'/?page_id='.$gallerycontent->pageid.'">'.$gallerycontent->title.'</a></div>
|
287 |
+
<div class="ngg-albumcontent">
|
288 |
+
<div class="ngg-thumbnail"><a href="'.get_bloginfo('wpurl').'/?page_id='.$gallerycontent->pageid.'">'.$insertpic.'</a></div>
|
289 |
+
<div class="ngg-description"><p>'.$gallerycontent->description.'</p></div>'."\n".'</div>'."\n".'</div>';
|
290 |
+
|
291 |
+
}
|
292 |
+
}
|
293 |
+
|
294 |
+
return $galleryoutput;
|
295 |
+
}
|
296 |
+
|
297 |
+
/**********************************************************/
|
298 |
+
function nggSinglePicture($imageID,$width=250,$height=250,$mode="") {
|
299 |
+
|
300 |
+
global $wpdb;
|
301 |
+
$ngg_options = get_option('ngg_options');
|
302 |
+
|
303 |
+
// remove the comma
|
304 |
+
$mode = ltrim($mode,',');
|
305 |
+
$width = ltrim($width,',');
|
306 |
+
$height = ltrim($height,',');
|
307 |
+
|
308 |
+
// get picturedata
|
309 |
+
$picture = $wpdb->get_row("SELECT * FROM $wpdb->nggpictures WHERE pid = '$imageID' ");
|
310 |
+
|
311 |
+
// add fullsize picture as link
|
312 |
+
if ($ngg_options[imgSinglePicLink]) {
|
313 |
+
// get gallery values
|
314 |
+
$act_gallery = $wpdb->get_row("SELECT * FROM $wpdb->nggallery WHERE gid = '$picture->galleryid' ");
|
315 |
+
|
316 |
+
// set gallery url
|
317 |
+
$folder_url = get_option ('siteurl')."/".$act_gallery->path."/";
|
318 |
+
|
319 |
+
// get the effect code
|
320 |
+
if ($ngg_options[thumbEffect] != "none") $thumbcode = stripslashes($ngg_options[thumbCode]);
|
321 |
+
if ($ngg_options[thumbEffect] == "highslide") $thumbcode = str_replace("%GALLERY_NAME%", "'".$act_gallery->name."'", $thumbcode);
|
322 |
+
else $thumbcode = str_replace("%GALLERY_NAME%", $act_gallery->name, $thumbcode);
|
323 |
+
|
324 |
+
$link = '<a href="'.$folder_url.$picture->filename.'" title="'.$picture->alttext.'" '.$thumbcode.' >';
|
325 |
+
}
|
326 |
+
|
327 |
+
$content = $link . '<img src="'.NGGALLERY_URLPATH.'nggshow.php?pid='.$imageID.'&width='.$width.'&height='.$height.'&mode='.$mode.'" alt="'.$picture->alttext.'" title="'.$picture->alttext.'" />';
|
328 |
+
|
329 |
+
if ($ngg_options[imgSinglePicLink]) $content .= '</a>';
|
330 |
+
|
331 |
+
return $content;
|
332 |
+
}
|
333 |
+
|
334 |
+
/**********************************************************/
|
335 |
+
// Global function
|
336 |
+
/**********************************************************/
|
337 |
+
function ngg_get_thumbnail_url($imageID){
|
338 |
+
// get the complete url to the thumbnail
|
339 |
+
global $wpdb;
|
340 |
+
|
341 |
+
// get gallery values
|
342 |
+
$galleryID = $wpdb->get_var("SELECT galleryid FROM $wpdb->nggpictures WHERE pid = '$imageID' ");
|
343 |
+
$fileName = $wpdb->get_var("SELECT filename FROM $wpdb->nggpictures WHERE pid = '$imageID' ");
|
344 |
+
$picturepath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$galleryID' ");
|
345 |
+
|
346 |
+
// set gallery url
|
347 |
+
$folder_url = get_option ('siteurl')."/".$picturepath.ngg_get_thumbnail_folder($picturepath, FALSE);
|
348 |
+
$thumb_prefix = ngg_get_thumbnail_prefix($picturepath, FALSE);
|
349 |
+
$thumbnailURL = $folder_url.$thumb_prefix.$fileName;
|
350 |
+
|
351 |
+
return $thumbnailURL;
|
352 |
+
}
|
353 |
+
|
354 |
+
/**********************************************************/
|
355 |
+
function ngg_get_image_url($imageID){
|
356 |
+
// get the complete url to the image
|
357 |
+
global $wpdb;
|
358 |
+
|
359 |
+
// get gallery values
|
360 |
+
$galleryID = $wpdb->get_var("SELECT galleryid FROM $wpdb->nggpictures WHERE pid = '$imageID' ");
|
361 |
+
$fileName = $wpdb->get_var("SELECT filename FROM $wpdb->nggpictures WHERE pid = '$imageID' ");
|
362 |
+
$picturepath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$galleryID' ");
|
363 |
+
|
364 |
+
// set gallery url
|
365 |
+
$imageURL = get_option ('siteurl')."/".$picturepath.$fileName;
|
366 |
+
|
367 |
+
return $imageURL;
|
368 |
+
}
|
369 |
+
|
370 |
+
/**********************************************************/
|
371 |
+
function ngg_get_thumbnail_folder($gallerypath, $include_Abspath = TRUE) {
|
372 |
+
//required for myGallery import :-)
|
373 |
+
|
374 |
+
if (!$include_Abspath) $gallerypath = WINABSPATH.$gallerypath;
|
375 |
+
if (is_dir($gallerypath."/thumbs")) return "/thumbs/";
|
376 |
+
if (is_dir($gallerypath."/tumbs")) return "/tumbs/";
|
377 |
+
|
378 |
+
return FALSE;
|
379 |
+
|
380 |
+
}
|
381 |
+
|
382 |
+
/**********************************************************/
|
383 |
+
function ngg_get_thumbnail_prefix($gallerypath, $include_Abspath = TRUE) {
|
384 |
+
//required for myGallery import :-)
|
385 |
+
|
386 |
+
if (!$include_Abspath) $gallerypath = WINABSPATH.$gallerypath;
|
387 |
+
if (is_dir($gallerypath."/thumbs")) return "thumbs_";
|
388 |
+
if (is_dir($gallerypath."/tumbs")) return "tmb_";
|
389 |
+
|
390 |
+
return FALSE;
|
391 |
+
|
392 |
+
}
|
393 |
+
|
394 |
+
?>
|
ngginstall.php
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
//required database version
|
4 |
+
$ngg_db_version = "0.33";
|
5 |
+
|
6 |
+
function nggallery_install () {
|
7 |
+
|
8 |
+
global $wpdb;
|
9 |
+
global $ngg_db_version;
|
10 |
+
|
11 |
+
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
|
12 |
+
|
13 |
+
$nggpictures = $wpdb->prefix . 'ngg_pictures';
|
14 |
+
$nggallery = $wpdb->prefix . 'ngg_gallery';
|
15 |
+
$nggalbum = $wpdb->prefix . 'ngg_album';
|
16 |
+
|
17 |
+
if($wpdb->get_var("show tables like '$nggpictures'") != $nggpictures) {
|
18 |
+
|
19 |
+
$sql = "CREATE TABLE " . $nggpictures . " (
|
20 |
+
pid MEDIUMINT(9) NOT NULL AUTO_INCREMENT ,
|
21 |
+
galleryid MEDIUMINT(9) DEFAULT '0' NOT NULL ,
|
22 |
+
filename VARCHAR(255) NOT NULL ,
|
23 |
+
description MEDIUMTEXT NULL ,
|
24 |
+
alttext MEDIUMTEXT NULL ,
|
25 |
+
exclude TINYINT NULL ,
|
26 |
+
PRIMARY KEY pid (pid)
|
27 |
+
);";
|
28 |
+
|
29 |
+
dbDelta($sql);
|
30 |
+
|
31 |
+
ngg_default_options();
|
32 |
+
add_option("ngg_db_version", $ngg_db_version);
|
33 |
+
}
|
34 |
+
|
35 |
+
if($wpdb->get_var("show tables like '$nggallery'") != $nggallery) {
|
36 |
+
|
37 |
+
$sql = "CREATE TABLE " . $nggallery . " (
|
38 |
+
gid MEDIUMINT(9) NOT NULL AUTO_INCREMENT ,
|
39 |
+
name VARCHAR(255) NOT NULL ,
|
40 |
+
path MEDIUMTEXT NULL ,
|
41 |
+
title MEDIUMTEXT NULL ,
|
42 |
+
description MEDIUMTEXT NULL ,
|
43 |
+
pageid SMALLINT(6) NULL DEFAULT '0' ,
|
44 |
+
previewpic SMALLINT(6) NULL DEFAULT '0' ,
|
45 |
+
PRIMARY KEY gid (gid)
|
46 |
+
);";
|
47 |
+
|
48 |
+
dbDelta($sql);
|
49 |
+
}
|
50 |
+
|
51 |
+
if($wpdb->get_var("show tables like '$nggalbum'") != $nggalbum) {
|
52 |
+
|
53 |
+
$sql = "CREATE TABLE " . $nggalbum . " (
|
54 |
+
id MEDIUMINT(9) NOT NULL AUTO_INCREMENT ,
|
55 |
+
name VARCHAR(255) NOT NULL ,
|
56 |
+
sortorder LONGTEXT NOT NULL,
|
57 |
+
PRIMARY KEY id (id)
|
58 |
+
);";
|
59 |
+
|
60 |
+
dbDelta($sql);
|
61 |
+
}
|
62 |
+
|
63 |
+
// update routine
|
64 |
+
$installed_ver = get_option( "ngg_db_version" );
|
65 |
+
if( $installed_ver != $ngg_db_version ) {
|
66 |
+
|
67 |
+
// do the update (hopefully I didn't required this sometimes)
|
68 |
+
update_option( "ngg_db_version", $ngg_db_version );
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
function ngg_default_options() {
|
74 |
+
|
75 |
+
$ngg_options[gallerypath] = "wp-content/gallery/"; // set default path to the gallery
|
76 |
+
$ngg_options[scanfolder] = false; // search for new images
|
77 |
+
$ngg_options[deleteImg] = false; // delete Images
|
78 |
+
|
79 |
+
$ngg_options[thumbwidth] = 100; // Thumb Width
|
80 |
+
$ngg_options[thumbheight] = 75; // Thumb height
|
81 |
+
$ngg_options[thumbfix] = true; // Fix the dimension
|
82 |
+
$ngg_options[thumbcrop] = false; // Crop thumbnail
|
83 |
+
$ngg_options[thumbquality] = 100; // Thumb Quality
|
84 |
+
$ngg_options[thumbResampleMode] = 3; // Resample speed value 1 - 5
|
85 |
+
|
86 |
+
// Image Settings
|
87 |
+
$ngg_options[imgResize] = false; // Activate resize
|
88 |
+
$ngg_options[imgWidth] = 800; // Image Width
|
89 |
+
$ngg_options[imgHeight] = 600; // Image height
|
90 |
+
$ngg_options[imgQuality] = 100; // Image Quality
|
91 |
+
$ngg_options[imgResampleMode] = 4; // Resample speed value 1 - 5
|
92 |
+
$ngg_options[imgSinglePicLink] = false; // Add a link to the full size picture
|
93 |
+
|
94 |
+
// Gallery Settings
|
95 |
+
$ngg_options[galImages] = "20"; // Number Of images per page
|
96 |
+
$ngg_options[galShowSlide] = true; // Show slideshow
|
97 |
+
$ngg_options[galTextSlide] = __('[Show as slideshow]','nggallery'); // Text for slideshow
|
98 |
+
$ngg_options[galTextGallery] = __('[Show picture list]','nggallery'); // Text for gallery
|
99 |
+
$ngg_options[galShowOrder] = "gallery"; // Show order
|
100 |
+
$ngg_options[galSort] = "pid"; // Sort order
|
101 |
+
|
102 |
+
// Thumbnail Effect
|
103 |
+
$ngg_options[thumbEffect] = "thickbox"; // select effect
|
104 |
+
$ngg_options[thumbCode] = "class=\"thickbox\" rel=\"%GALLERY_NAME%\"";
|
105 |
+
|
106 |
+
// Watermark settings
|
107 |
+
$ngg_options[wmPos] = "botRight"; // Postion
|
108 |
+
$ngg_options[wmXpos] = 5; // X Pos
|
109 |
+
$ngg_options[wmYpos] = 5; // Y Pos
|
110 |
+
$ngg_options[wmType] = "text"; // Type : 'image' / 'text'
|
111 |
+
$ngg_options[wmPath] = ""; // Path to image
|
112 |
+
$ngg_options[wmFont] = "arial.ttf"; // Font type
|
113 |
+
$ngg_options[wmSize] = 10; // Font Size
|
114 |
+
$ngg_options[wmText] = get_option('blogname'); // Text
|
115 |
+
$ngg_options[wmColor] = "000000"; // Font Color
|
116 |
+
$ngg_options[wmOpaque] = "100"; // Font Opaque
|
117 |
+
|
118 |
+
// Image Rotator settings
|
119 |
+
$ngg_options[irWidth] = 320;
|
120 |
+
$ngg_options[irHeight] = 240;
|
121 |
+
$ngg_options[irShuffle] = true;
|
122 |
+
$ngg_options[irLinkfromdisplay] = true;
|
123 |
+
$ngg_options[irShownavigation] = false;
|
124 |
+
$ngg_options[irShowicons] = false;
|
125 |
+
$ngg_options[irOverstretch] = "true";
|
126 |
+
$ngg_options[irRotatetime] = 10;
|
127 |
+
$ngg_options[irTransition] = "random";
|
128 |
+
$ngg_options[irBackcolor] = "000000";
|
129 |
+
$ngg_options[irFrontcolor] = "FFFFFF";
|
130 |
+
$ngg_options[irLightcolor] = "CC0000";
|
131 |
+
|
132 |
+
// CSS Style
|
133 |
+
$ngg_options[activateCSS] = true; // activate the CSS file
|
134 |
+
$ngg_options[CSSfile] = "nggallery.css"; // set default css filename
|
135 |
+
|
136 |
+
update_option('ngg_options', $ngg_options);
|
137 |
+
|
138 |
+
}
|
139 |
+
|
140 |
+
?>
|
nggshow.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$wpconfig = realpath("../../../wp-config.php");
|
4 |
+
if (!file_exists($wpconfig)) die; // stop when wp-config is not there
|
5 |
+
require_once($wpconfig);
|
6 |
+
|
7 |
+
global $wpdb;
|
8 |
+
|
9 |
+
// get the options
|
10 |
+
$ngg_options=get_option('ngg_options');
|
11 |
+
|
12 |
+
//reference thumbnail class
|
13 |
+
include_once('lib/thumbnail.inc.php');
|
14 |
+
|
15 |
+
$pictureID = $_GET['pid'];
|
16 |
+
$mode = $_GET['mode'];
|
17 |
+
|
18 |
+
// get the path and filename to the image
|
19 |
+
$galleryID = $wpdb->get_var("SELECT galleryid FROM $wpdb->nggpictures WHERE pid = '$pictureID' ");
|
20 |
+
$filenname = $wpdb->get_var("SELECT filename FROM $wpdb->nggpictures WHERE pid = '$pictureID' ");
|
21 |
+
$gallerypath = $wpdb->get_var("SELECT path FROM $wpdb->nggallery WHERE gid = '$galleryID' ");
|
22 |
+
$filepath = WINABSPATH . "/" . $gallerypath ."/" . $filenname;
|
23 |
+
|
24 |
+
$thumb = new Thumbnail($filepath);
|
25 |
+
if ( isset($_GET['height']) and isset($_GET['width']))
|
26 |
+
$thumb->resize($_GET['width'],$_GET['height']);
|
27 |
+
if ($mode == 'watermark') {
|
28 |
+
if ($ngg_options[wmType] == 'image') {
|
29 |
+
$thumb->watermarkImgPath = $ngg_options[wmPath];
|
30 |
+
$thumb->watermarkImage($ngg_options[wmPos], $ngg_options[wmXpos], $ngg_options[wmYpos]);
|
31 |
+
}
|
32 |
+
if ($ngg_options[wmType] == 'text') {
|
33 |
+
$thumb->watermarkText = $ngg_options[wmText];
|
34 |
+
$thumb->watermarkCreateText($ngg_options[wmColor], $ngg_options[wmFont], $ngg_options[wmSize], $ngg_options[wmOpaque]);
|
35 |
+
$thumb->watermarkImage($ngg_options[wmPos], $ngg_options[wmXpos], $ngg_options[wmYpos]);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
if ($mode == 'web20')
|
39 |
+
$thumb->createReflection(40,40,50,false,'#a4a4a4');
|
40 |
+
$thumb->show();
|
41 |
+
$thumb->destruct();
|
42 |
+
|
43 |
+
exit;
|
44 |
+
|
45 |
+
/*
|
46 |
+
createReflection($percent,$reflection,$white,$border,$borderColor)
|
47 |
+
|
48 |
+
i.e. $thumb->createReflection(40,40,80,true,'#a4a4a4');
|
49 |
+
|
50 |
+
Creates an Apple�-style reflection (it�s more of a web 2.0 thing now, I know�)
|
51 |
+
from an image. This one�s a bit weird to explain, but here goes:
|
52 |
+
|
53 |
+
$percent - What percentage of the image to create the reflection from
|
54 |
+
$reflection - What percentage of the image height should the reflection height be.
|
55 |
+
i.e. If your image is 100 pixels high, and you set reflection to 40, the reflection would be 40 pixels high.
|
56 |
+
|
57 |
+
$white - How transparent (using white as the background) the reflection should be, as a percent
|
58 |
+
$border - Whether a border should be drawn around the original image (default is true)
|
59 |
+
$borderColor - The hex value of the color you would like your border to be (default is #a4a4a4)
|
60 |
+
*/
|
61 |
+
?>
|
readme.txt
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== NextGEN Gallery ===
|
2 |
+
Contributors: Alex Rabe
|
3 |
+
Donate link: http://alexrabe.boelinger.com/?page_id=80
|
4 |
+
Tags: flash, slideshow, images, gallery, media, admin, post
|
5 |
+
Requires at least: 2.1.3
|
6 |
+
Tested up to: 2.2
|
7 |
+
Stable tag: 0.37
|
8 |
+
|
9 |
+
NextGEN Gallery is a Image Gallery plugin for WordPress.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
My last and hopefully best plugin for WordPress is a new Gallery plugin called NextGEN Gallery . It's named als "NextGeneration" according to the the development of the game consoles . More over it should indicate that I (try) to use all new possibilities of the great JQuery and the so called Web 2.0.
|
14 |
+
Before I start writing the plugin I study all image and gallery plugins for WordPress, I figure out that some of them are really good and well designed, but I missed a simple and easy administration back end to handle multiple galleries.
|
15 |
+
|
16 |
+
Features:
|
17 |
+
|
18 |
+
* Sortable Albums : Create your own sets of images
|
19 |
+
* Upload a Zip-File with pictures : Upload pictures in a zip-file (Not in Safe-mode)
|
20 |
+
* Watermark function : You can add a watermark image or text
|
21 |
+
* JavaScript Effect : Use any available popular image effect : Thickbox, Lightbox or Highslide
|
22 |
+
* Multiple CSS Stylesheet : Use a nice shadow effect for your thumbnails with your own CSS file
|
23 |
+
* Slideshow : Full integrated flash slideshow
|
24 |
+
|
25 |
+
|
26 |
+
PLEASE NOTE !! This gallery plugin is still in development, it can be contain many bugs !
|
27 |
+
|
28 |
+
== Credits ==
|
29 |
+
|
30 |
+
Copyright 2007 Alex Rabe
|
31 |
+
|
32 |
+
The NextGEN button is taken from the Silk set of FamFamFam. See more at
|
33 |
+
http://www.famfamfam.com/lab/icons/silk/
|
34 |
+
|
35 |
+
This program is free software; you can redistribute it and/or modify
|
36 |
+
it under the terms of the GNU General Public License as published by
|
37 |
+
the Free Software Foundation; either version 2 of the License, or
|
38 |
+
(at your option) any later version.
|
39 |
+
|
40 |
+
This program is distributed in the hope that it will be useful,
|
41 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
42 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
43 |
+
GNU General Public License for more details.
|
44 |
+
|
45 |
+
You should have received a copy of the GNU General Public License
|
46 |
+
along with this program; if not, write to the Free Software
|
47 |
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
48 |
+
|
49 |
+
== Installation ==
|
50 |
+
|
51 |
+
1. Upload the files to wp-content/plugins/nggallery
|
52 |
+
|
53 |
+
2. Go to the web page http://www.jeroenwijering.com/ and download the Flash Image Rotator and unpack the conent
|
54 |
+
|
55 |
+
3. Upload the file imagerotator.swf to the nggallery folder
|
56 |
+
|
57 |
+
4. Activate the plugin
|
58 |
+
|
59 |
+
5. Add a gallery and upload some images (the main gallery folder must have permission 777)
|
60 |
+
|
61 |
+
6. Go to your post an enter the tag [Gallery=ID] or [Slideshow=ID].
|
62 |
+
|
63 |
+
That's it ... Have fun
|
64 |
+
|
65 |
+
== Screenshots ==
|
66 |
+
|
67 |
+
1. Screenshot Admin Area
|
68 |
+
2. Screenshot Album Selection
|
69 |
+
2. Screenshot Thickbox Effect
|
70 |
+
2. Screenshot Watermark function
|
71 |
+
|
72 |
+
== Frequently Asked Questions ==
|
73 |
+
|
74 |
+
|
75 |
+
When writing a page/post, you can use the follow tags:
|
76 |
+
|
77 |
+
|
78 |
+
For a slideshow : **[slideshow=id,width,height]**
|
79 |
+
|
80 |
+
Example : http://nextgen.boelinger.com/slideshow/
|
81 |
+
|
82 |
+
For a album : **[album=id,extend]** or **[album=id,compact]**
|
83 |
+
|
84 |
+
Example : http://nextgen.boelinger.com/album/
|
85 |
+
|
86 |
+
For a gallery : **[gallery=id]**
|
87 |
+
|
88 |
+
Example : http://nextgen.boelinger.com/gallery-page/
|
89 |
+
|
90 |
+
For a single picture : **[singlepic=id,width,height,mode]**
|
91 |
+
|
92 |
+
Example : http://nextgen.boelinger.com/singlepic/
|
93 |
+
|
screenshot-1.jpg
ADDED
Binary file
|
screenshot-2.jpg
ADDED
Binary file
|
screenshot-3.jpg
ADDED
Binary file
|
screenshot-4.jpg
ADDED
Binary file
|
thickbox/loadingAnimation.gif
ADDED
Binary file
|
thickbox/thickbox.css
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* ----------------------------------------------------------------------------------------------------------------*/
|
2 |
+
/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
|
3 |
+
/* ----------------------------------------------------------------------------------------------------------------*/
|
4 |
+
|
5 |
+
/* *{padding: 0; margin: 0;} */
|
6 |
+
|
7 |
+
html, body {
|
8 |
+
min-height: 100%;
|
9 |
+
height: auto !important;
|
10 |
+
height: 100%
|
11 |
+
}
|
12 |
+
|
13 |
+
/* ----------------------------------------------------------------------------------------------------------------*/
|
14 |
+
/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
|
15 |
+
/* ----------------------------------------------------------------------------------------------------------------*/
|
16 |
+
#TB_window {
|
17 |
+
font: 12px Arial, Helvetica, sans-serif;
|
18 |
+
color: #333333;
|
19 |
+
}
|
20 |
+
|
21 |
+
#TB_secondLine {
|
22 |
+
font: 10px Arial, Helvetica, sans-serif;
|
23 |
+
color:#666666;
|
24 |
+
}
|
25 |
+
|
26 |
+
#TB_window a:link {color: #666666;}
|
27 |
+
#TB_window a:visited {color: #666666;}
|
28 |
+
#TB_window a:hover {color: #000;}
|
29 |
+
#TB_window a:active {color: #666666;}
|
30 |
+
#TB_window a:focus{color: #666666;}
|
31 |
+
|
32 |
+
/* ----------------------------------------------------------------------------------------------------------------*/
|
33 |
+
/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
|
34 |
+
/* ----------------------------------------------------------------------------------------------------------------*/
|
35 |
+
#TB_overlay {
|
36 |
+
position: absolute;
|
37 |
+
z-index:100;
|
38 |
+
top: 0px;
|
39 |
+
left: 0px;
|
40 |
+
background-color:#000;
|
41 |
+
filter:alpha(opacity=60);
|
42 |
+
-moz-opacity: 0.6;
|
43 |
+
opacity: 0.6;
|
44 |
+
}
|
45 |
+
|
46 |
+
#TB_window {
|
47 |
+
position: absolute;
|
48 |
+
background: #ffffff;
|
49 |
+
z-index: 102;
|
50 |
+
color:#000000;
|
51 |
+
display:none;
|
52 |
+
border: 4px solid #525252;
|
53 |
+
text-align:left;
|
54 |
+
}
|
55 |
+
|
56 |
+
#TB_window img {
|
57 |
+
display:block;
|
58 |
+
margin: 15px 0 0 15px;
|
59 |
+
border-right: 1px solid #ccc;
|
60 |
+
border-bottom: 1px solid #ccc;
|
61 |
+
border-top: 1px solid #666;
|
62 |
+
border-left: 1px solid #666;
|
63 |
+
}
|
64 |
+
|
65 |
+
#TB_caption{
|
66 |
+
height:25px;
|
67 |
+
padding:7px 30px 10px 25px;
|
68 |
+
float:left;
|
69 |
+
}
|
70 |
+
|
71 |
+
#TB_closeWindow{
|
72 |
+
height:25px;
|
73 |
+
padding:11px 25px 10px 0;
|
74 |
+
float:right;
|
75 |
+
}
|
76 |
+
|
77 |
+
#TB_closeAjaxWindow{
|
78 |
+
padding:5px 10px 7px 0;
|
79 |
+
margin-bottom:1px;
|
80 |
+
text-align:right;
|
81 |
+
float:right;
|
82 |
+
}
|
83 |
+
|
84 |
+
#TB_ajaxWindowTitle{
|
85 |
+
float:left;
|
86 |
+
padding:7px 0 5px 10px;
|
87 |
+
margin-bottom:1px;
|
88 |
+
}
|
89 |
+
|
90 |
+
#TB_title{
|
91 |
+
background-color:#e8e8e8;
|
92 |
+
height:27px;
|
93 |
+
}
|
94 |
+
|
95 |
+
#TB_ajaxContent{
|
96 |
+
clear:both;
|
97 |
+
padding:2px 15px 15px 15px;
|
98 |
+
overflow:auto;
|
99 |
+
text-align:left;
|
100 |
+
line-height:1.4em;
|
101 |
+
}
|
102 |
+
|
103 |
+
#TB_ajaxContent p{
|
104 |
+
padding:5px 0px 5px 0px;
|
105 |
+
}
|
106 |
+
|
107 |
+
#TB_load{
|
108 |
+
position: absolute;
|
109 |
+
display:none;
|
110 |
+
height:100px;
|
111 |
+
width:100px;
|
112 |
+
z-index:101;
|
113 |
+
}
|
114 |
+
|
115 |
+
#TB_HideSelect{
|
116 |
+
z-index:99;
|
117 |
+
position:absolute;
|
118 |
+
top: 0;
|
119 |
+
left: 0;
|
120 |
+
background-color:#fff;
|
121 |
+
border:none;
|
122 |
+
filter:alpha(opacity=0);
|
123 |
+
-moz-opacity: 0;
|
124 |
+
opacity: 0;
|
125 |
+
}
|
126 |
+
|
127 |
+
#TB_iframeContent{
|
128 |
+
clear:both;
|
129 |
+
border:none;
|
130 |
+
margin-bottom:-1px;
|
131 |
+
margin-top:1px;
|
132 |
+
_margin-bottom:1px;
|
133 |
+
}
|
thickbox/thickbox.js
ADDED
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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ickbox 2.1 - jQuery plugin for displaying content in a box above the page
|
3 |
+
*
|
4 |
+
* Copyright (c) 2006, 2007 Cody Lindley (http://www.codylindley.com)
|
5 |
+
*
|
6 |
+
* Licensed under the MIT License:
|
7 |
+
* http://www.opensource.org/licenses/mit-license.php
|
8 |
+
*/
|
9 |
+
|
10 |
+
// on page load call TB_init
|
11 |
+
$(document).ready(TB_init);
|
12 |
+
|
13 |
+
// add thickbox to href elements that have a class of .thickbox
|
14 |
+
function TB_init(){
|
15 |
+
$("a.thickbox").click(function(event){
|
16 |
+
// stop default behaviour
|
17 |
+
event.preventDefault();
|
18 |
+
// remove click border
|
19 |
+
this.blur();
|
20 |
+
|
21 |
+
// get caption: either title or name attribute
|
22 |
+
var caption = this.title || this.name || "";
|
23 |
+
|
24 |
+
// get rel attribute for image groups
|
25 |
+
var group = this.rel || false;
|
26 |
+
|
27 |
+
// display the box for the elements href
|
28 |
+
TB_show(caption, this.href, group);
|
29 |
+
});
|
30 |
+
}
|
31 |
+
|
32 |
+
// called when the user clicks on a thickbox link
|
33 |
+
function TB_show(caption, url, rel) {
|
34 |
+
|
35 |
+
// create iframe, overlay and box if non-existent
|
36 |
+
if ( !$("#TB_HideSelect").length ) {
|
37 |
+
$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
|
38 |
+
$("#TB_overlay").click(TB_remove);
|
39 |
+
}
|
40 |
+
// TODO replace or check if event is already assigned
|
41 |
+
$(window).scroll(TB_position);
|
42 |
+
|
43 |
+
// TODO replace
|
44 |
+
TB_overlaySize();
|
45 |
+
|
46 |
+
// TODO create loader only once, hide and show on demand
|
47 |
+
// $("body").append("<div id='TB_load'><img src='loadingAnimation.gif' /></div>");
|
48 |
+
$("body").append("<div id='TB_load'><img src='"+ LoadingImage +"' /></div>");
|
49 |
+
TB_load_position();
|
50 |
+
|
51 |
+
// check if a query string is involved
|
52 |
+
var baseURL = url.match(/(.+)?/)[1] || url;
|
53 |
+
|
54 |
+
// regex to check if a href refers to an image
|
55 |
+
var imageURL = /\.(jpe?g|png|gif|bmp)/gi;
|
56 |
+
|
57 |
+
// check for images
|
58 |
+
if ( baseURL.match(imageURL) ) {
|
59 |
+
var dummy = { caption: "", url: "", html: "" };
|
60 |
+
|
61 |
+
var prev = dummy,
|
62 |
+
next = dummy,
|
63 |
+
imageCount = "";
|
64 |
+
|
65 |
+
// if an image group is given
|
66 |
+
if ( rel ) {
|
67 |
+
function getInfo(image, id, label) {
|
68 |
+
return {
|
69 |
+
caption: image.title,
|
70 |
+
url: image.href,
|
71 |
+
html: "<span id='TB_" + id + "'> <a href='#'>" + label + "</a></span>"
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
// find the anchors that point to the group
|
76 |
+
var imageGroup = $("a[@rel="+rel+"]").get();
|
77 |
+
var foundSelf = false;
|
78 |
+
|
79 |
+
// loop through the anchors, looking for ourself, saving information about previous and next image
|
80 |
+
for (var i = 0; i < imageGroup.length; i++) {
|
81 |
+
var image = imageGroup[i];
|
82 |
+
var urlTypeTemp = image.href.match(imageURL);
|
83 |
+
|
84 |
+
// look for ourself
|
85 |
+
if ( image.href == url ) {
|
86 |
+
foundSelf = true;
|
87 |
+
imageCount = "Image " + (i + 1) + " of "+ (imageGroup.length);
|
88 |
+
} else {
|
89 |
+
// when we found ourself, the current is the next image
|
90 |
+
if ( foundSelf ) {
|
91 |
+
next = getInfo(image, "next", "Next >");
|
92 |
+
// stop searching
|
93 |
+
break;
|
94 |
+
} else {
|
95 |
+
// didn't find ourself yet, so this may be the one before ourself
|
96 |
+
prev = getInfo(image, "prev", "< Prev");
|
97 |
+
}
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
imgPreloader = new Image();
|
103 |
+
imgPreloader.onload = function() {
|
104 |
+
imgPreloader.onload = null;
|
105 |
+
|
106 |
+
// Resizing large images
|
107 |
+
var pagesize = TB_getPageSize();
|
108 |
+
var x = pagesize[0] - 150;
|
109 |
+
var y = pagesize[1] - 150;
|
110 |
+
var imageWidth = imgPreloader.width;
|
111 |
+
var imageHeight = imgPreloader.height;
|
112 |
+
if (imageWidth > x) {
|
113 |
+
imageHeight = imageHeight * (x / imageWidth);
|
114 |
+
imageWidth = x;
|
115 |
+
if (imageHeight > y) {
|
116 |
+
imageWidth = imageWidth * (y / imageHeight);
|
117 |
+
imageHeight = y;
|
118 |
+
}
|
119 |
+
} else if (imageHeight > y) {
|
120 |
+
imageWidth = imageWidth * (y / imageHeight);
|
121 |
+
imageHeight = y;
|
122 |
+
if (imageWidth > x) {
|
123 |
+
imageHeight = imageHeight * (x / imageWidth);
|
124 |
+
imageWidth = x;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
// End Resizing
|
128 |
+
|
129 |
+
// TODO don't use globals
|
130 |
+
TB_WIDTH = imageWidth + 30;
|
131 |
+
TB_HEIGHT = imageHeight + 60;
|
132 |
+
|
133 |
+
// TODO empty window content instead
|
134 |
+
$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + imageCount + prev.html + next.html + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div>");
|
135 |
+
|
136 |
+
$("#TB_closeWindowButton").click(TB_remove);
|
137 |
+
|
138 |
+
function buildClickHandler(image) {
|
139 |
+
return function() {
|
140 |
+
$("#TB_window").remove();
|
141 |
+
$("body").append("<div id='TB_window'></div>");
|
142 |
+
TB_show(image.caption, image.url, rel);
|
143 |
+
return false;
|
144 |
+
};
|
145 |
+
}
|
146 |
+
var goPrev = buildClickHandler(prev);
|
147 |
+
var goNext = buildClickHandler(next);
|
148 |
+
if ( prev.html ) {
|
149 |
+
$("#TB_prev").click(goPrev);
|
150 |
+
}
|
151 |
+
|
152 |
+
if ( next.html ) {
|
153 |
+
$("#TB_next").click(goNext);
|
154 |
+
}
|
155 |
+
|
156 |
+
// TODO use jQuery, maybe with event fix plugin, or just get the necessary parts of it
|
157 |
+
document.onkeydown = function(e) {
|
158 |
+
if (e == null) { // ie
|
159 |
+
keycode = event.keyCode;
|
160 |
+
} else { // mozilla
|
161 |
+
keycode = e.which;
|
162 |
+
}
|
163 |
+
switch(keycode) {
|
164 |
+
case 27:
|
165 |
+
TB_remove();
|
166 |
+
break;
|
167 |
+
case 190:
|
168 |
+
if( next.html ) {
|
169 |
+
document.onkeydown = null;
|
170 |
+
goNext();
|
171 |
+
}
|
172 |
+
break;
|
173 |
+
case 188:
|
174 |
+
if( prev.html ) {
|
175 |
+
document.onkeydown = null;
|
176 |
+
goPrev();
|
177 |
+
}
|
178 |
+
break;
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
// TODO don't remove loader etc., just hide and show later
|
183 |
+
TB_position();
|
184 |
+
$("#TB_load").remove();
|
185 |
+
$("#TB_ImageOff").click(TB_remove);
|
186 |
+
|
187 |
+
// for safari using css instead of show
|
188 |
+
// TODO is that necessary? can't test safari
|
189 |
+
$("#TB_window").css({display:"block"});
|
190 |
+
}
|
191 |
+
imgPreloader.src = url;
|
192 |
+
|
193 |
+
} else { //code to show html pages
|
194 |
+
|
195 |
+
var queryString = url.match(/\?(.+)/)[1];
|
196 |
+
var params = TB_parseQuery( queryString );
|
197 |
+
|
198 |
+
TB_WIDTH = (params['width']*1) + 30;
|
199 |
+
TB_HEIGHT = (params['height']*1) + 40;
|
200 |
+
|
201 |
+
var ajaxContentW = TB_WIDTH - 30,
|
202 |
+
ajaxContentH = TB_HEIGHT - 45;
|
203 |
+
|
204 |
+
if(url.indexOf('TB_iframe') != -1){
|
205 |
+
urlNoQuery = url.split('TB_');
|
206 |
+
$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' onload='TB_showIframe()'> </iframe>");
|
207 |
+
} else {
|
208 |
+
$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
|
209 |
+
}
|
210 |
+
|
211 |
+
$("#TB_closeWindowButton").click(TB_remove);
|
212 |
+
|
213 |
+
if(url.indexOf('TB_inline') != -1){
|
214 |
+
$("#TB_ajaxContent").html($('#' + params['inlineId']).html());
|
215 |
+
TB_position();
|
216 |
+
$("#TB_load").remove();
|
217 |
+
$("#TB_window").css({display:"block"});
|
218 |
+
}else if(url.indexOf('TB_iframe') != -1){
|
219 |
+
TB_position();
|
220 |
+
if(frames['TB_iframeContent'] == undefined){//be nice to safari
|
221 |
+
$("#TB_load").remove();
|
222 |
+
$("#TB_window").css({display:"block"});
|
223 |
+
$(document).keyup( function(e){ var key = e.keyCode; if(key == 27){TB_remove()} });
|
224 |
+
}
|
225 |
+
}else{
|
226 |
+
$("#TB_ajaxContent").load(url, function(){
|
227 |
+
TB_position();
|
228 |
+
$("#TB_load").remove();
|
229 |
+
$("#TB_window").css({display:"block"});
|
230 |
+
});
|
231 |
+
}
|
232 |
+
|
233 |
+
}
|
234 |
+
|
235 |
+
$(window).resize(TB_position);
|
236 |
+
|
237 |
+
document.onkeyup = function(e){
|
238 |
+
if (e == null) { // ie
|
239 |
+
keycode = event.keyCode;
|
240 |
+
} else { // mozilla
|
241 |
+
keycode = e.which;
|
242 |
+
}
|
243 |
+
if(keycode == 27){ // close
|
244 |
+
TB_remove();
|
245 |
+
}
|
246 |
+
}
|
247 |
+
|
248 |
+
}
|
249 |
+
|
250 |
+
//helper functions below
|
251 |
+
|
252 |
+
function TB_showIframe(){
|
253 |
+
$("#TB_load").remove();
|
254 |
+
$("#TB_window").css({display:"block"});
|
255 |
+
}
|
256 |
+
|
257 |
+
function TB_remove() {
|
258 |
+
$("#TB_imageOff").unbind("click");
|
259 |
+
$("#TB_overlay").unbind("click");
|
260 |
+
$("#TB_closeWindowButton").unbind("click");
|
261 |
+
$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').remove();});
|
262 |
+
$("#TB_load").remove();
|
263 |
+
return false;
|
264 |
+
}
|
265 |
+
|
266 |
+
function TB_position() {
|
267 |
+
var pagesize = TB_getPageSize();
|
268 |
+
var arrayPageScroll = TB_getPageScrollTop();
|
269 |
+
var style = {width: TB_WIDTH, left: (arrayPageScroll[0] + (pagesize[0] - TB_WIDTH)/2), top: (arrayPageScroll[1] + (pagesize[1]-TB_HEIGHT)/2)};
|
270 |
+
$("#TB_window").css(style);
|
271 |
+
}
|
272 |
+
|
273 |
+
function TB_overlaySize(){
|
274 |
+
if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) {
|
275 |
+
yScroll = window.innerHeight + window.scrollMaxY;
|
276 |
+
xScroll = window.innerWidth + window.scrollMaxX;
|
277 |
+
var deff = document.documentElement;
|
278 |
+
var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
|
279 |
+
var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
|
280 |
+
xScroll -= (window.innerWidth - wff);
|
281 |
+
yScroll -= (window.innerHeight - hff);
|
282 |
+
} else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac
|
283 |
+
yScroll = document.body.scrollHeight;
|
284 |
+
xScroll = document.body.scrollWidth;
|
285 |
+
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
|
286 |
+
yScroll = document.body.offsetHeight;
|
287 |
+
xScroll = document.body.offsetWidth;
|
288 |
+
}
|
289 |
+
$("#TB_overlay").css({"height": yScroll, "width": xScroll});
|
290 |
+
$("#TB_HideSelect").css({"height": yScroll,"width": xScroll});
|
291 |
+
}
|
292 |
+
|
293 |
+
function TB_load_position() {
|
294 |
+
var pagesize = TB_getPageSize();
|
295 |
+
var arrayPageScroll = TB_getPageScrollTop();
|
296 |
+
$("#TB_load")
|
297 |
+
.css({left: (arrayPageScroll[0] + (pagesize[0] - 100)/2), top: (arrayPageScroll[1] + ((pagesize[1]-100)/2)) })
|
298 |
+
.css({display:"block"});
|
299 |
+
}
|
300 |
+
|
301 |
+
function TB_parseQuery ( query ) {
|
302 |
+
// return empty object
|
303 |
+
if( !query )
|
304 |
+
return {};
|
305 |
+
var params = {};
|
306 |
+
|
307 |
+
// parse query
|
308 |
+
var pairs = query.split(/[;&]/);
|
309 |
+
for ( var i = 0; i < pairs.length; i++ ) {
|
310 |
+
var pair = pairs[i].split('=');
|
311 |
+
if ( !pair || pair.length != 2 )
|
312 |
+
continue;
|
313 |
+
// unescape both key and value, replace "+" with spaces in value
|
314 |
+
params[unescape(pair[0])] = unescape(pair[1]).replace(/\+/g, ' ');
|
315 |
+
}
|
316 |
+
return params;
|
317 |
+
}
|
318 |
+
|
319 |
+
function TB_getPageScrollTop(){
|
320 |
+
var yScrolltop;
|
321 |
+
var xScrollleft;
|
322 |
+
if (self.pageYOffset || self.pageXOffset) {
|
323 |
+
yScrolltop = self.pageYOffset;
|
324 |
+
xScrollleft = self.pageXOffset;
|
325 |
+
} else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){ // Explorer 6 Strict
|
326 |
+
yScrolltop = document.documentElement.scrollTop;
|
327 |
+
xScrollleft = document.documentElement.scrollLeft;
|
328 |
+
} else if (document.body) {// all other Explorers
|
329 |
+
yScrolltop = document.body.scrollTop;
|
330 |
+
xScrollleft = document.body.scrollLeft;
|
331 |
+
}
|
332 |
+
arrayPageScroll = new Array(xScrollleft,yScrolltop)
|
333 |
+
return arrayPageScroll;
|
334 |
+
}
|
335 |
+
|
336 |
+
function TB_getPageSize(){
|
337 |
+
var de = document.documentElement;
|
338 |
+
var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
|
339 |
+
var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight
|
340 |
+
arrayPageSize = new Array(w,h)
|
341 |
+
return arrayPageSize;
|
342 |
+
}
|