4 /* Admin page for NP_SkinFiles */
\r
5 /* ------------------------------------ */
\r
6 /* A simple skin files manager */
\r
8 /* code by Jeff MacMichael */
\r
9 /* http://gednet.com/ */
\r
13 $strRel = '../../../';
\r
14 include($strRel . 'config.php');
\r
16 include($DIR_LIBS . 'PLUGINADMIN.php');
\r
18 if (preg_match("/MD$/", $nucleus['version'])) {
\r
19 $isblogadmin = $member->isBlogAdmin(-1);
\r
21 $isblogadmin = $member->isBlogAdmin($blogid);
\r
23 if (!($member->isAdmin() || $isblogadmin)) {
\r
24 $oPluginAdmin = new PluginAdmin('SkinFiles');
\r
25 $oPluginAdmin->start();
\r
26 echo "<p>"._ERROR_DISALLOWED."</p>";
\r
27 $oPluginAdmin->end();
\r
31 // set to FALSE for normal operation, or TRUE if skins are stored
\r
32 // under owner's member id i.e. /skins/1/grey/... (MDNucleus)
\r
33 $privateskins = FALSE;
\r
34 if ($privateskins) {
\r
36 $SKINSUBDIR = $member->getID().'/';
\r
37 $latestskins = 'latest-skins/';
\r
42 global $pluginsskinfiles, $CONF;
\r
43 $pluginsskinfiles=$CONF['PluginURL']."skinfiles";
\r
45 if (isset($_GET['action'])) {$action = $_GET['action'];}
\r
46 if (isset($_POST['action'])) {$action = $_POST['action'];}
\r
48 if ($action == 'download') {
\r
54 // create the admin area page
\r
55 $oPluginAdmin = new PluginAdmin('SkinFiles');
\r
56 $oPluginAdmin->start();
\r
58 echo "<h2>Skin File Management</h2>";
\r
60 if (strstr('renfile delfile createdir rendir deldir deleteAllInDir'
\r
61 .' editfile uploadfile createfile getLatestSkins', $action)) {
\r
62 call_user_func($action);
\r
67 $oPluginAdmin->end();
\r
71 function createfile() {
\r
72 global $oPluginAdmin, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;
\r
73 $parent = $_POST["dir"];
\r
74 $filename = $_POST["filename"];
\r
75 $fullpath = $DIR_SKINS.$SKINSUBDIR.$parent.'/'.$filename;
\r
76 if (file_exists($fullpath)) {
\r
77 $msg = "Error: the file '$filename' already exists.";
\r
80 echo "<h3><b>Creating file \"/$parent/$filename\":</b></h3>";
\r
81 $errrep = error_reporting(E_ERROR);
\r
82 if (touch($fullpath)) {
\r
83 $msg = 'The file was created successfully.';
\r
85 $msg = 'ERROR: The file was <i>not</i> created successfully.';
\r
87 $oldumask = umask(0000);
\r
88 chmod($fullpath, 0755);
\r
90 error_reporting($errrep);
\r
94 function createdir() {
\r
95 global $oPluginAdmin, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;
\r
96 $parent = $_POST["dir"];
\r
97 $newdir = $_POST["newdir"];
\r
99 echo 'You need to specify a directory name to create. <br /><br />';
\r
100 echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Go back</a><br />';
\r
103 $errrep = error_reporting(E_ERROR);
\r
104 $oldumask = umask(0000);
\r
105 if (mkdir ($DIR_SKINS.$SKINSUBDIR.$parent.'/'.$newdir, 0755)) {
\r
106 $msg = 'Directory created successfully.';
\r
108 $msg = 'There was an error creating the directory (check to see if the directory already exists).';
\r
111 error_reporting($errrep);
\r
115 function download() {
\r
116 global $DIR_SKINS, $SKINSUBDIR;
\r
117 $file = $_GET["rfp"];
\r
118 $path = $DIR_SKINS.$SKINSUBDIR.$file;
\r
119 $splitpath = preg_split( "/\//", strrev($_GET["rfp"]), 2);
\r
120 $file = strrev($splitpath[0]);
\r
122 // download code taken from Paul Alger's PHP_Easy_Download.
\r
124 // translate file name properly for Internet Explorer.
\r
125 if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")){
\r
126 $file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1);
\r
128 // make sure the file exists before sending headers
\r
129 if(!$fdl=@fopen($path,'r')){
\r
130 die("Cannot Open File!");
\r
132 header("Cache-Control: ");// leave blank to avoid IE errors
\r
133 header("Pragma: ");// leave blank to avoid IE errors
\r
134 header("Content-type: application/octet-stream");
\r
135 header('Content-Disposition: attachment; filename="'.$file.'"');
\r
136 header("Content-length: ".(string)(filesize($path)));
\r
145 function uploadfile() {
\r
146 global $HTTP_POST_FILES, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles, $CONF;
\r
147 $filename = $HTTP_POST_FILES['filename']['name'];
\r
148 $filesize = $HTTP_POST_FILES['filename']['size'];
\r
149 $filetempname = $HTTP_POST_FILES['filename']['tmp_name'];
\r
150 $todir = $DIR_SKINS.$SKINSUBDIR.$_POST['dir'].'/';
\r
152 if ($filesize > $CONF['MaxUploadSize']) {
\r
153 showdir(_ERROR_FILE_TOO_BIG);
\r
157 // check file type against allowed types
\r
159 $allowedtypes = explode (',', "css,html,htm,xml,inc,txt,".$CONF['AllowedTypes']);
\r
160 foreach ( $allowedtypes as $type )
\r
161 if (eregi("\." .$type. "$",$filename)) $ok = 1;
\r
163 showdir(_ERROR_BADFILETYPE);
\r
166 if (!is_uploaded_file($filetempname)) {
\r
167 showdir(_ERROR_BADREQUEST);
\r
170 if (file_exists($todir.$filename)) {
\r
171 showdir(_ERROR_UPLOADDUPLICATE);
\r
175 // move file to directory
\r
176 if (is_uploaded_file($filetempname)) {
\r
177 $errrep = error_reporting(E_ERROR);
\r
178 if (!@move_uploaded_file($filetempname, $todir . $filename)) {
\r
179 showdir(_ERROR_UPLOADMOVE);
\r
182 error_reporting($errrep);
\r
184 // chmod uploaded file
\r
185 $oldumask = umask(0000);
\r
186 @chmod($todir . $filename, 0755);
\r
189 showdir("File uploaded successfully.");
\r
192 function rendir() {
\r
193 global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;
\r
194 if (isset($_POST['newname'])) {
\r
195 $splitpath = preg_split( "/\//", strrev($_POST["oldname"]), 2);
\r
196 $newname = strrev($splitpath[1]) .'/'. $_POST["newname"];
\r
197 $newname = preg_replace("/^\//", "", $newname);
\r
198 $res = rename ( $DIR_SKINS.$SKINSUBDIR.$_POST["oldname"],
\r
199 $DIR_SKINS.$SKINSUBDIR.$newname);
\r
201 $msg = "Directory successfully renamed.";
\r
203 $msg = "Failed to rename directory - (check to see if another directory already exists with the new name).";
\r
207 $oldname = preg_replace("/^\//", "", $_GET["oldname"]);
\r
208 echo '<h3><b>Rename directory "/'.$oldname.'":</b></h3>';
\r
209 $splitpath = preg_split( "/\//", strrev($_GET["oldname"]), 2);
\r
210 $dir = strrev($splitpath[0]);
\r
211 $parent = strrev($splitpath[1]);
\r
212 echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Cancel rename</a><br />';
\r
214 <form method="post" action="<?php echo $pluginsskinfiles?>/">
\r
215 <input type="hidden" name="action" value="rendir" />
\r
216 <input type="hidden" name="dir" value="<?php echo "/$parent" ?>"/>
\r
217 <input type="hidden" name="oldname" value="<?php echo $oldname?>"/>
\r
219 <td><?php echo 'Rename to'?></td>
\r
220 <td><input name="newname" tabindex="90" value="<?php echo htmlspecialchars($dir) ?>" maxlength="50" size="20" /></td>
\r
222 <td><?php echo "Rename"?></td>
\r
223 <td><input type="submit" tabindex="140" value="<?php echo "Rename this folder"?>" onclick="return checkSubmit();" /></td>
\r
230 function editfile () {
\r
231 global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;
\r
232 if (isset ($_POST['rfp']) && isset($_POST['content'])) {
\r
233 $file = $_POST['rfp'];
\r
234 $errrep = error_reporting(E_ERROR);
\r
236 if ($fh = @fopen($DIR_SKINS.$SKINSUBDIR.$file, 'w')) {
\r
237 if (fwrite ($fh, trim(stripslashes($_POST['content'])))) {
\r
245 error_reporting($errrep);
\r
247 $msg = 'File was edited successfully.';
\r
249 $msg = 'ERROR: File was <i>not</i> saved successfully.';
\r
252 if (isset ($_GET['rfp'])) { $file = $_GET['rfp']; }
\r
253 if (isset ($_POST['rfp'])) { $file = $_POST['rfp']; }
\r
254 $splitpath = preg_split( "/\//", strrev($file), 2);
\r
255 $parent = strrev($splitpath[1]);
\r
256 echo '<h3>Editing file "/'.$file.'":</h3>';
\r
257 if (isset($msg)) { echo "<p><b>$msg</b></p>"; }
\r
258 echo "> <a href=\"$pluginsskinfiles/?dir=$parent\"> Cancel/Return to /$parent</a><br /><br />";
\r
259 $fh = @fopen($DIR_SKINS.$SKINSUBDIR.$file, 'r');
\r
260 while (!feof($fh)) {
\r
261 $content .= fread($fh, 4096);
\r
265 <form method="post" action="<?php echo $pluginsskinfiles?>/">
\r
266 <input type="hidden" name="action" value="editfile" />
\r
267 <input type="hidden" name="rfp" value="<?php echo $file ?>"/>
\r
268 <input type="hidden" name="dir" value="<?php echo $parent ?>"/>
\r
269 <input type="submit" tabindex="140" value="<?php echo "Save changes"?>" onclick="return checkSubmit();" />
\r
270 <input type="reset" value="Reset Data" /><br />
\r
271 <textarea class="skinedit" tabindex="8" rows="20" cols="80" name="content"><?PHP echo htmlspecialchars($content) ?></textarea>
\r
272 <input type="submit" tabindex="140" value="<?php echo "Save changes"?>" onclick="return checkSubmit();" />
\r
273 <input type="reset" value="Reset Data" /><br />
\r
279 function renfile() {
\r
280 global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;
\r
281 if (isset($_POST['newname'])) {
\r
282 $splitpath = preg_split( "/\//", strrev($_POST["oldname"]), 2);
\r
283 $newname = strrev($splitpath[1]) .'/'. $_POST["newname"];
\r
284 $newname = preg_replace("/^\//", "", $newname);
\r
285 $res = rename ( $DIR_SKINS.$SKINSUBDIR.$_POST["oldname"],
\r
286 $DIR_SKINS.$SKINSUBDIR.$newname);
\r
288 $msg = "File successfully renamed.";
\r
290 $msg = "File could not be renamed - (check to see if another file already exists with the new name).";
\r
294 echo '<h3><b>Rename file "/'.$_GET["rfp"].'":</b></h3>';
\r
295 $splitpath = preg_split( "/\//", strrev($_GET["rfp"]), 2);
\r
296 $file = strrev($splitpath[0]);
\r
297 $parent = strrev($splitpath[1]);
\r
298 echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Cancel rename</a><br />';
\r
300 <form method="post" action="<?php echo $pluginsskinfiles?>/">
\r
301 <input type="hidden" name="action" value="renfile" />
\r
302 <input type="hidden" name="oldname" value="<?php echo $_GET["rfp"] ?>"/>
\r
303 <input type="hidden" name="dir" value="<?php echo "/$parent" ?>"/>
\r
305 <td><?php echo 'Rename to'?></td>
\r
306 <td><input name="newname" tabindex="90" value="<?php echo htmlspecialchars($file) ?>" maxlength="50" size="20" /></td>
\r
308 <td><?php echo "Rename"?></td>
\r
309 <td><input type="submit" tabindex="140" value="<?php echo "Rename this file"?>" onclick="return checkSubmit();" /></td>
\r
316 function delfile() {
\r
317 global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;
\r
318 if (isset($_GET['sure'])) {
\r
319 $file = $DIR_SKINS.$SKINSUBDIR.$_GET["rfp"];
\r
320 $errrep = error_reporting(E_ERROR);
\r
321 if (unlink ($file)) {
\r
322 $msg = 'File "'.$_GET["rfp"].'" has been deleted.';
\r
324 $msg = 'ERROR: File "'.$_GET["rfp"].'" could not be deleted.';
\r
326 error_reporting($errrep);
\r
329 $file = $DIR_SKINS.$SKINSUBDIR.$_GET["rfp"];
\r
330 $splitpath = preg_split( "/\//", strrev($_GET["rfp"]), 2);
\r
331 $parent = strrev($splitpath[1]);
\r
332 echo '<h3><b>Delete file "'.$_GET["rfp"].'": are you sure?</b></h3>';
\r
333 echo '<b>This action cannot be undone!</b><br /><br />';
\r
334 echo "> <a href=\"$pluginsskinfiles/?action=delfile&dir=$parent&sure=y&rfp=".$_GET["rfp"]."\">Yes, delete the file.</a><br />";
\r
335 echo "> <a href=\"$pluginsskinfiles/?dir=".$parent.'">No, go back.</a><br />';
\r
339 function deldir() {
\r
340 global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;
\r
341 if (isset($_GET['sure'])) {
\r
342 $dir = $DIR_SKINS.$SKINSUBDIR.$_GET["remdir"];
\r
343 $errrep = error_reporting(E_ERROR);
\r
344 if (rmdir ($dir)) {
\r
345 $msg = 'Directory "'.$_GET["remdir"].'" has been deleted.';
\r
347 $msg = 'ERROR: directory "'.$_GET["remdir"].'" could not be deleted - (check to see if it contains files).';
\r
349 error_reporting($errrep);
\r
352 $dir = preg_replace("/^\//", "",$_GET['remdir']);
\r
353 $parent = $_GET['dir'];
\r
354 echo '<h3><b>Delete directory "/'.$dir.'": are you sure?</b></h3>';
\r
355 echo '<b>This action cannot be undone!</b><br /><br />';
\r
356 echo "> <a href=\"$pluginsskinfiles/?action=deldir&sure=y&remdir=$dir&dir=$parent\">Yes, delete the directory (it must be empty to do this).</a><br /><br />";
\r
357 echo "> <a href=\"$pluginsskinfiles/?dir=".$parent.'">No, go back.</a><br />';
\r
361 function deleteAllInDir() {
\r
362 global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;
\r
363 $parent = $DIR_SKINS.$SKINSUBDIR.preg_replace("/^\//", "",$_GET['dir']);
\r
364 if ($dh = @opendir($parent)) {
\r
365 while (($file = readdir($dh)) !== false) {
\r
366 if(!preg_match("/^\.{1,2}/", $file)){
\r
367 if (!is_dir($parent.$file)) {
\r
374 if (isset($_GET['sure'])) {
\r
375 $errrep = error_reporting(E_ERROR);
\r
376 echo '<h3>Deletion results</h3><table>';
\r
377 echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET["dir"]."\">Return to the /".$_GET["dir"]." directory.</a><br />";
\r
378 foreach ($files as $file) {
\r
379 if (unlink ("$parent/$file")) {
\r
380 echo "<tr><td>File: $file was deleted.</td></tr>";
\r
382 echo "<tr><td>File: $file was <b>NOT</b> deleted.</td></tr>";
\r
386 error_reporting($errrep);
\r
387 echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET["dir"]."\">Return to the /".$_GET["dir"]." directory.</a><br />";
\r
389 echo '<h3><b>Delete all files in directory "/'.$_GET['dir'].'": are you sure?</b></h3>';
\r
390 echo '<b>This action cannot be undone!</b><br /><br />';
\r
391 echo "> <a href=\"$pluginsskinfiles/?action=deleteAllInDir&sure=y&dir=".$_GET["dir"]."\">Yes, delete <u>all files</u> in this directory.</a><br />";
\r
392 echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET['dir'].'">No, go back.</a><br /><br />';
\r
393 echo '<b>Files list:</b><table>';
\r
394 foreach ($files as $file) { echo "<tr><td>$file</td></tr>"; }
\r
399 // function for MDNucleus; won't work unless $privateskins is set to true
\r
400 function getLatestSkins() {
\r
401 global $DIR_SKINS, $pluginsskinfiles, $privateskins, $latestskins, $member;
\r
402 $confirmed = $_POST['overwrite'];
\r
404 showdir("Overwrite of default skin files not confirmed - no action taken.");
\r
407 if ($dh = @opendir($DIR_SKINS.$latestskins)) {
\r
408 while (($file = readdir($dh)) !== false) {
\r
409 if(!preg_match("/^\.{1,2}/", $file))
\r
410 if (is_dir($DIR_SKINS.$latestskins.$file)) $skins[] = $file;
\r
415 $msg = "Refreshed skin folders:";
\r
417 foreach ($skins as $skin) {
\r
418 $memberskin = $DIR_SKINS.$member->getID().'/'.$skin;
\r
419 if (is_file($memberskin)) unlink($memberskin);
\r
420 if (!is_dir($memberskin)) {
\r
421 $old_umask = umask(0);
\r
422 mkdir($memberskin, 0755);
\r
425 exec("rsync -Wtr --delete ".$DIR_SKINS.$latestskins.$skin."/* ".$memberskin.'/');
\r
429 showdir("No default skin folders found. No action taken.");
\r
435 function _isImageFile($file) {
\r
436 return preg_match ("/\.(gif|png|jpg|jpeg|bmp|ico)$/i", $file);
\r
439 function _isEditableFile($file) {
\r
440 return preg_match ("/\.(inc|txt|htm|html|xml)$/i", $file);
\r
443 function showdir($msg = '') {
\r
444 global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles, $CONF;
\r
445 global $privateskins, $latestskins;
\r
446 if (isset($_GET['dir'])) {
\r
447 $newdir = preg_replace("/^\//", "",$_GET['dir']);
\r
448 $currdir = $DIR_SKINS.$SKINSUBDIR."$newdir/";
\r
450 } elseif (isset($_POST['dir'])) {
\r
451 $newdir = preg_replace("/^\//", "",$_POST['dir']);
\r
452 $currdir = $DIR_SKINS.$SKINSUBDIR."$newdir/";
\r
456 $currdir = $DIR_SKINS.$SKINSUBDIR;
\r
460 if ($privateskins && (!is_dir($DIR_SKINS.$SKINSUBDIR))) {
\r
461 $oldumask = umask(0);
\r
462 mkdir($DIR_SKINS.$SKINSUBDIR, 0755);
\r
466 if (!is_dir($currdir)) {
\r
467 echo 'The specified location is not a directory or doesn\'t exist.';
\r
471 if ($dh = @opendir($currdir)) {
\r
472 while (($file = readdir($dh)) !== false) {
\r
473 if(!preg_match("/^\.{1,2}/", $file)){
\r
474 if (is_dir($currdir.$file)) {
\r
484 echo "<h3>Current Directory: <b>/$newdir</b></h3>";
\r
487 echo '<p><b>'.htmlspecialchars($msg).'</b></p>';
\r
490 if ($newdir != '') {
\r
491 echo "<u><a href=\"$pluginsskinfiles/\">> Return to / <</a></u><br />";
\r
492 if (strstr($newdir, '/')) {
\r
493 $splitpath = preg_split( "/\//", strrev($newdir), 2);
\r
494 $updir = strrev($splitpath[1]);
\r
495 echo "<u><a href=\"$pluginsskinfiles/?dir=/$updir\">> Return to /$updir <</a></u><br /><br />";
\r
498 echo "<u><a href=\"$pluginsskinfiles/?dir=$newdir\">> Refresh <</a></u><br />";
\r
501 if(is_array($dirs)){
\r
503 foreach($dirs as $dir) {
\r
504 echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'><td>";
\r
505 echo " <a href=\"$pluginsskinfiles/?dir=$newdir/$dir\">";
\r
506 echo "<img src=\"$pluginsskinfiles/dir.gif\"> $dir</a> </td>";
\r
507 echo "<td> <a href=\"$pluginsskinfiles/?action=rendir&oldname=$newdir/$dir\" title=\"Rename directory\">(ren)</a></td>";
\r
508 echo "<td> <a href=\"$pluginsskinfiles/?action=deldir&dir=$newdir&remdir=$newdir/$dir\" title=\"Delete directory\">(del)</a></td>";
\r
509 echo "</td><td></td><td></td><td></td><td>";
\r
510 echo "<td>".date('M d, Y h:i:s a', filemtime($DIR_SKINS.$SKINSUBDIR.$newdir."/$dir"));
\r
515 if(is_array($files)){
\r
517 foreach($files as $file) {
\r
518 echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'><td>";
\r
519 echo " ";
\r
520 if (preg_match("/\.css$/i", $file)) {
\r
521 echo "<img src=\"$pluginsskinfiles/css.gif\"> ";
\r
522 } elseif (preg_match("/\.php(3|4)?$/i", $file)) {
\r
523 echo "<img src=\"$pluginsskinfiles/php.gif\"> ";
\r
524 } elseif (_isEditableFile($file)) {
\r
525 echo "<img src=\"$pluginsskinfiles/text.gif\"> ";
\r
526 } elseif (_isImageFile($file)) {
\r
527 echo "<img src=\"$pluginsskinfiles/image.gif\"> ";
\r
529 echo "<img src=\"$pluginsskinfiles/generic.png\"> ";
\r
531 if ($newdir == '') {$thisdir = '';} else {$thisdir = "$newdir/";}
\r
532 echo "$file ";
\r
534 echo " <a href=\"$pluginsskinfiles/?action=renfile&rfp=$thisdir"."$file\" title=\"Rename file\">(ren)</a>";
\r
536 echo " <a href=\"$pluginsskinfiles/?action=delfile&rfp=$thisdir"."$file\" title=\"Delete file\">(del)</a>";
\r
538 if ((is_writable($DIR_SKINS.$SKINSUBDIR.$thisdir.$file)) && (!_isImageFile($file))) {
\r
539 echo " <a href=\"$pluginsskinfiles/?action=editfile&rfp=$thisdir"."$file\" title=\"Edit file\">(edit)</a>";
\r
542 if (_isImageFile($file)) {
\r
543 echo ' <a href="'.$CONF['SkinsURL'].$SKINSUBDIR.$thisdir."$file\" title=\"View graphic\">(view)</a>";
\r
546 echo " <a href=\"$pluginsskinfiles/?action=download&rfp=$thisdir"."$file\" title=\"Download file\">(d/l)</a>";
\r
548 echo number_format(filesize($DIR_SKINS.$SKINSUBDIR.$thisdir.$file)/1024, 2)." KB";
\r
550 echo date('M d, Y h:i:s a', filemtime($DIR_SKINS.$SKINSUBDIR.$thisdir.$file));
\r
556 if(is_array($dirs) || is_array($files)) {
\r
557 if ($newdir != '') {
\r
558 echo "<u><a href=\"$pluginsskinfiles/\">> Return to / <</a></u><br />";
\r
559 if (strstr($newdir, '/')) {
\r
560 $splitpath = preg_split( "/\//", strrev($newdir), 2);
\r
561 $updir = strrev($splitpath[1]);
\r
562 echo "<u><a href=\"$pluginsskinfiles/?dir=/$updir\">> Return to /$updir <</a></u><br /><br />";
\r
565 echo "<u><a href=\"$pluginsskinfiles/?dir=$newdir\">> Refresh <</a></u><br />";
\r
568 if ($newdir != '') {
\r
569 echo "<h3>Create new file in <b>/$newdir</b></h3>";
\r
571 <form method="POST" enctype="multipart/form-data" action="<?php echo $pluginsskinfiles ?>/">
\r
572 <input type="hidden" name="action" value="createfile" />
\r
573 <input type="hidden" name="dir" value="<?php echo $newdir ?>">
\r
574 <input type="text" name="filename" size="40">
\r
575 <input type="submit" value="<?php echo 'Create file' ?>" />
\r
579 echo "<h3>Upload new file to <b>/$newdir</b></h3>";
\r
581 <form method="POST" enctype="multipart/form-data" action="<?php echo $pluginsskinfiles ?>/">
\r
582 <input type="hidden" name="action" value="uploadfile" />
\r
583 <input type="hidden" name="dir" value="<?php echo $newdir ?>">
\r
584 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $CONF['MaxUploadSize']?>" />
\r
585 <input type="file" name="filename" size="40">
\r
586 <input type="submit" value="<?php echo _UPLOAD_BUTTON?>" />
\r
590 if (count($files)) {
\r
591 echo "<h3>Delete all files in <b>/$newdir</b></h3>";
\r
593 <form method="get" action="<?php echo $pluginsskinfiles?>/">
\r
594 <input type="hidden" name="action" value="deleteAllInDir" />
\r
595 <input type="hidden" name="dir" value="<?php echo $newdir?>"/>
\r
596 <?php echo "Delete all Files? (will ask for confirmation)"?>
\r
597 <input type="submit" tabindex="140" value="<?php echo "Delete All"?>" onclick="return checkSubmit();" />
\r
603 echo "<h3>Create a new directory in <b>/$newdir</b></h3>";
\r
605 <form method="post" action="<?php echo $pluginsskinfiles?>/">
\r
606 <input type="hidden" name="action" value="createdir" />
\r
607 <input type="hidden" name="dir" value="<?php echo $newdir?>"/>
\r
608 <input name="newdir" tabindex="90" value="<?php echo 'newdir' ?>" size="40" />
\r
609 <input type="submit" tabindex="140" value="<?php echo "Create"?>" onclick="return checkSubmit();" />
\r
613 // for MDNucleus, ignored if on Win32 platform (for the moment)
\r
614 if (($newdir == '') && ($privateskins) && (!strtoupper(substr(PHP_OS, 0,3) == 'WIN'))) {
\r
615 if ($dh = @opendir($DIR_SKINS.$latestskins)) {
\r
616 while (($file = readdir($dh)) !== false) {
\r
617 if(!preg_match("/^\.{1,2}/", $file))
\r
618 if (is_dir($DIR_SKINS.$latestskins.$file)) $skins[] = $file;
\r
623 echo "<h3>Refresh default skin files to standard versions</h3>";
\r
625 <form method="post" action="<?php echo $pluginsskinfiles?>/">
\r
626 <input type="hidden" name="action" value="getLatestSkins" />
\r
629 if (count($skins) > 1) {
\r
630 $lastskin = array_pop($skins);
\r
631 array_push($skins, "</b>and<b> $lastskin");
\r
633 echo "This will overwrite or create files in the following skin file directories: <b>";
\r
634 echo implode(", ", $skins)."</b><br /><br />";
\r
636 Note that you may need to re-import skin definitions you wish to use (See Layout Import/Export).<br /><br />
\r
637 <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" />
\r
638 <label for="cb_overwrite"><?php echo "Check this box to confirm overwrite of files<br />" ?></label>
\r
639 <input type="submit" tabindex="140" value="<?php echo "Overwrite Default Skin Files"?>" onclick="return checkSubmit();" />
\r