Commit 27cbb3f9 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1.fixed http req 2.temporary turned off repeated requests

parent 58cbe941
...@@ -157,7 +157,7 @@ else if ($cmd=="get_hdd_space"){ ...@@ -157,7 +157,7 @@ else if ($cmd=="get_hdd_space"){
if (isset($_GET['mountpoint'])) if (isset($_GET['mountpoint']))
$mountpoint = $_GET['mountpoint']; $mountpoint = $_GET['mountpoint'];
else else
$mountpoint = '/mnt/0'; $mountpoint = '/mnt/sda1';
xml_header(); xml_header();
echo "<command>".$cmd."</command>"; echo "<command>".$cmd."</command>";
echo "<".$cmd.">"; echo "<".$cmd.">";
...@@ -170,7 +170,8 @@ else if ($cmd=="mount") { // mount media like HDD ...@@ -170,7 +170,8 @@ else if ($cmd=="mount") { // mount media like HDD
if (isset($_GET['partition'])) if (isset($_GET['partition']))
$partition = $_GET['partition']; $partition = $_GET['partition'];
else else
$partition = '/dev/hda1'; $partition = '/dev/sda1';
//$partition = '/dev/hda1';
if (isset($_GET['mountpoint'])) if (isset($_GET['mountpoint']))
$mountpoint = $_GET['mountpoint']; $mountpoint = $_GET['mountpoint'];
...@@ -353,7 +354,7 @@ else ...@@ -353,7 +354,7 @@ else
$i = 2; $i = 2;
while($i < count($arr1)) { while($i < count($arr1)) {
// skip flash and RAM disk partitions // skip flash and RAM disk partitions
if(!strpos($arr1[$i], "mtdblock") && !strpos($arr1[$i], "ram")) { if (!strpos($arr1[$i], "mtdblock") && !strpos($arr1[$i], "ram")) {
$temp = $arr1[$i]; $temp = $arr1[$i];
while(strstr($temp, " ")) { while(strstr($temp, " ")) {
$temp = str_replace(chr(9), " ", $temp); $temp = str_replace(chr(9), " ", $temp);
...@@ -415,7 +416,8 @@ else ...@@ -415,7 +416,8 @@ else
if (isset($_GET['partition'])) if (isset($_GET['partition']))
$partition = $_GET['partition']; $partition = $_GET['partition'];
else else
$partition = '/dev/hda1'; $partition = '/dev/sda1';
//$partition = '/dev/hda1';
exec('mount', $arr); exec('mount', $arr);
...@@ -426,7 +428,13 @@ else ...@@ -426,7 +428,13 @@ else
echo "no HDD mounted"; echo "no HDD mounted";
break; break;
case "create_symlink": case "create_symlink":
exec('ln -s /var/hdd /mnt/flash/html/hdd'); //exec('ln -s /var/hdd /mnt/flash/html/hdd');
if (isset($_GET['mountpoint'])) $mountpoint = $_GET['mountpoint'];
else $mountpoint = "/mnt/sda1";
exec("rm /www/pages/hdd");
exec("ln -sf $mountpoint /www/pages/hdd");
break; break;
// case "list": // case "list":
// if (isset($_GET['path'])) $path = $_GET['path']; // if (isset($_GET['path'])) $path = $_GET['path'];
...@@ -447,7 +455,7 @@ else ...@@ -447,7 +455,7 @@ else
// //
// break; // break;
case "list_files": case "list_files":
if (!file_exists('/mnt/flash/html/hdd')) { if (!file_exists('/www/pages/hdd')) {
echo "no webshare found"; echo "no webshare found";
break; break;
} }
...@@ -473,32 +481,34 @@ else ...@@ -473,32 +481,34 @@ else
echo "</file>"; echo "</file>";
} }
if ($handle = opendir('/mnt/flash/html/hdd'.$dir)) if ($handle = opendir('/www/pages/hdd/'.$dir)) {
{
while ($file = readdir($handle)) while ($file = readdir($handle))
{ {
if ($file != "." && $file != "..") if ($file != "." && $file != "..")
{ {
echo "<file>"; echo "<file>";
echo "<type>"; echo "<type>";
if (is_dir("/var/hdd/".$dir.$file)) if (is_dir("/www/pages/hdd/".$dir.$file))
echo "dir"; echo "dir";
else else
echo $extension = substr($file, strrpos($file, '.')+1, strlen($file)); echo $extension = substr($file, strrpos($file, '.')+1, strlen($file));
echo "</type>"; echo "</type>";
echo "<name>".$file."</name>"; echo "<name>".$file."</name>";
echo "<path>".substr($dir, 1).$file."</path>"; echo "<path>".substr($dir, 1).$file."</path>";
$size = filesize("/var/hdd/".$dir.$file); $size = filesize("/www/pages/hdd/".$dir.$file);
echo "<size>".$size."</size>"; echo "<size>".$size."</size>";
$date = date ("d M Y H:i:s", filectime("/var/hdd/".$dir.$file)); if(!ini_get('date.timezone')){
date_default_timezone_set('GMT');
}
$date = date ("d M Y H:i:s", filectime("/www/pages/hdd/".$dir.$file));
echo "<date>".$date."</date>"; echo "<date>".$date."</date>";
echo "</file>"; echo "</file>";
} }
} }
closedir($handle); closedir($handle);
} }else{
else
echo "no webshare found<br>"; echo "no webshare found<br>";
}
break; break;
case "set_prefix": case "set_prefix":
$prefix = $_GET['prefix']; $prefix = $_GET['prefix'];
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment