Merge branch 'master' of git://github.com/Froxlor/Froxlor
This commit is contained in:
@@ -140,8 +140,11 @@ if ($page == 'customers'
|
||||
WHERE `customerid` = :id" .
|
||||
($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")
|
||||
);
|
||||
Database::pexecute($result_stmt, array('id' => $id, 'adminid' => $userinfo['adminid']));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$params = array('id' => $id);
|
||||
if ($userinfo['customers_see_all'] == '0') {
|
||||
$params['adminid'] = $userinfo['adminid'];
|
||||
}
|
||||
$result = Database::pexecute_first($result_stmt, $params);
|
||||
|
||||
$destination_user = $result['loginname'];
|
||||
|
||||
@@ -155,8 +158,8 @@ if ($page == 'customers'
|
||||
WHERE `userid` = :id
|
||||
AND `hash` = :hash"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('id' => $userinfo['userid'], 'hash' => $s));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$result = Database::pexecute_first($result_stmt, array('id' => $userinfo['userid'], 'hash' => $s));
|
||||
|
||||
$s = md5(uniqid(microtime(), 1));
|
||||
$insert = Database::prepare("
|
||||
INSERT INTO `" . TABLE_PANEL_SESSIONS . "` SET
|
||||
@@ -168,7 +171,7 @@ if ($page == 'customers'
|
||||
`language` = :lang,
|
||||
`adminsession` = '0'"
|
||||
);
|
||||
Database::pexecute($stmt, array(
|
||||
Database::pexecute($insert, array(
|
||||
'hash' => $s,
|
||||
'id' => $id,
|
||||
'ip' => $result['ipaddress'],
|
||||
@@ -191,8 +194,7 @@ if ($page == 'customers'
|
||||
WHERE `customerid` = :id" .
|
||||
($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")
|
||||
);
|
||||
Database::pexecute($result_stmt, array('id' => $id, 'adminid' => $userinfo['adminid']));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$result = Database::pexecute_first($result_stmt, array('id' => $id, 'adminid' => $userinfo['adminid']));
|
||||
|
||||
if ($result['loginname'] != '') {
|
||||
|
||||
@@ -220,8 +222,11 @@ if ($page == 'customers'
|
||||
WHERE `customerid` = :id" .
|
||||
($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid")
|
||||
);
|
||||
Database::pexecute($result_stmt, array('id' => $id, 'adminid' => $userinfo['adminid']));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$params = array('id' => $id);
|
||||
if ($userinfo['customers_see_all'] == '0') {
|
||||
$params['adminid'] = $userinfo['adminid'];
|
||||
}
|
||||
$result = Database::pexecute_first($result_stmt, $params);
|
||||
|
||||
if ($result['loginname'] != '') {
|
||||
|
||||
@@ -641,14 +646,12 @@ if ($page == 'customers'
|
||||
$loginname_check_stmt = Database::prepare("
|
||||
SELECT `loginname` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `loginname` = :loginname"
|
||||
);
|
||||
Database::pexecute($loginname_check_stmt, array('loginname' => $loginname));
|
||||
$loginname_check = $loginname_check_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$loginname_check = Database::pexecute_first($loginname_check_stmt, array('loginname' => $loginname));
|
||||
|
||||
$loginname_check_admin_stmt = Database::prepare("
|
||||
SELECT `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `loginname` = :loginname"
|
||||
);
|
||||
Database::pexecute($loginname_check_admin_stmt, array('loginname' => $loginname));
|
||||
$loginname_check_admin = $loginname_check_admin_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$loginname_check_admin = Database::pexecute_first($loginname_check_admin_stmt, array('loginname' => $loginname));
|
||||
|
||||
if (strtolower($loginname_check['loginname']) == strtolower($loginname)
|
||||
|| strtolower($loginname_check_admin['loginname']) == strtolower($loginname)
|
||||
@@ -969,16 +972,14 @@ if ($page == 'customers'
|
||||
SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `language` = :deflang AND `templategroup` = 'mails' AND `varname` = 'createcustomer_subject'"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'deflang' => $def_language));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$result = Database::pexecute_first($result_stmt, array('adminid' => $userinfo['adminid'], 'deflang' => $def_language));
|
||||
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['createcustomer']['subject']), $replace_arr));
|
||||
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
WHERE `adminid` = :adminid AND `language` = :deflang AND `templategroup` = 'mails' AND `varname` = 'createcustomer_mailbody'"
|
||||
);
|
||||
Database::pexecute($result_stmt, array('adminid' => $userinfo['adminid'], 'deflang' => $def_language));
|
||||
$result = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$result = Database::pexecute_first($result_stmt, array('adminid' => $userinfo['adminid'], 'deflang' => $def_language));
|
||||
$mail_body = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $lng['mails']['createcustomer']['mailbody']), $replace_arr));
|
||||
|
||||
$_mailerror = false;
|
||||
|
||||
@@ -284,7 +284,7 @@ if ($page == 'tickets'
|
||||
} else {
|
||||
$now = time();
|
||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
||||
$replyticket->Set('customerid', $mainticket->Get('customer'), true, true);
|
||||
$replyticket->Set('customer', $mainticket->Get('customer'), true, true);
|
||||
$replyticket->Set('lastchange', $now, true, true);
|
||||
$replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
|
||||
$replyticket->Set('status', '1', true, true);
|
||||
@@ -303,7 +303,7 @@ if ($page == 'tickets'
|
||||
$mainticket->Update();
|
||||
$mainticket->sendMail((int)$mainticket->Get('customer'), 'new_reply_ticket_by_staff_subject', $lng['mails']['new_reply_ticket_by_staff']['subject'], 'new_reply_ticket_by_staff_mailbody', $lng['mails']['new_reply_ticket_by_staff']['mailbody']);
|
||||
$log->logAction(ADM_ACTION, LOG_NOTICE, "answered ticket '" . $mainticket->Get('subject') . "'");
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -115,7 +115,7 @@ if ($page == 'overview') {
|
||||
}
|
||||
|
||||
$stmt = Database::prepare("DROP DATABASE IF EXISTS `" . $result['databasename'] . "`");
|
||||
Database::pexecute($stmt);
|
||||
Database::pexecute($stmt, array(), false);
|
||||
$stmt = Database::prepare("FLUSH PRIVILEGES");
|
||||
Database::pexecute($stmt);
|
||||
Database::needRoot(false);
|
||||
|
||||
@@ -24,9 +24,7 @@ if (isset($_POST['id'])) {
|
||||
|
||||
$id = intval($_POST['id']);
|
||||
|
||||
/*
|
||||
* Check if the current user is allowed to see the current ticket.
|
||||
*/
|
||||
//Check if the current user is allowed to see the current ticket.
|
||||
$stmt = Database::prepare("SELECT `id` FROM `panel_tickets` WHERE `id` = :id AND `customerid` = :customerid");
|
||||
$result = Database::pexecute_first($stmt, array("id" => $id, "customerid" => $userinfo['customerid']));
|
||||
|
||||
@@ -185,7 +183,7 @@ if($page == 'overview') {
|
||||
|
||||
// Admin mail
|
||||
$newticket->sendMail(-1, 'new_ticket_by_customer_subject', $lng['mails']['new_ticket_by_customer']['subject'], 'new_ticket_by_customer_mailbody', $lng['mails']['new_ticket_by_customer']['mailbody']);
|
||||
redirectTo($filename, Array('page' => $page, 's' => $s));
|
||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||
}
|
||||
} else {
|
||||
$categories = '';
|
||||
@@ -252,7 +250,7 @@ if($page == 'overview') {
|
||||
standard_error(array('stringisempty', 'mymessage'));
|
||||
} else {
|
||||
$now = time();
|
||||
$replyticket->Set('customerid', (int)$userinfo['customerid'], true, true);
|
||||
$replyticket->Set('customer', (int)$userinfo['customerid'], true, true);
|
||||
$replyticket->Set('lastchange', $now, true, true);
|
||||
$replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
|
||||
$replyticket->Set('status', '1', true, true);
|
||||
|
||||
@@ -539,7 +539,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.30');
|
||||
('panel', 'version', '0.9.31-dev1');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_tasks`;
|
||||
@@ -897,25 +897,6 @@ CREATE TABLE IF NOT EXISTS `domain_redirect_codes` (
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `ipsandports_docrootsettings`;
|
||||
CREATE TABLE IF NOT EXISTS `ipsandports_docrootsettings` (
|
||||
`id` int(5) NOT NULL auto_increment,
|
||||
`fid` int(11) NOT NULL,
|
||||
`docrootsettings` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `domain_docrootsettings`;
|
||||
CREATE TABLE IF NOT EXISTS `domain_docrootsettings` (
|
||||
`id` int(5) NOT NULL auto_increment,
|
||||
`fid` int(11) NOT NULL,
|
||||
`docrootsettings` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_general_ci;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `domain_ssl_settings`;
|
||||
CREATE TABLE IF NOT EXISTS `domain_ssl_settings` (
|
||||
`id` int(5) NOT NULL auto_increment,
|
||||
|
||||
@@ -2410,3 +2410,16 @@ if (isFroxlorVersion('0.9.30-rc1')) {
|
||||
|
||||
updateToVersion('0.9.30');
|
||||
}
|
||||
|
||||
if (isFroxlorVersion('0.9.30')) {
|
||||
|
||||
showUpdateStep("Updating from 0.9.30 to 0.9.31-dev1", true);
|
||||
lastStepStatus(0);
|
||||
|
||||
showUpdateStep("Removing unsused tables");
|
||||
Database::query("DROP TABLE IF EXISTS `ipsandports_docrootsettings`;");
|
||||
Database::query("DROP TABLE IF EXISTS `domain_docrootsettings`;");
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToVersion('0.9.31-dev1');
|
||||
}
|
||||
|
||||
@@ -251,6 +251,7 @@ class Database {
|
||||
$sl_file = makeCorrectFile($sl_dir."/sql-error.log");
|
||||
$sqllog = @fopen($sl_file, 'a');
|
||||
@fwrite($sqllog, date('d.m.Y H:i', time())." --- ".str_replace("\n", " ", $error->getMessage())."\n");
|
||||
@fwrite($sqllog, date('d.m.Y H:i', time())." --- DEBUG: \n".$error->getTraceAsString()."\n");
|
||||
@fclose($sqllog);
|
||||
|
||||
if ($showerror) {
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Michael Kaufmann <mkaufmann@nutime.de>
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Classes
|
||||
*
|
||||
* @link http://www.nutime.de/
|
||||
* @since 0.9.17-svn2
|
||||
*
|
||||
*/
|
||||
|
||||
class docrootsettings
|
||||
{
|
||||
/**
|
||||
* Database handler
|
||||
* @var object
|
||||
*/
|
||||
private $_db = false;
|
||||
|
||||
/**
|
||||
* Settings array
|
||||
* @var array
|
||||
*/
|
||||
private $_settings = array();
|
||||
|
||||
/**
|
||||
* main constructor
|
||||
*/
|
||||
public function __construct($db, $settings)
|
||||
{
|
||||
$this->_db = $db;
|
||||
$this->_settings = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* this function lets you add docroot-settings for a given domain (by ID)
|
||||
*
|
||||
* @param int $domainid id of the domain to add the settings for
|
||||
* @param string $ssettings docrootsettings to add for the domain
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function addDomainDocrootsettings($domainid = 0, $ssettings = '')
|
||||
{
|
||||
return $this->_addDocrootSetting(TABLE_PANEL_DOMDOCROOTSETTINGS, $domainid, $ssettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function lets you update docroot-settings for a given domain (by ID)
|
||||
*
|
||||
* @param int $domainid id of the domain to update the settings from
|
||||
* @param string $ssettings docrootsettings to update for the domain
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function updateDomainDocrootsettings($domainid = 0, $ssettings = '')
|
||||
{
|
||||
return $this->_updateDocrootSetting(TABLE_PANEL_DOMDOCROOTSETTINGS, $domainid, $ssettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function lets you add docroot-settings for a given ip/port combo (by ID)
|
||||
*
|
||||
* @param int $ipandportid id of the domain to add the settings for
|
||||
* @param string $ssettings docrootsettings to add for the domain
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function addIpsAndPortsDocrootsettings($ipandportid = 0, $ssettings = '')
|
||||
{
|
||||
return $this->_addDocrootSetting(TABLE_PANEL_IPDOCROOTSETTINGS, $ipandportid, $ssettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function lets you update docroot-settings for a given ip/port combo (by ID)
|
||||
*
|
||||
* @param int $ipandportid id of the domain to update the settings from
|
||||
* @param string $ssettings docrootsettings to update for the domain
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function updateIpsAndPortsDocrootsettings($ipandportid = 0, $ssettings = '')
|
||||
{
|
||||
return $this->_updateDocrootSetting(TABLE_PANEL_IPDOCROOTSETTINGS, $ipandportid, $ssettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the docroot-setting
|
||||
* for a given domain (by ID)
|
||||
*
|
||||
* @param int $domainid the id of the domain
|
||||
*
|
||||
* @return string the settings or empty if not set
|
||||
*/
|
||||
public function getDomainDocrootsettings($domainid = 0)
|
||||
{
|
||||
return $this->_getDocrootSettingById(TABLE_PANEL_DOMDOCROOTSETTINGS, $domainid);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the docroot-setting
|
||||
* for a given ip/port combination (by ID)
|
||||
*
|
||||
* @param int $ipandportid the id of the ip/port combo
|
||||
*
|
||||
* @return string the settings or empty if not set
|
||||
*/
|
||||
public function getIpsAndPortsDocrootsettings($ipandportid = 0)
|
||||
{
|
||||
return $this->_getDocrootSettingById(TABLE_PANEL_IPDOCROOTSETTINGS, $ipandportid);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is called by addDomainDocrootsettings() and
|
||||
* addIpsAndPortsDocrootsettings() to add docroot settings for an object
|
||||
*
|
||||
* @param string $table table to add the settings to
|
||||
* @param int $fid foreign id / object id
|
||||
* @param string $ssettings docroot-settings
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function _addDocrootSetting($table, $fid, $ssettings)
|
||||
{
|
||||
$query = "INSERT INTO `".$table."` SET
|
||||
`fid` = '".(int)$fid."',
|
||||
`docrootsettings` = '".$db->escape($ssettings)."';";
|
||||
$this->_db->query($query);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is called by updateDomainDocrootsettings() and
|
||||
* updateIpsAndPortsDocrootsettings() to update docroot settings for an object
|
||||
*
|
||||
* if new value is an empty string, entry is being removed
|
||||
*
|
||||
* @param string $table table to update the settings from
|
||||
* @param int $fid foreign id / object id
|
||||
* @param string $ssettings docroot-settings
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function _updateDocrootSetting($table, $fid, $ssettings)
|
||||
{
|
||||
// check if this object has an entry for docrootsettings
|
||||
if($this->_getDocrootSettingById($table, $fid) != '')
|
||||
{
|
||||
if($ssettings != '')
|
||||
{
|
||||
// update if new value has been set
|
||||
$query = "UPDATE `".$table."` SET
|
||||
`docrootsettings` = '".$db->escape($ssettings)."'
|
||||
WHERE `fid` = '".(int)$fid."';";
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove if new value is empty
|
||||
$query = "DELETE FROM `".$table."` WHERE `fid` = '".(int)$fid."';";
|
||||
}
|
||||
// run query
|
||||
$this->_db->query($query);
|
||||
return true;
|
||||
}
|
||||
// this object has no entry for docrootsettings yet
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* read the docrootsetting field of given table
|
||||
* for given id
|
||||
*
|
||||
* @param string $table table where to read from
|
||||
* @param int $id id of the object
|
||||
*
|
||||
* @return string string the settings or empty if not set
|
||||
*/
|
||||
private function _getDocrootSettingById($table = null, $id = 0)
|
||||
{
|
||||
$query = "SELECT `docrootsettings` FROM `".$table."` WHERE `fid`='".(int)$id."';";
|
||||
$result = $this->_db->query_first($query);
|
||||
if($result !== false && isset($result['docrootsettings']))
|
||||
{
|
||||
return $result['docrootsettings'];
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ class phpinterface_fcgid {
|
||||
$adminid = intval($adminid);
|
||||
|
||||
if (!isset($this->_admin_cache[$adminid])) {
|
||||
$stmt = Database::prepare("TABLE_PANEL_ADMINS
|
||||
$stmt = Database::prepare("
|
||||
SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :id"
|
||||
);
|
||||
$this->_admin_cache[$adminid] = Database::pexecute_first($stmt, array('id' => $adminid));
|
||||
|
||||
@@ -348,7 +348,7 @@ class phpinterface_fpm {
|
||||
$adminid = intval($adminid);
|
||||
|
||||
if (!isset($this->_admin_cache[$adminid])) {
|
||||
$stmt = Database::prepare("TABLE_PANEL_ADMINS
|
||||
$stmt = Database::prepare("
|
||||
SELECT `email`, `loginname` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = :id"
|
||||
);
|
||||
$this->_admin_cache[$adminid] = Database::pexecute_first($stmt, array('id' => $adminid));
|
||||
|
||||
@@ -177,8 +177,8 @@ class ticket {
|
||||
'priority' => $this->Get('priority'),
|
||||
'subject' => $this->Get('subject'),
|
||||
'message' => $this->Get('message'),
|
||||
'dt' => $this->Get('dt'),
|
||||
'lastchange' => $this->Get('lastchange'),
|
||||
'dt' => time(),
|
||||
'lastchange' => time(),
|
||||
'ip' => $this->Get('ip'),
|
||||
'status' => $this->Get('status'),
|
||||
'lastreplier' => $this->Get('lastreplier'),
|
||||
@@ -296,7 +296,7 @@ class ticket {
|
||||
$mail_subject = html_entity_decode(replace_variables((($result['value'] != '') ? $result['value'] : $default_subject), $replace_arr));
|
||||
|
||||
unset($tpl_seldata['tplsubject']);
|
||||
$tpl_seldata['tplbody'] = $template_body;
|
||||
$tpl_seldata['tplmailbody'] = $template_body;
|
||||
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `value` FROM `" . TABLE_PANEL_TEMPLATES . "`
|
||||
@@ -337,7 +337,7 @@ class ticket {
|
||||
SELECT `name`, `email` FROM `" . TABLE_PANEL_ADMINS . "`
|
||||
WHERE `adminid` = :adminid"
|
||||
);
|
||||
$admin = Database::pexecute_first($admin_stmt, array('adminid' => $userinfo['adminid']));
|
||||
$admin = Database::pexecute_first($admin_stmt, array('adminid' => $this->userinfo['adminid']));
|
||||
$_mailerror = false;
|
||||
try {
|
||||
$mail->SetFrom($this->settings['ticket']['noreply_email'], $this->settings['ticket']['noreply_name']);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/**
|
||||
* Function updateToVersion
|
||||
*
|
||||
* updates the panel.version field
|
||||
@@ -25,40 +25,41 @@
|
||||
*
|
||||
* @return bool true on success, else false
|
||||
*/
|
||||
function updateToVersion($new_version = null)
|
||||
{
|
||||
global $db, $settings, $theme;
|
||||
function updateToVersion($new_version = null) {
|
||||
|
||||
if($new_version !== null && $new_version != '')
|
||||
{
|
||||
$query = "UPDATE `".TABLE_PANEL_SETTINGS."` SET `value` = '" . $new_version . "' WHERE `settinggroup` = 'panel' AND `varname` = 'version'";
|
||||
$db->query($query);
|
||||
global $settings;
|
||||
|
||||
if ($new_version !== null && $new_version != '') {
|
||||
$upd_stmt = Database::prepare("
|
||||
UPDATE `".TABLE_PANEL_SETTINGS."` SET `value` = :newversion
|
||||
WHERE `settinggroup` = 'panel' AND `varname` = 'version'"
|
||||
);
|
||||
Database::pexecute($upd_stmt, array('newversion' => $new_version));
|
||||
$settings['panel']['version'] = $new_version;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Function isFroxlor
|
||||
*
|
||||
* checks if the panel is froxlor
|
||||
*
|
||||
* @return bool true if panel is froxlor, else false
|
||||
*/
|
||||
function isFroxlor()
|
||||
{
|
||||
global $settings, $theme;
|
||||
function isFroxlor() {
|
||||
global $settings;
|
||||
|
||||
if(isset($settings['panel']['frontend'])
|
||||
&& $settings['panel']['frontend'] == 'froxlor')
|
||||
{
|
||||
if (isset($settings['panel']['frontend'])
|
||||
&& $settings['panel']['frontend'] == 'froxlor'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Function isFroxlorVersion
|
||||
*
|
||||
* checks if a given version is the
|
||||
@@ -68,19 +69,19 @@ function isFroxlor()
|
||||
*
|
||||
* @return bool true if version to check matches, else false
|
||||
*/
|
||||
function isFroxlorVersion($to_check = null)
|
||||
{
|
||||
global $settings, $theme;
|
||||
function isFroxlorVersion($to_check = null) {
|
||||
|
||||
if($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == $to_check)
|
||||
{
|
||||
global $settings;
|
||||
|
||||
if ($settings['panel']['frontend'] == 'froxlor'
|
||||
&& $settings['panel']['version'] == $to_check
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Function isFroxlorVersion
|
||||
*
|
||||
* checks if a given version is the
|
||||
@@ -90,19 +91,19 @@ function isFroxlorVersion($to_check = null)
|
||||
*
|
||||
* @return bool true if version to check matches, else false
|
||||
*/
|
||||
function hasUpdates($to_check = null)
|
||||
{
|
||||
global $settings, $theme;
|
||||
function hasUpdates($to_check = null) {
|
||||
|
||||
if(!isset($settings['panel']['version'])
|
||||
|| $settings['panel']['version'] != $to_check)
|
||||
{
|
||||
global $settings;
|
||||
|
||||
if (!isset($settings['panel']['version'])
|
||||
|| $settings['panel']['version'] != $to_check
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Function showUpdateStep
|
||||
*
|
||||
* outputs and logs the current
|
||||
@@ -113,65 +114,63 @@ function hasUpdates($to_check = null)
|
||||
*
|
||||
* @return string formatted output and log-entry
|
||||
*/
|
||||
function showUpdateStep($task = null, $needs_status = true)
|
||||
{
|
||||
global $updatelog, $filelog, $theme;
|
||||
|
||||
function showUpdateStep($task = null, $needs_status = true) {
|
||||
|
||||
global $updatelog, $filelog;
|
||||
|
||||
// output
|
||||
echo $task;
|
||||
|
||||
if(!$needs_status)
|
||||
{
|
||||
|
||||
if (!$needs_status) {
|
||||
echo "<br />";
|
||||
}
|
||||
|
||||
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, $task);
|
||||
$filelog->logAction(ADM_ACTION, LOG_WARNING, $task);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Function lastStepStatus
|
||||
*
|
||||
*
|
||||
* outputs [OK] (success), [??] (warning) or [!!] (failure)
|
||||
* of the last update-step
|
||||
*
|
||||
*
|
||||
* @param int status (0 = success, 1 = warning, 2 = failure)
|
||||
*
|
||||
*
|
||||
* @return string formatted output and log-entry
|
||||
*/
|
||||
function lastStepStatus($status = -1, $message = '')
|
||||
{
|
||||
global $updatelog, $filelog, $theme;
|
||||
|
||||
switch($status)
|
||||
{
|
||||
function lastStepStatus($status = -1, $message = '') {
|
||||
|
||||
global $updatelog, $filelog;
|
||||
|
||||
switch($status) {
|
||||
|
||||
case 0:
|
||||
$status_sign = ($message != '') ? '['.$message.']' : '[OK]';
|
||||
$status_color = '1dcd00';
|
||||
break;
|
||||
case 1:
|
||||
$status_sign = ($message != '') ? '['.$message.']' : '[??]';
|
||||
$status_color = 'db7100';
|
||||
$status_color = 'db7100';
|
||||
break;
|
||||
case 2:
|
||||
$status_sign = ($message != '') ? '['.$message.']' : '[!!]';
|
||||
$status_color = 'ff0000';
|
||||
$status_color = 'ff0000';
|
||||
break;
|
||||
default:
|
||||
$status_sign = '[unknown]';
|
||||
$status_color = '000000';
|
||||
$status_color = '000000';
|
||||
break;
|
||||
}
|
||||
|
||||
// output
|
||||
echo "<span style=\"margin-left: 5em; font-weight: bold; color: #".$status_color."\">".$status_sign."</span><br />";
|
||||
|
||||
if($status == -1 || $status == 2)
|
||||
{
|
||||
|
||||
if ($status == -1 || $status == 2) {
|
||||
$updatelog->logAction(ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
|
||||
$filelog->logAction(ADM_ACTION, LOG_WARNING, 'Attention - last update task failed!!!');
|
||||
}
|
||||
elseif($status == 0 || $status == 1)
|
||||
{
|
||||
|
||||
} elseif($status == 0 || $status == 1) {
|
||||
$filelog->logAction(ADM_ACTION, LOG_WARNING, 'Success');
|
||||
}
|
||||
}
|
||||
@@ -179,18 +178,16 @@ function lastStepStatus($status = -1, $message = '')
|
||||
/**
|
||||
* validate if full path to update.log is sane
|
||||
* if not, the update.log is created in /tmp/
|
||||
*
|
||||
*
|
||||
* @param string $filename the file name to validate
|
||||
*
|
||||
*
|
||||
* @return string the full path with filename (can differ if not writeable => /tmp)
|
||||
*/
|
||||
function validateUpdateLogFile($filename)
|
||||
{
|
||||
if(!is_dir($filename))
|
||||
{
|
||||
function validateUpdateLogFile($filename) {
|
||||
|
||||
if (!is_dir($filename)) {
|
||||
$fh = @fopen($filename, 'a');
|
||||
if($fh)
|
||||
{
|
||||
if ($fh) {
|
||||
fclose($fh);
|
||||
return $filename;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
function version_compare2($a, $b) {
|
||||
|
||||
// split version into pieces and remove trailing .0
|
||||
$a = explode(".", rtrim($a, ".0"));
|
||||
$b = explode(".", rtrim($b, ".0"));
|
||||
$a = explode(".", $a);
|
||||
$b = explode(".", $b);
|
||||
|
||||
_parseVersionArray($a);
|
||||
_parseVersionArray($b);
|
||||
|
||||
@@ -52,13 +52,10 @@ 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_IPDOCROOTSETTINGS', 'ipsandports_docrootsettings');
|
||||
define('TABLE_PANEL_DOMDOCROOTSETTINGS', 'domain_docrootsettings');
|
||||
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);
|
||||
@@ -74,6 +71,6 @@ define('PACKAGE_LOCKED', 1);
|
||||
define('PACKAGE_ENABLED', 2);
|
||||
|
||||
// VERSION INFO
|
||||
$version = '0.9.30';
|
||||
$version = '0.9.31-dev1';
|
||||
$dbversion = '2';
|
||||
$branding = '';
|
||||
|
||||
@@ -787,7 +787,6 @@ class apache
|
||||
*/
|
||||
public function createVirtualHosts()
|
||||
{
|
||||
//$result_domains = $this->db->query("SELECT `d`.*, `pd`.`domain` AS `parentdomain`, `c`.`loginname`, `d`.`phpsettingid`, `c`.`adminid`, `c`.`guid`, `c`.`email`, `c`.`documentroot` AS `customerroot`, `c`.`deactivated`, `c`.`phpenabled` AS `phpenabled`, `d`.`mod_fcgid_starter`, `d`.`mod_fcgid_maxrequests` FROM `" . TABLE_PANEL_DOMAINS . "` `d` LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` `c` USING(`customerid`) " . "LEFT JOIN `" . TABLE_PANEL_DOMAINS . "` `pd` ON (`pd`.`id` = `d`.`parentdomainid`) " . "WHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` <> 1 ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC");
|
||||
$query = "SELECT `d`.*, `pd`.`domain` AS `parentdomain`, `c`.`loginname`,
|
||||
`d`.`phpsettingid`, `c`.`adminid`, `c`.`guid`, `c`.`email`,
|
||||
`c`.`documentroot` AS `customerroot`, `c`.`deactivated`,
|
||||
@@ -809,7 +808,7 @@ class apache
|
||||
GROUP BY `id_domain`
|
||||
) AS p ON p.`id_domain` = `d`.`id`
|
||||
|
||||
WHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` = '0'
|
||||
WHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` <> '1'
|
||||
ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC;";
|
||||
|
||||
$result_domains = $this->db->query($query);
|
||||
|
||||
@@ -324,7 +324,7 @@ class lighttpd
|
||||
GROUP BY `id_domain`
|
||||
) AS p ON p.`id_domain` = `d`.`id`
|
||||
|
||||
WHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` = '0'
|
||||
WHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` <> '1'
|
||||
ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC;";
|
||||
|
||||
$included_vhosts = array();
|
||||
|
||||
@@ -284,7 +284,7 @@ class nginx
|
||||
GROUP BY `id_domain`
|
||||
) AS p ON p.`id_domain` = `d`.`id`
|
||||
|
||||
WHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` = '0'
|
||||
WHERE `d`.`aliasdomain` IS NULL AND `d`.`email_only` <> '1'
|
||||
ORDER BY `d`.`parentdomainid` DESC, `d`.`iswildcarddomain`, `d`.`domain` ASC;";
|
||||
|
||||
$result_domains = $this->db->query($query);
|
||||
|
||||
Reference in New Issue
Block a user