PageRenderTime 45ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/NukeViet3.2/admin/modules/themes/package_theme.php

http://nuke-viet.googlecode.com/
PHP | 111 lines | 98 code | 6 blank | 7 comment | 4 complexity | c8ebde47a37841fb3093c2622a403643 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1, GPL-2.0
  1. <?php
  2. /**
  3. * @Project NUKEVIET 3.0
  4. * @Author VINADES.,JSC (contact@vinades.vn)
  5. * @Copyright (C) 2010 VINADES.,JSC. All rights reserved
  6. * @Createdate 2-2-2010 12:55
  7. */
  8. if ( ! defined( 'NV_IS_FILE_THEMES' ) ) die( 'Stop!!!' );
  9. $title = $note = $module_file = "";
  10. $page_title = $lang_module['autoinstall_method_packet'];
  11. if ( $nv_Request->isset_request( NV_OP_VARIABLE, 'post' ) )
  12. {
  13. $themename = $nv_Request->get_string( 'themename', 'post' );
  14. $themefolder = array();
  15. //theme folder
  16. if ( file_exists( NV_ROOTDIR . '/themes/' . $themename . '/' ) )
  17. {
  18. $themefolder[] = NV_ROOTDIR . '/themes/' . $themename . '/';
  19. }
  20. if ( file_exists( NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $themename . '.zip' ) )
  21. {
  22. @unlink( NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $themename . '.zip' );
  23. }
  24. $file_src = NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . NV_TEMPNAM_PREFIX . 'theme_' . $themename . '_' . md5( nv_genpass( 10 ) . session_id() ) . '.zip';
  25. require_once NV_ROOTDIR . '/includes/class/pclzip.class.php';
  26. $zip = new PclZip( $file_src );
  27. $zip->create( $themefolder, PCLZIP_OPT_REMOVE_PATH, NV_ROOTDIR . '/themes' );
  28. $filesize = @filesize( $file_src );
  29. $file_name = basename( $file_src );
  30. nv_insert_logs( NV_LANG_DATA, $module_name, $lang_module['autoinstall_method_packet'], 'file name : ' . $themename . '.zip', $admin_info['userid'] );
  31. $linkgetfile = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=getfile&amp;mod=nv3_theme_" . $themename . ".zip&amp;checkss=" . md5( $file_name . $client_info['session_id'] . $global_config['sitekey'] ) . "&amp;filename=" . $file_name;
  32. echo '<a href="' . $linkgetfile . '"><span style="font-size:16px;color:red">nv3_theme_' . $themename . '' . ' - ' . nv_convertfromBytes( $filesize ) . '</span></a>';
  33. }
  34. else
  35. {
  36. $op = $nv_Request->get_string( 'op', 'get' );
  37. $contents .= "<form name='install_theme' enctype='multipart/form-data' action=\"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "\" method=\"post\">";
  38. $contents .= "<table summary=\"\" class=\"tab1\">\n";
  39. $contents .= "<tbody class=\"second\">";
  40. $contents .= "<tr>";
  41. $contents .= "<td align=\"center\" colspan='2'><strong>" . $lang_module['autoinstall_package_select'] . ": </strong>\n";
  42. $contents .= "<input type='hidden' name='" . NV_OP_VARIABLE . "' value='" . $op . "'/>";
  43. $contents .= "<select name=\"themename\">\n";
  44. $contents .= "<option value=\"0\">" . $lang_module['autoinstall_method_none'] . "</option>\n";
  45. $theme_list = nv_scandir( NV_ROOTDIR . "/themes/", $global_config['check_theme'] );
  46. foreach ( $theme_list as $value )
  47. {
  48. $contents .= "<option value=\"" . $value . "\">" . $value . "</option>\n";
  49. }
  50. $contents .= "</select>\n";
  51. $contents .= "</td>";
  52. $contents .= "</tr>";
  53. $contents .= "</tbody>";
  54. $contents .= "<tr>";
  55. $contents .= "<td colspan='2' align='center'>";
  56. $contents .= "<input name=\"continue\" type=\"button\" value=\"" . $lang_module['autoinstall_continue'] . "\" />\n";
  57. $contents .= "<input name=\"back\" type=\"button\" value=\"" . $lang_module['autoinstall_back'] . "\" />\n";
  58. $contents .= "</td>";
  59. $contents .= "</tr>";
  60. $contents .= "<tbody class=\"second\">";
  61. $contents .= "<tr>";
  62. $contents .= "<td colspan='2' align='center'>";
  63. $contents .= "<p id='message' style='color:red;display:none'></p>";
  64. $contents .= "</td>";
  65. $contents .= "</tr>";
  66. $contents .= "</tbody>";
  67. $contents .= "</table>";
  68. $contents .= "</form>";
  69. $contents .= '
  70. <script type="text/javascript">
  71. $(function(){
  72. //<![CDATA[
  73. $("input[name=continue]").click(function(){
  74. var themename = $("select[name=themename]").val();
  75. if (themename!=0){
  76. $("#message").html("<img src=\'' . NV_BASE_SITEURL . 'images/load_bar.gif\' alt=\'\'/>' . $lang_module['autoinstall_package_processing'] . '");
  77. $("#message").fadeIn();
  78. $("input[name=continue]").attr("disabled","disabled");
  79. $("input[name=back]").attr("disabled","disabled");
  80. $("#step1").slideUp();
  81. $.ajax({
  82. type: "POST",
  83. url: "' . NV_BASE_ADMINURL . 'index.php?' . NV_NAME_VARIABLE . '=' . $module_name . '",
  84. data: "themename="+ themename+"&' . NV_OP_VARIABLE . '=' . $op . '",
  85. success: function(data){
  86. $("input[name=back]").removeAttr("disabled");
  87. $("input[name=continue]").removeAttr("disabled");
  88. $("#message").html(data);
  89. }
  90. });
  91. } else {
  92. alert("' . $lang_module['autoinstall_package_noselect'] . '");
  93. return false;
  94. }
  95. });
  96. $("input[name=back]").click(function(){
  97. $("#content").slideUp();
  98. $("#step1").slideDown();
  99. });
  100. });
  101. //]]>
  102. </script>';
  103. echo $contents;
  104. }
  105. ?>