public static function loadConfig() { $tz = DB::getOption("lobby_timezone"); if ($tz !== null) { self::$tz = $tz; } }
function getOption($key) { if (\Lobby::$installed === false) { return false; } else { return \Lobby\DB::getOption($key); } }
/** * Install module * -------------- * Create the `users` table */ public function install() { if (DB::getOption("admin_installed") == null && \Lobby::$installed) { /** * Install Module */ $salt = \Helper::randStr(15); $cookie = \Helper::randStr(15); DB::saveOption("admin_secure_salt", $salt); DB::saveOption("admin_secure_cookie", $cookie); $prefix = DB::getPrefix(); /** * Create `users` TABLE */ $sql = DB::getDBH()->prepare("CREATE TABLE IF NOT EXISTS `{$prefix}users` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `username` varchar(10) NOT NULL,\n `password` varchar(255) NOT NULL,\n `name` varchar(30) NOT NULL,\n `created` datetime NOT NULL,\n `attempt` varchar(15) NOT NULL DEFAULT '0',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;"); if ($sql->execute() != 0) { DB::saveOption("admin_installed", "true"); } } }
/** * Initialization * @param array $themeVARS Contains directory and URL to `themes` folder */ public static function __constructStatic($themesVARS) { self::$themesDir = $themesVARS[0]; self::$themesURL = Lobby::u($themesVARS[1]); self::$themeID = DB::getOption("active_theme"); /** * Default theme is `hine` */ if (self::$themeID === null) { self::$themeID = "hine"; } else { if (self::validTheme(self::$themeID) === false) { self::$themeID = "hine"; } } self::$url = self::$themesURL . "/" . self::$themeID; self::$dir = self::$themesDir . "/" . self::$themeID; if (!\Lobby::status("lobby.assets-serve")) { self::loadDefaults(); self::loadTheme(); } }
public static function finish_software_update($admin_previously_installed = false) { FS::write("/upgrade.lobby", "1", "w"); if ($admin_previously_installed) { FS::remove("/contents/modules/admin/disabled.txt"); } $latest_version = DB::getOption("lobby_latest_version"); self::log("Updated Lobby to version {$latest_version}"); /** * Remove Depreciated Files */ $deprecatedFilesInfoLoc = "/contents/update/removeFiles.php"; if (FS::exists($deprecatedFilesInfoLoc)) { $files = FS::get($deprecatedFilesInfoLoc); $files = explode("\n", $files); if (count($files) !== 0) { $files = array_filter($files); foreach ($files as $file) { $fileLoc = L_DIR . "/{$file}"; if (file_exists($fileLoc) && $fileLoc != L_DIR) { FS::remove($fileLoc); self::log("Removed Deprecated File: {$fileLoc}"); } } copy(FS::loc($deprecatedFilesInfoLoc), FS::loc("{$deprecatedFilesInfoLoc}.txt")); FS::remove($deprecatedFilesInfoLoc); self::log("Finished Removing Deprecated Files"); } } /** * Database Update */ if (FS::exists("/update/sqlExecute.sql")) { self::log("Upgrading Lobby Database"); $sqlCode = FS::get("/update/sqlExecute.sql"); $sql = \Lobby\DB::prepare($sqlCode); if (!$sql->execute()) { echo ser("Error", "Database Update Couldn't be made. <a href='update.php'>Try again</a>"); } else { FS::remove("/update/sqlExecute.sql"); } self::log("Updated Lobby Database"); } FS::remove("/upgrade.lobby"); self::log("Lobby is successfully Updated."); }
/** * Returns enabled apps as an array */ public static function getEnabledApps() { if (isset(self::$cache["enabled_apps"])) { $enabled_apps = self::$cache["enabled_apps"]; } else { $enabled_apps = DB::getOption("enabled_apps"); $enabled_apps = json_decode($enabled_apps, true); if (!is_array($enabled_apps) || count($enabled_apps) == 0) { $enabled_apps = array(); } self::$cache["enabled_apps"] = $enabled_apps; } return $enabled_apps; }
</td> </tr> <tr> <td>Latest Version Release Date</td> <td><?php echo Lobby\DB::getOption("lobby_latest_version_release"); ?> </td> </tr> </tbody> </table> <cl/> <?php /** * Check if the current version is not the latest version */ if (\Lobby::$version < \Lobby\DB::getOption("lobby_latest_version")) { ?> <div clear></div> <a class="btn red" href="update.php">Update To Version <?php echo Lobby\DB::getOption("lobby_latest_version"); ?> </a> <?php } ?> </div> </div> </body> </html>