OSDN Git Service

ver 0.5.9.2
authorkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sun, 24 Feb 2008 23:04:22 +0000 (23:04 +0000)
committerkmorimatsu <kmorimatsu@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sun, 24 Feb 2008 23:04:22 +0000 (23:04 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@613 1ca29b6e-896d-4ea0-84a5-967f57386b96

trunk/NP_MitasNom/mitasnom/extra/compress.php [new file with mode: 0644]
trunk/NP_MitasNom/mitasnom/extra/expand.php [new file with mode: 0644]
trunk/NP_MitasNom/mitasnom/extra/index.php [new file with mode: 0644]

diff --git a/trunk/NP_MitasNom/mitasnom/extra/compress.php b/trunk/NP_MitasNom/mitasnom/extra/compress.php
new file mode 100644 (file)
index 0000000..ed4f41f
--- /dev/null
@@ -0,0 +1,53 @@
+<html><body><?php
+/*
+ * NP_MitasNom
+ * Written by Katsumi
+ * This library is GPL
+ */
+$strRel = '../../../../'; 
+include($strRel . 'config.php');
+
+if (!($member->isLoggedIn() && $member->isAdmin())) exit('Not logged in');
+if (!$manager->checkTicket()) exit('Invalid ticket');
+
+error_reporting (E_ERROR | E_WARNING | E_PARSE);
+
+//$files=listup_files('../');
+$files=listup_files('../editor');
+
+if (!($fHandle=fopen('compress.dat','x'))) exit; //Overwrite prohibited.
+$list='';
+$fpoint=0;
+
+foreach ($files as $value) {
+       ob_start();
+       $list.=readfile($value).'|'.$value."\n";// The data at each line is: "filesize|filename"
+       $data=ob_get_contents();
+       ob_end_clean();
+       fwrite($fHandle,$data);
+       echo "$value<br />\n";
+}
+fclose($fHandle);
+
+if (!($fHandle=fopen('compress.lst','x'))) exit; //Overwrite prohibited.
+fwrite($fHandle,$list);
+fclose($fHandle);
+
+function listup_files($dir){
+       $dir=str_replace('\\','/',$dir);// Windows support.
+       $dir=preg_replace('/[\/]$/','',$dir).'/';
+       $files=array();
+       if (!is_dir($dir)) return $files;
+       $d = dir($dir);
+       while (false !== ($entry = $d->read())) {
+               if ($entry=='.'||$entry=='..') continue;// Ignore this and parent directory.
+               if (is_dir($dir.$entry)) {// The case of directory
+                       foreach(listup_files($dir.$entry) as $value) $files[]=$value;
+                       continue;
+               }
+               $files[]=$dir.$entry;
+       }
+       $d->close();
+       return $files;
+}
+?>All Done!</body></html>
\ No newline at end of file
diff --git a/trunk/NP_MitasNom/mitasnom/extra/expand.php b/trunk/NP_MitasNom/mitasnom/extra/expand.php
new file mode 100644 (file)
index 0000000..8272c10
--- /dev/null
@@ -0,0 +1,44 @@
+<html><body><?php
+/*
+ * NP_MitasNom
+ * Written by Katsumi
+ * This library is GPL
+ */
+$strRel = '../../../../'; 
+include($strRel . 'config.php');
+
+if (!($member->isLoggedIn() && $member->isAdmin())) exit('Not logged in');
+if (!$manager->checkTicket()) exit('Invalid ticket');
+
+error_reporting (E_ERROR | E_WARNING | E_PARSE);
+
+if (!file_exists('compress.lst')) exit('compress.lst not found');
+if (!($fHandle=fopen('compress.dat','r'))) exit;
+
+foreach(file('compress.lst') as $value) {
+       list($filesize,$filename)=explode('|',$value);// The data contains "filesize|filename".
+       $filesize=(int)$filesize;
+       $filename=trim($filename);
+       echo "($filesize)$filename<br />\n";
+       $data=fread($fHandle,$filesize);
+       mkdirex(dirname($filename));
+       if (!($fHandle2=fopen($filename,'w'))) continue;// Overwrite allowed.
+       fwrite($fHandle2,$data);
+       fclose($fHandle2);
+}
+
+function mkdirex($dir,$mod='777'){
+       $dir=str_replace('\\','/',$dir);
+       if (substr($dir,0,1)=='/') $temp='/';
+       else $temp='';
+       eval('$i=0'.$mod.';');
+       foreach(explode('/',$dir) as $value) {
+               if (!$value) continue;
+               $temp.=$value.'/';
+               if (!file_exists($temp)) {
+                       @mkdir($temp);
+                       @chmod($temp,$i);
+               }
+       }
+}
+?>All Done!</body></html>
\ No newline at end of file
diff --git a/trunk/NP_MitasNom/mitasnom/extra/index.php b/trunk/NP_MitasNom/mitasnom/extra/index.php
new file mode 100644 (file)
index 0000000..33db918
--- /dev/null
@@ -0,0 +1,16 @@
+<html><body><?php
+/*
+ * NP_MitasNom
+ * Written by Katsumi
+ * This library is GPL
+ */
+$strRel = '../../../../'; 
+include($strRel . 'config.php');
+
+if (!($member->isLoggedIn() && $member->isAdmin())) exit('Not logged in');
+
+echo '<a href="'.$manager->addTicketToUrl('expand.php').'">Expand</a><p/>';
+
+if (!file_exists('compress.lst')) echo '<a href="'.$manager->addTicketToUrl('compress.php').'">Compress</a><p/>';
+
+?></body></html>
\ No newline at end of file