<h2>Create New KeyRing</h2> <?php if (isset($_POST['keyring_id']) && isset($_POST['keyring_name']) && isset($_POST['keyring_password']) && isset($_POST['keyring_retyped_password'])) { $id = strtolower($_POST['keyring_id']); $name = $_POST['keyring_name']; $pass = $_POST['keyring_password']; $desc = $_POST['keyring_description']; if (!ctype_alpha($id)) { ser("Invalid ID", "Keyring ID should onlt contain alphabets"); } elseif (strlen($pass) < 6) { ser("Invalid Password", "A password should have minimum characters of 6. Your's doesn't even have 6 characters."); } elseif ($pass != $_POST['keyring_retyped_password']) { ser("Passwords Mismatch", "The passwords you entered didn't match. Please try again."); } else { if ($this->MasterAdd($id, $name, $desc, $pass)) { sss("Created KeyRing", "Your keyring was successfulyl created."); } else { ser("KeyRing Exists", "The keyring with the ID you gave already exists"); } } } ?> <form method='POST' action='<?php echo APP_URL; ?> /new-master'> <label> <span>ID</span> <input type='text' name='keyring_id' placeholder='A unique KeyRing ID. Lowercase ALPHABETS Only' /> </label> <label>
} if (H::input("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.<a href='" . $App->info['URL'] . "' class='button green'>Open App</a>"); } if (H::input("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()) { ?> <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> <?php } ?> </div> <div> </body>
?> </p> <h3>Results</h3> <p> <button id='btn-download-sss'>Download Results</button> <?php $db = pg_connect("user={$db_user} dbname={$db_name} host={$db_host} port={$db_port}"); if (!$db) { die("Error in connection: " . pg_last_error()); } $pagenum = $_GET["pagenum"]; if (empty($pagenum)) { $_SESSION['tmp_table_sss'] = sss($searchOperator, $query, $molformat); deleteTmpTables(); $pagenum = 1; } $sqlCont = "SELECT count(*) FROM " . $_SESSION['tmp_table_sss']; $resultCont = pg_query($db, $sqlCont); $rowOne = pg_fetch_row($resultCont); $rows = $rowOne[0]; if (!$resultCont || $rows == 0) { echo '<b>No Results, please search again</b>'; } else { // Number of results $page_rows = 11; $last = ceil($rows / $page_rows); if ($pagenum < 1) { $pagenum = 1;
<head> <?php \Lobby::doHook("admin.head.begin"); \Lobby::head("Lobby Info"); ?> </head> <body> <?php \Lobby::doHook("admin.body.begin"); include "{$docRoot}/admin/sidebar.php"; ?> <div class="workspace"> <div class="content"> <?php if (isset($_GET['updated']) && H::csrf()) { sss("Updated", "Lobby was successfully updated to Version <b>" . getOption("lobby_version") . "</b> from the old " . htmlspecialchars($_GET['oldver']) . " version."); } ?> <h1>About</h1> <p>Here is the information about your Lobby install.</p> <table border="1" style="margin-top:5px"> <tbody> <tr> <td>Version</td> <td><?php echo getOption("lobby_version"); ?> </td> </tr> <tr> <td>Release Date</td>
</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> <?php exit; } else { if ($action == "enable") { if ($App->enableApp()) { sss("Enabled", "App has been enabled."); } else { ser("Error", "The App couldn't be enabled. Try again.", false); } } } } } $Apps = \Lobby\Apps::getApps(); if (count($Apps) == 0) { ser("No Enabled Apps", "Lobby didn't find any apps that has been enabled", false); } if (count($Apps) != 0) { ?> <table style="width: 100%;margin-top:5px"> <thead>
/** * First, check if prefix is valid * Check if connection to database can be established using the credentials given by the user */ if ($prefix == "" || preg_match("/[^0-9,a-z,A-Z,\$,_]+/i", $prefix) != 0 || strlen($prefix) > 50) { ser("Error", "A Prefix should only contain basic Latin letters, digits 0-9, dollar, underscore and shouldn't exceed 50 characters. <a href='install.php?step=2'>Try Again</a>"); } elseif (\Lobby\Install::checkDatabaseConnection() !== false) { /** * Make the Config File */ \Lobby\Install::makeConfigFile(); /** * Create Tables */ if (\Lobby\Install::makeDatabase($prefix)) { sss("Success", "Database Tables and configuration file was successfully created."); /** * Enable app lEdit */ \Lobby::$installed = true; \Lobby\DB::init(); $App = new \Lobby\Apps("ledit"); $App->enableApp(); echo '<cl/><a href="?step=3" class="button">Proceed</a>'; } else { ser("Unable To Create Database Tables", "Are there any tables with the same name ? Or Does the user have the permissions to create tables ?<cl/>The <b>config.php</b> file is created. To try again, remove the <b>config.php</b> file and click the button. <cl/>" . \Lobby::l("/admin/install.php?step=2", "Try Again", "class='button'")); } } } else { ?> <h2 style="margin-top: -20px;">Database Configuration</h2>
<h2>Change Password</h2> <?php if (isset($_POST['change_password'])) { $curPass = $_POST['current_password']; $newPass = $_POST['new_password']; $retypePass = $_POST['retype_password']; if ($curPass != null && $newPass != null && $retypePass != null) { if (!\Fr\LS::login("admin", $curPass, false, false)) { echo ser("Login Failed", "Couldn't login to your account to change password."); } else { if ($newPass !== $retypePass) { echo ser("Passwords Doesn't match"), "The passwords you entered didn't match. Try again.</p></p>"; } else { $changePass = \Fr\LS::changePassword($newPass); if ($changePass === true) { echo sss("Password Changed Successfully", "Your password was updated."); } } } } else { echo "<p><h2>Password Fields was blank</h2><p>Form fields were left blank</p></p>"; } } ?> <form action="<?php echo \Lobby::u(); ?> " method='POST'> <label> <p>Current Password</p> <input type='password' name='current_password' />
/** * We give the database config to the Install Class */ \Lobby\Install::dbConfig(array("path" => str_replace(L_DIR, "", $db_loc), "prefix" => "l_")); /** * Make the Config File */ \Lobby\Install::makeConfigFile("sqlite"); /** * Enable app lEdit */ \Lobby::$installed = true; \Lobby\DB::__constructStatic(); $App = new \Lobby\Apps("ledit"); $App->enableApp(); echo sss("Success", "Database and <b>config.php</b> file was successfully created."); echo '<cl/><a href="?step=4' . CSRF::getParam() . '" class="btn">Proceed</a>'; } else { echo ser("Couldn't Make SQLite Database", "I was unable to make the database. Error :<blockquote>" . \Lobby\Install::$error . "</blockquote> <cl/>" . \Lobby::l("/admin/install.php?step=3&db_type=sqlite" . CSRF::getParam(), "Try Again", "class='btn'")); } } } else { if ($db_type === "mysql") { ?> <h3>Database</h3> <p>Provide the database credentials. Double check before submitting</p> <form action="<?php \Lobby::u(); ?> " method="POST"> <table>
<p class="chip"><?php echo $App->info['short_description']; ?> </p> </div> <?php if ($action !== null && $show && CSRF::check()) { switch ($action) { case "disable": echo sss("Disabled", "The App <strong>{$appIDEscaped}</strong> has been disabled."); break; case "disable-fail": echo ser("Error", "The App <strong>{$appIDEscaped}</strong> couldn't be disabled. Try again."); break; case "enable": echo sss("Enabled", "The App <strong>{$appIDEscaped}</strong> has been enabled."); break; case "enable-fail": echo ser("Error", "The App couldn't be enabled. Try again.", false); break; } } else { if ($action !== null && CSRF::check()) { if ($action === "remove") { /** * Do not show app info during confirmation */ $showAppInfo = false; echo sme("Confirm", "<p>Are you sure you want to remove the app <b>{$appIDEscaped}</b> ? This cannot be undone.</p>" . Lobby::l("/admin/install-app.php?action=remove&app={$appID}" . CSRF::getParam(), "Yes, I'm sure", "class='btn red'") . Lobby::l("/admin/apps.php?app={$appID}" . CSRF::getParam(), "No, I'm not", "class='btn blue' id='cancel'")); } else { if ($action === "clear-data") {
echo ser("Error", "No App is mentioned. Install Apps from <a href='lobby-store.php'>Lobby Store</a>"); } else { if (!$App->exists) { echo ser("Error", "App is not installed"); } else { if ($action === "enable" && CSRF::check()) { $App->enableApp(); echo sss("Enabled", "The App <b>{$displayID}</b> is enabled. The author says thanks. <cl/><a href='" . $App->info['url'] . "' class='btn green'>Open App</a>"); } else { if ($action === "remove" && CSRF::check()) { $App->removeApp(); echo sss("Removed", "The App <b>{$displayID}</b> was successfully removed."); } else { if ($action === "clear-data" && CSRF::check()) { if ($App->clearData()) { echo sss("Cleared Data", "The data of <b>{$displayID}</b> was successfully cleared from the database."); } } else { if ($appID != null && $action == null && CSRF::check()) { ?> <h1>Install App</h1> <p>The install progress will be displayed below. If this doesn't work, try the <?php echo \Lobby::l("/admin/install-app.php?app={$appID}&do=alternate-install" . CSRF::getParam(), "alternate install"); ?> .</p> <?php if (isset($_GET["do"]) && $_GET["do"] === "alternate-install" && CSRF::check()) { ?> <iframe src="<?php echo L_URL . "/admin/download.php?type=app&app={$appID}" . CSRF::getParam(); ?>
<head> <?php \Hooks::doAction("admin.head.begin"); \Response::head("Admin"); ?> </head> <body> <?php \Hooks::doAction("admin.body.begin"); ?> <div id="workspace"> <div class="contents"> <h1>Admin</h1> <?php if (\Lobby\Update::isAvailable()) { echo sss("Updates Available", "Some updates are available for you to update. Yay!<cl/><a class='btn blue' href='" . \Lobby::u("/admin/update.php") . "'>See Updates</a>"); } ?> <p>Manage your Lobby installation.</p> <?php echo \Lobby::l("admin/settings.php", "Settings", "class='btn red'") . " "; echo \Lobby::l("admin/apps.php", "Apps", "class='btn green'") . " "; echo \Lobby::l("admin/lobby-store.php", "Lobby Store", "class='btn pink'") . " "; if (\Lobby\Modules::exists("admin")) { echo \Lobby::l("admin/login?logout=true", "Log Out", "class='btn'"); } ?> <h2>About</h2> <p>You are using <b>Lobby <?php echo \Lobby::getVersion(); ?>
<html> <head> <?php \Hooks::doAction("admin.head.begin"); \Response::head("Change Settings"); ?> </head> <body> <?php \Hooks::doAction("admin.body.begin"); ?> <div id="workspace"> <div class="contents"> <?php if (isset($_GET['updated']) && CSRF::check()) { echo sss("Updated", "Lobby was successfully updated to Version <b>" . \Lobby::$version . "</b> from the old " . htmlspecialchars($_GET['oldver']) . " version."); } if (isset($_POST['update_settings']) && \CSRF::check()) { /** * Sadly, PHP supports GMT+ and not UTC+ */ $time_zone = $_POST['timezone']; if ($time_zone === "") { Lobby\DB::saveOption("lobby_timezone", "UTC"); \Lobby\Time::loadConfig(); } else { if (@date_default_timezone_set($time_zone)) { Lobby\DB::saveOption("lobby_timezone", $time_zone); \Lobby\Time::loadConfig(); } else { echo ser("Invalid Timezone", "Your PHP server doesn't support the timezone " . htmlspecialchars($time_zone));
<?php require_once $this->dir . "/src/inc/partial/layout.php"; ?> <div class='contentLoader'> <h1>Settings</h1> <?php if (isset($_POST['db_host']) && isset($_POST['db_port']) && isset($_POST['db_name']) && isset($_POST['db_username']) && isset($_POST['db_password']) && isset($_POST['db_table'])) { $config = array("db_host" => $_POST['db_host'], "db_port" => $_POST['db_port'], "db_name" => $_POST['db_name'], "db_username" => $_POST['db_username'], "db_password" => $_POST['db_password'], "db_table" => $_POST['db_table']); $status = $this->connect($config); if ($status === true) { $this->removeData("credentials"); $this->saveJSONData("credentials", $config); echo sss("Connected", "I have successfully connected to database."); } else { if ($status == "no_table") { echo ser("No Table", "I couldn't find the table you mentioned in the database"); $this->dbinfo = $config; } else { echo ser("Cound't Connect To Database", "I couldn't connect to the database with the credentials you gave. Please check it again."); $this->dbinfo = $config; } } } $cfg = array_merge(array("db_host" => "", "db_port" => "", "db_name" => "", "db_username" => "", "db_password" => "", "db_table" => ""), is_array($this->dbinfo) ? $this->dbinfo : array()); ?> <form action="<?php echo \Lobby::u(); ?> " method="POST"> <label>
<div class="contents"> <h1>Indi</h1> <p>Make a standalone Lobby app.</p> <h2>Config</h2> <?php $appID = Request::postParam("appID"); if ($appID !== null && CSRF::check()) { if ($appID === "") { $this->removeData("appID"); } else { $this->saveData("appID", $appID); } echo sss("Saved", "Settings has been saved."); } $appID = $this->getData("appID"); ?> <form action="<?php echo Lobby::u("/admin/app/indi"); ?> " method="POST"> <label> <span>App ID</span> <select name="appID"> <option value="">Choose App:</option> <?php foreach (Lobby\Apps::getEnabledApps() as $app) { echo "<option value='{$app}' " . ($appID === $app ? "selected='selected'" : "") . ">{$app}</option>"; } ?> </select> </label>
echo '<td><input style="vertical-align:top;display:inline-block;" checked="checked" type="checkbox" name="' . $appID . '" /></td>'; echo '<td><span style="vertical-align:middle;display:inline-block;margin-left:5px;">' . $AppInfo['name'] . '</span></td>'; echo '<td>' . $AppInfo['version'] . '</td>'; echo '<td>' . $latest_version . '</td>'; echo '</tr>'; } ?> </tbody></table> <input type="hidden" name="action" value="updateApps" /> <button class="red" style='padding: 10px 15px;' clear>Update Selected Apps</button> </form> <?php } if (getOption("lobby_version") == getOption("lobby_latest_version") && !\H::input("action", "POST") == "updateApps") { echo "<h2>Lobby</h2>"; sss("Latest Version", "You are using the latest version of Lobby. There are no new releases yet."); } elseif (!isset($_GET['step']) && !\H::input("action", "POST") == "updateApps") { ?> <h2>Lobby</h2> <p> Welcome To The Lobby Update Page. A latest version is available for you to upgrade. </p> <blockquote> Latest Version is <?php echo getOption("lobby_latest_version"); ?> released on <?php echo date("jS F Y", strtotime(getOption("lobby_latest_version_release"))); ?> </blockquote> <p style="margin-bottom: 10px;">
$siteInfo = array("name" => Request::postParam("siteName"), "src" => Request::postParam("siteSRC"), "out" => Request::postParam("siteOut"), "minHTML" => (int) (Request::postParam("minHTML") !== null), "minPHP" => (int) (Request::postParam("minPHP") !== null), "noComments" => (int) (Request::postParam("noComments") !== null), "minCSS" => (int) (Request::postParam("minCSS") !== null), "minJS" => (int) (Request::postParam("minJS") !== null), "minInline" => (int) (Request::postParam("minInline") !== null), "skipMinFiles" => (int) (Request::postParam("skipMinFiles") !== null)); if ($siteInfo["name"] == null || $siteInfo["src"] == null || $siteInfo["out"] == null) { echo ser("Fields Missing", "Please fill up the entire form."); } else { /** * Add fields that are optional */ $siteInfo["beforeCMD"] = Request::postParam("beforeCMD"); $siteInfo["afterCMD"] = Request::postParam("afterCMD"); $id = $siteID === null ? strtolower(preg_replace('/[^\\da-z]/i', '', $siteInfo["name"])) : $siteID; $this->data->saveArray("site-{$id}", $siteInfo); $this->data->saveArray("sites", array($id => $siteInfo["name"])); if ($siteInfo["skipMinFiles"] === 1) { $this->data->saveArray("{$siteID}-skip-assets", $this->findMinFiles($siteInfo["src"])); } echo sss("Site Saved", "Your site was saved. <a href='" . $this->u("/site/{$id}/compress?now") . "'>Compress it now!</a>"); } } else { if (!$editing) { $siteInfo["beforeCMD"] = null; $siteInfo["afterCMD"] = null; } } ?> <form action="<?php echo $editing ? $this->u("/site/{$siteID}/settings") : $this->u("/sites/new"); ?> " method="POST"> <label> <span>Name</span> <input type="text" name="siteName" value="<?php
} else { \Response::setTitle("New App | Me"); } ?> <h1><?php echo $app_edit == true ? $app_info['name'] : "New App"; ?> </h1> <p>Use the following form to fill information about your app. After you submit, an admin will review your app and take the final decision whether to add your app to the App Center.</p> <?php if ($app_edit === true) { ?> <h2>Update</h2> <?php if (isset($_GET['app-updated'])) { echo sss("Updated App", "The app was updated from the Git source."); } ?> <p>If the app's Git repo (branch master) was updated, Lobby will update it automatically within an hour.<cl/>If that didn't happen or you want to update immediately, please click the following button to update the app :</p> <center><a class="btn green" href="?update">Update</a></center> <?php } ?> <h2>Edit</h2> <form action="/me/app<?php echo $app_edit ? "/{$app_info['id']}" : ""; ?> " method="POST"> <label> <span>App ID</span> <input type="text" name="app_id" value="<?php
if (isset($_POST['update'])) { /** * Update info except password */ \fr_logsys\Fr\LS::updateUser($_POST['update'], $id); /** * Change Password */ if (isset($_POST['user_password']) && $_POST['user_password'] != "") { \fr_logsys\Fr\LS::$user = $id; \fr_logsys\Fr\LS::$loggedIn = true; \fr_logsys\Fr\LS::changePassword($_POST['user_password']); \fr_logsys\Fr\LS::$user = null; \fr_logsys\Fr\LS::$loggedIn = false; } sss("Updated", "The user's data was successfully updated. <a href='javascript:window.location.reload();'>Reload page</a> to see changes."); $sql = $this->dbh->prepare("SELECT * FROM `" . $this->table . "` WHERE `id` = ?"); $sql->execute(array($id)); } $info = $sql->fetch(\PDO::FETCH_ASSOC); ?> <h2><?php echo "Editing User '{$id}'"; ?> </h2> <form id="updateUser"> <input type='hidden' name='uid' value='<?php echo $id; ?> ' /> <?php
<div class="contents"> <h1>Bunto</h1> <?php $status = \H::i("status"); if ($status === "site-deleted") { sss("Site Deleted", "The site you requested was removed from Bunto, but the folder is not removed."); } echo \Lobby::l($this->u("/new"), "New Site", "class='btn'"); ?> <p> <?php $sites = getData("sites"); if ($sites !== false) { $sites = json_decode($sites, true); foreach ($sites as $name => $site) { echo $this->l("/site/" . urlencode($name), $name, "class='btn green'") . "<cl/>"; } } ?> </p> </div>
/** * Show success messages in HTML format */ public function sss($title, $description = "") { $this->app->saveData("compress-msg", sss($title, $description)); }
<?php $app_info = array("id" => \Request::get("app_id"), "name" => \Request::get("app_name"), "git_url" => \Request::get("app_download"), "requires" => \Request::get("app_requires"), "short_description" => \Request::get("app_short_description"), "description" => \Request::get("app_description"), "category" => \Request::get("app_category"), "sub_category" => \Request::get("app_sub_category"), "version" => \Request::get("app_version"), "page" => \Request::get("app_page"), "author_id" => \Request::get("author_id")); if (isset($_POST['app_id']) && array_search(null, $app_info) === false && CSRF::check()) { $apps_sql = \Lobby\DB::getDBH()->prepare("SELECT COUNT(1) FROM `apps` WHERE `id` = ?"); $apps_sql->execute(array($app_info['id'])); if ($apps_sql->fetchColumn() != 0) { ser("App Exists", "Hmmm... Looks like the App ID you submitted already exists either on App Center Or in the App Queue. " . \Lobby::l("/apps/{$app_info['id']}", "See Existing App")); } else { $app_info["logo"] = isset($_POST["app_logo"]) ? "1" : "0"; $lobby_web = isset($_POST['app_lobby_web']) ? 1 : 0; $sql = \Lobby\DB::getDBH()->prepare("INSERT INTO `apps` (`id`, `name`, `version`, `logo`, `requires`, `git_url`, `description`, `short_description`, `category`, `sub_category`, `app_page`, `author`, `lobby_web`, `updated`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW());"); $sql->execute(array($app_info['id'], $app_info['name'], $app_info['version'], $app_info['logo'], $app_info['requires'], $app_info['git_url'], $app_info['description'], $app_info['short_description'], $app_info['category'], $app_info['sub_category'], $app_info['page'], $app_info['author_id'], $lobby_web)); require_once __DIR__ . "/../../inc/LobbyGit.php"; $LG = new LobbyGit($app_info["id"], $app_info["git_url"]); $LG->register(); sss("App Added", "App was added to the repository"); } } ?> <form action="<?php echo \Lobby::u(); ?> " method="POST"> <label> <span>App ID</span> <input type="text" name="app_id" /> </label> <label> <span>Name</span> <input type="text" name="app_name" /> </label>
<?php include APP_DIR . "/src/Inc/load.php"; $this->setTitle("Admin Panel"); ?> <div class="content-full"> <h2>Admin Panel</h2> <?php if (isset($_GET['action'])) { $ELEC->liveChange($_GET['action']); sss("Requested For {$_GET['action']}", "The request to reload election page has been sent."); } if (isset($_POST['clearData'])) { $ELEC->clear(); echo "<h2>Successfully Cleared Data</h1>"; } ?> <div> <?php echo \Lobby::l("/admin/app/school-election/candidates", "Candidates Enrollment", "class='button'"); ?> </div> <div style="margin-top:10px;"> <?php echo \Lobby::l("/admin/app/school-election/create-users", "Generate Election Passwords", "class='button'"); ?> </div> <div style="margin-top:10px;"> <?php echo \Lobby::l("/admin/app/school-election/stats", "Election Statistics", "class='button green'"); ?>
<?php $this->load(); if (isset($_POST['new'])) { $omitted_array = $_POST['new']; unset($omitted_array['password']); unset($omitted_array['username']); \fr_logsys\Fr\LS::register($_POST['new']['username'], $_POST['new']['password'], $omitted_array); sss("Created", "The user has been created. <a href='javascript:window.location.reload();'>Reload page</a> to see changes."); } $columns = $this->dbh->query("DESCRIBE `" . $this->table . "`")->fetchAll(); ?> <h2>New User</h2> <form id="newUser"> <?php foreach ($columns as $column_info) { $column = $column_info['Field']; if ($column != "id" && $column != "password_salt") { ?> <label> <span><?php echo ucfirst($column); ?> </span> <input type='text' name='new[<?php echo $column; ?> ]' /> </label> <?php }
// Set name $this->saveData("name", $_POST['diary']); } ?> <div class="contents"> <h1>Diary</h1> <p style="font-style: italic;margin-bottom: 20px;">Saving memories of your life</p> <h2>Entries</h2> <p>Choose a date to view it's entry or <?php echo $this->l("/entry", "write today's", "class='btn'"); ?> </p> <div class="datepicker" style="margin: 10px auto;"></div> <?php if (isset($_POST['diary'])) { echo sss("Name Set", "Your diary's name has been set."); } ?> <h2>Name</h2> <form action="<?php echo \Lobby::u(); ?> " method="POST"> <p>Want to name your diary ?</p> <?php CSRF::getInput(); ?> <input type="text" name="diary" placeholder="Type name here... (Kitty, John)" value="<?php echo $this->getData("name"); ?> " />
<?php require_once APP_DIR . "/src/Inc/partial/layout.php"; ?> <div class='contentLoader'> <h1>Users</h1> <?php if ($this->set) { $this->load(); echo "<a class='button dialog' data-dialog='new_user.php'>New User</a>"; echo "<a class='button green dialog' data-dialog='new_col.php'>Add New Column</a>"; echo "<a class='button green dialog' data-dialog='export.php'>Export as SQL</a>"; if (isset($_POST['remove_user'])) { $sql = $this->dbh->prepare("DELETE FROM `" . $this->table . "` WHERE `id` = ?"); $sql->execute(array($_POST['remove_user'])); sss("Removed User", "The user with the ID '" . htmlspecialchars($_POST['remove_user']) . "' was deleted from the database"); } $_GET['start'] = isset($_GET['start']) ? $_GET['start'] : 0; $sql = $this->dbh->prepare("SELECT * FROM `" . $this->table . "` ORDER BY `id` LIMIT :start, 10"); $sql->bindValue(":start", (int) trim($_GET['start']), \PDO::PARAM_INT); $sql->execute(); $results = $sql->fetchAll(\PDO::FETCH_ASSOC); $usersCount = $sql->rowCount(); if ($usersCount == 0) { echo sme("No Users", "There are currently no users stored in the table."); } else { echo "<table><thead>"; echo "<th width='15%'>Actions</th>"; $description = array("User ID" => "uid: The user's unique ID", "username" => "username: Username of user", "created" => "created: The date when the user created her/his account", "attempt" => "attempt: The number of times the user have attempted logins or the time for which the user was blocked from loggging in."); $sql = $this->dbh->query("DESCRIBE `" . $this->table . "`"); foreach ($sql->fetchAll() as $null => $column) {
function sss($arrayinfo, $parent_id) { $arr = array(); foreach ($arrayinfo as $key => $val) { if ($val['parent_id'] == $parent_id) { $region_id = $val['region_id']; $arr[$region_id] = array('id' => $region_id, 'text' => $val['region_name'], 'level' => $val['region_type'], 'parent_id' => $val['parent_id']); unset($arrayinfo[$key]); $arr[$region_id]['child'] = sss($arrayinfo, $region_id); if (empty($arr[$region_id]['child']) && $arr[$region_id]['level'] < 3) { $arr[$region_id]['child'] = null; unset($arr[$region_id]); } } } return $arr; }
<?php $this->load(); if (isset($_POST['column'])) { foreach ($_POST['column'] as $column) { if ($column['length'] == "") { $sql = $this->dbh->prepare("ALTER TABLE `" . $this->table . "` ADD {$column['name']} {$column['type']}"); } else { $sql = $this->dbh->prepare("ALTER TABLE `" . $this->table . "` ADD {$column['name']} {$column['type']}({$column['length']})"); } if ($sql->execute()) { sss("Column Added", "The column <b>{{$column['name']}}</b> was successfully added"); } else { $this->log($sql->errorInfo()); ser("Failed", "Some error caused the column to be not created"); } } } $field = str_replace(array("\r", "\n"), "", "<tr>\n <td><input type='text' name='column[0][name]' id='column_name' /></td>\n <td>\n <select name='column[0][type]' class='column_type'>\n <option title='A 4-byte integer, signed range is -2,147,483,648 to 2,147,483,647, unsigned range is 0 to 4,294,967,295' value='INT'>INT</option><option title='A variable-length (0-65,535) string, the effective maximum length is subject to the maximum row size' value='VARCHAR'>VARCHAR</option><option title='A TEXT column with a maximum length of 65,535 (2^16 - 1) characters, stored with a two-byte prefix indicating the length of the value in bytes' value='TEXT'>TEXT</option><option title='A date, supported range is 1000-01-01 to 9999-12-31' value='DATE'>DATE</option><optgroup label='Numeric'><option title='A 1-byte integer, signed range is -128 to 127, unsigned range is 0 to 255' value='TINYINT'>TINYINT</option><option title='A 2-byte integer, signed range is -32,768 to 32,767, unsigned range is 0 to 65,535' value='SMALLINT'>SMALLINT</option><option title='A 3-byte integer, signed range is -8,388,608 to 8,388,607, unsigned range is 0 to 16,777,215' value='MEDIUMINT'>MEDIUMINT</option><option title='A 4-byte integer, signed range is -2,147,483,648 to 2,147,483,647, unsigned range is 0 to 4,294,967,295' value='INT'>INT</option><option title='An 8-byte integer, signed range is -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, unsigned range is 0 to 18,446,744,073,709,551,615' value='BIGINT'>BIGINT</option><option disabled='disabled' value='-'>-</option><option title='A fixed-point number (M, D) - the maximum number of digits (M) is 65 (default 10), the maximum number of decimals (D) is 30 (default 0)' value='DECIMAL'>DECIMAL</option><option title='A small floating-point number, allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38' value='FLOAT'>FLOAT</option><option title='A double-precision floating-point number, allowable values are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308' value='DOUBLE'>DOUBLE</option><option title='Synonym for DOUBLE (exception: in REAL_AS_FLOAT SQL mode it is a synonym for FLOAT)' value='REAL'>REAL</option><option disabled='disabled' value='-'>-</option><option title='A bit-field type (M), storing M of bits per value (default is 1, maximum is 64)' value='BIT'>BIT</option><option title='A synonym for TINYINT(1), a value of zero is considered false, nonzero values are considered true' value='BOOLEAN'>BOOLEAN</option><option title='An alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE' value='SERIAL'>SERIAL</option></optgroup><optgroup label='Date and time'><option title='A date, supported range is 1000-01-01 to 9999-12-31' value='DATE'>DATE</option><option title='A date and time combination, supported range is 1000-01-01 00:00:00 to 9999-12-31 23:59:59' value='DATETIME'>DATETIME</option><option title='A timestamp, range is 1970-01-01 00:00:01 UTC to 2038-01-09 03:14:07 UTC, stored as the number of seconds since the epoch (1970-01-01 00:00:00 UTC)' value='TIMESTAMP'>TIMESTAMP</option><option title='A time, range is -838:59:59 to 838:59:59' value='TIME'>TIME</option><option title='A year in four-digit (4, default) or two-digit (2) format, the allowable values are 70 (1970) to 69 (2069) or 1901 to 2155 and 0000' value='YEAR'>YEAR</option></optgroup><optgroup label='String'><option title='A fixed-length (0-255, default 1) string that is always right-padded with spaces to the specified length when stored' value='CHAR'>CHAR</option><option title='A variable-length (0-65,535) string, the effective maximum length is subject to the maximum row size' value='VARCHAR'>VARCHAR</option><option disabled='disabled' value='-'>-</option><option title='A TEXT column with a maximum length of 255 (2^8 - 1) characters, stored with a one-byte prefix indicating the length of the value in bytes' value='TINYTEXT'>TINYTEXT</option><option title='A TEXT column with a maximum length of 65,535 (2^16 - 1) characters, stored with a two-byte prefix indicating the length of the value in bytes' value='TEXT'>TEXT</option><option title='A TEXT column with a maximum length of 16,777,215 (2^24 - 1) characters, stored with a three-byte prefix indicating the length of the value in bytes' value='MEDIUMTEXT'>MEDIUMTEXT</option><option title='A TEXT column with a maximum length of 4,294,967,295 or 4GiB (2^32 - 1) characters, stored with a four-byte prefix indicating the length of the value in bytes' value='LONGTEXT'>LONGTEXT</option><option disabled='disabled' value='-'>-</option><option title='Similar to the CHAR type, but stores binary byte strings rather than non-binary character strings' value='BINARY'>BINARY</option><option title='Similar to the VARCHAR type, but stores binary byte strings rather than non-binary character strings' value='VARBINARY'>VARBINARY</option><option disabled='disabled' value='-'>-</option><option title='A BLOB column with a maximum length of 255 (2^8 - 1) bytes, stored with a one-byte prefix indicating the length of the value' value='TINYBLOB'>TINYBLOB</option><option title='A BLOB column with a maximum length of 16,777,215 (2^24 - 1) bytes, stored with a three-byte prefix indicating the length of the value' value='MEDIUMBLOB'>MEDIUMBLOB</option><option title='A BLOB column with a maximum length of 65,535 (2^16 - 1) bytes, stored with a two-byte prefix indicating the length of the value' value='BLOB'>BLOB</option><option title='A BLOB column with a maximum length of 4,294,967,295 or 4GiB (2^32 - 1) bytes, stored with a four-byte prefix indicating the length of the value' value='LONGBLOB'>LONGBLOB</option><option disabled='disabled' value='-'>-</option><option title='An enumeration, chosen from the list of up to 65,535 values or the special '' error value' value='ENUM'>ENUM</option><option title='A single value chosen from a set of up to 64 members' value='SET'>SET</option></optgroup><optgroup label='Spatial'><option title='A type that can store a geometry of any type' value='GEOMETRY'>GEOMETRY</option><option title='A point in 2-dimensional space' value='POINT'>POINT</option><option title='A curve with linear interpolation between points' value='LINESTRING'>LINESTRING</option><option title='A polygon' value='POLYGON'>POLYGON</option><option title='A collection of points' value='MULTIPOINT'>MULTIPOINT</option><option title='A collection of curves with linear interpolation between points' value='MULTILINESTRING'>MULTILINESTRING</option><option title='A collection of polygons' value='MULTIPOLYGON'>MULTIPOLYGON</option><option title='A collection of geometry objects of any type' value='GEOMETRYCOLLECTION'>GEOMETRYCOLLECTION</option></optgroup>\n </select>\n </td>\n <td><input type='number' name='column[0][length]' id='column_length' placeholder='Leave empty for using default length' /></td>\n</tr>"); ?> <form id="newColumn"> <table><thead> <th>Name</th> <th>Type</th> <th>Length</th> </thead><tbody> <?php echo $field; ?> </tbody></table> <button>Add Column(s)</button>
<?php //编码转义未解决! //$tt=htmlspecialchars($row->description); echo sss($row->description); ?> </p> <h3>输入</h3> <p> <?php echo sss($row->input); ?> </p> <h3>输出</h3> <p> <?php echo sss($row->output); ?> </p> <h3>样例输入</h3> <pre> <?php echo $sinput; ?> </pre> <h3>样例输出</h3> <pre> <?php echo $soutput; ?> </pre> <h3>提示</h3>