Added column Currency in Bank Accounts. Changed to all years in fixed assets.
[fa-stable.git] / includes / main.inc
index 018fb2b0cdc9b0869d2418969b231d838518563c..d6a3453118731fe25034152e010727be21df1937 100644 (file)
 ***********************************************************************/
 include_once($path_to_root . "/includes/db/connect_db.inc");
 
+include_once($path_to_root . "/admin/db/transactions_db.inc");
 include_once($path_to_root . "/includes/types.inc");
-include_once($path_to_root . "/includes/systypes.inc");
 include_once($path_to_root . "/includes/references.inc");
 include_once($path_to_root . "/includes/db/comments_db.inc");
 include_once($path_to_root . "/includes/db/sql_functions.inc");
 include_once($path_to_root . "/includes/db/audit_trail_db.inc");
-//include_once($path_to_root . "/includes/validation.inc");
 
 include_once($path_to_root . "/admin/db/users_db.inc");
 include_once($path_to_root . "/includes/ui/ui_view.inc");
 include_once($path_to_root . "/includes/ui/ui_controls.inc");
 
 $page_nested = -1;
+// static js files path
+$js_path = $path_to_root.'/js/';
+// standard external js scripts included in all files
+$js_static = array('JsHttpRequest.js', 'behaviour.js', 'utils.js', 'inserts.js');
+// additional js source included in header
+$js_lib = $js_userlib = array();
 
 function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $script_only=false, $css='')
 {
@@ -65,9 +70,9 @@ function end_page($no_menu=false, $is_index=false, $final_screen=false, $type_no
 
 function cache_js_file($fpath, $text) 
 {
-       global $go_debug;
+       global $SysPrefs;
 
-       if(!$go_debug) $text = js_compress($text);
+       if (!$SysPrefs->go_debug) $text = js_compress($text);
 
     $file = force_open($fpath);
        if (!$file) return false;
@@ -118,7 +123,7 @@ function add_js_ufile($filename)
 function add_js_source($text) 
 {
          global $js_lib;
-         
+
          $search = array_search($text, $js_lib);
          if ($search === false || $search === null) // php>4.2.0 returns null
                $js_lib[] = $text;
@@ -378,4 +383,24 @@ function clean_file_name($filename) {
     return preg_replace('/[^a-zA-Z0-9.\-_]/', '_', $filename);
 }
 
-?>
\ No newline at end of file
+/*
+       Simple random password generator.
+*/
+function generate_password()
+{
+       if (PHP_VERSION >= '5.3')
+               $bytes = openssl_random_pseudo_bytes(8, $cstrong);
+       else
+               $bytes = sprintf("08%x", mt_rand(0,0xffffffff));
+
+       return  base64_encode($bytes);
+}
+
+if (!function_exists('array_fill_keys')) // since 5.2
+{
+       function array_fill_keys($keys, $value)
+       {
+               return array_combine($keys, array_fill(count($keys), $value));
+       }
+}
+