Advertisement
voku1987

testing ...

Jun 16th, 2012
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.45 KB | None | 0 0
  1. <?php
  2.  
  3. function rrmdir($dir) {
  4.     if (is_dir($dir)) {
  5.         $objects = scandir($dir);
  6.         foreach ($objects as $object) {
  7.             if ($object != "." && $object != "..") {
  8.                 if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object);
  9.                 else unlink($dir."/".$object);
  10.                 }
  11.         }
  12.         reset($objects);
  13.     rmdir($dir);
  14.     }
  15. }
  16.  
  17. function copy_directory($source, $destination) {
  18.     if (is_dir($source)) {
  19.         @mkdir($destination);
  20.         $directory = dir($source);
  21.         while ( FALSE !== ($readdirectory = $directory->read())) {
  22.             if ($readdirectory == '.' || $readdirectory == '..') continue;
  23.             $PathDir = $source . '/' . $readdirectory;
  24.             if (is_dir($PathDir)) {
  25.                 copy_directory($PathDir, $destination . '/' . $readdirectory);
  26.                 continue;
  27.             }
  28.             copy($PathDir, $destination . '/' . $readdirectory);
  29.         }
  30.         $directory->close();
  31.     } else copy($source, $destination);
  32. }
  33.  
  34.  
  35. $templateGlobals['pageSublineDeactivated'] = 0;
  36. $pageIDNext = (int)$pageID+1;
  37.  
  38. if (isset($_POST['submitted'])) {
  39.    
  40.     if (isset($_POST['base'])) $base_post = $_POST['base'];
  41.     if (isset($_POST['kernel'])) $kernel = $_POST['kernel'];
  42.  
  43.     /* rom base */
  44.     if ($base_post == "rom_cyanogenmod9") {
  45.         $base = "CM9";
  46.     }
  47.     else if ($base_post == "rom_cyanogenmod9_nightly") {
  48.         $base = "CM9_nightly";
  49.     }
  50.  
  51.     if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
  52.     {
  53.         $ip=$_SERVER['HTTP_CLIENT_IP'];
  54.     }
  55.     if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
  56.     {
  57.         $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
  58.     }
  59.     else
  60.     {
  61.         $ip=$_SERVER['REMOTE_ADDR'];
  62.     }
  63.  
  64.     $dir = "download/" . $ip . $base;
  65.  
  66.     // if dir exist, will be deleted right now
  67.     if(is_dir($dir) == true) rrmdir($dir);  
  68.  
  69.     // copy base-package to modding
  70.     copy_directory($base, $dir);
  71.  
  72.     /* add a new kernel */
  73.  
  74.     // CM-kernel (default)
  75.     if ($kernel == "kernel_cm9") {
  76.         $array_source[] = 'kernel/cm9/zImage';
  77.         $array_target[] = 'xbin/zImage';
  78.     }
  79.  
  80.     // dorimanx
  81.     if ($kernel == "kernel_dorimanx_stable") {
  82.         $array_source[] = 'kernel/dorimanx/v1111/zImage';
  83.         $array_target[] = 'xbin/zImage';
  84.     }
  85.     if ($kernel == "kernel_dorimanx_new") {
  86.         $array_source[] = 'kernel/dorimanx/v2222/zImage';
  87.         $array_target[] = 'xbin/zImage';
  88.     }
  89.  
  90.     $count = count($array_source);
  91.     for ($i = 0; $i < $count; $i++) {
  92.         if(file_exists($array_source[$i])) copy($array_source[$i], $dir . $array_target[$i]);
  93.         else echo "404: The requested file was not found!!! -> " . $array_source[$i];
  94.     }
  95. }
  96.  
  97.     $pageContent .= '
  98.     <form action="index.php?pid=' . $pageIDNext . '" method="post">
  99.         <input name="submitted" type="hidden" value="1" />
  100.  
  101.         <fieldset style="text-align:left;">
  102.             <legend><strong>Base-package</strong></legend>
  103.  
  104.             <input type="radio" name="base" value="rom_cyanogenmod9_nightly" style="width: 20px;" checked="checked" />
  105.             <strong><a href="http://download.cyanogenmod.com/?type=nightly&device=galaxys2" target="_blank">CyanogenMod | Galaxys2 / Nightly</a></strong>
  106.  
  107.             <br>
  108.  
  109.             <input type="radio" name="base" value="rom_other" style="width: 20px;" />
  110.             <strong><a href="" target="_blank">other base</a></strong><br />
  111.  
  112.             <input type="radio" name="base" value="rom_no" style="width: 20px;" /><strong>No Base Package</strong>
  113.         </fieldset>
  114.  
  115.         <fieldset style="text-align:left;"><legend><strong>Select kernel</strong></legend>
  116.             <table border="0">
  117.                 <tr>
  118.                     <td width="65%">
  119.                         <table border="0">
  120.                             <tr>
  121.                                 <td>other</td>
  122.                                 <td align="center">
  123.                                     <input type="radio" name="kernel" value="kernel_other_stable" />v1
  124.                                 </td>
  125.                             </tr>
  126.                             <tr>
  127.                                 <td><a href="http://forum.xda-developers.com/showthread.php?t=1617219" target="_blank">Dorimanx</a></td>
  128.                                 <td align="center">
  129.                                     <input type="radio" name="kernel" value="kernel_dorimanx_stable" />v1111
  130.                                 </td>
  131.                                 <td align="center">
  132.                                     <input type="radio" name="kernel" value="kernel_dorimanx_new" />v2222
  133.                                 </td>
  134.                             </tr>
  135.                             <tr>
  136.                                 <td><a href="" target="_blank">other2</a></td>
  137.                                 <td align="center">
  138.                                     <input type="radio" name="kernel" value="kernel_other_stable" />v1111
  139.                                 </td>
  140.                                 <td align="center">
  141.                                     <input type="radio" name="kernel" value="kernel_other_new" />v2222
  142.                                 </td>
  143.                                 </tr>
  144.                
  145.                             <tr>
  146.                         </table>
  147.                     </td>
  148.                     <td>
  149.                         <div id="div1"></div>
  150.                     </td>
  151.                 </tr>
  152.             </table>
  153.         </fieldset>
  154.         <input type="image" src="images/next.jpg" alt="Next step..." /><br />
  155.     </form>
  156.     ';
  157.  
  158. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement