forked from soerennb/extplorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.extplorer.php
executable file
·109 lines (99 loc) · 3.12 KB
/
install.extplorer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
// ensure this file is being included by a parent file
if( !defined( '_JEXEC' ) && !defined( '_VALID_MOS' ) ) die( 'Restricted access' );
/**
* @version $Id: install.extplorer.php 245 2015-09-15 20:20:03Z soeren $
* @package eXtplorer
* @copyright (C) 2005-2008 Soeren
* @license GNU / GPL
* @author soeren
* eXtplorer is Free Software
*/
if(function_exists ('jimport')){
jimport( 'joomla.version' );
}
if(!function_exists ('com_install')){
function com_install($mypath =''){
error_reporting( E_ALL ^ E_NOTICE );
global $database;
if( is_callable( array( 'JFactory', 'getDBO' ))) {
$database = JFactory::getDBO();
}
if( $mypath == '' ) {
$mypath = dirname(__FILE__);
}
require_once($mypath . "/include/functions.php");
require_once($mypath . "/libraries/Archive/archive.php");
ext_RaiseMemoryLimit( '50M' );
$archive_name = $mypath.'/scripts.tar.gz';
$extract_dir = $mypath.'/';
$result = extArchive::extract( $archive_name, $extract_dir );
if( !@PEAR::isError( $result )) {
unlink( $archive_name );
} else {
echo '<pre style="color:white; font-weight:bold; background-color:red;">Error!
'.$result->getMessage().'
</pre>';
}
if( !is_callable( array( $database, 'loadNextRow' ))) {
$database->setQuery( "SELECT id FROM #__components WHERE admin_menu_link = 'option=com_extplorer'" );
$id = $database->loadResult();
//add new admin menu images
$database->setQuery( "UPDATE #__components SET admin_menu_img = '../administrator/components/com_extplorer/images/x_icon.png', admin_menu_link = 'option=com_extplorer' WHERE id=$id");
$database->query();
}
}
}
if(!class_exists ( 'com_extplorerInstallerScript' )){
class com_extplorerInstallerScript
{
/**
* Called on installation
*
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function install( $adapter){
$adminpath = JPATH_SITE.'/administrator/components/com_extplorer';
com_install($adminpath);
$version = new JVersion;
if($version->isCompatible('3.0')) rename($adminpath.'/extplorer.j30.php', $adminpath.'/extplorer.php');
return true;
}
/**
* Called on update
*
* @param JAdapterInstance $adapter The object responsible for running this script
*
* @return boolean True on success
*/
public function update( $adapter) {
return true;
}
/**
* Called on uninstallation
*
* @param JAdapterInstance $adapter The object responsible for running this script
*/
public function uninstall( $adapter) {
return true;
}
function preflight($type, $parent)
{
// $parent is the class calling this method
// $type is the type of change (install, update or discover_install)
}
/**
* method to run after an install/update/uninstall method
*
* @return void
*/
function postflight($type, $parent)
{
$db = jfactory::getdbo();
$db->setQuery( "UPDATE `#__menu` SET link='index.php?option=com_extplorer&tmpl=component' WHERE link = 'index.php?option=com_extplorer'" );
$db->query();
}
}
}