]> git.mxchange.org Git - friendica.git/blobdiff - mod/install.php
Merge branch 'master' of https://github.com/friendica/friendica
[friendica.git] / mod / install.php
index cb21a71ebe9febc903847618a7d2d1d7421a6e4b..7247ebb2c12c13598398f58b9373cc006456e4c0 100755 (executable)
@@ -32,7 +32,7 @@ function install_post(&$a) {
                        $dbdata = notags(trim($_POST['dbdata']));
                        $phpath = notags(trim($_POST['phpath']));
 
-                       require_once("dba.php");
+                       require_once("include/dba.php");
                        unset($db);
                        $db = new dba($dbhost, $dbuser, $dbpass, $dbdata, true);
                        /*if(get_db_errno()) {
@@ -60,7 +60,7 @@ function install_post(&$a) {
 
                        return; 
                        break;
-               case 4;
+               case 4:
                        $urlpath = $a->get_path();
                        $dbhost = notags(trim($_POST['dbhost']));
                        $dbuser = notags(trim($_POST['dbuser']));
@@ -155,11 +155,11 @@ function install_content(&$a) {
        }
 
        if(x($a->data,'txt') && strlen($a->data['txt'])) {
-               $tpl = get_markup_template('install.tpl');
                $db_return_text .= manual_config($a);
        }
        
        if ($db_return_text!="") {
+               $tpl = get_markup_template('install.tpl');
                return replace_macros($tpl, array(
                        '$title' => $install_title,
                        '$pass' => "",
@@ -177,6 +177,8 @@ function install_content(&$a) {
 
                        check_htconfig($checks);
 
+                       check_smarty3($checks);
+
                        check_keys($checks);
                        
                        if(x($_POST,'phpath'))
@@ -249,7 +251,7 @@ function install_content(&$a) {
                        return $o;
                }; break;
                case 3: { // Site settings
-                       require_once('datetime.php');
+                       require_once('include/datetime.php');
                        $dbhost = ((x($_POST,'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost');
                        $dbuser = notags(trim($_POST['dbuser']));
                        $dbpass = notags(trim($_POST['dbpass']));
@@ -428,6 +430,22 @@ function check_htconfig(&$checks) {
 
 }
 
+function check_smarty3(&$checks) {
+       $status = true;
+       $help = "";
+       if(     !is_writable('view/smarty3') ) {
+       
+               $status=false;
+               $help = t('Friendica uses the Smarty3 template engine to render its web views. Smarty3 compiles templates to PHP to speed up rendering.') .EOL;
+               $help .= t('In order to store these compiled templates, the web server needs to have write access to the directory view/smarty3/ under the Friendica top level folder.').EOL;
+               $help .= t('Please ensure that the user that your web server runs as (e.g. www-data) has write access to this folder.').EOL;
+               $help .= t('Note: as a security measure, you should give the web server write access to view/smarty3/ only--not the template files (.tpl) that it contains.').EOL; 
+       }
+    
+       check_add($checks, t('view/smarty3 is writable'), $status, true, $help);
+
+}
+
 function check_htaccess(&$checks) {
        $a = get_app();
        $status = true;
@@ -447,7 +465,7 @@ function check_htaccess(&$checks) {
 
        
 function manual_config(&$a) {
-       $data = htmlentities($a->data['txt']);
+       $data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8');
        $o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');
        $o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";
        return $o;
@@ -466,7 +484,6 @@ function load_database_rem($v, $i){
 function load_database($db) {
 
        $str = file_get_contents('database.sql');
-//     $str = array_reduce(explode("\n", $str),"load_database_rem","");
        $arr = explode(';',$str);
        $errors = false;
        foreach($arr as $a) {
@@ -488,7 +505,7 @@ function what_next() {
                ."<p>".t('IMPORTANT: You will need to [manually] setup a scheduled task for the poller.')
                .t('Please see the file "INSTALL.txt".')                        
                ."</p><p>"
-               .t("Go to your new Firendica node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.")
+               .t("Go to your new Friendica node <a href='$baseurl/register'>registration page</a> and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.")
                ."</p>";
 }