Просмотр файла download/include/screen_theme.php

Размер файла: 2.43Kb
  1. <?php
  2.  
  3. $theme = $res_down['dir'] . '/' . $res_down['name'];
  4. $file_name = $file_id . '.gif';
  5. $name = 'screen/' . $file_name;
  6. if ($format_file == 'nth')
  7. {
  8. include H.'sys/inc/zip.php';
  9. $nth = &new PclZip($theme);
  10. $content = $nth->extract(PCLZIP_OPT_BY_NAME, 'theme_descriptor.xml', PCLZIP_OPT_EXTRACT_AS_STRING);
  11. if (!$content)
  12. {
  13. $content = $nth->extract(PCLZIP_OPT_BY_PREG, '\.xml$', PCLZIP_OPT_EXTRACT_AS_STRING);
  14. }
  15. $teg = simplexml_load_string($content[0]['content'])->wallpaper['src'] or $teg = simplexml_load_string($content[0]['content'])->wallpaper['main_display_graphics'];
  16. $image = $nth->extract(PCLZIP_OPT_BY_NAME, trim($teg), PCLZIP_OPT_EXTRACT_AS_STRING);
  17. $im = array_reverse(explode('.', $teg));
  18. $im = 'imageCreateFrom' . str_ireplace('jpg', 'jpeg', trim($im[0]));
  19. $upload = file_put_contents($name, $image[0]['content']);
  20. } elseif ($format_file == 'thm')
  21. {
  22. include 'class_tar.php';
  23. $thm = &new Archive_Tar($theme);
  24. if (!$file = $thm->extractInString('Theme.xml') or !$file = $thm->extractInString(pathinfo($theme, PATHINFO_FILENAME) . '.xml'))
  25. {
  26. $list = $thm->listContent();
  27. $all = sizeof($list);
  28. for ($i = 0; $i < $all; ++$i)
  29. {
  30. if (pathinfo($list[$i]['filename'], PATHINFO_EXTENSION) == 'xml')
  31. {
  32. $file = $thm->extractInString($list[$i]['filename']);
  33. break;
  34. }
  35. }
  36.  
  37. }
  38. if (!$file)
  39. {
  40. preg_match('/<\?\s*xml\s*version\s*=\s*"1\.0"\s*\?>(.*)<\/.+>/isU', file_get_contents($theme), $arr);
  41. $file = trim($arr[0]);
  42. }
  43. $load = trim((string )simplexml_load_string($file)->Standby_image['Source']);
  44. if (strtolower(strrchr($load, '.')) == '.swf')
  45. $load = '';
  46. if (!$load)
  47. $load = trim((string )simplexml_load_string($file)->Desktop_image['Source']);
  48. if (strtolower(strrchr($load, '.')) == '.swf')
  49. $load = '';
  50. if (!$load)
  51. $load = trim((string )simplexml_load_string($file)->Desktop_image['Source']);
  52. if (strtolower(strrchr($load, '.')) == '.swf')
  53. $load = '';
  54. if (!$load)
  55. {
  56. include H.'engine/includes/foot.php';
  57. exit;
  58. }
  59. $image = $thm->extractInString($load);
  60. $im = array_reverse(explode('.', $load));
  61. $im = 'imageCreateFrom' . str_ireplace('jpg', 'jpeg', trim($im[0]));
  62. $upload = file_put_contents($name, $image);
  63. }
  64.  
  65. ?>