Exemplo n.º 1
0
 public function page($slug = "", $values = array(), $layout = "")
 {
     $location = "{$this->path}/{$slug}.html";
     if ($layout == "") {
         $layout = \Lobby\FS::get("/src/Data/themes/{$this->theme}/layout.html");
     }
     if ($this->titleTag && $values["{{page-title}}"] != $this->name) {
         $layout = str_replace("<title>{{page-title}}</title>", "<title>{{page-title}} - {{site-name}}</title>", $layout);
     }
     if (isset($values['{{page-title}}']) && isset($values['{{page-content}}'])) {
         $toReplace = array("{{page-title}}" => "", "{{page-content}}" => "", "{{site-head}}" => "", "{{site-name}}" => $this->name, "{{site-tagline}}" => $this->tagline, "{{site-sidebar}}" => "");
         $result = array_merge($toReplace, $values);
         foreach ($result as $from => $to) {
             $layout = str_replace($from, $to, $layout);
         }
         /* Make directory if it doesn't exist */
         $dir = dirname($location);
         if (!file_exists($dir)) {
             mkdir($dir);
         }
         /* Make the Page file */
         file_put_contents($location, $layout);
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 2
0
 public static function getFile($location, $vars = array())
 {
     extract($vars);
     ob_start();
     require FS::loc($location);
     return ob_get_clean();
 }
Exemplo n.º 3
0
 public function __construct($id, $git_url, $cloud_id = null)
 {
     $this->id = $id;
     $this->git_url = $git_url;
     $this->git_dir = \Lobby\FS::loc("/contents/apps/lobby-server/src/data/git-cache/{$id}");
     $this->cloud_id = $cloud_id;
 }
Exemplo n.º 4
0
 public static function __constructStatic()
 {
     /**
      * Get DB config
      */
     $config = \Lobby::config(true);
     if (is_array($config)) {
         /**
          * Make DB credentials variables from the config.php file
          */
         self::$prefix = $config['prefix'];
         self::$type = $config['type'];
         $options = array(\PDO::ATTR_PERSISTENT => true, \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION);
         try {
             if ($config['type'] === 'mysql') {
                 self::$dbh = new \PDO("mysql:dbname={$config['dbname']};host={$config['host']};port={$config['port']};charset=utf8;", $config['username'], $config['password'], $options);
                 /**
                  * Check if Lobby tables exist
                  */
                 $notable = false;
                 $tables = array("options", "data");
                 // The Tables of Lobby
                 foreach ($tables as $tableName) {
                     $results = self::$dbh->prepare("SHOW TABLES LIKE ?");
                     $results->execute(array(self::$prefix . $tableName));
                     if ($results->rowCount() == 0) {
                         $notable = true;
                     }
                 }
             } else {
                 if ($config['type'] === 'sqlite') {
                     self::$dbh = new \PDO("sqlite:" . \Lobby\FS::loc($config['path']), "", "", $options);
                     /**
                      * Enable Multithreading Read/Write
                      */
                     self::$dbh->exec("PRAGMA journal_mode=WAL;");
                     /**
                      * Check if Lobby tables exist
                      */
                     $sql = self::$dbh->query("SELECT COUNT(1) FROM `sqlite_master` WHERE `type` = 'table' AND (`name` = 'l_data' OR `name` = 'l_options')");
                     $notable = $sql->fetchColumn() === "2" ? false : true;
                 }
             }
             if ($notable === false) {
                 /* There are database tables */
                 parent::$installed = true;
             } else {
                 parent::log(array("fatal", "Tables required by Lobby was not found in the database. Check your <b>config.php</b> and database to fix the error. Or Install again by removing <b>config.php</b>."));
             }
         } catch (\PDOException $e) {
             parent::$installed = false;
             $error = $e->getMessage();
             parent::log(array("fatal", "Unable to connect to database server. Is the database credentials given in <b>config.php</b> correct ? <blockquote>{$error}</blockquote>"));
         }
     } else {
         self::$installed = false;
     }
 }
Exemplo n.º 5
0
 /**
  * Map static functions into object methods
  */
 public function __call($function, $args)
 {
     switch ($function) {
         case "exists":
         case "loc":
             return FS::$function($this->base . "/" . $args[0]);
         case "get":
             return FS::get($this->base . "/" . $args[0]);
         case "write":
         case "remove":
             return call_user_func_array(FS::$function, array($this->base . "/" . $args[0], $args[1], $args[2]));
     }
 }
Exemplo n.º 6
0
 public static function makeDatabase($prefix)
 {
     try {
         /* Create Tables */
         $sql = self::$dbh->prepare("\n        CREATE TABLE IF NOT EXISTS `{$prefix}options` (\n          `id` int(11) NOT NULL AUTO_INCREMENT,\n          `name` varchar(64) NOT NULL,\n          `val` text NOT NULL,\n          PRIMARY KEY (`id`),\n          UNIQUE(`name`)\n        ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n        CREATE TABLE IF NOT EXISTS `{$prefix}data` (\n          `id` int(11) NOT NULL AUTO_INCREMENT,\n          `app` varchar(50) NOT NULL,\n          `name` varchar(150) NOT NULL,\n          `content` longtext NOT NULL,\n          `created` datetime NOT NULL,\n          `updated` datetime NOT NULL,\n           PRIMARY KEY (`id`)\n        ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;");
         $sql->execute();
         /* Insert The Default Data In To Tables */
         $lobby_info = \Lobby\FS::get("/lobby.json");
         $lobby_info = json_decode($lobby_info, true);
         $sql = self::$dbh->prepare("\n        INSERT INTO `{$prefix}options` (\n          `id`, \n          `name`, \n          `val`\n        ) VALUES (\n          NULL,\n          'lobby_version',\n          ?\n        ),(\n          NULL,\n          'lobby_version_release',\n          ?\n        );");
         $sql->execute(array($lobby_info['version'], $lobby_info['released']));
         return true;
     } catch (\PDOException $Exception) {
         return false;
     }
 }
Exemplo n.º 7
0
                                echo CSRF::getInput();
                                ?>
                </form>
            <?php 
                            } else {
                                if ($db_type === "sqlite") {
                                    ?>
                <h3>Database</h3>
                <form action="<?php 
                                    \Lobby::u();
                                    ?>
" method="POST">
                  <p>The location of the SQLite database file :</p>
                  <label>
                    <input type="text" name="db_location" id="db_location" value="<?php 
                                    echo \Lobby\FS::loc("/contents/extra/lobby_db.sqlite");
                                    ?>
" />
                  </label>
                  
                  <button name="submit" style="width:200px;font-size:15px;" class="btn green">Install Lobby</button>
                  <input type="hidden" name="db_type" value="sqlite" />
                  <?php 
                                    echo CSRF::getInput();
                                    ?>
                </form>
              <?php 
                                } else {
                                    echo ser("Error", "Uh... You didn't mention the DBMS to use");
                                }
                            }
Exemplo n.º 8
0
 /**
  * Create Tables in the DB
  * Supports both MySQL & SQLite
  */
 public static function makeDatabase($prefix, $db_type = "mysql")
 {
     try {
         if ($db_type === "mysql") {
             $sql_code = "\n        CREATE TABLE IF NOT EXISTS `{$prefix}options` (\n          `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n          `name` varchar(64) NOT NULL,\n          `value` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL\n        ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n        CREATE TABLE IF NOT EXISTS `{$prefix}data` (\n          `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n          `app` varchar(50) NOT NULL,\n          `name` varchar(150) NOT NULL,\n          `value` longblob NOT NULL,\n          `created` datetime NOT NULL,\n          `updated` datetime NOT NULL\n        ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;";
             /**
              * Create Tables
              */
             $sql = self::$dbh->prepare($sql_code);
             $sql->execute();
         } else {
             /**
              * SQLite
              * Multiple commands separated by ';' cannot be don in SQLite
              * Weird, :P
              */
             $sql_code = "\n        CREATE TABLE IF NOT EXISTS `{$prefix}options` (\n          `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n          `name` varchar(64) NOT NULL,\n          `value` text NOT NULL\n        );\n        ";
             self::$dbh->exec($sql_code);
             $sql_code = "\n        CREATE TABLE IF NOT EXISTS `{$prefix}data` (\n          `id` INTEGER PRIMARY KEY AUTOINCREMENT,\n          `app` varchar(50) NOT NULL,\n          `name` varchar(150) NOT NULL,\n          `value` blob NOT NULL,\n          `created` datetime NOT NULL,\n          `updated` datetime NOT NULL\n        );";
             self::$dbh->exec($sql_code);
         }
         /* Insert The Default Data In To Tables */
         $lobby_info = FS::get("/lobby.json");
         $lobby_info = json_decode($lobby_info, true);
         $sql = self::$dbh->prepare("\n        INSERT INTO `{$prefix}options`\n          (`name`, `value`)\n        VALUES\n          ('lobby_version', ?),\n          ('lobby_version_release', ?);");
         $sql->execute(array($lobby_info['version'], $lobby_info['released']));
         return true;
     } catch (\PDOException $Exception) {
         self::$error = $Exception->getMessage();
         self::log("Install error : " . self::$error);
         return false;
     }
 }
Exemplo n.º 9
0
<?php

require "../../../../load.php";
$file = \Request::postParam('cx74e9c6a45', '');
$appID = \Request::postParam('s7c8csw91', '');
if ($file != "" && CSRF::check()) {
    if ($appID !== "") {
        $App = new \Lobby\Apps($appID);
        if ($App->exists && $App->enabled) {
            $AppClass = $App->run();
            $html = $AppClass->page("/ajax/{$file}");
            if ($html === "auto") {
                $html = $AppClass->inc("/src/ajax/{$file}");
            }
            echo $html;
        }
    } else {
        if (\Lobby\FS::exists($file)) {
            require_once \Lobby\FS::loc($file);
        } else {
            echo "fileNotFound";
        }
    }
}
Exemplo n.º 10
0
 /**
  * This is useful when Lobby is run using PHP Built In Server
  * When no routes are matched, by default a 404 is inited,
  * even when the file exists in Lobby as .php file. To prevent
  * this, we check if the file exist and return false to the PHP
  * Built in Server to make it serve the file normally
  * http://php.net/manual/en/features.commandline.webserver.php#example-430
  */
 public static function pathExists()
 {
     if (\Lobby\FS::rel($_SERVER['PHP_SELF']) !== "index.php") {
         return file_exists(L_DIR . $_SERVER['PHP_SELF']);
     }
     return false;
 }
Exemplo n.º 11
0
 /**
  * Fetch the questions array
  */
 public function questions($class)
 {
     return json_decode(\Lobby\FS::get("/src/Data/questions.{$class}.json"), true);
 }
Exemplo n.º 12
0
 public function addStyle($fileName)
 {
     $filePath = FS::rel("{$this->dir}/css/{$fileName}");
     \Assets::css("{$this->id}-{$fileName}", $filePath);
 }
Exemplo n.º 13
0
 /**
  * Add message to log files 
  */
 public static function log($msg = "", $file = "lobby.log")
 {
     $msg = !is_string($msg) ? serialize($msg) : $msg;
     if ($msg != "" && self::$debug === true) {
         $logFile = "/contents/extra/{$file}";
         $message = "[" . date("Y-m-d H:i:s") . "] {$msg}";
         \Lobby\FS::write($logFile, $message, "a");
     }
 }
Exemplo n.º 14
0
             $readable_size = FS::normalizeSize($download_size);
             sendStatusToLobby("download_status", "Downloaded {$percent}% of {$readable_size}");
         } else {
             /**
              * We couldn't find the percentage
              */
             $GLOBALS['non_percent'] = 1;
             $downloaded = FS::normalizeSize($downloaded);
             sendStatusToLobby("download_status", "Downloaded {$downloaded}");
         }
         /**
          * Show Install message when download is completed
          */
         if ($percent == 100 && !isset($GLOBALS['install-msg-printed'])) {
             $GLOBALS['install-msg-printed'] = 1;
             $downloaded = FS::normalizeSize($downloaded);
             sendStatusToLobby("download_status", "Downloaded 100% of {$downloaded}");
             sleep(2);
             sendStatusToLobby("install_status", "Installing <b>{$appID}</b>...");
             sleep(2);
         }
     }
 };
 try {
     /**
      * Update::app() will only return TRUE if download is completed
      */
     if (Update::app($appID)) {
         $App = new Apps($appID);
         $App->enableApp();
         sendStatusToLobby("install_finished", "Installed <b>{$appID}</b>.<cl/><a href='" . $App->info["url"] . "' class='btn green'>Open App</a>");
Exemplo n.º 15
0
 public static function disableModule($module)
 {
     if (self::exists($module)) {
         \Lobby\FS::write(self::$mods[$module]["location"] . "/disabled.txt", "1");
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 16
0
 /**
  * Add message to log files 
  */
 public static function log($msg = null, $file = "lobby.log")
 {
     /**
      * If $msg is an array, it means the errors are SERIOUS
      * Array(
      *   0 => "Type of Error",
      *   1 => "Message"
      * )
      */
     if (is_array($msg)) {
         $type = $msg[0];
         $logMSG = ucfirst($type) . " Error - " . $msg[1];
     } else {
         if (self::$debug === false) {
             return false;
         }
     }
     if ($msg != null) {
         $logMSG = !is_string($msg) ? serialize($msg) : $msg;
     }
     /**
      * Write to Log File
      */
     if ($msg != null) {
         $logFile = "/contents/extra/logs/{$file}";
         /**
          * Format the log message 
          */
         $logMSG = "[" . date("Y-m-d H:i:s") . "] {$logMSG}";
         \Lobby\FS::write($logFile, $logMSG, "a");
     }
     /**
      * If error is Fatal, Lobby can't work
      * So register error in class
      */
     if (isset($type) && $type === "fatal") {
         Response::showError(ucfirst($msg[0]) . " Error", $msg[1]);
     }
 }
Exemplo n.º 17
0
if (preg_match("/,/", $f)) {
    $files = explode(",", $f);
} else {
    /**
     * Only 1 File is present
     */
    $files = array($f);
}
/* Loop through files and */
foreach ($files as $file) {
    $file = str_replace(L_URL, "", $file);
    if ($file == "/includes/lib/jquery/jquery-ui.js" || $file == "/includes/lib/jquery/jquery.js" || $file == "/includes/lib/core/JS/main.js" || $file == "/includes/lib/core/JS/app.js") {
        $extraContent .= \Lobby\FS::get($file);
    } else {
        if (\Lobby\FS::exists($file)) {
            $content .= \Lobby\FS::get($file);
        } else {
            $type_of_file = isset($js) ? "JavaScript" : "CSS";
            \Lobby::log("{$type_of_file} file was not found in location given : {$file}");
        }
    }
    if (isset($css)) {
        $to_replace = array("<?L_URL?>" => L_URL, "<?THEME_URL?>" => THEME_URL);
        if (isset($_GET['APP_URL'])) {
            $to_replace["<?APP_URL?>"] = htmlspecialchars(urldecode($_GET['APP_URL']));
            $to_replace["<?APP_SRC?>"] = htmlspecialchars(urldecode($_GET['APP_SRC']));
        }
        foreach ($to_replace as $from => $to) {
            $content = str_replace($from, $to, $content);
        }
    }
Exemplo n.º 18
0
        $dbSize = $App->getDBSize();
        echo FS::normalizeSize($dbSize);
        ?>
                        <a class="btn red" href="<?php 
        echo \Lobby::u("/admin/apps.php?app={$appID}&action=clear-data" . CSRF::getParam());
        ?>
">Clear Data</a>
                        </h6>
                      </td>
                    </tr>
                  </tbody>
                  <tfoot>
                    <tr>
                      <td>Total size</td>
                      <td><h5><?php 
        echo FS::normalizeSize($folderSize + $dbSize);
        ?>
</h5></td>
                    </tr>
                  </tfoot>
                </table>
              </div>
            </div>
            <style>
            .tab-contents{
              padding: 10px 0;
            }
            </style>
        <?php 
    }
} else {
Exemplo n.º 19
0
<?php

if (isset($_POST['answers'])) {
    /**
     * The Default Values
     */
    $class = $_SESSION['kerala-it-exam-class'];
    $questions = $this->questions($class);
    $marks = json_decode(\Lobby\FS::get("/src/Data/mark.json"), true);
    $awarded = array();
    $total_mark = $marks['total'];
    /**
     * The User Data
     */
    $answers = $_POST['answers'];
    $mark = 0;
    /**
     * We don't do any checking, because I don't think the user will try to crack
     * the software. Why would he ? Also, because I'm lazy
     */
    $short = $answers['short'];
    $multiple = $answers['multiple'];
    $note = $answers['note'];
    /**
     * First, Short Answers
     */
    foreach ($short as $qID => $answer) {
        /**
         * The right answer is hashed with MD5
         */
        $right_answer = strtolower($questions['short'][$qID]['answer']);
Exemplo n.º 20
0
            // Rekursiv, If dir: FlxZipArchive::addDir(), else ::File();
            $do = filetype($location . $file) == 'dir' ? 'addDir' : 'addFile';
            $this->{$do}($location . $file, $name . $file);
        }
    }
}
$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);
Exemplo n.º 21
0
 /**
  * Disable app and remove the app files recursilvely from the directory
  */
 public function removeApp()
 {
     if ($this->app) {
         if (self::exists($this->app) !== false) {
             $dir = $this->appDir;
             if (file_exists("{$dir}/uninstall.php")) {
                 include_once "{$dir}/uninstall.php";
             }
             $this->disableApp();
             $files = array_diff(scandir($dir), array('.', '..'));
             foreach ($files as $file) {
                 if (is_dir("{$dir}/{$file}")) {
                     delTree("{$dir}/{$file}");
                 } else {
                     \Lobby\FS::remove("{$dir}/{$file}");
                 }
             }
             return rmdir($dir);
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Exemplo n.º 22
0
 /**
  * Disable app and remove the app files recursilvely from the directory
  */
 public function removeApp()
 {
     if ($this->app) {
         if (self::exists($this->app) !== false) {
             $dir = $this->dir;
             if (file_exists("{$dir}/uninstall.php")) {
                 include_once "{$dir}/uninstall.php";
             }
             $this->disableApp();
             return \Lobby\FS::remove($dir);
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Exemplo n.º 23
0
<?php

include \Lobby\FS::loc("/src/Inc/load.php");
if (isset($_POST['id']) && isset($_POST['roll']) && isset($_POST['password'])) {
    $roll = $_POST['roll'];
    $voterID = strtoupper($_POST['id']);
    $passwords = unserialize(getData("student_passwords"));
    if ($passwords[$roll] == $_POST['password']) {
        if ($ELEC->didVote($voterID) == false) {
            $_SESSION['election-validated'] = "true";
            echo "true";
        } else {
            echo "voted";
        }
    } else {
        echo "false";
    }
}
Exemplo n.º 24
0
 /**
  * Update the App with the given ID
  */
 public static function app($id)
 {
     if ($id == "") {
         echo ser("Error", "No App Mentioned to update.");
     }
     self::log("Installing Latest Version of App {$id}");
     $url = Server::download("app", $id);
     $zipFile = L_DIR . "/contents/update/{$id}.zip";
     self::zipFile($url, $zipFile);
     // Un Zip the file
     if (class_exists("ZipArchive")) {
         $zip = new \ZipArchive();
         if ($zip->open($zipFile) != "true") {
             self::log("Unable to open Downloaded App ({$id}) File : {$zipFile}");
             echo ser("Error", "Unable to open Downloaded App File.");
         } else {
             /**
              * Extract App
              */
             $appDir = APPS_DIR . "/{$id}";
             if (!file_exists($appDir)) {
                 mkdir($appDir);
             }
             $zip->extractTo($appDir);
             $zip->close();
             FS::remove($zipFile);
             self::log("Installed App {$id}");
             return true;
         }
     } else {
         throw new \Exception("Unable to Install App, because <a href='" . L_SERVER . "/docs/quick#section-requirements' target='_blank'>PHP Zip Extension</a> is not installed");
     }
 }
Exemplo n.º 25
0
 public function write($path, $content, $type = "w")
 {
     return \Lobby\FS::write($this->dir . $path, $content, $type);
 }
Exemplo n.º 26
0
<?php

include \Lobby\FS::loc("/src/Inc/load.php");
include \Lobby\FS::loc("/src/Inc/graph.php");
$data = array();
// Set config directives
$cfg['title'] = 'Election Results';
$cfg['width'] = 600;
$cfg['height'] = 300;
$cfg['value-font-size'] = 4;
$cfg['key-font-size'] = 6;
$candidateNames = unserialize(getData("female_candidates")) + unserialize(getData("male_candidates"));
$votes = $ELEC->count($candidateNames);
foreach ($votes as $name => $votes) {
    $data[$name] = $votes;
}
$graph = new phpMyGraph();
ob_start();
$graph->parseVerticalColumnGraph($data, $cfg);
$img = ob_get_clean();
echo base64_encode($img);
?>
 
Exemplo n.º 27
0
 public static function get($path)
 {
     return \Lobby\FS::get(APP_DIR . $path);
 }
Exemplo n.º 28
0
          </ul>
          <div style="margin: 20px;text-align: center;">
            <a data-path="/admin/lobby-store.php?app=<?php 
        echo $appInfo["id"];
        ?>
" class="open-via-lobby btn orange btn-large" title="Open in Lobby" style="display: inline-block;">
              <i class="material-icons">open_in_new</i>
            </a>
            <a style='display: inline-block;color: white;position:relative;line-height: 40px;' class='btn btn-large green' onclick="node = document.createElement('iframe');node.src = this.href;node.style.cssText = 'display:none;position: absolute;left:-1000px;';node.addEventListener('load', function(){$(this).remove();clog('c');}, true);document.body.appendChild(node);return false;" href="<?php 
        echo L_URL;
        ?>
/api/app/<?php 
        echo $appInfo['id'];
        ?>
/download">Download Zip<span style='position: absolute;font-weight: bold;bottom: 7px;left: 0;line-height: 14px;right: 0;font-size: 0.8rem;'><?php 
        echo \Lobby\FS::normalizeSize($appInfo["download_size"]);
        ?>
</span></a>
            <a style="display: inline-block;" class="btn">
              <strong><?php 
        echo $appInfo['downloads'];
        ?>
 Downloads</strong>
            </a>
            <a href="http://server.lobby.sim/docs/install-app" class="btn" target="_blank">Installation Help</a>
          </div>
          <?php 
        require_once $this->dir . "/src/inc/Fr.star.php";
        $this->addScript("Fr.star.js");
        $star = new \Fr\Star(array(), "app-{$appInfo['id']}");
        echo "<div class='ratings'>";
Exemplo n.º 29
0
<?php

/**
 * Add the <head> files if it's not the install page
 */
if (!\Lobby::status("lobby.install")) {
    /**
     * Left Menu
     */
    \Lobby\UI\Panel::addTopItem("lobbyHome", array("text" => "Home", "href" => L_URL, "position" => "left"));
    $adminArray = array("text" => "Admin", "href" => "/admin", "position" => "left");
    $adminArray["subItems"] = array("app_manager" => array("text" => "Apps", "href" => "/admin/apps.php"), "lobby_store" => array("text" => "Lobby Store", "href" => "/admin/lobby-store.php"), "about" => array("text" => "Settings", "href" => "/admin/settings.php"));
    \Lobby\UI\Panel::addTopItem("lobbyAdmin", $adminArray);
    if (\Lobby\FS::exists("/upgrade.lobby")) {
        require_once L_DIR . "/includes/src/Update.php";
        $l_info = json_decode(\Lobby\FS::get("/lobby.json"));
        if ($lobby_version != $l_info->version) {
            Lobby\DB::saveOption("lobby_latest_version", $l_info->version);
            Lobby\DB::saveOption("lobby_latest_version_release", $l_info->released);
        }
        \Lobby\Update::finish_software_update();
    }
}
if (\Lobby::status("lobby.admin")) {
    /**
     * Add Admin Pages' stylesheet, script
     */
    \Assets::js("admin", "/admin/js/admin.js");
    /**
     * Add sidebar
     */
Exemplo n.º 30
0
 /**
  * Update the App with the given ID
  */
 public static function app($id)
 {
     if ($id == "") {
         ser("Error", "No App Mentioned to update.");
     }
     \Lobby::log("Installing Latest Version of App {$id}");
     $url = \Lobby\Server::download("app", $id);
     $zipFile = L_DIR . "/contents/update/{$id}.zip";
     self::zipFile($url, $zipFile);
     // Un Zip the file
     $zip = new \ZipArchive();
     if ($zip->open($zipFile) != "true") {
         \Lobby::log("Unable to open Downloaded App ({$id}) File : {$zipFile}");
         ser("Error", "Unable to open Downloaded App File.");
     } else {
         /**
          * Extract App
          */
         $zip->extractTo(APPS_DIR);
         $zip->close();
         \Lobby\FS::remove($zipFile);
         \Lobby::log("Installed App {$id}");
         return true;
     }
 }