Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Lucksi
GitHub Repository: Lucksi/Mr.Holmes
Path: blob/master/GUI/Actions/OpenSchema.php
1071 views
1
<?php
2
/*ORIGINAL CREATOR: Luca Garofalo (Lucksi)
3
AUTHOR: Luca Garofalo (Lucksi)
4
Copyright (C) 2022-2023 Lucksi <[email protected]>
5
License: GNU General Public License v3.0*/
6
7
function Get_Message($Type,$Param){
8
require_once ("Language_Controller.php");
9
$Message = Message($Type,$Param);
10
return $Message;
11
}
12
13
function Toolbar($final,$converted,$Mess1,$Mess2){
14
require("Builder.php");
15
OpenConstructor($final,$converted,$Mess1,$Mess2);
16
}
17
18
function Decode($content){
19
$converted = base64_decode($content);
20
$String = utf8_encode($converted);
21
return $String;
22
}
23
24
function Open(){
25
$filename = $_POST["bar"];
26
$filename2 = '" "';
27
$final = str_replace(" ",$filename,$filename2);
28
$path = "../Graphs/{$filename}/{$filename}.mh";
29
$path2 = "../Graphs/{$filename}/encode.mh";
30
if(!file_exists($path)){
31
$Message = Get_Message("Errors","Graph");
32
echo "<script>
33
alert('$Message');
34
</script>";
35
}
36
else{
37
$Message = Get_Message("Positives","Graph");
38
echo "<script>
39
alert('$Message');
40
</script>";
41
$content = file_get_contents($path);
42
$reader2 = fopen($path2,"r")or die("2Error");
43
$encode = file_get_contents($path2);
44
if($encode == "Encoded"){
45
$converted = Decode($content);
46
}
47
else if($encode == "NotEncoded"){
48
$converted = $content;
49
}
50
else{
51
echo "<script>alert('OPS Looks Like there is an invalid Encode Value exit)</script>";
52
exit();
53
}
54
$tmp = "../Graphs/Temp.txt";
55
$tmp2 = "../Graphs/TempEncode.txt";
56
if(file_exists($tmp)){
57
unlink($tmp);
58
}
59
if(file_exists($tmp2)){
60
unlink($tmp2);
61
}
62
$Mess1 = Get_Message("Question","Graph");
63
$Msg = '" "';
64
$finalMsg = str_replace(" ",$Mess1,$Msg);
65
$Mess2 = Get_Message("Question","Reset");
66
$Msg2 = '" "';
67
$finalMsg2 = str_replace(" ",$Mess2,$Msg2);
68
$d = fopen($tmp,"w");
69
fwrite($d,$path);
70
fclose($d);
71
$d = fopen($tmp2,"w");
72
fwrite($d,$path2);
73
fclose($d);
74
Toolbar($final,$converted,$finalMsg,$finalMsg2);
75
}
76
}
77
if(isset($_POST["Button"])){
78
Open();
79
}
80
?>
81