Compare commits

...

21 Commits

Author SHA1 Message Date
b41d768cca Fix comment creation in archived articles 2019-01-30 21:09:43 +01:00
fa8f50a3d9 Restore blog behavior with three tables 2019-01-30 21:03:48 +01:00
2e2a79ed76 Rename SQL id field in contents 2019-01-30 20:49:32 +01:00
50e8552059 Restore wiki behavior with three tables 2019-01-30 19:49:26 +01:00
55ed7db3c4 Add sequences on new content tables ids 2019-01-30 19:02:09 +01:00
35275d217b Change SQL schema to add more hierarchy in contents: content -> localized -> version 2019-01-29 19:33:57 +01:00
c6d69666bb Fix exampleweb URL with trailing / 2019-01-29 19:33:07 +01:00
leosw
2aa41e692d Fix blog RSS list page 2019-01-23 13:42:34 +01:00
leosw
f215a6cf08 Fix blog list page 2019-01-23 13:32:54 +01:00
2258aa3fe0 Fix blog comment management 2018-11-18 21:59:55 +01:00
f32e528d01 Remove trailing dot in blog/wiki name view page 2018-11-05 22:51:13 +01:00
6356faa9ca Fix blog article deletion/restoration 2018-11-05 22:39:06 +01:00
41c1ea61b6 Fix blog history view 2018-11-05 22:34:48 +01:00
3ad4a6d08e Store author as contributor in wiki/blog 2018-11-05 22:31:20 +01:00
b5115182d5 fix blog edition 2018-11-05 22:29:14 +01:00
7a29f0825f fix blog view page 2018-11-05 22:05:42 +01:00
9aa7498db7 fix blog creation page 2018-11-05 21:35:21 +01:00
7d3a00fd68 Start rewrite model for new article page 2018-11-04 19:01:10 +01:00
1f7a77e0d6 Fix blog view page using new sql scheme 2018-11-04 18:55:48 +01:00
19b5cec9b5 Fix FA in blog edit view 2018-11-04 18:51:54 +01:00
a3d964e9c5 First work on article list 2018-11-04 08:35:56 +01:00
12 changed files with 753 additions and 458 deletions

View File

