aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfabrixxm <fabrix.xm@gmail.com>2013-05-10 06:13:24 -0400
committerfabrixxm <fabrix.xm@gmail.com>2013-05-10 06:13:24 -0400
commitd4c07930d51244c8ae5014344c9502d010954448 (patch)
treed6e4815e0c895fdd00089a95a223456f6ba01756 /include
parente1c6b776c4c388b4671c0838c9d24feac42857c2 (diff)
downloadvolse-hubzilla-d4c07930d51244c8ae5014344c9502d010954448.tar.gz
volse-hubzilla-d4c07930d51244c8ae5014344c9502d010954448.tar.bz2
volse-hubzilla-d4c07930d51244c8ae5014344c9502d010954448.zip
add $db_port to .htconfig.php and $a->config['syste]['smarty3_folder'] for compiled templates
Diffstat (limited to 'include')
-rwxr-xr-x[-rw-r--r--]include/dba/dba_driver.php16
-rwxr-xr-x[-rw-r--r--]include/dba/dba_mysql.php4
-rwxr-xr-x[-rw-r--r--]include/dba/dba_mysqli.php4
-rwxr-xr-xinclude/friendica_smarty.php19
4 files changed, 27 insertions, 16 deletions
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index 1091b9632..abc759adc 100644..100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -1,15 +1,17 @@
<?php /** @file */
-function dba_factory($server,$user,$pass,$db,$install = false) {
+function dba_factory($server, $port,$user,$pass,$db,$install = false) {
$dba = null;
if(class_exists('mysqli')) {
+ if (is_null($port)) $port = ini_get("mysqli.default_port");
require_once('include/dba/dba_mysqli.php');
- $dba = new dba_mysqli($server,$user,$pass,$db,$install);
+ $dba = new dba_mysqli($server, $port,$user,$pass,$db,$install);
}
else {
+ if (is_null($port)) $port = "3306";
require_once('include/dba/dba_mysql.php');
- $dba = new dba_mysql($server,$user,$pass,$db,$install);
+ $dba = new dba_mysql($server, $port,$user,$pass,$db,$install);
}
return $dba;
@@ -23,16 +25,16 @@ abstract class dba_driver {
public $connected = false;
public $error = false;
- abstract function connect($server,$user,$pass,$db);
+ abstract function connect($server, $port, $user,$pass,$db);
abstract function q($sql);
abstract function escape($str);
abstract function close();
- function __construct($server,$user,$pass,$db,$install = false) {
- if(($install) && (! $this->install($server,$user,$pass,$db))) {
+ function __construct($server, $port, $user,$pass,$db,$install = false) {
+ if(($install) && (! $this->install($server, $port, $user,$pass,$db))) {
return;
}
- $this->connect($server,$user,$pass,$db);
+ $this->connect($server, $port, $user,$pass,$db);
}
diff --git a/include/dba/dba_mysql.php b/include/dba/dba_mysql.php
index 05e19903d..f5a2a47ba 100644..100755
--- a/include/dba/dba_mysql.php
+++ b/include/dba/dba_mysql.php
@@ -5,8 +5,8 @@ require_once('include/dba/dba_driver.php');
class dba_mysql extends dba_driver {
- function connect($server,$user,$pass,$db) {
- $this->db = mysql_connect($server,$user,$pass);
+ function connect($server, $port, $user,$pass,$db) {
+ $this->db = mysql_connect($server.":".$port,$user,$pass);
if($this->db && mysql_select_db($db,$this->db)) {
$this->connected = true;
}
diff --git a/include/dba/dba_mysqli.php b/include/dba/dba_mysqli.php
index af9a2434e..9cb60cb8c 100644..100755
--- a/include/dba/dba_mysqli.php
+++ b/include/dba/dba_mysqli.php
@@ -4,8 +4,8 @@ require_once('include/dba/dba_driver.php');
class dba_mysqli extends dba_driver {
- function connect($server,$user,$pass,$db) {
- $this->db = new mysqli($server,$user,$pass,$db);
+ function connect($server, $port, $user,$pass,$db) {
+ $this->db = new mysqli($server,$user,$pass,$db, $port);
if(! mysqli_connect_errno()) {
$this->connected = true;
}
diff --git a/include/friendica_smarty.php b/include/friendica_smarty.php
index a4675acd4..ec0748600 100755
--- a/include/friendica_smarty.php
+++ b/include/friendica_smarty.php
@@ -21,9 +21,11 @@ class FriendicaSmarty extends Smarty {
$template_dirs = $template_dirs + array('base' => 'view/tpl/');
$this->setTemplateDir($template_dirs);
- $this->setCompileDir('view/tpl/smarty3/compiled/');
- $this->setConfigDir('view/tpl/smarty3/config/');
- $this->setCacheDir('view/tpl/smarty3/cache/');
+ $basecompiledir = $a->config['system']['smarty3_folder'];
+
+ $this->setCompileDir($basecompiledir.'/compiled/');
+ $this->setConfigDir($basecompiledir.'/config/');
+ $this->setCacheDir($basecompiledir.'/cache/');
$this->left_delimiter = $a->get_template_ldelim('smarty3');
$this->right_delimiter = $a->get_template_rdelim('smarty3');
@@ -46,9 +48,16 @@ class FriendicaSmartyEngine implements ITemplateEngine {
static $name ="smarty3";
public function __construct(){
- if(!is_writable('view/tpl/smarty3/')){
- echo "<b>ERROR:</b> folder <tt>view/tpl/smarty3/</tt> must be writable by webserver."; killme();
+ $a = get_app();
+ $basecompiledir = $a->config['system']['smarty3_folder'];
+ if (!$basecompiledir) $basecompiledir = dirname(__dir__)."/view/tpl/smarty3";
+ if (!is_dir($basecompiledir)) {
+ echo "<b>ERROR:</b> folder <tt>$basecompiledir</tt>does not exixst."; killme();
+ }
+ if(!is_writable($basecompiledir)){
+ echo "<b>ERROR:</b> folder <tt>$basecompiledir</tt> must be writable by webserver."; killme();
}
+ $a->config['system']['smarty3_folder'] = $basecompiledir;
}
// ITemplateEngine interface