Initial commit
This commit is contained in:
parent
c67747073d
commit
506f2710f4
31
.gitignore
vendored
Executable file
31
.gitignore
vendored
Executable file
|
@ -0,0 +1,31 @@
|
|||
# OS generated files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Trashes
|
||||
Thumbs.db
|
||||
|
||||
# The active config file copied from config-dist.php
|
||||
config.php
|
||||
|
||||
# Vim
|
||||
*.swp
|
||||
*.swo
|
||||
|
||||
# SQLite
|
||||
*.sqlite
|
||||
|
||||
# Ignore the images/ folder
|
||||
images/
|
||||
|
||||
# sass generated files
|
||||
.sass-cache/
|
||||
install/.sass-cache/
|
||||
compressed
|
||||
*.map
|
||||
|
||||
# IDE generated
|
||||
.idea/
|
||||
|
||||
# Authorize.net SDK
|
||||
vendor/
|
29
ajax/deletelink.php
Executable file
29
ajax/deletelink.php
Executable file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
require '../header.php';
|
||||
|
||||
$data = array();
|
||||
|
||||
if ( !isset($_REQUEST['id']) || !is_numeric($_REQUEST['id']) ) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$id = intval($_REQUEST['id']);
|
||||
|
||||
$link = new WebLink($id);
|
||||
if ( $link->delete() === false ) {
|
||||
$data['success'] = false;
|
||||
$data['message'] = "Invalid link! Cannot delete!";
|
||||
pushData();
|
||||
}
|
||||
|
||||
$data['success'] = true;
|
||||
$data['message'] = "Link deleted!";
|
||||
pushData();
|
||||
|
||||
function pushData() {
|
||||
global $data;
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($data);
|
||||
exit();
|
||||
}
|
25
ajax/getlinkdata.php
Executable file
25
ajax/getlinkdata.php
Executable file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
require '../header.php';
|
||||
|
||||
if ( isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) && (intval($_REQUEST['id']) != 0) ) {
|
||||
$id = intval($_REQUEST['id']);
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
|
||||
$data = array();
|
||||
$link = new WebLink($id);
|
||||
$data['id'] = $link->getID();
|
||||
$data['url'] = $link->getURL();
|
||||
$data['title'] = $link->getTitle();
|
||||
$data['description'] = $link->getDescription();
|
||||
|
||||
pushData($data);
|
||||
exit();
|
||||
|
||||
function pushData($data) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($data);
|
||||
exit();
|
||||
}
|
27
ajax/getlinks.php
Executable file
27
ajax/getlinks.php
Executable file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
require '../header.php';
|
||||
|
||||
$data = array();
|
||||
$data['links'] = array();
|
||||
$links = WebLink::getList();
|
||||
foreach ( $links as $link ) {
|
||||
$row = array();
|
||||
$row['id'] = $link->getID();
|
||||
$row['url'] = $link->getURL();
|
||||
$row['url_safe'] = $link->getURL(HTMLSAFE);
|
||||
$row['title'] = $link->getTitle();
|
||||
$row['title_safe'] = $link->getTitle(HTMLSAFE);
|
||||
$row['description'] = $link->getDescription();
|
||||
$row['description_safe'] = $link->getDescription(HTMLSAFE);
|
||||
$data['links'][] = $row;
|
||||
}
|
||||
|
||||
pushData($data);
|
||||
exit();
|
||||
|
||||
function pushData($data) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($data);
|
||||
exit();
|
||||
}
|
50
ajax/savelink.php
Executable file
50
ajax/savelink.php
Executable file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
require '../header.php';
|
||||
|
||||
$data = array();
|
||||
|
||||
if ( !isset($_REQUEST['id'])
|
||||
|| !isset($_REQUEST['url'])
|
||||
|| !isset($_REQUEST['title'])
|
||||
|| !isset($_REQUEST['description']) ) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$id = intval($_REQUEST['id']);
|
||||
$url = $_REQUEST['url'];
|
||||
$title = $_REQUEST['title'];
|
||||
$description = $_REQUEST['description'];
|
||||
|
||||
$link = new WebLink($id);
|
||||
if ( $link->setURL($url) === false ) {
|
||||
$data['success'] = false;
|
||||
$data['message'] = "Invalid URL! URL cannot be left blank.";
|
||||
pushData();
|
||||
}
|
||||
if ( $link->setTitle($title) === false ) {
|
||||
$data['success'] = false;
|
||||
$data['message'] = "Invalid title! Title cannot be left blank.";
|
||||
pushData();
|
||||
}
|
||||
if ( $link->setDescription($description) === false ) {
|
||||
$data['success'] = false;
|
||||
$data['message'] = "Invalid description! Description cannot be left blank.";
|
||||
pushData();
|
||||
}
|
||||
|
||||
if ( $link->save() === false ) {
|
||||
$data['success'] = false;
|
||||
$data['message'] = "Error saving link!.";
|
||||
pushData();
|
||||
}
|
||||
$data['success'] = true;
|
||||
$data['message'] = (is_null($link->getID())) ? "New link created! Thank you :)" : "Link edited! Thank you :)";
|
||||
pushData();
|
||||
|
||||
function pushData() {
|
||||
global $data;
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($data);
|
||||
exit();
|
||||
}
|
134
class_link.php
Executable file
134
class_link.php
Executable file
|
@ -0,0 +1,134 @@
|
|||
<?php
|
||||
|
||||
class WebLink {
|
||||
private $id = null;
|
||||
private $url = null;
|
||||
private $title = null;
|
||||
private $description = null;
|
||||
|
||||
const TABLE = "links";
|
||||
|
||||
public function getID() {
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getURL($flag = 0) {
|
||||
switch ($flag) {
|
||||
case HTMLSAFE:
|
||||
return htmlspecialchars($this->url);
|
||||
break;
|
||||
case HTMLFORMSAFE:
|
||||
return htmlspecialchars($this->url, ENT_QUOTES);
|
||||
break;
|
||||
default:
|
||||
return $this->url;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function getTitle($flag = 0) {
|
||||
switch ($flag) {
|
||||
case HTMLSAFE:
|
||||
return htmlspecialchars($this->title);
|
||||
break;
|
||||
case HTMLFORMSAFE:
|
||||
return htmlspecialchars($this->title, ENT_QUOTES);
|
||||
break;
|
||||
default:
|
||||
return $this->title;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function getDescription($flag = 0) {
|
||||
switch ($flag) {
|
||||
case HTMLSAFE:
|
||||
return htmlspecialchars($this->description);
|
||||
break;
|
||||
case HTMLFORMSAFE:
|
||||
return htmlspecialchars($this->description, ENT_QUOTES);
|
||||
break;
|
||||
default:
|
||||
return $this->description;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function setURL($value) {
|
||||
if ( is_null($value) || ($value == "") ) return false;
|
||||
$this->url = $value;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setTitle($value) {
|
||||
if ( is_null($value) || ($value == "") ) return false;
|
||||
$this->title = $value;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function setDescription($value) {
|
||||
if ( is_null($value) || ($value == "") ) return false;
|
||||
$this->description = $value;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getList() {
|
||||
global $globaldbh;
|
||||
|
||||
$query = "SELECT id FROM " . WebLink::TABLE . " ORDER BY title";
|
||||
$sth = $globaldbh->prepare($query);
|
||||
$sth->execute();
|
||||
$thelist = array();
|
||||
while ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
|
||||
$thelist[] = new WebLink($row['id']);
|
||||
}
|
||||
return $thelist;
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
global $globaldbh;
|
||||
|
||||
if ( is_null($this->id) ) return false;
|
||||
$query = "DELETE from " . WebLink::TABLE . " WHERE id=:id";
|
||||
$fields = array();
|
||||
$fields[':id'] = $this->id;
|
||||
$sth = $globaldbh->prepare($query);
|
||||
$saved = $sth->execute($fields);
|
||||
return $saved;
|
||||
}
|
||||
|
||||
public function save() {
|
||||
global $globaldbh;
|
||||
|
||||
$query = "INSERT INTO " . WebLink::TABLE . " " .
|
||||
"(id, url, title, description) " .
|
||||
"VALUES(:id, :url, :title, :description) " .
|
||||
"ON DUPLICATE KEY UPDATE " .
|
||||
"url=:url, title=:title, description=:description";
|
||||
$fields = array();
|
||||
$fields[':id'] = $this->getID();
|
||||
$fields[':url'] = $this->getURL();
|
||||
$fields[':title'] = $this->getTitle();
|
||||
$fields[':description'] = $this->getDescription();
|
||||
$sth = $globaldbh->prepare($query);
|
||||
$saved = $sth->execute($fields);
|
||||
return $saved;
|
||||
}
|
||||
|
||||
public function __construct($id = null) {
|
||||
global $globaldbh;
|
||||
|
||||
$query = "SELECT id, url, title, description FROM " . WebLink::TABLE . " WHERE id=:id";
|
||||
$fields = array();
|
||||
$fields[':id'] = $id;
|
||||
$sth = $globaldbh->prepare($query);
|
||||
$sth->execute($fields);
|
||||
if ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
|
||||
$this->id = $row['id'];
|
||||
$this->setURL($row['url']);
|
||||
$this->setTitle($row['title']);
|
||||
$this->setDescription($row['description']);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
24
config-dist.php
Executable file
24
config-dist.php
Executable file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
// Session Information
|
||||
//
|
||||
define('SESSNAME', 'dynamiclinks'); // Must be only letters and numbers!
|
||||
define('PAGETITLE', 'Link Registration'); // This is the large label in the header of each page
|
||||
|
||||
// Database Type: Valid values are 'mysql' and 'sqlite'
|
||||
//
|
||||
define('DBTYPE', 'mysql');
|
||||
|
||||
// SQLite Database Configuration. Ignore if not using SQLite
|
||||
// This must be set to the full path of the SQLite database file.
|
||||
// The folder containing this file MUST also be writable!
|
||||
// SUPER IMPORTANT!!! This file MUST be included in a regular backup schedule!!!
|
||||
//
|
||||
define('SQLITEDB', '/tmp/mcplaces.sqlite');
|
||||
|
||||
// MySQL Database Configuration. Ignore if not using MySQL
|
||||
//
|
||||
define('DBHOST', 'localhost');
|
||||
define('DBUSER', 'root');
|
||||
define('DBPASS', '');
|
||||
define('DBNAME', 'test');
|
14
constants.php
Executable file
14
constants.php
Executable file
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
define("HTMLSAFE", 1000001);
|
||||
define("HTMLFORMSAFE", 1000002);
|
||||
define("CSVSAFE", 1000003);
|
||||
|
||||
define("TIMESTAMP", 1000101);
|
||||
define("PRETTY", 1000102);
|
||||
define("SHORTDATE", 1000103);
|
||||
|
||||
define("BOOLEANDB", 1000201);
|
||||
|
||||
define("NOLIMIT", 0);
|
||||
define("NOFLAG", 0);
|
133
css/main.css
Executable file
133
css/main.css
Executable file
|
@ -0,0 +1,133 @@
|
|||
:root {
|
||||
--main-fg-color: #0d47a1;
|
||||
--main-highlight-color: #2196f3;
|
||||
--toast-fail-color: #c62828;
|
||||
--toast-warn-color: #ffa000;
|
||||
--table-highlight-color: #bbdefb;
|
||||
--logo-bg-color: white;
|
||||
}
|
||||
|
||||
.input-field label {
|
||||
color: var(--main-fg-color);
|
||||
}
|
||||
|
||||
.failtoast {
|
||||
color: white;
|
||||
background-color: var(--toast-fail-color);
|
||||
}
|
||||
|
||||
.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.warningtoast {
|
||||
color: white;
|
||||
background-color: var(--toast-warn-color);;
|
||||
}
|
||||
|
||||
nav, footer {
|
||||
background-color: var(--main-fg-color) !important;
|
||||
}
|
||||
|
||||
body {
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.navbar-logo {
|
||||
height: 46px;
|
||||
margin: 8px;
|
||||
padding: 4px;
|
||||
border-radius: 3px;
|
||||
background-color: var(--logo-bg-color);
|
||||
}
|
||||
|
||||
.invisible {
|
||||
visibility: hidden !important;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.narrow {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1 0 auto;
|
||||
}
|
||||
table.highlight tbody tr:hover {
|
||||
background-color: var(--table-highlight-color) !important;
|
||||
}
|
||||
#toast-container {
|
||||
z-index: 1000000;
|
||||
}
|
||||
.modal-footer {
|
||||
height: 5em !important;
|
||||
}
|
||||
|
||||
.wide {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
[type="radio"]:checked + span:after,
|
||||
[type="radio"].with-gap:checked + span:before,
|
||||
[type="radio"].with-gap:checked + span:after {
|
||||
border: 2px solid var(--main-fg-color);
|
||||
}
|
||||
|
||||
[type="radio"]:checked + span:after,
|
||||
[type="radio"].with-gap:checked + span:after {
|
||||
background-color: var(--main-fg-color);
|
||||
}
|
||||
|
||||
.btn, .btn-small {
|
||||
background-color: var(--main-fg-color);
|
||||
}
|
||||
|
||||
.btn:hover, .btn-small:hover {
|
||||
background-color: var(--main-highlight-color);
|
||||
}
|
||||
|
||||
.btn:focus, .btn-large:focus, .btn-small:focus,
|
||||
.btn-floating:focus {
|
||||
background-color: var(--main-fg-color);
|
||||
}
|
||||
|
||||
.dropdown-content li > a, .dropdown-content li > span {
|
||||
color: var(--main-fg-color);
|
||||
}
|
||||
|
||||
.tabs {
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.tabs .tab {
|
||||
line-height: 100px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.tabs .tab a {
|
||||
color: var(--main-highlight-color);
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.tabs .tab a:focus, .tabs .tab a:focus.active {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.tabs .tab a:hover, .tabs .tab a.active {
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tabs .tab.disabled a,
|
||||
.tabs .tab.disabled a:hover {
|
||||
color: var(--main-highlight-color);
|
||||
}
|
||||
|
||||
.tabs .indicator {
|
||||
background-color: var(--main-highlight-color);
|
||||
}
|
7
db.sql
Executable file
7
db.sql
Executable file
|
@ -0,0 +1,7 @@
|
|||
CREATE TABLE `links` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`url` text NOT NULL,
|
||||
`title` varchar(255) NOT NULL,
|
||||
`description` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
|
1
error.html
Executable file
1
error.html
Executable file
|
@ -0,0 +1 @@
|
|||
Could not connect to the database.
|
75
functions.php
Executable file
75
functions.php
Executable file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
//
|
||||
// A simple function to redirect a page while still in the header
|
||||
//
|
||||
function redirectPage($page = null) {
|
||||
if ( is_null($page) ) $page = "index.php";
|
||||
header("Location: {$page}");
|
||||
exit();
|
||||
}
|
||||
|
||||
//
|
||||
// This function outputs the HTML header along with adding a string
|
||||
// of text to the page title.
|
||||
//
|
||||
function includeHTMLHeader($headertext = "", ...$sheets) {
|
||||
global $currentuser;
|
||||
if ($headertext != "") $fullpagetitle = htmlspecialchars($headertext);
|
||||
$extrasheets = " <!-- Extra CSS included by the current page -->\n";
|
||||
foreach ( $sheets as $sheet ) {
|
||||
$extrasheets .= " <link type='text/css' rel='stylesheet' href='css/{$sheet}'/>\n";
|
||||
}
|
||||
require 'htmlheader.php';
|
||||
}
|
||||
|
||||
//
|
||||
// This function outputs the HTML header along with adding a string
|
||||
// of text to the page title. This is for pages without side navigation.
|
||||
//
|
||||
function includeHTMLHeaderBasic($headertext = "", ...$sheets) {
|
||||
global $currentuser;
|
||||
if ($headertext != "") $fullpagetitle = htmlspecialchars($headertext);
|
||||
$extrasheets = " <!-- Extra CSS included by the current page -->\n";
|
||||
foreach ( $sheets as $sheet ) {
|
||||
$extrasheets .= " <link type='text/css' rel='stylesheet' href='css/{$sheet}'/>\n";
|
||||
}
|
||||
require 'htmlheader-basic.php';
|
||||
}
|
||||
|
||||
//
|
||||
// This function outputs the HTML footer along with adding script tags
|
||||
// for any script files passed to the function. These files are assumed
|
||||
// to be in the js/ folder.
|
||||
//
|
||||
function includeHTMLFooter(...$scripts) {
|
||||
require 'htmlfooter.php';
|
||||
foreach ( $scripts as $script ) {
|
||||
echo "<script type='text/javascript' src='js/", trim($script), "'></script>\n";
|
||||
}
|
||||
echo " </body>\n";
|
||||
echo " </html>\n";
|
||||
}
|
||||
|
||||
//
|
||||
// This function outputs the HTML footer along with adding script tags
|
||||
// for any script files passed to the function. These files are assumed
|
||||
// to be in the js/ folder. This is for pages without side navigation.
|
||||
//
|
||||
function includeHTMLFooterBasic(...$scripts) {
|
||||
require 'htmlfooter-basic.php';
|
||||
foreach ( $scripts as $script ) {
|
||||
echo "<script type='text/javascript' src='js/", trim($script), "'></script>\n";
|
||||
}
|
||||
echo " </body>\n";
|
||||
echo " </html>\n";
|
||||
}
|
||||
|
||||
function isValidIPAddress($address) {
|
||||
$octets = explode(".", $address);
|
||||
if ( count($octets) != 4 ) return false;
|
||||
foreach ( $octets as $octet ) {
|
||||
if ( !is_numeric($octet) || ($octet < 0) || ($octet > 255) ) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
7
header-includes.php
Executable file
7
header-includes.php
Executable file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
require 'constants.php';
|
||||
require 'config.php';
|
||||
require 'functions.php';
|
||||
require 'class_link.php';
|
||||
|
15
header.php
Executable file
15
header.php
Executable file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
require 'header-includes.php';
|
||||
|
||||
// Make our PDO database connection which will be used in all scripts
|
||||
try {
|
||||
$globaldbh = new PDO("mysql:host=" . DBHOST . ";dbname=" . DBNAME, DBUSER, DBPASS);
|
||||
} catch (PDOException $e) {
|
||||
header('Location: error.html');
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( php_sapi_name() != "cli" ) {
|
||||
require 'startsession.php';
|
||||
}
|
15
htmlfooter-basic.php
Executable file
15
htmlfooter-basic.php
Executable file
|
@ -0,0 +1,15 @@
|
|||
</main>
|
||||
<footer class="page-footer">
|
||||
<div class="footer-copyright grey lighten-2">
|
||||
<div class="container grey-text text-darken-2">
|
||||
© Link Registration
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<!-- Import jQuery before materialize.js -->
|
||||
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
|
||||
<!-- Compiled and minified JavaScript -->
|
||||
<script type="text/javascript" src="materialize/js/materialize.min.js"></script>
|
||||
<!-- Main JS file for housekeeping and functions -->
|
||||
<script type="text/javascript" src="js/main.js"></script>
|
||||
<!--Page Specific JavaScript-->
|
19
htmlfooter.php
Executable file
19
htmlfooter.php
Executable file
|
@ -0,0 +1,19 @@
|
|||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<footer class="page-footer">
|
||||
<div class="footer-copyright grey lighten-3">
|
||||
<div class="container grey-text light-text">
|
||||
© Link Registration
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<!--Import jQuery before materialize.js-->
|
||||
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
|
||||
<!-- Compiled and minified JavaScript -->
|
||||
<script type="text/javascript" src="materialize/js/materialize.min.js"></script>
|
||||
<!-- https://momentjs.com MomentJS for time and date functions on the client -->
|
||||
<script type="text/javascript" src="js/moment.min.js"></script>
|
||||
<!-- Main JS file for housekeeping and functions -->
|
||||
<script type="text/javascript" src="js/main.js"></script>
|
||||
<!--Page Specific JavaScript-->
|
39
htmlheader-basic.php
Executable file
39
htmlheader-basic.php
Executable file
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><?php echo $fullpagetitle; ?></title>
|
||||
<!--Import Google Icon Font-->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<!--Let browser know website is optimized for mobile-->
|
||||
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
|
||||
<!-- Favicon -->
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<link rel="shortcut icon" href="favicons/favicon.ico">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="msapplication-config" content="favicons/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<!-- Compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="materialize/css/materialize.min.css">
|
||||
<!--Main CSS-->
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<!-- Page Specific CSS -->
|
||||
<?php
|
||||
// This is where dynamically added stylesheets will show up
|
||||
echo $extrasheets;
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<div class='nav-wrapper'>
|
||||
<img class='navbar-logo' src='images/logo.png' onerror="this.style.display='none'" /><a href='#!' class='brand-logo'><?php echo PAGETITLE; ?></a>
|
||||
</div>
|
||||
</nav>
|
||||
<main>
|
48
htmlheader.php
Executable file
48
htmlheader.php
Executable file
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title id="profile-title"><?php echo $fullpagetitle; ?></title>
|
||||
<!--Import Google Icon Font-->
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<!--Let browser know website is optimized for mobile-->
|
||||
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
|
||||
<!-- Favicon -->
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="favicons/apple-touch-icon.png">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="favicons/favicon-32x32.png">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="favicons/favicon-16x16.png">
|
||||
<link rel="manifest" href="favicons/site.webmanifest">
|
||||
<link rel="mask-icon" href="favicons/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<link rel="shortcut icon" href="favicons/favicon.ico">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="msapplication-config" content="favicons/browserconfig.xml">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<!-- Compiled and minified CSS -->
|
||||
<link rel="stylesheet" href="materialize/css/materialize.min.css">
|
||||
<!--Main CSS-->
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<!--Page Specific CSS-->
|
||||
<?php
|
||||
// This is where dynamically added stylesheets will show up
|
||||
echo $extrasheets;
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<div class='navbar-fixed'>
|
||||
<nav>
|
||||
<div class='nav-wrapper'>
|
||||
<img class='navbar-logo' src='images/logo.png' onerror="this.style.display='none'" /><a href='#!' class='brand-logo'><?php echo PAGETITLE; ?></a>
|
||||
<a href='#' data-target='mobile-menu' class='sidenav-trigger'><i class='material-icons'>menu</i></a>
|
||||
<ul class='right hide-on-med-and-down'>
|
||||
<li><a href='#!' onClick='openNewLinkModal()'>Add A Link</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<ul class='sidenav' id='mobile-menu'>
|
||||
<li><a href='addplace.php'>Add A Link</a></li>
|
||||
</ul>
|
||||
<main>
|
||||
<div class='row'>
|
||||
<div class='col s8 offset-s2'>
|
64
index.php
Executable file
64
index.php
Executable file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
require 'header.php';
|
||||
|
||||
includeHTMLHeader("Link Manager");
|
||||
|
||||
?>
|
||||
<h3 class='center-align'>Links</h3>
|
||||
<div class='row center-align'><a href='#!' class='tooltipped' data-position='bottom' data-tooltip='Register a new link' onClick='openEditLinkModal()'>Add A New Link</a></div>
|
||||
<table class='bordered striped highlight'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>URL</th>
|
||||
<th>Title</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id='linklist'></tbody>
|
||||
</table>
|
||||
<div id='editlink_modal' class='modal'>
|
||||
<div class='modal-content'>
|
||||
<input type='hidden' id='editlink_id' value='0' />
|
||||
<div class='row center-align'>
|
||||
<h3 id='editlink_modaltitle'>Link Data</h3>
|
||||
</div>
|
||||
<div class='row center-align'>
|
||||
<form class='col s6 offset-s3'>
|
||||
<div class='row'>
|
||||
<div class='input-field col s10 offset-s1'>
|
||||
<input id='editlink_url' type='text' value='' />
|
||||
<label for='editlink_url'>URL</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='input-field col s10 offset-s1'>
|
||||
<input id='editlink_title' type='text' value='' />
|
||||
<label for='editlink_title'>Title</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='input-field col s10 offset-s1'>
|
||||
<input id='editlink_description' type='text' value='' />
|
||||
<label for='editlink_description'>Description</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class='modal-footer'>
|
||||
<div class='col s1 offset-s2'>
|
||||
<a href='#!' id='editlink_modal_delete' class='btn-small red'>Delete</a>
|
||||
</div>
|
||||
<div class='col s2 offset-s2'>
|
||||
<a href='#!' id='editlink_modal_save' class='btn-small'>Save</a>
|
||||
</div>
|
||||
<div class='col s1 offset-s2'>
|
||||
<a href='#!' id='editlink_modal_cancel' class='btn-small'>Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
includeHTMLFooter();
|
||||
|
2
js/jquery-3.3.1.min.js
vendored
Executable file
2
js/jquery-3.3.1.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
143
js/main.js
Executable file
143
js/main.js
Executable file
|
@ -0,0 +1,143 @@
|
|||
$(document).ready(function() {
|
||||
$(".dropdown-trigger").dropdown({hover: true, coverTrigger: false});
|
||||
$(".sidenav").sidenav();
|
||||
$(".tooltipped").tooltip();
|
||||
$('.modal').modal({dismissible: false});
|
||||
$('#editlink_modal_delete').click(function() { deleteLink(); });
|
||||
$('#editlink_modal_save').click(function() { saveEditLink(); });
|
||||
$('#editlink_modal_cancel').click(function() { cancelEditLink(); });
|
||||
updateLinkList();
|
||||
});
|
||||
|
||||
function goHome() {
|
||||
$.ajax({
|
||||
url: 'ajax/setlocation.php',
|
||||
dataType: 'json',
|
||||
data: {gohome: 1},
|
||||
success: function(data, stat, jqo) {
|
||||
if ( data.success ) window.location.href = "index.php";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function escapeHTML(text) {
|
||||
var map = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
};
|
||||
|
||||
return text.relink(/[&<>"']/g, function(m) { return map[m]; });
|
||||
}
|
||||
|
||||
function encodeHTML(text) {
|
||||
return jQuery('<div />').text(text).html();
|
||||
}
|
||||
|
||||
function decodeHTML(text) {
|
||||
return jQuery('<div />').html(text).text();
|
||||
}
|
||||
|
||||
function toast(message, delay, classname) {
|
||||
if ( delay === undefined ) delay = 4000;
|
||||
if ( classname === undefined ) classname = "";
|
||||
M.toast({html: message, displayLength: delay, classes: classname});
|
||||
}
|
||||
|
||||
function openEditLinkModal(id = 0) {
|
||||
var instance = M.Modal.getInstance($('#editlink_modal'));
|
||||
$.ajax({
|
||||
url: 'ajax/getlinkdata.php',
|
||||
dataType: 'json',
|
||||
data: {id: id},
|
||||
success: function(data, stat, jqo) {
|
||||
if (data.id !== null) {
|
||||
$("#editlink_id").val(data.id);
|
||||
$("#editlink_url").val(data.url);
|
||||
$("#editlink_title").val(data.title);
|
||||
$("#editlink_description").val(data.description);
|
||||
$("#editlink_modal_delete").show();
|
||||
} else {
|
||||
$("#editlink_id").val("0");
|
||||
$("#editlink_url").val("");
|
||||
$("#editlink_title").val("");
|
||||
$("#editlink_description").val("");
|
||||
$("#editlink_modal_delete").hide();
|
||||
}
|
||||
M.updateTextFields();
|
||||
instance.open();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateLinkList() {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'ajax/getlinks.php',
|
||||
dateType: 'json',
|
||||
success: function(data, stat, jqo) {
|
||||
var tabledata = "";
|
||||
for (var i=0; i<data.links.length; i++) {
|
||||
var link = data.links[i];
|
||||
tabledata += "<tr class='clickable' onClick='openEditLinkModal(" + link.id + ")'>";
|
||||
tabledata += "<td>" + link.url_safe + "</td>";
|
||||
tabledata += "<td>" + link.title_safe + "</td>";
|
||||
tabledata += "<td>" + link.description_safe + "</td>";
|
||||
tabledata += "</td>";
|
||||
tabledata += "</tr>";
|
||||
}
|
||||
$("#linklist").html(tabledata);
|
||||
$('.tooltipped').tooltip();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deleteLink() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax/deletelink.php',
|
||||
dataType: 'json',
|
||||
data: {id: $("#editlink_id").val()},
|
||||
success: function(data, stat, jqo) {
|
||||
if ( data.success ) {
|
||||
cancelEditLink();
|
||||
toast(data.message, 4000);
|
||||
updateLinkList();
|
||||
} else {
|
||||
toast(data.message, 4000, "failtoast");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveEditLink() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax/savelink.php',
|
||||
dataType: 'json',
|
||||
data: {id: $("#editlink_id").val(),
|
||||
url: $("#editlink_url").val(),
|
||||
title: $("#editlink_title").val(),
|
||||
description: $("#editlink_description").val()},
|
||||
success: function(data, stat, jqo) {
|
||||
if ( data.success ) {
|
||||
cancelEditLink();
|
||||
toast(data.message, 4000);
|
||||
updateLinkList();
|
||||
} else {
|
||||
toast(data.message, 4000, "failtoast");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cancelEditLink() {
|
||||
var instance = M.Modal.getInstance($('#editlink_modal'));
|
||||
instance.close();
|
||||
$("#editlink_url").val("");
|
||||
$("#editlink_title").val("");
|
||||
$("#editlink_description").val("");
|
||||
M.updateTextFields();
|
||||
}
|
1
js/moment.min.js
vendored
Executable file
1
js/moment.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
21
materialize/LICENSE
Executable file
21
materialize/LICENSE
Executable file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2018 Materialize
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
91
materialize/README.md
Executable file
91
materialize/README.md
Executable file
|
@ -0,0 +1,91 @@
|
|||
<p align="center">
|
||||
<a href="http://materializecss.com/">
|
||||
<img src="http://materializecss.com/res/materialize.svg" width="150">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<h3 align="center">MaterializeCSS</h3>
|
||||
|
||||
<p align="center">
|
||||
Materialize, a CSS Framework based on material design.
|
||||
<br>
|
||||
<a href="http://materializecss.com/"><strong>-- Browse the docs --</strong></a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://travis-ci.org/Dogfalo/materialize">
|
||||
<img src="https://travis-ci.org/Dogfalo/materialize.svg?branch=master" alt="Travis CI badge">
|
||||
</a>
|
||||
<a href="https://badge.fury.io/js/materialize-css">
|
||||
<img src="https://badge.fury.io/js/materialize-css.svg" alt="npm version badge">
|
||||
</a>
|
||||
<a href="https://cdnjs.com/libraries/materialize">
|
||||
<img src="https://img.shields.io/cdnjs/v/materialize.svg" alt="CDNJS version badge">
|
||||
</a>
|
||||
<a href="https://david-dm.org/Dogfalo/materialize">
|
||||
<img src="https://david-dm.org/Dogfalo/materialize/status.svg" alt="dependencies Status badge">
|
||||
</a>
|
||||
<a href="https://david-dm.org/Dogfalo/materialize#info=devDependencies">
|
||||
<img src="https://david-dm.org/Dogfalo/materialize/dev-status.svg" alt="devDependency Status badge">
|
||||
</a>
|
||||
<a href="https://gitter.im/Dogfalo/materialize">
|
||||
<img src="https://badges.gitter.im/Join%20Chat.svg" alt="Gitter badge">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
## Table of Contents
|
||||
- [Quickstart](#quickstart)
|
||||
- [Documentation](#documentation)
|
||||
- [Supported Browsers](#supported-browsers)
|
||||
- [Changelog](#changelog)
|
||||
- [Testing](#testing)
|
||||
- [Contributing](#contributing)
|
||||
- [Copyright and license](#copyright-and-license)
|
||||
|
||||
## Quickstart:
|
||||
Read the [getting started guide](http://materializecss.com/getting-started.html) for more information on how to use materialize.
|
||||
|
||||
- [Download the latest release](https://github.com/Dogfalo/materialize/releases/latest) of materialize directly from GitHub. ([Beta](https://github.com/Dogfalo/materialize/releases/))
|
||||
- Clone the repo: `git clone https://github.com/Dogfalo/materialize.git` (Beta: `git clone -b v1-dev https://github.com/Dogfalo/materialize.git`)
|
||||
- Include the files via [cdnjs](https://cdnjs.com/libraries/materialize). More [here](http://materializecss.com/getting-started.html). ([Beta](https://cdnjs.com/libraries/materialize/1.0.0-beta))
|
||||
- Install with [npm](https://www.npmjs.com): `npm install materialize-css` (Beta: `npm install materialize-css@next`)
|
||||
- Install with [Bower](https://bower.io): `bower install materialize` ([DEPRECATED](https://bower.io/blog/2017/how-to-migrate-away-from-bower/))
|
||||
- Install with [Atmosphere](https://atmospherejs.com): `meteor add materialize:materialize` (Beta: `meteor add materialize:materialize@=1.0.0-beta`)
|
||||
|
||||
## Documentation
|
||||
The documentation can be found at <http://materializecss.com>. To run the documentation locally on your machine, you need [Node.js](https://nodejs.org/en/) installed on your computer.
|
||||
|
||||
### Running documentation locally
|
||||
Run these commands to set up the documentation:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Dogfalo/materialize
|
||||
cd materialize
|
||||
npm install
|
||||
```
|
||||
|
||||
Then run `grunt monitor` to compile the documentation. When it finishes, open a new browser window and navigate to `localhost:8000`. We use [BrowserSync](https://www.browsersync.io/) to display the documentation.
|
||||
|
||||
### Documentation for previous releases
|
||||
Previous releases and their documentation are available for [download](https://github.com/Dogfalo/materialize/releases).
|
||||
|
||||
## Supported Browsers:
|
||||
Materialize is compatible with:
|
||||
|
||||
- Chrome 35+
|
||||
- Firefox 31+
|
||||
- Safari 9+
|
||||
- Opera
|
||||
- Edge
|
||||
- IE 11+
|
||||
|
||||
## Changelog
|
||||
For changelogs, check out [the Releases section of materialize](https://github.com/Dogfalo/materialize/releases) or the [CHANGELOG.md](CHANGELOG.md).
|
||||
|
||||
## Testing
|
||||
We use Jasmine as our testing framework and we're trying to write a robust test suite for our components. If you want to help, [here's a starting guide on how to write tests in Jasmine](CONTRIBUTING.md#jasmine-testing-guide).
|
||||
|
||||
## Contributing
|
||||
Check out the [CONTRIBUTING document](CONTRIBUTING.md) in the root of the repository to learn how you can contribute. You can also browse the [help-wanted](https://github.com/Dogfalo/materialize/labels/help-wanted) tag in our issue tracker to find things to do.
|
||||
|
||||
## Copyright and license
|
||||
Code Copyright 2018 Materialize. Code released under the MIT license.
|
9067
materialize/css/materialize.css
vendored
Executable file
9067
materialize/css/materialize.css
vendored
Executable file
File diff suppressed because it is too large
Load Diff
13
materialize/css/materialize.min.css
vendored
Executable file
13
materialize/css/materialize.min.css
vendored
Executable file
File diff suppressed because one or more lines are too long
12360
materialize/js/materialize.js
vendored
Executable file
12360
materialize/js/materialize.js
vendored
Executable file
File diff suppressed because it is too large
Load Diff
6
materialize/js/materialize.min.js
vendored
Executable file
6
materialize/js/materialize.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
8
startsession.php
Executable file
8
startsession.php
Executable file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
if ( php_sapi_name() == "cli" ) exit();
|
||||
|
||||
// Start the session
|
||||
session_name(SESSNAME);
|
||||
session_start();
|
||||
|
Loading…
Reference in New Issue
Block a user