PageRenderTime 21ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/Quản lý website các món ăn và ẩm thực php/bbqvietnam.com/administrator/components/com_ninjaxplorer/admin.ninjaxplorer.php

https://gitlab.com/phamngsinh/baitaplon_sinhvien
PHP | 270 lines | 121 code | 11 blank | 138 comment | 8 complexity | b30887ef8858e1b178d4749963e61c71 MD5 | raw file
  1. <?php
  2. // ensure this file is being included by a parent file
  3. defined('_JEXEC') or die('Restricted access');
  4. /**
  5. * MAIN FILE! (formerly known as index.php)
  6. *
  7. * @version $Id: admin.joomlaxplorer.php 99 2008-04-20 15:10:20Z soeren $
  8. *
  9. * @package joomlaXplorer
  10. * @copyright soeren 2007
  11. * @author The joomlaXplorer project (http://joomlacode.org/gf/project/joomlaxplorer/)
  12. * @author The The QuiX project (http://quixplorer.sourceforge.net)
  13. * @license
  14. * The contents of this file are subject to the Mozilla Public License
  15. * Version 1.1 (the "License"); you may not use this file except in
  16. * compliance with the License. You may obtain a copy of the License at
  17. * http://www.mozilla.org/MPL/
  18. *
  19. * Software distributed under the License is distributed on an "AS IS"
  20. * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  21. * License for the specific language governing rights and limitations
  22. * under the License.
  23. *
  24. * Alternatively, the contents of this file may be used under the terms
  25. * of the GNU General Public License Version 2 or later (the "GPL"), in
  26. * which case the provisions of the GPL are applicable instead of
  27. * those above. If you wish to allow use of your version of this file only
  28. * under the terms of the GPL and not to allow others to use
  29. * your version of this file under the MPL, indicate your decision by
  30. * deleting the provisions above and replace them with the notice and
  31. * other provisions required by the GPL. If you do not delete
  32. * the provisions above, a recipient may use your version of this file
  33. * under either the MPL or the GPL."
  34. *
  35. *
  36. * This is a component with full access to the filesystem of your joomla Site
  37. * I wouldn't recommend to let in Managers
  38. * allowed: Superadministrator
  39. **/
  40. ###################################################################
  41. /* Ninja Xplorer
  42. * By Richie Mortimer
  43. * http://www.ninjoomla.com
  44. * Copyright (C) 2008 Richie Mortimer www.ninjoomla.com - Code so sharp, it hurts.
  45. * email: Richie@ninjaforge.com
  46. * date: April 2008
  47. * Release: 1.0
  48. * License : http://www.gnu.org/copyleft/gpl.html GNU/GPL
  49. *
  50. * Changelog
  51. * v1.0
  52. * Joomla! 1.5 Native
  53. *
  54. *
  55. */
  56. ###################################################################
  57. //Ninja Xplorer
  58. //Copyright (C) 2007 Richie Mortimer. Ninjoomla.com. All rights reserved.
  59. //
  60. //This program is free software; you can redistribute it and/or
  61. //modify it under the terms of the GNU General Public License
  62. //as published by the Free Software Foundation; either version 2
  63. //of the License, or (at your option) any later version.
  64. //
  65. //This program is distributed in the hope that it will be useful,
  66. //but WITHOUT ANY WARRANTY; without even the implied warranty of
  67. //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  68. //GNU General Public License for more details.
  69. //
  70. //You should have received a copy of the GNU General Public License
  71. //along with this program; if not, write to the Free Software
  72. //Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  73. ###################################################################
  74. global $mainframe;
  75. $document =& JFactory::getDocument();
  76. $user = &JFactory::getUser();
  77. $acl = &JFactory::getACL();
  78. $database = &JFactory::getDBO();
  79. /*if (!$acl->acl_check( 'administration', 'config', 'users', $user->usertype )) {
  80. $mainframe->redirect( 'index2.php', _NOT_AUTH );
  81. } */
  82. //get the users ID
  83. $myRealGid = intval( $acl->get_group_id( $user->usertype ) );
  84. //check to see if there superadmin, if not redirect them.
  85. if ($myRealGid != 25) {
  86. $mainframe->redirect( 'index2.php', _NOT_AUTH );
  87. }
  88. // The ninjaXplorer version number
  89. $GLOBALS['nx_version'] = '1.0';
  90. $GLOBALS['nx_home'] = 'http://ninjoomla.com';
  91. /*
  92. // Needed to keep the filelist in the XML installer file up-to-date
  93. $path = $mosConfig_absolute_path.'/administrator/components/com_joomlaxplorer';
  94. $filelist = mosReadDirectory( $path, '.', true, true );
  95. $contents ='';
  96. foreach($filelist as $file ) {
  97. if( is_dir( $file ) ) continue;
  98. $filepath = str_replace( $path.'/', '', $file );
  99. $contents .= '<filename>'.$filepath."</filename>\n";
  100. }
  101. file_put_contents( 'joomlaxplorer_filelist.txt', $contents );
  102. */
  103. define ( "_QUIXPLORER_PATH", JPATH_SITE."/administrator/components/com_ninjaxplorer" );
  104. define ( "_QUIXPLORER_FTPTMP_PATH", JPATH_SITE."/administrator/components/com_ninjaxplorer/ftp_tmp" );
  105. define ( "_QUIXPLORER_URL", $mainframe->getSiteURL()."administrator/components/com_ninjaxplorer" );
  106. //------------------------------------------------------------------------------
  107. if( defined( 'E_STRICT' )) {
  108. // Suppress Strict Standards Warnings (E_ALL doesn't include E_STRICT!)
  109. error_reporting( E_ALL);
  110. }
  111. //------------------------------------------------------------------------------
  112. umask(0002); // Added to make created files/dirs group writable
  113. //------------------------------------------------------------------------------
  114. require _QUIXPLORER_PATH . "/include/init.php"; // Init
  115. //------------------------------------------------------------------------------
  116. $action = stripslashes(JRequest::getCmd('action'));
  117. if( $action == "post" ) {
  118. $action = JRequest::getCmd( "do_action" );
  119. } elseif( empty( $action ))
  120. $action = "list";
  121. //if( is_callable( array( $mainframe, 'addcustomheadtag')) ) {
  122. $document->addScript( "components/com_ninjaxplorer/style/opacity.js" );
  123. // $document->addScript( "components/com_ninjaxplorer/scripts/mootools.ajax.js" );
  124. /*} else {
  125. echo '<script type="text/javascript" src="components/com_ninjaxplorer/style/opacity.js"></script>'
  126. .'<script type="text/javascript" src="components/com_nijaxplorer/scripts/mootools.ajax.js"></script>';
  127. } */
  128. if( nx_isXHR() ) {
  129. error_reporting(0);
  130. while( @ob_end_clean() );
  131. }
  132. switch($action) { // Execute action
  133. //------------------------------------------------------------------------------
  134. // EDIT FILE
  135. case "edit":
  136. require _QUIXPLORER_PATH . "/include/fun_edit.php";
  137. edit_file($dir, $item);
  138. break;
  139. // VIEW FILE
  140. case 'view':
  141. require _QUIXPLORER_PATH . "/include/fun_view.php";
  142. nx_show_file($dir, $item);
  143. break;
  144. //------------------------------------------------------------------------------
  145. // DELETE FILE(S)/DIR(S)
  146. case "delete":
  147. require _QUIXPLORER_PATH . "/include/fun_del.php";
  148. del_items($dir);
  149. break;
  150. //------------------------------------------------------------------------------
  151. // COPY/MOVE FILE(S)/DIR(S)
  152. case "copy": case "move":
  153. require _QUIXPLORER_PATH ."/include/fun_copy_move.php";
  154. copy_move_items($dir);
  155. break;
  156. // RENAME FILE(S)/DIR(S)
  157. case "rename":
  158. require _QUIXPLORER_PATH ."/include/fun_rename.php";
  159. rename_item($dir, $item);
  160. break;
  161. //------------------------------------------------------------------------------
  162. // DOWNLOAD FILE
  163. case "download":
  164. require _QUIXPLORER_PATH . "/include/fun_down.php";
  165. @ob_end_clean(); // get rid of cached unwanted output
  166. download_item($dir, $item);
  167. ob_start(false); // prevent unwanted output
  168. exit;
  169. break;
  170. //------------------------------------------------------------------------------
  171. // UPLOAD FILE(S)
  172. case "upload":
  173. require _QUIXPLORER_PATH . "/include/fun_up.php";
  174. upload_items($dir);
  175. break;
  176. //------------------------------------------------------------------------------
  177. // CREATE DIR/FILE
  178. case "mkitem":
  179. require _QUIXPLORER_PATH ."/include/fun_mkitem.php";
  180. make_item($dir);
  181. break;
  182. //------------------------------------------------------------------------------
  183. // CHMOD FILE/DIR
  184. case "chmod":
  185. require _QUIXPLORER_PATH ."/include/fun_chmod.php";
  186. chmod_item($dir, $GLOBALS["item"]);
  187. break;
  188. //------------------------------------------------------------------------------
  189. // SEARCH FOR FILE(S)/DIR(S)
  190. case "search":
  191. require _QUIXPLORER_PATH ."/include/fun_search.php";
  192. search_items($dir);
  193. break;
  194. //------------------------------------------------------------------------------
  195. // CREATE ARCHIVE
  196. case "arch":
  197. require _QUIXPLORER_PATH . "/include/fun_archive.php";
  198. archive_items($dir);
  199. break;
  200. //------------------------------------------------------------------------------
  201. // EXTRACT ARCHIVE
  202. case "extract":
  203. require _QUIXPLORER_PATH . "/include/fun_archive.php";
  204. extract_item($dir, $item);
  205. break;
  206. //------------------------------------------------------------------------------
  207. // USER-ADMINISTRATION
  208. case "admin":
  209. require _QUIXPLORER_PATH . "/include/fun_admin.php";
  210. show_admin($dir);
  211. break;
  212. //------------------------------------------------------------------------------
  213. // System Info
  214. case 'sysinfo':
  215. require _QUIXPLORER_PATH . "/include/fun_system_info.php";
  216. break;
  217. //------------------------------------------------------------------------------
  218. // FTP LOGIN
  219. case 'ftp_authentication':
  220. $ftp_login = JRequest::get( $_POST, 'ftp_login_name', '' );
  221. $ftp_pass = JRequest::get( $_POST, 'ftp_login_pass', '' );
  222. require( _QUIXPLORER_PATH.'/include/fun_ftpauthentication.php' );
  223. ftp_authentication( $ftp_login, $ftp_pass );
  224. break;
  225. case 'ftp_logout':
  226. require( _QUIXPLORER_PATH.'/include/fun_ftpauthentication.php' );
  227. ftp_logout();
  228. break;
  229. //------------------------------------------------------------------------------
  230. // BOOKMARKS
  231. case 'modify_bookmark':
  232. $task = JArrayHelper::getValue( $_REQUEST, 'task' );
  233. require( _QUIXPLORER_PATH.'/include/fun_bookmarks.php' );
  234. modify_bookmark( $task, $dir );
  235. break;
  236. //------------------------------------------------------------------------------
  237. case 'show_error':
  238. show_error('');
  239. break;
  240. //------------------------------------------------------------------------------
  241. // DEFAULT: LIST FILES & DIRS
  242. case "list":
  243. default:
  244. require _QUIXPLORER_PATH . "/include/fun_list.php";
  245. list_dir($dir);
  246. //------------------------------------------------------------------------------
  247. } // end switch-statement
  248. //------------------------------------------------------------------------------
  249. show_footer();
  250. // Disconnect from ftp server
  251. if( nx_isFTPMode() ) {
  252. $GLOBALS['FTPCONNECTION']->disconnect();
  253. }
  254. // Empty the output buffer if this is a XMLHttpRequest
  255. if( nx_isXHR() ) {
  256. nx_exit();
  257. }
  258. //------------------------------------------------------------------------------
  259. ?>