<?php @ini_set("display_errors","1"); @ini_set("display_startup_errors","1"); include("include/dbcommon.php"); include('include/xtempl.php'); require_once(getabspath("classes/cipherer.php")); include('classes/loginpage.php'); add_nocache_headers(); if($wr_is_standalone) { $arr_table=db_gettablelist(); $first_install=true; foreach($arr_table as $ind=>$table) { if(strpos(strtoupper($table),strtoupper("webreport_settings"))!==false) { $first_install=false; break; } } if($first_install) header("Location: install.php"); } $cipherer = new RunnerCipherer( NOT_TABLE_BASED_TNAME ); $layout = new TLayout("login2", "BoldOrange", "MobileOrange");
function create_table($dbname) { global $config,$conn,$wr_pagestylepath; $arr_table=db_gettablelist(); if($config["databaseType"]=="oracle" || $config["databaseType"]=="postgre" || $config["databaseType"]=="mssql") { foreach($arr_table as $ind=>$table) { $pos=strpos($table,"."); $arr_table[$ind]=substr($table,$pos+1); } } foreach($arr_table as $ind=>$table) { if(strtoupper($dbname)==strtoupper($table)) return false; } $handle = fopen("script/".$config["databaseType"]."/".$dbname.".sql", "r"); if(!$handle) die("File 'script/".$config["databaseType"]."/".$dbname.".sql' don't exist !"); $contents = fread($handle, filesize("script/".$config["databaseType"]."/".$dbname.".sql")); fclose($handle); $pos=0; $arr=array(); $arr=explode("-- \$next",$contents); foreach($arr as $value) { if($value) { while($pos!==false) { $pos=strpos($value,"--",$pos); if($pos!==false) { $posend=strpos($value,"\r\n",$pos); if(!$posend) $posend=strpos($value,"\n",$pos); $value=substr($value,0,$pos).substr($value,$posend); } } if($config["databaseType"]=="oracle") $value = str_replace("\r","",$value); db_exec($value,$conn); } } }
function WRGetTablesList() { if(!isset($_SESSION["WRTableList"])) $_SESSION["WRTableList"] = db_gettablelist(); return $_SESSION["WRTableList"]; }