OSDN Git Service

added NP_SkinFiles
authorkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sat, 19 Mar 2005 09:54:13 +0000 (09:54 +0000)
committerkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sat, 19 Mar 2005 09:54:13 +0000 (09:54 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@70 1ca29b6e-896d-4ea0-84a5-967f57386b96

16 files changed:
euc/nucleus/plugins/NP_SkinFiles.php [new file with mode: 0644]
euc/nucleus/plugins/skinfiles/css.gif [new file with mode: 0644]
euc/nucleus/plugins/skinfiles/dir.gif [new file with mode: 0644]
euc/nucleus/plugins/skinfiles/generic.png [new file with mode: 0644]
euc/nucleus/plugins/skinfiles/image.gif [new file with mode: 0644]
euc/nucleus/plugins/skinfiles/index.php [new file with mode: 0644]
euc/nucleus/plugins/skinfiles/php.gif [new file with mode: 0644]
euc/nucleus/plugins/skinfiles/text.gif [new file with mode: 0644]
utf8/nucleus/plugins/NP_SkinFiles.php [new file with mode: 0644]
utf8/nucleus/plugins/skinfiles/css.gif [new file with mode: 0644]
utf8/nucleus/plugins/skinfiles/dir.gif [new file with mode: 0644]
utf8/nucleus/plugins/skinfiles/generic.png [new file with mode: 0644]
utf8/nucleus/plugins/skinfiles/image.gif [new file with mode: 0644]
utf8/nucleus/plugins/skinfiles/index.php [new file with mode: 0644]
utf8/nucleus/plugins/skinfiles/php.gif [new file with mode: 0644]
utf8/nucleus/plugins/skinfiles/text.gif [new file with mode: 0644]

diff --git a/euc/nucleus/plugins/NP_SkinFiles.php b/euc/nucleus/plugins/NP_SkinFiles.php
new file mode 100644 (file)
index 0000000..d6136a9
--- /dev/null
@@ -0,0 +1,75 @@
+<?php\r
+\r
+/*                                       */\r
+/* NP_SkinFiles                          */\r
+/* ------------------------------------  */\r
+/* A simple skin files manager           */\r
+/*                                       */\r
+/* code by Jeff MacMichael               */\r
+/* http://wiki.gednet.com/               */\r
+/*                                       */\r
+\r
+/* Changes:\r
+ * v0.91 ged - added ICO, PHPx files, fixed/added some icons\r
+ *           - changed perms on file or folder creation or upload to 0755 from 0640\r
+ *           - changed 'cancel' links for delete actions to $parent dir from http_referer\r
+ *           - changed order of links next to files... moved 'del' over a bit.  ;)\r
+ * v0.92 ged - changed order of links next to dirs\r
+ *             $privateskins = FALSE by default\r
+ * v1.0  ged - fixed security catch so it actually quits the script\r
+ *             "columnated" the files & dirs display for easier viewing\r
+ *             Made the edit cancel link more intuitive\r
+ * v1.01 ged - fixed event_QuickMenu to properly skip for non-admins\r
+ *             lined up columns for directories & added <tr> highlights\r
+ */\r
+\r
+class NP_SkinFiles extends NucleusPlugin {\r
+\r
+       function getName()              { return 'SkinFiles'; }\r
+       function getAuthor()    { return 'Jeff MacMichael'; }\r
+       function getURL()               { return 'http://wiki.gednet.com/'; }\r
+       function getVersion()   { return '1.01'; }\r
+       function getDescription() { return 'A simple file manager for skins.';  }\r
+\r
+       function supportsFeature($what) {\r
+               switch($what)\r
+               { case 'SqlTablePrefix':\r
+                               return 1;\r
+                       default:\r
+                               return 0; }\r
+       }\r
+\r
+       function install() {\r
+       }\r
+       \r
+       function unInstall() {\r
+       }\r
+\r
+       function getEventList() {\r
+               return array('QuickMenu');\r
+       }\r
+       \r
+       function hasAdminArea() {\r
+               return 1;\r
+       }\r
+       \r
+       function event_QuickMenu(&$data) {\r
+               global $member, $nucleus, $blogid;\r
+               // only show to admins\r
+               if (preg_match("/MD$/", $nucleus['version'])) {\r
+                       $isblogadmin = $member->isBlogAdmin(-1);\r
+               } else {\r
+                       $isblogadmin = $member->isBlogAdmin($blogid);\r
+               }\r
+               if (!($member->isLoggedIn() && ($member->isAdmin() | $isblogadmin))) return;\r
+               array_push(\r
+                       $data['options'], \r
+                       array(\r
+                               'title' => 'Skin Files',\r
+                               'url' => $this->getAdminURL(),\r
+                               'tooltip' => 'Manage skin files'\r
+                       )\r
+               );\r
+       }\r
+}\r
+?>
\ No newline at end of file
diff --git a/euc/nucleus/plugins/skinfiles/css.gif b/euc/nucleus/plugins/skinfiles/css.gif
new file mode 100644 (file)
index 0000000..b48fe1c
Binary files /dev/null and b/euc/nucleus/plugins/skinfiles/css.gif differ
diff --git a/euc/nucleus/plugins/skinfiles/dir.gif b/euc/nucleus/plugins/skinfiles/dir.gif
new file mode 100644 (file)
index 0000000..7b37b09
Binary files /dev/null and b/euc/nucleus/plugins/skinfiles/dir.gif differ
diff --git a/euc/nucleus/plugins/skinfiles/generic.png b/euc/nucleus/plugins/skinfiles/generic.png
new file mode 100644 (file)
index 0000000..16374a1
Binary files /dev/null and b/euc/nucleus/plugins/skinfiles/generic.png differ
diff --git a/euc/nucleus/plugins/skinfiles/image.gif b/euc/nucleus/plugins/skinfiles/image.gif
new file mode 100644 (file)
index 0000000..a5c40f1
Binary files /dev/null and b/euc/nucleus/plugins/skinfiles/image.gif differ
diff --git a/euc/nucleus/plugins/skinfiles/index.php b/euc/nucleus/plugins/skinfiles/index.php
new file mode 100644 (file)
index 0000000..a23e3ee
--- /dev/null
@@ -0,0 +1,649 @@
+<?php\r
+\r
+/*                                       */\r
+/* Admin page for NP_SkinFiles           */\r
+/* ------------------------------------  */\r
+/* A simple skin files manager           */\r
+/*                                       */\r
+/* code by Jeff MacMichael               */\r
+/* http://gednet.com/                    */\r
+/*                                       */\r
+/* version 1.01                          */\r
\r
+       $strRel = '../../../'; \r
+       include($strRel . 'config.php');\r
+       \r
+       include($DIR_LIBS . 'PLUGINADMIN.php');\r
+\r
+       if (preg_match("/MD$/", $nucleus['version'])) {\r
+               $isblogadmin = $member->isBlogAdmin(-1);\r
+       } else {\r
+               $isblogadmin = $member->isBlogAdmin($blogid);\r
+       }\r
+       if (!($member->isAdmin() || $isblogadmin)) {\r
+               $oPluginAdmin = new PluginAdmin('SkinFiles');\r
+               $oPluginAdmin->start();\r
+               echo "<p>"._ERROR_DISALLOWED."</p>";\r
+               $oPluginAdmin->end();\r
+               exit;\r
+       }\r
+\r
+       // set to FALSE for normal operation, or TRUE if skins are stored\r
+       // under owner's member id i.e. /skins/1/grey/...   (MDNucleus)\r
+       $privateskins = FALSE;\r
+       if ($privateskins) { \r
+               global $member;\r
+               $SKINSUBDIR = $member->getID().'/'; \r
+               $latestskins = 'latest-skins/';\r
+       } else {\r
+               $SKINSUBDIR = '';\r
+       }\r
+       \r
+       global $pluginsskinfiles, $CONF;\r
+       $pluginsskinfiles=$CONF['PluginURL']."skinfiles";\r
+\r
+       if (isset($_GET['action'])) {$action = $_GET['action'];}\r
+       if (isset($_POST['action'])) {$action = $_POST['action'];}\r
+\r
+       if ($action == 'download') { \r
+               download();\r
+               return;\r
+               break;\r
+       }\r
+\r
+       // create the admin area page\r
+       $oPluginAdmin = new PluginAdmin('SkinFiles');\r
+       $oPluginAdmin->start();\r
+       \r
+       echo "<h2>Skin File Management</h2>";\r
+       \r
+       if (strstr('renfile delfile createdir rendir deldir deleteAllInDir'\r
+               .' editfile uploadfile createfile getLatestSkins', $action)) { \r
+               call_user_func($action);\r
+       } else {\r
+               showdir();\r
+       }\r
+\r
+       $oPluginAdmin->end();\r
+       return;\r
+       break;\r
+               \r
+       function createfile() {\r
+               global $oPluginAdmin, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               $parent = $_POST["dir"];\r
+               $filename = $_POST["filename"];\r
+               $fullpath = $DIR_SKINS.$SKINSUBDIR.$parent.'/'.$filename;\r
+               if (file_exists($fullpath)) {\r
+                       $msg = "Error: the file '$filename' already exists.";\r
+                       showdir($msg);\r
+               }\r
+               echo "<h3><b>Creating file \"/$parent/$filename\":</b></h3>";\r
+               $errrep = error_reporting(E_ERROR);\r
+               if (touch($fullpath)) { \r
+                       $msg = 'The file was created successfully.';\r
+               } else {\r
+                       $msg = 'ERROR: The file was <i>not</i> created successfully.';\r
+               }\r
+               $oldumask = umask(0000);\r
+               chmod($fullpath, 0755);\r
+               umask($oldumask);\r
+               error_reporting($errrep);\r
+               showdir($msg);\r
+       }\r
+\r
+       function createdir() {\r
+               global $oPluginAdmin, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               $parent = $_POST["dir"];\r
+               $newdir = $_POST["newdir"];\r
+               if (!$newdir) {\r
+                       echo 'You need to specify a directory name to create. <br /><br />';\r
+                       echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Go back</a><br />';              \r
+                       return;\r
+               }\r
+               $errrep = error_reporting(E_ERROR);\r
+               $oldumask = umask(0000);\r
+               if (mkdir ($DIR_SKINS.$SKINSUBDIR.$parent.'/'.$newdir, 0755)) {\r
+                       $msg = 'Directory created successfully.';\r
+               } else {\r
+                       $msg = 'There was an error creating the directory (check to see if the directory already exists).';\r
+               }\r
+               umask($oldumask);\r
+               error_reporting($errrep);\r
+               showdir($msg);\r
+       }\r
+       \r
+       function download() {\r
+               global $DIR_SKINS, $SKINSUBDIR;\r
+               $file = $_GET["rfp"];\r
+               $path = $DIR_SKINS.$SKINSUBDIR.$file;\r
+               $splitpath =  preg_split( "/\//", strrev($_GET["rfp"]), 2);\r
+               $file = strrev($splitpath[0]);\r
+               \r
+               // download code taken from Paul Alger's PHP_Easy_Download. \r
+\r
+               // translate file name properly for Internet Explorer.\r
+               if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")){\r
+                       $file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1);\r
+               }\r
+               // make sure the file exists before sending headers\r
+               if(!$fdl=@fopen($path,'r')){\r
+                       die("Cannot Open File!");\r
+               } else {\r
+                       header("Cache-Control: ");// leave blank to avoid IE errors\r
+                       header("Pragma: ");// leave blank to avoid IE errors\r
+                       header("Content-type: application/octet-stream");\r
+                       header('Content-Disposition: attachment; filename="'.$file.'"');\r
+                       header("Content-length: ".(string)(filesize($path)));\r
+                       sleep(1);\r
+                       \r
+                       fpassthru($fdl);\r
+               }\r
+               return;\r
+               break;\r
+       }\r
+       \r
+       function uploadfile() {\r
+               global $HTTP_POST_FILES, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles, $CONF;\r
+               $filename = $HTTP_POST_FILES['filename']['name'];\r
+               $filesize = $HTTP_POST_FILES['filename']['size'];\r
+               $filetempname = $HTTP_POST_FILES['filename']['tmp_name'];\r
+               $todir = $DIR_SKINS.$SKINSUBDIR.$_POST['dir'].'/';\r
+               \r
+               if ($filesize > $CONF['MaxUploadSize']) {\r
+                       showdir(_ERROR_FILE_TOO_BIG);\r
+                       return;\r
+               }\r
+\r
+               // check file type against allowed types\r
+               $ok = 0;\r
+               $allowedtypes = explode (',', "css,html,htm,xml,inc,txt,".$CONF['AllowedTypes']);\r
+               foreach ( $allowedtypes as $type ) \r
+                       if (eregi("\." .$type. "$",$filename)) $ok = 1;    \r
+               if (!$ok) {\r
+                       showdir(_ERROR_BADFILETYPE);\r
+                       return;\r
+               }\r
+               if (!is_uploaded_file($filetempname)) {\r
+                       showdir(_ERROR_BADREQUEST);\r
+                       return;\r
+               }\r
+               if (file_exists($todir.$filename)) {\r
+                       showdir(_ERROR_UPLOADDUPLICATE);\r
+                       return;\r
+               }\r
+\r
+               // move file to directory\r
+               if (is_uploaded_file($filetempname)) {\r
+                       $errrep = error_reporting(E_ERROR);\r
+                       if (!@move_uploaded_file($filetempname, $todir . $filename)) {\r
+                               showdir(_ERROR_UPLOADMOVE);\r
+                               return;\r
+                       }\r
+                       error_reporting($errrep);\r
+               }\r
+               // chmod uploaded file\r
+               $oldumask = umask(0000);\r
+               @chmod($todir . $filename, 0755); \r
+               umask($oldumask);               \r
+\r
+               showdir("File uploaded successfully.");\r
+       }\r
+\r
+       function rendir() {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               if (isset($_POST['newname'])) {\r
+                       $splitpath =  preg_split( "/\//", strrev($_POST["oldname"]), 2);\r
+                       $newname = strrev($splitpath[1]) .'/'. $_POST["newname"];\r
+                       $newname = preg_replace("/^\//", "", $newname);\r
+                       $res = rename ( $DIR_SKINS.$SKINSUBDIR.$_POST["oldname"], \r
+                               $DIR_SKINS.$SKINSUBDIR.$newname);\r
+                       if ($res) { \r
+                               $msg = "Directory successfully renamed."; \r
+                       } else {\r
+                               $msg = "Failed to rename directory - (check to see if another directory already exists with the new name).";\r
+                       }\r
+                       showdir($msg);\r
+               } else { \r
+                       $oldname = preg_replace("/^\//", "", $_GET["oldname"]);\r
+                       echo '<h3><b>Rename directory "/'.$oldname.'":</b></h3>';\r
+                       $splitpath =  preg_split( "/\//", strrev($_GET["oldname"]), 2);\r
+                       $dir = strrev($splitpath[0]);\r
+                       $parent = strrev($splitpath[1]);\r
+                       echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Cancel rename</a><br />';                \r
+                       ?>\r
+                               <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
+                                       <input type="hidden" name="action" value="rendir" />\r
+                                       <input type="hidden" name="dir" value="<?php echo "/$parent" ?>"/>\r
+                                       <input type="hidden" name="oldname" value="<?php echo $oldname?>"/>\r
+                                       <table><tr>\r
+                                               <td><?php echo 'Rename to'?></td>\r
+                                               <td><input name="newname" tabindex="90" value="<?php echo  htmlspecialchars($dir) ?>" maxlength="50" size="20" /></td>\r
+                                       </tr><tr>\r
+                                               <td><?php echo "Rename"?></td>\r
+                                               <td><input type="submit" tabindex="140" value="<?php echo "Rename this folder"?>" onclick="return checkSubmit();" /></td>\r
+                                       </tr></table>\r
+                               </form>\r
+                       <?PHP\r
+               }\r
+       }\r
+\r
+       function editfile () {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               if (isset ($_POST['rfp']) && isset($_POST['content'])) {\r
+                       $file = $_POST['rfp'];\r
+                       $errrep = error_reporting(E_ERROR);\r
+                       $success = true;\r
+                       if ($fh = @fopen($DIR_SKINS.$SKINSUBDIR.$file, 'w')) { \r
+                               if (fwrite ($fh, trim(stripslashes($_POST['content'])))) {\r
+                                       fclose($fh);\r
+                               } else {\r
+                                       $success = false;\r
+                               }\r
+                       } else {\r
+                               $success = false;\r
+                       }\r
+                       error_reporting($errrep);\r
+                       if ($success) {\r
+                               $msg = 'File was edited successfully.';\r
+                       } else {\r
+                               $msg = 'ERROR: File was <i>not</i> saved successfully.';\r
+                       }\r
+               }\r
+               if (isset ($_GET['rfp'])) { $file = $_GET['rfp']; }\r
+               if (isset ($_POST['rfp'])) { $file = $_POST['rfp']; }\r
+               $splitpath =  preg_split( "/\//", strrev($file), 2);\r
+               $parent = strrev($splitpath[1]);\r
+               echo '<h3>Editing file "/'.$file.'":</h3>';\r
+               if (isset($msg)) { echo "<p><b>$msg</b></p>"; }\r
+               echo "> <a href=\"$pluginsskinfiles/?dir=$parent\"> Cancel/Return to /$parent</a><br /><br />";\r
+               $fh = @fopen($DIR_SKINS.$SKINSUBDIR.$file, 'r');\r
+               while (!feof($fh)) { \r
+                       $content .= fread($fh, 4096); \r
+               }\r
+               fclose ($fh);                   \r
+               ?>\r
+                       <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
+                               <input type="hidden" name="action" value="editfile" />\r
+                               <input type="hidden" name="rfp" value="<?php echo $file ?>"/>\r
+                               <input type="hidden" name="dir" value="<?php echo $parent ?>"/>\r
+                               <input type="submit" tabindex="140" value="<?php echo "Save changes"?>" onclick="return checkSubmit();" />\r
+                               <input type="reset" value="Reset Data" /><br />\r
+                               <textarea class="skinedit" tabindex="8" rows="20" cols="80" name="content"><?PHP echo htmlspecialchars($content) ?></textarea>\r
+                               <input type="submit" tabindex="140" value="<?php echo "Save changes"?>" onclick="return checkSubmit();" />\r
+                               <input type="reset" value="Reset Data" /><br />\r
+                       </form>\r
+               <?PHP\r
+       }\r
+\r
+\r
+       function renfile() {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               if (isset($_POST['newname'])) {\r
+                       $splitpath =  preg_split( "/\//", strrev($_POST["oldname"]), 2);\r
+                       $newname = strrev($splitpath[1]) .'/'. $_POST["newname"];\r
+                       $newname = preg_replace("/^\//", "", $newname);\r
+                       $res = rename ( $DIR_SKINS.$SKINSUBDIR.$_POST["oldname"], \r
+                               $DIR_SKINS.$SKINSUBDIR.$newname);\r
+                       if ($res) { \r
+                               $msg = "File successfully renamed."; \r
+                       } else {\r
+                               $msg = "File could not be renamed - (check to see if another file already exists with the new name).";\r
+                       }\r
+                       showdir($msg);\r
+               } else { \r
+                       echo '<h3><b>Rename file "/'.$_GET["rfp"].'":</b></h3>';\r
+                       $splitpath =  preg_split( "/\//", strrev($_GET["rfp"]), 2);\r
+                       $file = strrev($splitpath[0]);\r
+                       $parent = strrev($splitpath[1]);\r
+                       echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Cancel rename</a><br />';                \r
+                       ?>\r
+                               <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
+                                       <input type="hidden" name="action" value="renfile" />\r
+                                       <input type="hidden" name="oldname" value="<?php echo $_GET["rfp"] ?>"/>\r
+                                       <input type="hidden" name="dir" value="<?php echo "/$parent" ?>"/>\r
+                                       <table><tr>\r
+                                               <td><?php echo 'Rename to'?></td>\r
+                                               <td><input name="newname" tabindex="90" value="<?php echo  htmlspecialchars($file) ?>" maxlength="50" size="20" /></td>\r
+                                       </tr><tr>\r
+                                               <td><?php echo "Rename"?></td>\r
+                                               <td><input type="submit" tabindex="140" value="<?php echo "Rename this file"?>" onclick="return checkSubmit();" /></td>\r
+                                       </tr></table>\r
+                               </form>\r
+                       <?PHP\r
+               }\r
+       }\r
+\r
+       function delfile() {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               if (isset($_GET['sure'])) { \r
+                       $file = $DIR_SKINS.$SKINSUBDIR.$_GET["rfp"];\r
+                       $errrep = error_reporting(E_ERROR);\r
+                       if (unlink ($file)) {\r
+                               $msg = 'File "'.$_GET["rfp"].'" has been deleted.';\r
+                       } else {\r
+                               $msg = 'ERROR: File "'.$_GET["rfp"].'" could not be deleted.';\r
+                       }\r
+                       error_reporting($errrep);\r
+                       showdir($msg);\r
+               } else {\r
+                       $file = $DIR_SKINS.$SKINSUBDIR.$_GET["rfp"];\r
+                       $splitpath =  preg_split( "/\//", strrev($_GET["rfp"]), 2);\r
+                       $parent = strrev($splitpath[1]);\r
+                       echo '<h3><b>Delete file "'.$_GET["rfp"].'": are you sure?</b></h3>';\r
+                       echo '<b>This action cannot be undone!</b><br /><br />';\r
+                       echo "> <a href=\"$pluginsskinfiles/?action=delfile&dir=$parent&sure=y&rfp=".$_GET["rfp"]."\">Yes, delete the file.</a><br />";         \r
+                       echo "> <a href=\"$pluginsskinfiles/?dir=".$parent.'">No, go back.</a><br />';          \r
+               }\r
+       }\r
+\r
+       function deldir() {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               if (isset($_GET['sure'])) { \r
+                       $dir = $DIR_SKINS.$SKINSUBDIR.$_GET["remdir"];\r
+                       $errrep = error_reporting(E_ERROR);\r
+                       if (rmdir ($dir)) {\r
+                               $msg = 'Directory "'.$_GET["remdir"].'" has been deleted.';\r
+                       } else {\r
+                               $msg = 'ERROR: directory "'.$_GET["remdir"].'" could not be deleted - (check to see if it contains files).';\r
+                       }\r
+                       error_reporting($errrep);\r
+                       showdir($msg);\r
+               } else {\r
+                       $dir = preg_replace("/^\//", "",$_GET['remdir']);\r
+                       $parent = $_GET['dir'];\r
+                       echo '<h3><b>Delete directory "/'.$dir.'": are you sure?</b></h3>';\r
+                       echo '<b>This action cannot be undone!</b><br /><br />';\r
+                       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
+                       echo "> <a href=\"$pluginsskinfiles/?dir=".$parent.'">No, go back.</a><br />';          \r
+               }\r
+       }\r
+\r
+       function deleteAllInDir() {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               $parent = $DIR_SKINS.$SKINSUBDIR.preg_replace("/^\//", "",$_GET['dir']);\r
+               if ($dh = @opendir($parent)) { \r
+                       while (($file = readdir($dh)) !== false) { \r
+                               if(!preg_match("/^\.{1,2}/", $file)){\r
+                                       if (!is_dir($parent.$file)) {\r
+                                               $files[] = $file;\r
+                                       }\r
+                               }\r
+                       }\r
+                       closedir($dh); \r
+               } \r
+               if (isset($_GET['sure'])) { \r
+                       $errrep = error_reporting(E_ERROR);\r
+                       echo '<h3>Deletion results</h3><table>';\r
+                       echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET["dir"]."\">Return to the /".$_GET["dir"]." directory.</a><br />";              \r
+                       foreach ($files as $file) {\r
+                               if (unlink ("$parent/$file")) { \r
+                                       echo "<tr><td>File: $file was deleted.</td></tr>"; \r
+                               } else {\r
+                                       echo "<tr><td>File: $file was <b>NOT</b> deleted.</td></tr>";\r
+                               }\r
+                       }\r
+                       echo "</table>";\r
+                       error_reporting($errrep);\r
+                       echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET["dir"]."\">Return to the /".$_GET["dir"]." directory.</a><br />";              \r
+               } else {\r
+                       echo '<h3><b>Delete all files in directory "/'.$_GET['dir'].'": are you sure?</b></h3>';\r
+                       echo '<b>This action cannot be undone!</b><br /><br />';\r
+                       echo "> <a href=\"$pluginsskinfiles/?action=deleteAllInDir&sure=y&dir=".$_GET["dir"]."\">Yes, delete <u>all files</u> in this directory.</a><br />";            \r
+                       echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET['dir'].'">No, go back.</a><br /><br />';               \r
+                       echo '<b>Files list:</b><table>';\r
+                       foreach ($files as $file) {     echo "<tr><td>$file</td></tr>"; }\r
+                       echo '</table>';\r
+               }\r
+       }\r
+\r
+       // function for MDNucleus; won't work unless $privateskins is set to true\r
+       function getLatestSkins() {\r
+               global $DIR_SKINS, $pluginsskinfiles, $privateskins, $latestskins, $member;\r
+               $confirmed = $_POST['overwrite'];\r
+               if (!$confirmed) {\r
+                       showdir("Overwrite of default skin files not confirmed - no action taken.");\r
+                       return;\r
+               }\r
+               if ($dh = @opendir($DIR_SKINS.$latestskins)) { \r
+                       while (($file = readdir($dh)) !== false) { \r
+                               if(!preg_match("/^\.{1,2}/", $file))\r
+                                       if (is_dir($DIR_SKINS.$latestskins.$file)) $skins[] = $file;\r
+                       }\r
+                       closedir($dh); \r
+               } \r
+               if ($skins) {\r
+                       $msg = "Refreshed skin folders:";\r
+                       sort ($skins);\r
+                       foreach ($skins as $skin) {\r
+                               $memberskin = $DIR_SKINS.$member->getID().'/'.$skin;\r
+                               if (is_file($memberskin)) unlink($memberskin);\r
+                               if (!is_dir($memberskin)) {\r
+                                       $old_umask = umask(0);\r
+                                       mkdir($memberskin, 0755);\r
+                                       umask($old_umask);\r
+                               }\r
+                               exec("rsync -Wtr --delete ".$DIR_SKINS.$latestskins.$skin."/* ".$memberskin.'/');\r
+                               $msg .= "  $skin";\r
+                       }\r
+               } else {\r
+                       showdir("No default skin folders found.  No action taken.");\r
+                       return;\r
+               }\r
+               showdir($msg);\r
+       }\r
+\r
+       function _isImageFile($file) {\r
+               return preg_match ("/\.(gif|png|jpg|jpeg|bmp|ico)$/i", $file);\r
+       }\r
+\r
+       function _isEditableFile($file) {\r
+               return preg_match ("/\.(inc|txt|htm|html|xml)$/i", $file);\r
+       }\r
+\r
+       function showdir($msg = '') {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles, $CONF;\r
+               global $privateskins, $latestskins;\r
+               if (isset($_GET['dir'])) { \r
+                       $newdir = preg_replace("/^\//", "",$_GET['dir']);\r
+                       $currdir = $DIR_SKINS.$SKINSUBDIR."$newdir/";\r
+                       $in_subdir = 1;\r
+               } elseif (isset($_POST['dir'])) { \r
+                       $newdir = preg_replace("/^\//", "",$_POST['dir']);\r
+                       $currdir = $DIR_SKINS.$SKINSUBDIR."$newdir/";\r
+                       $in_subdir = 1;\r
+               } else {\r
+                       $newdir = '';\r
+                       $currdir = $DIR_SKINS.$SKINSUBDIR;\r
+                       $in_subdir = 0;\r
+               }\r
+       \r
+               if ($privateskins && (!is_dir($DIR_SKINS.$SKINSUBDIR))) {\r
+                       $oldumask = umask(0);\r
+                       mkdir($DIR_SKINS.$SKINSUBDIR, 0755);\r
+                       umask($oldmask);\r
+               }\r
+\r
+               if (!is_dir($currdir)) {\r
+                       echo 'The specified location is not a directory or doesn\'t exist.';\r
+                       return;\r
+               }\r
+               \r
+               if ($dh = @opendir($currdir)) { \r
+                       while (($file = readdir($dh)) !== false) { \r
+                               if(!preg_match("/^\.{1,2}/", $file)){\r
+                                       if (is_dir($currdir.$file)) {\r
+                                               $dirs[] = $file;\r
+                                       } else {\r
+                                               $files[] = $file;\r
+                                       }\r
+                               }\r
+                       }\r
+                       closedir($dh); \r
+               } \r
+               \r
+               echo "<h3>Current Directory: <b>/$newdir</b></h3>";\r
+               \r
+               if ($msg) {\r
+                       echo '<p><b>'.htmlspecialchars($msg).'</b></p>';\r
+               }\r
+               \r
+               if ($newdir != '') {\r
+                       echo "<u><a href=\"$pluginsskinfiles/\">> Return to / <</a></u><br />";\r
+                       if (strstr($newdir, '/')) {\r
+                               $splitpath =  preg_split( "/\//", strrev($newdir), 2);\r
+                               $updir = strrev($splitpath[1]);\r
+                               echo "<u><a href=\"$pluginsskinfiles/?dir=/$updir\">> Return to /$updir <</a></u><br /><br />";\r
+                       }\r
+               }\r
+               echo "<u><a href=\"$pluginsskinfiles/?dir=$newdir\">> Refresh <</a></u><br />";\r
+\r
+               echo "<table>";\r
+               if(is_array($dirs)){\r
+                       sort($dirs);\r
+                       foreach($dirs as $dir) {\r
+                               echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'><td>";\r
+                               echo "&nbsp;&nbsp;<a href=\"$pluginsskinfiles/?dir=$newdir/$dir\">";\r
+                               echo "<img src=\"$pluginsskinfiles/dir.gif\"> $dir</a>&nbsp;</td>";\r
+                               echo "<td>&nbsp;<a href=\"$pluginsskinfiles/?action=rendir&oldname=$newdir/$dir\" title=\"Rename directory\">(ren)</a></td>";\r
+                               echo "<td>&nbsp;<a href=\"$pluginsskinfiles/?action=deldir&dir=$newdir&remdir=$newdir/$dir\" title=\"Delete directory\">(del)</a></td>";\r
+                               echo "</td><td></td><td></td><td></td><td>";\r
+                               echo "<td>".date('M d, Y  h:i:s a', filemtime($DIR_SKINS.$SKINSUBDIR.$newdir."/$dir"));\r
+                               echo "</td></tr>";\r
+                       }\r
+               }\r
+       \r
+               if(is_array($files)){\r
+                       sort($files);\r
+                       foreach($files as $file) {\r
+                               echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'><td>";\r
+                               echo "&nbsp;&nbsp;";\r
+                               if (preg_match("/\.css$/i", $file)) {\r
+                                       echo "<img src=\"$pluginsskinfiles/css.gif\"> ";\r
+                               } elseif (preg_match("/\.php(3|4)?$/i", $file)) {\r
+                                       echo "<img src=\"$pluginsskinfiles/php.gif\"> ";\r
+                               } elseif (_isEditableFile($file)) {\r
+                                       echo "<img src=\"$pluginsskinfiles/text.gif\"> ";\r
+                               } elseif (_isImageFile($file)) {\r
+                                       echo "<img src=\"$pluginsskinfiles/image.gif\"> ";\r
+                               } else {\r
+                                       echo "<img src=\"$pluginsskinfiles/generic.png\"> ";\r
+                               }\r
+                               if ($newdir == '') {$thisdir = '';} else {$thisdir = "$newdir/";}\r
+                               echo "$file&nbsp;";\r
+                               echo "</td><td>";\r
+                               echo "&nbsp;<a href=\"$pluginsskinfiles/?action=renfile&rfp=$thisdir"."$file\" title=\"Rename file\">(ren)</a>";\r
+                               echo "</td><td>";\r
+                               echo "&nbsp;<a href=\"$pluginsskinfiles/?action=delfile&rfp=$thisdir"."$file\" title=\"Delete file\">(del)</a>";\r
+                               echo "</td><td>";\r
+                               if ((is_writable($DIR_SKINS.$SKINSUBDIR.$thisdir.$file)) && (!_isImageFile($file))) {\r
+                                       echo "&nbsp;<a href=\"$pluginsskinfiles/?action=editfile&rfp=$thisdir"."$file\" title=\"Edit file\">(edit)</a>";\r
+                               }\r
+                               echo "</td><td>";\r
+                               if (_isImageFile($file)) {\r
+                                       echo '&nbsp;<a href="'.$CONF['SkinsURL'].$SKINSUBDIR.$thisdir."$file\" title=\"View graphic\">(view)</a>";\r
+                               }\r
+                               echo "</td><td>";\r
+                               echo "&nbsp;<a href=\"$pluginsskinfiles/?action=download&rfp=$thisdir"."$file\" title=\"Download file\">(d/l)</a>";\r
+                               echo "</td><td>";\r
+                               echo number_format(filesize($DIR_SKINS.$SKINSUBDIR.$thisdir.$file)/1024, 2)." KB";\r
+                               echo "</td><td>";\r
+                               echo date('M d, Y  h:i:s a', filemtime($DIR_SKINS.$SKINSUBDIR.$thisdir.$file));\r
+                               echo "</td></tr>";\r
+                       }\r
+               }\r
+               echo "</table>";\r
+       \r
+               if(is_array($dirs) || is_array($files)) {\r
+                       if ($newdir != '') {\r
+                               echo "<u><a href=\"$pluginsskinfiles/\">> Return to / <</a></u><br />";\r
+                               if (strstr($newdir, '/')) {\r
+                                       $splitpath =  preg_split( "/\//", strrev($newdir), 2);\r
+                                       $updir = strrev($splitpath[1]);\r
+                                       echo "<u><a href=\"$pluginsskinfiles/?dir=/$updir\">> Return to /$updir <</a></u><br /><br />";\r
+                               }\r
+                       }\r
+                       echo "<u><a href=\"$pluginsskinfiles/?dir=$newdir\">> Refresh <</a></u><br />";\r
+               }\r
+\r
+               if ($newdir != '') {\r
+                       echo "<h3>Create new file in <b>/$newdir</b></h3>";\r
+                               ?>\r
+                               <form method="POST" enctype="multipart/form-data" action="<?php echo $pluginsskinfiles ?>/">\r
+                                               <input type="hidden" name="action" value="createfile" />\r
+                                               <input type="hidden" name="dir" value="<?php echo $newdir ?>">\r
+                                               <input type="text" name="filename" size="40">\r
+                                               <input type="submit" value="<?php echo 'Create file' ?>" />\r
+                                       </form>\r
+                               <?PHP\r
+\r
+                               echo "<h3>Upload new file to <b>/$newdir</b></h3>";\r
+                               ?>\r
+                               <form method="POST" enctype="multipart/form-data" action="<?php echo $pluginsskinfiles ?>/">\r
+                                               <input type="hidden" name="action" value="uploadfile" />\r
+                                               <input type="hidden" name="dir" value="<?php echo $newdir ?>">\r
+                                               <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $CONF['MaxUploadSize']?>" />\r
+                                               <input type="file" name="filename" size="40">\r
+                                               <input type="submit" value="<?php echo _UPLOAD_BUTTON?>" />\r
+                                       </form>\r
+                               <?PHP\r
+       \r
+                       if (count($files)) {\r
+                               echo "<h3>Delete all files in <b>/$newdir</b></h3>";\r
+                                       ?>\r
+                                               <form method="get" action="<?php echo $pluginsskinfiles?>/">\r
+                                                       <input type="hidden" name="action" value="deleteAllInDir" />\r
+                                                       <input type="hidden" name="dir" value="<?php echo $newdir?>"/>\r
+                                                       <?php echo "Delete all Files? (will ask for confirmation)"?>\r
+                                                       <input type="submit" tabindex="140" value="<?php echo "Delete All"?>" onclick="return checkSubmit();" />\r
+                                               </form>\r
+                                       <?PHP\r
+                       }\r
+               }\r
+       \r
+               echo "<h3>Create a new directory in <b>/$newdir</b></h3>"; \r
+                               ?>\r
+                                       <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
+                                               <input type="hidden" name="action" value="createdir" />\r
+                                               <input type="hidden" name="dir" value="<?php echo $newdir?>"/>\r
+                                               <input name="newdir" tabindex="90" value="<?php echo 'newdir' ?>" size="40" />\r
+                                               <input type="submit" tabindex="140" value="<?php echo "Create"?>" onclick="return checkSubmit();" />\r
+                                       </form>\r
+                               <?PHP\r
+\r
+               // for MDNucleus, ignored if on Win32 platform (for the moment)\r
+               if (($newdir == '') && ($privateskins) && (!strtoupper(substr(PHP_OS, 0,3) == 'WIN'))) {\r
+                       if ($dh = @opendir($DIR_SKINS.$latestskins)) { \r
+                               while (($file = readdir($dh)) !== false) { \r
+                                       if(!preg_match("/^\.{1,2}/", $file))\r
+                                               if (is_dir($DIR_SKINS.$latestskins.$file)) $skins[] = $file;\r
+                               }\r
+                               closedir($dh); \r
+                       }\r
+                       if ($skins) {\r
+                               echo "<h3>Refresh default skin files to standard versions</h3>";\r
+                               ?>\r
+                                       <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
+                                               <input type="hidden" name="action" value="getLatestSkins" />\r
+                                               <?php\r
+                                               sort ($skins);\r
+                                               if (count($skins) > 1) {\r
+                                                       $lastskin = array_pop($skins);\r
+                                                       array_push($skins, "</b>and<b> $lastskin");\r
+                                               }\r
+                                               echo "This will overwrite or create files in the following skin file directories: <b>";\r
+                                               echo implode(", ", $skins)."</b><br /><br />"; \r
+                                               ?> \r
+                                               Note that you may need to re-import skin definitions you wish to use (See Layout Import/Export).<br /><br />\r
+                                               <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" />\r
+                                               <label for="cb_overwrite"><?php echo "Check this box to confirm overwrite of files<br />" ?></label>\r
+                                               <input type="submit" tabindex="140" value="<?php echo "Overwrite Default Skin Files"?>" onclick="return checkSubmit();" />\r
+                                       </form>\r
+                               <?PHP\r
+                       }\r
+               }\r
+\r
+       }\r
+\r
+       \r
+       \r
+?>
\ No newline at end of file
diff --git a/euc/nucleus/plugins/skinfiles/php.gif b/euc/nucleus/plugins/skinfiles/php.gif
new file mode 100644 (file)
index 0000000..7735fde
Binary files /dev/null and b/euc/nucleus/plugins/skinfiles/php.gif differ
diff --git a/euc/nucleus/plugins/skinfiles/text.gif b/euc/nucleus/plugins/skinfiles/text.gif
new file mode 100644 (file)
index 0000000..66ceefb
Binary files /dev/null and b/euc/nucleus/plugins/skinfiles/text.gif differ
diff --git a/utf8/nucleus/plugins/NP_SkinFiles.php b/utf8/nucleus/plugins/NP_SkinFiles.php
new file mode 100644 (file)
index 0000000..d6136a9
--- /dev/null
@@ -0,0 +1,75 @@
+<?php\r
+\r
+/*                                       */\r
+/* NP_SkinFiles                          */\r
+/* ------------------------------------  */\r
+/* A simple skin files manager           */\r
+/*                                       */\r
+/* code by Jeff MacMichael               */\r
+/* http://wiki.gednet.com/               */\r
+/*                                       */\r
+\r
+/* Changes:\r
+ * v0.91 ged - added ICO, PHPx files, fixed/added some icons\r
+ *           - changed perms on file or folder creation or upload to 0755 from 0640\r
+ *           - changed 'cancel' links for delete actions to $parent dir from http_referer\r
+ *           - changed order of links next to files... moved 'del' over a bit.  ;)\r
+ * v0.92 ged - changed order of links next to dirs\r
+ *             $privateskins = FALSE by default\r
+ * v1.0  ged - fixed security catch so it actually quits the script\r
+ *             "columnated" the files & dirs display for easier viewing\r
+ *             Made the edit cancel link more intuitive\r
+ * v1.01 ged - fixed event_QuickMenu to properly skip for non-admins\r
+ *             lined up columns for directories & added <tr> highlights\r
+ */\r
+\r
+class NP_SkinFiles extends NucleusPlugin {\r
+\r
+       function getName()              { return 'SkinFiles'; }\r
+       function getAuthor()    { return 'Jeff MacMichael'; }\r
+       function getURL()               { return 'http://wiki.gednet.com/'; }\r
+       function getVersion()   { return '1.01'; }\r
+       function getDescription() { return 'A simple file manager for skins.';  }\r
+\r
+       function supportsFeature($what) {\r
+               switch($what)\r
+               { case 'SqlTablePrefix':\r
+                               return 1;\r
+                       default:\r
+                               return 0; }\r
+       }\r
+\r
+       function install() {\r
+       }\r
+       \r
+       function unInstall() {\r
+       }\r
+\r
+       function getEventList() {\r
+               return array('QuickMenu');\r
+       }\r
+       \r
+       function hasAdminArea() {\r
+               return 1;\r
+       }\r
+       \r
+       function event_QuickMenu(&$data) {\r
+               global $member, $nucleus, $blogid;\r
+               // only show to admins\r
+               if (preg_match("/MD$/", $nucleus['version'])) {\r
+                       $isblogadmin = $member->isBlogAdmin(-1);\r
+               } else {\r
+                       $isblogadmin = $member->isBlogAdmin($blogid);\r
+               }\r
+               if (!($member->isLoggedIn() && ($member->isAdmin() | $isblogadmin))) return;\r
+               array_push(\r
+                       $data['options'], \r
+                       array(\r
+                               'title' => 'Skin Files',\r
+                               'url' => $this->getAdminURL(),\r
+                               'tooltip' => 'Manage skin files'\r
+                       )\r
+               );\r
+       }\r
+}\r
+?>
\ No newline at end of file
diff --git a/utf8/nucleus/plugins/skinfiles/css.gif b/utf8/nucleus/plugins/skinfiles/css.gif
new file mode 100644 (file)
index 0000000..b48fe1c
Binary files /dev/null and b/utf8/nucleus/plugins/skinfiles/css.gif differ
diff --git a/utf8/nucleus/plugins/skinfiles/dir.gif b/utf8/nucleus/plugins/skinfiles/dir.gif
new file mode 100644 (file)
index 0000000..7b37b09
Binary files /dev/null and b/utf8/nucleus/plugins/skinfiles/dir.gif differ
diff --git a/utf8/nucleus/plugins/skinfiles/generic.png b/utf8/nucleus/plugins/skinfiles/generic.png
new file mode 100644 (file)
index 0000000..16374a1
Binary files /dev/null and b/utf8/nucleus/plugins/skinfiles/generic.png differ
diff --git a/utf8/nucleus/plugins/skinfiles/image.gif b/utf8/nucleus/plugins/skinfiles/image.gif
new file mode 100644 (file)
index 0000000..a5c40f1
Binary files /dev/null and b/utf8/nucleus/plugins/skinfiles/image.gif differ
diff --git a/utf8/nucleus/plugins/skinfiles/index.php b/utf8/nucleus/plugins/skinfiles/index.php
new file mode 100644 (file)
index 0000000..a23e3ee
--- /dev/null
@@ -0,0 +1,649 @@
+<?php\r
+\r
+/*                                       */\r
+/* Admin page for NP_SkinFiles           */\r
+/* ------------------------------------  */\r
+/* A simple skin files manager           */\r
+/*                                       */\r
+/* code by Jeff MacMichael               */\r
+/* http://gednet.com/                    */\r
+/*                                       */\r
+/* version 1.01                          */\r
\r
+       $strRel = '../../../'; \r
+       include($strRel . 'config.php');\r
+       \r
+       include($DIR_LIBS . 'PLUGINADMIN.php');\r
+\r
+       if (preg_match("/MD$/", $nucleus['version'])) {\r
+               $isblogadmin = $member->isBlogAdmin(-1);\r
+       } else {\r
+               $isblogadmin = $member->isBlogAdmin($blogid);\r
+       }\r
+       if (!($member->isAdmin() || $isblogadmin)) {\r
+               $oPluginAdmin = new PluginAdmin('SkinFiles');\r
+               $oPluginAdmin->start();\r
+               echo "<p>"._ERROR_DISALLOWED."</p>";\r
+               $oPluginAdmin->end();\r
+               exit;\r
+       }\r
+\r
+       // set to FALSE for normal operation, or TRUE if skins are stored\r
+       // under owner's member id i.e. /skins/1/grey/...   (MDNucleus)\r
+       $privateskins = FALSE;\r
+       if ($privateskins) { \r
+               global $member;\r
+               $SKINSUBDIR = $member->getID().'/'; \r
+               $latestskins = 'latest-skins/';\r
+       } else {\r
+               $SKINSUBDIR = '';\r
+       }\r
+       \r
+       global $pluginsskinfiles, $CONF;\r
+       $pluginsskinfiles=$CONF['PluginURL']."skinfiles";\r
+\r
+       if (isset($_GET['action'])) {$action = $_GET['action'];}\r
+       if (isset($_POST['action'])) {$action = $_POST['action'];}\r
+\r
+       if ($action == 'download') { \r
+               download();\r
+               return;\r
+               break;\r
+       }\r
+\r
+       // create the admin area page\r
+       $oPluginAdmin = new PluginAdmin('SkinFiles');\r
+       $oPluginAdmin->start();\r
+       \r
+       echo "<h2>Skin File Management</h2>";\r
+       \r
+       if (strstr('renfile delfile createdir rendir deldir deleteAllInDir'\r
+               .' editfile uploadfile createfile getLatestSkins', $action)) { \r
+               call_user_func($action);\r
+       } else {\r
+               showdir();\r
+       }\r
+\r
+       $oPluginAdmin->end();\r
+       return;\r
+       break;\r
+               \r
+       function createfile() {\r
+               global $oPluginAdmin, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               $parent = $_POST["dir"];\r
+               $filename = $_POST["filename"];\r
+               $fullpath = $DIR_SKINS.$SKINSUBDIR.$parent.'/'.$filename;\r
+               if (file_exists($fullpath)) {\r
+                       $msg = "Error: the file '$filename' already exists.";\r
+                       showdir($msg);\r
+               }\r
+               echo "<h3><b>Creating file \"/$parent/$filename\":</b></h3>";\r
+               $errrep = error_reporting(E_ERROR);\r
+               if (touch($fullpath)) { \r
+                       $msg = 'The file was created successfully.';\r
+               } else {\r
+                       $msg = 'ERROR: The file was <i>not</i> created successfully.';\r
+               }\r
+               $oldumask = umask(0000);\r
+               chmod($fullpath, 0755);\r
+               umask($oldumask);\r
+               error_reporting($errrep);\r
+               showdir($msg);\r
+       }\r
+\r
+       function createdir() {\r
+               global $oPluginAdmin, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               $parent = $_POST["dir"];\r
+               $newdir = $_POST["newdir"];\r
+               if (!$newdir) {\r
+                       echo 'You need to specify a directory name to create. <br /><br />';\r
+                       echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Go back</a><br />';              \r
+                       return;\r
+               }\r
+               $errrep = error_reporting(E_ERROR);\r
+               $oldumask = umask(0000);\r
+               if (mkdir ($DIR_SKINS.$SKINSUBDIR.$parent.'/'.$newdir, 0755)) {\r
+                       $msg = 'Directory created successfully.';\r
+               } else {\r
+                       $msg = 'There was an error creating the directory (check to see if the directory already exists).';\r
+               }\r
+               umask($oldumask);\r
+               error_reporting($errrep);\r
+               showdir($msg);\r
+       }\r
+       \r
+       function download() {\r
+               global $DIR_SKINS, $SKINSUBDIR;\r
+               $file = $_GET["rfp"];\r
+               $path = $DIR_SKINS.$SKINSUBDIR.$file;\r
+               $splitpath =  preg_split( "/\//", strrev($_GET["rfp"]), 2);\r
+               $file = strrev($splitpath[0]);\r
+               \r
+               // download code taken from Paul Alger's PHP_Easy_Download. \r
+\r
+               // translate file name properly for Internet Explorer.\r
+               if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")){\r
+                       $file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1);\r
+               }\r
+               // make sure the file exists before sending headers\r
+               if(!$fdl=@fopen($path,'r')){\r
+                       die("Cannot Open File!");\r
+               } else {\r
+                       header("Cache-Control: ");// leave blank to avoid IE errors\r
+                       header("Pragma: ");// leave blank to avoid IE errors\r
+                       header("Content-type: application/octet-stream");\r
+                       header('Content-Disposition: attachment; filename="'.$file.'"');\r
+                       header("Content-length: ".(string)(filesize($path)));\r
+                       sleep(1);\r
+                       \r
+                       fpassthru($fdl);\r
+               }\r
+               return;\r
+               break;\r
+       }\r
+       \r
+       function uploadfile() {\r
+               global $HTTP_POST_FILES, $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles, $CONF;\r
+               $filename = $HTTP_POST_FILES['filename']['name'];\r
+               $filesize = $HTTP_POST_FILES['filename']['size'];\r
+               $filetempname = $HTTP_POST_FILES['filename']['tmp_name'];\r
+               $todir = $DIR_SKINS.$SKINSUBDIR.$_POST['dir'].'/';\r
+               \r
+               if ($filesize > $CONF['MaxUploadSize']) {\r
+                       showdir(_ERROR_FILE_TOO_BIG);\r
+                       return;\r
+               }\r
+\r
+               // check file type against allowed types\r
+               $ok = 0;\r
+               $allowedtypes = explode (',', "css,html,htm,xml,inc,txt,".$CONF['AllowedTypes']);\r
+               foreach ( $allowedtypes as $type ) \r
+                       if (eregi("\." .$type. "$",$filename)) $ok = 1;    \r
+               if (!$ok) {\r
+                       showdir(_ERROR_BADFILETYPE);\r
+                       return;\r
+               }\r
+               if (!is_uploaded_file($filetempname)) {\r
+                       showdir(_ERROR_BADREQUEST);\r
+                       return;\r
+               }\r
+               if (file_exists($todir.$filename)) {\r
+                       showdir(_ERROR_UPLOADDUPLICATE);\r
+                       return;\r
+               }\r
+\r
+               // move file to directory\r
+               if (is_uploaded_file($filetempname)) {\r
+                       $errrep = error_reporting(E_ERROR);\r
+                       if (!@move_uploaded_file($filetempname, $todir . $filename)) {\r
+                               showdir(_ERROR_UPLOADMOVE);\r
+                               return;\r
+                       }\r
+                       error_reporting($errrep);\r
+               }\r
+               // chmod uploaded file\r
+               $oldumask = umask(0000);\r
+               @chmod($todir . $filename, 0755); \r
+               umask($oldumask);               \r
+\r
+               showdir("File uploaded successfully.");\r
+       }\r
+\r
+       function rendir() {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               if (isset($_POST['newname'])) {\r
+                       $splitpath =  preg_split( "/\//", strrev($_POST["oldname"]), 2);\r
+                       $newname = strrev($splitpath[1]) .'/'. $_POST["newname"];\r
+                       $newname = preg_replace("/^\//", "", $newname);\r
+                       $res = rename ( $DIR_SKINS.$SKINSUBDIR.$_POST["oldname"], \r
+                               $DIR_SKINS.$SKINSUBDIR.$newname);\r
+                       if ($res) { \r
+                               $msg = "Directory successfully renamed."; \r
+                       } else {\r
+                               $msg = "Failed to rename directory - (check to see if another directory already exists with the new name).";\r
+                       }\r
+                       showdir($msg);\r
+               } else { \r
+                       $oldname = preg_replace("/^\//", "", $_GET["oldname"]);\r
+                       echo '<h3><b>Rename directory "/'.$oldname.'":</b></h3>';\r
+                       $splitpath =  preg_split( "/\//", strrev($_GET["oldname"]), 2);\r
+                       $dir = strrev($splitpath[0]);\r
+                       $parent = strrev($splitpath[1]);\r
+                       echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Cancel rename</a><br />';                \r
+                       ?>\r
+                               <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
+                                       <input type="hidden" name="action" value="rendir" />\r
+                                       <input type="hidden" name="dir" value="<?php echo "/$parent" ?>"/>\r
+                                       <input type="hidden" name="oldname" value="<?php echo $oldname?>"/>\r
+                                       <table><tr>\r
+                                               <td><?php echo 'Rename to'?></td>\r
+                                               <td><input name="newname" tabindex="90" value="<?php echo  htmlspecialchars($dir) ?>" maxlength="50" size="20" /></td>\r
+                                       </tr><tr>\r
+                                               <td><?php echo "Rename"?></td>\r
+                                               <td><input type="submit" tabindex="140" value="<?php echo "Rename this folder"?>" onclick="return checkSubmit();" /></td>\r
+                                       </tr></table>\r
+                               </form>\r
+                       <?PHP\r
+               }\r
+       }\r
+\r
+       function editfile () {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               if (isset ($_POST['rfp']) && isset($_POST['content'])) {\r
+                       $file = $_POST['rfp'];\r
+                       $errrep = error_reporting(E_ERROR);\r
+                       $success = true;\r
+                       if ($fh = @fopen($DIR_SKINS.$SKINSUBDIR.$file, 'w')) { \r
+                               if (fwrite ($fh, trim(stripslashes($_POST['content'])))) {\r
+                                       fclose($fh);\r
+                               } else {\r
+                                       $success = false;\r
+                               }\r
+                       } else {\r
+                               $success = false;\r
+                       }\r
+                       error_reporting($errrep);\r
+                       if ($success) {\r
+                               $msg = 'File was edited successfully.';\r
+                       } else {\r
+                               $msg = 'ERROR: File was <i>not</i> saved successfully.';\r
+                       }\r
+               }\r
+               if (isset ($_GET['rfp'])) { $file = $_GET['rfp']; }\r
+               if (isset ($_POST['rfp'])) { $file = $_POST['rfp']; }\r
+               $splitpath =  preg_split( "/\//", strrev($file), 2);\r
+               $parent = strrev($splitpath[1]);\r
+               echo '<h3>Editing file "/'.$file.'":</h3>';\r
+               if (isset($msg)) { echo "<p><b>$msg</b></p>"; }\r
+               echo "> <a href=\"$pluginsskinfiles/?dir=$parent\"> Cancel/Return to /$parent</a><br /><br />";\r
+               $fh = @fopen($DIR_SKINS.$SKINSUBDIR.$file, 'r');\r
+               while (!feof($fh)) { \r
+                       $content .= fread($fh, 4096); \r
+               }\r
+               fclose ($fh);                   \r
+               ?>\r
+                       <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
+                               <input type="hidden" name="action" value="editfile" />\r
+                               <input type="hidden" name="rfp" value="<?php echo $file ?>"/>\r
+                               <input type="hidden" name="dir" value="<?php echo $parent ?>"/>\r
+                               <input type="submit" tabindex="140" value="<?php echo "Save changes"?>" onclick="return checkSubmit();" />\r
+                               <input type="reset" value="Reset Data" /><br />\r
+                               <textarea class="skinedit" tabindex="8" rows="20" cols="80" name="content"><?PHP echo htmlspecialchars($content) ?></textarea>\r
+                               <input type="submit" tabindex="140" value="<?php echo "Save changes"?>" onclick="return checkSubmit();" />\r
+                               <input type="reset" value="Reset Data" /><br />\r
+                       </form>\r
+               <?PHP\r
+       }\r
+\r
+\r
+       function renfile() {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               if (isset($_POST['newname'])) {\r
+                       $splitpath =  preg_split( "/\//", strrev($_POST["oldname"]), 2);\r
+                       $newname = strrev($splitpath[1]) .'/'. $_POST["newname"];\r
+                       $newname = preg_replace("/^\//", "", $newname);\r
+                       $res = rename ( $DIR_SKINS.$SKINSUBDIR.$_POST["oldname"], \r
+                               $DIR_SKINS.$SKINSUBDIR.$newname);\r
+                       if ($res) { \r
+                               $msg = "File successfully renamed."; \r
+                       } else {\r
+                               $msg = "File could not be renamed - (check to see if another file already exists with the new name).";\r
+                       }\r
+                       showdir($msg);\r
+               } else { \r
+                       echo '<h3><b>Rename file "/'.$_GET["rfp"].'":</b></h3>';\r
+                       $splitpath =  preg_split( "/\//", strrev($_GET["rfp"]), 2);\r
+                       $file = strrev($splitpath[0]);\r
+                       $parent = strrev($splitpath[1]);\r
+                       echo '> <a href="'.$_SERVER['HTTP_REFERER'].'">Cancel rename</a><br />';                \r
+                       ?>\r
+                               <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
+                                       <input type="hidden" name="action" value="renfile" />\r
+                                       <input type="hidden" name="oldname" value="<?php echo $_GET["rfp"] ?>"/>\r
+                                       <input type="hidden" name="dir" value="<?php echo "/$parent" ?>"/>\r
+                                       <table><tr>\r
+                                               <td><?php echo 'Rename to'?></td>\r
+                                               <td><input name="newname" tabindex="90" value="<?php echo  htmlspecialchars($file) ?>" maxlength="50" size="20" /></td>\r
+                                       </tr><tr>\r
+                                               <td><?php echo "Rename"?></td>\r
+                                               <td><input type="submit" tabindex="140" value="<?php echo "Rename this file"?>" onclick="return checkSubmit();" /></td>\r
+                                       </tr></table>\r
+                               </form>\r
+                       <?PHP\r
+               }\r
+       }\r
+\r
+       function delfile() {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               if (isset($_GET['sure'])) { \r
+                       $file = $DIR_SKINS.$SKINSUBDIR.$_GET["rfp"];\r
+                       $errrep = error_reporting(E_ERROR);\r
+                       if (unlink ($file)) {\r
+                               $msg = 'File "'.$_GET["rfp"].'" has been deleted.';\r
+                       } else {\r
+                               $msg = 'ERROR: File "'.$_GET["rfp"].'" could not be deleted.';\r
+                       }\r
+                       error_reporting($errrep);\r
+                       showdir($msg);\r
+               } else {\r
+                       $file = $DIR_SKINS.$SKINSUBDIR.$_GET["rfp"];\r
+                       $splitpath =  preg_split( "/\//", strrev($_GET["rfp"]), 2);\r
+                       $parent = strrev($splitpath[1]);\r
+                       echo '<h3><b>Delete file "'.$_GET["rfp"].'": are you sure?</b></h3>';\r
+                       echo '<b>This action cannot be undone!</b><br /><br />';\r
+                       echo "> <a href=\"$pluginsskinfiles/?action=delfile&dir=$parent&sure=y&rfp=".$_GET["rfp"]."\">Yes, delete the file.</a><br />";         \r
+                       echo "> <a href=\"$pluginsskinfiles/?dir=".$parent.'">No, go back.</a><br />';          \r
+               }\r
+       }\r
+\r
+       function deldir() {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               if (isset($_GET['sure'])) { \r
+                       $dir = $DIR_SKINS.$SKINSUBDIR.$_GET["remdir"];\r
+                       $errrep = error_reporting(E_ERROR);\r
+                       if (rmdir ($dir)) {\r
+                               $msg = 'Directory "'.$_GET["remdir"].'" has been deleted.';\r
+                       } else {\r
+                               $msg = 'ERROR: directory "'.$_GET["remdir"].'" could not be deleted - (check to see if it contains files).';\r
+                       }\r
+                       error_reporting($errrep);\r
+                       showdir($msg);\r
+               } else {\r
+                       $dir = preg_replace("/^\//", "",$_GET['remdir']);\r
+                       $parent = $_GET['dir'];\r
+                       echo '<h3><b>Delete directory "/'.$dir.'": are you sure?</b></h3>';\r
+                       echo '<b>This action cannot be undone!</b><br /><br />';\r
+                       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
+                       echo "> <a href=\"$pluginsskinfiles/?dir=".$parent.'">No, go back.</a><br />';          \r
+               }\r
+       }\r
+\r
+       function deleteAllInDir() {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles;\r
+               $parent = $DIR_SKINS.$SKINSUBDIR.preg_replace("/^\//", "",$_GET['dir']);\r
+               if ($dh = @opendir($parent)) { \r
+                       while (($file = readdir($dh)) !== false) { \r
+                               if(!preg_match("/^\.{1,2}/", $file)){\r
+                                       if (!is_dir($parent.$file)) {\r
+                                               $files[] = $file;\r
+                                       }\r
+                               }\r
+                       }\r
+                       closedir($dh); \r
+               } \r
+               if (isset($_GET['sure'])) { \r
+                       $errrep = error_reporting(E_ERROR);\r
+                       echo '<h3>Deletion results</h3><table>';\r
+                       echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET["dir"]."\">Return to the /".$_GET["dir"]." directory.</a><br />";              \r
+                       foreach ($files as $file) {\r
+                               if (unlink ("$parent/$file")) { \r
+                                       echo "<tr><td>File: $file was deleted.</td></tr>"; \r
+                               } else {\r
+                                       echo "<tr><td>File: $file was <b>NOT</b> deleted.</td></tr>";\r
+                               }\r
+                       }\r
+                       echo "</table>";\r
+                       error_reporting($errrep);\r
+                       echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET["dir"]."\">Return to the /".$_GET["dir"]." directory.</a><br />";              \r
+               } else {\r
+                       echo '<h3><b>Delete all files in directory "/'.$_GET['dir'].'": are you sure?</b></h3>';\r
+                       echo '<b>This action cannot be undone!</b><br /><br />';\r
+                       echo "> <a href=\"$pluginsskinfiles/?action=deleteAllInDir&sure=y&dir=".$_GET["dir"]."\">Yes, delete <u>all files</u> in this directory.</a><br />";            \r
+                       echo "> <a href=\"$pluginsskinfiles/?dir=".$_GET['dir'].'">No, go back.</a><br /><br />';               \r
+                       echo '<b>Files list:</b><table>';\r
+                       foreach ($files as $file) {     echo "<tr><td>$file</td></tr>"; }\r
+                       echo '</table>';\r
+               }\r
+       }\r
+\r
+       // function for MDNucleus; won't work unless $privateskins is set to true\r
+       function getLatestSkins() {\r
+               global $DIR_SKINS, $pluginsskinfiles, $privateskins, $latestskins, $member;\r
+               $confirmed = $_POST['overwrite'];\r
+               if (!$confirmed) {\r
+                       showdir("Overwrite of default skin files not confirmed - no action taken.");\r
+                       return;\r
+               }\r
+               if ($dh = @opendir($DIR_SKINS.$latestskins)) { \r
+                       while (($file = readdir($dh)) !== false) { \r
+                               if(!preg_match("/^\.{1,2}/", $file))\r
+                                       if (is_dir($DIR_SKINS.$latestskins.$file)) $skins[] = $file;\r
+                       }\r
+                       closedir($dh); \r
+               } \r
+               if ($skins) {\r
+                       $msg = "Refreshed skin folders:";\r
+                       sort ($skins);\r
+                       foreach ($skins as $skin) {\r
+                               $memberskin = $DIR_SKINS.$member->getID().'/'.$skin;\r
+                               if (is_file($memberskin)) unlink($memberskin);\r
+                               if (!is_dir($memberskin)) {\r
+                                       $old_umask = umask(0);\r
+                                       mkdir($memberskin, 0755);\r
+                                       umask($old_umask);\r
+                               }\r
+                               exec("rsync -Wtr --delete ".$DIR_SKINS.$latestskins.$skin."/* ".$memberskin.'/');\r
+                               $msg .= "  $skin";\r
+                       }\r
+               } else {\r
+                       showdir("No default skin folders found.  No action taken.");\r
+                       return;\r
+               }\r
+               showdir($msg);\r
+       }\r
+\r
+       function _isImageFile($file) {\r
+               return preg_match ("/\.(gif|png|jpg|jpeg|bmp|ico)$/i", $file);\r
+       }\r
+\r
+       function _isEditableFile($file) {\r
+               return preg_match ("/\.(inc|txt|htm|html|xml)$/i", $file);\r
+       }\r
+\r
+       function showdir($msg = '') {\r
+               global $DIR_SKINS, $SKINSUBDIR, $pluginsskinfiles, $CONF;\r
+               global $privateskins, $latestskins;\r
+               if (isset($_GET['dir'])) { \r
+                       $newdir = preg_replace("/^\//", "",$_GET['dir']);\r
+                       $currdir = $DIR_SKINS.$SKINSUBDIR."$newdir/";\r
+                       $in_subdir = 1;\r
+               } elseif (isset($_POST['dir'])) { \r
+                       $newdir = preg_replace("/^\//", "",$_POST['dir']);\r
+                       $currdir = $DIR_SKINS.$SKINSUBDIR."$newdir/";\r
+                       $in_subdir = 1;\r
+               } else {\r
+                       $newdir = '';\r
+                       $currdir = $DIR_SKINS.$SKINSUBDIR;\r
+                       $in_subdir = 0;\r
+               }\r
+       \r
+               if ($privateskins && (!is_dir($DIR_SKINS.$SKINSUBDIR))) {\r
+                       $oldumask = umask(0);\r
+                       mkdir($DIR_SKINS.$SKINSUBDIR, 0755);\r
+                       umask($oldmask);\r
+               }\r
+\r
+               if (!is_dir($currdir)) {\r
+                       echo 'The specified location is not a directory or doesn\'t exist.';\r
+                       return;\r
+               }\r
+               \r
+               if ($dh = @opendir($currdir)) { \r
+                       while (($file = readdir($dh)) !== false) { \r
+                               if(!preg_match("/^\.{1,2}/", $file)){\r
+                                       if (is_dir($currdir.$file)) {\r
+                                               $dirs[] = $file;\r
+                                       } else {\r
+                                               $files[] = $file;\r
+                                       }\r
+                               }\r
+                       }\r
+                       closedir($dh); \r
+               } \r
+               \r
+               echo "<h3>Current Directory: <b>/$newdir</b></h3>";\r
+               \r
+               if ($msg) {\r
+                       echo '<p><b>'.htmlspecialchars($msg).'</b></p>';\r
+               }\r
+               \r
+               if ($newdir != '') {\r
+                       echo "<u><a href=\"$pluginsskinfiles/\">> Return to / <</a></u><br />";\r
+                       if (strstr($newdir, '/')) {\r
+                               $splitpath =  preg_split( "/\//", strrev($newdir), 2);\r
+                               $updir = strrev($splitpath[1]);\r
+                               echo "<u><a href=\"$pluginsskinfiles/?dir=/$updir\">> Return to /$updir <</a></u><br /><br />";\r
+                       }\r
+               }\r
+               echo "<u><a href=\"$pluginsskinfiles/?dir=$newdir\">> Refresh <</a></u><br />";\r
+\r
+               echo "<table>";\r
+               if(is_array($dirs)){\r
+                       sort($dirs);\r
+                       foreach($dirs as $dir) {\r
+                               echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'><td>";\r
+                               echo "&nbsp;&nbsp;<a href=\"$pluginsskinfiles/?dir=$newdir/$dir\">";\r
+                               echo "<img src=\"$pluginsskinfiles/dir.gif\"> $dir</a>&nbsp;</td>";\r
+                               echo "<td>&nbsp;<a href=\"$pluginsskinfiles/?action=rendir&oldname=$newdir/$dir\" title=\"Rename directory\">(ren)</a></td>";\r
+                               echo "<td>&nbsp;<a href=\"$pluginsskinfiles/?action=deldir&dir=$newdir&remdir=$newdir/$dir\" title=\"Delete directory\">(del)</a></td>";\r
+                               echo "</td><td></td><td></td><td></td><td>";\r
+                               echo "<td>".date('M d, Y  h:i:s a', filemtime($DIR_SKINS.$SKINSUBDIR.$newdir."/$dir"));\r
+                               echo "</td></tr>";\r
+                       }\r
+               }\r
+       \r
+               if(is_array($files)){\r
+                       sort($files);\r
+                       foreach($files as $file) {\r
+                               echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'><td>";\r
+                               echo "&nbsp;&nbsp;";\r
+                               if (preg_match("/\.css$/i", $file)) {\r
+                                       echo "<img src=\"$pluginsskinfiles/css.gif\"> ";\r
+                               } elseif (preg_match("/\.php(3|4)?$/i", $file)) {\r
+                                       echo "<img src=\"$pluginsskinfiles/php.gif\"> ";\r
+                               } elseif (_isEditableFile($file)) {\r
+                                       echo "<img src=\"$pluginsskinfiles/text.gif\"> ";\r
+                               } elseif (_isImageFile($file)) {\r
+                                       echo "<img src=\"$pluginsskinfiles/image.gif\"> ";\r
+                               } else {\r
+                                       echo "<img src=\"$pluginsskinfiles/generic.png\"> ";\r
+                               }\r
+                               if ($newdir == '') {$thisdir = '';} else {$thisdir = "$newdir/";}\r
+                               echo "$file&nbsp;";\r
+                               echo "</td><td>";\r
+                               echo "&nbsp;<a href=\"$pluginsskinfiles/?action=renfile&rfp=$thisdir"."$file\" title=\"Rename file\">(ren)</a>";\r
+                               echo "</td><td>";\r
+                               echo "&nbsp;<a href=\"$pluginsskinfiles/?action=delfile&rfp=$thisdir"."$file\" title=\"Delete file\">(del)</a>";\r
+                               echo "</td><td>";\r
+                               if ((is_writable($DIR_SKINS.$SKINSUBDIR.$thisdir.$file)) && (!_isImageFile($file))) {\r
+                                       echo "&nbsp;<a href=\"$pluginsskinfiles/?action=editfile&rfp=$thisdir"."$file\" title=\"Edit file\">(edit)</a>";\r
+                               }\r
+                               echo "</td><td>";\r
+                               if (_isImageFile($file)) {\r
+                                       echo '&nbsp;<a href="'.$CONF['SkinsURL'].$SKINSUBDIR.$thisdir."$file\" title=\"View graphic\">(view)</a>";\r
+                               }\r
+                               echo "</td><td>";\r
+                               echo "&nbsp;<a href=\"$pluginsskinfiles/?action=download&rfp=$thisdir"."$file\" title=\"Download file\">(d/l)</a>";\r
+                               echo "</td><td>";\r
+                               echo number_format(filesize($DIR_SKINS.$SKINSUBDIR.$thisdir.$file)/1024, 2)." KB";\r
+                               echo "</td><td>";\r
+                               echo date('M d, Y  h:i:s a', filemtime($DIR_SKINS.$SKINSUBDIR.$thisdir.$file));\r
+                               echo "</td></tr>";\r
+                       }\r
+               }\r
+               echo "</table>";\r
+       \r
+               if(is_array($dirs) || is_array($files)) {\r
+                       if ($newdir != '') {\r
+                               echo "<u><a href=\"$pluginsskinfiles/\">> Return to / <</a></u><br />";\r
+                               if (strstr($newdir, '/')) {\r
+                                       $splitpath =  preg_split( "/\//", strrev($newdir), 2);\r
+                                       $updir = strrev($splitpath[1]);\r
+                                       echo "<u><a href=\"$pluginsskinfiles/?dir=/$updir\">> Return to /$updir <</a></u><br /><br />";\r
+                               }\r
+                       }\r
+                       echo "<u><a href=\"$pluginsskinfiles/?dir=$newdir\">> Refresh <</a></u><br />";\r
+               }\r
+\r
+               if ($newdir != '') {\r
+                       echo "<h3>Create new file in <b>/$newdir</b></h3>";\r
+                               ?>\r
+                               <form method="POST" enctype="multipart/form-data" action="<?php echo $pluginsskinfiles ?>/">\r
+                                               <input type="hidden" name="action" value="createfile" />\r
+                                               <input type="hidden" name="dir" value="<?php echo $newdir ?>">\r
+                                               <input type="text" name="filename" size="40">\r
+                                               <input type="submit" value="<?php echo 'Create file' ?>" />\r
+                                       </form>\r
+                               <?PHP\r
+\r
+                               echo "<h3>Upload new file to <b>/$newdir</b></h3>";\r
+                               ?>\r
+                               <form method="POST" enctype="multipart/form-data" action="<?php echo $pluginsskinfiles ?>/">\r
+                                               <input type="hidden" name="action" value="uploadfile" />\r
+                                               <input type="hidden" name="dir" value="<?php echo $newdir ?>">\r
+                                               <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $CONF['MaxUploadSize']?>" />\r
+                                               <input type="file" name="filename" size="40">\r
+                                               <input type="submit" value="<?php echo _UPLOAD_BUTTON?>" />\r
+                                       </form>\r
+                               <?PHP\r
+       \r
+                       if (count($files)) {\r
+                               echo "<h3>Delete all files in <b>/$newdir</b></h3>";\r
+                                       ?>\r
+                                               <form method="get" action="<?php echo $pluginsskinfiles?>/">\r
+                                                       <input type="hidden" name="action" value="deleteAllInDir" />\r
+                                                       <input type="hidden" name="dir" value="<?php echo $newdir?>"/>\r
+                                                       <?php echo "Delete all Files? (will ask for confirmation)"?>\r
+                                                       <input type="submit" tabindex="140" value="<?php echo "Delete All"?>" onclick="return checkSubmit();" />\r
+                                               </form>\r
+                                       <?PHP\r
+                       }\r
+               }\r
+       \r
+               echo "<h3>Create a new directory in <b>/$newdir</b></h3>"; \r
+                               ?>\r
+                                       <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
+                                               <input type="hidden" name="action" value="createdir" />\r
+                                               <input type="hidden" name="dir" value="<?php echo $newdir?>"/>\r
+                                               <input name="newdir" tabindex="90" value="<?php echo 'newdir' ?>" size="40" />\r
+                                               <input type="submit" tabindex="140" value="<?php echo "Create"?>" onclick="return checkSubmit();" />\r
+                                       </form>\r
+                               <?PHP\r
+\r
+               // for MDNucleus, ignored if on Win32 platform (for the moment)\r
+               if (($newdir == '') && ($privateskins) && (!strtoupper(substr(PHP_OS, 0,3) == 'WIN'))) {\r
+                       if ($dh = @opendir($DIR_SKINS.$latestskins)) { \r
+                               while (($file = readdir($dh)) !== false) { \r
+                                       if(!preg_match("/^\.{1,2}/", $file))\r
+                                               if (is_dir($DIR_SKINS.$latestskins.$file)) $skins[] = $file;\r
+                               }\r
+                               closedir($dh); \r
+                       }\r
+                       if ($skins) {\r
+                               echo "<h3>Refresh default skin files to standard versions</h3>";\r
+                               ?>\r
+                                       <form method="post" action="<?php echo $pluginsskinfiles?>/">\r
+                                               <input type="hidden" name="action" value="getLatestSkins" />\r
+                                               <?php\r
+                                               sort ($skins);\r
+                                               if (count($skins) > 1) {\r
+                                                       $lastskin = array_pop($skins);\r
+                                                       array_push($skins, "</b>and<b> $lastskin");\r
+                                               }\r
+                                               echo "This will overwrite or create files in the following skin file directories: <b>";\r
+                                               echo implode(", ", $skins)."</b><br /><br />"; \r
+                                               ?> \r
+                                               Note that you may need to re-import skin definitions you wish to use (See Layout Import/Export).<br /><br />\r
+                                               <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" />\r
+                                               <label for="cb_overwrite"><?php echo "Check this box to confirm overwrite of files<br />" ?></label>\r
+                                               <input type="submit" tabindex="140" value="<?php echo "Overwrite Default Skin Files"?>" onclick="return checkSubmit();" />\r
+                                       </form>\r
+                               <?PHP\r
+                       }\r
+               }\r
+\r
+       }\r
+\r
+       \r
+       \r
+?>
\ No newline at end of file
diff --git a/utf8/nucleus/plugins/skinfiles/php.gif b/utf8/nucleus/plugins/skinfiles/php.gif
new file mode 100644 (file)
index 0000000..7735fde
Binary files /dev/null and b/utf8/nucleus/plugins/skinfiles/php.gif differ
diff --git a/utf8/nucleus/plugins/skinfiles/text.gif b/utf8/nucleus/plugins/skinfiles/text.gif
new file mode 100644 (file)
index 0000000..66ceefb
Binary files /dev/null and b/utf8/nucleus/plugins/skinfiles/text.gif differ