@ -2,10 +2,8 @@
-- PostgreSQL database dump
--
-- Dumped from database version 10.5
-- Dumped by pg_dump version 10.5
-- Started on 2018-10-17 20:33:22 CEST
-- Dumped from database version 11.1
-- Dumped by pg_dump version 11.1
SET statement_timeout = 0;
SET lock_timeout = 0;
@ -18,7 +16,6 @@ SET client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 7 (class 2615 OID 17905)
-- Name: topology; Type: SCHEMA; Schema: -; Owner: kabano
--
@ -28,8 +25,6 @@ CREATE SCHEMA topology;
ALTER SCHEMA topology OWNER TO kabano;
--
-- TOC entry 3890 (class 0 OID 0)
-- Dependencies: 7
-- Name: SCHEMA topology; Type: COMMENT; Schema: -; Owner: kabano
--
@ -37,24 +32,6 @@ COMMENT ON SCHEMA topology IS 'PostGIS Topology schema';
--
-- TOC entry 1 (class 3079 OID 12281)
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- TOC entry 3891 (class 0 OID 0)
-- Dependencies: 1
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- TOC entry 3 (class 3079 OID 16398)
-- Name: postgis; Type: EXTENSION; Schema: -; Owner:
--
@ -62,8 +39,6 @@ CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
--
-- TOC entry 3892 (class 0 OID 0)
-- Dependencies: 3
-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner:
--
@ -71,7 +46,6 @@ COMMENT ON EXTENSION postgis IS 'PostGIS geometry, geography, and raster spatial
--
-- TOC entry 2 (class 3079 OID 17906)
-- Name: postgis_topology; Type: EXTENSION; Schema: -; Owner:
--
@ -79,8 +53,6 @@ CREATE EXTENSION IF NOT EXISTS postgis_topology WITH SCHEMA topology;
--
-- TOC entry 3893 (class 0 OID 0)
-- Dependencies: 2
-- Name: EXTENSION postgis_topology; Type: COMMENT; Schema: -; Owner:
--
@ -88,7 +60,6 @@ COMMENT ON EXTENSION postgis_topology IS 'PostGIS topology spatial types and fun
--
-- TOC entry 2036 (class 1247 OID 18254)
-- Name: content_type_enum; Type: TYPE; Schema: public; Owner: kabano
--
@ -102,7 +73,6 @@ CREATE TYPE public.content_type_enum AS ENUM (
ALTER TYPE public.content_type_enum OWNER TO kabano;
--
-- TOC entry 2021 (class 1247 OID 18166)
-- Name: poi_key_enum; Type: TYPE; Schema: public; Owner: kabano
--
@ -115,7 +85,6 @@ CREATE TYPE public.poi_key_enum AS ENUM (
ALTER TYPE public.poi_key_enum OWNER TO kabano;
--
-- TOC entry 2007 (class 1247 OID 18088)
-- Name: poi_type_enum; Type: TYPE; Schema: public; Owner: kabano
--
@ -132,7 +101,6 @@ CREATE TYPE public.poi_type_enum AS ENUM (
ALTER TYPE public.poi_type_enum OWNER TO kabano;
--
-- TOC entry 2001 (class 1247 OID 18057)
-- Name: user_rank_enum; Type: TYPE; Schema: public; Owner: kabano
--
@ -149,7 +117,6 @@ CREATE TYPE public.user_rank_enum AS ENUM (
ALTER TYPE public.user_rank_enum OWNER TO kabano;
--
-- TOC entry 237 (class 1259 OID 18332)
-- Name: content_comments_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
@ -168,13 +135,11 @@ SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 229 (class 1259 OID 18288)
-- Name: content_comments; Type: TABLE; Schema: public; Owner: kabano
--
CREATE TABLE public.content_comments (
id integer DEFAULT nextval('public.content_comments_sequence'::regclass) NOT NULL,
permalink character varying(255),
version integer,
creation_date timestamp without time zone,
update_date timestamp without time zone,
@ -190,7 +155,6 @@ CREATE TABLE public.content_comments (
ALTER TABLE public.content_comments OWNER TO kabano;
--
-- TOC entry 236 (class 1259 OID 18330)
-- Name: content_contributors_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
@ -205,7 +169,6 @@ CREATE SEQUENCE public.content_contributors_sequence
ALTER TABLE public.content_contributors_sequence OWNER TO kabano;
--
-- TOC entry 228 (class 1259 OID 18271)
-- Name: content_contributors; Type: TABLE; Schema: public; Owner: kabano
--
@ -219,7 +182,65 @@ CREATE TABLE public.content_contributors (
ALTER TABLE public.content_contributors OWNER TO kabano;
--
-- TOC entry 235 (class 1259 OID 18328)
-- Name: content_locales_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
CREATE SEQUENCE public.content_locales_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.content_locales_sequence OWNER TO kabano;
--
-- Name: content_locales; Type: TABLE; Schema: public; Owner: kabano
--
CREATE TABLE public.content_locales (
id integer DEFAULT nextval('public.content_locales_sequence'::regclass) NOT NULL,
content_id integer NOT NULL,
locale character varying(32) NOT NULL,
author integer NOT NULL
);
ALTER TABLE public.content_locales OWNER TO kabano;
--
-- Name: content_versions_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
CREATE SEQUENCE public.content_versions_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.content_versions_sequence OWNER TO kabano;
--
-- Name: content_versions; Type: TABLE; Schema: public; Owner: kabano
--
CREATE TABLE public.content_versions (
id integer DEFAULT nextval('public.content_versions_sequence'::regclass) NOT NULL,
version integer DEFAULT 0 NOT NULL,
update_date timestamp without time zone NOT NULL,
is_archive boolean DEFAULT false NOT NULL,
name character varying(255),
content text,
locale_id integer NOT NULL
);
ALTER TABLE public.content_versions OWNER TO kabano;
--
-- Name: contents_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
@ -234,31 +255,22 @@ CREATE SEQUENCE public.contents_sequence
ALTER TABLE public.contents_sequence OWNER TO kabano;
--
-- TOC entry 227 (class 1259 OID 18230)
-- Name: contents; Type: TABLE; Schema: public; Owner: kabano
--
CREATE TABLE public.contents (
id integer DEFAULT nextval('public.contents_sequence'::regclass) NOT NULL,
permalink character varying(255) NOT NULL,
version integer DEFAULT 0 NOT NULL,
locale character varying(32) NOT NULL,
creation_date timestamp without time zone NOT NULL,
update_date timestamp without time zone NOT NULL,
author integer NOT NULL,
is_public boolean DEFAULT true NOT NULL,
is_archive boolean DEFAULT false NOT NULL,
is_commentable boolean DEFAULT true NOT NULL,
type public.content_type_enum NOT NULL,
name character varying(255),
content text
type public.content_type_enum NOT NULL
);
ALTER TABLE public.contents OWNER TO kabano;
--
-- TOC entry 221 (class 1259 OID 18067)
-- Name: locales; Type: TABLE; Schema: public; Owner: kabano
--
@ -272,7 +284,6 @@ CREATE TABLE public.locales (
ALTER TABLE public.locales OWNER TO kabano;
--
-- TOC entry 234 (class 1259 OID 18326)
-- Name: poi_comments_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
@ -287,7 +298,6 @@ CREATE SEQUENCE public.poi_comments_sequence
ALTER TABLE public.poi_comments_sequence OWNER TO kabano;
--
-- TOC entry 226 (class 1259 OID 18203)
-- Name: poi_comments; Type: TABLE; Schema: public; Owner: kabano
--
@ -309,7 +319,6 @@ CREATE TABLE public.poi_comments (
ALTER TABLE public.poi_comments OWNER TO kabano;
--
-- TOC entry 233 (class 1259 OID 18324)
-- Name: poi_contributors_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
@ -324,7 +333,6 @@ CREATE SEQUENCE public.poi_contributors_sequence
ALTER TABLE public.poi_contributors_sequence OWNER TO kabano;
--
-- TOC entry 225 (class 1259 OID 18186)
-- Name: poi_contributors; Type: TABLE; Schema: public; Owner: kabano
--
@ -338,7 +346,6 @@ CREATE TABLE public.poi_contributors (
ALTER TABLE public.poi_contributors OWNER TO kabano;
--
-- TOC entry 232 (class 1259 OID 18322)
-- Name: poi_localised_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
@ -353,7 +360,6 @@ CREATE SEQUENCE public.poi_localised_sequence
ALTER TABLE public.poi_localised_sequence OWNER TO kabano;
--
-- TOC entry 224 (class 1259 OID 18160)
-- Name: poi_localised; Type: TABLE; Schema: public; Owner: kabano
--
@ -369,7 +375,6 @@ CREATE TABLE public.poi_localised (
ALTER TABLE public.poi_localised OWNER TO kabano;
--
-- TOC entry 222 (class 1259 OID 18109)
-- Name: poi_sources; Type: TABLE; Schema: public; Owner: kabano
--
@ -386,7 +391,6 @@ CREATE TABLE public.poi_sources (
ALTER TABLE public.poi_sources OWNER TO kabano;
--
-- TOC entry 231 (class 1259 OID 18320)
-- Name: pois_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
@ -401,7 +405,6 @@ CREATE SEQUENCE public.pois_sequence
ALTER TABLE public.pois_sequence OWNER TO kabano;
--
-- TOC entry 223 (class 1259 OID 18119)
-- Name: pois; Type: TABLE; Schema: public; Owner: kabano
--
@ -428,7 +431,6 @@ CREATE TABLE public.pois (
ALTER TABLE public.pois OWNER TO kabano;
--
-- TOC entry 230 (class 1259 OID 18317)
-- Name: users_id_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
@ -443,7 +445,6 @@ CREATE SEQUENCE public.users_id_sequence
ALTER TABLE public.users_id_sequence OWNER TO kabano;
--
-- TOC entry 220 (class 1259 OID 18047)
-- Name: users; Type: TABLE; Schema: public; Owner: kabano
--
@ -467,16 +468,209 @@ CREATE TABLE public.users (
ALTER TABLE public.users OWNER TO kabano;
--
-- TOC entry 3717 (class 2606 OID 18297)
-- Name: content_comments content_comments_permalink_version_key; Type: CONSTRAINT; Schema: public; Owner: kabano
-- Data for Name: content_comments; Type: TABLE DATA; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.content_comments
ADD CONSTRAINT content_comments_permalink_version_key UNIQUE (permalink, version);
COPY public.content_comments (id, version, creation_date, update_date, author, is_public, is_archive, content, comment, locale) FROM stdin;
\.
--
-- Data for Name: content_contributors; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.content_contributors (id, content, contributor) FROM stdin;
31 1 1
32 2 1
\.
--
-- Data for Name: content_locales; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.content_locales (id, content_id, locale, author) FROM stdin;
1 29 fr_FR 1
2 32 fr_FR 1
\.
--
-- Data for Name: content_versions; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.content_versions (id, version, update_date, is_archive, name, content, locale_id) FROM stdin;
2 0 2019-01-30 18:33:36 f Ceci est un test héhé Encore 2
1 0 2019-01-30 18:10:51 t 404 Erreur 404 1
3 1 2019-01-30 18:47:44 t 404 Erreur 404s 1
4 2 2019-01-30 18:48:51 f 404 Erreur 404sd 1
\.
--
-- Data for Name: contents; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.contents (id, permalink, creation_date, is_public, is_commentable, type) FROM stdin;
32 403 2019-01-30 18:33:36 t f wiki
29 404 2019-01-30 18:10:51 t f wiki
\.
--
-- Data for Name: locales; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.locales (name, display_name, flag_name) FROM stdin;
fr_FR Français fr
\.
--
-- Data for Name: poi_comments; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.poi_comments (id, permalink, version, creation_date, update_date, author, is_public, is_archive, poi, comment, locale) FROM stdin;
\.
--
-- Data for Name: poi_contributors; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.poi_contributors (id, poi, contributor) FROM stdin;
\.
--
-- Data for Name: poi_localised; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.poi_localised (id, poi, locale, key, value) FROM stdin;
\.
--
-- Data for Name: poi_sources; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.poi_sources (id, display_name, icon_name, website, license_name, license_url) FROM stdin;
\.
--
-- Data for Name: pois; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.pois (id, permalink, version, creation_date, update_date, author, is_public, is_archive, type, is_detroyed, name, alt_names, source, source_id, "position", parameters) FROM stdin;
\.
--
-- Data for Name: spatial_ref_sys; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text) FROM stdin;
\.
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: kabano
--
COPY public.users (id, name, version, email, password, website, is_avatar_present, is_archive, rank, locale, timezone, visit_date, register_date) FROM stdin;
4 leosw2 0 leo@leo.fr b36982d19ecde5eabbd83f964c6fe560050fe4bd f f moderator fr_FR CEST 2018-11-04 07:12:11 2018-10-17 18:14:11
1 leosw 1 leo@lstronic.com b36982d19ecde5eabbd83f964c6fe560050fe4bd https://lstronic.com t f administrator fr_FR CEST 2019-01-30 18:49:01 2018-09-03 21:27:13
\.
--
-- Data for Name: topology; Type: TABLE DATA; Schema: topology; Owner: kabano
--
COPY topology.topology (id, name, srid, "precision", hasz) FROM stdin;
\.
--
-- Data for Name: layer; Type: TABLE DATA; Schema: topology; Owner: kabano
--
COPY topology.layer (topology_id, layer_id, schema_name, table_name, feature_column, feature_type, level, child_id) FROM stdin;
\.
--
-- Name: content_comments_sequence; Type: SEQUENCE SET; Schema: public; Owner: kabano
--
SELECT pg_catalog.setval('public.content_comments_sequence', 3, true);
--
-- Name: content_contributors_sequence; Type: SEQUENCE SET; Schema: public; Owner: kabano
--
SELECT pg_catalog.setval('public.content_contributors_sequence', 34, true);
--
-- Name: content_locales_sequence; Type: SEQUENCE SET; Schema: public; Owner: kabano
--
SELECT pg_catalog.setval('public.content_locales_sequence', 2, true);
--
-- Name: content_versions_sequence; Type: SEQUENCE SET; Schema: public; Owner: kabano
--
SELECT pg_catalog.setval('public.content_versions_sequence', 4, true);
--
-- Name: contents_sequence; Type: SEQUENCE SET; Schema: public; Owner: kabano
--
SELECT pg_catalog.setval('public.contents_sequence', 32, true);
--
-- Name: poi_comments_sequence; Type: SEQUENCE SET; Schema: public; Owner: kabano
--
SELECT pg_catalog.setval('public.poi_comments_sequence', 1, false);
--
-- Name: poi_contributors_sequence; Type: SEQUENCE SET; Schema: public; Owner: kabano
--
SELECT pg_catalog.setval('public.poi_contributors_sequence', 1, false);
--
-- Name: poi_localised_sequence; Type: SEQUENCE SET; Schema: public; Owner: kabano
--
SELECT pg_catalog.setval('public.poi_localised_sequence', 1, false);
--
-- Name: pois_sequence; Type: SEQUENCE SET; Schema: public; Owner: kabano
--
SELECT pg_catalog.setval('public.pois_sequence', 1, false);
--
-- Name: users_id_sequence; Type: SEQUENCE SET; Schema: public; Owner: kabano
--
SELECT pg_catalog.setval('public.users_id_sequence', 4, true);
--
-- TOC entry 3719 (class 2606 OID 18295)
-- Name: content_comments content_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -485,7 +679,6 @@ ALTER TABLE ONLY public.content_comments
--
-- TOC entry 3711 (class 2606 OID 18275)
-- Name: content_contributors content_contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -494,7 +687,6 @@ ALTER TABLE ONLY public.content_contributors
--
-- TOC entry 3713 (class 2606 OID 18277)
-- Name: content_contributors content_contributors_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -503,16 +695,46 @@ ALTER TABLE ONLY public.content_contributors
--
-- TOC entry 3707 (class 2606 OID 18262)
-- Name: contents contents_permalink_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- Name: content_locales content_locales_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.content_locales
ADD CONSTRAINT content_locales_pkey PRIMARY KEY (id);
--
-- Name: content_locales content_locales_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.content_locales
ADD CONSTRAINT content_locales_unique UNIQUE (content_id, locale);
--
-- Name: content_versions content_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.content_versions
ADD CONSTRAINT content_versions_pkey PRIMARY KEY (id);
--
-- Name: content_versions content_versions_version_locale_key; Type: CONSTRAINT; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.content_versions
ADD CONSTRAINT content_versions_version_locale_key UNIQUE (version, locale_id);
--
-- Name: contents contents_permalink_type_key; Type: CONSTRAINT; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.contents
ADD CONSTRAINT contents_permalink_unique UNIQUE (permalink, version, locale);
ADD CONSTRAINT contents_permalink_type_key UNIQUE (permalink, type);
--
-- TOC entry 3709 (class 2606 OID 18238)
-- Name: contents contents_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -521,7 +743,6 @@ ALTER TABLE ONLY public.contents
--
-- TOC entry 3673 (class 2606 OID 18073)
-- Name: locales locales_display_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -530,7 +751,6 @@ ALTER TABLE ONLY public.locales
--
-- TOC entry 3675 (class 2606 OID 18075)
-- Name: locales locales_flag_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -539,7 +759,6 @@ ALTER TABLE ONLY public.locales
--
-- TOC entry 3677 (class 2606 OID 18071)
-- Name: locales locales_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -548,7 +767,6 @@ ALTER TABLE ONLY public.locales
--
-- TOC entry 3701 (class 2606 OID 18212)
-- Name: poi_comments poi_comments_permalink_version_key; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -557,7 +775,6 @@ ALTER TABLE ONLY public.poi_comments
--
-- TOC entry 3703 (class 2606 OID 18210)
-- Name: poi_comments poi_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -566,7 +783,6 @@ ALTER TABLE ONLY public.poi_comments
--
-- TOC entry 3695 (class 2606 OID 18190)
-- Name: poi_contributors poi_contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -575,7 +791,6 @@ ALTER TABLE ONLY public.poi_contributors
--
-- TOC entry 3697 (class 2606 OID 18192)
-- Name: poi_contributors poi_contributors_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -584,7 +799,6 @@ ALTER TABLE ONLY public.poi_contributors
--
-- TOC entry 3691 (class 2606 OID 18164)
-- Name: poi_localised poi_localised_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -593,7 +807,6 @@ ALTER TABLE ONLY public.poi_localised
--
-- TOC entry 3693 (class 2606 OID 18185)
-- Name: poi_localised poi_localised_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -602,7 +815,6 @@ ALTER TABLE ONLY public.poi_localised
--
-- TOC entry 3679 (class 2606 OID 18118)
-- Name: poi_sources poi_sources_display_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -611,7 +823,6 @@ ALTER TABLE ONLY public.poi_sources
--
-- TOC entry 3681 (class 2606 OID 18116)
-- Name: poi_sources poi_sources_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -620,7 +831,6 @@ ALTER TABLE ONLY public.poi_sources
--
-- TOC entry 3686 (class 2606 OID 18145)
-- Name: pois pois_permalink_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -629,7 +839,6 @@ ALTER TABLE ONLY public.pois
--
-- TOC entry 3688 (class 2606 OID 18124)
-- Name: pois pois_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -638,7 +847,6 @@ ALTER TABLE ONLY public.pois
--
-- TOC entry 3665 (class 2606 OID 18079)
-- Name: users users_email_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -647,7 +855,6 @@ ALTER TABLE ONLY public.users
--
-- TOC entry 3668 (class 2606 OID 18077)
-- Name: users users_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -656,7 +863,6 @@ ALTER TABLE ONLY public.users
--
-- TOC entry 3670 (class 2606 OID 18055)
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
--
@ -665,7 +871,6 @@ ALTER TABLE ONLY public.users
--
-- TOC entry 3714 (class 1259 OID 18313)
-- Name: content_comments_is_archive_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -673,7 +878,6 @@ CREATE INDEX content_comments_is_archive_index ON public.content_comments USING
--
-- TOC entry 3715 (class 1259 OID 18314)
-- Name: content_comments_is_public_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -681,15 +885,6 @@ CREATE INDEX content_comments_is_public_index ON public.content_comments USING b
--
-- TOC entry 3704 (class 1259 OID 18251)
-- Name: contents_is_archive_index; Type: INDEX; Schema: public; Owner: kabano
--
CREATE INDEX contents_is_archive_index ON public.contents USING btree (is_archive);
--
-- TOC entry 3705 (class 1259 OID 18252)
-- Name: contents_is_public_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -697,7 +892,20 @@ CREATE INDEX contents_is_public_index ON public.contents USING btree (is_public)
--
-- TOC entry 3698 (class 1259 OID 18229)
-- Name: fki_content_contributors_content_fkey; Type: INDEX; Schema: public; Owner: kabano
--
CREATE INDEX fki_content_contributors_content_fkey ON public.content_contributors USING btree (content);
--
-- Name: fki_content_contributors_contributor_fkey; Type: INDEX; Schema: public; Owner: kabano
--
CREATE INDEX fki_content_contributors_contributor_fkey ON public.content_contributors USING btree (contributor);
--
-- Name: poi_comments_is_archive_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -705,7 +913,6 @@ CREATE INDEX poi_comments_is_archive_index ON public.poi_comments USING btree (i
--
-- TOC entry 3699 (class 1259 OID 18228)
-- Name: poi_comments_is_public_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -713,7 +920,6 @@ CREATE INDEX poi_comments_is_public_index ON public.poi_comments USING btree (is
--
-- TOC entry 3682 (class 1259 OID 18157)
-- Name: pois_is_archive_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -721,7 +927,6 @@ CREATE INDEX pois_is_archive_index ON public.pois USING btree (is_archive);
--
-- TOC entry 3683 (class 1259 OID 18159)
-- Name: pois_is_destroyed_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -729,7 +934,6 @@ CREATE INDEX pois_is_destroyed_index ON public.pois USING btree (is_detroyed);
--
-- TOC entry 3684 (class 1259 OID 18156)
-- Name: pois_is_public_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -737,7 +941,6 @@ CREATE INDEX pois_is_public_index ON public.pois USING btree (is_public);
--
-- TOC entry 3689 (class 1259 OID 18158)
-- Name: pois_type_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -745,7 +948,6 @@ CREATE INDEX pois_type_index ON public.pois USING btree (type);
--
-- TOC entry 3666 (class 1259 OID 18080)
-- Name: users_is_archive_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -753,7 +955,6 @@ CREATE INDEX users_is_archive_index ON public.users USING btree (is_archive);
--
-- TOC entry 3671 (class 1259 OID 18081)
-- Name: users_register_date_index; Type: INDEX; Schema: public; Owner: kabano
--
@ -761,7 +962,6 @@ CREATE INDEX users_register_date_index ON public.users USING btree (register_dat
--
-- TOC entry 3734 (class 2606 OID 18298)
-- Name: content_comments content_comments_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -770,7 +970,6 @@ ALTER TABLE ONLY public.content_comments
--
-- TOC entry 3736 (class 2606 OID 18308)
-- Name: content_comments content_comments_content_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -779,7 +978,6 @@ ALTER TABLE ONLY public.content_comments
--
-- TOC entry 3735 (class 2606 OID 18303)
-- Name: content_comments content_comments_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -788,16 +986,14 @@ ALTER TABLE ONLY public.content_comments
--
-- TOC entry 3733 (class 2606 OID 18283)
-- Name: content_contributors content_contributors_content_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.content_contributors
ADD CONSTRAINT content_contributors_content_fkey FOREIGN KEY (content) REFERENCES public.contents(id);
ADD CONSTRAINT content_contributors_content_fkey FOREIGN KEY (content) REFERENCES public.content_locales(id);
--
-- TOC entry 3732 (class 2606 OID 18278)
-- Name: content_contributors content_contributors_contributor_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -806,25 +1002,38 @@ ALTER TABLE ONLY public.content_contributors
--
-- TOC entry 3730 (class 2606 OID 18241)
-- Name: contents contents_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- Name: content_locales content_locales_author; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.contents
ADD CONSTRAINT contents_author_fkey FOREIGN KEY (author) REFERENCES public.users(id);
ALTER TABLE ONLY public.content_locales
ADD CONSTRAINT content_locales_author FOREIGN KEY (author) REFERENCES public.users(id);
--
-- TOC entry 3731 (class 2606 OID 18263)
-- Name: contents contents_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- Name: content_locales content_locales_content; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.contents
ADD CONSTRAINT contents_locale_fkey FOREIGN KEY (locale) REFERENCES public.locales(name);
ALTER TABLE ONLY public.content_locales
ADD CONSTRAINT content_locales_content FOREIGN KEY (content_id) REFERENCES public.contents(id);
--
-- Name: content_locales content_locales_locale; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.content_locales
ADD CONSTRAINT content_locales_locale FOREIGN KEY (locale) REFERENCES public.locales(name);
--
-- Name: content_versions content_versions_locale; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
ALTER TABLE ONLY public.content_versions
ADD CONSTRAINT content_versions_locale FOREIGN KEY (locale_id) REFERENCES public.content_locales(id);
--
-- TOC entry 3727 (class 2606 OID 18213)
-- Name: poi_comments poi_comments_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -833,7 +1042,6 @@ ALTER TABLE ONLY public.poi_comments
--
-- TOC entry 3728 (class 2606 OID 18218)
-- Name: poi_comments poi_comments_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -842,7 +1050,6 @@ ALTER TABLE ONLY public.poi_comments
--
-- TOC entry 3729 (class 2606 OID 18223)
-- Name: poi_comments poi_comments_poi_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -851,7 +1058,6 @@ ALTER TABLE ONLY public.poi_comments
--
-- TOC entry 3725 (class 2606 OID 18193)
-- Name: poi_contributors poi_contributors_contributor_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -860,7 +1066,6 @@ ALTER TABLE ONLY public.poi_contributors
--
-- TOC entry 3726 (class 2606 OID 18198)
-- Name: poi_contributors poi_contributors_poi_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -869,7 +1074,6 @@ ALTER TABLE ONLY public.poi_contributors
--
-- TOC entry 3724 (class 2606 OID 18179)
-- Name: poi_localised poi_localised_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -878,7 +1082,6 @@ ALTER TABLE ONLY public.poi_localised
--
-- TOC entry 3723 (class 2606 OID 18174)
-- Name: poi_localised poi_localised_poi_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -887,7 +1090,6 @@ ALTER TABLE ONLY public.poi_localised
--
-- TOC entry 3721 (class 2606 OID 18146)
-- Name: pois pois_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -896,7 +1098,6 @@ ALTER TABLE ONLY public.pois
--
-- TOC entry 3722 (class 2606 OID 18151)
-- Name: pois pois_source_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -905,7 +1106,6 @@ ALTER TABLE ONLY public.pois
--
-- TOC entry 3720 (class 2606 OID 18082)
-- Name: users users_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
--
@ -913,7 +1113,25 @@ ALTER TABLE ONLY public.users
ADD CONSTRAINT users_locale_fkey FOREIGN KEY (locale) REFERENCES public.locales(name);
-- Completed on 2018-10-17 20:33:23 CEST
--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: kabano
--
REVOKE ALL ON SCHEMA public FROM postgres;
REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO PUBLIC;
GRANT ALL ON SCHEMA public TO kabano;
--
-- Name: TABLE spatial_ref_sys; Type: ACL; Schema: public; Owner: kabano
--
REVOKE ALL ON TABLE public.spatial_ref_sys FROM postgres;
REVOKE SELECT ON TABLE public.spatial_ref_sys FROM PUBLIC;
GRANT ALL ON TABLE public.spatial_ref_sys TO kabano;
GRANT SELECT ON TABLE public.spatial_ref_sys TO PUBLIC;
--
-- PostgreSQL database dump complete

View File

@ -31,25 +31,21 @@ switch ($controller->splitted_url[1]) {
case "list":
$blogArticles = new Kabano\BlogArticles();
$blogArticles->number(($user->role >= 600));
$blogArticles->number(($user->rankIsHigher("premium")));
// In case the wanted page is too big
if($articles_per_pages * $page >= $blogArticles->number)
$page = 0;
$blogArticles->listArticles($page*$articles_per_pages,$articles_per_pages,($user->role >= 600));
$blogArticles->listArticles($page*$articles_per_pages,$articles_per_pages,($user->rankIsHigher("premium")));
$i = 0;
$blogArticles_list = array();
foreach ($blogArticles->ids as $row) {
$blogArticles_list[$i] = new Kabano\BlogArticle();
$blogArticles_list[$i]->id = $row;
$blogArticles_list[$i]->populate();
$blogArticles_list[$i]->md2txt();
foreach ($blogArticles->objs as $row) {
$row->md2txt();
$tempUser = new Kabano\User();
$tempUser->id = $blogArticles_list[$i]->author;
$tempUser->populate();
$blogArticles_list[$i]->author_name = $tempUser->name;
$tempUser->checkId($row->author);
$row->author_name = $tempUser->name;
unset($tempUser);
$i++;
}
@ -64,79 +60,80 @@ switch ($controller->splitted_url[1]) {
}
break;
case "new":
if($user->role >= 800) {
if($user->rankIsHigher("moderator")) {
if(isset($_POST['submit'])) {
$blogArticle->content = $_POST['content'];
$blogArticle->locale = $_POST['locale'];
$blogArticle->title = $_POST['title'];
$blogArticle->comments = isset($_POST['comments'])?'t':'f';
$blogArticle->name = $_POST['name'];
$blogArticle->is_commentable = isset($_POST['is_commentable'])?'t':'f';
$blogArticle->author = $user->id;
if(!$blogArticle->checkUrl($_POST['url'],1)) {
if(!$blogArticle->checkPermalink($_POST['permalink'],1)) {
$blogArticle->permalink = $_POST['permalink'];
$blogArticle->insert();
header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->url);
header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink);
}
else {
$head['title'] = $blogArticle->title;
$error = "url";
$new = 1;
include ($config['views_folder']."d.blog.edit.html");
$head['title'] = $blogArticle->name;
$error = "permalink";
}
}
else {
$head['title'] = "Nouvel article";
$new = 1;
include ($config['views_folder']."d.blog.edit.html");
}
$locales = new Kabano\Locales();
$locales->getAll();
$new = 1;
include ($config['views_folder']."d.blog.edit.html");
break;
}
default:
// If the page exists
if ($blogArticle->checkUrl($controller->splitted_url[1],$user->role >= 600)) {
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "delete" && $user->role >= 800) {
if ($blogArticle->checkPermalink($controller->splitted_url[1],$user->rankIsHigher("premium"))) {
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "delete" && $user->rankIsHigher("moderator")) {
$blogArticle->delete();
header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->url);
header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink);
}
else if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "edit" && $user->role >= 800) {
else if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "restore" && $user->rankIsHigher("moderator")) {
$blogArticle->restore();
header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink);
}
else if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "edit" && $user->rankIsHigher("moderator")) {
if(isset($_POST['submit'])) {
$blogArticle->content = $_POST['content'];
$blogArticle->locale = $_POST['locale'];
$blogArticle->title = $_POST['title'];
$blogArticle->comments = isset($_POST['comments'])?'t':'f';
$blogArticle->name = $_POST['name'];
$blogArticle->is_commentable = isset($_POST['is_commentable'])?'t':'f';
$blogArticle->author = $user->id;
$blogArticle->update();
header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->url);
header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink);
}
else {
$blogArticle->populate();
$head['title'] = $blogArticle->title;
$locales = new Kabano\Locales();
$locales->getAll();
$head['title'] = $blogArticle->name;
include ($config['views_folder']."d.blog.edit.html");
}
}
else {
// Manage history of an article
if($user->role >= 600) {
$blogArticles_history = new Kabano\BlogArticles();
$blogArticles_history->getHistory($controller->splitted_url[1]);
$i = 0;
foreach ($blogArticles_history->ids as $row) {
$blogArticles_history_list[$i] = new Kabano\BlogArticle();
$blogArticles_history_list[$i]->id = $row;
$blogArticles_history_list[$i]->populate();
$i++;
}
if($user->rankIsHigher("premium")) {
$blogHistory = new Kabano\BlogArticles();
$blogHistory->getHistory($controller->splitted_url[1]);
}
if (isset($controller->splitted_url[2]) && is_numeric($controller->splitted_url[2]))
$blogArticle->checkUrl($controller->splitted_url[1],$user->role>=600,$controller->splitted_url[2]);
$blogArticle->checkPermalink($controller->splitted_url[1],$user->rankIsHigher("premium"),$controller->splitted_url[2]);
// Manage comment creation
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="new_comment") {
if (isset($_POST['submit']) && $user->role > 0) {
if (isset($_POST['submit']) && $user->rankIsHigher("registered")) {
$blogComment = new Kabano\BlogComment();
$blogComment->locale = $user->locale;
$blogComment->author = $user->id;
$blogComment->article = $blogArticle->id;
$blogComment->content = $_POST['comment'];
$blogComment->content = $blogArticle->content_id;
$blogComment->comment = $_POST['comment'];
$blogComment->insert();
}
}
@ -145,53 +142,44 @@ switch ($controller->splitted_url[1]) {
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="delete_comment") {
if (isset($controller->splitted_url[3]) && is_numeric($controller->splitted_url[3])) {
$blogComment = new Kabano\BlogComment();
$blogComment->id = $controller->splitted_url[3];
$blogComment->populate();
if ($user->role >= 800 || $user->id == $blogComment->author)
$blogComment->delete();
if($blogComment->checkId($controller->splitted_url[3]))
if ($user->rankIsHigher("moderator") || $user->id == $blogComment->author)
$blogComment->delete();
}
}
// Manage comment undeletion
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="undelete_comment") {
// Manage comment restoration
if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="restore_comment") {
if (isset($controller->splitted_url[3]) && is_numeric($controller->splitted_url[3])) {
$blogComment = new Kabano\BlogComment();
$blogComment->id = $controller->splitted_url[3];
$blogComment->populate();
if ($user->role >= 800 || $user->id == $blogComment->author)
$blogComment->undelete();
if($blogComment->checkId($controller->splitted_url[3]))
if ($user->rankIsHigher("moderator") || $user->id == $blogComment->author)
$blogComment->restore();
}
}
$blogArticle->populate();
$blogArticle->md2html();
// Manage comments
if ($blogArticle->comments == "t") {
if ($blogArticle->is_commentable == "t") {
$blogArticles_comments = new Kabano\BlogComments();
$blogArticles_comments->listComments($blogArticle->id, ($user->role>400));
$blogArticles_comments->listComments($blogArticle->content_id, ($user->rankIsHigher("premium")));
$i = 0;
foreach ($blogArticles_comments->ids as $row) {
$blogArticles_comments_list[$i] = new Kabano\BlogComment();
$blogArticles_comments_list[$i]->id = $row;
$blogArticles_comments_list[$i]->populate();
$blogArticles_comments_list[$i]->md2html();
$blogArticles_comments_list[$i]->author_obj = new Kabano\User();
$blogArticles_comments_list[$i]->author_obj->id = $blogArticles_comments_list[$i]->author;
$blogArticles_comments_list[$i]->author_obj->populate();
$i++;
foreach ($blogArticles_comments->objs as $comment) {
$comment->md2html();
$comment->author_obj = new Kabano\User();
$comment->author_obj->checkId($comment->author);
}
}
$tempUser = new Kabano\User();
$tempUser->id = $blogArticle->author;
$tempUser->populate();
$tempUser->checkId($blogArticle->author);
$blogArticle->author_name = $tempUser->name;
unset($tempUser);
$head['title'] = $blogArticle->title;
$head['title'] = $blogArticle->name;
include ($config['views_folder']."d.blog.view.html");
}
}

View File

@ -15,6 +15,7 @@ $config['include_folder']=basename(__DIR__);
$config['abs_root_folder']=str_replace($config['include_folder'],"",__DIR__);
// This is the relative folder to the root of the website from the DocumentRoot (can also be called subfolder)
$config['rel_root_folder']=str_replace($_SERVER['DOCUMENT_ROOT'],"",$config['abs_root_folder']);
$config['web_root_folder']="kabano.test/";
if($config['rel_root_folder']=="") $config['rel_root_folder']="/";
// Here all the absolute paths to specific folders

View File

@ -14,46 +14,50 @@ require_once($config['third_folder']."Md/MarkdownExtra.inc.php");
class BlogArticle
{
public $id = 0;
public $title = NULL;
public $url = NULL;
public $content_id = NULL;
public $locale_id = NULL;
public $version_id = NULL;
public $permalink = NULL;
public $version = 0;
public $locale = NULL;
public $lastedit = NULL;
public $archive = NULL;
public $content = NULL;
public $creation_date = NULL;
public $update_date = NULL;
public $author = NULL;
public $comments = NULL;
public $is_public = NULL;
public $is_archive = NULL;
public $is_commentable = NULL;
public $type = "blog";
public $name = NULL;
public $content = NULL;
/*****
** Checks if a page at this URL exists and return the ID
*****/
public function checkUrl($url, $withArchive=0, $elementNb=0) {