diff --git a/.gitignore b/.gitignore index 212413f4..176cc9ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ -packages/* lib/classes/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/*/ -temp/* templates/* install/update.log .buildpath diff --git a/actions/admin/settings/150.mail.php b/actions/admin/settings/150.mail.php index 1714d2c6..bc2d39ea 100644 --- a/actions/admin/settings/150.mail.php +++ b/actions/admin/settings/150.mail.php @@ -85,21 +85,6 @@ return array( 'default' => 100, 'save_method' => 'storeSettingField', ), - 'system_autoresponder_enabled' => array( - 'label' => $lng['serversettings']['autoresponder_active'], - 'settinggroup' => 'autoresponder', - 'varname' => 'autoresponder_active', - 'type' => 'bool', - 'default' => false, - 'cronmodule' => 'froxlor/autoresponder', - 'save_method' => 'storeSettingField', - ), - 'system_last_autoresponder_run' => array( - 'settinggroup' => 'autoresponder', - 'varname' => 'last_autoresponder_run', - 'type' => 'hidden', - 'default' => 0, - ), 'system_catchall_enabled' => array( 'label' => $lng['serversettings']['catchall_enabled'], 'settinggroup' => 'catchall', diff --git a/actions/admin/settings/200.aps.php b/actions/admin/settings/200.aps.php deleted file mode 100644 index 66dccb65..00000000 --- a/actions/admin/settings/200.aps.php +++ /dev/null @@ -1,102 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Settings - * - */ - -return array( - 'groups' => array( - 'aps' => array( - 'title' => $lng['admin']['aps'], - 'fields' => array( - 'aps_enable' => array( - 'label' => $lng['aps']['activate_aps'], - 'settinggroup' => 'aps', - 'varname' => 'aps_active', - 'type' => 'bool', - 'default' => false, - 'cronmodule' => 'froxlor/aps', - 'save_method' => 'storeSettingField', - 'overview_option' => true - ), - 'aps_items_per_page' => array( - 'label' => $lng['aps']['packages_per_page'], - 'settinggroup' => 'aps', - 'varname' => 'items_per_page', - 'type' => 'int', - 'default' => 20, - 'save_method' => 'storeSettingField', - ), - 'aps_upload_fields' => array( - 'label' => $lng['aps']['upload_fields'], - 'settinggroup' => 'aps', - 'varname' => 'upload_fields', - 'type' => 'int', - 'default' => 5, - 'save_method' => 'storeSettingField', - ), - 'aps_exceptions' => array( - 'label' => $lng['aps']['exceptions'], - 'type' => 'label', - ), - 'aps_php-extension' => array( - 'label' => $lng['aps']['settings_php_extensions'], - 'settinggroup' => 'aps', - 'varname' => 'php-extension', - 'type' => 'option', - 'default' => '', - 'option_mode' => 'multiple', - 'option_options' => array('gd' => 'GD Library', 'pcre' => 'PCRE', 'ioncube' => 'ionCube', 'ioncube loader' => 'ionCube Loader', 'curl' => 'curl', 'mcrypt' => 'mcrypt', 'imap' => 'imap', 'json' => 'json', 'ldap' => 'LDAP', 'hash' => 'hash', 'mbstring' => 'mbstring', 'Zend Optimizer' => 'Zend Guard'), - 'save_method' => 'storeSettingApsPhpExtensions', - ), - 'aps_php-function' => array( - 'settinggroup' => 'aps', - 'varname' => 'php-function', - 'type' => 'hidden', - 'default' => '', - ), - 'aps_php-configuration' => array( - 'label' => $lng['aps']['settings_php_configuration'], - 'settinggroup' => 'aps', - 'varname' => 'php-configuration', - 'type' => 'option', - 'default' => '', - 'option_mode' => 'multiple', - 'option_options' => array('short_open_tag' => 'short_open_tag', 'file_uploads' => 'file_uploads', 'magic_quotes_gpc' => 'magic_quotes_gpc', 'register_globals' => 'register_globals', 'allow_url_fopen' => 'allow_url_fopen', 'safe_mode' => 'safe_mode', 'post_max_size' => 'post_max_size', 'memory_limit' => 'memory_limit', 'max_execution_time' => 'max_execution_time'), - 'save_method' => 'storeSettingField', - ), - 'aps_webserver-module' => array( - 'label' => $lng['aps']['settings_webserver_modules'], - 'settinggroup' => 'aps', - 'varname' => 'webserver-module', - 'type' => 'option', - 'default' => '', - 'option_mode' => 'multiple', - 'option_options' => array('mod_perl' => 'mod_perl', 'mod_rewrite' => 'mod_rewrite', 'mod_access' => 'mod_access', 'fcgid-any' => 'FastCGI/mod_fcgid', 'htaccess' => '.htaccess'), - 'save_method' => 'storeSettingApsWebserverModules', - ), - 'aps_webserver-htaccess' => array( - 'settinggroup' => 'aps', - 'varname' => 'webserver-htaccess', - 'type' => 'hidden', - 'default' => '', - ), - ), - ), - ), - ); - -?> \ No newline at end of file diff --git a/actions/admin/settings/215.backup.php b/actions/admin/settings/215.backup.php deleted file mode 100644 index 99c3bcfd..00000000 --- a/actions/admin/settings/215.backup.php +++ /dev/null @@ -1,118 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Settings - * - */ - -return array( - 'groups' => array( - 'backup' => array( - 'title' => $lng['backup'], - 'fields' => array( - 'backup_enabled' => array( - 'label' => $lng['serversettings']['backup_enabled'], - 'settinggroup' => 'system', - 'varname' => 'backup_enabled', - 'type' => 'bool', - 'default' => false, - 'cronmodule' => 'froxlor/backup', - 'save_method' => 'storeSettingField', - 'overview_option' => true - ), - 'backup_dir' => array( - 'label' => $lng['serversettings']['backupdir']['description'], - 'settinggroup' => 'system', - 'varname' => 'backup_dir', - 'type' => 'string', - 'string_type' => 'dir', - 'default' => '/var/customers/backups/', - 'string_regexp' => '#^/.*/$#', - 'save_method' => 'storeSettingField', - ), - 'backup_mysqldump_path' => array( - 'label' => $lng['serversettings']['mysqldump_path']['description'], - 'settinggroup' => 'system', - 'varname' => 'backup_mysqldump_path', - 'type' => 'string', - 'default' => '/usr/bin/mysqldump', - 'save_method' => 'storeSettingField', - ), - 'backup_count' => array( - 'label' => $lng['serversettings']['backup_count'], - 'settinggroup' => 'system', - 'varname' => 'backup_count', - 'type' => 'bool', - 'default' => 'true', - 'save_method' => 'storeSettingField', - 'overview_option' => false - ), - 'backup_bigfile' => array( - 'label' => $lng['serversettings']['backup_bigfile'], - 'settinggroup' => 'system', - 'varname' => 'backup_bigfile', - 'type' => 'bool', - 'default' => false, - 'save_method' => 'storeSettingField', - 'overview_option' => false - ), - 'backup_ftp_enabled_' => array( - 'label' => $lng['serversettings']['backup_ftp_enabled'], - 'settinggroup' => 'system', - 'varname' => 'backup_ftp_enabled', - 'type' => 'bool', - 'default' => false, - 'save_method' => 'storeSettingField', - 'overview_option' => false - ), - 'backup_server' => array( - 'label' => $lng['serversettings']['backup_ftp_server'], - 'settinggroup' => 'system', - 'varname' => 'backup_ftp_server', - 'type' => 'string', - 'default' => '', - 'save_method' => 'storeSettingField', - ), - 'backup_user' => array( - 'label' => $lng['serversettings']['backup_ftp_user'], - 'settinggroup' => 'system', - 'varname' => 'backup_ftp_user', - 'type' => 'string', - 'default' => '', - 'save_method' => 'storeSettingField', - ), - 'backup_pass' => array( - 'label' => $lng['serversettings']['backup_ftp_pass'], - 'settinggroup' => 'system', - 'varname' => 'backup_ftp_pass', - 'type' => 'hiddenstring', - 'default' => '', - 'save_method' => 'storeSettingField', - ), - 'backup_passive_mode' => array( - 'label' => $lng['serversettings']['backup_ftp_passive_mode'], - 'settinggroup' => 'system', - 'varname' => 'backup_ftp_passive', - 'type' => 'bool', - 'default' => true, - 'save_method' => 'storeSettingField', - 'overview_option' => false, - ), - ), - ), - ), - ); - -?> diff --git a/admin_admins.php b/admin_admins.php index 3b4135ab..88dd799b 100644 --- a/admin_admins.php +++ b/admin_admins.php @@ -81,7 +81,7 @@ if ($page == 'admins' $traffic_doublepercent = 0; } - $row = str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota email_autoresponder ftps subdomains tickets'); + $row = str_replace_array('-1', 'UL', $row, 'customers domains diskspace traffic mysqls emails email_accounts email_forwarders email_quota ftps subdomains tickets'); $row = htmlentities_array($row); eval("\$admins.=\"" . getTemplate("admins/admins_admin") . "\";"); $count++; @@ -233,16 +233,6 @@ if ($page == 'admins' $email_quota = - 1; } - if ($settings['autoresponder']['autoresponder_active'] == '1') { - - $email_autoresponder = intval_ressource($_POST['email_autoresponder']); - if (isset($_POST['email_autoresponder_ul'])) { - $email_autoresponder = - 1; - } - } else { - $email_autoresponder = 0; - } - $ftps = intval_ressource($_POST['ftps']); if (isset($_POST['ftps_ul'])) { $ftps = - 1; @@ -263,19 +253,6 @@ if ($page == 'admins' $mysqls = - 1; } - if ($settings['aps']['aps_active'] == '1') { - - $number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']); - if (isset($_POST['number_of_aps_packages_ul'])) { - $number_of_aps_packages = - 1; - } - $can_manage_aps_packages = isset($_POST['can_manage_aps_packages']) ? 1 : 0; - - } else { - $number_of_aps_packages = 0; - $can_manage_aps_packages = 0; - } - $customers_see_all = 0; if (isset($_POST['customers_see_all'])) { $customers_see_all = intval($_POST['customers_see_all']); @@ -401,9 +378,6 @@ if ($page == 'admins' 'tickets_see_all' => $tickets_see_all, 'mysqls' => $mysqls, 'ip' => $ipaddress, - 'can_manage_aps_packages' => $can_manage_aps_packages, - 'aps_packages' => $number_of_aps_packages, - 'autoresponder' => $email_autoresponder, 'theme' => $_theme ); @@ -432,9 +406,6 @@ if ($page == 'admins' `tickets_see_all` = :tickets_see_all, `mysqls` = :mysqls, `ip` = :ip, - `can_manage_aps_packages` = :can_manage_aps_packages, - `aps_packages` = :aps_packages, - `email_autoresponder` = :autoresponder, `theme` = :theme "); Database::pexecute($ins_stmt, $ins_data); @@ -476,11 +447,9 @@ if ($page == 'admins' $email_accounts_ul = makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $email_forwarders_ul = makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $email_quota_ul = makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); - $email_autoresponder_ul = makecheckbox('email_autoresponder_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $tickets_ul = makecheckbox('tickets_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $mysqls_ul = makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); - $number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true); $admin_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/admin/formfield.admin_add.php'; $admin_add_form = htmlform::genHTMLForm($admin_add_data); @@ -520,7 +489,6 @@ if ($page == 'admins' $email_accounts = $result['email_accounts']; $email_forwarders = $result['email_forwarders']; $email_quota = $result['email_quota']; - $email_autoresponder = $result['email_autoresponder']; $ftps = $result['ftps']; $tickets = $result['tickets']; $mysqls = $result['mysqls']; @@ -532,8 +500,6 @@ if ($page == 'admins' $diskspace = $result['diskspace']; $traffic = $result['traffic']; $ipaddress = $result['ip']; - $can_manage_aps_packages = $result['can_manage_aps_packages']; - $number_of_aps_packages = $result['aps_packages']; } else { @@ -580,15 +546,6 @@ if ($page == 'admins' $email_quota = -1; } - if ($settings['autoresponder']['autoresponder_active'] == '1') { - $email_autoresponder = intval_ressource($_POST['email_autoresponder']); - if (isset($_POST['email_autoresponder_ul'])) { - $email_autoresponder = -1; - } - } else { - $email_autoresponder = 0; - } - $ftps = intval_ressource($_POST['ftps']); if (isset($_POST['ftps_ul'])) { $ftps = -1; @@ -608,16 +565,6 @@ if ($page == 'admins' $mysqls = - 1; } - if ($settings['aps']['aps_active'] == '1') { - $number_of_aps_packages = intval_ressource($_POST['number_of_aps_packages']); - if (isset($_POST['number_of_aps_packages_ul'])) { - $number_of_aps_packages = -1; - } - $can_manage_aps_packages = isset($_POST['can_manage_aps_packages']) ? 1 : 0; - } else { - $number_of_aps_packages = 0; - } - $customers_see_all = 0; if (isset($_POST['customers_see_all'])) { $customers_see_all = intval($_POST['customers_see_all']); @@ -723,9 +670,6 @@ if ($page == 'admins' if ($email_quota != $result['email_quota'] && $email_quota < $result['email_quota_used']) { $res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'email quota'); } - if ($email_autoresponder != $result['email_autoresponder'] && $email_autoresponder < $result['email_autoresponder_used']) { - $res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'email autoresponder'); - } if ($ftps != $result['ftps'] && $ftps < $result['ftps_used']) { $res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'ftps'); } @@ -735,9 +679,6 @@ if ($page == 'admins' if ($mysqls != $result['mysqls'] && $mysqls < $result['mysqls_used']) { $res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'mysqls'); } - if ($number_of_aps_packages != $result['aps_packages'] && $number_of_aps_packages < $result['aps_packages_used']) { - $res_warning .= sprintf($lng['error']['setlessthanalreadyused'], 'aps packages'); - } if ($res_warning != "") { $link = ''; @@ -770,9 +711,6 @@ if ($page == 'admins' 'mysqls' => $mysqls, 'ip' => $ipaddress, 'deactivated' => $deactivated, - 'can_manage_aps_packages' => $can_manage_aps_packages, - 'aps_packages' => $number_of_aps_packages, - 'autoresponder' => $email_autoresponder, 'adminid' => $id ); @@ -800,10 +738,7 @@ if ($page == 'admins' `tickets_see_all` = :tickets_see_all, `mysqls` = :mysqls, `ip` = :ip, - `deactivated` = :deactivated, - `can_manage_aps_packages` = :can_manage_aps_packages, - `aps_packages` = :aps_packages, - `email_autoresponder` = :autoresponder + `deactivated` = :deactivated WHERE `adminid` = :adminid "); Database::pexecute($upd_stmt, $upd_data); @@ -863,11 +798,6 @@ if ($page == 'admins' $result['email_quota'] = ''; } - $email_autoresponder_ul = makecheckbox('email_autoresponder_ul', $lng['customer']['unlimited'], '-1', false, $result['email_autoresponder'], true, true); - if ($result['email_autoresponder'] == '-1') { - $result['email_autoresponder'] = ''; - } - $ftps_ul = makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true); if ($result['ftps'] == '-1') { $result['ftps'] = ''; @@ -883,11 +813,6 @@ if ($page == 'admins' $result['mysqls'] = ''; } - $number_of_aps_packages_ul = makecheckbox('number_of_aps_packages_ul', $lng['customer']['unlimited'], '-1', false, $result['aps_packages'], true, true); - if ($result['aps_packages'] == '-1') { - $result['aps_packages'] = ''; - } - $language_options = ''; while (list($language_file, $language_name) = each($languages)) { $language_options.= makeoption($language_name, $language_file, $result['def_language'], true); diff --git a/admin_aps.php b/admin_aps.php deleted file mode 100644 index 7a53b508..00000000 --- a/admin_aps.php +++ /dev/null @@ -1,33 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Panel - * - */ - -// Required code - -define('AREA', 'admin'); -require './lib/init.php'; -$Id = 0; - -if(isset($_GET['id']))$Id = (int)$_GET['id']; - -if(isset($_POST['id']))$Id = (int)$_POST['id']; -eval("echo \"" . getTemplate("aps/header") . "\";"); -$Aps = new ApsParser($userinfo, $settings); -$Aps->MainHandler($action); -eval("echo \"" . getTemplate("aps/footer") . "\";"); - diff --git a/customer_aps.php b/customer_aps.php deleted file mode 100644 index a36151ad..00000000 --- a/customer_aps.php +++ /dev/null @@ -1,34 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Panel - * - */ - -define('AREA', 'customer'); -require './lib/init.php'; - -$Id = 0; -if (isset($_GET['id'])) { - $Id = (int)$_GET['id']; -} -if (isset($_POST['id'])) { - $Id = (int)$_POST['id']; -} - -eval("echo \"" . getTemplate('aps/header') . "\";"); -$Aps = new ApsParser($userinfo, $settings); -$Aps->MainHandler($action); -eval("echo \"" . getTemplate('aps/footer') . "\";"); diff --git a/customer_extras.php b/customer_extras.php index 235a2e72..11b5cedc 100644 --- a/customer_extras.php +++ b/customer_extras.php @@ -29,36 +29,6 @@ if(isset($_POST['id'])) { if($page == 'overview') { $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras"); eval("echo \"" . getTemplate("extras/extras") . "\";"); -} elseif($page == 'backup') { - $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras_backup"); - - $result_stmt = Database::prepare("SELECT `backup_enabled` FROM `" . TABLE_PANEL_CUSTOMERS . "` - WHERE `customerid`= :customerid" - ); - Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); - $row = $result_stmt->fetch(PDO::FETCH_ASSOC); - - $backup_enabled = makeyesno('backup_enabled', '1', '0', $row['backup_enabled']); - - if(isset($_POST['send']) && $_POST['send'] == 'send') { - $backup_enabled = ($_POST['backup_enabled'] == '1' ? '1' : '0'); - - $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` - SET `backup_enabled`= :backupenabled - WHERE `customerid`= :customerid" - ); - Database::pexecute($stmt, array("backupenabled" => $backup_enabled, "customerid" => $userinfo['customerid'])); - - redirectTo($filename, Array('page' => $page, 's' => $s)); - } - - $backup_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.backup.php'; - $backup_form = htmlform::genHTMLForm($backup_data); - - $title = $backup_data['backup']['title']; - $image = $backup_data['backup']['image']; - - eval("echo \"" . getTemplate("extras/backup") . "\";"); } elseif($page == 'htpasswds') { if($action == '') { $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_extras::htpasswds"); @@ -67,7 +37,7 @@ if($page == 'overview') { 'path' => $lng['panel']['path'] ); $paging = new paging($userinfo, TABLE_PANEL_HTPASSWDS, $fields, $settings['panel']['paging'], $settings['panel']['natsorting']); - $result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` + $result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `customerid`= :customerid " . $paging->getSqlWhere(true) . " " . $paging->getSqlOrderBy() . " " . $paging->getSqlLimit() ); Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'])); @@ -110,7 +80,7 @@ if($page == 'overview') { AND `id`= :id" ); Database::pexecute($stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); - + $log->logAction(USR_ACTION, LOG_INFO, "deleted htpasswd for '" . $result['username'] . " (" . $result['path'] . ")'"); inserttask('1'); redirectTo($filename, Array('page' => $page, 's' => $s)); @@ -130,7 +100,7 @@ if($page == 'overview') { $username = validate($_POST['username'], 'username', '/^[a-zA-Z0-9][a-zA-Z0-9\-_]+\$?$/'); $authname = validate($_POST['directory_authname'], 'directory_authname', '/^[a-zA-Z0-9][a-zA-Z0-9\-_ ]+\$?$/'); validate($_POST['directory_password'], 'password'); - + $username_path_check_stmt = Database::prepare("SELECT `id`, `username`, `path` FROM `" . TABLE_PANEL_HTPASSWDS . "` WHERE `username`= :username AND `path`= :path @@ -213,18 +183,18 @@ if($page == 'overview') { } else { $password = crypt($_POST['directory_password']); } - + $params = array( "customerid" => $userinfo['customerid'], "id" => $id ); - + $pwd_sql = ''; if($_POST['directory_password'] != '') { $pwd_sql = "`password`= :password "; $params["password"] = $password; } - + $auth_sql = ''; if($authname != $result['authname']) { $auth_sql = "`authname`= :authname "; @@ -344,7 +314,7 @@ if($page == 'overview') { ); Database::pexecute($path_dupe_check_stmt, array("path" => $path, "customerid" => $userinfo['customerid'])); $path_dupe_check = $path_dupe_check_stmt->fetch(PDO::FETCH_ASSOC); - + if(!$_POST['path']) { standard_error('invalidpath'); } @@ -353,18 +323,18 @@ if($page == 'overview') { $options_cgi = '1'; } else { $options_cgi = '0'; - } + } $error404path = ''; if (isset($_POST['error404path'])) { $error404path = correctErrorDocument($_POST['error404path']); } - + $error403path = ''; if (isset($_POST['error403path'])) { $error403path = correctErrorDocument($_POST['error403path']); } - + $error500path = ''; if (isset($_POST['error500path'])) { $error500path = correctErrorDocument($_POST['error500path']); @@ -402,10 +372,6 @@ if($page == 'overview') { } else { $pathSelect = makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $settings['panel']['pathedit']); $cperlenabled = customerHasPerlEnabled($userinfo['customerid']); - /* - $options_indexes = makeyesno('options_indexes', '1', '0', '0'); - $options_cgi = makeyesno('options_cgi', '1', '0', '0'); - */ $htaccess_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htaccess_add.php'; $htaccess_add_form = htmlform::genHTMLForm($htaccess_add_data); @@ -417,7 +383,7 @@ if($page == 'overview') { } } elseif(($action == 'edit') && ($id != 0)) { $result_stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` - WHERE `customerid` = :customerid + WHERE `customerid` = :customerid AND `id` = :id" ); Database::pexecute($result_stmt, array("customerid" => $userinfo['customerid'], "id" => $id)); @@ -444,8 +410,9 @@ if($page == 'overview') { || ($error404path != $result['error404path']) || ($error403path != $result['error403path']) || ($error500path != $result['error500path']) - || ($options_cgi != $result['options_cgi'])) { - + || ($options_cgi != $result['options_cgi']) + ) { + inserttask('1'); $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTACCESS . "` SET `options_indexes` = :options_indexes, @@ -489,7 +456,7 @@ if($page == 'overview') { $htaccess_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/extras/formfield.htaccess_edit.php'; $htaccess_edit_form = htmlform::genHTMLForm($htaccess_edit_data); - + $title = $htaccess_edit_data['htaccess_edit']['title']; $image = $htaccess_edit_data['htaccess_edit']['image']; @@ -498,5 +465,3 @@ if($page == 'overview') { } } } - -?> diff --git a/customer_index.php b/customer_index.php index 6a40c186..5b8058f0 100644 --- a/customer_index.php +++ b/customer_index.php @@ -38,21 +38,21 @@ if ($action == 'logout') { ); } Database::pexecute($stmt, $params); - + redirectTo('index.php'); exit; } if ($page == 'overview') { $log->logAction(USR_ACTION, LOG_NOTICE, "viewed customer_index"); - + $domain_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `customerid` = :customerid AND `parentdomainid` = '0' AND `id` <> :standardsubdomain "); Database::pexecute($domain_stmt, array("customerid" => $userinfo['customerid'], "standardsubdomain" => $userinfo['standardsubdomain'])); - + $domains = ''; $domainArray = array(); @@ -91,7 +91,6 @@ if ($page == 'overview') { if ($userinfo['pop3'] == '1') $se[] = "POP3"; if ($userinfo['phpenabled'] == '1') $se[] = "PHP"; if ($userinfo['perlenabled'] == '1') $se[] = "Perl/CGI"; - if ($userinfo['backup_enabled'] == '1' && $userinfo['backup_allowed'] == '1') $se[] = "Backup"; $services_enabled = implode(", ", $se); eval("echo \"" . getTemplate('index/index') . "\";"); @@ -154,7 +153,7 @@ if ($page == 'overview') { } else { $new_webalizer_password = crypt($new_password); } - + $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_HTPASSWDS . "` SET `password` = :password WHERE `customerid` = :customerid @@ -182,20 +181,20 @@ if ($page == 'overview') { WHERE `customerid` = :customerid" ); Database::pexecute($stmt, array("lang" => $def_language, "customerid" => $userinfo['customerid'])); - + $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `language` = :lang WHERE `hash` = :hash" ); Database::pexecute($stmt, array("lang" => $def_language, "hash" => $s)); - + $log->logAction(USR_ACTION, LOG_NOTICE, "changed default language to '" . $def_language . "'"); } redirectTo($filename, Array('s' => $s)); } else { $default_lang = $settings['panel']['standardlanguage']; - if ($userinfo['def_language'] != '') { + if ($userinfo['def_language'] != '') { $default_lang = $userinfo['def_language']; } @@ -209,19 +208,19 @@ if ($page == 'overview') { } elseif ($page == 'change_theme') { if (isset($_POST['send']) && $_POST['send'] == 'send') { $theme = validate($_POST['theme'], 'theme'); - + $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `theme` = :theme WHERE `customerid` = :customerid" ); Database::pexecute($stmt, array("theme" => $theme, "customerid" => $userinfo['customerid'])); - + $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_SESSIONS . "` SET `theme` = :theme WHERE `hash` = :hash" ); Database::pexecute($stmt, array("theme" => $theme, "hash" => $s)); - + $log->logAction(USR_ACTION, LOG_NOTICE, "changed default theme to '" . $theme . "'"); redirectTo($filename, Array('s' => $s)); } else { diff --git a/install/froxlor.sql b/install/froxlor.sql index ee12dd34..ee5a2b37 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -128,11 +128,6 @@ CREATE TABLE `panel_admins` ( `lastlogin_fail` int(11) unsigned NOT NULL default '0', `loginfail_count` int(11) unsigned NOT NULL default '0', `reportsent` tinyint(4) unsigned NOT NULL default '0', - `can_manage_aps_packages` tinyint(1) NOT NULL default '1', - `aps_packages` int(5) NOT NULL default '0', - `aps_packages_used` int(5) NOT NULL default '0', - `email_autoresponder` int(5) NOT NULL default '0', - `email_autoresponder_used` int(5) NOT NULL default '0', `theme` varchar(255) NOT NULL default 'Sparkle', PRIMARY KEY (`adminid`), UNIQUE KEY `loginname` (`loginname`) @@ -191,14 +186,8 @@ CREATE TABLE `panel_customers` ( `reportsent` tinyint(4) unsigned NOT NULL default '0', `pop3` tinyint(1) NOT NULL default '1', `imap` tinyint(1) NOT NULL default '1', - `aps_packages` int(5) NOT NULL default '0', - `aps_packages_used` int(5) NOT NULL default '0', `perlenabled` tinyint(1) NOT NULL default '0', - `email_autoresponder` int(5) NOT NULL default '0', - `email_autoresponder_used` int(5) NOT NULL default '0', `theme` varchar(255) NOT NULL default 'Sparkle', - `backup_allowed` TINYINT( 1 ) NOT NULL DEFAULT '1', - `backup_enabled` TINYINT( 1 ) NOT NULL DEFAULT '0', PRIMARY KEY (`customerid`), UNIQUE KEY `loginname` (`loginname`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; @@ -212,7 +201,6 @@ CREATE TABLE `panel_databases` ( `databasename` varchar(255) NOT NULL default '', `description` varchar(255) NOT NULL default '', `dbserver` int(11) unsigned NOT NULL default '0', - `apsdb` tinyint(1) NOT NULL default '0', PRIMARY KEY (`id`), KEY `customerid` (`customerid`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; @@ -374,18 +362,8 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('dkim', 'dkim_domains', 'domains'), ('dkim', 'dkim_dkimkeys', 'dkim-keys.conf'), ('dkim', 'dkimrestart_command', '/etc/init.d/dkim-filter restart'), - ('autoresponder', 'autoresponder_active', '0'), - ('autoresponder', 'last_autoresponder_run', '0'), ('admin', 'show_version_login', '0'), ('admin', 'show_version_footer', '0'), - ('aps', 'items_per_page', '20'), - ('aps', 'upload_fields', '5'), - ('aps', 'aps_active', '0'), - ('aps', 'php-extension', ''), - ('aps', 'php-configuration', ''), - ('aps', 'webserver-htaccess', ''), - ('aps', 'php-function', ''), - ('aps', 'webserver-module', ''), ('spf', 'use_spf', '0'), ('spf', 'spf_entry', '@ IN TXT "v=spf1 a mx -all"'), ('dkim', 'dkim_algorithm', 'all'), @@ -491,16 +469,6 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('system', 'report_webmax', '90'), ('system', 'report_trafficmax', '90'), ('system', 'validate_domain', '1'), - ('system', 'backup_enabled', '0'), - ('system', 'backup_dir', '/var/customers/backups/'), - ('system', 'backup_mysqldump_path', '/usr/bin/mysqldump'), - ('system', 'backup_count', '1'), - ('system', 'backup_bigfile', '1'), - ('system', 'backup_ftp_enabled', '0'), - ('system', 'backup_ftp_server', ''), - ('system', 'backup_ftp_user', ''), - ('system', 'backup_ftp_pass', ''), - ('system', 'backup_ftp_passive', '1'), ('system', 'diskquota_enabled', '0'), ('system', 'diskquota_repquota_path', '/usr/sbin/repquota'), ('system', 'diskquota_quotatool_path', '/usr/bin/quotatool'), @@ -552,7 +520,7 @@ INSERT INTO `panel_settings` (`settinggroup`, `varname`, `value`) VALUES ('panel', 'phpconfigs_hidestdsubdomain', '0'), ('panel', 'allow_theme_change_admin', '1'), ('panel', 'allow_theme_change_customer', '1'), - ('panel', 'version', '0.9.31-rc1'); + ('panel', 'version', '0.9.31-rc99'); DROP TABLE IF EXISTS `panel_tasks`; @@ -727,23 +695,6 @@ CREATE TABLE IF NOT EXISTS `panel_syslog` ( ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; - -DROP TABLE IF EXISTS `mail_autoresponder`; -CREATE TABLE `mail_autoresponder` ( - `email` varchar(255) NOT NULL default '', - `message` text NOT NULL, - `enabled` tinyint(1) NOT NULL default '0', - `date_from` int(15) NOT NULL default '-1', - `date_until` int(15) NOT NULL default '-1', - `subject` varchar(255) NOT NULL default '', - `customerid` int(11) NOT NULL default '0', - PRIMARY KEY (`email`), - KEY `customerid` (`customerid`), - FULLTEXT KEY `message` (`message`) -) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; - - - DROP TABLE IF EXISTS `panel_phpconfigs`; CREATE TABLE `panel_phpconfigs` ( `id` int(11) unsigned NOT NULL auto_increment, @@ -765,63 +716,6 @@ INSERT INTO `panel_phpconfigs` (`id`, `description`, `binary`, `file_extensions` (1, 'Default Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_call_time_pass_reference = Off\r\nallow_url_fopen = Off\r\nasp_tags = Off\r\ndisable_classes =\r\ndisable_functions = curl_exec,curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\ncgi.force_redirect = 1\r\ngpc_order = "GPC"\r\nhtml_errors = Off\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\nmax_execution_time = 30\r\nmax_input_time = 60\r\nmemory_limit = 16M\r\n{OPEN_BASEDIR_C}open_basedir = "{OPEN_BASEDIR}"\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nregister_globals = Off\r\nreport_memleaks = On\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nsession.auto_start = 0\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.entropy_file = /dev/urandom\r\nsession.entropy_length = 16\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 1\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.use_cookies = 1\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nsuhosin.mail.protect = 1\r\nsuhosin.simulation = Off\r\ntrack_errors = Off\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\n'); -DROP TABLE IF EXISTS `aps_instances`; -CREATE TABLE IF NOT EXISTS `aps_instances` ( - `ID` int(4) NOT NULL auto_increment, - `CustomerID` int(4) NOT NULL, - `PackageID` int(4) NOT NULL, - `Status` int(4) NOT NULL, - PRIMARY KEY (`ID`) -) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; - - - -DROP TABLE IF EXISTS `aps_packages`; -CREATE TABLE IF NOT EXISTS `aps_packages` ( - `ID` int(4) NOT NULL auto_increment, - `Path` varchar(500) NOT NULL, - `Name` varchar(500) NOT NULL, - `Version` varchar(20) NOT NULL, - `Release` int(4) NOT NULL, - `Status` int(1) NOT NULL default '1', - PRIMARY KEY (`ID`) -) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; - - - -DROP TABLE IF EXISTS `aps_settings`; -CREATE TABLE IF NOT EXISTS `aps_settings` ( - `ID` int(4) NOT NULL auto_increment, - `InstanceID` int(4) NOT NULL, - `Name` varchar(250) NOT NULL, - `Value` varchar(250) NOT NULL, - PRIMARY KEY (`ID`) -) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; - - - -DROP TABLE IF EXISTS `aps_tasks`; -CREATE TABLE IF NOT EXISTS `aps_tasks` ( - `ID` int(4) NOT NULL auto_increment, - `InstanceID` int(4) NOT NULL, - `Task` int(4) NOT NULL, - PRIMARY KEY (`ID`) -) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; - - - -DROP TABLE IF EXISTS `aps_temp_settings`; -CREATE TABLE IF NOT EXISTS `aps_temp_settings` ( - `ID` int(4) NOT NULL auto_increment, - `PackageID` int(4) NOT NULL, - `CustomerID` int(4) NOT NULL, - `Name` varchar(250) NOT NULL, - `Value` varchar(250) NOT NULL, - PRIMARY KEY (`ID`) -) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; - - - DROP TABLE IF EXISTS `cronjobs_run`; CREATE TABLE IF NOT EXISTS `cronjobs_run` ( `id` bigint(20) NOT NULL auto_increment, @@ -835,18 +729,13 @@ CREATE TABLE IF NOT EXISTS `cronjobs_run` ( ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; - INSERT INTO `cronjobs_run` (`id`, `module`, `cronfile`, `interval`, `isactive`, `desc_lng_key`) VALUES (1, 'froxlor/core', 'cron_tasks.php', '5 MINUTE', '1', 'cron_tasks'), - (2, 'froxlor/aps', 'cron_apsinstaller.php', '5 MINUTE', '0', 'cron_apsinstaller'), - (3, 'froxlor/autoresponder', 'cron_autoresponder.php', '5 MINUTE', '0', 'cron_autoresponder'), - (4, 'froxlor/aps', 'cron_apsupdater.php', '1 HOUR', '0', 'cron_apsupdater'), - (5, 'froxlor/core', 'cron_traffic.php', '1 DAY', '1', 'cron_traffic'), - (6, 'froxlor/ticket', 'cron_used_tickets_reset.php', '1 DAY', '1', 'cron_ticketsreset'), - (7, 'froxlor/ticket', 'cron_ticketarchive.php', '1 MONTH', '1', 'cron_ticketarchive'), - (8, 'froxlor/reports', 'cron_usage_report.php', '1 DAY', '1', 'cron_usage_report'), - (9, 'froxlor/backup', 'cron_backup.php', '1 DAY', '1', 'cron_backup'), - (10, 'froxlor/core', 'cron_mailboxsize.php', '6 HOUR', '1', 'cron_mailboxsize'); + (2, 'froxlor/core', 'cron_traffic.php', '1 DAY', '1', 'cron_traffic'), + (3, 'froxlor/ticket', 'cron_used_tickets_reset.php', '1 DAY', '1', 'cron_ticketsreset'), + (4, 'froxlor/ticket', 'cron_ticketarchive.php', '1 MONTH', '1', 'cron_ticketarchive'), + (5, 'froxlor/reports', 'cron_usage_report.php', '1 DAY', '1', 'cron_usage_report'), + (6, 'froxlor/core', 'cron_mailboxsize.php', '6 HOUR', '1', 'cron_mailboxsize'); @@ -931,3 +820,4 @@ CREATE TABLE IF NOT EXISTS `panel_domaintoip` ( `id_ipandports` int(11) unsigned NOT NULL, PRIMARY KEY (`id_domain`,`id_ipandports`) ) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci; + diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php index 567106a9..78db0dde 100644 --- a/install/updates/froxlor/0.9/update_0.9.inc.php +++ b/install/updates/froxlor/0.9/update_0.9.inc.php @@ -2519,3 +2519,50 @@ if (isFroxlorVersion('0.9.31-dev6')) { lastStepStatus(0); updateToVersion('0.9.31-rc1'); } + +if (isFroxlorVersion('0.9.31-rc1')) { + showUpdateStep("Updating from 0.9.31-rc1 to 0.9.31-rc99"); + lastStepStatus(0); + + showUpdateStep("Removing APS-module (deprecated)"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'aps';"); + Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `can_manage_aps_packages`;"); + Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `aps_packages`;"); + Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `aps_packages_used`;"); + Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `aps_packages`;"); + Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `aps_packages_used`;"); + // FIXME what to do with APS-databases? (before dropping the field) + Database::query("ALTER TABLE `".TABLE_PANEL_DATABASES."` DROP `apsdb`;"); + Database::query("DROP TABLE IF EXISTS `aps_packages`;"); + Database::query("DROP TABLE IF EXISTS `aps_instances`;"); + Database::query("DROP TABLE IF EXISTS `aps_settings`;"); + Database::query("DROP TABLE IF EXISTS `aps_tasks`;"); + Database::query("DROP TABLE IF EXISTS `aps_temp_settings`;"); + lastStepStatus(0); + + showUpdateStep("Removing backup-module (deprecated)"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_enabled';"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_dir';"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_mysqldump_path';"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_count';"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_bigfile';"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_ftp_enabled';"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_ftp_server';"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_ftp_user';"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_ftp_pass';"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `varname` = 'backup_ftp_passive';"); + Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `backup_allowed`;"); + Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `backup_enabled`;"); + lastStepStatus(0); + + showUpdateStep("Removing autoresponder-module (deprecated)"); + Database::query("DELETE FROM `".TABLE_PANEL_SETTINGS."` WHERE `settinggroup` = 'autoresponder';"); + Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `email_autoresponder`;"); + Database::query("ALTER TABLE `".TABLE_PANEL_ADMINS."` DROP `email_autoresponder_used`;"); + Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `email_autoresponder`;"); + Database::query("ALTER TABLE `".TABLE_PANEL_CUSTOMERS."` DROP `email_autoresponder_used`;"); + Database::query("DROP TABLE IF EXISTS `mail_autoresponder`;"); + lastStepStatus(0); + + updateToVersion('0.9.31-rc99'); +} diff --git a/lib/classes/aps/class.ApsInstaller.php b/lib/classes/aps/class.ApsInstaller.php deleted file mode 100644 index eb6edafb..00000000 --- a/lib/classes/aps/class.ApsInstaller.php +++ /dev/null @@ -1,691 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package APS - * - * @todo logging - * run with user uid/gid - * folder truncation/tar all files - */ - -class ApsInstaller extends ApsParser { - - private $DomainPath = ''; - private $Domain = ''; - private $RealPath = ''; - private $RootDir = ''; - private $Hosts = ''; - private $aps_version = '1.0'; - - /** - * constructor of class. setup some basic variables - * - * @param settings array with the global settings from froxlor - */ - public function __construct($settings) { - - $this->RootDir = dirname(dirname(dirname(dirname(__FILE__)))) . '/'; - $this->Hosts = $settings['system']['mysql_access_host']; - } - - /** - * main function of class which handles all - */ - public function InstallHandler() { - - chdir($this->RootDir); - $result_stmt = Database::query(" - SELECT * FROM `" . TABLE_APS_TASKS . "` AS `t` - INNER JOIN `" . TABLE_APS_INSTANCES . "` AS `i` ON `t`.`InstanceID` = `i`.`ID` - INNER JOIN `" . TABLE_APS_PACKAGES . "` AS `p` ON `i`.`PackageID` = `p`.`ID` - INNER JOIN `" . TABLE_PANEL_CUSTOMERS . "` AS `c` ON `i`.`CustomerID` = `c`.`customerid` - WHERE `TASK` NOT IN (" . TASK_SYSTEM_UPDATE . ", " . TASK_SYSTEM_DOWNLOAD . ") - "); - - while ($Row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { - //check for existing aps xml file - if (!file_exists($this->RootDir . 'packages/' . $Row['Path'] . '/APP-META.xml')) { - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_APS_INSTANCES . "` SET `Status` = " . INSTANCE_ERROR . " WHERE `ID` = :id - "); - Database::pexecute($upd_stmt, array('id' => $Row['InstanceID'])); - continue; - } - - //get contents and parse them - $XmlContent = file_get_contents($this->RootDir . 'packages/' . $Row['Path'] . '/APP-META.xml'); - $Xml = new SimpleXMLElement($XmlContent); - - $this->aps_version = isset($Xml->attributes()->version) ? (string)$Xml->attributes()->version : '1.0'; - - //check for unparseable xml data - if ($Xml == false) { - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_APS_INSTANCES . "` SET `Status` = " . INSTANCE_ERROR . " WHERE `ID` = :id - "); - Database::pexecute($upd_stmt, array('id' => $Row['InstanceID'])); - continue; - } - - $Task = $Row['Task']; - $this->DomainPath = ''; - $this->Domain = ''; - $this->RealPath = ''; - - //lock instance so installation cannot be canceled from the panel - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_APS_INSTANCES . "` SET `Status` = " . INSTANCE_TASK_ACTIVE . " WHERE `ID` = :id - "); - Database::pexecute($upd_stmt, array('id' => $Row['InstanceID'])); - - //setup environment with data for domain/installation location - self::PrepareBasics($Row); - - //create database if necessary and setup environment variables - self::PrepareDatabase($Xml, $Row, $Task); - - //unpack installation scripts and package files if necessary - if (self::PrepareFiles($Xml, $Row, $Task)) { - //setup environment variables fetched from installation wizard - self::PrepareWizardData($Xml, $Row, $Task); - //run installation scripts from packages - self::RunInstaller($Xml, $Row, $Task); - } - - //remove installation scripts - self::CleanupData($Xml, $Row, $Task); - unset($Xml); - } - } - - /** - * run the installation script and log errors if there are some - * - * @param xml instance of a valid xml object with a parsed APP-META.xml file - * @param row current entry from the database for app to handle - * @param task numeric code to specify what to do - * @return success true/error false - */ - private function RunInstaller($Xml, $Row, $Task) { - //installation - - if ($Task == TASK_INSTALL) { - //setup right path and run installation script - if (!is_dir($this->RealPath . $this->DomainPath . '/install_scripts/')) { - echo 'Directory: '. $this->RealPath . $this->DomainPath . '/install_scripts/ does not exist'; - return; - } - - chdir($this->RealPath . $this->DomainPath . '/install_scripts/'); - - // make configure-script executable - if ($this->aps_version != '1.0') { - $scriptname = (string)$Xml->service->provision->{'configuration-script'}['name']; - } else { - $scriptname = 'configure'; - } - - chmod($this->RealPath . $this->DomainPath . '/install_scripts/'.$scriptname, 0755); - - $Return = array(); - - // first 'true' to indicate that we want the return-status from exec. - // after exec() is called, the value will be the return-status of the - // program executed - $ReturnStatus = true; - - $Return = safe_exec('php ' . escapeshellarg($this->RealPath . $this->DomainPath . '/install_scripts/'.$scriptname) . ' install', $ReturnStatus); - - if ($ReturnStatus != 0) { - //write output of script on error into database for admin - $Buffer = ''; - $Count = 0; - foreach ($Return as $Line) { - $Count+= 1; - $Buffer.= $Line; - if ($Count != count($Return)) { - $Buffer.= "\n"; - } - } - - //FIXME error logging - echo ("error : installer\n" . $Buffer . "\n"); - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_APS_INSTANCES . "` SET `Status` = " . INSTANCE_ERROR . " WHERE `ID` = :id - "); - Database::pexecute($upd_stmt, array('id' => $Row['InstanceID'])); - return false; - - } else { - //installation succeeded - //chown all files if installtion script has created some new files. otherwise customers cannot edit the files via ftp - safe_exec('chown -R ' . (int)$Row['guid'] . ':' . (int)$Row['guid'] . ' ' . escapeshellarg($this->RealPath . $this->DomainPath . '/')); - - //update database - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_APS_INSTANCES . "` SET `Status` = " . INSTANCE_SUCCESS . " WHERE `ID` = :id - "); - Database::pexecute($upd_stmt, array('id' => $Row['InstanceID'])); - return true; - } - } - } - - /** - * remove installation scripts from filesystem and remove tasks and update the database - * - * @param xml instance of a valid xml object with a parsed APP-META.xml file - * @param row current entry from the database for app to handle - * @param task numeric code to specify what to do - */ - private function CleanupData($Xml, $Row, $Task) { - - chdir($this->RootDir); - - if ($Task == TASK_INSTALL) { - //cleanup installation - self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/install_scripts/'); - //remove task - $del_stmt = Database::prepare(" - DELETE FROM `" . TABLE_APS_TASKS . "` WHERE `Task` = " . TASK_INSTALL . " AND `InstanceID` = :id - "); - Database::pexecute($del_stmt, array('id' => $Row['InstanceID'])); - - } elseif($Task == TASK_REMOVE) { - - // check for database - if ($this->aps_version == '1.0') { - // the good ole way - $XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db'); - } else { - // since 1.1 - $Xml->registerXPathNamespace('db', 'http://apstandard.com/ns/1/db'); - - $XmlDb = new DynamicProperties; - $XmlDb->db = new DynamicProperties; - $XmlDb->db->id = getXPathValue($Xml, '//db:id'); - } - - if ($XmlDb->db->id) { - //drop database permissions - Database::needRoot(true); -// FIXME ### here - $Database = 'web' . $Row['CustomerID'] . 'aps' . $Row['InstanceID']; - foreach (array_map('trim', explode(',', $this->Hosts)) as $DatabaseHost) { - - if (Database::getAttribute(PDO::ATTR_SERVER_VERSION) < '5.0.2') { - // Revoke privileges (only required for MySQL 4.1.2 - 5.0.1) - $stmt = Database::prepare("REVOKE ALL PRIVILEGES, GRANT OPTION FROM :databasename"); - Database::pexecute($stmt, array("databasename" => $DatabaseHost)); - } - - $host_res_stmt = Database::prepare(" - SELECT `Host` FROM `mysql`.`user` - WHERE `User`= :databasename - "); - Database::pexecute($host_res_stmt, array("databasename" => $DatabaseHost)); - - while ($host = $host_res_stmt->fetch(PDO::FETCH_ASSOC)) { - // as of MySQL 5.0.2 this also revokes privileges. (requires MySQL 4.1.2+) - $stmt = Database::prepare("DROP USER :databasename@:host"); - Database::pexecute($stmt, array("databasename" => $DatabaseHost, "host" => $host['Host'])); - } - } - - // drop database - $stmt = Database::prepare("DROP DATABASE IF EXISTS `" . $DatabaseHost . "`"); - Database::pexecute($stmt, array(), false); - $stmt = Database::prepare("FLUSH PRIVILEGES"); - Database::pexecute($stmt); - Database::needRoot(false); - - // remove database from customer-mysql overview, #272 - $stmt = Database::prepare("DELETE FROM `" . TABLE_PANEL_DATABASES . "` - WHERE `customerid` = :customerid - AND `databasename` = :databasename - AND `apsdb` = '1' - "); - Database::pexecute($stmt, array("customerid" => $Row['CustomerID'], "databasename" => $Database)); - - $stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` - SET `mysqls_used` = `mysqls_used` - 1 - WHERE `customerid` = :customerid" - ); - Database::pexecute($stmt, array("customerid" => $Row['CustomerID'])); - } - - // remove task & delete package instance + settings - $del_stmt = Database::prepare(" - DELETE FROM `" . TABLE_APS_TASKS . "` WHERE `Task` = '" . TASK_REMOVE . "' - AND `InstanceID` = :instanceid - "); - Database::pexecute($del_stmt, array('instanceid' => $Row['InstanceID'])); - - $del_stmt = Database::prepare(" - DELETE FROM `" . TABLE_APS_INSTANCES . "` WHERE `ID` = :instanceid - "); - Database::pexecute($del_stmt, array('instanceid' => $Row['InstanceID'])); - - $del_stmt = Database::prepare(" - DELETE FROM `" . TABLE_APS_SETTINGS . "` WHERE `InstanceID` = :instanceid - "); - Database::pexecute($del_stmt, array('instanceid' => $Row['InstanceID'])); - - if ($this->RealPath != '' - && checkDisallowedPaths($this->RealPath) - ) { - //remove data, #273 - if ($this->DomainPath != '' - && $this->DomainPath != '/' - ) { - self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/'); - } else { - // save awstats/webalizer folder if it's the docroot - self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/', true); - // place standard-index file - $loginname = getLoginNameByUid($Row['CustomerID']); - if ($loginname !== false) { - storeDefaultIndex($loginname, $this->RealPath . $this->DomainPath . '/'); - } - } - } - } - } - - /** - * setup all environment variables from the wizard, they're all needed by the installation script - * - * @param xml instance of a valid xml object with a parsed APP-META.xml file - * @param row current entry from the database for app to handle - * @param task numeric code to specify what to do - */ - private function PrepareWizardData($Xml, $Row, $Task) { - - //data collected by wizard - //FIXME install_only parameter/reconfigure - $result_stmt = Database::prepare(" - SELECT * FROM `" . TABLE_APS_SETTINGS . "` WHERE `InstanceID` = :instanceid - "); - Database::pexecute($result_stmt, array('instanceid' => $Row['InstanceID'])); - - while ($Row2 = $result_stmt->fetch(PDO::FETCH_ASSOC)) { - //skip APS internal data - if ($Row2['Name'] == 'main_location' - || $Row2['Name'] == 'main_domain' - || $Row2['Name'] == 'main_database_password' - || $Row2['Name'] == 'license' - ) { - continue; - } - putenv('SETTINGS_' . $Row2['Name'] . '=' . $Row2['Value']); - } - } - - /** - * extract all needed files from the aps packages - * - * @param xml instance of a valid xml object with a parsed APP-META.xml file - * @param row current entry from the database for app to handle - * @param task numeric code to specify what to do - * @return success true/error false - */ - private function PrepareFiles($Xml, $Row, $Task) { - - if ($this->aps_version != '1.0') { - $mapping = $Xml->service->provision->{'url-mapping'}->mapping; - $mapping_path = $Xml->service->provision->{'url-mapping'}->mapping['path']; - $mapping_url = $Xml->service->provision->{'url-mapping'}->mapping['url']; - } else { - $mapping = $Xml->mapping; - $mapping_path = $Xml->mapping['path']; - $mapping_url = $Xml->mapping['url']; - } - - if ($this->RealPath == '' || !checkDisallowedPaths($this->RealPath)) { - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_APS_INSTANCES . "` SET `Status` = " . INSTANCE_ERROR . " WHERE `ID` = :id - "); - Database::pexecute($upd_stmt, array('id' => $Row['InstanceID'])); - return false; - } - - if ($Task == TASK_INSTALL) { - //FIXME truncate customer directory - //remove files from: $this->RealPath . $this->DomainPath . '/*' - if (!file_exists($this->RealPath . $this->DomainPath . '/')) { - mkdir($this->RealPath . $this->DomainPath . '/', 0777, true); - } - - //extract all files and chown them to the customer guid - if (self::ExtractZip($this->RootDir . 'packages/' . $Row['Path'] . '/' . $Row['Path'], $mapping_path, $this->RealPath . $this->DomainPath . '/') == false - || self::ExtractZip($this->RootDir . 'packages/' . $Row['Path'] . '/' . $Row['Path'], 'scripts', $this->RealPath . $this->DomainPath . '/install_scripts/') == false - ) { - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_APS_INSTANCES . "` SET `Status` = " . INSTANCE_ERROR . " WHERE `ID` = :id - "); - Database::pexecute($upd_stmt, array('id' => $Row['InstanceID'])); - - //FIXME clean up already installed data - //remove files from: $this->RealPath . $this->DomainPath . '/*' - return false; - } - - safe_exec('chown -R ' . (int)$Row['guid'] . ':' . (int)$Row['guid'] . ' ' . escapeshellarg($this->RealPath . $this->DomainPath . '/')); - - } else { - - if (self::ExtractZip($this->RootDir . 'packages/' . $Row['Path'] . '/' . $Row['Path'], 'scripts', $this->RealPath . $this->DomainPath . '/install_scripts/') == false) { - - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_APS_INSTANCES . "` SET `Status` = " . INSTANCE_ERROR . " WHERE `ID` = :id - "); - Database::pexecute($upd_stmt, array('id' => $Row['InstanceID'])); - - //clean up already installed data - self::UnlinkRecursive($this->RealPath . $this->DomainPath . '/install_scripts/'); - return false; - } - - //set right file owner - safe_exec('chown -R ' . (int)$Row['guid'] . ':' . (int)$Row['guid'] . ' ' . escapeshellarg($this->RealPath . $this->DomainPath . '/')); - } - - //recursive mappings - self::PrepareMappings($mapping, $mapping_url, $this->RealPath . $this->DomainPath . '/'); - return true; - } - - /** - * setup path environment variables for the installation script - * - * @param parentmapping instance of parsed xml file, current mapping position - * @param url relative path for application specifying the current path within the mapping tree - * @param path absolute path for application specifying the current path within the mapping tree - */ - private function PrepareMappings($ParentMapping, $Url, $Path) { - - //check for special PHP permissions - //must be done with xpath otherwise check not possible (XML parser problem with attributes) - - if ($ParentMapping && $ParentMapping !== null) { - - $ParentMapping->registerXPathNamespace('p', 'http://apstandard.com/ns/1/php'); - $Result = $ParentMapping->xpath('p:permissions'); - - if (is_array($Result) - && isset($Result[0]) - && is_array($Result[0]) - ) { - if (isset($Result[0]['writable']) - && $Result[0]['writable'] == 'true' - ) { - // fixing file permissions to writeable - if (is_dir($Path)) { - chmod($Path, 0775); - } else { - chmod($Path, 0664); - } - } - - if (isset($Result[0]['readable']) - && $Result[0]['readable'] == 'false' - ) { - //fixing file permissions to non readable - if (is_dir($Path)) { - chmod($Path, 0333); - } else { - chmod($Path, 0222); - } - } - } - } - - //set environment variables - $EnvVariable = str_replace("/", "_", $Url); - putenv('WEB_' . $EnvVariable . '_DIR=' . $Path); - - //resolve deeper mappings - if ($ParentMapping && $ParentMapping !== null) { - foreach ($ParentMapping->mapping as $Mapping) { - //recursive check of other mappings - if ($Url == '/') { - self::PrepareMappings($Mapping, $Url . $Mapping['url'], $Path . $Mapping['url']); - } else { - self::PrepareMappings($Mapping, $Url . '/' . $Mapping['url'], $Path . '/' . $Mapping['url']); - } - } - } - } - - /** - * setup domain environment variables for the installation script - * - * @param xml instance of a valid xml object with a parsed APP-META.xml file - */ - private function PrepareBasics($Row) { - //domain - $result_stmt = Database::prepare(" - SELECT * FROM `" . TABLE_APS_SETTINGS . "` WHERE `InstanceID` = :instanceid AND `Name` = 'main_domain' - "); - $Row3 = Database::pexecute_first($result_stmt, array('instanceid' => $Row['InstanceID'])); - - $result_stmt = Database::prepare(" - SELECT * FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `id` = :domainid - "); - $Row3 = Database::pexecute_first($result_stmt, array('instanceid' => $Row3['Value'])); - $this->Domain = $Row3['domain']; - $this->RealPath = $Row3['documentroot']; - - //location - $result3_stmt = Database::prepare(" - SELECT * FROM `" . TABLE_APS_SETTINGS . "` WHERE `InstanceID` = :instanceid AND `Name` = 'main_location' - "); - $Row3 = Database::pexecute_first($result_stmt, array('instanceid' => $Row['InstanceID'])); - $this->DomainPath = $Row3['Value']; - - //if application is directly installed on domain remove / at the end - if ($this->DomainPath == '') { - $this->RealPath = substr($this->RealPath, 0, strlen($this->RealPath) - 1); - } - - //url environment variables - putenv('BASE_URL_HOST=' . $this->Domain); - putenv('BASE_URL_PATH=' . $this->DomainPath . '/'); - putenv('BASE_URL_SCHEME=http'); - } - - /** - * create a database if necessary and setup environment variables - * - * @param xml instance of a valid xml object with a parsed APP-META.xml file - * @param row current entry from the database for app to handle - * @param task numeric code to specify what to do - */ - private function PrepareDatabase($Xml, $Row, $Task) { - - $XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db'); - - if ($this->aps_version == '1.0') { - // the good ole way - $XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db'); - } else { - // since 1.1 - $Xml->registerXPathNamespace('db', 'http://apstandard.com/ns/1/db'); - - $XmlDb = new DynamicProperties; - $XmlDb->db = new DynamicProperties; - $XmlDb->db->id = getXPathValue($Xml, '//db:id'); - } - - if ($XmlDb->db->id) { - //database management - $NewDatabase = 'web' . $Row['CustomerID'] . 'aps' . $Row['InstanceID']; - $result_stmt = Database::prepare(" - SELECT * FROM `" . TABLE_APS_SETTINGS . "` WHERE `InstanceID` = :instanceid AND `Name` = 'main_database_password' - "); - $Row3 = Database::pexecute_first($result_stmt, array('instanceid' => $Row['InstanceID'])); - $DbPassword = $Row3['Value']; - - if ($Task == TASK_INSTALL) { - Database::needRoot(true); - $drp_stmt = Database::prepare("DROP DATABASE IF EXISTS :newdb"); - Database::pexecute($drp_stmt, array('newdb' => $NewDatabase)); - $crt_stmt = Database::prepare("CREATE DATABASE IF NOT EXISTS :newdb"); - Database::pexecute($crt_stmt, array('newdb' => $NewDatabase)); - - foreach (array_map('trim', explode(',', $this->Hosts)) as $DatabaseHost) { - $stmt = Database::prepare("GRANT ALL PRIVILEGES ON `" . $NewDatabase . "`.* - TO :username@:host - IDENTIFIED BY 'password'" - ); - Database::pexecute($stmt, array("username" => $NewDatabase, "host" => $DatabaseHost)); - $stmt = Database::prepare("SET PASSWORD FOR :username@:host = PASSWORD(:password)"); - Database::pexecute($stmt, array("username" => $NewDatabase, "host" => $DatabaseHost, "password" => $DbPassword)); - } - Database::query('FLUSH PRIVILEGES'); - Database::needRoot(false); - - // add database to customers databases, #272 - $databasedescription = $Xml->name.' '.$Xml->version.' (Release ' . $Xml->release . ')'; - $ins_stmt = Database::prepare(" - INSERT INTO `" . TABLE_PANEL_DATABASES . "` - (`customerid`, `databasename`, `description`, `dbserver`, `apsdb`) - VALUES - (:customerid, :databasename, :desc, '0', '1') - "); - $ins_data = array( - 'customerid' => $Row['CustomerID'], - 'databasename' => $NewDatabase, - 'desc' => $databasedescription - ); - Database::pexecute($ins_stmt, $ins_data); - - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET - `mysqls_used`=`mysqls_used`+1 WHERE `customerid` = :customerid - "); - Database::pexecute($upd_stmt, array('customerid' => $Row['CustomerID'])); - } - - //get first mysql access host - $AccessHosts = array_map('trim', explode(',', $this->Hosts)); - - //environment variables - putenv('DB_' . $XmlDb->db->id . '_TYPE=mysql'); - putenv('DB_' . $XmlDb->db->id . '_NAME=' . $NewDatabase); - putenv('DB_' . $XmlDb->db->id . '_LOGIN=' . $NewDatabase); - putenv('DB_' . $XmlDb->db->id . '_PASSWORD=' . $DbPassword); - putenv('DB_' . $XmlDb->db->id . '_HOST=' . $AccessHosts[0]); - putenv('DB_' . $XmlDb->db->id . '_PORT=3306'); - putenv('DB_' . $XmlDb->db->id . '_VERSION=' . Database::getAttribute(PDO::ATTR_SERVER_VERSION)); - } - } - - /** - * extract complete directories from a zipfile - * - * @param filename path to zipfile to extract - * @param directory which directory in zipfile to extract - * @param destination destination directory for files to extract - * @return success true/error false - */ - private function ExtractZip($Filename, $Directory, $Destination) { - - if (!file_exists($Filename)) { - return false; - } - - // fix slash notation for correct paths - if (substr($Directory, -1, 1) == '/') { - $Directory = substr($Directory, 0, strlen($Directory) - 1); - } - - if (substr($Destination, -1, 1) != '/') { - $Destination.= '/'; - } - - //open zipfile to read its contents - $ZipHandle = zip_open(realpath($Filename)); - - if (is_resource($ZipHandle)) { - - while ($ZipEntry = zip_read($ZipHandle)) { - - if (substr(zip_entry_name($ZipEntry), 0, strlen($Directory)) == $Directory) { - //fix relative path from zipfile - $NewPath = zip_entry_name($ZipEntry); - $NewPath = substr($NewPath, strlen($Directory)); - - //directory - if (substr($NewPath, -1, 1) == '/') { - if(!file_exists($Destination . $NewPath))mkdir($Destination . $NewPath, 0777, true); - } else { - //files - if (zip_entry_open($ZipHandle, $ZipEntry)) { - // handle new directory - $dir = dirname($Destination.$NewPath); - if (!file_exists($dir)) { - mkdir ($dir, 0777, true); - } - - $File = fopen($Destination . $NewPath, "wb"); - - if ($File) { - while ($Line = zip_entry_read($ZipEntry)) { - fwrite($File, $Line); - } - fclose($File); - } else { - return false; - } - } - } - } - } - - zip_close($ZipHandle); - return true; - - } else { - - $ReturnLines = array(); - - // first 'true' to indicate that we want the return-status from exec. - // after exec() is called, the value will be the return-status of the - // program executed - $ReturnVal = true; - - - //on 64 bit systems the zip functions can fail -> use exec to extract the files - $ReturnLines = safe_exec('unzip -o -qq ' . escapeshellarg(realpath($Filename)) . ' ' . escapeshellarg($Directory . '/*') . ' -d ' . escapeshellarg(sys_get_temp_dir()), $ReturnVal); - - if ($ReturnVal == 0) { - //fix absolute structure of extracted data - if (!file_exists($Destination)) { - mkdir($Destination, 0777, true); - } - safe_exec('cp -Rf ' . sys_get_temp_dir() . '/' . $Directory . '/*' . ' ' . escapeshellarg($Destination)); - self::UnlinkRecursive(sys_get_temp_dir() . '/' . $Directory . '/'); - return true; - } else { - return false; - } - } - return false; - } -} diff --git a/lib/classes/aps/class.ApsParser.php b/lib/classes/aps/class.ApsParser.php deleted file mode 100644 index 2de3eb2d..00000000 --- a/lib/classes/aps/class.ApsParser.php +++ /dev/null @@ -1,3281 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package APS - * - * @todo implement charset validation - * reconfigure - * patch- and versionmanagement - * use settings/userinfo array instead a copy of this vars - * remove locked packages - * replace all html code - * add https support - * multi language support (package localization) - * zip stuff in own class - * logging - * button for remove of all failed installations - * increse database counter for customer - */ - -class ApsParser { - - private $userinfo = array(); - private $settings = array(); - private $RootDir = ''; - private $aps_version = '1.0'; - - /** - * Constructor of class, setup basic variables needed by the class - * - * @param userinfo global array with the current userinfos - * @param settings global array with the current system settings - * @param db valid instance of the database class - */ - public function __construct($userinfo, $settings) { - $this->settings = $settings; - $this->userinfo = $userinfo; - $this->RootDir = dirname(dirname(dirname(dirname(__FILE__)))) . '/'; - } - - /** - * function provides instance management for admins - */ - private function ManageInstances() { - - global $lng, $filename, $s, $page, $action, $theme; - $Question = false; - - //dont do anything if there is no instance - if ((int)$this->userinfo['customers_see_all'] == 1) { - $Instances_stmt = Database::query("SELECT * FROM `" . TABLE_APS_INSTANCES . "` AS `i` INNER JOIN `" . TABLE_APS_PACKAGES . "` AS `p` ON `i`.`PackageID` = `p`.`ID`"); - } else { - $Instances_stmt = Database::prepare(" - SELECT * FROM `" . TABLE_APS_INSTANCES . "` AS `i` INNER JOIN `" . TABLE_APS_PACKAGES . "` AS `p` ON `i`.`PackageID` = `p`.`ID` - INNER JOIN `" . TABLE_PANEL_CUSTOMERS . "` AS `c` ON `i`.`CustomerID` = `c`.`customerid` WHERE `c`.`adminid` = :adminid - "); - Database::pexecute($Instances_stmt, array('adminid' => $this->userinfo['adminid'])); - } - - if (Database::num_rows() == 0) { - self::InfoBox($lng['aps']['noinstancesexisting']); - return; - } - - if (isset($_POST['save'])) { - - $Ids = ''; - $Result_stmt = Database::query("SELECT * FROM `" . TABLE_APS_INSTANCES . "`"); - - while ($Row = $Result_stmt->fetch(PDO::FETCH_ASSOC)) { - //has admin clicked "yes" for question - if (isset($_POST['answer']) - && $_POST['answer'] == $lng['panel']['yes'] - ) { - //instance installation stop - if (isset($_POST['stop' . $Row['ID']]) - && $_POST['stop' . $Row['ID']] == '1' - ) { - //remove task - $del_stmt = Database::prepare(" - DELETE FROM `" . TABLE_APS_TASKS . "` WHERE `InstanceID` = :instanceid - "); - Database::pexecute($del_stmt, array('instanceid' => $Row['ID'])); - - //remove settings - $del_stmt = Database::prepare(" - DELETE FROM `" . TABLE_APS_SETTINGS . "` WHERE `InstanceID` = :instanceid - "); - Database::pexecute($del_stmt, array('instanceid' => $Row['ID'])); - - //remove instance - $del_stmt = Database::prepare(" - DELETE FROM `" . TABLE_APS_INSTANCES . "` WHERE `ID` = :instanceid - "); - Database::pexecute($del_stmt, array('instanceid' => $Row['ID'])); - - //decrease used flag - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `aps_packages_used` = `aps_packages_used` - 1 - WHERE `customerid` = :customerid - "); - Database::pexecute($upd_stmt, array('customerid' => $Row['CustomerID'])); - } - - //instance uninstallation - if (isset($_POST['remove' . $Row['ID']]) - && $_POST['remove' . $Row['ID']] == '1' - ) { - //remove installation task if it still exists - $del_stmt = Database::prepare(" - DELETE FROM `" . TABLE_APS_TASKS . "` WHERE `InstanceID` = :instanceid AND `Task` = " . TASK_INSTALL . " - "); - Database::pexecute($del_stmt, array('instanceid' => $Row['ID'])); - - //insert task for uninstallation if it doesnt exists already - $Result2_stmt = Database::prepare(" - SELECT * FROM `" . TABLE_APS_TASKS . "` WHERE `InstanceID` = :instanceid AND `Task` = " . TASK_REMOVE . " - "); - Database::pexecute($del_stmt, array('instanceid' => $Row['ID'])); - - if (Database::num_rows() == 0) { - $ins_stmt = Database::prepare(" - INSERT INTO `" . TABLE_APS_TASKS . "` SET - `InstanceID` = :instanceid, - `Task` = ".TASK_REMOVE - ); - Database::pexecute($ins_stmt, array($Row['ID'])); - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_APS_INSTANCES . "` SET `Status` = " . INSTANCE_UNINSTALL . " WHERE `ID` = :id - "); - Database::pexecute($upd_stmt, array('id' => $Row['ID'])); - $upd_stmt = Database::prepare(" - UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `aps_packages_used` = `aps_packages_used` - 1 - WHERE `customerid` = :customerid - "); - Database::pexecute($upd_stmt, array('customerid' => $Row['CustomerID'])); - } - } - - } else { - - //backup all selected ids for yes/no question - if (isset($_POST['stop' . $Row['ID']]) - && $_POST['stop' . $Row['ID']] == '1' - ) { - $Ids .= ''; - } - - if (isset($_POST['remove' . $Row['ID']]) - && $_POST['remove' . $Row['ID']] == '1' - ) { - $Ids .= ''; - } - } - } - - //if there are some ids, show yes/no question - if ($Ids != '' && !isset($_POST['answer'])) { - //show yes/no question - $Message = $lng['question']['reallydoaction']; - eval("echo \"" . getTemplate("aps/askyesno") . "\";"); - $Question = true; - } - } - - //create table with contents based on instance status - if ($Question != true) { - - global $settings, $theme; - $Instances = ''; - - if ((int)$this->userinfo['customers_see_all'] == 1) { - $Result_stmt = Database::query('SELECT `p`.`Name`, `p`.`Version`, `p`.`Release`, `i`.`Status`, `i`.`PackageID`, `i`.`ID`, `i`.`CustomerID`, `c`.`name`, `c`.`firstname`, `c`.`company`, `c`.`loginname` FROM `' . TABLE_APS_INSTANCES . '` AS `i` INNER JOIN `' . TABLE_APS_PACKAGES . '` AS `p` ON `i`.`PackageID` = `p`.`ID` INNER JOIN `' . TABLE_PANEL_CUSTOMERS . '` AS `c` ON `i`.`CustomerID` = `c`.`customerid` ORDER BY i.`Status`, p.`Version`, p.`Release`, i.`CustomerID`'); - } else { - $Result_stmt = Database::prepare('SELECT `p`.`Name`, `p`.`Version`, `p`.`Release`, `i`.`Status`, `i`.`PackageID`, `i`.`ID`, `i`.`CustomerID` FROM `' . TABLE_APS_INSTANCES . '` AS `i` INNER JOIN `' . TABLE_APS_PACKAGES . '` AS `p` ON `i`.`PackageID` = `p`.`ID` INNER JOIN `' . TABLE_PANEL_CUSTOMERS . '` AS `c` ON `i`.`CustomerID` = `c`.`customerid` WHERE `c`.`adminid` = :adminid ORDER BY i.`Status`, p.`Version`, p.`Release`, i.`CustomerID`'); - Database::pexecute($Result_stmt, array('adminid' => $this->userinfo['adminid'])); - } - - $lastState = 0; - $lastPackage = 0; - - while ($Row = $Result_stmt->fetch(PDO::FETCH_ASSOC)) { - - if ($lastState != $Row['Status']) { - - switch ($Row['Status']) - { - case INSTANCE_INSTALL: - $Caption = $lng['aps']['instance_install']; - break; - case INSTANCE_TASK_ACTIVE: - $Caption = $lng['aps']['instance_task_active']; - break; - case INSTANCE_SUCCESS: - $Caption = $lng['aps']['instance_success']; - break; - case INSTANCE_ERROR: - $Caption = $lng['aps']['instance_error']; - break; - case INSTANCE_UNINSTALL: - $Caption = $lng['aps']['instance_uninstall']; - break; - } - eval("\$Instances.=\"" . getTemplate("aps/manage_instances_status") . "\";"); - $lastState = $Row['Status']; - //we need to print the package header for the new State as well it can be that the last Package is the first in this section, so we would it ignore it otherwise - $lastPackage = 0; - } - - if (strcmp($lastPackage, $Row['Name'].$Row['Version']. '(Release ' . $Row['Release'] . ')')) { - $lastPackage = $Row['Name'].$Row['Version']. '(Release ' . $Row['Release'] . ')'; - eval("\$Instances.=\"" . getTemplate("aps/manage_instances_package") . "\";"); - } - - $main_domain = $this->GetSettingValue($Row['ID'], 'main_domain'); - $main_location = $this->GetSettingValue($Row['ID'], 'main_location'); - $Result2_stmt = Database::prepare('SELECT `domain` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `id` = :maindomain'); - $Row2 = Database::pexecute_first($Result2_stmt, array('maindomain' => $main_domain)); - - $main_domain = $Row2['domain'] . '/' . $main_location; - - $database = $settings['customer']['accountprefix'] . $Row['CustomerID'] . 'aps' . $Row['ID']; - - switch ($Row['Status']) - { - case INSTANCE_INSTALL: - $Stop = makecheckbox('stop' . $Row['ID'], '', '1'); - break; - case INSTANCE_TASK_ACTIVE: - break; - case INSTANCE_SUCCESS: - $Remove = makecheckbox('remove' . $Row['ID'], '', '1'); - break; - case INSTANCE_ERROR: - $Remove = makecheckbox('remove' . $Row['ID'], '', '1'); - break; - case INSTANCE_UNINSTALL: - break; - } - eval("\$Instances.=\"" . getTemplate("aps/manage_instances_detail") . "\";"); - } - - //create some statistics - $Statistics = ''; - - if ((int)$this->userinfo['customers_see_all'] == 1) { - $Result = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '`'); - $Statistics.= sprintf($lng['aps']['numerofinstances'], Database::num_rows()); - $Result = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `Status` = ' . INSTANCE_SUCCESS); - $Statistics.= sprintf($lng['aps']['numerofinstancessuccess'], Database::num_rows()); - $Result = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `Status` = ' . INSTANCE_ERROR); - $Statistics.= sprintf($lng['aps']['numerofinstanceserror'], Database::num_rows()); - $Result = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `Status` IN (' . INSTANCE_INSTALL . ', ' . INSTANCE_TASK_ACTIVE . ', ' . INSTANCE_UNINSTALL . ')'); - $Statistics.= sprintf($lng['aps']['numerofinstancesaction'], Database::num_rows()); - } else { - $Result = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` AS `i` INNER JOIN `' . TABLE_PANEL_CUSTOMERS . '` AS `c` ON `i`.`CustomerID` = `c`.`customerid` WHERE `c`.`adminid` = ' . (int)$this->userinfo['adminid']); - $Statistics.= sprintf($lng['aps']['numerofinstances'], Database::num_rows()); - $Result = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` AS `i` INNER JOIN `' . TABLE_PANEL_CUSTOMERS . '` AS `c` ON `i`.`CustomerID` = `c`.`customerid` WHERE `c`.`adminid` = ' . (int)$this->userinfo['adminid'] . ' AND `Status` = ' . INSTANCE_SUCCESS); - $Statistics.= sprintf($lng['aps']['numerofinstancessuccess'], Database::num_rows()); - $Result = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` AS `i` INNER JOIN `' . TABLE_PANEL_CUSTOMERS . '` AS `c` ON `i`.`CustomerID` = `c`.`customerid` WHERE `c`.`adminid` = ' . (int)$this->userinfo['adminid'] . ' AND `Status` = ' . INSTANCE_ERROR); - $Statistics.= sprintf($lng['aps']['numerofinstanceserror'], Database::num_rows()); - $Result = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` AS `i` INNER JOIN `' . TABLE_PANEL_CUSTOMERS . '` AS `c` ON `i`.`CustomerID` = `c`.`customerid` WHERE `c`.`adminid` = ' . (int)$this->userinfo['adminid'] . ' AND `Status` IN (' . INSTANCE_INSTALL . ', ' . INSTANCE_TASK_ACTIVE . ', ' . INSTANCE_UNINSTALL . ')'); - $Statistics.= sprintf($lng['aps']['numerofinstancesaction'], Database::num_rows()); - } - - eval("echo \"" . getTemplate("aps/manage_instances") . "\";"); - } - } - - /** - * unlink files recursively - * - * @param dir directory to delete recursive - * @param boolean whether the base-directory should be kept or not - */ - protected function UnlinkRecursive($Dir, $save_base = false) { - - if (!$DirHandle = @opendir($Dir)) { - return; - } - - while (false !== ($Object = readdir($DirHandle))) { - - if ($Object == '.' || $Object == '..') { - continue; - } - - if ($save_base && (strtoupper($Object) == 'AWSTATS' || strtoupper($Object) == 'WEBALIZER')) { - continue; - } - - if (!@unlink($Dir . '/' . $Object)) { - self::UnlinkRecursive($Dir . '/' . $Object); - } - } - - closedir($DirHandle); - if (!$save_base) { - @rmdir($Dir); - } - } - - /** - * function provides package management for admins - */ - private function ManagePackages() { - - global $lng, $filename, $s, $page, $action, $theme; - $Question = false; - - if(isset($_POST['save'])) - { - if(isset($_POST['all']) - && $_POST['all'] == 'lock') - { - //lock alle packages - Database::query('UPDATE `' . TABLE_APS_PACKAGES . '` SET `Status` = ' . PACKAGE_LOCKED . ' WHERE 1'); - } - elseif(isset($_POST['all']) - && $_POST['all'] == 'unlock') - { - //enable all packages - Database::query('UPDATE `' . TABLE_APS_PACKAGES . '` SET `Status` = ' . PACKAGE_ENABLED . ' WHERE 1'); - } - elseif(isset($_POST['downloadallpackages'])) - { - $Result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_TASKS . '` WHERE `Task` = ' . TASK_SYSTEM_DOWNLOAD); - - if (Database::num_rows() > 0) { - self::InfoBox($lng['aps']['downloadtaskexists']); - } else { - Database::query('INSERT INTO `' . TABLE_APS_TASKS . '` (`Task`, `InstanceID`) VALUES (' . TASK_SYSTEM_DOWNLOAD . ', 0)'); - self::InfoBox($lng['aps']['downloadtaskinserted']); - } - } - elseif(isset($_POST['updateallpackages'])) - { - $Result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_TASKS . '` WHERE `Task` = ' . TASK_SYSTEM_UPDATE); - - if (Database::num_rows() > 0) { - self::InfoBox($lng['aps']['updatetaskexists']); - } else { - Database::query('INSERT INTO `' . TABLE_APS_TASKS . '` (`Task`, `InstanceID`) VALUES (' . TASK_SYSTEM_UPDATE . ', 0)'); - self::InfoBox($lng['aps']['updatetaskinserted']); - } - } - elseif(isset($_POST['enablenewest'])) - { - //lock alle packages, then find newerst package and enable it - Database::query('UPDATE `' . TABLE_APS_PACKAGES . '` SET `Status` = ' . PACKAGE_LOCKED); - - //get all packages - $Result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` GROUP BY `Name`'); - - while ($Row = $Result_stmt->fetch(PDO::FETCH_ASSOC)) { - //get newest version of package - $NewestVersion = ''; - $NewestId = ''; - $Result2_stmt = Database::prepare('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Name` = :name'); - Database::pexecute($Result2_stmt, array('name' => $Row['Name'])); - - while ($Row2 = $Result2_stmt->fetch(PDO::FETCH_ASSOC)) { - if (version_compare($Row2['Version'] . '-' . $Row2['Release'], $NewestVersion) == 1) { - $NewestVersion = $Row2['Version'] . '-' . $Row2['Release']; - $NewestId = $Row2['ID']; - } - } - - //enable newest version - Database::query('UPDATE `' . TABLE_APS_PACKAGES . '` SET `Status` = ' . PACKAGE_ENABLED . ' WHERE `ID` = ' . $NewestId); - } - } - elseif(isset($_POST['removeunused'])) - { - //remove all packages which have no dependencies (count of package instances = 0) - if(isset($_POST['answer']) - && $_POST['answer'] == $lng['panel']['yes']) - { - //get all packages - $Result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '`'); - - while ($Row = $Result_stmt->fetch(PDO::FETCH_ASSOC)) { - //query how often package has been installed - $Result2_stmt = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `PackageID` = ' . $Row['ID']); - - if (Database::num_rows() == 0) { - //remove package if number of package instances is 0 - self::UnlinkRecursive('./packages/' . $Row['Path']); - Database::query('DELETE FROM `' . TABLE_APS_PACKAGES . '` WHERE `ID` = ' . $Row['ID']); - } - } - } - else - { - //show yes/no question - $Message = $lng['question']['reallyremovepackages']; - $Ids = ''; - eval("echo \"" . getTemplate("aps/askyesno") . "\";"); - $Question = true; - } - } - elseif(isset($_POST['all']) - && $_POST['all'] == 'remove') - { - //remove all packages from system - if(isset($_POST['answer']) - && $_POST['answer'] == $lng['panel']['yes']) - { - $Result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '`'); - - //check for dependencies - while ($Row = $Result_stmt->fetch(PDO::FETCH_ASSOC)) { - //query how often package has been installed - $Result2_stmt = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `PackageID` = ' . $Row['ID']); - - if (Database::num_rows() == 0) { - //remove package if number of package instances is 0 - self::UnlinkRecursive('./packages/' . $Row['Path']); - Database::query('DELETE FROM `' . TABLE_APS_PACKAGES . '` WHERE `ID` = ' . $Row['ID']); - } - } - } - else - { - //show yes/no question - $Message = $lng['question']['reallyremovepackages']; - $Ids = ''; - eval("echo \"" . getTemplate("aps/askyesno") . "\";"); - $Question = true; - } - } - else - { - //no special button or "all" function has been clicked - //continue to parse "single" options - $Result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '`'); - $Ids = ''; - - while ($Row = $Result_stmt->fetch(PDO::FETCH_ASSOC)) { - //set new status of package (locked) - if($Row['Status'] == PACKAGE_ENABLED - && isset($_POST['lock' . $Row['ID']])) - { - Database::query('UPDATE `' . TABLE_APS_PACKAGES . '` SET `Status` = ' . PACKAGE_LOCKED . ' WHERE `ID` = ' . (int)$Row['ID']); - } - - //set new status of package (enabled) - if($Row['Status'] == PACKAGE_LOCKED - && isset($_POST['unlock' . $Row['ID']])) - { - Database::query('UPDATE `' . TABLE_APS_PACKAGES . '` SET `Status` = ' . PACKAGE_ENABLED . ' WHERE `ID` = ' . (int)$Row['ID']); - } - - //save id of package to remove for yes/no question - if(isset($_POST['remove' . $Row['ID']])) - { - $Ids.= ''; - - //remove package if answer is yes - if(isset($_POST['answer']) - && $_POST['answer'] == $lng['panel']['yes']) - { - self::UnlinkRecursive('./packages/' . $Row['Path']); - Database::query('DELETE FROM `' . TABLE_APS_PACKAGES . '` WHERE `ID` = ' . (int)$Row['ID']); - } - } - } - - //if there are some ids to remove, show yes/no box - if($Ids != '' - && !isset($_POST['answer'])) - { - //show yes/no question - $Message = $lng['question']['reallyremovepackages']; - eval("echo \"" . getTemplate("aps/askyesno") . "\";"); - $Question = true; - } - } - } - - //show package overview with options - if(!isset($_POST['save']) - || $Question == false) - { - //query all packages grouped by package name - $Result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` GROUP BY `Name` ORDER BY `Name` ASC'); - $Packages = ''; - $result_numrows = Database::num_rows(); - - while ($Row = $Result_stmt->fetch(PDO::FETCH_ASSOC)) { - - eval("\$Packages.=\"" . getTemplate("aps/manage_packages_row") . "\";"); - - //get all package versions of current package - $Result2_stmt = Database::prepare('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Name` = :name ORDER BY `Version` DESC, `Release` DESC'); - Database::pexecute($Result2_stmt, array('name' => $Row['Name'])); - - while ($Row2 = $Result2_stmt->fetch(PDO::FETCH_ASSOC)) { - //show package with options - $Lock = ''; - $Unlock = ''; - - if($Row2['Status'] == PACKAGE_ENABLED) - { - $Lock = makecheckbox('lock' . $Row2['ID'], '', '1'); - } - - if($Row2['Status'] == PACKAGE_LOCKED) - { - $Unlock = makecheckbox('unlock' . $Row2['ID'], '', '1'); - } - - //query how often package has been installed - $Result3_stmt = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `PackageID` = ' . (int)$Row2['ID']); - $Installations = Database::num_rows(); - - if($Installations == 0)$Remove = makecheckbox('remove' . $Row2['ID'], '', '1'); - eval("\$Packages.=\"" . getTemplate("aps/manage_packages_detail") . "\";"); - } - } - - if ($result_numrows == 0) { - //no packages have been installed in system - self::InfoBox($lng['aps']['nopackagesinsystem']); - eval("echo \"" . getTemplate("aps/manage_packages_download") . "\";"); - } - else - { - //generate some statistics - $Result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '`'); - $Temp = Database::num_rows(); - $Statistics = sprintf($lng['aps']['numerofpackagesinstalled'], $Temp); - $Result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Status` = ' . PACKAGE_ENABLED); - $Temp2 = Database::num_rows(); - $Statistics.= sprintf($lng['aps']['numerofpackagesenabled'], $Temp2); - $Statistics.= sprintf($lng['aps']['numerofpackageslocked'], $Temp - $Temp2); - - if ((int)$this->userinfo['customers_see_all'] == 1) { - $Result = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '`'); - $Statistics.= sprintf($lng['aps']['numerofinstances'], Database::num_rows()); - } - else - { - $Result = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` AS `i` INNER JOIN `' . TABLE_PANEL_CUSTOMERS . '` AS `c` ON `i`.`CustomerID` = `c`.`customerid` WHERE `c`.`adminid` = ' . (int)$this->userinfo['adminid']); - $Statistics.= sprintf($lng['aps']['numerofinstances'], Database::num_rows()); - } - - eval("echo \"" . getTemplate("aps/manage_packages") . "\";"); - } - } - } - - /** - * function provides a upload site for new packages - */ - private function UploadNewPackages() { - - global $lng, $filename, $s, $page, $action, $theme; - - //define how many files can be uploaded at once - $Files = array(); - - //define how many upload fields will be shown - for ($i = 1;$i <= (int)$this->settings['aps']['upload_fields'];$i++) { - $Files[] = 'file' . $i; - } - - //check whether one file has been uploaded - $FilesSet = false; - foreach ($Files as $File) { - if(isset($_FILES[$File]))$FilesSet = true; - } - - if ($FilesSet == true) { - //any file has been uploaded, now check for errors and parse the input - foreach ($Files as $File){ - - if (isset($_FILES[$File])) { - - $Errors = array(); - - //check uploaded files against some things - //check for filetype - if(substr($_FILES[$File]['name'], -3) != 'zip' - && $_FILES[$File]['error'] == 0) - { - $Errors[] = $lng['aps']['notazipfile']; - } - - //check for filesize - if(($_FILES[$File]['size'] > self::PhpMemorySizeToBytes(ini_get('upload_max_filesize')) && $_FILES[$File]['error'] == 0) - || $_FILES[$File]['error'] == 1) - { - $Errors[] = $lng['aps']['filetoobig']; - } - - //check is file isnt complete - if($_FILES[$File]['error'] == 3) - { - $Errors[] = $lng['aps']['filenotcomplete']; - } - - //check for other php internal errors - if($_FILES[$File]['error'] >= 6) - { - $Errors[] = $lng['aps']['phperror'] . (int)$_FILES[$File]['error']; - } - - //all checks are ok, try to install the package - if(count($Errors) == 0 - && $_FILES[$File]['error'] == 0) - { - //install package in system - if(move_uploaded_file($_FILES[$File]['tmp_name'], './temp/' . basename($_FILES[$File]['name'])) == true) - { - self::InstallNewPackage('./temp/' . basename($_FILES[$File]['name'])); - } - else - { - $moveproblem = str_replace('{$path}', $this->RootDir, $lng['aps']['moveproblem']); - $Errors[] = $moveproblem; - } - } - - if(count($Errors) > 0) - { - //throw errors - $ErrorMessage = ''; - foreach($Errors as $Error) - { - $ErrorMessage.= '
  • ' . $Error . '
  • '; - } - - self::InfoBox(sprintf($lng['aps']['uploaderrors'], htmlspecialchars($_FILES[$File]['name']), $ErrorMessage)); - } - } - } - } - - //generate upload fields - $Output = ''; - foreach($Files as $File) - { - $Output.= '

    '; - } - - eval("echo \"" . getTemplate("aps/upload") . "\";"); - } - - /** - * function provides a frontend for customers to search packages - */ - private function SearchPackages() { - - global $lng, $filename, $s, $page, $action, $theme; - $Error = 0; - $Ids = array(); - $ShowAll = 0; - - if(isset($_GET['keyword']) - && preg_match('/^[- _0-9a-z\.,:;]+$/i', $_GET['keyword']) != false) - { - //split all keywords - $Elements = preg_split('/[ ,;]/', trim($_GET['keyword'])); - - if(count($Elements) == 1 - && strlen($Elements[0]) == 0) - { - //no keyword given -> show all packages - $ShowAll = 1; - } - else - { - foreach($Elements as $Key) - { - //skip empty values -> prevents that whitespaces lead to the result that all packages will be found - if ($Key == '') { - continue; - } - $result_stmt = Database::prepare(" - SELECT * FROM `" . TABLE_APS_PACKAGES . "` WHERE - `Status` = " . PACKAGE_ENABLED . " - AND (`Name` LIKE :key OR `Path` LIKE :key OR `Version` LIKE :key) - "); - Database::pexecute($result_stmt, array('key' => '%'.$Key.'%')); - - //check if keyword got a result - if (Database::num_rows() > 0) { - //add all package ids which match to result array - while ($Temp = $result_stmt->fetch(PDO::FETCH_ASSOC)) { - if (!in_array($Temp['ID'], $Ids)) { - $Ids[] = $Temp['ID']; - } - } - } - } - - //no matches found to given keywords - if (count($Ids) == 0) { - $Error = 2; - } - } - } - elseif(isset($_GET['keyword']) - && strlen($_GET['keyword']) != 0) - { - //input contains illegal characters - $Error = 1; - } - elseif(isset($_GET['keyword']) - && strlen($_GET['keyword']) == 0) - { - //nothing has been entered - show all packages - $ShowAll = 1; - } - - //show errors - if ($Error == 1) { - self::InfoBox($lng['aps']['nospecialchars'], 1); - } elseif($Error == 2) { - self::InfoBox($lng['aps']['noitemsfound']); - } - - //show keyword only if format is ok - $Keyword = ''; - - if (isset($_GET['keyword']) && $Error == 0) { - $Keyword = htmlspecialchars($_GET['keyword']); - } - eval("echo \"" . getTemplate("aps/search") . "\";"); - - //show results - if (($Error == 0 && count($Ids) > 0) || $ShowAll == 1) { - - //run query based on search results - if ($ShowAll != 1) { - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `ID` IN (' . implode(',', $Ids) . ')'); - } else { - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Status` = ' . PACKAGE_ENABLED); - } - - $numrows = Database::num_rows(); - //show package infos - if ($numrows> 0) { - - if ($numrows == 1) { - self::InfoBox(sprintf($lng['aps']['searchoneresult'], $numrows), 2); - } else { - self::InfoBox(sprintf($lng['aps']['searchmultiresult'], $numrows), 2); - } - - while ($Row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { - self::ShowPackageInfo($Row['ID']); - } - } - } - } - - /** - * function provides a frontend for customers to show the status of installed packages - * - * @param customerid id of customer from database - */ - private function CustomerStatus($CustomerId) { - - global $lng, $filename, $s, $page, $action, $theme; - - $Data = ''; - $Fieldname = ''; - $Fieldvalue = ''; - $Groupname = ''; - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `CustomerID` = ' . (int)$CustomerId); - - //customer hasnt installed any package yet - if (Database::num_rows() == 0) { - self::InfoBox($lng['aps']['nopackagesinstalled']); - return; - } - - while ($Row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { - - $Data = ''; - $result2_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `ID` = ' . (int)$Row['PackageID']); - $Row2 = $result2_stmt->fetch(PDO::FETCH_ASSOC); - $Xml = self::GetXmlFromFile('./packages/' . $Row2['Path'] . '/APP-META.xml'); - - //skip if parse of xml has failed - if($Xml == false) { - continue; - } - $Icon = 'templates/'.$theme.'/assets/img/default.png'; - $this->aps_version = isset($Xml->attributes()->version) ? (string)$Xml->attributes()->version : '1.0'; - - //show data and status of package - if ($this->aps_version != '1.0') { - $iconpath = $Xml->presentation->icon['path']; - $Summary = htmlspecialchars($Xml->presentation->summary); - } else { - $iconpath = $Xml->icon['path']; - $Summary = htmlspecialchars($Xml->summary); - } - - if ($iconpath) { - $Icon = './packages/' . $Row2['Path'] . '/' . basename($iconpath); - } - - $Fieldname = $lng['aps']['version']; - $Fieldvalue = $Xml->version . ' (Release ' . $Xml->release . ')'; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - $Temp = ''; - - switch($Row['Status']) - { - case INSTANCE_INSTALL: - $Temp.= $lng['aps']['instance_install']; - break; - case INSTANCE_TASK_ACTIVE: - $Temp.= $lng['aps']['instance_task_active']; - break; - case INSTANCE_SUCCESS: - $Temp.= $lng['aps']['instance_success']; - break; - case INSTANCE_ERROR: - $Temp.= $lng['aps']['instance_error']; - break; - case INSTANCE_UNINSTALL: - $Temp.= $lng['aps']['instance_uninstall']; - break; - default: - $Temp.= $lng['aps']['unknown_status']; - break; - } - - $Fieldname = $lng['aps']['currentstatus']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - $result2_stmt = Database::query('SELECT * FROM `' . TABLE_APS_TASKS . '` WHERE `InstanceID` = ' . (int)$Row['ID']); - $Temp = ''; - - if (Database::num_rows() > 0) { - - while ($Row2 = $result2_stmt->fetch(PDO::FETCH_ASSOC)) { - switch($Row2['Task']) - { - case TASK_INSTALL: - $Temp.= $lng['aps']['task_install'] . '
    '; - break; - case TASK_REMOVE: - $Temp.= $lng['aps']['task_remove'] . '
    '; - break; - case TASK_RECONFIGURE: - $Temp.= $lng['aps']['task_reconfigure'] . '
    '; - break; - case TASK_UPGRADE: - $Temp.= $lng['aps']['task_upgrade'] . '
    '; - break; - default: - $Temp.= $lng['aps']['unknown_status'] . '
    '; - break; - } - } - } - else - { - $Temp.= $lng['aps']['no_task']; - } - - $Fieldname = $lng['aps']['activetasks']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - - //show entrypoints for application (important URLs within the application) - if ($Row['Status'] == INSTANCE_SUCCESS) { - - $Temp = ''; - - //get domain to domain id - $result3_stmt = Database::query('SELECT * FROM `' . TABLE_APS_SETTINGS . '` WHERE `Name` = "main_domain" AND `InstanceID` = ' . (int)$Row['ID']); - $Row3 = $result3_stmt->fetch(PDO::FETCH_ASSOC); - $result4_stmt = Database::query('SELECT * FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `customerid` = ' . (int)$CustomerId . ' AND `id` = ' . (int)$Row3['Value']); - $Row3 = $result4_stmt->fetch(PDO::FETCH_ASSOC); - $Domain = $Row3['domain']; - - //get sub location for domain - $result5_stmt = Database::query('SELECT * FROM `' . TABLE_APS_SETTINGS . '` WHERE `Name` = "main_location" AND `InstanceID` = ' . (int)$Row['ID']); - $Row3 = $result5_stmt->fetch(PDO::FETCH_ASSOC); - $Location = $Row3['Value']; - - //show main site link - if ($Location == '') { - $Temp.= '' . $lng['aps']['mainsite'] . '
    '; - } else { - $Temp.= '' . $lng['aps']['mainsite'] . '
    '; - } - - //show other links from meta data - if ($Xml->{'entry-points'}) { - foreach ($Xml->{'entry-points'}->entry as $Entry) { - if ($Location == '') { - $Temp.= '' . $Entry->label . '
    '; - } else { - $Temp.= '' . $Entry->label . '
    '; - } - } - } - - $Fieldname = $lng['aps']['applicationlinks']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - - eval("echo \"" . getTemplate("aps/package_status") . "\";"); - unset($Xml); - } - } - - /** - * function creates a new instance of a package based on the installer data - * - * @param packageid id of package from database - * @param customerid id of customer from database - * @return success true/error false - */ - private function CreatePackageInstance($PackageId, $CustomerId) { - - global $lng, $theme; - - if (!self::IsValidPackageId($PackageId, true)) { - return false; - } - - //has user pressed F5/reload? - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_TEMP_SETTINGS . '` WHERE `CustomerID` = ' . (int)$CustomerId); - - if (Database::num_rows() == 0) { - self::InfoBox($lng['aps']['erroronnewinstance'], 1); - return false; - } - - //get path to package xml file - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `ID` = ' . (int)$PackageId); - $Row = $result_stmt->fetch(PDO::FETCH_ASSOC); - $Xml = self::GetXmlFromFile('./packages/' . $Row['Path'] . '/APP-META.xml'); - - //return if parse of xml file has failed - if ($Xml == false) { - return false; - } - - //add new instance - $ins_stmt = Database::prepare(" - INSERT INTO `" . TABLE_APS_INSTANCES . "` - (`CustomerID`, `PackageID`, `Status`) - VALUES - (:cid, :pid, " . INSTANCE_INSTALL . ") - "); - Database::pexecute($ins_stmt, array('cid' => $CustomerId, 'pid' => $PackageId)); - - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `CustomerID` = ' . (int)$CustomerId . ' AND `PackageID` = ' . (int)$PackageId . ' AND `Status` = ' . INSTANCE_INSTALL . ' ORDER BY ID DESC'); - $Row = $result_stmt->fetch(PDO::FETCH_ASSOC); - - //copy & delete temporary data - Database::query(" - INSERT INTO `" . TABLE_APS_SETTINGS . "` - (`InstanceID`, `Name`, `Value`) - SELECT " . (int)$Row['ID'] . " AS `InstanceID`, `Name`, `Value` - FROM `" . TABLE_APS_TEMP_SETTINGS . "` - WHERE `CustomerID` = " .(int)$CustomerId . " AND `PackageID` = " . (int)$PackageId - ); - Database::query('DELETE FROM `' . TABLE_APS_TEMP_SETTINGS . '` WHERE `CustomerID` = ' . (int)$CustomerId . ' AND `PackageID` = ' . (int)$PackageId); - - //add task for installation - Database::query('INSERT INTO `' . TABLE_APS_TASKS . '` (`InstanceID`, `Task`) VALUES(' . (int)$Row['ID'] . ', ' . TASK_INSTALL . ')'); - - //update used counter for packages - Database::query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `aps_packages_used` = `aps_packages_used` + 1 WHERE `customerid` = ' . (int)$CustomerId); - self::InfoBox(sprintf($lng['aps']['successonnewinstance'], $Xml->name), 2); - unset($Xml); - } - - /** - * convert human readable memory sizes into bytes - * - * @param value ini_get() formated memory size - * @return memory size in bytes - */ - private function PhpMemorySizeToBytes($Value) { - - //convert memory formats from php.ini to a integer value in bytes - $Value = trim($Value); - $Last = strtolower($Value{strlen($Value) - 1}); - - switch($Last) - { - case 'g': - $Value*= 1024; - case 'm': - $Value*= 1024; - case 'k': - $Value*= 1024; - } - - return $Value; - } - - /** - * convert php.ini formated strings into true and false as a string - * - * @param value value to read from php.ini (format: safe_mode or safe-mode) - * @return (true|false) as string - */ - private function TrueFalseIniGet($Value) { - //convert php.ini values to true and false as string - $Value = ini_get(str_replace(array('-'), array('_'), $Value)); - - if($Value == 0 - || $Value == false - || $Value == 'off') - { - return 'false'; - } - else - { - return 'true'; - } - } - - /** - * packages can fail during the validation process. this function allows to check for exceptions - * - * @param category category as string to check - * @param item item within category to check - * @return success true (value has exception) / error false (value has no exception) - */ - private function CheckException($Category, $Item, $Value) { - global $settings, $theme; - - //search for element within system settings - $Elements = explode(',', $settings['aps'][$Category . '-' . $Item]); - foreach($Elements as $Element) - { - if(strtolower($Element) == strtolower($Value))return true; - } - - return false; - } - - /** - * packages must be validated within the submappings of a filesystem structure - * - * @param parentmapping instance of parsed xml file, current mapping position - * @param url relative path for application specifying the current path within the mapping tree - * @return array with errors found, optional empty when no errors were found - */ - private function CheckSubmappings($ParentMapping, $Url) { - global $lng, $theme; - $Error = array(); - - //check for special PHP handler extensions - $XmlPhpMapping = $ParentMapping->children('http://apstandard.com/ns/1/php'); - foreach($XmlPhpMapping->handler as $Handler) - { - if(isset($Handler->extension[0]) - && strval($Handler->extension[0]) != 'php') - { - $Error[] = $lng['aps']['php_misc_handler']; - } - - if(isset($Handler->disabled)) - { - $Error[] = $lng['aps']['php_misc_directoryhandler']; - } - } - - //check for special ASP.NET url handler within mappings - $XmlAspMapping = $ParentMapping->children('http://apstandard.com/ns/1/aspnet'); - - if($XmlAspMapping->handler) - { - $Error[] = $lng['aps']['asp_net']; - } - - //check for special CGI url handlers within mappings - /** - * as of 0.9.13 we can handle CGI ;-), #404 - * - $XmlCgiMapping = $ParentMapping->children('http://apstandard.com/ns/1/cgi'); - if($XmlCgiMapping->handler) { - $Error[] = $lng['aps']['cgi']; - } - */ - - //resolve deeper mappings - foreach($ParentMapping->mapping as $Mapping) - { - $Return = array(); - - //recursive check of other mappings - if($Url == '/') - { - $Return = self::CheckSubmappings($Mapping, $Url . $Mapping['url']); - } - else - { - $Return = self::CheckSubmappings($Mapping, $Url . '/' . $Mapping['url']); - } - - //if recursive checks found errors, attach them - if(count($Return) != 0) - { - foreach($Return as $Value) - { - if(!in_array($Value, $Error))$Error[] = $Value; - } - } - } - - return $Error; - } - - /** - * function validates a package against a lot of options and installs it if all conditions have succeeded - * - * @param filename path to zipfile to install - */ - private function InstallNewPackage($Filename) { - - global $lng, $userinfo, $theme; - - if(file_exists($Filename) - && $Xml = self::GetXmlFromZip($Filename)) - { - $Error = array(); - - $this->aps_version = isset($Xml->attributes()->version) ? (string)$Xml->attributes()->version : '1.0'; - - //check alot of stuff if package is supported - //php modules - if ($this->aps_version == '1.0') - { - // the good ole way - $XmlPhp = $Xml->requirements->children('http://apstandard.com/ns/1/php'); - } - else - { - // since 1.1 - $Xml->registerXPathNamespace('php', 'http://apstandard.com/ns/1/php'); - - $XmlPhp = new DynamicProperties; - $XmlPhp->extension = getXPathValue($Xml, '//php:extension', false); - $XmlPhp->function = getXPathValue($Xml, '//php:function', false); - } - - if($XmlPhp->extension) - { - $ExtensionsLoaded = get_loaded_extensions(); - foreach($XmlPhp->extension as $Extension) - { - if(strtolower($Extension) == 'php') - { - continue; - } - - if(!in_array($Extension, $ExtensionsLoaded) - && !self::CheckException('php', 'extension', $Extension)) - { - $Error[] = sprintf($lng['aps']['php_extension'], $Extension); - } - } - } - - //php functions - if($XmlPhp->function) - { - foreach($XmlPhp->function as $Function) - { - if(!function_exists($Function) - && !self::CheckException('php', 'function', $Function)) - { - $Error[] = sprintf($lng['aps']['php_function'], $Function); - } - } - } - - //php values - $PhpValues = array( - 'short-open-tag', - 'file-uploads', - 'magic-quotes-gpc', - 'register-globals', - 'allow-url-fopen', - 'safe-mode' - ); - foreach($PhpValues as $Value) - { - if ($this->aps_version != '1.0') - { - $XmlPhp->{$Value} = getXPathValue($Xml, '//php:'.$Value); - } - - if($XmlPhp->{$Value}) - { - if(self::TrueFalseIniGet($Value) != $XmlPhp->{$Value} - && !self::CheckException('php', 'configuration', str_replace(array('-'), array('_'), $Value))) - { - $Error[] = sprintf($lng['aps']['php_configuration'], str_replace(array('-'), array('_'), $Value)); - } - } - } - - if ($this->aps_version != '1.0') - { - $XmlPhp->{'post-max-size'} = getXPathValue($Xml, '//php:post-max-size'); - } - - if($XmlPhp->{'post-max-size'}) - { - if(self::PhpMemorySizeToBytes(ini_get('post_max_size')) < intval($XmlPhp->{'post-max-size'}) - && !self::CheckException('php', 'configuration', 'post_max_size')) - { - $Error[] = $lng['aps']['php_configuration_post_max_size']; - } - } - - if ($this->aps_version != '1.0') - { - $XmlPhp->{'memory-limit'} = getXPathValue($Xml, '//php:memory-limit'); - } - - if($XmlPhp->{'memory-limit'}) - { - if(self::PhpMemorySizeToBytes(ini_get('memory_limit')) < intval($XmlPhp->{'memory-limit'}) - && !self::CheckException('php', 'configuration', 'memory_limit')) - { - $Error[] = $lng['aps']['php_configuration_memory_limit']; - } - } - - if ($this->aps_version != '1.0') - { - $XmlPhp->{'max-execution-time'} = getXPathValue($Xml, '//php:max-execution-time'); - } - - if($XmlPhp->{'max-execution-time'}) - { - if(ini_get('max_execution_time') < intval($XmlPhp->{'max-execution-time'}) - && !self::CheckException('php', 'configuration', 'max_execution_time')) - { - $Error[] = $lng['aps']['php_configuration_max_execution_time']; - } - } - - //php version - //must be done with xpath otherwise check not possible (XML parser problem with attributes) - $Xml->registerXPathNamespace('phpversion', 'http://apstandard.com/ns/1/php'); - $Result = $Xml->xpath('//phpversion:version'); - - if(isset($Result[0]['min'])) - { - if(version_compare($Result[0]['min'], PHP_VERSION) == 1) - { - $Error[] = $lng['aps']['php_general_old']; - } - } - - if(isset($Result[0]['max-not-including'])) - { - if(version_compare($Result[0]['max-not-including'], PHP_VERSION) == - 1) - { - $Error[] = $lng['aps']['php_general_new']; - } - } - - //database - if ($this->aps_version == '1.0') - { - // the good ole way - $XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db'); - } - else - { - // since 1.1 - $Xml->registerXPathNamespace('db', 'http://apstandard.com/ns/1/db'); - - $XmlDb = new DynamicProperties; - $XmlDb->db->id = getXPathValue($Xml, '//db:id'); - $XmlDb->db->{'server-type'} = getXPathValue($Xml, '//db:server-type'); - $XmlDb->db->{'server-min-version'} = getXPathValue($Xml, '//db:server-min-version'); - } - - if($XmlDb->db->id) - { - if($XmlDb->db->{'server-type'} != 'mysql') - { - $Error[] = $lng['aps']['db_mysql_support']; - } - - if(version_compare($XmlDb->db->{'server-min-version'}, Database::getAttribute(PDO::ATTR_SERVER_VERSION)) == 1) - { - $Error[] = $lng['aps']['db_mysql_version']; - } - } - - //ASP.NET - if ($this->aps_version == '1.0') - { - // the good ole way - $XmlAsp = $Xml->requirements->children('http://apstandard.com/ns/1/aspnet'); - } - else - { - // since 1.1 - $Xml->registerXPathNamespace('aspnet', 'http://apstandard.com/ns/1/aspnet'); - - $XmlAsp = new DynamicProperties; - $XmlAsp->handler = getXPathValue($Xml, '//aspnet:handler'); - $XmlAsp->permissions = getXPathValue($Xml, '//aspnet:permissions'); - $XmlAsp->version = getXPathValue($Xml, '//aspnet:version'); - } - - if($XmlAsp->handler - || $XmlAsp->permissions - || $XmlAsp->version) - { - $Error[] = $lng['aps']['asp_net']; - } - - //webserver modules - if ($this->aps_version == '1.0') - { - // the good ole way - $XmlWebserver = $Xml->requirements->children('http://apstandard.com/ns/1/apache'); - } - else - { - // since 1.1 - $Xml->registerXPathNamespace('apache', 'http://apstandard.com/ns/1/apache'); - - $XmlWebserver = new DynamicProperties; - $XmlWebserver->{'required-module'} = getXPathValue($Xml, '//apache:required-module'); - $XmlWebserver->htaccess = getXPathValue($Xml, '//apache:htaccess'); - } - - if($XmlWebserver->{'required-module'}) - { - if(function_exists('apache_get_modules')) - { - $ModulesLoaded = apache_get_modules(); - foreach($XmlWebserver->{'required-module'} as $Module) - { - if(!in_array($Module, $ModulesLoaded) - && !self::CheckException('webserver', 'module', $Module)) - { - $Error[] = sprintf($lng['aps']['webserver_module'], $Module); - } - } - } - else - { - if(!self::CheckException('webserver', 'module', 'fcgid-any'))$Error[] = $lng['aps']['webserver_fcgid']; - } - } - - //webserver .htaccess - if($XmlWebserver->htaccess - && !self::CheckException('webserver', 'htaccess', 'htaccess')) - { - $Error[] = $lng['aps']['webserver_htaccess']; - } - - //configuration script check - if($Xml->{'configuration-script-language'} - && $Xml->{'configuration-script-language'} != 'php') - { - $Error[] = $lng['aps']['misc_configscript']; - } - - //validation against a charset not possible in current version - if ($this->aps_version == '1.0') - { - // the good ole way - $aps_settings_array = $Xml->settings->group; - } - else - { - // since 1.1 - $aps_settings_array = $Xml->{'global-settings'}->setting; - if(!is_array($aps_settings_array)) { - $aps_settings_array = $Xml->service->settings->group; - } - } - - foreach($aps_settings_array as $Group) - { - foreach($Group->setting as $Setting) - { - if($Setting['type'] == 'string' - || $Setting['type'] == 'password') - { - if(isset($Setting['charset'])) - { - if(!in_array($lng['aps']['misc_charset'], $Error))$Error[] = $lng['aps']['misc_charset']; - } - } - } - } - - //check different errors/features in submappings - if ($this->aps_version == '1.0') - { - $Return = self::CheckSubmappings($Xml->mapping, $Xml->mapping['url']); - - if(count($Return) != 0) - { - foreach($Return as $Value) - { - if(!in_array($Value, $Error))$Error[] = $Value; - } - } - } - - //check already installed versions - $result_stmt = Database::prepare('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Name` = :name'); - Database::pexecute($result_stmt, array('name' => $Xml->name)); - $Newer = 0; - - if (Database::num_rows() > 0) { - - while ($Row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { - - //package is newer, install package as a update - if (version_compare($Row['Version'] . '-' . $Row['Release'], $Xml->version . '-' . $Xml->release) == - 1) { - $Newer = 1; - } - - //package is installed already with same version, cancel installation - if (version_compare($Row['Version'] . '-' . $Row['Release'], $Xml->version . '-' . $Xml->release) == 0) { - $Error[] = $lng['aps']['misc_version_already_installed']; - break; - } - - //package is older than the one which is installed already, cancel installation - if (version_compare($Row['Version'] . '-' . $Row['Release'], $Xml->version . '-' . $Xml->release) == 1) { - $Error[] = $lng['aps']['misc_only_newer_versions']; - break; - } - } - } - - if(count($Error) > 0) - { - //show errors - $Output = ''; - foreach($Error as $Entry) - { - $Output.= '
  • ' . $Entry . '
  • '; - } - - self::InfoBox(sprintf($lng['aps']['erroronscan'], $Xml->name, $Output), 1); - return false; - } - else - { - //install package in system, all checks succeeded - $Destination = './packages/' . basename($Filename) . '/'; - - //create package directory - if(!file_exists($Destination)) { - mkdir($Destination, 0777, true); - } - - //copy xml meta data - self::GetContentFromZip($Filename, 'APP-META.xml', $Destination . 'APP-META.xml'); - - //copy screenshots - if ($this->aps_version != '1.0') - { - $xml_screenshots = $Xml->presentation->screenshot;; - } - else - { - $xml_screenshots = $Xml->screenshot; - } - - - if($xml_screenshots) - { - foreach($xml_screenshots as $Screenshot) - { - self::GetContentFromZip($Filename, $Screenshot['path'], $Destination . basename($Screenshot['path'])); - } - } - - //copy icon - if ($this->aps_version != '1.0') - { - $xml_iconpath = $Xml->presentation->icon['path']; - } - else - { - $xml_iconpath = $Xml->icon['path']; - } - - if($xml_iconpath) - { - self::GetContentFromZip($Filename, $xml_iconpath, $Destination . basename($xml_iconpath)); - } - - //copy license - if ($this->aps_version != '1.0') - { - $xml_license = $Xml->service->license; - } - else - { - $xml_license = $Xml->license; - } - - if($xml_license - && $xml_license->text->file) - { - self::GetContentFromZip($Filename, $xml_license->text->file, $Destination . 'license.txt'); - } - - //insert package to database - $ins_stmt = Database::prepare(' - INSERT INTO `' . TABLE_APS_PACKAGES . '` - (`Path`, `Name`, `Version`, `Release`, `Status`) - VALUES - (:path, :name, :version, :release, ' . PACKAGE_LOCKED . ') - '); - $ins_data = array( - 'path' => basename($Filename), - 'name' => $Xml->name, - 'version' => $Xml->version, - 'release' => $Xml->release - ); - Database::pexecute($ins_stmt, $ins_data); - - //copy zipfile do destination - copy($Filename, $Destination . basename($Filename)); - unlink($Filename); - - //show some feedback messages to admin - if($Newer == 1) - { - self::InfoBox(sprintf($lng['aps']['successpackageupdate'], $Xml->name), 2); - } - else - { - self::InfoBox(sprintf($lng['aps']['successpackageinstall'], $Xml->name), 2); - } - - unset($Xml); - return true; - } - } - else - { - //file cannot be unzipped or parse of xml data has failed - self::InfoBox(sprintf($lng['aps']['invalidzipfile'], basename($Filename))); - return false; - } - } - - /** - * main function of the class, provides all of the aps installer frontend - */ - public function MainHandler($Action) { - - global $lng, $filename, $s, $page, $action, $Id, $userinfo, $theme; - - //check for basic functions, classes and permissions - $Error = ''; - - if(!class_exists('SimpleXMLElement') - || !function_exists('zip_open')) - { - $Error.= '
  • ' . $lng['aps']['class_zip_missing'] . '
  • '; - } - - if(!is_writable($this->RootDir.'temp/') - || !is_writable($this->RootDir.'packages/')) - { - $dirpermission = str_replace('{$path}', $this->RootDir, $lng['aps']['dir_permissions']); - $Error.= '
  • ' . $dirpermission . '
  • '; - } - - if($Error != '') - { - //show different error to customer and admin - if(!isset($this->userinfo['customerid'])) - { - self::InfoBox(sprintf($lng['aps']['initerror'], $Error), 1); - } - else - { - self::InfoBox($lng['aps']['initerror_customer'], 1); - } - return; - } - - if(isset($this->userinfo['customerid'])) - { - $CustomerId = $this->userinfo['customerid']; - } - else - { - $CustomerId = -1; - } - $AdminId = $this->userinfo['adminid']; - $PackagesPerSite = $this->settings['aps']['items_per_page']; - - //run different functions based on action - if($Action == 'install') - { - //check for valid package id - if(self::IsValidPackageId($Id, true)) - { - //installation data is given - if(isset($_POST['withinput'])) - { - $Errors = self::ValidatePackageData($Id, $CustomerId); - - //if there are no input errors, create a new instance - if(count($Errors) == 0) - { - self::CreatePackageInstance($Id, $CustomerId); - } - else - { - self::ShowPackageInstaller($Id, $Errors, $CustomerId); - } - } - else - { - //empty array -> no errors will be shown to customer - $Errors = array(); - self::ShowPackageInstaller($Id, $Errors, $CustomerId); - } - } - else - { - self::InfoBox($lng['aps']['iderror']); - } - } - elseif($Action == 'remove') - { - //check for valid instance id - if(self::IsValidInstanceId($Id, $CustomerId)) - { - //customer has clicked yes to uninstall a package - if(isset($_POST['answer']) - && $_POST['answer'] == $lng['panel']['yes']) - { - //check if there is already an task - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_TASKS . '` WHERE `InstanceID` = ' . (int)$Id . ' AND `Task` = ' . TASK_REMOVE); - - if (Database::num_rows() > 0) { - self::InfoBox($lng['aps']['removetaskexisting']); - } - else - { - //remove package, no task existing - Database::query('INSERT INTO `' . TABLE_APS_TASKS . '` (`InstanceID`, `Task`) VALUES (' . (int)$Id . ', ' . TASK_REMOVE . ')'); - Database::query('UPDATE `' . TABLE_APS_INSTANCES . '` SET `Status` = ' . INSTANCE_UNINSTALL . ' WHERE `ID` = ' . (int)$Id); - Database::query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `aps_packages_used` = `aps_packages_used` - 1 WHERE `customerid` = ' . (int)$CustomerId); - self::InfoBox($lng['aps']['packagewillberemoved']); - } - } - else - { - //show yes/no question - $Message = $lng['question']['reallywanttoremove']; - $action_alt = 'customerstatus'; - $Ids = ''; - eval("echo \"" . getTemplate("aps/askyesno") . "\";"); - } - } - else - { - self::InfoBox($lng['aps']['iderror']); - } - } - elseif($Action == 'stopinstall') - { - //check for valid instance id - if(self::IsValidInstanceId($Id, $CustomerId)) - { - //check if application installation runs already - $Result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `ID` = ' . (int)$Id); - $Row = $Result_stmt->fetch(PDO::FETCH_ASSOC); - - if($Row['Status'] == INSTANCE_TASK_ACTIVE) - { - self::InfoBox($lng['aps']['installstoperror']); - } - else - { - if(isset($_POST['answer']) - && $_POST['answer'] == $lng['panel']['yes']) - { - //remove task - Database::query('DELETE FROM `' . TABLE_APS_TASKS . '` WHERE `InstanceID` = ' . (int)$Id); - - //remove settings - Database::query('DELETE FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . (int)$Id); - - //remove instance - Database::query('DELETE FROM `' . TABLE_APS_INSTANCES . '` WHERE `ID` = ' . (int)$Id); - - //update used counter - Database::query('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `aps_packages_used` = `aps_packages_used` - 1 WHERE `customerid` = ' . (int)$CustomerId); - self::InfoBox($lng['aps']['installstopped']); - } - else - { - //show yes/no question - $Message = $lng['question']['reallywanttostop']; - $action_alt = 'customerstatus'; - $Ids = ''; - eval("echo \"" . getTemplate("aps/askyesno") . "\";"); - } - } - } - else - { - self::InfoBox($lng['aps']['iderror']); - } - } - elseif($Action == 'reconfigure') - { - //check for valid instance id - if(self::IsValidInstanceId($Id, $CustomerId)) - { - self::InfoBox('Reconfigure function not implemented in current version!'); - } - else - { - self::InfoBox($lng['aps']['iderror']); - } - } - elseif($Action == 'details') - { - //show advanced package infos if package id is valid - if(self::IsValidPackageId($Id, true)) - { - self::ShowPackageInfo($Id, true); - } - else - { - self::InfoBox($lng['aps']['iderror']); - } - } - elseif($Action == 'scan' - && !isset($this->userinfo['customerid'])) - { - //find all files in temp directory - $Files = scandir('./temp/'); - $Counter = 0; - foreach($Files as $File) - { - //skip invalid "files" - if(substr($File, -4) != '.zip')continue; - - //install new package in system - self::InstallNewPackage('./temp/' . $File); - $Counter+= 1; - } - - if($Counter == 0) - { - //throw error if no file was found - self::InfoBox($lng['aps']['nopacketsforinstallation']); - } - } - elseif($Action == 'manageinstances' - && !isset($this->userinfo['customerid'])) - { - self::ManageInstances(); - } - elseif($Action == 'managepackages' - && !isset($this->userinfo['customerid'])) - { - self::ManagePackages(); - } - elseif($Action == 'upload' - && !isset($this->userinfo['customerid'])) - { - self::UploadNewPackages(); - } - elseif($Action == 'customerstatus') - { - self::CustomerStatus($CustomerId); - } - elseif($Action == 'search') - { - self::SearchPackages(); - } - elseif($Action == 'overview') - { - // show packages with paging - if(isset($_GET['page']) - && preg_match('/^[0-9]+$/', $_GET['page']) != - 1) - { - //check if page parameter is valid - //get all packages to find out how many pages are needed - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Status` = ' . PACKAGE_ENABLED . ' ORDER BY `Name` ASC'); - $numrows = Database::num_rows(); - $Pages = intval($numrows / $PackagesPerSite); - - if (($numrows / $PackagesPerSite) > $Pages) { - $Pages+= 1; - } - - if($_GET['page'] >= 1 - && $_GET['page'] <= $Pages) - { - //page parameter is within available pages, now show packages for that given page - $result2_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Status` = ' . PACKAGE_ENABLED . ' ORDER BY `Name` ASC LIMIT ' . (int)(intval($_GET['page']) - 1) * $PackagesPerSite . ', ' . (int)$PackagesPerSite); - - //show packages - while ($Row3 = $result2_stmt->fetch(PDO::FETCH_ASSOC)) { - self::ShowPackageInfo($Row3['ID']); - } - - //show URLs for other pages - if ($Pages > 1) { - echo '

    '; - for ($i = 1;$i < $Pages + 1;$i++) { - if ($i == $_GET['page']) { - echo '' . $i . ' '; - } else { - echo '' . $i . ' '; - } - } - - echo '


    '; - } - } - else - { - //page parameter isnt within available pages, show packages from first page - $result2_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Status` = ' . PACKAGE_ENABLED . ' ORDER BY `Name` ASC LIMIT 0, ' . (int)$PackagesPerSite); - - //show packages - while($Row3 = $result2_stmt->fetch(PDO::FETCH_ASSOC)) { - self::ShowPackageInfo($Row3['ID']); - } - - //fetch number of packages to calculate the number of pages - $result3_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Status` = ' . PACKAGE_ENABLED . ' ORDER BY `Name` ASC'); - $numrows = Database::num_rows(); - $Pages = intval($numrows / $PackagesPerSite); - - if (($numrows / $PackagesPerSite) > $Pages) { - $Pages+= 1; - } - - //show URLs for other pages - if ($Pages > 1) { - echo '

    '; - for ($i = 1;$i < $Pages + 1;$i++) { - echo '' . $i . ' '; - } - echo '
    '; - } - } - } - else - { - //page parameter isnt valid, show packages from first page - $result2_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Status` = ' . PACKAGE_ENABLED . ' ORDER BY `Name` ASC LIMIT 0, ' . (int)$PackagesPerSite); - - if (Database::num_rows() == 0) { - self::InfoBox($lng['aps']['nopackagestoinstall']); - return; - } - - // no more contingent, #278 - if($userinfo['aps_packages'] == $userinfo['aps_packages_used'] - && $userinfo['aps_packages'] != '-1' - ){ - self::InfoBox($lng['aps']['nocontingent']); - } - - //show packages - while ($Row3 = $result2_stmt->fetch(PDO::FETCH_ASSOC)) - { - self::ShowPackageInfo($Row3['ID']); - } - - //fetch number of packages to calculate number of pages - $result3_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Status` = ' . PACKAGE_ENABLED . ' ORDER BY `Name` ASC'); - $numrows = Database::num_rows(); - $Pages = intval($numrows / $PackagesPerSite); - - if (($numrows / $PackagesPerSite) > $Pages) { - $Pages+= 1; - } - - //show URLs for other pages - if ($Pages > 1) { - echo '

    '; - for ($i = 1;$i < $Pages + 1;$i++) { - if ($i == 1) { - echo '' . $i . ''; - } else { - echo '' . $i . ''; - } - } - echo '


    '; - } - } - } - } - - /** - * function extracts resources from a zipfile to return or save them on disk - * - * @param filename zipfile to read data from - * @param file file within zip archive to read - * @param destination optional parameter where to save file from within the zip file - * @return success content of file from zip archive / error false - */ - private function GetContentFromZip($Filename, $File, $Destination = '') - { - if (!file_exists($Filename)) { - return false; - } - - $Content = ''; - - //now using the new ZipArchive class from php 5.2 - - $Zip = new ZipArchive; - $Resource = $Zip->open(realpath($Filename)); - - if($Resource === true) - { - $FileHandle = $Zip->getStream($File); - - if(!$FileHandle)return false; - - while(!feof($FileHandle)) - { - $Content.= fread($FileHandle, 8192); - } - - fclose($FileHandle); - $Zip->close(); - } - else - { - //on 64 bit systems the zip functions can fail -> use safe_exec to extract the files - $ReturnLines = array(); - $ReturnVal = - 1; - $ReturnLines = safe_exec('unzip -o -j -qq ' . escapeshellarg(realpath($Filename)) . ' ' . escapeshellarg($File) . ' -d ' . escapeshellarg(sys_get_temp_dir() . '/'), $ReturnVal); - - if($ReturnVal == 0) - { - $Content = file_get_contents(sys_get_temp_dir() . '/' . basename($File)); - unlink(sys_get_temp_dir() . '/' . basename($File)); - - if($Content == false)return false; - } - else - { - return false; - } - } - - //return content of file from within the zipfile or save to disk - if($Content == '') - { - return false; - } - else - { - if($Destination == '') - { - return $Content; - } - else - { - //open file and save content - $File = fopen($Destination, "wb"); - - if($File) - { - fwrite($File, $Content); - fclose($File); - } - else - { - return false; - } - } - } - } - - /** - * fetches the xml metafile from a zipfile and returns the parsed data - * - * @param filename zipfile containing the xml meta data - * @return success parsed xml content of zipfile / error false - */ - private function GetXmlFromZip($Filename) - { - if (!file_exists($Filename)) { - return false; - } - - //get content for xml meta data file from within the zipfile - if($XmlContent = self::GetContentFromZip($Filename, 'APP-META.xml')) - { - //parse xml content - $Xml = new SimpleXMLElement($XmlContent); - return $Xml; - } - else - { - return false; - } - } - - /** - * reads the content of a xml metafile from disk and returns the parsed data - * - * @param filename xmlfile to parse - * @return success parsed xml content of file / error false - */ - private function GetXmlFromFile($Filename) - { - //read xml file from disk and return parsed data - if (!file_exists($Filename)) { - return false; - } - $XmlContent = file_get_contents($Filename); - $Xml = new SimpleXMLElement($XmlContent); - return $Xml; - } - - /** - * check whether a given package id is valid - * - * @param packageid id of package from database to check vor validity - * @param customer check if package can be used by customer and/or admin [true|false] - * @return success valid package id (id > 0 based on database layout) / error false - */ - private function IsValidPackageId($PackageId, $Customer) - { - if (preg_match('/^[0-9]+$/', $PackageId) != 1) { - return false; - } - - if($Customer == true) - { - //customers can only see packages which are enabled - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `Status` = ' . PACKAGE_ENABLED . ' AND `ID` = ' . (int)$PackageId); - - if (Database::num_rows() > 0) { - return $PackageId; - } else { - return false; - } - } - else - { - //admins can see all packages - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `ID` = ' . (int)$PackageId); - - if (Database::num_rows() > 0) { - return $PackageId; - } else { - return false; - } - } - } - - /** - * check whether a given instance id is valid - * - * @param packageid id of instance from database to check vor validity - * @return success valid instance id (id > 0 based on database layout) / error false - */ - private function IsValidInstanceId($InstanceId, $CustomerId) - { - if (preg_match('/^[0-9]+$/', $InstanceId) != 1) { - return false; - } - - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `CustomerID` = ' . (int)$CustomerId) . ' AND `ID` = ' . (int)$InstanceId; - - if (Database::num_rows() > 0) { - return $InstanceId; - } else { - return false; - } - } - - /** - * save installation values fetched from the installation wizard - * - * @param packageid id of package from database - * @param customerid id of customer for who the values should be saved - * @param name name of field to save - * @param value value to save for previously given name - */ - private function SetInstallationValue($PackageId, $CustomerId, $Name, $Value) { - - $result_stmt = Database::prepare(' - SELECT * FROM `' . TABLE_APS_TEMP_SETTINGS . '` - WHERE `PackageID` = :pid AND `CustomerID` = :cid AND `Name` = :name - '); - Database::pexecute($result_stmt, array('pid' => $PackageId, 'cid' => $CustomerId, 'name' => $Name)); - - if (Database::num_rows() == 0) { - $ins_stmt = Database::prepare(' - INSERT INTO `' . TABLE_APS_TEMP_SETTINGS . '` - (`PackageID`, `CustomerID`, `Name`, `Value`) - VALUES - (:pid, :cid, :name, :value) - '); - Database::pexecute($ins_stmt, array('pid' => $PackageId, 'cid' => $CustomerId, 'name' => $Name, 'value' => $Value)); - } else { - $Row = $result_stmt->fetch(PDO::FETCH_ASSOC); - $upd_stmt = Database::prepare(' - UPDATE `' . TABLE_APS_TEMP_SETTINGS . '` SET - `PackageID` = :pid, - `CustomerID` = :cid, - `Name` = :name, - `Value` = :value - WHERE `ID` = :id - '); - $upd_data = array( - 'pid' => $PackageId, - 'cid' => $CustomerId, - 'name' => $Name, - 'value' => $Value, - 'id' => $Row['ID'] - ); - Database::pexecute($upd_stmt, $upd_data); - } - } - - /** - * return previously saved installation values - * - * @param packageid id of package from database - * @param customerid id of customer for who the values should be read - * @param name name of field to read - * @return success value of field from database / error false - */ - private function GetInstallationValue($PackageId, $CustomerId, $Name) { - - $result_stmt = Database::prepare(' - SELECT * FROM `' . TABLE_APS_TEMP_SETTINGS . '` - WHERE `PackageID` = :pid AND `CustomerID` = :cid AND `Name` = :name - '); - Database::pexecute($result_stmt, array('pid' => $PackageId, 'cid' => $CustomerId, 'name' => $Name)); - - if (Database::num_rows() == 0) { - return false; - } else { - $Row = $result_stmt->fetch(PDO::FETCH_ASSOC); - return $Row['Value']; - } - } - - /** - * return setting value for a given Instance - * - * @param instanceid id of APS Instance from database - * @param name name of field to read - * @return success value of field from database / error false - */ - private function GetSettingValue($InstanceId, $Name) { - - $result_stmt = Database::prepare(' - SELECT * FROM `' . TABLE_APS_SETTINGS . '` - WHERE `InstanceID` = :iid AND `Name` = :name - '); - Database::pexecute($result_stmt, array('iid' => $InstanceID, 'name' => $Name)); - - if (Database::num_rows() == 0) { - return false; - } else { - $Row = $result_stmt->fetch(PDO::FETCH_ASSOC); - return $Row['Value']; - } - } - - /** - * fix a path given by the customer - * - * @param path path which could be compromised - * @return corrected path - */ - private function MakeSecurePath($path) { - - //code based on froxlor core code - $search = Array( - '#/+#', - '#\.+#', - '#\0+#', - '#\\\\+#' - ); - $replace = Array( - '/', - '', - '', - '/' - ); - $path = preg_replace($search, $replace, $path); - - //no / at the end - if (substr($path, strlen($path) - 1, 1) == '/') { - $path = substr($path, 0, strlen($path) - 1); - } - - //no / at beginning - if(substr($path, 0, 1) == '/') { - $path = substr($path, 1); - } - - return $path; - } - - /** - * validate the input of a customer against the xml meta descriptions - * - * @param packageid id of package from database - * @param customerid id of customer from database - * @return success/error array of errors found containing fields that were wrong - */ - private function ValidatePackageData($PackageId, $CustomerId) { - - if (!self::IsValidPackageId($PackageId, true)) { - return false; - } - - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `ID` = ' . (int)$PackageId); - $Row = $result_stmt->fetch(PDO::FETCH_ASSOC); - $Xml = self::GetXmlFromFile('./packages/' . $Row['Path'] . '/APP-META.xml'); - - //return if parse of xml file has failed - if($Xml == false) { - return false; - } - - $this->aps_version = isset($Xml->attributes()->version) ? (string)$Xml->attributes()->version : '1.0'; - - //check all data fields of xml file against inut of customer - if ($this->aps_version == '1.0') { - // the good ole way - $aps_settings_array = $Xml->settings->group; - } else { - // since 1.1 - $aps_settings_array = $Xml->{'global-settings'}->setting; - if(!is_array($aps_settings_array)) { - $aps_settings_array = $Xml->service->settings->group; - } - } - - $Error = array(); - foreach($aps_settings_array as $Group) - { - foreach($Group->setting as $Setting) - { - $FieldId = strval($Setting['id']); - - if($Setting['type'] == 'string' - || $Setting['type'] == 'password') - { - if(isset($_POST[$FieldId])) - { - if(isset($Setting['min-length']) - && strlen($_POST[$FieldId]) < $Setting['min-length']) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(isset($Setting['max-length']) - && strlen($_POST[$FieldId]) > $Setting['max-length']) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(isset($Setting['regex']) - && !preg_match("/" . $Setting['regex'] . "/", $_POST[$FieldId])) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - /* - elseif(isset($Setting['charset'])) - { - //CHARSET VALIDATION FOR LATER VERSIONS - } - */ - - if(!in_array($FieldId, $Error))self::SetInstallationValue($PackageId, $CustomerId, $FieldId, $_POST[$FieldId]); - } - else - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - } - else - - if($Setting['type'] == 'email') - { - if(isset($_POST[$FieldId])) - { - $email = strtolower($_POST[$FieldId]); - if(filter_var($email, FILTER_VALIDATE_EMAIL) === false) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(!in_array($FieldId, $Error))self::SetInstallationValue($PackageId, $CustomerId, $FieldId, $_POST[$FieldId]); - } - else - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - } - elseif($Setting['type'] == 'domain-name') - { - if(isset($_POST[$FieldId])) - { - if(!preg_match("^(http|https)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*$", $_POST[$FieldId])) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(!in_array($FieldId, $Error))self::SetInstallationValue($PackageId, $CustomerId, $FieldId, $_POST[$FieldId]); - } - else - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - } - elseif($Setting['type'] == 'integer') - { - if(isset($_POST[$FieldId])) - { - //check if number is in the format of float - - if(round($_POST[$FieldId]) != $_POST[$FieldId]) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(!is_numeric($_POST[$FieldId])) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(isset($Setting['min']) - && intval($_POST[$FieldId]) < intval($Setting['min'])) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(isset($Setting['max']) - && intval($_POST[$FieldId]) > intval($Setting['max'])) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(!in_array($FieldId, $Error))self::SetInstallationValue($PackageId, $CustomerId, $FieldId, intval($_POST[$FieldId])); - } - else - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - } - elseif($Setting['type'] == 'float') - { - if(isset($_POST[$FieldId])) - { - if(!is_numeric($_POST[$FieldId])) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(isset($Setting['min']) - && floatval($_POST[$FieldId]) < floatval($Setting['min'])) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(isset($Setting['max']) - && floatval($_POST[$FieldId]) > floatval($Setting['max'])) - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - - if(!in_array($FieldId, $Error))self::SetInstallationValue($PackageId, $CustomerId, $FieldId, floatval($_POST[$FieldId])); - } - else - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - } - elseif($Setting['type'] == 'boolean') - { - if(isset($_POST[$FieldId]) - && $_POST[$FieldId] == 'true') - { - self::SetInstallationValue($PackageId, $CustomerId, $FieldId, 'true'); - } - else - { - self::SetInstallationValue($PackageId, $CustomerId, $FieldId, 'false'); - } - } - elseif($Setting['type'] == 'enum') - { - if(isset($_POST[$FieldId])) - { - foreach($Setting->choice as $Choice) - { - if($Choice['id'] == $_POST[$FieldId]) - { - self::SetInstallationValue($PackageId, $CustomerId, $FieldId, $_POST[$FieldId]); - break; - } - } - } - else - { - if(!in_array($FieldId, $Error))$Error[] = $FieldId; - } - } - } - } - - //database required? - if ($this->aps_version == '1.0') { - // the good ole way - $XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db'); - } - else - { - // since 1.1 - $Xml->registerXPathNamespace('db', 'http://apstandard.com/ns/1/db'); - - $XmlDb = new DynamicProperties; - $XmlDb->db->id = getXPathValue($Xml, '//db:id'); - } - - if($XmlDb->db->id) - { - if(isset($_POST['main_database_password'])) - { - if(strlen($_POST['main_database_password']) < 8) - { - if(!in_array('main_database_password', $Error))$Error[] = 'main_database_password'; - } - - if(!in_array('main_database_password', $Error))self::SetInstallationValue($PackageId, $CustomerId, 'main_database_password', $_POST['main_database_password']); - } - else - { - if(!in_array('main_database_password', $Error))$Error[] = 'main_database_password'; - } - } - - //application location - if(isset($_POST['main_domain'])) - { - $result2_stmt = Database::query(' - SELECT * FROM `' . TABLE_PANEL_DOMAINS . '` - WHERE `customerid` = ' . (int)$CustomerId . ' AND `id` = ' . (int)$_POST['main_domain']); - - if (Database::num_rows() > 0) { - self::SetInstallationValue($PackageId, $CustomerId, 'main_domain', $_POST['main_domain']); - } else { - self::SetInstallationValue($PackageId, $CustomerId, 'main_domain', '-1'); - - if (!in_array('main_domain', $Error)) { - $Error[] = 'main_domain'; - } - } - } - else - { - self::SetInstallationValue($PackageId, $CustomerId, 'main_domain', '-1'); - - if (!in_array('main_domain', $Error)) { - $Error[] = 'main_domain'; - } - } - - if(isset($_POST['main_location'])) - { - $Temp = $_POST['main_location']; - - //call function twice for security reasons! - $Temp = self::MakeSecurePath($Temp); - $Temp = self::MakeSecurePath($Temp); - - //previous instance check - $InstallPath = ''; - - //find real path for selected domain - $_id = self::GetInstallationValue($PackageId, $CustomerId, 'main_domain'); - $result3_stmt = Database::query(' - SELECT * FROM `' . TABLE_PANEL_DOMAINS . '` - WHERE `customerid` = ' . (int)$CustomerId . ' AND `id` = ' . (int)$_id); - - if (Database::num_rows() > 0) { - //build real path - $Row = $result3_stmt->fetch(PDO::FETCH_ASSOC); - $InstallPath = $Row['documentroot']; - $InstallPath.= $Temp; - $result4_stmt = Database::query('SELECT * FROM `' . TABLE_APS_INSTANCES . '` WHERE `CustomerID` = ' . (int)$CustomerId); - - //get all instances from current customer - //thats needed because there cannot be installed two apps within the same directory - while ($Row3 = $result4_stmt->fetch(PDO::FETCH_ASSOC)) { - //get all domains linked to instances - $result5_stmt = Database::query('SELECT * FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . (int)$Row3['ID'] . ' AND `Name` = "main_domain"'); - - if (Database::num_rows() > 0) { - $Row2 = $result5_stmt->fetch(PDO::FETCH_ASSOC); - $Reserved = ''; - - //get real domain path - $result6_stmt = Database::query('SELECT * FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `customerid` = ' . (int)$CustomerId . ' AND `id` = ' . (int)$Row2['Value']); - - if(Database::num_rows() > 0) - { - $Row = $result6_stmt->fetch(PDO::FETCH_ASSOC); - $Reserved = $Row['documentroot']; - } - - //get location under domain - $result7_stmt = Database::query('SELECT * FROM `' . TABLE_APS_SETTINGS . '` WHERE `InstanceID` = ' . (int)$Row3['ID'] . ' AND `Name` = "main_location"'); - - if (Database::num_rows() > 0) { - $Row = $result7_stmt->fetch(PDO::FETCH_ASSOC); - $Reserved.= $Row['Value']; - } - - //check whether there is another app installed already - if ($Reserved == $InstallPath) { - if (!in_array('main_location', $Error)){ - $Error[] = 'main_location'; - } - break; - } - } - } - } - - if (!in_array('main_location', $Error)) { - self::SetInstallationValue($PackageId, $CustomerId, 'main_location', $Temp); - } - } - else - { - if (!in_array('main_location', $Error)) { - $Error[] = 'main_location'; - } - self::SetInstallationValue($PackageId, $CustomerId, 'main_location', ''); - } - - if ($this->aps_version != '1.0') - { - $xml_license = $Xml->service->license; - } - else - { - $xml_license = $Xml->license; - } - - if($xml_license) - { - if($xml_license['must-accept'] - && $xml_license['must-accept'] == 'true') - { - if(isset($_POST['license']) - && $_POST['license'] == 'true') - { - self::SetInstallationValue($PackageId, $CustomerId, 'license', 'true'); - } - else - { - self::SetInstallationValue($PackageId, $CustomerId, 'license', 'false'); - - if(!in_array('license', $Error))$Error[] = 'license'; - } - } - } - - unset($Xml); - return $Error; - } - - /** - * functions provides the frontend of the installation wizard for the customer - * - * @param packageid id of package from database - * @param wrongdata array of fields that were wrong in previous validation check - * @return error false / success none - */ - private function ShowPackageInstaller($PackageId, $WrongData, $CustomerId) - { - global $lng, $filename, $s, $page, $action, $theme; - $Data = ''; - $Fieldname = ''; - $Fieldvalue = ''; - $Groupname = ''; - - if (!self::IsValidPackageId($PackageId, true)) { - return false; - } - - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `ID` = ' . (int)$PackageId); - $Row = $result_stmt->fetch(PDO::FETCH_ASSOC); - $Xml = self::GetXmlFromFile('./packages/' . $Row['Path'] . '/APP-META.xml'); - - //return if parse of xml file has failed - if ($Xml == false) { - return false; - } - - $this->aps_version = isset($Xml->attributes()->version) ? (string)$Xml->attributes()->version : '1.0'; - - //show notifcation if customer has reached his installation limit - if($this->userinfo['aps_packages'] != '-1' - && (int)$this->userinfo['aps_packages_used'] >= (int)$this->userinfo['aps_packages']) - { - self::InfoBox($lng['aps']['allpackagesused']); - return false; - } - - //icon for package - $Icon = 'templates/'.$theme.'/img/default.png'; - - if($this->aps_version != '1.0') - { - $iconpath = $Xml->presentation->icon['path']; - } - else - { - $iconpath = $Xml->icon['path']; - } - - if($iconpath) - { - $Icon = './packages/' . $Row['Path'] . '/' . basename($iconpath); - } - - //show error message if some input was wrong - $ErrorMessage = 0; - - if(count($WrongData) != 0) - { - $ErrorMessage = 1; - } - - //remove previously entered values if new installation has been triggered - if(!isset($_POST['withinput'])) - { - Database::query(' - DELETE FROM `' . TABLE_APS_TEMP_SETTINGS . '` - WHERE `CustomerID` = ' . (int)$CustomerId . ' AND `PackageID` = ' . (int)$PackageId); - } - - //where to install app? - $Temp = 'http://'; - $Value = self::GetInstallationValue($PackageId, $CustomerId, 'main_location'); - - if($Value) - { - $Temp.= '/'; - } - else - { - $Temp.= '/'; - } - - if(in_array('main_domain', $WrongData)) - { - $Temp.= self::FieldError($lng['aps']['nodomains']); - } - - if(in_array('main_location', $WrongData)) - { - $Temp.= self::FieldError($lng['aps']['wrongpath']); - } - - if(!in_array('main_location', $WrongData) - && !in_array('main_domain', $WrongData))$Temp.= '
    '; - $Temp.= '' . $lng['aps']['application_location_description'] . ''; - $Groupname = $lng['aps']['basic_settings']; - $Fieldname = $lng['aps']['application_location']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - - //database required? - if ($this->aps_version == '1.0') - { - // the good ole way - $XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db'); - } - else - { - // since 1.1 - $Xml->registerXPathNamespace('db', 'http://apstandard.com/ns/1/db'); - - $XmlDb = new DynamicProperties; - $XmlDb->db->id = getXPathValue($Xml, '//db:id'); - } - - if($XmlDb->db->id) - { - $Temp = ''; - - if(in_array('main_database_password', $WrongData)) - { - $Temp.= self::FieldError($lng['aps']['dbpassword']); - } - - if(!in_array('main_database_password', $WrongData))$Temp.= '
    '; - $Temp.= '' . $lng['aps']['database_password_description'] . ''; - $Groupname = ''; - $Fieldname = $lng['aps']['database_password']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - - if ($this->aps_version == '1.0') - { - // the good ole way - $aps_settings_array = $Xml->settings->group; - } - else - { - // since 1.1 - $aps_settings_array = $Xml->{'global-settings'}->setting; - if(!is_array($aps_settings_array)) { - $aps_settings_array = $Xml->service->settings->group; - } - } - - foreach($aps_settings_array as $Group) - { - $GroupPrinted = false; - foreach($Group->setting as $Setting) - { - $Temp = ''; - - if($Setting['type'] == 'string' - || $Setting['type'] == 'email' - || $Setting['type'] == 'integer' - || $Setting['type'] == 'float' - || $Setting['type'] == 'domain-name') - { - if(!$GroupPrinted) - { - $Groupname = $Group->name; - $GroupPrinted = true; - } - else - { - $Groupname = ''; - } - - $Value = self::GetInstallationValue($PackageId, $CustomerId, strval($Setting['id'])); - - if($Value) - { - $Temp.= ''; - } - elseif($Setting['default-value']) - { - $Temp.= ''; - } - else - { - $Temp.= ''; - } - - if(in_array($Setting['id'], $WrongData)) - { - if($Setting->{'error-message'}) - { - $Temp.= self::FieldError($Setting->{'error-message'}); - } - else - { - if($Setting['type'] == 'string') - { - $Temp.= self::FieldError($lng['aps']['error_text']); - } - elseif($Setting['type'] == 'email') - { - $Temp.= self::FieldError($lng['aps']['error_email']); - } - elseif($Setting['type'] == 'domain-name') - { - $Temp.= self::FieldError($lng['aps']['domain']); - } - elseif($Setting['type'] == 'integer') - { - $Temp.= self::FieldError($lng['aps']['error_integer']); - } - elseif($Setting['type'] == 'float') - { - $Temp.= self::FieldError($lng['aps']['error_float']); - } - } - } - } - elseif($Setting['type'] == 'password') - { - if(!$GroupPrinted) - { - $Groupname = $Group->name; - $GroupPrinted = true; - } - else - { - $Groupname = ''; - } - - $Temp.= ''; - - if(in_array($Setting['id'], $WrongData)) - { - if($Setting->{'error-message'}) - { - $Temp.= self::FieldError($Setting->{'error-message'}); - } - else - { - $Temp.= self::FieldError($lng['aps']['error_password']); - } - } - } - elseif($Setting['type'] == 'boolean') - { - if(!$GroupPrinted) - { - $Groupname = $Group->name; - $GroupPrinted = true; - } - else - { - $Groupname = ''; - } - - $Value = self::GetInstallationValue($PackageId, $CustomerId, strval($Setting['id'])); - - if($Value) - { - if($Value == 'true') - { - $Temp.= ''; - } - else - { - $Temp.= ''; - } - } - elseif($Setting['default-value'] == 'true') - { - $Temp.= ''; - } - else - { - $Temp.= ''; - } - } - elseif($Setting['type'] == 'enum') - { - if(!$GroupPrinted) - { - $Groupname = $Group->name; - $GroupPrinted = true; - } - else - { - $Groupname = ''; - } - - $Temp.= ''; - } - - //default field description - if(isset($Setting->description)) - { - if(!in_array(strval($Setting['id']), $WrongData))$Temp.= '
    '; - $Temp.= '' . $Setting->description . ''; - } - - $Fieldname = $Setting->name; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - } - - if ($this->aps_version != '1.0') - { - $xml_license = $Xml->service->license; - } - else - { - $xml_license = $Xml->license; - } - - if($xml_license) - { - $Temp = ''; - - if($xml_license['must-accept'] - && $xml_license['must-accept'] == 'true') - { - if($xml_license->text->name)$Temp.= $xml_license->text->name . '
    '; - - if($xml_license->text->file) - { - $Temp.= ''; - $Groupname = $lng['aps']['license']; - $Fieldname = $lng['aps']['license']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - else - { - $Temp.= '' . $lng['aps']['error_license'] . ''; - $Groupname = $lng['aps']['license']; - $Fieldname = $lng['aps']['license']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - - $Temp = ''; - - if(in_array('license', $WrongData)) - { - $Temp.= self::FieldError($lng['aps']['error_licensenoaccept']); - } - - $Groupname = ''; - $Fieldname = $lng['aps']['license_agreement']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - } - - eval("echo \"" . getTemplate("aps/installer") . "\";"); - unset($Xml); - } - - /** - * show informations for a package in basic or detailed view - * - * @param packageid id of package from database - * @param mode verbosity of data to view (basic|advanced) - * @return error false / success none - */ - private function ShowPackageInfo($PackageId, $All = false) - { - global $lng, $filename, $s, $page, $action, $userinfo, $theme; - $Data = ''; - $Fieldname = ''; - $Fieldvalue = ''; - $Groupname = ''; - - if (!self::IsValidPackageId($PackageId, true)) { - return false; - } - - $result_stmt = Database::query('SELECT * FROM `' . TABLE_APS_PACKAGES . '` WHERE `ID` = ' . (int)$PackageId); - $Row = $result_stmt->fetch(PDO::FETCH_ASSOC); - $Xml = self::GetXmlFromFile('./packages/' . $Row['Path'] . '/APP-META.xml'); - - //return if parse of xml file has failed - if ($Xml == false) { - return false; - } - - $Icon = 'templates/'.$theme.'/img/default.png'; - - $this->aps_version = isset($Xml->attributes()->version) ? (string)$Xml->attributes()->version : '1.0'; - - //show icon and basic data - if($this->aps_version != '1.0') - { - $iconpath = $Xml->presentation->icon['path']; - $Summary = htmlspecialchars($Xml->presentation->summary); - $categories = $Xml->presentation->categories; - $languages = $Xml->presentation->languages; - $description = $Xml->presentation->description; - $changelogs = $Xml->presentation->changelog; - $license = $Xml->service->license; - $screenshots = $Xml->presentation->screenshot; - } - else - { - $iconpath = $Xml->icon['path']; - $Summary = htmlspecialchars($Xml->summary); - $categories = $Xml->categories; - $languages = $Xml->languages; - $description = $Xml->description; - $changelogs = $Xml->changelog; - $license = $Xml->license; - $screenshots = $Xml->screenshot; - } - - if($iconpath) - { - $Icon = './packages/' . $Row['Path'] . '/' . basename($iconpath); - } - - $Fieldname = $lng['aps']['version']; - $Fieldvalue = $Xml->version . ' (Release ' . $Xml->release . ')'; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - - //show website - if($Xml->homepage) - { - $Fieldname = $lng['aps']['homepage']; - $Fieldvalue = '' . htmlspecialchars($Xml->homepage) . ''; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - - //show size after installation - if($Xml->{'installed-size'}) - { - $Fieldname = $lng['aps']['installed_size']; - $Fieldvalue = 'ca. ' . number_format(intval($Xml->{'installed-size'}) / (1024 * 1024), 2) . ' MB'; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - - //show categories - if($categories) - { - $Temp = ''; - foreach($categories->category as $_categories) - { - $Temp.= htmlspecialchars($_categories[0]) . '
    '; - } - - $Fieldname = $lng['aps']['categories']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - - //show available languages - if($languages) - { - $Temp = ''; - foreach($languages->language as $_languages) - { - $Temp.= $_languages[0] . ' '; - } - - $Fieldname = $lng['aps']['languages']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - - //show more information - if($All == true) - { - $Fieldname = $lng['aps']['long_description']; - $Fieldvalue = htmlspecialchars($description); - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - - //show config script language - if($Xml->{'configuration-script-language'}) - { - $Fieldname = $lng['aps']['configscript']; - $Fieldvalue = $Xml->{'configuration-script-language'}; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - - //show changelog - $Temp = '
      '; - foreach($changelogs->version as $Versions) - { - $Temp.= '
    • ' . $Versions['version'] . ' (Release ' . $Versions['release'] . ')'; - $Temp.= '
        '; - foreach($Versions->entry as $Entries) - { - $Temp.= '
      • ' . $Entries[0] . '
      • '; - } - - $Temp.= '
    • '; - } - - $Temp.= '
    '; - $Fieldname = $lng['aps']['changelog']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - - //show license - if($license) - { - if($license->text->file) - { - $Temp = ''; - - if($license->text->name)$Temp = $license->text->name . '
    '; - $Temp.= '
    '; - $Fieldname = $lng['aps']['license']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - else - { - $Fieldname = $lng['aps']['license']; - $Fieldvalue = '' . $lng['aps']['linktolicense'] . ''; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - } - - //show screenshots - if($screenshots) - { - $Count = 0; - $Temp = ''; - foreach($screenshots as $Screenshot) - { - $Count+= 1; - $Temp.= '' . $Screenshot->description . '
    ' . $Screenshot->description . '
    '; - - if(count($screenshots) != $Count)$Temp.= '
    '; - } - - $Fieldname = $lng['aps']['screenshots']; - $Fieldvalue = $Temp; - eval("\$Data.=\"" . getTemplate("aps/data") . "\";"); - } - } - - /* - * check if packages needs a database - * and if the customer has contingent for that, #272 - */ - if ($this->aps_version == '1.0') - { - // the good ole way - $XmlDb = $Xml->requirements->children('http://apstandard.com/ns/1/db'); - } - else - { - // since 1.1 - $Xml->registerXPathNamespace('db', 'http://apstandard.com/ns/1/db'); - - $XmlDb = new DynamicProperties; - $XmlDb->db->id = getXPathValue($Xml, '//db:id'); - } - - if($XmlDb->db->id) - { - if($userinfo['mysqls_used'] < $userinfo['mysqls'] - || $userinfo['mysqls'] == '-1' - ){ - $can_use_db = true; - } else { - $can_use_db = false; - } - } else { $can_use_db = true; } - - $db_info = ''; - if(!$can_use_db) - { - $db_info = $lng['aps']['packageneedsdb']; - } - - eval("echo \"" . getTemplate("aps/package") . "\";"); - unset($Xml); - } - - /** - * show a nice looking infobox - * - * @param string $Message message to display in beautifull layout - * @param int $Type 0 = warning, 1 = errror, 2 = success - * - */ - private function InfoBox($Message, $Type = 0) { - global $lng, $filename, $s, $page, $action, $theme; - //shows a box with informations - eval("echo \"" . getTemplate("aps/infobox") . "\";"); - } - - /** - * returns html code for nice looking boxes to show customers wrong input - * - * @param error error to display in beautifull layout - */ - private function FieldError($Error) { - return '
    ' . $Error . '
    '; - } -} diff --git a/lib/classes/aps/class.ApsUpdater.php b/lib/classes/aps/class.ApsUpdater.php deleted file mode 100644 index 482f3020..00000000 --- a/lib/classes/aps/class.ApsUpdater.php +++ /dev/null @@ -1,259 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package APS - * - * @todo logging - * install specific packages by name - * other solution than using url_fopen - * move url for distributionserver into panel - */ - -class ApsUpdater extends ApsParser { - - private $settings = array(); - private $RequestDomain = ''; - private $RootUrl = ''; - private $RootDir = ''; - - /** - * FroxlorLogger - * @var FroxlorLogger - */ - private $_cronlog = null; - - /** - * constructor of class. setup some basic variables needed by class - * - * @param cronlog instance of the froxlor logger - */ - public function __construct($cronlog) { - - $this->RequestDomain = 'apscatalog.com'; - $this->RootUrl = '/1/'; - $this->RootDir = dirname(dirname(dirname(dirname(__FILE__)))) . '/'; - $this->_cronlog = $cronlog; - } - - /** - * Main function of class which handles all around the update mechanism - */ - public function UpdateHandler() { - - $this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Changing directory to '" . $this->RootDir . "'"); - chdir($this->RootDir); - - //return if allow_url_fopen is disabled - if (!ini_get('allow_url_fopen')) { - $this->_cronlog->logAction(CRON_ACTION, LOG_ERROR, "The APS updater cronjob requires that allow_url_fopen is enabled for the PHP CLI binary!"); - echo "The APS updater cronjob requires that allow_url_fopen is enabled for the PHP CLI binary!\n"; - return; - } - - //return if no task exists - $Result_stmt = Database::query("SELECT * FROM `" . TABLE_APS_TASKS . "` WHERE `Task` IN (" . TASK_SYSTEM_UPDATE . ", " . TASK_SYSTEM_DOWNLOAD . ")"); - - if (Database::num_rows() == 0) { - $this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "No tasks for ApsUpdater"); - return; - } - - //query first task -> updater can only do one job within a run - $Task = $Result_stmt->fetch(PDO::FETCH_ASSOC); - $del_stmt = Database::prepare(" - DELETE FROM `" . TABLE_APS_TASKS . "` WHERE `Task` = :task - "); - Database::pexecute($del_stmt, array('task' => $Task['Task'])); - - //fetch all vendors - $this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Fetching all Vendors from '" . $this->RootUrl . "'"); - $Vendors = self::FetchSubUrls($this->RootUrl); - - if ($Vendors !== false) { - - foreach ($Vendors as $Vendor) { - - //fetch all applications from vendors - $this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Fetching all from Vendor '" . $Vendor. "'"); - $Applications = self::FetchSubUrls($this->RootUrl . $Vendor); - - if ($Applications !== false) { - - foreach ($Applications as $Application) { - - //get newest version of package which is already installed - $this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Checking application '" . substr($Application, 0, -1) . "'"); - - $CurrentVersion = ''; - $Result_stmt = Database::prepare(" - SELECT * FROM `" . TABLE_APS_PACKAGES . "` WHERE `Name` = :name - "); - Database::pexecute($Result_stmt, array('name' => substr($Application, 0, -1))); - $numrows_result = Database::num_rows(); - - while ($Row = $Result_stmt->fetch(PDO::FETCH_ASSOC)) { - if (version_compare($Row['Version'] . '-' . $Row['Release'], $CurrentVersion) == 1) { - $CurrentVersion = $Row['Version'] . '-' . $Row['Release']; - } - } - - if ($numrows_result!= 0) { - //package already installed in system, search for newer version - if ($Task['Task'] != TASK_SYSTEM_UPDATE) { - continue; - } - - //fetch different versions of application from distribution server - $NewerVersion = ''; - $Versions = self::FetchSubUrls($this->RootUrl . $Vendor . $Application); - - if ($Versions !== false) { - foreach ($Versions as $Version) { - $OnlineVersion = substr($Version, 0, -1); - //is package newer than current version? - if (version_compare($OnlineVersion, $CurrentVersion) == 1) { - //is new package newer than another one found before? - if (version_compare($OnlineVersion, $NewerVersion) == 1) { - $NewerVersion = $OnlineVersion; - } - } - } - - if ($NewerVersion != '') { - //download package as an update - self::DownloadPackage($this->RootUrl . $Vendor . $Application . $NewerVersion, substr($Application, 0, -1), $NewerVersion); - continue; - } - } - - } else { - - if ($Task['Task'] != TASK_SYSTEM_DOWNLOAD) { - continue; - } - - //new packages - $NewVersion = ''; - $Versions = self::FetchSubUrls($this->RootUrl . $Vendor . $Application); - - foreach ($Versions as $Version) { - $OnlineVersion = substr($Version, 0, -1); - //is package newer than another one found before? - if (version_compare($OnlineVersion, $NewVersion) == 1) { - $NewVersion = $OnlineVersion; - } - } - - if ($NewVersion != '') { - //download package as a new one - self::DownloadPackage($this->RootUrl . $Vendor . $Application . $NewVersion, substr($Application, 0, -1), $NewVersion); - continue; - } - } - } - } - } - } - } - - /** - * download a package from the distribution server and move the downloaded file in the temporary directory - * - * @param url url to download - * @param application string identifying the application name - * @param version string identifying the application version - * @return success true/error false - */ - private function DownloadPackage($Url, $Application, $Version) { - - $Downloads = self::FetchSubUrls($Url . '/'); - - //make url valid - $path = dirname($Url); - $file = urlencode(basename($Url)); - $file_url = 'http://' . $this->RequestDomain . $path . '/' . $file . '.aps' . $Downloads[0]; - - //get content from website url - $this->_cronlog->logAction(CRON_ACTION, LOG_NOTICE, "Downloading '" . $file_url . "'"); - $Content = @file_get_contents($file_url); - - if ($Content != false) { - //open file to write contents on disk - $FileHandle = fopen($this->RootDir . 'temp/' . $Application . '-' . $Version . '.app.zip', 'wb'); - - if ($FileHandle == true) { - //write results to disk - fwrite($FileHandle, $Content); - fclose($FileHandle); - - //set right permissions - chmod($this->RootDir . 'temp/' . $Application . '-' . $Version . '.app.zip', 0664); - return true; - - } else { - return false; - } - } else { - return false; - } - } - - /** - * fetch html content of distribution server and parse all information - * - * @param requestdomain domain to aps-/mirrorserver with package api - * @param url url to fetch sub links from - * @return error false/success array with relative sub links - */ - private function FetchSubUrls($Url) { - - $Return = array(); - - //make url valid - $Url = str_replace(' ', '%20', $Url); - $file_url = 'http://' . $this->RequestDomain . $Url; - - //get content from website url - $Content = @file($file_url); - - if ($Content !== false) { - - foreach ($Content as $Temp) { - //skip empty lines - if ($Temp != "\r\n" - && $Temp != "\r" - && $Temp != "\n" - && $Temp != "" - ) { - //remove unwanted characters - $Temp = trim($Temp); - - //grep URLs which match defined format - if (preg_match("/^ (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package APS - * - */ - -class DynamicProperties { /* empty class for some magic */ } diff --git a/lib/formfields/admin/admin/formfield.admin_add.php b/lib/formfields/admin/admin/formfield.admin_add.php index 3f659d62..fa897d06 100644 --- a/lib/formfields/admin/admin/formfield.admin_add.php +++ b/lib/formfields/admin/admin/formfield.admin_add.php @@ -177,14 +177,6 @@ return array( 'mandatory' => true, 'ul_field' => $email_quota_ul ), - 'email_autoresponder' => array( - 'label' => $lng['customer']['autoresponder'], - 'type' => 'textul', - 'value' => 0, - 'maxlength' => 9, - 'visible' => ($settings['autoresponder']['autoresponder_active'] == '1' ? true : false), - 'ul_field' => $email_autoresponder_ul - ), 'ftps' => array( 'label' => $lng['customer']['ftps'], 'type' => 'textul', @@ -215,23 +207,6 @@ return array( 'maxlength' => 9, 'mandatory' => true, 'ul_field' => $mysqls_ul - ), - 'can_manage_aps_packages' => array( - 'label' => $lng['aps']['canmanagepackages'], - 'type' => 'checkbox', - 'values' => array( - array ('label' => $lng['panel']['yes'], 'value' => '1') - ), - 'value' => array(), - 'visible' => ($settings['aps']['aps_active'] == '1' ? true : false) - ), - 'number_of_aps_packages' => array( - 'label' => $lng['aps']['numberofapspackages'], - 'type' => 'textul', - 'value' => 0, - 'maxlength' => 9, - 'visible' => ($settings['aps']['aps_active'] == '1' ? true : false), - 'ul_field' => $number_of_aps_packages_ul ) ) ) diff --git a/lib/formfields/admin/admin/formfield.admin_edit.php b/lib/formfields/admin/admin/formfield.admin_edit.php index 861013fc..99031eb5 100644 --- a/lib/formfields/admin/admin/formfield.admin_edit.php +++ b/lib/formfields/admin/admin/formfield.admin_edit.php @@ -191,14 +191,6 @@ return array( 'mandatory' => true, 'ul_field' => $email_quota_ul ), - 'email_autoresponder' => array( - 'label' => $lng['customer']['autoresponder'], - 'type' => 'textul', - 'value' => $result['email_autoresponder'], - 'maxlength' => 9, - 'visible' => ($settings['autoresponder']['autoresponder_active'] == '1' ? true : false), - 'ul_field' => $email_autoresponder_ul - ), 'ftps' => array( 'label' => $lng['customer']['ftps'], 'type' => 'textul', @@ -229,23 +221,6 @@ return array( 'maxlength' => 9, 'mandatory' => true, 'ul_field' => $mysqls_ul - ), - 'can_manage_aps_packages' => array( - 'label' => $lng['aps']['canmanagepackages'], - 'type' => 'checkbox', - 'values' => array( - array ('label' => $lng['panel']['yes'], 'value' => '1') - ), - 'value' => array($result['can_manage_aps_packages']), - 'visible' => ($settings['aps']['aps_active'] == '1' ? true : false) - ), - 'number_of_aps_packages' => array( - 'label' => $lng['aps']['numberofapspackages'], - 'type' => 'textul', - 'value' => $result['aps_packages'], - 'maxlength' => 9, - 'visible' => ($settings['aps']['aps_active'] == '1' ? true : false), - 'ul_field' => $number_of_aps_packages_ul ) ) ) diff --git a/lib/formfields/customer/extras/formfield.backup.php b/lib/formfields/customer/extras/formfield.backup.php deleted file mode 100644 index 1564f03e..00000000 --- a/lib/formfields/customer/extras/formfield.backup.php +++ /dev/null @@ -1,36 +0,0 @@ - (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Formfields - */ - -return array( - 'backup' => array( - 'title' => $lng['backup'], - 'image' => 'icons/backup.png', - 'sections' => array( - 'section_a' => array( - 'title' => $lng['backup'], - 'image' => 'icons/backup.png', - 'fields' => array( - 'path' => array( - 'label' => $lng['extras']['backup_create'], - 'desc' => sprintf($lng['extras']['backup_info'], $userinfo['loginname']).'
    '.($settings['system']['backup_bigfile'] == 1 ? $lng['extras']['backup_info_big'] : $lng['extras']['backup_info_sep']).'
    '.($settings['system']['backup_count'] == 1 ? $lng['extras']['backup_count_info'] : ''), - 'type' => 'yesno', - 'yesno_var' => $backup_enabled - ) - ) - ) - ) - ) -); diff --git a/lib/tables.inc.php b/lib/tables.inc.php index f8d5054b..b9c1a216 100644 --- a/lib/tables.inc.php +++ b/lib/tables.inc.php @@ -43,34 +43,13 @@ define('TABLE_PANEL_IPSANDPORTS', 'panel_ipsandports'); define('TABLE_PANEL_TICKETS', 'panel_tickets'); define('TABLE_PANEL_TICKET_CATS', 'panel_ticket_categories'); define('TABLE_PANEL_LOG', 'panel_syslog'); -define('TABLE_MAIL_AUTORESPONDER', 'mail_autoresponder'); define('TABLE_PANEL_PHPCONFIGS', 'panel_phpconfigs'); -define('TABLE_APS_PACKAGES', 'aps_packages'); -define('TABLE_APS_INSTANCES', 'aps_instances'); -define('TABLE_APS_SETTINGS', 'aps_settings'); -define('TABLE_APS_TASKS', 'aps_tasks'); -define('TABLE_APS_TEMP_SETTINGS', 'aps_temp_settings'); define('TABLE_PANEL_CRONRUNS', 'cronjobs_run'); define('TABLE_PANEL_REDIRECTCODES', 'redirect_codes'); define('TABLE_PANEL_DOMAINREDIRECTS', 'domain_redirect_codes'); define('TABLE_PANEL_DOMAIN_SSL_SETTINGS', 'domain_ssl_settings'); define('TABLE_DOMAINTOIP', 'panel_domaintoip'); -// APS constants -define('TASK_INSTALL', 1); -define('TASK_REMOVE', 2); -define('TASK_RECONFIGURE', 3); -define('TASK_UPGRADE', 4); -define('TASK_SYSTEM_UPDATE', 5); -define('TASK_SYSTEM_DOWNLOAD', 6); -define('INSTANCE_INSTALL', 1); -define('INSTANCE_TASK_ACTIVE', 2); -define('INSTANCE_SUCCESS', 3); -define('INSTANCE_ERROR', 4); -define('INSTANCE_UNINSTALL', 5); -define('PACKAGE_LOCKED', 1); -define('PACKAGE_ENABLED', 2); - // VERSION INFO $version = '0.9.31-rc1'; $dbversion = '2'; diff --git a/lng/english.lng.php b/lng/english.lng.php index bc67069b..769fb5c1 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -911,25 +911,8 @@ $lng['panel']['not_supported'] = 'Not supported in: '; $lng['emails']['quota_edit'] = 'Change E-Mail Quota'; $lng['error']['allocatetoomuchquota'] = 'You tried to allocate %s MB Quota, but you do not have enough left.'; -// Autoresponder module - -$lng['menue']['email']['autoresponder'] = 'Autoresponder'; -$lng['autoresponder']['active'] = 'Active'; -$lng['autoresponder']['autoresponder_add'] = 'Add autoresponder'; -$lng['autoresponder']['autoresponder_edit'] = 'Edit autoresponder'; -$lng['autoresponder']['autoresponder_new'] = 'Create new autoresponder'; -$lng['autoresponder']['subject'] = 'Subject'; -$lng['autoresponder']['message'] = 'Message'; -$lng['autoresponder']['account'] = 'Account'; -$lng['autoresponder']['sender'] = 'Sender'; -$lng['question']['autoresponderdelete'] = 'Do you really want to delete the autoresponder?'; -$lng['error']['noemailaccount'] = 'There can be two reasons why you cannot create a new autoresponder: You need at least one email account to create a new autoresponder. Secondly it can be possible that all accounts already have an autoresponder configured.'; $lng['error']['missingfields'] = 'Not all required fields were filled out.'; $lng['error']['accountnotexisting'] = 'The given email account doesn\'t exist.'; -$lng['error']['autoresponderalreadyexists'] = 'There is already an autoresponder configured for this account.'; -$lng['error']['invalidautoresponder'] = 'The given account is invalid.'; -$lng['serversettings']['autoresponder_active']['title'] = 'Use autoresponder module'; -$lng['serversettings']['autoresponder_active']['description'] = 'Do you want to use the autoresponder module?'; $lng['admin']['security_settings'] = 'Security Options'; $lng['admin']['know_what_youre_doing'] = 'Change only, if you know what you\'re doing!'; $lng['admin']['show_version_login']['title'] = 'Show Froxlor version on login'; @@ -996,174 +979,6 @@ $lng['error']['index_file_extension'] = 'The file extension for the index file m $lng['admin']['expert_settings'] = 'Expert settings!'; $lng['admin']['mod_fcgid_starter']['title'] = 'PHP Processes for this domain (empty for default value)'; -//added with aps installer - -$lng['admin']['aps'] = 'APS Installer'; -$lng['customer']['aps'] = 'APS Installer'; -$lng['aps']['scan'] = 'Scan for new packages'; -$lng['aps']['upload'] = 'Upload new packages'; -$lng['aps']['managepackages'] = 'Manage packages'; -$lng['aps']['manageinstances'] = 'Manage instances'; -$lng['aps']['overview'] = 'Package overview'; -$lng['aps']['status'] = 'My packages'; -$lng['aps']['search'] = 'Search for packages'; -$lng['aps']['upload_description'] = 'Please select the APS Installer zipfiles to install them in the system.'; -$lng['aps']['search_description'] = 'Name, Description, Keyword, Version'; -$lng['aps']['detail'] = 'More information'; -$lng['aps']['install'] = 'Install package'; -$lng['aps']['data'] = 'Data'; -$lng['aps']['version'] = 'Version'; -$lng['aps']['homepage'] = 'Homepage'; -$lng['aps']['installed_size'] = 'Size after Installation'; -$lng['aps']['categories'] = 'Categories'; -$lng['aps']['languages'] = 'Languages'; -$lng['aps']['long_description'] = 'Long description'; -$lng['aps']['configscript'] = 'Configuration script'; -$lng['aps']['changelog'] = 'Changelog'; -$lng['aps']['license'] = 'License'; -$lng['aps']['license_link'] = 'Link to License'; -$lng['aps']['screenshots'] = 'Screenshots'; -$lng['aps']['back'] = 'Back to overview'; -$lng['aps']['install_wizard'] = 'Installation wizard...'; -$lng['aps']['wizard_error'] = 'Your input contains invalid data. Please correct yourself to continue the installation.'; -$lng['aps']['basic_settings'] = 'Basic settings'; -$lng['aps']['application_location'] = 'Installation location'; -$lng['aps']['application_location_description'] = 'Location where the application will be installed.'; -$lng['aps']['no_domains'] = 'No domains found'; -$lng['aps']['database_password'] = 'Database password'; -$lng['aps']['database_password_description'] = 'Password which should be used for the new created database.'; -$lng['aps']['license_agreement'] = 'Agreement'; -$lng['aps']['cancel_install'] = 'Abort Installation'; -$lng['aps']['notazipfile'] = 'The uploaded file is not a zipfile.'; -$lng['aps']['filetoobig'] = 'The file is too big.'; -$lng['aps']['filenotcomplete'] = 'The file wasn\'t uploaded completely.'; -$lng['aps']['phperror'] = 'There occured a PHP internal error. The PHP upload errorcode is #'; -$lng['aps']['moveproblem'] = 'The script failed to move the uploaded file into the destination directory. Please ensure that all permissions are set correctly.'; -$lng['aps']['uploaderrors'] = 'Errors for the file %s
      %s
    '; -$lng['aps']['nospecialchars'] = 'Special characters are not allowed in the search term!'; -$lng['aps']['noitemsfound'] = 'No packages were found!'; -$lng['aps']['nopackagesinstalled'] = 'You haven\'t installed any package yet which could be shown.'; -$lng['aps']['instance_install'] = 'Package Installation pending'; -$lng['aps']['instance_task_active'] = 'Package is currently being processed'; -$lng['aps']['instance_success'] = 'Package is installed/was installed successfully'; -$lng['aps']['instance_error'] = 'Package isn\'t installed - there occured some errors on the installation'; -$lng['aps']['instance_uninstall'] = 'Package uninstall pending'; -$lng['aps']['unknown_status'] = 'Error - Unknown value'; -$lng['aps']['currentstatus'] = 'Current status'; -$lng['aps']['activetasks'] = 'Current tasks'; -$lng['aps']['task_install'] = 'Installation pending'; -$lng['aps']['task_remove'] = 'Uninstallation pending'; -$lng['aps']['task_reconfigure'] = 'Reconfiguration pending'; -$lng['aps']['task_upgrade'] = 'Update/Upgrade pending'; -$lng['aps']['no_task'] = 'No tasks pending'; -$lng['aps']['applicationlinks'] = 'Application links'; -$lng['aps']['mainsite'] = 'Main site'; -$lng['aps']['uninstall'] = 'Uninstall package'; -$lng['aps']['reconfigure'] = 'Change settings'; -$lng['aps']['erroronnewinstance'] = 'This package cannot be installed.

    Please go back to the package overview and start a new Installation.'; -$lng['aps']['successonnewinstance'] = '%s will be installed now.

    Go back to "My packages" and wait until the Installation has finished. This can take some time.'; -$lng['aps']['php_misc_handler'] = 'PHP - Misc - There is no support for other file extensions than .php for the PHP Parser.'; -$lng['aps']['php_misc_directoryhandler'] = 'PHP - Misc - There is no support for per directory disabled PHP Handlers.'; -$lng['aps']['asp_net'] = 'ASP.NET - Package not supported.'; -$lng['aps']['cgi'] = 'CGI - Package not supported.'; -$lng['aps']['php_extension'] = 'PHP - Extension "%s" missing.'; -$lng['aps']['php_function'] = 'PHP - Function "%s" missing.'; -$lng['aps']['php_configuration'] = 'PHP - Configuration - Current "%s" setting not supported by package.'; -$lng['aps']['php_configuration_post_max_size'] = 'PHP - Configuration - "post_max_size" value too low.'; -$lng['aps']['php_configuration_memory_limit'] = 'PHP - Configuration - "memory_limit" value too low.'; -$lng['aps']['php_configuration_max_execution_time'] = 'PHP - Configuration - "max_execution_time" value too low.'; -$lng['aps']['php_general_old'] = 'PHP - General - PHP Version too old.'; -$lng['aps']['php_general_new'] = 'PHP - General - PHP Version too new.'; -$lng['aps']['db_mysql_support'] = 'Database - The package needs another database engine than MySQL.'; -$lng['aps']['db_mysql_version'] = 'Database - MySQL server too old.'; -$lng['aps']['webserver_module'] = 'Webserver - Module "%s" missing.'; -$lng['aps']['webserver_fcgid'] = 'Webserver - This package requires additional modules from the webserver. In your FastCGI/mod_fcgid environment the function "apache_get_modules" doesn\'t exist. The package cannot be installed because the APS Installer is unable to verify if this modules are installed.'; -$lng['aps']['webserver_htaccess'] = 'Webserver - This package requires that .htaccess files are parsed by the webserver. The package cannot be installed because the APS Installer is unable to determine if this is enabled.'; -$lng['aps']['misc_configscript'] = 'Misc - The language of the configuration script is not supported.'; -$lng['aps']['misc_charset'] = 'Misc - In the current Installer version its not possibel to validate formfields from the wizard against a specific charset. The package cannot be installed.'; -$lng['aps']['misc_version_already_installed'] = 'Same version of package already installed.'; -$lng['aps']['misc_only_newer_versions'] = 'For security reasons only newer package versions can be installed on the system than them which are already installed.'; -$lng['aps']['erroronscan'] = 'Errors for %s
      %s
    '; -$lng['aps']['invalidzipfile'] = 'Errors for %s
    • This is not a valid APS zipfile!
    '; -$lng['aps']['successpackageupdate'] = '%s successfully installed as a package update'; -$lng['aps']['successpackageinstall'] = '%s successfully installed as a new package'; -$lng['aps']['class_zip_missing'] = 'SimpleXML Class, exec function or ZIP Functions missing or not enabled! For further information about this problem look into the handbook for this module.'; -$lng['aps']['dir_permissions'] = 'The PHP/webserver process must be able to write in the directory {$path}temp/ and {$path}packages/'; -$lng['aps']['initerror'] = 'There are some problems with this module:
      %s
    Fix these problems, otherwise the module cannot be used!'; -$lng['aps']['iderror'] = 'Wrong id specified!'; -$lng['aps']['nopacketsforinstallation'] = 'There are no packages to install.'; -$lng['aps']['nopackagestoinstall'] = 'There are no packages to view or install.'; -$lng['aps']['nodomains'] = 'Select a domain from the list. If there is none, the package cannot be installed!'; -$lng['aps']['wrongpath'] = 'Either this path contains invalid characters or there is another application installed already.'; -$lng['aps']['dbpassword'] = 'Specify a password with a minimum length of 8 characters.'; -$lng['aps']['error_text'] = 'Specify a text without special characters.'; -$lng['aps']['error_email'] = 'Specify a valid e-mail address.'; -$lng['aps']['error_domain'] = 'Specify a valid URL like http://www.example.com/'; -$lng['aps']['error_integer'] = 'Specify a numeric value (Integer-Format) e.g. 5 or 7.'; -$lng['aps']['error_float'] = 'Specify a numeric value (Float-Format) e.g. 5,2432 or 7,5346.'; -$lng['aps']['error_password'] = 'Specify a password.'; -$lng['aps']['error_license'] = 'Yes, I have read the license and will abide by its terms.'; -$lng['aps']['error_licensenoaccept'] = 'You must accept the license to install this application.'; -$lng['aps']['stopinstall'] = 'Abort Installation'; -$lng['aps']['installstopped'] = 'The Installation of this package was aborted successfully.'; -$lng['aps']['installstoperror'] = 'The Installation cannot be aborted anymore because installation has started already. If you\'d like to uninstall the package, wait until the Installation has finished and then go to "My packages" to trigger an Uninstall.'; -$lng['aps']['waitfortask'] = 'There are no actions to select. Wait until all tasks have finished.'; -$lng['aps']['removetaskexisting'] = 'There is already a task for uninstallation.

    Please go back to "My packages" and wait until the uninstall has finished.'; -$lng['aps']['packagewillberemoved'] = 'The package will be uninstalled now.

    Please go back to "My packages" and wait until the uninstall has finished.'; -$lng['question']['reallywanttoremove'] = 'Do you really want to uninstall this package?

    All database contents and files will be erased. Be sure to make a manual backup of a files you need for any further usage!

    '; -$lng['aps']['searchoneresult'] = '%s package found'; -$lng['aps']['searchmultiresult'] = '%s packages found'; -$lng['question']['reallywanttostop'] = 'Do you really want to abort the installation of this package?

    '; -$lng['aps']['packagenameandversion'] = 'Packagename & version'; -$lng['aps']['package_locked'] = 'Locked'; -$lng['aps']['package_enabled'] = 'Enabled'; -$lng['aps']['lock'] = 'Lock'; -$lng['aps']['unlock'] = 'Enable'; -$lng['aps']['remove'] = 'Remove'; -$lng['aps']['allpackages'] = 'All packages'; -$lng['question']['reallyremovepackages'] = 'Do you really want to delete these packages?

    Packages with dependencies can only be remove if the corresponding Instances have been removed!

    '; -$lng['aps']['nopackagesinsystem'] = 'There were no packages installed in the system which could be managed.'; -$lng['aps']['packagenameandstatus'] = 'Packagename & status'; -$lng['aps']['activate_aps']['title'] = 'Enable APS installer'; -$lng['aps']['activate_aps']['description'] = 'Here the APS installer can be enabled and disabled globaly.'; -$lng['aps']['packages_per_page']['title'] = 'Packages per page'; -$lng['aps']['packages_per_page']['description'] = 'How many packages should be displayed per page for customers?'; -$lng['aps']['upload_fields']['title'] = 'Upload fields per page'; -$lng['aps']['upload_fields']['description'] = 'How many upload fields should be displayed on the page to install new packages in the system?'; -$lng['aps']['exceptions']['title'] = 'Exceptions for package validation'; -$lng['aps']['exceptions']['description'] = 'Some packages need special configuration parameters or modules. The installer cannot always determine if this options/extensions are available. For this reason you can now define exceptions that packages can be installed in the system. Do only select options which match your real configuration setup. For further information about this problem look into the handbook for this module.'; -$lng['aps']['settings_php_extensions'] = 'PHP-Extensions'; -$lng['aps']['settings_php_configuration'] = 'PHP-Configuration'; -$lng['aps']['settings_webserver_modules'] = 'Webserver modules'; -$lng['aps']['settings_webserver_misc'] = 'Webserver miscellaneous'; -$lng['aps']['specialoptions'] = 'Special options'; -$lng['aps']['removeunused'] = 'Remove unused packages'; -$lng['aps']['enablenewest'] = 'Enabled newest version of package, lock others'; -$lng['aps']['installations'] = 'Installations'; -$lng['aps']['statistics'] = 'Statistics'; -$lng['aps']['numerofpackagesinstalled'] = '%s packages installed
    '; -$lng['aps']['numerofpackagesenabled'] = '%s packages enabled
    '; -$lng['aps']['numerofpackageslocked'] = '%s packages locked
    '; -$lng['aps']['numerofinstances'] = '%s Instances installed
    '; -$lng['question']['reallydoaction'] = 'Do you really want to execute the selected actions?

    Data which can be lost by continuing, cannot be restored later.

    '; -$lng['aps']['linktolicense'] = 'Link to license'; -$lng['aps']['initerror_customer'] = 'There is currently a problem with this Froxlor extension. Contact your administrator for further information.'; -$lng['aps']['numerofinstances'] = '%s Installations at all
    '; -$lng['aps']['numerofinstancessuccess'] = '%s successful Installations
    '; -$lng['aps']['numerofinstanceserror'] = '%s failed Installations
    '; -$lng['aps']['numerofinstancesaction'] = '%s planed Installations/Uninstallations'; -$lng['aps']['downloadallpackages'] = 'Download all packages from distribution server'; -$lng['aps']['updateallpackages'] = 'Update all packages by distribution server'; -$lng['aps']['downloadtaskexists'] = 'There is already a task for the download of all packages. Please wait until this task has finished.'; -$lng['aps']['downloadtaskinserted'] = 'A task for the download of all packages has been created. This can take up to several minutes.'; -$lng['aps']['updatetaskexists'] = 'There is already an task for the update of all packages. Please wait until this task has finished.'; -$lng['aps']['updatetaskinserted'] = 'A task for the update of all packages has been created. This can take up to several minutes.'; -$lng['aps']['canmanagepackages'] = 'Can manage APS packages'; -$lng['aps']['numberofapspackages'] = 'Amount of APS installations'; -$lng['aps']['allpackagesused'] = 'Error

    You have already reached the number of installable APS applications.'; -$lng['aps']['noinstancesexisting'] = 'There are currently no instances which could be managed. There must be installed at least one application by a customer.'; -$lng['aps']['lightywarning'] = 'Warning'; -$lng['aps']['lightywarningdescription'] = 'You are using the lighttpd webserver together with Froxlor. The APS module was mainly written for Apache, so it can be possible that some features do not work with lighttpd. Please remember this when using the APS module. If you have found or experienced any problems in connection with lighttpd and the APS module please report them to the developers that they can be fixed within the next release if Froxlor.'; $lng['error']['customerdoesntexist'] = 'The customer you have chosen doesn\'t exist.'; $lng['error']['admindoesntexist'] = 'The admin you have chosen doesn\'t exist.'; @@ -1192,7 +1007,6 @@ $lng['serversettings']['mod_fcgid']['maxrequests']['description'] = 'How many re // fix bug #1124 $lng['admin']['webserver'] = 'Webserver'; $lng['error']['admin_domain_emailsystemhostname'] = 'The server-hostname cannot be used as email-domain.'; -$lng['aps']['license_link'] = 'Link to the license'; // ADDED IN 1.4.2.1-1 @@ -1230,9 +1044,6 @@ $lng['panel']['toomanydirs'] = 'Too many subdirectories. Falling back to manual $lng['panel']['abort'] = 'Abort'; $lng['serversettings']['cron']['debug']['title'] = 'Cronscript debugging'; $lng['serversettings']['cron']['debug']['description'] = 'Activate to keep the lockfile after a cron-run for debugging.
    Attention:Keeping the lockfile can cause the next scheduled cron not to run properly.'; -$lng['autoresponder']['date_from'] = 'Start date'; -$lng['autoresponder']['date_until'] = 'End date'; -$lng['autoresponder']['startenddate'] = 'Start/end date'; $lng['panel']['not_activated'] = 'not activated'; $lng['panel']['off'] = 'off'; $lng['update']['updateinprogress_onlyadmincanlogin'] = 'A newer version of Froxlor has been installed but not yet set up.
    Only the administrator can log in and finish the update.'; @@ -1305,9 +1116,6 @@ $lng['crondesc']['cron_unknown_desc'] = 'no description given'; $lng['admin']['cron']['add'] = 'Add cronjob'; $lng['crondesc']['cron_tasks'] = 'generating of configfiles'; $lng['crondesc']['cron_legacy'] = 'legacy (old) cronjob'; -$lng['crondesc']['cron_apsinstaller'] = 'APS-installer'; -$lng['crondesc']['cron_autoresponder'] = 'e-mail autoresponder'; -$lng['crondesc']['cron_apsupdater'] = 'updating APS packages'; $lng['crondesc']['cron_traffic'] = 'traffic calculation'; $lng['crondesc']['cron_ticketsreset'] = 'resetting ticket-counters'; $lng['crondesc']['cron_ticketarchive'] = 'archiving old tickets'; @@ -1334,7 +1142,6 @@ $lng['ftp']['editpassdescription'] = 'Set new password or leave blank for no cha $lng['customer']['sendinfomail'] = 'Send data via email to me'; $lng['customer']['mysql_add']['infomail_subject'] = '[Froxlor] New database created'; $lng['customer']['mysql_add']['infomail_body']['main'] = "Hello {CUST_NAME},\n\nyou have just added a new database. Here is the entered information:\n\nDatabasename: {DB_NAME}\nPassword: {DB_PASS}\nDescription: {DB_DESC}\nDB-Hostname: {DB_SRV}\nphpMyAdmin: {PMA_URI}\nYours sincerely, your administrator"; -$lng['error']['domains_cantdeletedomainwithapsinstances'] = 'You cannot delete a domain which is used by an installed APS package. You have to uninstall it first.'; $lng['serversettings']['awstats_path'] = 'Path to AWStats \'awstats_buildstaticpages.pl\''; $lng['serversettings']['awstats_conf'] = 'AWStats configuration path'; $lng['error']['overviewsettingoptionisnotavalidfield'] = 'Woops, a field that should be displayed as an option in the settings-overview is not an excepted type. You can blame the developers for this. This should not happen!'; @@ -1383,12 +1190,6 @@ $lng['serversettings']['customredirect_default']['description'] = 'Set the defau // ADDED IN FROXLOR 0.9.7-svn2 $lng['error']['pathmaynotcontaincolon'] = 'The path you have entered should not contain a colon (":"). Please enter a correct path value.'; -$lng['tasks']['aps_task_install'] = 'Installing one or more APS packages'; -$lng['tasks']['aps_task_remove'] = 'Removing one or more APS packages'; -$lng['tasks']['aps_task_reconfigure'] = 'Reconfigurating one or more APS packages'; -$lng['tasks']['aps_task_upgrade'] = 'Upgrading one or more APS packages'; -$lng['tasks']['aps_task_sysupdate'] = 'Updating all APS packages'; -$lng['tasks']['aps_task_sysdownload'] = 'Downloading new APS packages'; // ADDED IN FROXLOR 0.9.7-svn3 @@ -1407,9 +1208,6 @@ $lng['error']['exception'] = '%s'; $lng['serversettings']['mail_also_with_mxservers'] = 'Create mail-, imap-, pop3- and smtp-"A record" also with MX-Servers set'; // ADDED IN FROXLOR 0.9.10-svn1 -$lng['aps']['nocontingent'] = 'Your APS contingent is insufficient. You cannot install any package.'; -$lng['aps']['packageneedsdb'] = 'This package needs a database but your contingent is used up'; -$lng['aps']['cannoteditordeleteapsdb'] = 'APS databases cannot be edited or removed here'; $lng['admin']['webserver_user'] = 'Webserver user-name'; $lng['admin']['webserver_group'] = 'Webserver group-name'; @@ -1476,9 +1274,6 @@ $lng['admin']['templates']['forgotpwd'] = 'Notification-mails for password-reset $lng['admin']['templates']['password_reset'] = 'Customer-notification for passwort-reset'; $lng['admin']['store_defaultindex'] = 'Store default index-file to customers docroot'; -// ADDED IN FROXLOR 0.9.13-svn1 -$lng['customer']['autoresponder'] = 'Autoresponder'; - // ADDED IN FROXLOR 0.9.14 $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'] = 'Default PHP configuration for Froxlor-vHost'; $lng['serversettings']['awstats_icons']['title'] = 'Path to AWstats icons folder'; @@ -1582,30 +1377,12 @@ $lng['traffic']['months']['total'] = 'Total'; $lng['traffic']['details'] = 'Details'; $lng['menue']['traffic']['table'] = 'Traffic'; $lng['error']['admin_domain_emailsystemhostname'] = 'Sorry, the system - hostname may not be used as a customer domain'; -$lng['backup'] = 'Backup'; -$lng['backup_allowed'] = 'Backup allowed'; -$lng['extras']['backup_create'] = 'Create Backup?'; -$lng['extras']['backup_info'] = 'Backup will be saved once daily to a FTP directory. The FTP username is "%s_backup". The FTP password is the same as for your main FTP account.'; -$lng['extras']['backup_info_sep'] = 'It contains compressed archives of your web-directory and databases.'; -$lng['extras']['backup_info_big'] = 'It contains a compressed archive of your web-directory and databases.'; -$lng['extras']['backup_count_info'] = '

    Please note that the backup will charge your webspace!'; -$lng['serversettings']['backup_count'] = 'Should backup size be subtracted from webspace size?'; -$lng['serversettings']['backup_enabled'] = 'Backup activated?'; -$lng['serversettings']['backupdir']['description'] = 'Backup dir path?'; -$lng['serversettings']['mysqldump_path']['description'] = 'Path to mysqldump binary?'; -$lng['serversettings']['backup_bigfile'] = 'Save backup in 1 big file instead in separeted files for html and databases?'; -$lng['serversettings']['backup_ftp_enabled'] = 'FTP Upload activated?'; -$lng['serversettings']['backup_ftp_server'] = 'FTP Server:'; -$lng['serversettings']['backup_ftp_user'] = 'FTP Username:'; -$lng['serversettings']['backup_ftp_pass'] = 'FTP Password:'; -$lng['crondesc']['cron_backup'] = 'Backup cronjob'; // ADDED IN FROXLOR 0.9.21 $lng['gender']['title'] = 'Title'; $lng['gender']['male'] = 'Mr.'; $lng['gender']['female'] = 'Mrs.'; $lng['gender']['undef'] = ''; -$lng['serversettings']['backup_ftp_passive_mode'] = 'Use passive mode'; // Country code (ISO-3166-2) $lng['country']['AF'] = "Afghanistan"; diff --git a/lng/german.lng.php b/lng/german.lng.php index 4cba2b95..3136881c 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -911,25 +911,8 @@ $lng['emails']['quota_edit'] = 'E-Mail Kontingent ändern'; $lng['panel']['not_supported'] = 'Nicht unterstüzt in: '; $lng['error']['allocatetoomuchquota'] = 'Sie versuchen "%s" MB Kontingent zu zuweisen, haben aber nicht genug übrig.'; -// Autoresponder module - -$lng['menue']['email']['autoresponder'] = 'Abwesenheitsnachrichten'; -$lng['autoresponder']['active'] = 'Aktiviert'; -$lng['autoresponder']['autoresponder_add'] = 'Abwesenheitsnachricht hinzufügen'; -$lng['autoresponder']['autoresponder_edit'] = 'Abwesenheitsnachricht bearbeiten'; -$lng['autoresponder']['autoresponder_new'] = 'Neue Abwesenheitsnachricht erstellen'; -$lng['autoresponder']['subject'] = 'Betreff'; -$lng['autoresponder']['message'] = 'Nachricht'; -$lng['autoresponder']['account'] = 'Konto'; -$lng['autoresponder']['sender'] = 'Absender'; -$lng['question']['autoresponderdelete'] = 'Abwesenheitsnachricht wirklich löschen?'; -$lng['error']['noemailaccount'] = 'Es gibt zwei mögliche Gründe warum keine Abwesenheitsnachricht erstellt werden kann: Sie benötigen mindestens einen E-Mail Account. Zweitens kann es sein dass bereits für alle Accounts eine Abwesenheitsnachricht eingerichtet wurde.'; $lng['error']['missingfields'] = 'Es wurden nicht alle Felder augefüllt.'; $lng['error']['accountnotexisting'] = 'Der angegebene E-Mail-Account existiert nicht.'; -$lng['error']['autoresponderalreadyexists'] = 'Für dieses Konto existiert bereits eine Abwesenheitsnachricht.'; -$lng['error']['invalidautoresponder'] = 'Das angegebene Konto ist ungültig.'; -$lng['serversettings']['autoresponder_active']['title'] = 'Abwesenheitsnachrichten-Modul verwenden'; -$lng['serversettings']['autoresponder_active']['description'] = 'Möchten Sie das Abwesenheitsnachrichten-Modul verwenden?'; $lng['admin']['show_version_login']['title'] = 'Zeige Froxlor Version beim Login'; $lng['admin']['show_version_login']['description'] = 'Zeige Froxlor Version in der Fußzeile der Loginseite'; $lng['admin']['show_version_footer']['title'] = 'Zeige Froxlor Version in Fußzeile'; @@ -996,173 +979,6 @@ $lng['admin']['security_settings'] = 'Sicherheitseinstellungen'; $lng['admin']['expert_settings'] = 'Experteneinstellungen!'; $lng['admin']['mod_fcgid_starter']['title'] = 'PHP-Prozesse für diese Domain (leer für Standardwert)'; -//added with aps installer - -$lng['admin']['aps'] = 'APS-Installer'; -$lng['customer']['aps'] = 'APS-Installer'; -$lng['aps']['scan'] = 'Neue Pakete einlesen'; -$lng['aps']['upload'] = 'Neue Pakete hochladen'; -$lng['aps']['managepackages'] = 'Pakete verwalten'; -$lng['aps']['manageinstances'] = 'Instanzen verwalten'; -$lng['aps']['overview'] = 'Paketübersicht'; -$lng['aps']['status'] = 'Meine Pakete'; -$lng['aps']['search'] = 'Paket suchen'; -$lng['aps']['upload_description'] = 'Bitte wählen Sie die APS-ZIP-Dateien aus, um diese im System zu installieren.'; -$lng['aps']['search_description'] = 'Name, Beschreibung, Schlagwort, Version'; -$lng['aps']['detail'] = 'Weitere Informationen'; -$lng['aps']['install'] = 'Paket installieren'; -$lng['aps']['data'] = 'Daten'; -$lng['aps']['version'] = 'Version'; -$lng['aps']['homepage'] = 'Homepage'; -$lng['aps']['installed_size'] = 'Größe nach Installation'; -$lng['aps']['categories'] = 'Kategorien'; -$lng['aps']['languages'] = 'Sprachen'; -$lng['aps']['long_description'] = 'Langbeschreibung'; -$lng['aps']['configscript'] = 'Konfigurationskript'; -$lng['aps']['changelog'] = 'Changelog'; -$lng['aps']['license'] = 'Lizenz'; -$lng['aps']['linktolicense'] = 'Link zur Lizenz'; -$lng['aps']['screenshots'] = 'Screenshots'; -$lng['aps']['back'] = 'Zurück zur Übersicht'; -$lng['aps']['install_wizard'] = 'Installationsassistent...'; -$lng['aps']['wizard_error'] = 'Ihre Eingaben enthalten ungültige Daten. Bitte korrigieren Sie diese, um mit der Installation fortzufahren.'; -$lng['aps']['basic_settings'] = 'Grundlegende Einstellungen'; -$lng['aps']['application_location'] = 'Installationsort'; -$lng['aps']['application_location_description'] = 'Ort an dem die Anwendung installiert werden soll.'; -$lng['aps']['no_domains'] = 'Keine Domains gefunden'; -$lng['aps']['database_password'] = 'Datenbankpasswort'; -$lng['aps']['database_password_description'] = 'Passwort welches für die neu zu erstellende Datenbank verwendet werden soll.'; -$lng['aps']['license_agreement'] = 'Zustimmung'; -$lng['aps']['cancel_install'] = 'Installation abbrechen'; -$lng['aps']['notazipfile'] = 'Die hochgeladene Datei ist keine gültige ZIP-Datei.'; -$lng['aps']['filetoobig'] = 'Die Datei ist zu groß.'; -$lng['aps']['filenotcomplete'] = 'Die Datei wurde nicht vollständig hochgeladen.'; -$lng['aps']['phperror'] = 'Es trat ein PHP interner Fehler auf. Der Upload Fehlercode lautet #'; -$lng['aps']['moveproblem'] = 'Die hochgeladene Datei konnte nicht aus dem temporären Ordner verschoben werden. Prüfen Sie ob alle Rechte korrekt gesetzt sind. Dies gilt insbesondere fü die Ordner {$path}temp/ und {$path}packages/.'; -$lng['aps']['uploaderrors'] = 'Fehler für die Datei "%s"
      "%s"
    '; -$lng['aps']['nospecialchars'] = 'Sonderzeichen sind im Suchausdruck nicht erlaubt!'; -$lng['aps']['noitemsfound'] = 'Es wurden keine Pakete gefunden!'; -$lng['aps']['nopackagesinstalled'] = 'Sie haben noch kein Paket installiert welches angezeigt werden könnte.'; -$lng['aps']['instance_install'] = 'Paket wurde zur Installation vorgemerkt'; -$lng['aps']['instance_task_active'] = 'Paket wird gerade bearbeitet'; -$lng['aps']['instance_success'] = 'Paket ist installiert bzw. wurde erfolgreich installiert'; -$lng['aps']['instance_error'] = 'Paket ist nicht installiert - bei der Installation traten Fehler auf'; -$lng['aps']['instance_uninstall'] = 'Paket wurde zur Deinstallation vorgemerkt'; -$lng['aps']['unknown_status'] = 'Fehler - Unbekannter Wert'; -$lng['aps']['currentstatus'] = 'Aktueller Status'; -$lng['aps']['activetasks'] = 'Aktuelle Jobs'; -$lng['aps']['task_install'] = 'Installation ausstehend'; -$lng['aps']['task_remove'] = 'Deinstallation ausstehend'; -$lng['aps']['task_reconfigure'] = 'Neukonfiguration ausstehend'; -$lng['aps']['task_upgrade'] = 'Aktualisierung ausstehend'; -$lng['aps']['no_task'] = 'Kein Task ausstehend'; -$lng['aps']['applicationlinks'] = 'Anwendungslinks'; -$lng['aps']['mainsite'] = 'Hauptseite'; -$lng['aps']['uninstall'] = 'Paket deinstallieren'; -$lng['aps']['reconfigure'] = 'Einstellungen ändern'; -$lng['aps']['erroronnewinstance'] = 'Dieses Paket kann nicht installiert werden.

    Bitte gehen Sie zurück zur Paketübersicht und starten Sie eine neue Installation.'; -$lng['aps']['successonnewinstance'] = '"%s" wird nun installiert.

    Gehen Sie zurück zu "Meine Pakete" und warten Sie bis die Installation abgeschlossen ist. Dies kann einige Minuten in Anspruch nehmen.'; -$lng['aps']['php_misc_handler'] = 'PHP - Sonstiges - Es werden keine anderen Dateiendungen als .php zum Parsen unterstützt.'; -$lng['aps']['php_misc_directoryhandler'] = 'PHP - Sonstiges - Je Verzeichnis deaktivierte PHP Handler werden nicht unterstützt.'; -$lng['aps']['asp_net'] = 'ASP.NET - Paket wird nicht unterstützt.'; -$lng['aps']['cgi'] = 'CGI - Paket wird nicht unterstützt.'; -$lng['aps']['php_extension'] = 'PHP - Erweiterung "%s" fehlt.'; -$lng['aps']['php_function'] = 'PHP - Funktion "%s" fehlt.'; -$lng['aps']['php_configuration'] = 'PHP - Konfiguration - Aktuelle "%s" Einstellung wird von Paket nicht unterstützt.'; -$lng['aps']['php_configuration_post_max_size'] = 'PHP - Konfiguration - "post_max_size" Wert zu klein.'; -$lng['aps']['php_configuration_memory_limit'] = 'PHP - Konfiguration - "memory_limit" Wert zu klein.'; -$lng['aps']['php_configuration_max_execution_time'] = 'PHP - Konfiguration - "max_execution_time" Wert zu klein.'; -$lng['aps']['php_general_old'] = 'PHP - Generell - PHP-Version zu alt.'; -$lng['aps']['php_general_new'] = 'PHP - Generell - PHP-Version zu neu.'; -$lng['aps']['db_mysql_support'] = 'Datenbank - Das Paket benötigt eine andere Datenbank Engine als MySQL.'; -$lng['aps']['db_mysql_version'] = 'Datenbank - MySQL Server zu alt.'; -$lng['aps']['webserver_module'] = 'Webserver - Modul "%s" fehlt.'; -$lng['aps']['webserver_fcgid'] = 'Webserver - Von diesem Paket werden einige Webserver Module benötigt. Da Sie Froxlor in einer FastCGI/mod_fcgid Umgebung verwenden, existiert die Funktion "apache_get_modules" nicht. Es kann also nicht ermittelt werden, ob das Paket unterstützt wird.'; -$lng['aps']['webserver_htaccess'] = 'Webserver - Dieses Paket benötigt, dass ".htaccess"-Dateien vom Webserver geparst werden. Das Paket kann nicht installiert werden, da nicht ermittelt werden kann, ob diese Funktion aktiviert ist.'; -$lng['aps']['misc_configscript'] = 'Sonstiges - Die Sprache des Konfigurationsskriptes wird nicht unterstützt.'; -$lng['aps']['misc_charset'] = 'Sonstiges - In der aktuellen Version wird eine Validierung gegen einen gewissen Zeichensatz im Installationsassitenten nicht unterstützt.'; -$lng['aps']['misc_version_already_installed'] = 'Die gleiche Paketversion ist bereits installiert.'; -$lng['aps']['misc_only_newer_versions'] = 'Aus Sicherheitsgründen können nur Pakete installiert werden, die neuer sind als die bereits im System installierten Pakete sind.'; -$lng['aps']['erroronscan'] = 'Fehler für "%s"
      "%s"
    '; -$lng['aps']['invalidzipfile'] = 'Fehler für "%s"
    • Dies ist keine gültige APS-ZIP-Datei!
    '; -$lng['aps']['successpackageupdate'] = '"%s" erfolgreich als Paketupdate installiert'; -$lng['aps']['successpackageinstall'] = '"%s" erfolgreich als neues Paket installiert'; -$lng['aps']['class_zip_missing'] = 'SimpleXML-Klasse, exec-Funktion oder ZIP-Funktionen nicht vorhanden bzw. aktiviert! Für genauere Informationen zu diesem Problem schauen Sie bitte in das Handbuch zu diesem Modul.'; -$lng['aps']['dir_permissions'] = 'Der PHP- bzw. Webserver-Prozess muss Schreibrechte für {$path}temp/ und {$path}packages/ haben.'; -$lng['aps']['initerror'] = 'Es gibt ein paar Probleme mit diesem Modul:
      "%s"
    Beheben Sie diese Probleme, andernfalls kann das Modul nicht genutzt werden!'; -$lng['aps']['iderror'] = 'Es wurde eine falsche ID übergeben!'; -$lng['aps']['nopacketsforinstallation'] = 'Es wurden keine Pakete zur Installation gefunden.'; -$lng['aps']['nopackagestoinstall'] = 'Es existieren keine Pakete die angezeigt oder installiert werden könnten.'; -$lng['aps']['nodomains'] = 'Wählen Sie eine Domain aus der Liste. Sollte keine Domain vorhanden sein können Sie keine Pakete installieren!'; -$lng['aps']['wrongpath'] = 'Entweder enthält dieser Pfad ungültige Zeichen oder es ist bereits eine Anwendung am gegebenen Ort installiert.'; -$lng['aps']['dbpassword'] = 'Geben Sie ein Passwort mit einer minimalen Länge von 8 Zeichen ein.'; -$lng['aps']['error_text'] = 'Geben Sie einen Text ohne Sonderzeichen ein.'; -$lng['aps']['error_email'] = 'Geben Sie eine gültige E-Mail Adresse ein.'; -$lng['aps']['error_domain'] = 'Geben Sie eine gültige URL wie "http://www.example.com/" ein.'; -$lng['aps']['error_integer'] = 'Geben Sie eine Zahl (Integer-Format) ein. Beispiel: 5 oder 7.'; -$lng['aps']['error_float'] = 'Geben Sie eine Zahl (Float-Format) ein. Beispiel: 5,2432 oder 7,5346.'; -$lng['aps']['error_password'] = 'Geben Sie ein Passwort ein.'; -$lng['aps']['error_license'] = 'Ja, ich habe die Lizenz gelesen und willige ein diese zu befolgen.'; -$lng['aps']['error_licensenoaccept'] = 'Sie müssen die Lizenz annehmen um die Anwendung installieren zu können.'; -$lng['aps']['stopinstall'] = 'Installation abbrechen'; -$lng['aps']['installstopped'] = 'Die Installation für dieses Paket wurde erfolgreich abgebrochen.'; -$lng['aps']['installstoperror'] = 'Die Installation kann nicht mehr abgebrochen werden, da diese bereits gestartet wurde. Möchten Sie das Paket entfernen, so warten Sie die Installation ab und entfernen Sie dann das Paket unter "Meine Pakete"'; -$lng['aps']['waitfortask'] = 'Es stehen momentan keine Aktionen zur Verfügung. Warten Sie bis alle Tasks abgearbeitet wurden.'; -$lng['aps']['removetaskexisting'] = 'Es gibt bereits einen Task zur Deinstallation.

    Bitte gehen Sie zurück zu "Meine Pakete" und warten Sie bis die Deinstallation abgeschlossen ist.'; -$lng['aps']['packagewillberemoved'] = 'Das Paket wird nun deinstalliert.

    Gehen Sie zurück zu "Meine Pakete" und warten Sie bis die Deinstallation abgeschlossen ist.'; -$lng['question']['reallywanttoremove'] = 'Wollen Sie dieses Paket wirklich deinstallieren?

    Alle Datenbankinhalte und Dateien werden unwiderruflich gelöscht. Wenn Sie die enthaltenen Daten weiterhin benötigen, stellen Sie sicher dass Sie diese vorher sichern!

    '; -$lng['aps']['searchoneresult'] = '"%s" Paket gefunden'; -$lng['aps']['searchmultiresult'] = '"%s" Pakete gefunden'; -$lng['question']['reallywanttostop'] = 'Wollen Sie die Installation dieses Paketes wirklich abbrechen?

    '; -$lng['aps']['packagenameandversion'] = 'Paketname & Version'; -$lng['aps']['package_locked'] = 'Gesperrt'; -$lng['aps']['package_enabled'] = 'Freigegeben'; -$lng['aps']['lock'] = 'Sperren'; -$lng['aps']['unlock'] = 'Freigeben'; -$lng['aps']['remove'] = 'Löschen'; -$lng['aps']['allpackages'] = 'Alle Pakete'; -$lng['question']['reallyremovepackages'] = 'Wollen Sie diese Pakete wirklich löschen?

    Pakete mit Abhängigkeiten können erst gelöscht werden wenn die entsprechenden Instanzen dafür deinstalliert wurden!

    '; -$lng['aps']['nopackagesinsystem'] = 'Es wurden noch keine Pakete im System installiert, die verwaltet werden könnten.'; -$lng['aps']['packagenameandstatus'] = 'Paketname & Status'; -$lng['aps']['activate_aps']['title'] = 'APS-Installer aktivieren'; -$lng['aps']['activate_aps']['description'] = 'Hier können Sie den APS-Installer global aktivieren bzw. deaktivieren.'; -$lng['aps']['packages_per_page']['title'] = 'Pakete pro Seite'; -$lng['aps']['packages_per_page']['description'] = 'Wieviele Pakete sollen Kunden pro Seite angezeigt bekommen?'; -$lng['aps']['upload_fields']['title'] = 'Uploadfelder pro Seite'; -$lng['aps']['upload_fields']['description'] = 'Wieviele Uploadfelder sollen im Panel zur Installation von Paketen angezeigt werden?'; -$lng['aps']['exceptions']['title'] = 'Ausnahmen für Paketvalidierung'; -$lng['aps']['exceptions']['description'] = 'Manche Pakete benötigen spezielle Konfigurationsparameter oder Module. Der Installer selbst kann nicht immer eindeutig feststellen ob diese Optionen/Erweiterungen aktiviert sind. Aus diesem Grund kann man hier nun Ausnahmen festlegen damit Pakete dann trotzdem installiert werden können. Wählen Sie nur die Optionen aus, die auch wirklich so mit der Realität übereinstimmen. Für genauere Informationen zu diesem Problem schauen Sie bitte in das Handbuch zu diesem Modul.'; -$lng['aps']['settings_php_extensions'] = 'PHP-Erweiterungen'; -$lng['aps']['settings_php_configuration'] = 'PHP-Konfiguration'; -$lng['aps']['settings_webserver_modules'] = 'Webserver-Module'; -$lng['aps']['settings_webserver_misc'] = 'Webserver - Sonstiges'; -$lng['aps']['specialoptions'] = 'Sonderoptionen'; -$lng['aps']['removeunused'] = 'Ungenutzte Pakete entfernen'; -$lng['aps']['enablenewest'] = 'Von jedem Paket neueste Version freigeben, alte Version sperren'; -$lng['aps']['installations'] = 'Installationen'; -$lng['aps']['statistics'] = 'Statistiken'; -$lng['aps']['numerofpackagesinstalled'] = '"%s" Pakete vorhanden
    '; -$lng['aps']['numerofpackagesenabled'] = '"%s" Pakete freigegeben
    '; -$lng['aps']['numerofpackageslocked'] = '"%s" Pakete gesperrt
    '; -$lng['aps']['numerofinstances'] = '"%s" Instanzen installiert
    '; -$lng['question']['reallydoaction'] = 'Wollen Sie die gewählten Aktionen wirklich durchführen?

    Daten, die durch diese Vorgänge möglicherweise gelöscht werden, können anschließend nicht wieder hergestellt werden.

    '; -$lng['aps']['initerror_customer'] = 'Es gibt momentan ein Problem mit dieser Froxlor-Erweiterung. Wenden Sie sich bitte für weitere Informationen an Ihren Administrator.'; -$lng['aps']['numerofinstances'] = '"%s" Installationen insgesamt
    '; -$lng['aps']['numerofinstancessuccess'] = '"%s" erfolgreiche Installationen
    '; -$lng['aps']['numerofinstanceserror'] = '"%s" fehlgeschlagene Installationen
    '; -$lng['aps']['numerofinstancesaction'] = '"%s" geplante Installationen/Deinstallationen'; -$lng['aps']['downloadallpackages'] = 'Alle Pakete vom Distributionsserver herunterladen'; -$lng['aps']['updateallpackages'] = 'Alle Pakete über Distributionsserver aktualisieren'; -$lng['aps']['downloadtaskexists'] = 'Es gibt bereits einen Task zum Download aller Pakete. Bitte warten Sie bis dieser abgeschlossen ist.'; -$lng['aps']['downloadtaskinserted'] = 'Es wurde ein Task zum Download aller Pakete erstellt. Dieser Vorgang kann einige Minuten in Anspruch nehmen.'; -$lng['aps']['updatetaskexists'] = 'Es gibt bereits einen Task zur Aktualisierung aller Pakete. Bitte warten Sie bis dieser abgeschlossen ist.'; -$lng['aps']['updatetaskinserted'] = 'Es wurde ein Task zur Aktualisierung aller Pakete erstellt. Dieser Vorgang kann einige Minuten in Anspruch nehmen.'; -$lng['aps']['canmanagepackages'] = 'Darf APS-Pakete verwalten'; -$lng['aps']['numberofapspackages'] = 'Anzahl an APS-Installationen'; -$lng['aps']['allpackagesused'] = 'Fehler

    Sie haben bereits die Anzahl an installierbaren APS-Anwendungen erreicht bzw. überschritten.'; -$lng['aps']['noinstancesexisting'] = 'Es gibt momentan noch keine Instanzen, die verwaltet werden könnten. Es muss mindestens eine Anwendung von einem Kunden installiert worden sein.'; -$lng['aps']['lightywarning'] = 'Warnung'; -$lng['aps']['lightywarningdescription'] = 'Sie verwenden den lighttpd-Webserver zusammen mit Froxlor. Da das APS-Modul hauptsächlich für den Apache-Webserver geschrieben wurde, kann es unter Umständen vorkommen, dass gewisse Features mit lighttpd nicht funktionieren. Bitte beachten Sie dies bei der Verwendung des APS-Moduls. Sollten Sie Fehler bei der Verwendung oder Probleme bei der Nutzung haben, so leiten Sie diese bitte an die Entwickler weiter, damit diese Probleme in der nächsten Version behoben werden können.'; $lng['error']['customerdoesntexist'] = 'Der ausgewählte Kunde existiert nicht.'; $lng['error']['admindoesntexist'] = 'Der ausgewählte Admin existiert nicht.'; @@ -1191,7 +1007,6 @@ $lng['serversettings']['mod_fcgid']['maxrequests']['description'] = 'Wieviele PH // fix bug #1124 $lng['admin']['webserver'] = 'Webserver'; $lng['error']['admin_domain_emailsystemhostname'] = 'Der Server-Hostname kann leider nicht als E-Mail-Domain verwendet werden.'; -$lng['aps']['license_link'] = 'Link zur Lizenz'; // ADDED IN FROXLOR 0.9 @@ -1203,9 +1018,6 @@ $lng['panel']['toomanydirs'] = 'Zu viele Unterverzeichnisse. Weiche auf manuelle $lng['panel']['abort'] = 'Abbrechen'; $lng['serversettings']['cron']['debug']['title'] = 'Debuggen des Cronscripts'; $lng['serversettings']['cron']['debug']['description'] = 'Wenn aktiviert, wird die Lockdatei nach dem Cronlauf zum Debuggen nicht gelöscht
    Achtung: Eine alte Lockdatei kann weitere Cronjobs behindern und dafür sorgen, dass diese nicht vollständig ausgeführt werden.'; -$lng['autoresponder']['date_from'] = 'Start-Datum'; -$lng['autoresponder']['date_until'] = 'End-Datum'; -$lng['autoresponder']['startenddate'] = 'Start/End-Datum'; $lng['panel']['not_activated'] = 'Nicht aktiviert'; $lng['panel']['off'] = 'aus'; $lng['update']['updateinprogress_onlyadmincanlogin'] = 'Eine neuere Version von Froxlor wurde installiert, aber noch nicht eingerichtet.
    Nur der Administrator kann sich anmelden und die Aktualisierung abschließen.'; @@ -1278,9 +1090,6 @@ $lng['crondesc']['cron_unknown_desc'] = 'Keine Beschreibung angegeben'; $lng['admin']['cron']['add'] = 'Cronjob hinzufügen'; $lng['crondesc']['cron_tasks'] = 'Erstellen von Konfigurationsdateien'; $lng['crondesc']['cron_legacy'] = 'Legacy (alter) Cronjob'; -$lng['crondesc']['cron_apsinstaller'] = 'APS-Installer'; -$lng['crondesc']['cron_autoresponder'] = 'E-Mail Autoresponder'; -$lng['crondesc']['cron_apsupdater'] = 'Aktualisieren der APS-Pakete'; $lng['crondesc']['cron_traffic'] = 'Traffic-Berechnung'; $lng['crondesc']['cron_ticketsreset'] = 'Zurücksetzen der Ticket-Zähler'; $lng['crondesc']['cron_ticketarchive'] = 'Archivieren alter Tickets'; @@ -1307,7 +1116,6 @@ $lng['ftp']['editpassdescription'] = 'Neues Passwort setzen oder leer für keine $lng['customer']['sendinfomail'] = 'Daten per E-Mail an mich senden'; $lng['customer']['mysql_add']['infomail_subject'] = '[Froxlor] Neue Datenbank erstellt'; $lng['customer']['mysql_add']['infomail_body']['main'] = "Hallo {CUST_NAME},\n\ndu hast gerade eine neue Datenbank angelegt. Hier die angegebenen Informationen:\n\nDatenbankname: {DB_NAME}\nPasswort: {DB_PASS}\nBeschreibung: {DB_DESC}\nDatenbank-Server: {DB_SRV}\nphpMyAdmin: {PMA_URI}\nVielen Dank, Ihr Administrator"; -$lng['error']['domains_cantdeletedomainwithapsinstances'] = 'Sie können keine Domain löschen, die noch von APS Paketen verwendet wird. Löschen Sie zuerst alle installierten APS Pakete dieser Domain.'; $lng['serversettings']['awstats_path'] = 'Pfad zu AWStats \'awstats_buildstaticpages.pl\''; $lng['serversettings']['awstats_conf'] = 'AWStats Konfigurations-Pfad'; $lng['error']['overviewsettingoptionisnotavalidfield'] = 'Hoppla, ein Feld, dass als Option in der Konfigurationsübersicht angezeigt werden soll, hat nicht den erwarteten Wert. Sie können den Entwicklern die Schuld geben. Dies sollte nicht passieren!'; @@ -1374,20 +1182,11 @@ $lng['serversettings']['customredirect_default']['description'] = 'Dieser Redire // ADDED IN FROXLOR 0.9.7-svn2 $lng['error']['pathmaynotcontaincolon'] = 'Der eingegebene Pfad sollte keinen Doppelpunkt (":") enthalten. Bitte geben Sie einen korrekten Wert für den Pfad ein.'; -$lng['tasks']['aps_task_install'] = 'Installation eines oder mehrerer APS-Pakete'; -$lng['tasks']['aps_task_remove'] = 'Deinstallation eines oder mehrerer APS-Pakete'; -$lng['tasks']['aps_task_reconfigure'] = 'Rekonfiguration eines oder mehrerer APS-Pakete'; -$lng['tasks']['aps_task_upgrade'] = 'Upgrade eines oder mehrerer APS-Pakete'; -$lng['tasks']['aps_task_sysupdate'] = 'Aktualisiere alle APS-Pakete'; -$lng['tasks']['aps_task_sysdownload'] = 'Herunterladen neuer APS-Pakete'; // ADDED IN FROXLOR 0.9.9-svn1 $lng['serversettings']['mail_also_with_mxservers'] = 'Erstelle mail-, imap-, pop3- and smtp-"A Record" auch wenn MX-Server angegeben sind'; // ADDED IN FROXLOR 0.9.10-svn1 -$lng['aps']['nocontingent'] = 'Sie haben kein ausreichendes APS-Kontingent und können daher keine Pakete installieren.'; -$lng['aps']['packageneedsdb'] = 'Dieses Paket benötigt eine Datenbank, Sie haben allerdings keine mehr frei'; -$lng['aps']['cannoteditordeleteapsdb'] = 'APS-Datenbanken können hier nicht bearbeitet oder gelöscht werden'; $lng['admin']['webserver_user'] = 'Benutzername Webserver'; $lng['admin']['webserver_group'] = 'Gruppenname Webserver'; @@ -1454,9 +1253,6 @@ $lng['admin']['templates']['forgotpwd'] = 'Benachrichtigungs-Mails bei Zurückse $lng['admin']['templates']['password_reset'] = 'Kunden-Benachrichtigung nach Zurücksetzen des Passworts'; $lng['admin']['store_defaultindex'] = 'Erstelle Standard-Index-Datei im Kunden-Ordner'; -// ADDED IN FROXLOR 0.9.13-svn1 -$lng['customer']['autoresponder'] = 'Abwesenheitsnachrichten'; - // ADDED IN FROXLOR 0.9.14 $lng['serversettings']['mod_fcgid']['defaultini_ownvhost'] = 'Voreingestellte PHP-Konfiguration für den Froxlor-Vhost'; $lng['serversettings']['awstats_icons']['title'] = 'Pfad zum AWstats-Icon-Ordner'; @@ -1558,31 +1354,12 @@ $lng['traffic']['months']['total'] = 'Gesamt'; $lng['traffic']['details'] = 'Details'; $lng['menue']['traffic']['table'] = 'Übersicht'; $lng['error']['admin_domain_emailsystemhostname'] = 'Der System - Hostname kann nicht als Kundendomain verwendet werden.'; -$lng['backup'] = 'Backup'; -$lng['backup_allowed'] = 'Backup erlaubt'; -$lng['extras']['backup_create'] = 'Backup erstellen?'; -$lng['extras']['backup_info'] = 'Das Backup wird täglich in einem FTP Verzeichnis abgelegt. Der FTP Username ist "%s_backup". Das FTP Passwort ist das gleiche wie bei ihrem Haupt FTP Account.'; -$lng['extras']['backup_info_sep'] = 'Es sind komprimierte Archive von Ihrem Webverzeichnis und Ihren Datenbanken enthalten.'; -$lng['extras']['backup_info_big'] = 'Es ist ein komprimiertes Archiv von Ihrem Webverzeichnis und Ihren Datenbanken enthalten.'; -$lng['extras']['backup_count_info'] = '

    Beachten Sie bitte, dass das Backup den verfügbaren Speicherplatz belastet!'; -$lng['serversettings']['backup_count'] = 'Soll die Größe des Backups vom verfügbaren Webspace-Limit abgezogen werden?'; -$lng['serversettings']['backup_enabled'] = 'Backup aktivieren?'; -$lng['serversettings']['backup_ftp_enabled'] = 'FTP Upload aktivieren?'; -$lng['serversettings']['backup_ftp_server'] = 'FTP Server:'; -$lng['serversettings']['backup_ftp_user'] = 'FTP Benutzer:'; -$lng['serversettings']['backup_ftp_pass'] = 'FTP Passwort:'; -$lng['serversettings']['backupdir']['description'] = 'Pfad des Backup-Verzeichnisses?'; -$lng['serversettings']['mysqldump_path']['description'] = 'Pfad zum mysqldump Programm:'; -$lng['serversettings']['backup_count'] = 'Soll die Größe des Backups vom verfügbaren Webspace abgezogen werden?'; -$lng['crondesc']['cron_backup'] = 'Backup Cronjob'; // ADDED IN FROXLOR 0.9.21 $lng['gender']['title'] = 'Geschlecht'; $lng['gender']['male'] = 'Herr'; $lng['gender']['female'] = 'Frau'; $lng['gender']['undef'] = ''; -$lng['serversettings']['backup_ftp_passive_mode'] = 'Passiven Übertragungsmodus verwenden'; -$lng['serversettings']['backup_bigfile'] = 'Backup von Kundenverzeichnissen und Datenbanken in eine Datei speichern, statt zu splitten?'; // ADDED IN FROXLOR 0.9.22-svn1 $lng['diskquota'] = 'Quota'; diff --git a/packages/.gitignore b/packages/.gitignore deleted file mode 100644 index 72e8ffc0..00000000 --- a/packages/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/packages/.keep b/packages/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/scripts/jobs/cron_apsinstaller.php b/scripts/jobs/cron_apsinstaller.php deleted file mode 100644 index 430b37ca..00000000 --- a/scripts/jobs/cron_apsinstaller.php +++ /dev/null @@ -1,21 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Cron - * - */ - -$Aps = new ApsInstaller($settings); -$Aps->InstallHandler(); diff --git a/scripts/jobs/cron_apsupdater.php b/scripts/jobs/cron_apsupdater.php deleted file mode 100644 index 53b1ac24..00000000 --- a/scripts/jobs/cron_apsupdater.php +++ /dev/null @@ -1,21 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Cron - * - */ - -$Aps = new ApsUpdater($cronlog); -$Aps->UpdateHandler(); diff --git a/scripts/jobs/cron_autoresponder.php b/scripts/jobs/cron_autoresponder.php deleted file mode 100644 index 49914f3c..00000000 --- a/scripts/jobs/cron_autoresponder.php +++ /dev/null @@ -1,258 +0,0 @@ - (2003-2009) - * @author Remo Fritzsche - * @author Manuel Aller - * @author Michael Schlechtinger - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Cron - * - * @todo skip mail parsing after x bytes for large mails - */ - -$mail = new PHPMailer(true); - -//dont do anything when module is disabled -if ((int)$settings['autoresponder']['autoresponder_active'] == 0) { - return; -} - -//only send autoresponder to mails which were delivered since last run -if ((int)$settings['autoresponder']['last_autoresponder_run'] == 0) { - //mails from last 5 minutes, otherwise all mails will be parsed -> mailbomb prevention - $cycle = 300; -} else { - // calculate seconds since last check - $cycle = time() - (int)$settings['autoresponder']['last_autoresponder_run']; - //prevent mailbombs when cycle is bigger than two days - if($cycle > (2 * 60 * 60 * 24))$cycle = (60 * 60 * 24); -} - -// set last_autoresponder_run -$upd_stmt = Database::prepare(" - UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :timeval - WHERE `settinggroup` = 'autoresponder' AND `varname` = 'last_autoresponder_run' -"); -Database::pexecute($upd_stmt, array('timeval' => time())); - -// get all customer set ip autoresponders -$result_stmt = Database::query(" - SELECT * FROM `" . TABLE_MAIL_AUTORESPONDER . "` INNER JOIN `" . TABLE_MAIL_USERS . "` - ON `" . TABLE_MAIL_AUTORESPONDER . "`.`email` = `" . TABLE_MAIL_USERS . "`.`email` - WHERE `enabled` = 1 -"); - -if (Database::num_rows() > 0) { - - while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { - //check if specific autoresponder should be used - $ts_now = time(); - $ts_start = (int)$row['date_from']; - $ts_end = (int)$row['date_until']; - - $row['email'] = strtolower($row['email']); - - // not yet - if($ts_start != -1 && $ts_start > $ts_now) continue; - // already ended - if($ts_end != -1 && $ts_end < $ts_now) continue; - - // setup mail-path (e.g. /var/customers/mail/[loginname]/[user@domain.tld]/new - $path = makeCorrectDir($row['homedir'] . $row['maildir'] . "new/"); - - // if the directory does not exist, inform syslog - if (!is_dir($path)) { - $cronlog->logAction(CRON_ACTION, LOG_WARNING, "Error accessing maildir: " . $path); - continue; - } - - // get all files - $its = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path) - ); - - $responded_counter = 0; - foreach ($its as $fullFilename => $it ) { - if ($it->getFilename() == '.' || $it->getFilename() == '..') { - continue; - } - - /* - * is the time passed between now and - * the time we received the mail lower/equal - * than our cycle-seconds? - */ - $filemtime = $it->getMTime(); - if (time() - $filemtime <= $cycle) { - // why not read up to k lines? - // I've been patching this forever, to avoid FATAL ERROR / memory exhausted - // (fgets() is now binary safe, too) - // $content = file($fullFilename); - $lcount = 0; $content = array(); $handle = @fopen($fullFilename, "r"); - if ($handle) { - // 1023 lines of an email should be enough to analyze it - while (($lcount++<1023) && (($buffer = fgets($handle)) !== false)) { - $content[]=$buffer; - } - fclose($handle); - } - - // error reading mail contents or just empty - if (count($content) == 0) { - $cronlog->logAction(CRON_ACTION, LOG_WARNING, "Unable to read mail from maildir: " . dirname($fullFilename)); - continue; - } - - $match = array(); - $from = ''; - $to = ''; - $sender = ''; - $spam = false; - foreach ($content as $line) { - // header ends on first empty line, skip rest of mail - if (strlen(rtrim($line)) == 0) { - break; - } - - //fetching from field - if (!strlen($from) - && preg_match("/^From:(.+)<(.*)>$/", $line, $match) - ) { - $from = strtolower($match[2]); - } - elseif (!strlen($from) - && preg_match("/^From:\s+(.*@.*)$/", $line, $match) - ) { - $from = strtolower($match[1]); - } - - //fetching to field - if ((!strlen($to) || $to != $row['email']) - && preg_match("/^To:(.+)<(.*)>$/", $line, $match) - ) { - $to = strtolower($match[2]); - } - elseif ((!strlen($to) || $to != $row['email']) - && preg_match("/^To:\s+(.*@.*)$/", $line, $match) - ) { - $to = strtolower($match[1]); - } - /* - * if we still don't have a To:-address - * OR even worse, the $to is NOT the mail-address - * of the customer which autoresponder this is - * we have to check for CC too, #476 - */ - elseif ((!strlen($to) || $to != $row['email']) - && preg_match("/^Cc:(.+)<(.*)>$/", $line, $match) - ) { - $to = strtolower($match[2]); - } - elseif ((!strlen($to) || $to != $row['email']) - && preg_match("/^Cc:\s+(.*@.*)$/", $line, $match) - ) { - $to = strtolower($match[1]); - } - - // fetching sender field - if (!strlen($sender) - && preg_match("/^Sender:(.+)<(.*)>$/", $line, $match) - ) { - $sender = strtolower($match[2]); - } - elseif (!strlen($sender) - && preg_match("/Sender:\s+(.*@.*)$/", $line, $match) - ) { - $sender = strtolower($match[1]); - } - - //check for amavis/spamassassin spam headers - if (preg_match("/^X-Spam-Status: (Yes|No)(.*)$/", $line, $match)) { - if(strtolower($match[1]) == 'yes') { - $spam = true; - } - } - - //check for precedence header - if (preg_match("/^Precedence: (bulk|list|junk)(.*)$/", $line, $match)) { - // use the spam flag to skip reply - $spam = true; - } - } - - // check if the receiver is really the one - // with the autoresponder - if (!strlen($to) || $to != $row['email']) { - $to = ''; - } - - //skip mail when marked as spam - if ($spam == true) { - continue; - } - - //error while parsing mail - if ($to == '' || $from == '') { - $cronlog->logAction(CRON_ACTION, LOG_WARNING, "No valid headers found in mail to parse"); - continue; - } - - //important! prevent mailbombs when mail comes from a maildaemon/mailrobot - //robot/daemon mails must go to Sender: field in envelope header - //refers to "Das Postfix-Buch" / RFC 2822 - if ($sender != '') { - $from = $sender; - } - - //make message valid to email format - $message = str_replace("\r\n", "\n", $row['message']); - - //check if mail is already an answer - $fullcontent = implode("", $content); - - if (strstr($fullcontent, $message) || $from == $to) { - continue; - } - - $_mailerror = false; - try { - $mail->CharSet = "UTF-8"; - $mail->SetFrom($to, $to); - $mail->AddReplyTo($to, $to); - $mail->Subject = $row['subject']; - $mail->AltBody = $message; - $html_message = str_replace("\n", "
    ", $message); - $mail->MsgHTML(html_entity_decode($html_message)); - $mail->AddAddress($from, $from); - $mail->AddCustomHeader('Precedence: bulk'); - $mail->Send(); - } catch(phpmailerException $e) { - $mailerr_msg = $e->errorMessage(); - $_mailerror = true; - } catch (Exception $e) { - $mailerr_msg = $e->getMessage(); - $_mailerror = true; - } - - if ($_mailerror) { - $cronlog->logAction(CRON_ACTION, LOG_WARNING, "Error sending autoresponder mail: " . $mailerr_msg); - } - - $mail->ClearAddresses(); - $responded_counter++; - } - } - $cronlog->logAction(CRON_ACTION, LOG_INFO, "Responded to '" . $responded_counter . "' mails from '".$path."'"); - } -} diff --git a/scripts/jobs/cron_backup.php b/scripts/jobs/cron_backup.php deleted file mode 100644 index 852c283a..00000000 --- a/scripts/jobs/cron_backup.php +++ /dev/null @@ -1,158 +0,0 @@ - (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Cron - * -*/ - -/** - * Backup -*/ -if ($settings['system']['backup_enabled'] == '1') { - - fwrite($debugHandler, 'backup customers started...' . "\n"); - - // get sql-root access data for mysqldump - Database::needRoot(true); - Database::needSqlData(); - $sql_root = Database::getSqlData(); - Database::needRoot(false); - - $result_stmt = Database::query(" - SELECT customerid, loginname, guid, documentroot, backup_allowed, backup_enabled - FROM `" . TABLE_PANEL_CUSTOMERS . "` ORDER BY `customerid` ASC; - "); - - while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) { - - fwrite($debugHandler, 'backup for ' . $row['loginname'] . ' started...' . "\n"); - - // backup - if ($row['backup_allowed'] == '1' - && $row['backup_enabled'] == '1' - ) { - // get uid & gid from ftp table - $ftp_result_stmt = Database::prepare(" - SELECT uid, gid FROM `" . TABLE_FTP_USERS . "` - WHERE `username` = :loginname - "); - $ftp_row = Database::pexecute_first($ftp_result_stmt, array('loginname' => $row['loginname'])); - - // create backup dir an set rights - $_backupdir = makeCorrectDir($settings['system']['backup_dir'] . $row['loginname']); - if (!file_exists($_backupdir)) { - safe_exec('install -d ' . escapeshellarg($_backupdir) . ' -o ' . escapeshellarg($ftp_row['uid']) . ' -g ' . escapeshellarg($ftp_row['gid']) . ' -m ' . '0500'); - } - - // create customers html backup - safe_exec('tar -C ' . escapeshellarg($row['documentroot']) . ' -c -z -f ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($row['loginname']) . 'html.tar.gz .'); - - // get customer dbs - $dbs_result_stmt = Database::prepare(" - SELECT `databasename` FROM `" . TABLE_PANEL_DATABASES . "` - WHERE `customerid` = :customerid - "); - Database::pexecute($dbs_result_stmt, array('customerid' => $row['customerid'])); - - while ($dbs_row = $dbs_result_stmt->fetch(PDO::FETCH_ASSOC)){ - // create customers sql backup - safe_exec(escapeshellcmd($settings['system']['backup_mysqldump_path']) . ' --opt --force --allow-keywords -u ' . escapeshellarg($sql_root['user']) . ' -p' . escapeshellarg($sql_root['passwd']) . ' -h ' . $sql_root['host'] . ' -B ' . escapeshellarg($dbs_row['databasename']) . ' -r ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($dbs_row['databasename']) . '.sql' ); - // compress sql backup - safe_exec('tar -C ' . escapeshellarg($_backupdir) . ' -c -z -f ' . escapeshellarg($settings['system']['backup_dir']) . $row['loginname'] . '/' . escapeshellarg($dbs_row['databasename']) . '.tar.gz ' . escapeshellarg($dbs_row['databasename']) . '.sql'); - // remove uncompresed sql files - safe_exec('rm ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($dbs_row['databasename']) . '.sql'); - } - - // create 1 big file with html & db - if ($settings['system']['backup_bigfile'] == 1) { - safe_exec('tar -C ' . escapeshellarg($_backupdir) . '/' . ' --exclude=' . escapeshellarg($row['loginname']) . '.tar.gz -c -z -f ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($row['loginname']) . '.tar.gz .'); - // remove separated files - $tmp_files = scandir($_backupdir); - foreach ($tmp_files as $tmp_file) { - if (preg_match('/.*(html|sql|aps).*\.tar\.gz$/', $tmp_file) && !preg_match('/^' . $row['loginname'] . '\.tar\.gz$/', $tmp_file)) { - safe_exec('rm ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($tmp_file)); - } - } - } else { - //remove big file if separated backups are used - if (file_exists(makeCorrectFile($_backupdir . '/' . $row['loginname'] . '.tar.gz'))) { - safe_exec('rm ' . escapeshellarg($_backupdir) . '/' . escapeshellarg($row['loginname']) . '.tar.gz'); - } - } - - // chown & chmod files to prevent manipulation - safe_exec('chown ' . escapeshellarg($row['guid']) . ':' . escapeshellarg($row['guid']) . ' ' . escapeshellarg($_backupdir) . '/*'); - safe_exec('chmod 0400 ' . escapeshellarg($_backupdir) . '/*'); - - // create ftp backup user - $user_result_stmt = Database::prepare(" - SELECT username, password FROM `" . TABLE_FTP_USERS . "` - WHERE `customerid` = :customerid AND `username` = :username; - "); - $user_row = Database::pexecute_first($user_result_stmt, array('customerid' => $row['customerid'], 'username' => $row['loginname'])); - - $ins_stmt = Database::prepare(" - REPLACE INTO `" . TABLE_FTP_USERS . "` - (`customerid`, `username`, `password`, `homedir`, `login_enabled`, `uid`, `gid`) - VALUES - (:customerid, :username, :password, :homedir, 'y', :guid, :guid) - "); - $ins_data = array( - 'customerid' => $row['customerid'], - 'username' => $row['loginname']."_backup", - 'password' => $user_row['password'], - 'homedir' => makeCorrectDir($settings['system']['backup_dir'].'/'.$row['loginname'].'/'), - 'guid' => $row['guid'] - ); - Database::pexecute($ins_stmt, $ins_data); - - if ($settings['system']['backup_ftp_enabled'] == '1') { - // upload backup to customers ftp server - $_ftpdir = makeCorrectDir($settings['system']['backup_dir'].'/'.$row['loginname'].'/'); - $ftp_files = scandir($_ftpdir); - - foreach ($ftp_files as $ftp_file) { - if (preg_match('/.*\.tar\.gz$/', $ftp_file)) { - - $ftp_con = ftp_connect($settings['system']['backup_ftp_server']); - $ftp_login = ftp_login($ftp_con, $settings['system']['backup_ftp_user'], $settings['system']['backup_ftp_pass']); - - // Check whether to use passive mode or not - if ($settings['system']['backup_ftp_passive'] == 1) { - ftp_pasv($ftp_con, true); - } else { - ftp_pasv($ftp_con, false); - } - $_file = makeCorrectFile($_ftpdir.'/'.$ftp_file); - $ftp_upload = ftp_put($ftp_con, $ftp_file, $_file, FTP_BINARY); - } - } - } - fwrite($debugHandler, 'backup for ' . $row['loginname'] . ' finished...' . "\n"); - } - // delete old backup data (deletes backup if customer or admin disables backup) - elseif ($row['backup_allowed'] == '0' || $row['backup_enabled'] == '0') { - $_ftpdir = makeCorrectDir($settings['system']['backup_dir'].'/'.$row['loginname'].'/'); - if (file_exists($_ftpdir)){ - $files = scandir($_ftpdir); - foreach ($files as $file) { - if (preg_match('/.*\.tar\.gz$/', $file)){ - $_file = makeCorrectFile($_ftpdir.'/'.$file); - safe_exec('rm -f ' . escapeshellarg($_file)); - } - } - } - } - } - fwrite($debugHandler, 'backup customers finished...' . "\n"); -} diff --git a/temp/.gitignore b/temp/.gitignore deleted file mode 100644 index 72e8ffc0..00000000 --- a/temp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -* diff --git a/temp/.keep b/temp/.keep deleted file mode 100644 index e69de29b..00000000