-
Notifications
You must be signed in to change notification settings - Fork 44
/
appIndex.php
140 lines (128 loc) · 11.4 KB
/
appIndex.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" href="favicon.ico">
<title>HRCLoud2 | App Launcher</title>
<script type="text/javascript" src="/HRProprietary/HRCloud2/Applications/jquery-3.1.0.min.js" preload></script>
<script type="text/javascript" src="/HRProprietary/HRCloud2/Resources/HRC2-Lib.js" defer></script>
<script type="text/javascript" src="/HRProprietary/HRCloud2/Resources/Drag-Drop-Swap.js" defer></script>
<?php
// / -----------------------------------------------------------------------------------
// / The follwoing code checks for required core files and terminates if they are missing.
if (!file_exists(realpath(dirname(__FILE__)).'/commonCore.php')) die ('<body>ERROR!!! HRC2AppIndex28, Cannot process the HRCloud2 Common Core file (commonCore.php)!<br></body></html>');
else require_once (realpath(dirname(__FILE__)).'/commonCore.php');
if (!file_exists(realpath(dirname(__FILE__)).'/appCore.php')) die ('<body>ERROR!!! HRC2AppIndex34, Cannot process the HRCloud2 App Core file (appCore.php)!<br></body></html>');
else require_once (realpath(dirname(__FILE__)).'/appCore.php');
// / -----------------------------------------------------------------------------------
?>
<div style="font-family:<?php echo $Font; ?>;">
<div align="center">
<p><strong>HRCloud2 Apps</strong>
<?php
// / Secutity related processing.
$appCounter = 0;
if ($UserIDRAW == 1) {
echo '<button id="showInstallAppButton" name="showInstallAppButton" class="button" alt="Install App" title="Install App" style="display:block; float:right;" onclick="toggle_visibility(\'showInstallAppButton\'); toggle_visibility(\'XshowInstallAppButton\'); toggle_visibility(\'installAppForm\');">+</button>';
echo '<img id="XshowInstallAppButton" name="XshowInstallAppButton" style="margin-right:5px; display:none; float:right;" onclick="toggle_visibility(\'showInstallAppButton\'); toggle_visibility(\'XshowInstallAppButton\'); toggle_visibility(\'installAppForm\');" src="Resources/x.png" alt="Close \'Install App\'" title="Close \'Install App\'" defer></p>';
echo '<div id="installAppForm" name="installAppForm" style="display:none;"><form method="post" action="appIndex.php" enctype="multipart/form-data"><input type="file" id="appToUpload" name="appToUpload[]" class="uploadbox" multiple>';
echo '<input type="hidden" id="YUMMYSaltHash" name="YUMMYSaltHash" value="'.$SaltHash.'"><input type="submit" id="installApplication" name="installApplication" class="button" value="Install App"></form></div>'; }
if ($UserIDRAW !== 1) {
echo '</p>'; } ?>
</div>
<hr />
<div align="center" id='loading' name='loading' style="display:none;"><img src="Resources/pacmansmall.gif"></div>
<div class="dragContainer" align="center">
<?php
// / The following code detects and displays each valid App in the "Applications" directory.
foreach ($apps as $appName) {
if (in_array($appName, $defaultApps)) continue;
if ($appName == '.' or $appName == '..' or in_array($appName, $defaultApps)) continue;
@copy($InstLoc.'/index.html', $AppDir.$appName.'/index.html');
$appLoc = 'Applications/'.$appName.'/'.$appName.'.php';
$appIcon = 'Applications/'.$appName.'/'.$appName.'.png';
if (!file_exists($appIcon)) {
$appIcon = 'Resources/appicon.png'; }
// / The folloiwing code declares the AppInfo for the app being displayed by scanning for the
// / HRCLOUD2-PLUGIN declaration contained within each HRC2 App.
if (!file_exists($appLoc)) continue;
$lines = file($appLoc);
$lineCounter = 0;
$ApplicationName = '';
$ApplicationVersion = '';
$ApplicationLicense = '';
$ApplicationAuthor = '';
$ApplicationDescription = '';
$ApplicationWebsite = '';
$ApplicationIntegration = '';
foreach ($lines as $line) {
if (strpos($line, 'App Name: ') == 'true') {
$ApplicationName = str_replace('App Name: ', '', $line);
$ApplicationName = trim($ApplicationName); }
if (strpos($line, 'App Version: ') == 'true') {
$ApplicationVersion = str_replace('App Version: ', '', $line); }
if (strpos($line, 'App License: ') == 'true') {
$ApplicationLicense = str_replace('App License: ', '', $line);
$ApplicationLicense = trim($ApplicationLicense); }
if (strpos($line, 'App Author: ') == 'true') {
$ApplicationAuthor = str_replace('App Author: ', '', $line);
$ApplicationAuthor = trim($ApplicationAuthor); }
if (strpos($line, 'App Description: ') == 'true') {
$ApplicationDescription = str_replace('App Description: ', '', $line);
$ApplicationDescription = trim($ApplicationDescription); }
if (strpos($line, 'App Website: ') == 'true') {
$ApplicationWebsite = str_replace('App Website: ', '', $line);
$ApplicationWebsite = trim($ApplicationWebsite); }
if (strpos($line, 'App Integration: ') == 'true') {
$ApplicationIntegration = str_replace('App Integration: ', '', $line);
$ApplicationIntegration = trim($ApplicationIntegration); }
if (strpos($line, 'App Permission: 0') == 'true' or strpos($line, 'App Permission: admin') == 'true'
or strpos($line, 'App Permission: Admin') == 'true') {
if ($UserIDRAW !== 1) continue 2; }
$lineCounter++; }
echo nl2br('<div id="app'.$appCounter.'Overview" name="'.$appName.'Overview" style="overflow-y:auto; height:160px; float:left; width:190px; height:195px; border:inset; margin-bottom:2px;" draggable=true>');
echo ('<div align="center">');
echo nl2br('<br><input type="submit" id="launchApplication" name="launchApplication" value="'.$appName.'" onclick="location.href=\''.'Applications/'.$appName.'/'.$appName.'.php\'; toggle_visibility(\'loading\');"><p>');
// / The following code displays administrator specific buttons.
if ($UserIDRAW == 1) {
echo ('<img id="deleteApp'.$appCounter.'Button" name="deleteApp'.$appCounter.'Button" style="cursor:pointer; padding-left:6px; padding-bottom:2px; float:right; display:block;" onclick="toggle_visibility(\'deleteApp'.$appCounter.'Button\'); toggle_visibility(\'app'.$appName.'Icon\'); toggle_visibility(\'XdeleteApp'.$appCounter.'Button\'); toggle_visibility(\'uninstallApp'.$appCounter.'Div\');" src="Resources/deletesmall.png" alt="Delete \''.$appName.'\'" title="Delete \''.$appName.'\'">');
echo ('<img id="XdeleteApp'.$appCounter.'Button" name="XdeleteApp'.$appCounter.'Button" style="cursor:pointer; padding-left:6px; padding-bottom:2px; float:right; display:none;" onclick="toggle_visibility(\'deleteApp'.$appCounter.'Button\'); toggle_visibility(\'app'.$appName.'Icon\'); toggle_visibility(\'XdeleteApp'.$appCounter.'Button\'); toggle_visibility(\'uninstallApp'.$appCounter.'Div\'); " src="Resources/x.png" alt="Close \'Delete '.$appName.'\'" title="Close \'Delete '.$appName.' \'">'); }
// / The followind code displays the App image and Launch button to all users.
echo ('<img id="infoApp'.$appCounter.'Button" name="infoApp'.$appCounter.'Button" style="cursor:pointer; padding-left:6px; padding-bottom:2px; float:right; display:block;" src="Resources/info.png" alt="Show \''.$appName.'\' Info" title="Show \''.$appName.'\' Info" onclick="toggle_visibility(\'infoApp'.$appCounter.'Button\'); toggle_visibility(\'app'.$appName.'Icon\'); toggle_visibility(\'XinfoApp'.$appCounter.'Button\'); toggle_visibility(\'infoApp'.$appCounter.'Div\');">');
echo ('<img id="XinfoApp'.$appCounter.'Button" name="XinfoApp'.$appCounter.'Button" style="cursor:pointer; padding-left:6px; padding-bottom:2px; float:right; display:none;" onclick="toggle_visibility(\'infoApp'.$appCounter.'Button\'); toggle_visibility(\'app'.$appName.'Icon\'); toggle_visibility(\'XinfoApp'.$appCounter.'Button\'); toggle_visibility(\'infoApp'.$appCounter.'Div\'); " src="Resources/x.png" alt="Close \''.$appName.'\' Info" title="Close \''.$appName.'\' Info">');
echo ('<img src="Resources/newwindow.png" style="cursor:pointer; padding-left:6px; padding-bottom:2px; float:right;" alt="Launch \''.$appName.'\' in a new window" title="Launch \''.$appName.'\' in a new window" onclick="window.open(\''.$appLoc.'\',\''.$appName.'\',\'resizable,height=400,width=650\'); return false;">');
echo ('</p></div>');
echo nl2br ('<hr />');
// / The following code displays administrator specific buttons.
if ($UserIDRAW == 1) {
echo nl2br('<div align="center" id="uninstallApp'.$appCounter.'Div" name="uninstallApp'.$appCounter.'Div" style="display:none;">');
echo nl2br('<form action="appIndex.php" method="post" enctype="multipart/form-data"><input type="submit" id="uninstallApp'.$appCounter.'" name="uninstallApp'.$appCounter.'" value="Confirm Delete" alt="Confirm Delete '.$appName.'" title="Confirm Delete '.$appName.'" onclick="toggle_visibility(\'loading\');">');
echo ('<input type="hidden" id="uninstallApplication" name="uninstallApplication" value="'.$appName.'">');
echo ('<input type="hidden" id="YUMMYSaltHash" name="YUMMYSaltHash" value="'.$SaltHash.'"></form><br></div>'); }
// / The followind code displays the App image and Launch button to all users.
echo nl2br('<div align="center" id="infoApp'.$appCounter.'Div" name="infoApp'.$appCounter.'Div" style="cursor:pointer; display:none;" onclick="toggle_visibility(\'appSelector'.$appCounter.'\');">' );
echo ('<div align="center"><a style="cursor:pointer;" onclick="toggle_visibility(\'appBasic'.$appCounter.'\');"><strong>Info</strong></a> | <a style="cursor:pointer;" onclick="toggle_visibility(\'appDescription'.$appCounter.'\'); "><strong>Description</strong></a></div>');
// / The following code displays the Basic App information, when clicked.
echo ('<div align="left" id="appBasic'.$appCounter.'" name="appBasic'.$appCounter.'" style="display:none;"><hr />');
echo ('<div align="center"><strong>App Info</strong></div>');
echo ('<p>App Name: <i>'.$ApplicationName.'</i></p>');
echo ('<p>App Version: <i>'.$ApplicationVersion.'</i></p>');
echo ('<p>App Author: <i>'.$ApplicationAuthor.'</i></p>');
echo ('<p>App Website: <i>'.$ApplicationWebsite.'</i></p>');
echo ('<p>App License: <i>'.$ApplicationLicense.'</i></p>');
echo ('</div>');
// / The following code displays the App description, when clicked.
echo ('<div align="left" id="appDescription'.$appCounter.'" name="appDescription'.$appCounter.'" style="display:none;"><hr />');
echo ('<div align="center"><strong>App Description</strong></div>');
echo ('<p><i>'.$ApplicationDescription.'</i></p>');
echo ('</div></div>');
// / The followind code displays the App icon, if one exits in the App Directory.
if (file_exists($appIcon)) {
echo nl2br('<p><img src="'.$appIcon.'" maxwidth="75px" max-height="75px" id="app'.$appName.'Icon" name="app'.$appName.'Icon" style="cursor:pointer; display:block;" title="'.$appName.'" alt="'.$appName.'" onclick="location.href=\''.'Applications/'.$appName.'/'.$appName.'.php\';"></p> '); }
// / The following code signifies the end of each App Div in the appIndex. DO NOT ADD APP-SPECIFIC CODE BELOW THIS LINE!!!
echo nl2br('</div>');
$appCounter++; } ?>
</div>
</div>
</body>
</html>