]> git.mxchange.org Git - friendica.git/blobdiff - index.php
Merge remote-tracking branch 'CatoTH/master' into req245
[friendica.git] / index.php
old mode 100755 (executable)
new mode 100644 (file)
index e722796..442173e
--- a/index.php
+++ b/index.php
@@ -38,11 +38,10 @@ load_translation_table($lang);
  */
 
 require_once("dba.php");
-$db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
-        unset($db_host, $db_user, $db_pass, $db_data);
-
 
 if(! $install) {
+       $db = new dba($db_host, $db_user, $db_pass, $db_data, $install);
+           unset($db_host, $db_user, $db_pass, $db_data);
 
        /**
         * Load configs from db. Overwrite configs from .htconfig.php
@@ -96,6 +95,10 @@ if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
 if(x($_GET,'zrl')) {
        $_SESSION['my_url'] = $_GET['zrl'];
        $a->query_string = preg_replace('/[\?&]zrl=(.*?)([\?&]|$)/is','',$a->query_string);
+       if(! $install) {
+               $arr = array('zrl' => $_SESSION['my_url'], 'url' => $a->cmd);
+               call_hooks('zrl_init',$arr);
+       }
 }
 
 /**
@@ -258,6 +261,18 @@ if($a->module_loaded) {
                $func($a);
        }
 
+       if(function_exists(str_replace('-','_',current_theme()) . '_init')) {
+               $func = str_replace('-','_',current_theme()) . '_init';
+               $func($a);
+       }
+//     elseif (x($a->theme_info,"extends") && file_exists("view/theme/".$a->theme_info["extends"]."/theme.php")) {
+//             require_once("view/theme/".$a->theme_info["extends"]."/theme.php");
+//             if(function_exists(str_replace('-','_',$a->theme_info["extends"]) . '_init')) {
+//                     $func = str_replace('-','_',$a->theme_info["extends"]) . '_init';
+//                     $func($a);
+//             }
+//     }
+
        if(($_SERVER['REQUEST_METHOD'] === 'POST') && (! $a->error)
                && (function_exists($a->module . '_post'))
                && (! x($_POST,'auth-params'))) {
@@ -348,13 +363,13 @@ $profile = $a->profile;
 
 header("Content-type: text/html; charset=utf-8");
 
-$template = 'view/' . current_theme() . '/' 
+$template = 'view/theme/' . current_theme() . '/' 
        . ((x($a->page,'template')) ? $a->page['template'] : 'default' ) . '.php';
 
 if(file_exists($template))
        require_once($template);
 else
-       require_once(str_replace(current_theme() . '/', '', $template));
+       require_once(str_replace('theme/' . current_theme() . '/', '', $template));
 
 session_write_close();
 exit;