Skip to content

Commit

Permalink
Lobby 0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
subins2000 committed Mar 5, 2016
1 parent c3ffce5 commit e7b3fb8
Show file tree
Hide file tree
Showing 106 changed files with 12,365 additions and 265 deletions.
Empty file modified .htaccess
100755 → 100644
Empty file.
Empty file modified LICENSE
100755 → 100644
Empty file.
Empty file modified README.md
100755 → 100644
Empty file.
41 changes: 26 additions & 15 deletions admin/apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
<h2>Confirm</h2>
<p>Are you sure you want to remove the app <b><?php echo $app;?></b> ?</p>
<div clear></div>
<a class="button green" href="<?php echo L_URL ."/admin/install-app.php?action=remove&id={$app}&".H::csrf("g");?>">Yes, I'm Sure</a>
<a class="button red" href="<?php echo L_URL ."/admin/apps.php";?>">No, I'm Not</a>
<a class="btn green" href="<?php echo L_URL ."/admin/install-app.php?action=remove&id={$app}&".H::csrf("g");?>">Yes, I'm Sure</a>
<a class="btn red" href="<?php echo L_URL ."/admin/apps.php";?>">No, I'm Not</a>
<?php
exit;
}else if($action == "enable"){
Expand All @@ -71,13 +71,13 @@
<table style="width: 100%;margin-top:5px" id="apps_table">
<thead>
<tr>
<td>
<td width="5%">
<label><input type="checkbox" id="select_all_apps" /><span></span></label>
</td>
<td>Name</td>
<td>Version</td>
<td>Description</td>
<td>Actions</td>
<td width="15%">Name</td>
<td width="10%">Version</td>
<td width="40%">Description</td>
<td width="30%">Actions</td>
</tr>
</thead>
<tbody>
Expand All @@ -86,7 +86,7 @@
$App = new \Lobby\Apps($app);
$data = $App->info;
$appImage = !isset($data['image']) ? L_URL . "/includes/lib/lobby/image/blank.png" : $data['image'];
$enabled = $App->isEnabled();
$enabled = $App->enabled;
?>
<tr <?php if(!$enabled){echo 'style="background: #EEE;"';}?>>
<td>
Expand All @@ -103,23 +103,34 @@
<td style="text-align:center;">
<?php
if($enabled){
echo '<a class="button" href="?action=disable&app='. $app . H::csrf('g') .'">Disable</a>';
echo '<a class="btn" href="?action=disable&app='. $app . H::csrf('g') .'">Disable</a>';
}else{
echo '<a class="button" href="?action=enable&app='. $app . H::csrf('g') .'">Enable</a>';
echo '<a class="btn" href="?action=enable&app='. $app . H::csrf('g') .'">Enable</a>';
}
?>
<a class="button red" href="?action=remove&app=<?php echo $app . H::csrf('g');?>">Remove</a>
<a class="btn red" href="?action=remove&app=<?php echo $app . H::csrf('g');?>">Remove</a>
</td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<td width="5%">
<label><input type="checkbox" id="select_all_apps" /><span></span></label>
</td>
<td width="15%">Name</td>
<td width="10%">Version</td>
<td width="40%">Description</td>
<td width="30%">Actions</td>
</tr>
</tfoot>
</table>
<div id="combined_actions">
<span style="padding-left: 20px;">^</span>
<button class="button green" name="action" value="enable">Enable</button>
<button class="button blue" name="action" value="disable">Disable</button>
<div id="combined_actions" clear>
<span style="padding-left: 15px;">^</span>
<button class="btn green" name="action" value="enable">Enable</button>
<button class="btn blue" name="action" value="disable">Disable</button>
</div>
<?php echo H::csrf('i');?>
</form>
Expand Down
2 changes: 1 addition & 1 deletion admin/backup-db.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require "../load.php";
if(\Lobby::$installed){
$backupFile = \Lobby::$config['db']['dbname'] . "-" .date("Y-m-d-H-i-s") . '.gz';
$backupFile = \Lobby::$config['db']['dbname']. "-" .date("Y-m-d H:i:s") . '.gz';
$backupFileLoc = L_DIR . "/contents/extra/" . $backupFile;
$command = "mysqldump --opt --host=". \Lobby::$config['db']['host'] ." --port=" . \Lobby::$config['db']['port'] . " --user=". \Lobby::$config['db']['username'] ." --password=". \Lobby::$config['db']['password'] ." ". \Lobby::$config['db']['dbname'] ." | gzip -9 -c > {$backupFileLoc}";
system($command);
Expand Down
65 changes: 65 additions & 0 deletions admin/backup-dir.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
require "../load.php";

/**
* Backup Lobby DIR as .zip folder
* http://stackoverflow.com/a/19451938/1372424
*/
$the_folder = L_DIR;
$zip_file_name = L_DIR . "/contents/extra/lobby-" .date("Y-m-d@H-i-s") . '.zip';

$download_file = true;

class FlxZipArchive extends ZipArchive {
/** Add a Dir with Files and Subdirs to the archive;;;;; @param string $location Real Location;;;; @param string $name Name in Archive;;; @author Nicolas Heimann;;;; @access private **/

public function addDir($location, $name) {
$this->addEmptyDir($name);

$this->addDirDo($location, $name);
} // EO addDir;

/** Add Files & Dirs to archive;;;; @param string $location Real Location; @param string $name Name in Archive;;;;;; @author Nicolas Heimann
* @access private **/
private function addDirDo($location, $name) {
$name .= '/';
$location .= '/';

// Read all Files in Dir
$dir = opendir ($location);
while ($file = readdir($dir))
{
if ($file == '.' || $file == '..') continue;
// Rekursiv, If dir: FlxZipArchive::addDir(), else ::File();
$do = (filetype( $location . $file) == 'dir') ? 'addDir' : 'addFile';
$this->$do($location . $file, $name . $file);
}
} // EO addDirDo();
}

$za = new FlxZipArchive;
$res = $za->open($zip_file_name, ZipArchive::CREATE);
if($res === TRUE)
{
$za->addDir($the_folder, basename($the_folder));
$za->close();
}
else { echo 'Could not create a zip archive';}

if ($download_file){
ob_get_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=" . basename($zip_file_name) . ";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($zip_file_name));
readfile($zip_file_name);
}

/**
* Delete .zip File
*/
\Lobby\FS::remove($zip_file_name);
2 changes: 1 addition & 1 deletion admin/css/lobby-store.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions admin/download.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
header("Content-type: text/html");
header('Cache-Control: no-cache');

$id = H::input("id");
$type = H::input("type");
$id = H::i("id");
$type = H::i("type");

// Turn off output buffering
ini_set('output_buffering', 'off');
Expand Down
Binary file added admin/image/clear.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions admin/inc/sidebar.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div class="sidebar">
<div style="height:32px;text-align:center;margin-top:10px;">
<a target="_blank" href="http://lobby.subinsb.com" style="color:white;">Lobby <?php echo getOption("lobby_version");?></a>
</div>
<div class="side-nav fixed" id="slide-out">
<a target="_blank" href="http://lobby.subinsb.com" class="lobby-link">Lobby <?php echo getOption("lobby_version");?></a>
<?php
$links = array(
"/admin" => "Dashboard",
Expand Down
12 changes: 6 additions & 6 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
<h1>Admin</h1>
<p>Here, you can manage your Lobby installation :</p>
<?php
echo \Lobby::l("admin/settings.php", "Settings", "class='button red'") . "&nbsp;";
echo \Lobby::l("admin/apps.php", "Installed Apps", "class='button green'") . "&nbsp;";
echo \Lobby::l("admin/lobby-store.php", "Lobby Store", "class='button blue'") . "&nbsp;";
echo \Lobby::l("admin/settings.php", "Settings", "class='btn red'") . "&nbsp;";
echo \Lobby::l("admin/apps.php", "Installed Apps", "class='btn green'") . "&nbsp;";
echo \Lobby::l("admin/lobby-store.php", "Lobby Store", "class='btn blue'") . "&nbsp;";
if(\Lobby\Modules::exists("admin")){
echo \Lobby::l("admin/login?logout=true", "Log Out", "class='button'");
echo \Lobby::l("admin/login?logout=true", "Log Out", "class='btn'");
}
?>
<h2>Thank You</h2>
<p>We, the <a href="https://github.com/orgs/LobbyOS/people" target="_blank">Lobby Team</a> would like to thank you for installing Lobby.</p>
<p>Lobby is in <b>public beta mode</b>, so bugs may exist and some things may not work for you.</p>
<p>As you know, Lobby is an <a href="https://en.wikipedia.org/wiki/Open-source_software">Open Source Software</a>. We will be very glad and happy if you report any kinds of problems/bugs you faced :</p>
<p>Encoutered a problem or want to make a suggestion ? Do it on our <a target="_blank" class="button orange" href="https://github.com/subins2000/lobby/issues">GitHub Repo</a></p>
<p>As you know, Lobby is an <a href="https://en.wikipedia.org/wiki/Open-source_software" target="_blank">Open Source Software</a>. We will be very glad and happy if you report any kinds of problems/bugs you faced :</p>
<p>Encoutered a problem or want to make a suggestion ? Please do it on our <a target="_blank" class="btn orange" href="https://github.com/subins2000/lobby/issues">GitHub Repo</a></p>
</div>
</div>
</body>
Expand Down
12 changes: 6 additions & 6 deletions admin/install-app.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@
<div class="workspace">
<div class="content">
<?php
if(H::input("id") == null){
if(H::i("id") == null){
ser("Error", "No App is mentioned. Install Apps from <a href='lobby-store.php'>Lobby Store</a>");
}
if(H::input("action") == "enable" && H::csrf()){
if(H::i("action") == "enable" && H::csrf()){
$App = new \Lobby\Apps($_GET['id']);
if(!$App->exists){
ser("Error", "App is not installed");
}
$App->enableApp();
sss("Enabled", "The App <b>{$_GET['id']}</b> is enabled. The author says thanks. <cl/><a href='".$App->info['URL']."' class='button green'>Open App</a>");
sss("Enabled", "The App <b>{$_GET['id']}</b> is enabled. The author says thanks. <cl/><a href='".$App->info['URL']."' class='btn green'>Open App</a>");
}
if(H::input("action") == "remove" && H::csrf()){
if(H::i("action") == "remove" && H::csrf()){
$App = new \Lobby\Apps($_GET['id']);
if(!$App->exists){
ser("Error", "App is not installed");
}
$App->removeApp();
sss("Removed", "The App <b>{$_GET['id']}</b> was successfully removed.");
}
$id = H::input("id");
if($id != null && H::input("action") == null && H::csrf()){
$id = H::i("id");
if($id != null && H::i("action") == null && H::csrf()){
?>
<h1>Install App</h1>
<iframe src="<?php echo L_URL . "/admin/download.php?type=app&id={$id}". H::csrf("g");?>" style="border: 0;width: 100%;height: 200px;"></iframe>
Expand Down
Loading

0 comments on commit e7b3fb8

Please sign in to comment.