fix intltext template driver
This commit is contained in:
parent
b00c900fa2
commit
d20a0cb6ab
@ -53,6 +53,7 @@ abstract class dba_driver {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,13 +5,18 @@ require_once('include/dba/dba_driver.php');
|
|||||||
class dba_mysqli extends dba_driver {
|
class dba_mysqli extends dba_driver {
|
||||||
|
|
||||||
function connect($server, $port, $user,$pass,$db) {
|
function connect($server, $port, $user,$pass,$db) {
|
||||||
$this->db = new mysqli($server,$user,$pass,$db, $port);
|
if($port)
|
||||||
|
$this->db = new mysqli($server,$user,$pass,$db, $port);
|
||||||
|
else
|
||||||
|
$this->db = new mysqli($server,$user,$pass,$db);
|
||||||
|
|
||||||
if(! mysqli_connect_errno()) {
|
if(! mysqli_connect_errno()) {
|
||||||
$this->connected = true;
|
$this->connected = true;
|
||||||
}
|
}
|
||||||
if($this->connected) {
|
if($this->connected) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
$this->error = $this->db->connect_error;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,10 +90,10 @@ class FriendicaSmartyEngine implements ITemplateEngine {
|
|||||||
public function get_intltext_template($file, $root='') {
|
public function get_intltext_template($file, $root='') {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
if(file_exists("view/{$a->language}/$s"))
|
if(file_exists("view/{$a->language}/$file"))
|
||||||
$template_file = "view/{$a->language}/$s";
|
$template_file = "view/{$a->language}/$file";
|
||||||
elseif(file_exists("view/en/$s"))
|
elseif(file_exists("view/en/$file"))
|
||||||
$template_file = "view/en/$s";
|
$template_file = "view/en/$file";
|
||||||
else
|
else
|
||||||
$template_file = theme_include($file,$root);
|
$template_file = theme_include($file,$root);
|
||||||
if($template_file) {
|
if($template_file) {
|
||||||
|
@ -539,7 +539,7 @@ function theme_include($file, $root = '') {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function get_intltext_template($s) {
|
function get_intltext_template($s, $root = '') {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$t = $a->template_engine();
|
$t = $a->template_engine();
|
||||||
|
|
||||||
|
@ -38,6 +38,10 @@ function setup_post(&$a) {
|
|||||||
require_once('include/dba/dba_driver.php');
|
require_once('include/dba/dba_driver.php');
|
||||||
unset($db);
|
unset($db);
|
||||||
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true);
|
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true);
|
||||||
|
if(! $db->connected) {
|
||||||
|
echo "Database Connect failed: " . $db->error;
|
||||||
|
killme();
|
||||||
|
}
|
||||||
/*if(get_db_errno()) {
|
/*if(get_db_errno()) {
|
||||||
unset($db);
|
unset($db);
|
||||||
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, '', true);
|
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, '', true);
|
||||||
@ -80,6 +84,11 @@ function setup_post(&$a) {
|
|||||||
// connect to db
|
// connect to db
|
||||||
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true);
|
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true);
|
||||||
|
|
||||||
|
if(! $db->connected) {
|
||||||
|
echo 'CRITICAL: DB not connected.';
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
$tpl = get_intltext_template('htconfig.tpl');
|
$tpl = get_intltext_template('htconfig.tpl');
|
||||||
$txt = replace_macros($tpl,array(
|
$txt = replace_macros($tpl,array(
|
||||||
'$dbhost' => $dbhost,
|
'$dbhost' => $dbhost,
|
||||||
|
Reference in New Issue
Block a user