Refactoring
This commit is contained in:
22
app/config.sample.php
Executable file
22
app/config.sample.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
ini_set('error_log', '_LOG_');
|
||||
|
||||
define('APP_NAME', 'Ice Hrm');
|
||||
define('FB_URL', 'Ice Hrm');
|
||||
define('TWITTER_URL', 'Ice Hrm');
|
||||
|
||||
define('CLIENT_NAME', '_CLIENT_');
|
||||
define('APP_BASE_PATH', '_APP_BASE_PATH_');
|
||||
define('CLIENT_BASE_PATH', '_CLIENT_BASE_PATH_');
|
||||
define('BASE_URL','_BASE_URL_');
|
||||
define('CLIENT_BASE_URL','_CLIENTBASE_URL_');
|
||||
|
||||
define('APP_DB', '_APP_DB_');
|
||||
define('APP_USERNAME', '_APP_USERNAME_');
|
||||
define('APP_PASSWORD', '_APP_PASSWORD_');
|
||||
define('APP_HOST', '_APP_HOST_');
|
||||
define('APP_CON_STR', 'mysqli://'.APP_USERNAME.':'.APP_PASSWORD.'@'.APP_HOST.'/'.APP_DB);
|
||||
|
||||
//file upload
|
||||
define('FILE_TYPES', 'jpg,png,jpeg');
|
||||
define('MAX_FILE_SIZE_KB', 10 * 1024);
|
||||
7
app/cron.php
Executable file
7
app/cron.php
Executable file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
if(php_sapi_name() != 'cli'){
|
||||
exit();
|
||||
}
|
||||
|
||||
include ('config.php');
|
||||
include (APP_BASE_PATH.'crons/cron.php');
|
||||
3
app/data.php
Executable file
3
app/data.php
Executable file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
include ('config.php');
|
||||
include (APP_BASE_PATH.'data.php');
|
||||
1
app/data/gitkeep
Normal file
1
app/data/gitkeep
Normal file
@@ -0,0 +1 @@
|
||||
git keep
|
||||
18
app/entry.php
Executable file
18
app/entry.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
include ('config.php');
|
||||
if(!isset($_REQUEST['g']) || !isset($_REQUEST['n'])){
|
||||
header("Location:".CLIENT_BASE_URL."login.php");
|
||||
exit();
|
||||
}
|
||||
$group = $_REQUEST['g'];
|
||||
$name= $_REQUEST['n'];
|
||||
|
||||
$groups = array('admin','modules');
|
||||
|
||||
if($group == 'admin' || $group == 'modules'){
|
||||
$name = str_replace("..","",$name);
|
||||
$name = str_replace("/","",$name);
|
||||
include APP_BASE_PATH.'/'.$group.'/'.$name.'/entry.php';
|
||||
}else{
|
||||
exit();
|
||||
}
|
||||
3
app/fileupload.php
Executable file
3
app/fileupload.php
Executable file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
include ('config.php');
|
||||
include (APP_BASE_PATH.'fileupload.php');
|
||||
3
app/fileupload_page.php
Executable file
3
app/fileupload_page.php
Executable file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
include ('config.php');
|
||||
include (APP_BASE_PATH.'fileupload_page.php');
|
||||
3
app/header.php
Executable file
3
app/header.php
Executable file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
include (APP_BASE_PATH.'header.php');
|
||||
22
app/index.php
Executable file
22
app/index.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
if(!file_exists('config.php')){
|
||||
header("Location:install/");
|
||||
exit();
|
||||
}
|
||||
include ('config.php');
|
||||
if(!isset($_REQUEST['g']) || !isset($_REQUEST['n'])){
|
||||
header("Location:".CLIENT_BASE_URL."login.php");
|
||||
exit();
|
||||
}
|
||||
$group = $_REQUEST['g'];
|
||||
$name= $_REQUEST['n'];
|
||||
|
||||
$groups = array('admin','modules');
|
||||
|
||||
if($group == 'admin' || $group == 'modules'){
|
||||
$name = str_replace("..","",$name);
|
||||
$name = str_replace("/","",$name);
|
||||
include APP_BASE_PATH.'/'.$group.'/'.$name.'/index.php';
|
||||
}else{
|
||||
exit();
|
||||
}
|
||||
1058
app/install/bootstrap/css/bootstrap-responsive.css
vendored
Executable file
1058
app/install/bootstrap/css/bootstrap-responsive.css
vendored
Executable file
File diff suppressed because it is too large
Load Diff
9
app/install/bootstrap/css/bootstrap-responsive.min.css
vendored
Executable file
9
app/install/bootstrap/css/bootstrap-responsive.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
5774
app/install/bootstrap/css/bootstrap.css
vendored
Executable file
5774
app/install/bootstrap/css/bootstrap.css
vendored
Executable file
File diff suppressed because it is too large
Load Diff
9
app/install/bootstrap/css/bootstrap.min.css
vendored
Executable file
9
app/install/bootstrap/css/bootstrap.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
BIN
app/install/bootstrap/img/glyphicons-halflings-white.png
Executable file
BIN
app/install/bootstrap/img/glyphicons-halflings-white.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
BIN
app/install/bootstrap/img/glyphicons-halflings.png
Executable file
BIN
app/install/bootstrap/img/glyphicons-halflings.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
2027
app/install/bootstrap/js/bootstrap.js
vendored
Executable file
2027
app/install/bootstrap/js/bootstrap.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
6
app/install/bootstrap/js/bootstrap.min.js
vendored
Executable file
6
app/install/bootstrap/js/bootstrap.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
8
app/install/config.php
Executable file
8
app/install/config.php
Executable file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
error_reporting(E_ERROR);
|
||||
ini_set("error_log", "../data/icehrm_install.log");
|
||||
define('CURRENT_PATH',dirname(__FILE__));
|
||||
define('CLIENT_APP_PATH',realpath(dirname(__FILE__)."/..")."/");
|
||||
define('APP_PATH',realpath(dirname(__FILE__)."/../..")."/");
|
||||
define('APP_NAME',"IceHrm");
|
||||
define('APP_ID',"icehrm");
|
||||
256
app/install/index.php
Executable file
256
app/install/index.php
Executable file
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
require dirname(__FILE__)."/config.php";
|
||||
$isConfigFileExists = file_exists(CLIENT_APP_PATH."config.php");
|
||||
|
||||
$errorMap = array();
|
||||
|
||||
if($isConfigFileExists){
|
||||
$data = file_get_contents(CLIENT_APP_PATH."config.php");
|
||||
if($data != ""){
|
||||
$errorMap[] = array("important","A configuration file exists","Application is already installed. If you want to reinstall, please delete the config file, clear data folder and use a new database during the installation.");
|
||||
}
|
||||
}else{
|
||||
$file = fopen(CLIENT_APP_PATH."config.php","w");
|
||||
fwrite($file,"");
|
||||
fclose($file);
|
||||
}
|
||||
|
||||
$isConfigFileWriteable = is_writable(CLIENT_APP_PATH."config.php");
|
||||
error_log("Config writable ".$isConfigFileWriteable);
|
||||
error_log("Config exists ".file_exists(CLIENT_APP_PATH."config.php"));
|
||||
if(!$isConfigFileWriteable){
|
||||
$errorMap[] = array("important","Configuration file [".CLIENT_APP_PATH."config.php] is not writable","Make this file writable",array("sudo touch ".CLIENT_APP_PATH."config.php","sudo chmod 777 ".CLIENT_APP_PATH."config.php"));
|
||||
}
|
||||
|
||||
$isConfigSampleFileExists = file_exists(CLIENT_APP_PATH."config.sample.php");
|
||||
|
||||
if(!$isConfigSampleFileExists){
|
||||
$errorMap[] = array("important","Sample configuration file doesn't exists","Please check :".CLIENT_APP_PATH."config.sample.php");
|
||||
}
|
||||
|
||||
$isDataFolderExists = is_dir(CLIENT_APP_PATH."data");
|
||||
$isDataFolderWritable = false;
|
||||
|
||||
|
||||
if(!$isDataFolderExists){
|
||||
$errorMap[] = array("important","Data directory does not exists","Please create directory :".CLIENT_APP_PATH."data",array("sudo mkdir ".CLIENT_APP_PATH."data"));
|
||||
}else{
|
||||
$file = fopen(CLIENT_APP_PATH."data/test.txt","w");
|
||||
if($file){
|
||||
fwrite($file,"Test file write");
|
||||
fclose($file);
|
||||
|
||||
$data = file_get_contents(CLIENT_APP_PATH."data/test.txt");
|
||||
|
||||
if($data == "Test file write"){
|
||||
$isDataFolderWritable = true;
|
||||
}
|
||||
unlink(CLIENT_APP_PATH."data/test.txt");
|
||||
}
|
||||
if(!$isDataFolderWritable){
|
||||
$errorMap[] = array("important","Data folder is not writable","Provide wirte permission to the web server user to ".CLIENT_APP_PATH."data",array("sudo chmod 777 ".CLIENT_APP_PATH."data"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>IceHRM</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<!-- Le styles -->
|
||||
<link href="bootstrap/css/bootstrap.css" rel="stylesheet">
|
||||
|
||||
<script type="text/javascript" src="../../js/jquery.js"></script>
|
||||
<script src="bootstrap/js/bootstrap.js"></script>
|
||||
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
|
||||
<link href="styles.css?v=2" rel="stylesheet">
|
||||
|
||||
<script type="text/javascript" src="../../js/date.js"></script>
|
||||
<script type="text/javascript" src="../../js/json2.js"></script>
|
||||
<script type="text/javascript" src="../../js/CrockfordInheritance.v0.1.js"></script>
|
||||
|
||||
<!-- Le fav and touch icons -->
|
||||
<link rel="shortcut icon" href="bootstrap/ico/favicon.ico">
|
||||
<!-- IE Fix for HTML5 Tags -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
var url = top.location.href;
|
||||
|
||||
url = url.substring(0,url.lastIndexOf('/app'));
|
||||
$("#BASE_URL").val(url);
|
||||
});
|
||||
|
||||
function testDB(){
|
||||
var request = {};
|
||||
request["APP_DB"] = $("#APP_DB").val();
|
||||
request["APP_USERNAME"] = $("#APP_USERNAME").val();
|
||||
request["APP_PASSWORD"] = $("#APP_PASSWORD").val();
|
||||
request["APP_HOST"] = $("#APP_HOST").val();
|
||||
request["action"] = "TEST_DB";
|
||||
|
||||
$.post("submit.php",request , function(data) {
|
||||
if(data.status == "SUCCESS"){
|
||||
alert(data.msg);
|
||||
$("#installBtn").removeAttr('disabled');
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},"json");
|
||||
}
|
||||
|
||||
function install(){
|
||||
var request = {};
|
||||
request["APP_DB"] = $("#APP_DB").val();
|
||||
request["APP_USERNAME"] = $("#APP_USERNAME").val();
|
||||
request["APP_PASSWORD"] = $("#APP_PASSWORD").val();
|
||||
request["APP_HOST"] = $("#APP_HOST").val();
|
||||
request["action"] = "INS";
|
||||
|
||||
request["LOG"] = $("#LOG").val();
|
||||
request["BASE_URL"] = $("#BASE_URL").val();
|
||||
|
||||
if(request["BASE_URL"] == undefined || request["BASE_URL"] == null
|
||||
|| request["BASE_URL"] == ""){
|
||||
alert("Invalid Base URL");
|
||||
return;
|
||||
}
|
||||
|
||||
if(request["BASE_URL"].indexOf("http://") == 0 || request["BASE_URL"].indexOf("https://") == 0){
|
||||
}else{
|
||||
alert("Invalid Base URL");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!endsWith(request["BASE_URL"],"/")){
|
||||
request["BASE_URL"] = request["BASE_URL"] + "/";
|
||||
}
|
||||
$("#installBtn").attr('disabled','disabled');
|
||||
$.post("submit.php",request , function(data) {
|
||||
if(data.status == "SUCCESS"){
|
||||
alert(data.msg);
|
||||
top.location.href = request["BASE_URL"]+"app/";
|
||||
}else{
|
||||
alert(data.msg);
|
||||
$("#installBtn").removeAttr('disabled');
|
||||
}
|
||||
},"json");
|
||||
}
|
||||
|
||||
function endsWith(str,pattern) {
|
||||
var d = str.length - pattern.length;
|
||||
return d >= 0 && str.lastIndexOf(pattern) === d;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<div class="container-fluid bgbody" style="max-width:800px;padding-top:10px;margin:auto">
|
||||
<h1>IceHRM Installation</h1>
|
||||
<p class="p1">
|
||||
Please do not install this application if you have already installed (this could break existing installation)
|
||||
</p>
|
||||
<?php if(count($errorMap)>0){?>
|
||||
<?php foreach($errorMap as $error){?>
|
||||
<p class="p2">
|
||||
<!--
|
||||
<span style="" class="label label-<?=$error[0]?>"><?=$error[1]?></span><br/>
|
||||
-->
|
||||
<span style="font-size:14px;color:red;font-weight: bold;"><?=$error[1]?></span><br/>
|
||||
<?=$error[2]?><br/>
|
||||
<?php if(!empty($error[3]) && is_array($error[3])){?>
|
||||
|
||||
<?php foreach($error[3] as $command){?>
|
||||
<span class="label label-inverse">
|
||||
<?=$command?></span><br/>
|
||||
<?php }?>
|
||||
|
||||
<?php }?>
|
||||
</p>
|
||||
<hr/>
|
||||
<?php }?>
|
||||
Once above errors are corrected, please reload the page<br/><br/>
|
||||
<button onclick="location.reload();;return false;" class="btn">Reload</button>
|
||||
<?php }else{?>
|
||||
<form class="form-horizontal" id="install_step1">
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<span class="label label-warning" id="install_step1_error" style="display:none;"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="LOG">Log file path</label>
|
||||
<div class="controls">
|
||||
<input class="input-xxlarge" type="text" id="LOG" name="LOG" value="data/icehrm.log"/>
|
||||
<span class="help-inline p1">Keep this empty if you want logs to be in web server's default logs</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="BASE_URL">App Url</label>
|
||||
<div class="controls">
|
||||
<input class="input-xxlarge" type="text" id="BASE_URL" name="BASE_URL" value=""/>
|
||||
<span class="help-inline p1">This is the web path to folder that you copy icehrm sources (e.g http://yourdomain.com/icehrm/)</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="APP_DB">MySql Database Name</label>
|
||||
<div class="controls">
|
||||
<input class="input-xxlarge" type="text" id="APP_DB" name="APP_DB" value="icehrmdb"/>
|
||||
<span class="help-inline p1">Application DB Name</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="APP_USERNAME">Database User</label>
|
||||
<div class="controls">
|
||||
<input class="input-xxlarge" type="text" id="APP_USERNAME" name="APP_USERNAME" value="icehrmuser"/>
|
||||
<span class="help-inline p1">Database username</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="APP_PASSWORD">Database User Password</label>
|
||||
<div class="controls">
|
||||
<input class="input-xxlarge" type="password" id="APP_PASSWORD" name="APP_PASSWORD" value=""/>
|
||||
<span class="help-inline p1">Database user's password</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="APP_HOST">Database Host</label>
|
||||
<div class="controls">
|
||||
<input class="input-xxlarge" type="text" id="APP_HOST" name="APP_HOST" value="localhost"/>
|
||||
<span class="help-inline p1">MySql DB Host</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<button id="testBtn" onclick="testDB();return false;" class="btn">Test Database Connectivity</button>
|
||||
<button id="installBtn" onclick="install();return false;" class="btn" disabled="disabled">Install Application</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php }?>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row-fluid" style="height:10px;">
|
||||
<div class="span12" style="padding:5px;">
|
||||
<p style="text-align:center;font-size: 10px;">
|
||||
<?=APP_NAME?> All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
9
app/install/styles.css
Executable file
9
app/install/styles.css
Executable file
@@ -0,0 +1,9 @@
|
||||
@CHARSET "ISO-8859-1";
|
||||
|
||||
.p1{
|
||||
font-size:11px;
|
||||
}
|
||||
|
||||
.p2{
|
||||
font-size:12px;
|
||||
}
|
||||
134
app/install/submit.php
Executable file
134
app/install/submit.php
Executable file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
include dirname(__FILE__).'/config.php';
|
||||
include(CLIENT_APP_PATH.'../lib/adodb512/adodb.inc.php');
|
||||
|
||||
$isConfigFileExists = file_exists(CLIENT_APP_PATH."config.php");
|
||||
$configData = file_get_contents(CLIENT_APP_PATH."config.php");
|
||||
|
||||
error_log("isConfigFileExists $isConfigFileExists");
|
||||
error_log("configData $configData");
|
||||
|
||||
$ret = array();
|
||||
|
||||
if(!$isConfigFileExists || $configData != ""){
|
||||
$ret["status"] = "ERROR";
|
||||
$ret["msg"] = "You are trying to install IceHrm on an existing installation.";
|
||||
echo json_encode($ret);
|
||||
exit();
|
||||
}
|
||||
|
||||
$action = $_REQUEST['action'];
|
||||
|
||||
if($action == "TEST_DB"){
|
||||
|
||||
$db = NewADOConnection('mysqli');
|
||||
$res = $db->Connect($_REQUEST["APP_HOST"], $_REQUEST["APP_USERNAME"], $_REQUEST["APP_PASSWORD"], $_REQUEST["APP_DB"]);
|
||||
|
||||
if (!$res){
|
||||
error_log('Could not connect: ' . $db->ErrorMsg());
|
||||
$ret["status"] = "ERROR";
|
||||
$ret["msg"] = "Incorrect credentials or incorrect DB host :".$db->ErrorMsg();
|
||||
echo json_encode($ret);
|
||||
exit();
|
||||
}
|
||||
|
||||
$result = $db->Execute("Show tables");
|
||||
error_log(print_r("Number of tables:".$result->RecordCount(),true));
|
||||
$num_rows = $result->RecordCount();
|
||||
if($num_rows != 0){
|
||||
$ret["status"] = "ERROR";
|
||||
$ret["msg"] = "Database is not empty";
|
||||
echo json_encode($ret);
|
||||
exit();
|
||||
}
|
||||
|
||||
$ret["status"] = "SUCCESS";
|
||||
$ret["msg"] = "Successfully connected to the database";
|
||||
echo json_encode($ret);
|
||||
|
||||
}else if($action == "INS"){
|
||||
|
||||
$config = file_get_contents(CLIENT_APP_PATH."config.sample.php");
|
||||
|
||||
if(empty($config)){
|
||||
error_log('Sample config file is empty');
|
||||
$ret["status"] = "ERROR";
|
||||
$ret["msg"] = "Sample config file not found";
|
||||
echo json_encode($ret);
|
||||
exit();
|
||||
}
|
||||
|
||||
$config = str_replace("_LOG_", $_REQUEST['LOG'], $config);
|
||||
$config = str_replace("_APP_BASE_PATH_", APP_PATH, $config);
|
||||
$config = str_replace("_CLIENT_BASE_PATH_", CLIENT_APP_PATH, $config);
|
||||
$config = str_replace("_BASE_URL_", $_REQUEST['BASE_URL'], $config);
|
||||
$config = str_replace("_CLIENTBASE_URL_", $_REQUEST['BASE_URL']."app/", $config);
|
||||
$config = str_replace("_APP_DB_", $_REQUEST['APP_DB'], $config);
|
||||
$config = str_replace("_APP_USERNAME_", $_REQUEST['APP_USERNAME'], $config);
|
||||
$config = str_replace("_APP_PASSWORD_", $_REQUEST['APP_PASSWORD'], $config);
|
||||
$config = str_replace("_APP_HOST_", $_REQUEST['APP_HOST'], $config);
|
||||
$config = str_replace("_CLIENT_", 'app', $config);
|
||||
|
||||
|
||||
$db = NewADOConnection('mysqli');
|
||||
$res = $db->Connect($_REQUEST["APP_HOST"], $_REQUEST["APP_USERNAME"], $_REQUEST["APP_PASSWORD"], $_REQUEST["APP_DB"]);
|
||||
|
||||
|
||||
if (!$res){
|
||||
error_log('Could not connect: ' . $db->ErrorMsg());
|
||||
$ret["status"] = "ERROR";
|
||||
$ret["msg"] = "Incorrect credentials or incorrect DB host. ".'Could not connect: ' . $db->ErrorMsg();
|
||||
echo json_encode($ret);
|
||||
exit();
|
||||
}
|
||||
|
||||
$result = $db->Execute("Show tables");
|
||||
error_log(print_r("Number of tables:".$result->RecordCount(),true));
|
||||
$num_rows = $result->RecordCount();
|
||||
if($num_rows != 0){
|
||||
$ret["status"] = "ERROR";
|
||||
$ret["msg"] = "Database is not empty";
|
||||
echo json_encode($ret);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//Run create table script
|
||||
$insql = file_get_contents(CLIENT_APP_PATH."../data/scripts/".APP_ID."db.sql");
|
||||
$sql_list = preg_split('/;/',$insql);
|
||||
foreach($sql_list as $sql){
|
||||
if (preg_match('/^\s+$/', $sql) || $sql == '') { # skip empty lines
|
||||
continue;
|
||||
}
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
//Run create table script
|
||||
$insql = file_get_contents(CLIENT_APP_PATH."../data/scripts/".APP_ID."_master_data.sql");
|
||||
$sql_list = preg_split('/;/',$insql);
|
||||
foreach($sql_list as $sql){
|
||||
if (preg_match('/^\s+$/', $sql) || $sql == '') { # skip empty lines
|
||||
continue;
|
||||
}
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
//Write config file
|
||||
|
||||
$file = fopen(CLIENT_APP_PATH."config.php","w");
|
||||
if($file){
|
||||
fwrite($file,$config);
|
||||
fclose($file);
|
||||
}else{
|
||||
error_log('Unable to write configurations to file');
|
||||
$ret["status"] = "ERROR";
|
||||
$ret["msg"] = "Unable to write configurations to file";
|
||||
echo json_encode($ret);
|
||||
exit();
|
||||
}
|
||||
|
||||
$ret["status"] = "SUCCESS";
|
||||
$ret["msg"] = "Successfully installed. Please rename or delete install folder";
|
||||
echo json_encode($ret);
|
||||
}
|
||||
3
app/login.php
Executable file
3
app/login.php
Executable file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
include ('config.php');
|
||||
include (APP_BASE_PATH.'login.php');
|
||||
3
app/logout.php
Executable file
3
app/logout.php
Executable file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
include ('config.php');
|
||||
include (APP_BASE_PATH.'logout.php');
|
||||
3
app/rest.php
Executable file
3
app/rest.php
Executable file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
include ('config.php');
|
||||
include (APP_BASE_PATH.'rest.php');
|
||||
3
app/service.php
Executable file
3
app/service.php
Executable file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
include ('config.php');
|
||||
include (APP_BASE_PATH.'service.php');
|
||||
18
app/update.php
Executable file
18
app/update.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
include ('config.php');
|
||||
if(!isset($_REQUEST['g']) || !isset($_REQUEST['n'])){
|
||||
header("Location:".CLIENT_BASE_URL."login.php");
|
||||
exit();
|
||||
}
|
||||
$group = $_REQUEST['g'];
|
||||
$name= $_REQUEST['n'];
|
||||
|
||||
$groups = array('admin','modules');
|
||||
|
||||
if($group == 'admin' || $group == 'modules'){
|
||||
$name = str_replace("..","",$name);
|
||||
$name = str_replace("/","",$name);
|
||||
include APP_BASE_PATH.'/'.$group.'/'.$name.'/update.php';
|
||||
}else{
|
||||
exit();
|
||||
}
|
||||
Reference in New Issue
Block a user