aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-05-15 22:27:35 -0700
committerfriendica <info@friendica.com>2013-05-15 22:27:35 -0700
commitd20a0cb6abe92e05f4387a6b3ad504b422275fb1 (patch)
tree386e650aa46efd8d60885b3d6e9083727080adc4
parentb00c900fa2d999657b17caf577acea5ab772dec1 (diff)
downloadvolse-hubzilla-d20a0cb6abe92e05f4387a6b3ad504b422275fb1.tar.gz
volse-hubzilla-d20a0cb6abe92e05f4387a6b3ad504b422275fb1.tar.bz2
volse-hubzilla-d20a0cb6abe92e05f4387a6b3ad504b422275fb1.zip
fix intltext template driver
-rwxr-xr-xinclude/dba/dba_driver.php1
-rwxr-xr-xinclude/dba/dba_mysqli.php7
-rwxr-xr-xinclude/friendica_smarty.php8
-rwxr-xr-xinclude/plugin.php2
-rwxr-xr-xmod/setup.php9
5 files changed, 21 insertions, 6 deletions
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index abc759adc..c829c3714 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -53,6 +53,7 @@ abstract class dba_driver {
return false;
}
}
+ return true;
}
diff --git a/include/dba/dba_mysqli.php b/include/dba/dba_mysqli.php
index 9cb60cb8c..f1a50cc3f 100755
--- a/include/dba/dba_mysqli.php
+++ b/include/dba/dba_mysqli.php
@@ -5,13 +5,18 @@ require_once('include/dba/dba_driver.php');
class dba_mysqli extends dba_driver {
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()) {
$this->connected = true;
}
if($this->connected) {
return true;
}
+ $this->error = $this->db->connect_error;
return false;
}
diff --git a/include/friendica_smarty.php b/include/friendica_smarty.php
index e34fac003..1e8ef5406 100755
--- a/include/friendica_smarty.php
+++ b/include/friendica_smarty.php
@@ -90,10 +90,10 @@ class FriendicaSmartyEngine implements ITemplateEngine {
public function get_intltext_template($file, $root='') {
$a = get_app();
- if(file_exists("view/{$a->language}/$s"))
- $template_file = "view/{$a->language}/$s";
- elseif(file_exists("view/en/$s"))
- $template_file = "view/en/$s";
+ if(file_exists("view/{$a->language}/$file"))
+ $template_file = "view/{$a->language}/$file";
+ elseif(file_exists("view/en/$file"))
+ $template_file = "view/en/$file";
else
$template_file = theme_include($file,$root);
if($template_file) {
diff --git a/include/plugin.php b/include/plugin.php
index b65ca6e98..01ee99786 100755
--- a/include/plugin.php
+++ b/include/plugin.php
@@ -539,7 +539,7 @@ function theme_include($file, $root = '') {
-function get_intltext_template($s) {
+function get_intltext_template($s, $root = '') {
$a = get_app();
$t = $a->template_engine();
diff --git a/mod/setup.php b/mod/setup.php
index 751f8bdf8..b76fa7be1 100755
--- a/mod/setup.php
+++ b/mod/setup.php
@@ -38,6 +38,10 @@ function setup_post(&$a) {
require_once('include/dba/dba_driver.php');
unset($db);
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true);
+ if(! $db->connected) {
+ echo "Database Connect failed: " . $db->error;
+ killme();
+ }
/*if(get_db_errno()) {
unset($db);
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, '', true);
@@ -80,6 +84,11 @@ function setup_post(&$a) {
// connect to db
$db = dba_factory($dbhost, $dbport, $dbuser, $dbpass, $dbdata, true);
+ if(! $db->connected) {
+ echo 'CRITICAL: DB not connected.';
+ killme();
+ }
+
$tpl = get_intltext_template('htconfig.tpl');
$txt = replace_macros($tpl,array(
'$dbhost' => $dbhost,