├── LICENSE
├── README.md
├── mysql_setup.sql
├── setup-server.md
└── source
├── album.css
├── carousel.css
├── favicon.ico
├── footer.php
├── header.php
├── include
├── carousel_bg_future.jpg
├── carousel_bg_layots.jpg
├── carousel_bg_layouts.jpg
├── carousel_bg_styles.jpg
├── carousel_bg_styles.png
├── db_connect.inc.php
├── db_connect.php
├── layout_edit.inc.php
├── layout_submit.inc.php
├── login.inc.php
├── logout.inc.php
├── marketing_bg_future.png
├── marketing_bg_layouts.png
├── marketing_bg_styles.png
├── recover.inc.php
├── signup.inc.php
├── style_edit.inc.php
└── style_submit.inc.php
├── index.php
├── layout_edit.php
├── layout_submit.php
├── layouts.php
├── layouts
├── images
│ ├── 5f2ea4ecd2bda6.55720649.jpg
│ ├── 5f2ea54ce44388.34804648.jpg
│ ├── 5f2ea5f98a5464.63480178.jpg
│ ├── 5f2ea70884d192.51494044.jpg
│ ├── 5f2eae93174540.49168187.jpg
│ ├── 5f2eafcd518d27.51669229.png
│ ├── 5f2eb619e1ee50.29674482.png
│ ├── 5f2f99abe5c4e0.37617526.jpg
│ ├── 5f2f9a8be01522.74046234.jpg
│ └── 5f2f9ea669c4f4.16900436.jpg
└── resources
│ ├── 5f2ea4ecd2bd21.75364095.qpt
│ ├── 5f2ea54ce442b5.33477222.qpt
│ ├── 5f2ea5f98a53e1.56763458.qpt
│ ├── 5f2ea70884d101.74067897.qpt
│ ├── 5f2eae93174493.47577054.qpt
│ ├── 5f2eafcd518c84.31834074.qpt
│ ├── 5f2eb619e1eda7.23049489.qpt
│ ├── 5f2f99abe5c471.47526868.qpt
│ ├── 5f2f9a8be01496.24803415.qpt
│ └── 5f2f9ea669c487.31156090.qpt
├── signup.php
├── style_edit.php
├── style_submit.php
├── styles.php
├── styles
├── images
│ ├── 5f2ac8e21402a4.97545666.jpg
│ ├── 5f2b028244e595.02806186.png
│ ├── 5f2b33ee30fa63.26828068.jpeg
│ ├── 5f2c31183d61c6.77483439.png
│ ├── 5f2dd3fe213194.63332282.jpg
│ ├── 5f2ec31ea09265.72627163.png
│ ├── Revision.png
│ ├── Screenshot from 2020-07-15 10-58-42.png
│ ├── Screenshot from 2020-07-15 15-09-48.png
│ ├── Screenshot from 2020-07-15 18-22-05.png
│ ├── Screenshot from 2020-07-16 10-12-36.png
│ ├── Screenshot from 2020-07-18 11-11-17.png
│ ├── Screenshot from 2020-07-20 14-09-41.png
│ ├── Screenshot from 2020-07-21 15-34-02.png
│ ├── Screenshot from 2020-08-01 20-33-49.png
│ ├── Screenshot from 2020-08-03 18-46-42.png
│ ├── cool_lakes_pattern.jpg
│ ├── denim.jpg
│ ├── organic_blocks.jpg
│ ├── pen.png
│ ├── pencil.png
│ ├── readme.md
│ ├── sharpie.png
│ └── wallpaper-70s.jpg
├── index.php
└── resources
│ ├── 5f2ac8e2140216.09033704.xml
│ ├── 5f2b028244e4f1.91634423.xml
│ ├── 5f2b33ee30f9d4.93708272.xml
│ ├── 5f2c31183d6119.64859341.xml
│ ├── 5f2dd3fe2130e3.56895725.xml
│ ├── 5f2ec31ea091c2.42912362.xml
│ ├── 70s_wallpaper.xml
│ ├── CAD Revision cloud.xml
│ ├── Cool_Water_Area.xml
│ ├── Measure.xml
│ ├── Pencil.xml
│ ├── Sharpie.xml
│ ├── ballpoint_pen.xml
│ ├── barb_wire.xml
│ ├── cross_stitch.xml
│ ├── cubes.xml
│ ├── denim.xml
│ ├── dormido_rough.xml
│ ├── mattress.xml
│ ├── organic_blocks.xml
│ ├── panel.xml
│ ├── readme.md
│ ├── rock_crystal.xml
│ └── zipper.xml
└── users.php
/README.md:
--------------------------------------------------------------------------------
1 | # Hub Server
2 |
3 | The Hub Server is a community portal for sharing single file resources for QGIS. It requires minimum effort to share files, and is simple to browse and download the resources to your personal QGIS installation.
4 |
5 | To setup the server you will need a 'LAMP' server (Linux, Apache, MySQL, PHP) or equivalent. There's a separate instruction for how you can setup a server on Ubuntu Linux further down.
6 |
7 | The code you will use on your server (/var/www/hub/) is located in the "source" folder.
8 |
9 | ## Setup Server
10 |
11 | For the development a standard database user is used.
12 |
13 | User: _user_
14 |
15 | Password: _1#Password_
16 |
17 | [Setup server instructions](https://github.com/style-hub/hub-server/blob/master/setup-server.md)
18 |
19 | To create tables in the database, use the _mysql_setup.sql_ script.
20 |
21 | ```
22 | mysql -u user -p < mysql_setup.sql
23 | ```
24 |
25 | Note that uploads of files to the server only works if the folders are set with sufficient permissions to "write". __(Warning)__
26 |
27 | ## Project goals
28 |
29 | Build a web site with hubs that manage community contributed files for style, layout and maybe more.
30 |
31 | The goal is to create a site that requires very little from the contributor and makes it as effortless at possible to download and use the resources.
32 |
33 | Simple to search or browse, preview and download. Form based user contributions with minimal work required.
34 |
35 | There will likely be a need for some contributor verification, but it should be kept at a minimum.
36 |
37 | ## Project todo list
38 |
39 | * Project Structure!
40 | * Style guides?
41 | * Design guides? (How should the code look)
42 | * Landing site
43 | * Multiple hubs
44 | * Similar content and use
45 | * One place to land and get instructions
46 | * Filter and search using PHP
47 | * Probably also database table expansion
48 | * When most is working with the "Style Hub", start on "Layout Hub"
49 |
50 | ## Why not use the Resource Sharing Plugin?
51 |
52 | This is NOT a replacement for the plugin. But it is a way to significantly lower the bar for the majority of ordinary users to contribute, but also find and download the resources. Some resources is definitely not suitable to manage with a "hub" site. And the resources on a hub could easily be pulled to a resource sharing repository and shared that way too.
53 |
54 | ## Contribute to the project
55 |
56 | You can fork and create pull requests as usual for a GitHub project.
57 |
58 | If you want to engage more you can become a developer with direct commit rights.
59 |
60 | (But in that case I guess we need to create more guidelines for the goal of the project.)
61 |
62 | ## Site structure
63 |
64 | In the _root_ folder (source) the main file is _index.php_. All pages, including _index.php_ use the _header.php_ and _footer.php_.
65 |
66 | In the _include_ folder there's mostly pure php files. These manage tasks like updata a database, add a style to the database, upload a file, add a user, etc.
67 |
68 | One important file in _include_ is __db_connect.inc.php__. This is the only place where settings for connecting to the MySQL database needs to be done. All other pages that require the connection "calls" this file with a _require()_ function.
69 |
70 | Each _Hub_ also have a folder attached to it. In this folder are uploaded resources connected to the hub located. In the case of _styles_ there's two sub-folders, _images_ and _resources_. In the _images_ folder preview images are located, and in the _resources_ folder the style-xml files are located. These folders need to have appropriate _rights_ set for the upload to work.
--------------------------------------------------------------------------------
/mysql_setup.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE hub.styles (
2 | id INT(9) NOT NULL PRIMARY KEY AUTO_INCREMENT,
3 | stylename VARCHAR(50) NOT NULL,
4 | stylecreator VARCHAR(50) NOT NULL,
5 | styledescription VARCHAR(512) NOT NULL,
6 | stylexml VARCHAR(255) NOT NULL,
7 | stylepreview VARCHAR(255) NOT NULL,
8 | byuser VARCHAR(50),
9 | ismarker TINYINT(1),
10 | isline TINYINT(1),
11 | isfill TINYINT(1),
12 | isramp TINYINT(1),
13 | istext TINYINT(1),
14 | islabel TINYINT(1),
15 | ispatch TINYINT(1),
16 | popular INT(11)
17 | );
18 |
19 | CREATE TABLE hub.layouts (
20 | id INT(9) NOT NULL PRIMARY KEY AUTO_INCREMENT,
21 | layoutname VARCHAR(50) NOT NULL,
22 | layoutcreator VARCHAR(50) NOT NULL,
23 | layoutdescription VARCHAR(512) NOT NULL,
24 | layoutqpt VARCHAR(255) NOT NULL,
25 | layoutpreview VARCHAR(255) NOT NULL,
26 | byuser VARCHAR(50),
27 | istiny TINYINT(1),
28 | issmall TINYINT(1),
29 | ismedium TINYINT(1),
30 | islarge TINYINT(1),
31 | isscreen TINYINT(1),
32 | iselement TINYINT(1),
33 | popular INT(11)
34 | );
35 |
36 | CREATE TABLE hub.users (
37 | id INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
38 | username VARCHAR(50) NOT NULL,
39 | useremail VARCHAR(100) NOT NULL,
40 | userpwd VARCHAR(255) NOT NULL,
41 | moderator TINYINT(1)
42 | );
43 |
--------------------------------------------------------------------------------
/setup-server.md:
--------------------------------------------------------------------------------
1 | # Setup a server
2 |
3 | Linux-Apache-MySQL-PHP (LAMP)
4 |
5 | ## Install Ubuntu Server
6 |
7 | Include SSH Server
8 |
9 | Update all packages
10 |
11 | ```
12 | sudo apt update && sudo apt upgrade
13 | ```
14 |
15 | Enable Firewall with OpenSSH allowed (if you need to connect to the server using SSH)
16 | ```
17 | sudo ufw allow in "OpenSSH"
18 | sudo ufw enable
19 | ```
20 |
21 | ## Install Apache web server
22 |
23 | ```
24 | sudo apt install apache2
25 | ```
26 |
27 | Open the firewall for testing on port 80 (not for production server)
28 | ```
29 | sudo ufw allow in "Apache"
30 | ```
31 |
32 | Verify firewall
33 | ```
34 | sudo ufw status
35 | ```
36 |
37 | Check the server IP
38 | ```
39 | ip addr
40 | ```
41 |
42 | Verify Apache server running from web browser on the network.
43 | ```
44 | http://[ip address]
45 | ```
46 |
47 | ## Install and setup MySQL
48 | ```
49 | sudo apt install mysql-serve
50 | sudo mysql_secure_installation
51 | ```
52 |
53 | You choose if you want/need the security that is initiated by the seccond command.
54 |
55 | ## Install PHP
56 | ```
57 | sudo apt install php libapache2-mod-php php-mysql
58 | ```
59 |
60 | Verify installation
61 | ```
62 | php -v
63 | ```
64 |
65 | ## Set up a "domain" to work in. Leaving the default for anything else.
66 | ```
67 | sudo mkdir /var/www/hub
68 | sudo chown -R $USER:$USER /var/www/hub
69 | ```
70 |
71 | Configure Apache to find the site
72 | ```
73 | sudo nano /etc/apache2/sites-available/hub.conf
74 | ```
75 |
76 | Add basic setup.
77 | ```
78 |