Commit 477d4e98 authored by tbrehm's avatar tbrehm
Browse files

Initial commit of the interface part of the APS installer.

parent 80bee61f
......@@ -865,6 +865,10 @@ class installer_dist extends installer_base {
}
}
//* Make the APS directories group writable
exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages");
exec("chmod -R 770 $install_dir/server/aps_packages");
//* make sure that the server config file (not the interface one) is only readable by the root user
exec("chmod 600 $install_dir/server/lib/$configfile");
exec("chown root:root $install_dir/server/lib/$configfile");
......
......@@ -858,6 +858,10 @@ class installer extends installer_base
}
}
//* Make the APS directories group writable
exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages");
exec("chmod -R 770 $install_dir/server/aps_packages");
//* make sure that the server config file (not the interface one) is only readable by the root user
chmod($install_dir.'/server/lib/'.$configfile, 0600);
chown($install_dir.'/server/lib/'.$configfile, 'root');
......
......@@ -903,6 +903,10 @@ class installer_dist extends installer_base {
}
}
//* Make the APS directories group writable
exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages");
exec("chmod -R 770 $install_dir/server/aps_packages");
//* make sure that the server config file (not the interface one) is only readable by the root user
exec("chmod 600 $install_dir/server/lib/$configfile");
exec("chown root:root $install_dir/server/lib/$configfile");
......
......@@ -1767,6 +1767,10 @@ class installer_base {
}
}
}
//* Make the APS directories group writable
exec("chmod -R 770 $install_dir/interface/web/sites/aps_meta_packages");
exec("chmod -R 770 $install_dir/server/aps_packages");
//* make sure that the server config file (not the interface one) is only readable by the root user
chmod($install_dir.'/server/lib/'.$configfile, 0600);
......
-- --------------------------------------------------------
--
-- Table structure for table `aps_instances`
--
CREATE TABLE IF NOT EXISTS `aps_instances` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`sys_userid` int(11) unsigned NOT NULL DEFAULT '0',
`sys_groupid` int(11) unsigned NOT NULL DEFAULT '0',
`sys_perm_user` varchar(5) DEFAULT NULL,
`sys_perm_group` varchar(5) DEFAULT NULL,
`sys_perm_other` varchar(5) DEFAULT NULL,
`server_id` int(11) NOT NULL DEFAULT '0',
`customer_id` int(4) NOT NULL,
`package_id` int(4) NOT NULL,
`instance_status` int(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------
--
-- Table structure for table `aps_instances_settings`
--
CREATE TABLE IF NOT EXISTS `aps_instances_settings` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`server_id` int(11) NOT NULL DEFAULT '0',
`instance_id` int(4) NOT NULL,
`name` varchar(255) NOT NULL,
`value` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------
--
-- Table structure for table `aps_packages`
--
CREATE TABLE IF NOT EXISTS `aps_packages` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`path` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`category` varchar(255) NOT NULL,
`version` varchar(20) NOT NULL,
`release` int(4) NOT NULL,
`package_status` int(1) NOT NULL DEFAULT '2',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `aps_settings`
--
CREATE TABLE IF NOT EXISTS `aps_settings` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`value` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
--
-- Dumping data for table `aps_settings`
--
INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(1, 'ignore-php-extension', '');
INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(2, 'ignore-php-configuration', '');
INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(3, 'ignore-webserver-module', '');
ALTER TABLE `client` ADD `limit_aps` int(11) NOT NULL DEFAULT '0' AFTER `limit_webdav_user`;
ALTER TABLE `client_template` ADD `limit_aps` int(11) NOT NULL DEFAULT '0' AFTER `limit_webdav_user`;
\ No newline at end of file
......@@ -53,6 +53,67 @@ SET FOREIGN_KEY_CHECKS = 0;
-- --------------------------------------------------------
-- --------------------------------------------------------
--
-- Table structure for table `aps_instances`
--
CREATE TABLE IF NOT EXISTS `aps_instances` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`server_id` int(11) NOT NULL DEFAULT '0',
`customer_id` int(4) NOT NULL,
`package_id` int(4) NOT NULL,
`instance_status` int(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------
--
-- Table structure for table `aps_instances_settings`
--
CREATE TABLE IF NOT EXISTS `aps_instances_settings` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`server_id` int(11) NOT NULL DEFAULT '0',
`instance_id` int(4) NOT NULL,
`name` varchar(255) NOT NULL,
`value` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------
--
-- Table structure for table `aps_packages`
--
CREATE TABLE IF NOT EXISTS `aps_packages` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`path` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`category` varchar(255) NOT NULL,
`version` varchar(20) NOT NULL,
`release` int(4) NOT NULL,
`package_status` int(1) NOT NULL DEFAULT '2',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `aps_settings`
--
CREATE TABLE IF NOT EXISTS `aps_settings` (
`id` int(4) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`value` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
-- --------------------------------------------------------
--
-- Table structure for table `attempts_login`
--
......@@ -123,6 +184,7 @@ CREATE TABLE `client` (
`limit_shell_user` int(11) NOT NULL DEFAULT '0',
`ssh_chroot` varchar(255) NOT NULL DEFAULT 'no,jailkit,ssh-chroot',
`limit_webdav_user` int(11) NOT NULL DEFAULT '0',
`limit_aps` int(11) NOT NULL DEFAULT '0',
`default_dnsserver` int(11) unsigned NOT NULL DEFAULT '1',
`limit_dns_zone` int(11) NOT NULL DEFAULT '-1',
`limit_dns_slave_zone` int(11) NOT NULL DEFAULT '-1',
......@@ -208,6 +270,7 @@ CREATE TABLE `client_template` (
`limit_shell_user` int(11) NOT NULL default '0',
`ssh_chroot` varchar(255) NOT NULL DEFAULT 'no',
`limit_webdav_user` int(11) NOT NULL default '0',
`limit_aps` int(11) NOT NULL DEFAULT '0',
`limit_dns_zone` int(11) NOT NULL default '-1',
`limit_dns_slave_zone` int(11) NOT NULL default '-1',
`limit_dns_record` int(11) NOT NULL default '-1',
......@@ -1670,6 +1733,14 @@ CREATE TABLE `web_traffic` (
-- --------------------------------------------------------
-- --------------------------------------------------------
--
-- Dumping data for table `aps_settings`
--
INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(1, 'ignore-php-extension', '');
INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(2, 'ignore-php-configuration', '');
INSERT INTO `aps_settings` (`id`, `name`, `value`) VALUES(3, 'ignore-webserver-module', '');
-- --------------------------------------------------------
--
......
<?php
/*
Copyright (c) 2012, ISPConfig UG
Contributors: web wack creations, http://www.web-wack.at
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Constants describing instances
define('INSTANCE_PENDING', 0);
define('INSTANCE_INSTALL', 1);
define('INSTANCE_ERROR', 2);
define('INSTANCE_SUCCESS', 3);
define('INSTANCE_REMOVE', 4);
// Constants describing packages
define('PACKAGE_LOCKED', 1);
define('PACKAGE_ENABLED', 2);
define('PACKAGE_OUTDATED', 3);
define('PACKAGE_ERROR_NOMETA', 4);
class ApsBase
{
protected $app = null;
protected $db = null;
protected $log_prefix = '';
protected $fetch_url = '';
protected $aps_version = '';
protected $packages_dir = '';
protected $temp_pkg_dir = '';
protected $interface_pkg_dir = '';
protected $interface_mode = false; // server mode by default
/**
* Constructor
*
* @param $app the application instance (db handle + log method)
* @param $interface_mode act in interface (true) or server mode (false)
* @param $log_prefix a prefix to set before all log entries
*/
public function __construct($app, $log_prefix = 'APS: ', $interface_mode = false)
{
$this->db = $app->db;
$this->app = $app;
$this->log_prefix = $log_prefix;
$this->interface_mode = $interface_mode;
$this->fetch_url = 'apscatalog.com';
$this->aps_version = '1';
$this->packages_dir = ISPC_ROOT_PATH.'/aps_packages';
$this->interface_pkg_dir = ISPC_ROOT_PATH.'/web/sites/aps_meta_packages';
}
/**
* Converts a given value to it's native representation in 1024 units
*
* @param $value the size to convert
* @return integer and string
*/
public function convertSize($value)
{
$unit = array('Bytes', 'KB', 'MB', 'GB', 'TB');
return @round($value/pow(1024, ($i = floor(log($value, 1024)))), 2).' '.$unit[$i];
}
/**
* Determine a specific xpath from a given SimpleXMLElement handle. If the
* element is found, it's string representation is returned. If not,
* the return value will stay empty
*
* @param $xml_handle the SimpleXMLElement handle
* @param $query the XPath query
* @param $array define whether to return an array or a string
* @return $ret the return string
*/
protected function getXPathValue($xml_handle, $query, $array = false)
{
$ret = '';
$xp_result = @($xml_handle->xpath($query)) ? $xml_handle->xpath($query) : false;
if($xp_result !== false) $ret = (($array === false) ? (string)$xp_result[0] : $xp_result);
return $ret;
}
}
?>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -203,6 +203,9 @@ function loadContent(pagename) {
var pageContentObject2 = jQuery.ajax({ type: "GET",
url: pagename,
dataType: "html",
beforeSend: function() {
jQuery('#pageContent').html('<div id="ajaxloader"><img src="themes/default/images/ajax-loader.gif" /></div>');
},
success: function(data, textStatus, jqXHR) {
if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
var parts = jqXHR.responseText.split(':');
......@@ -215,9 +218,9 @@ function loadContent(pagename) {
//var reponse = jQuery(jqXHR.responseText);
//var reponseScript = reponse.filter("script");
//jQuery.each(reponseScript, function(idx, val) { eval(val.text); } );
jQuery('#pageContent').html(jqXHR.responseText);
}
},
error: function() {
reportError('Ajax Request was not successful. 113');
......
<?php
/*
Copyright (c) 2012, ISPConfig UG
Contributors: web wack creations, http://www.web-wack.at
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//require_once('classes/class.base.php'); // for constants
$app->load('aps_base');
// Path to the list definition file
$list_def_file = "list/aps_availablepackages.list.php";
// Check the module permissions
$app->auth->check_module_permissions('sites');
// Load needed classes
$app->uses('tpl,listform_actions');
$app->listform_actions->SQLOrderBy = 'ORDER BY name, version';
// Show only unlocked packages to clients and (un-)lockable packages to admins
if($_SESSION['s']['user']['typ'] != 'admin') $app->listform_actions->SQLExtWhere = 'package_status = '.PACKAGE_ENABLED;
else $app->listform_actions->SQLExtWhere = '(package_status = '.PACKAGE_ENABLED.' OR package_status = '.PACKAGE_LOCKED.')';
// Get package amount
$pkg_count = $app->db->queryOneRecord("SELECT COUNT(*) FROM aps_packages");
$app->tpl->setVar("package_count", $pkg_count['COUNT(*)']);
// Start the form rendering and action handling
$app->listform_actions->onLoad();
?>
\ No newline at end of file
<?php
/*
Copyright (c) 2012, ISPConfig UG
Contributors: web wack creations, http://www.web-wack.at
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
//require_once('classes/class.crawler.php');
$app->load('aps_crawler');
$log_prefix = 'APS crawler cron: ';
$aps = new ApsCrawler($app, true); // true = Interface mode, false = Server mode
$app->log($log_prefix.'Used mem at begin: '.$aps->convertSize(memory_get_usage(true)));
$time_start = microtime(true);
$aps->startCrawler();
$aps->parseFolderToDB();
$time = microtime(true) - $time_start;
$app->log($log_prefix.'Used mem at end: '.$aps->convertSize(memory_get_usage(true)));
$app->log($log_prefix.'Mem peak during execution: '.$aps->convertSize(memory_get_peak_usage(true)));
$app->log($log_prefix.'Execution time: '.round($time, 3).' seconds');
// Load the language file
$lngfile = 'lib/lang/'.$_SESSION['s']['language'].'_aps.lng';
require_once($lngfile);
$app->load_language_file('web/sites/'.$lngfile);
echo '<div id="OKMsg"><p>'.$app->lng('packagelist_update_finished_txt').'</p></div>';
?>
\ No newline at end of file
<?php
/*
Copyright (c) 2012, ISPConfig UG
Contributors: web wack creations, http://www.web-wack.at
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
require_once('../../lib/config.inc.php');
require_once('../../lib/app.inc.php');
require_once('classes/class.guicontroller.php');
// Check the module permissions
$app->auth->check_module_permissions('aps');
$gui = new ApsGUIController($app);
// An action and ID are required in any case
if(!isset($_GET['action'])) die;
// List of operations which can be performed
if($_GET['action'] == 'change_status')
{
// Only admins can perform this operation
if($_SESSION['s']['user']['typ'] != 'admin') die;
// Make sure a valid package ID is given
if(!$gui->isValidPackageID($_GET['id'], true)) die($app->lng('Invalid ID'));
// Change the existing status to the opposite
$get_status = $app->db->queryOneRecord("SELECT PackageStatus FROM aps_packages WHERE ID = '".intval($_GET['id'])."';");
if($get_status['PackageStatus'] == strval(PACKAGE_LOCKED))
{
$app->db->query("UPDATE aps_packages SET PackageStatus = ".PACKAGE_ENABLED." WHERE ID = '".intval($_GET['id'])."';");
echo '<div class="swap" id="ir-Yes"><span>'.$app->lng('Yes').'</span></div>';
}
else
{
$app->db->query("UPDATE aps_packages SET PackageStatus = ".PACKAGE_LOCKED." WHERE ID = '".intval($_GET['id'])."';");
echo '<div class="swap" id="ir-No"><span>'.$app->lng('No').'</span></div>';
}
}
else if($_GET['action'] == 'delete_instance')
{
// Make sure a valid package ID is given (also corresponding to the calling user)
$client_id = 0;
$is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
if(!$is_admin)
{
$cid = $app->db->queryOneRecord("SELECT client_id FROM client WHERE username = '".$app->db->quote($_SESSION['s']['user']['username'])."';");
$client_id = $cid['client_id'];
}
// Assume that the given instance belongs to the currently calling client_id. Unimportant if status is admin
if(!$gui->isValidInstanceID($_GET['id'], $client_id, $is_admin)) die($app->lng('Invalid ID'));
// Only delete the instance if the status is "installed" or "flawed"
$check = $app->db->queryOneRecord("SELECT ID FROM aps_instances
WHERE ID = ".$app->db->quote($_GET['id'])." AND
(InstanceStatus = ".INSTANCE_SUCCESS." OR InstanceStatus = ".INSTANCE_ERROR.");");
if(!empty($check)) $gui->deleteInstance($_GET['id']);
echo $app->lng('Installation_remove');
}
else if($_GET['action'] == 'reinstall_instance')
{
// Make sure a valid package ID is given (also corresponding to the calling user)
$client_id = 0;
$is_admin = ($_SESSION['s']['user']['typ'] == 'admin') ? true : false;
if(!$is_admin)
{
$cid = $app->db->queryOneRecord("SELECT client_id FROM client WHERE username = '".$app->db->quote($_SESSION['s']['user']['username'])."';");
$client_id = $cid['client_id'];
}
// Assume that the given instance belongs to the currently calling client_id. Unimportant if status is admin
if(!$gui->isValidInstanceID($_GET['id'], $client_id, $is_admin)) die($app->lng('Invalid ID'));
// We've an InstanceID, so make sure the package is no enabled and InstanceStatus is still "installed"
$check = $app->db->queryOneRecord("SELECT aps_instances.ID FROM aps_instances, aps_packages
WHERE aps_instances.PackageID = aps_packages.ID
AND aps_instances.InstanceStatus = ".INSTANCE_SUCCESS."
AND aps_packages.PackageStatus = ".PACKAGE_ENABLED."
AND aps_instances.ID = ".$app->db->quote($_GET['id']).";");
if(!$check) die; // normally this might not happen at all, so just die
$gui->reinstallInstance($_GET['id']);
echo $app->lng('Installation_task');
}
?>
<?php
/*
Copyright (c) 2012, ISPConfig UG
Contributors: web wack creations, http://www.web-wack.at
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: