finally removed super-old syscp-update-procedures, we now require the last available syscp for upgrading; migrate some functions to PDO database class, refs #1287
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -25,18 +25,26 @@
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function storeDefaultIndex($loginname = null, $destination = null, $logger = null, $force = false)
|
||||
{
|
||||
global $db, $settings, $pathtophpfiles, $theme;
|
||||
function storeDefaultIndex($loginname = null, $destination = null, $logger = null, $force = false) {
|
||||
|
||||
global $settings;
|
||||
|
||||
if ($force
|
||||
|| (int)$settings['system']['store_index_file_subs'] == 1
|
||||
) {
|
||||
$result = $db->query("SELECT `t`.`value`, `c`.`email` AS `customer_email`, `a`.`email` AS `admin_email`, `c`.`loginname` AS `customer_login`, `a`.`loginname` AS `admin_login` FROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c` INNER JOIN `" . TABLE_PANEL_ADMINS . "` AS `a` ON `c`.`adminid` = `a`.`adminid` INNER JOIN `" . TABLE_PANEL_TEMPLATES . "` AS `t` ON `a`.`adminid` = `t`.`adminid` WHERE `varname` = 'index_html' AND `c`.`loginname` = '" . $db->escape($loginname) . "'");
|
||||
|
||||
if($db->num_rows($result) > 0)
|
||||
{
|
||||
$template = $db->fetch_array($result);
|
||||
$result_stmt = Database::prepare("
|
||||
SELECT `t`.`value`, `c`.`email` AS `customer_email`, `a`.`email` AS `admin_email`, `c`.`loginname` AS `customer_login`, `a`.`loginname` AS `admin_login`
|
||||
FROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c` INNER JOIN `" . TABLE_PANEL_ADMINS . "` AS `a`
|
||||
ON `c`.`adminid` = `a`.`adminid`
|
||||
INNER JOIN `" . TABLE_PANEL_TEMPLATES . "` AS `t`
|
||||
ON `a`.`adminid` = `t`.`adminid`
|
||||
WHERE `varname` = 'index_html' AND `c`.`loginname` = :loginname");
|
||||
Database::pexecute($result_stmt, array('loginname' => $loginname));
|
||||
|
||||
if (Database::num_rows() > 0) {
|
||||
|
||||
$template = $result_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
$replace_arr = array(
|
||||
'SERVERNAME' => $settings['system']['hostname'],
|
||||
'CUSTOMER' => $template['customer_login'],
|
||||
@@ -44,6 +52,7 @@ function storeDefaultIndex($loginname = null, $destination = null, $logger = nul
|
||||
'CUSTOMER_EMAIL' => $template['customer_email'],
|
||||
'ADMIN_EMAIL' => $template['admin_email']
|
||||
);
|
||||
|
||||
$htmlcontent = replace_variables($template['value'], $replace_arr);
|
||||
$indexhtmlpath = makeCorrectFile($destination . '/index.' . $settings['system']['index_file_extension']);
|
||||
$index_html_handler = fopen($indexhtmlpath, 'w');
|
||||
@@ -52,14 +61,13 @@ function storeDefaultIndex($loginname = null, $destination = null, $logger = nul
|
||||
if ($logger !== null) {
|
||||
$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Creating \'index.' . $settings['system']['index_file_extension'] . '\' for Customer \'' . $template['customer_login'] . '\' based on template in directory ' . escapeshellarg($indexhtmlpath));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} else {
|
||||
$destination = makeCorrectDir($destination);
|
||||
if ($logger !== null) {
|
||||
$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Running: cp -a ' . $pathtophpfiles . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
|
||||
$logger->logAction(CRON_ACTION, LOG_NOTICE, 'Running: cp -a ' . FROXLOR_INSTALL_DIR . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
|
||||
}
|
||||
safe_exec('cp -a ' . $pathtophpfiles . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
|
||||
safe_exec('cp -a ' . FROXLOR_INSTALL_DIR . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user