Compare commits

...

2 Commits

Author SHA1 Message Date
leosw
dffe207d0f Fix user signin upgrading DB model 2018-10-17 20:40:07 +02:00
leosw
f4568fc66e Fix PHP for user signin, missing default IDs in SQL 2018-10-16 23:30:47 +02:00
3 changed files with 219 additions and 89 deletions

View File

@@ -5,7 +5,7 @@
-- Dumped from database version 10.5 -- Dumped from database version 10.5
-- Dumped by pg_dump version 10.5 -- Dumped by pg_dump version 10.5
-- Started on 2018-08-20 19:41:09 CEST -- Started on 2018-10-17 20:33:22 CEST
SET statement_timeout = 0; SET statement_timeout = 0;
SET lock_timeout = 0; SET lock_timeout = 0;
@@ -28,7 +28,7 @@ CREATE SCHEMA topology;
ALTER SCHEMA topology OWNER TO postgres; ALTER SCHEMA topology OWNER TO postgres;
-- --
-- TOC entry 3822 (class 0 OID 0) -- TOC entry 3890 (class 0 OID 0)
-- Dependencies: 7 -- Dependencies: 7
-- Name: SCHEMA topology; Type: COMMENT; Schema: -; Owner: postgres -- Name: SCHEMA topology; Type: COMMENT; Schema: -; Owner: postgres
-- --
@@ -45,7 +45,7 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
-- --
-- TOC entry 3823 (class 0 OID 0) -- TOC entry 3891 (class 0 OID 0)
-- Dependencies: 1 -- Dependencies: 1
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
-- --
@@ -54,7 +54,7 @@ COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
-- --
-- TOC entry 2 (class 3079 OID 16398) -- TOC entry 3 (class 3079 OID 16398)
-- Name: postgis; Type: EXTENSION; Schema: -; Owner: -- Name: postgis; Type: EXTENSION; Schema: -; Owner:
-- --
@@ -62,8 +62,8 @@ CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;
-- --
-- TOC entry 3824 (class 0 OID 0) -- TOC entry 3892 (class 0 OID 0)
-- Dependencies: 2 -- Dependencies: 3
-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner: -- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner:
-- --
@@ -71,7 +71,7 @@ COMMENT ON EXTENSION postgis IS 'PostGIS geometry, geography, and raster spatial
-- --
-- TOC entry 3 (class 3079 OID 17906) -- TOC entry 2 (class 3079 OID 17906)
-- Name: postgis_topology; Type: EXTENSION; Schema: -; Owner: -- Name: postgis_topology; Type: EXTENSION; Schema: -; Owner:
-- --
@@ -79,8 +79,8 @@ CREATE EXTENSION IF NOT EXISTS postgis_topology WITH SCHEMA topology;
-- --
-- TOC entry 3825 (class 0 OID 0) -- TOC entry 3893 (class 0 OID 0)
-- Dependencies: 3 -- Dependencies: 2
-- Name: EXTENSION postgis_topology; Type: COMMENT; Schema: -; Owner: -- Name: EXTENSION postgis_topology; Type: COMMENT; Schema: -; Owner:
-- --
@@ -88,7 +88,7 @@ COMMENT ON EXTENSION postgis_topology IS 'PostGIS topology spatial types and fun
-- --
-- TOC entry 2010 (class 1247 OID 18254) -- TOC entry 2036 (class 1247 OID 18254)
-- Name: content_type_enum; Type: TYPE; Schema: public; Owner: kabano -- Name: content_type_enum; Type: TYPE; Schema: public; Owner: kabano
-- --
@@ -102,7 +102,7 @@ CREATE TYPE public.content_type_enum AS ENUM (
ALTER TYPE public.content_type_enum OWNER TO kabano; ALTER TYPE public.content_type_enum OWNER TO kabano;
-- --
-- TOC entry 1995 (class 1247 OID 18166) -- TOC entry 2021 (class 1247 OID 18166)
-- Name: poi_key_enum; Type: TYPE; Schema: public; Owner: kabano -- Name: poi_key_enum; Type: TYPE; Schema: public; Owner: kabano
-- --
@@ -115,7 +115,7 @@ CREATE TYPE public.poi_key_enum AS ENUM (
ALTER TYPE public.poi_key_enum OWNER TO kabano; ALTER TYPE public.poi_key_enum OWNER TO kabano;
-- --
-- TOC entry 1981 (class 1247 OID 18088) -- TOC entry 2007 (class 1247 OID 18088)
-- Name: poi_type_enum; Type: TYPE; Schema: public; Owner: kabano -- Name: poi_type_enum; Type: TYPE; Schema: public; Owner: kabano
-- --
@@ -132,7 +132,7 @@ CREATE TYPE public.poi_type_enum AS ENUM (
ALTER TYPE public.poi_type_enum OWNER TO kabano; ALTER TYPE public.poi_type_enum OWNER TO kabano;
-- --
-- TOC entry 1975 (class 1247 OID 18057) -- TOC entry 2001 (class 1247 OID 18057)
-- Name: user_rank_enum; Type: TYPE; Schema: public; Owner: kabano -- Name: user_rank_enum; Type: TYPE; Schema: public; Owner: kabano
-- --
@@ -141,12 +141,28 @@ CREATE TYPE public.user_rank_enum AS ENUM (
'registered', 'registered',
'premium', 'premium',
'moderator', 'moderator',
'administrator' 'administrator',
'visitor'
); );
ALTER TYPE public.user_rank_enum OWNER TO kabano; 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: postgres
--
CREATE SEQUENCE public.content_comments_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.content_comments_sequence OWNER TO postgres;
SET default_tablespace = ''; SET default_tablespace = '';
SET default_with_oids = false; SET default_with_oids = false;
@@ -157,7 +173,7 @@ SET default_with_oids = false;
-- --
CREATE TABLE public.content_comments ( CREATE TABLE public.content_comments (
id integer NOT NULL, id integer DEFAULT nextval('public.content_comments_sequence'::regclass) NOT NULL,
permalink character varying(255), permalink character varying(255),
version integer, version integer,
creation_date timestamp without time zone, creation_date timestamp without time zone,
@@ -173,13 +189,28 @@ CREATE TABLE public.content_comments (
ALTER TABLE public.content_comments OWNER TO kabano; 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
--
CREATE SEQUENCE public.content_contributors_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.content_contributors_sequence OWNER TO kabano;
-- --
-- TOC entry 228 (class 1259 OID 18271) -- TOC entry 228 (class 1259 OID 18271)
-- Name: content_contributors; Type: TABLE; Schema: public; Owner: kabano -- Name: content_contributors; Type: TABLE; Schema: public; Owner: kabano
-- --
CREATE TABLE public.content_contributors ( CREATE TABLE public.content_contributors (
id integer NOT NULL, id integer DEFAULT nextval('public.content_contributors_sequence'::regclass) NOT NULL,
content integer, content integer,
contributor integer contributor integer
); );
@@ -187,13 +218,28 @@ CREATE TABLE public.content_contributors (
ALTER TABLE public.content_contributors OWNER TO kabano; ALTER TABLE public.content_contributors OWNER TO kabano;
--
-- TOC entry 235 (class 1259 OID 18328)
-- Name: contents_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
CREATE SEQUENCE public.contents_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.contents_sequence OWNER TO kabano;
-- --
-- TOC entry 227 (class 1259 OID 18230) -- TOC entry 227 (class 1259 OID 18230)
-- Name: contents; Type: TABLE; Schema: public; Owner: kabano -- Name: contents; Type: TABLE; Schema: public; Owner: kabano
-- --
CREATE TABLE public.contents ( CREATE TABLE public.contents (
id integer NOT NULL, id integer DEFAULT nextval('public.contents_sequence'::regclass) NOT NULL,
permalink character varying(255) NOT NULL, permalink character varying(255) NOT NULL,
version integer DEFAULT 0 NOT NULL, version integer DEFAULT 0 NOT NULL,
locale character varying(32) NOT NULL, locale character varying(32) NOT NULL,
@@ -225,13 +271,28 @@ CREATE TABLE public.locales (
ALTER TABLE public.locales OWNER TO kabano; ALTER TABLE public.locales OWNER TO kabano;
--
-- TOC entry 234 (class 1259 OID 18326)
-- Name: poi_comments_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
CREATE SEQUENCE public.poi_comments_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.poi_comments_sequence OWNER TO kabano;
-- --
-- TOC entry 226 (class 1259 OID 18203) -- TOC entry 226 (class 1259 OID 18203)
-- Name: poi_comments; Type: TABLE; Schema: public; Owner: kabano -- Name: poi_comments; Type: TABLE; Schema: public; Owner: kabano
-- --
CREATE TABLE public.poi_comments ( CREATE TABLE public.poi_comments (
id integer NOT NULL, id integer DEFAULT nextval('public.poi_comments_sequence'::regclass) NOT NULL,
permalink character varying(255), permalink character varying(255),
version integer, version integer,
creation_date timestamp without time zone, creation_date timestamp without time zone,
@@ -247,13 +308,28 @@ CREATE TABLE public.poi_comments (
ALTER TABLE public.poi_comments OWNER TO kabano; 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
--
CREATE SEQUENCE public.poi_contributors_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.poi_contributors_sequence OWNER TO kabano;
-- --
-- TOC entry 225 (class 1259 OID 18186) -- TOC entry 225 (class 1259 OID 18186)
-- Name: poi_contributors; Type: TABLE; Schema: public; Owner: kabano -- Name: poi_contributors; Type: TABLE; Schema: public; Owner: kabano
-- --
CREATE TABLE public.poi_contributors ( CREATE TABLE public.poi_contributors (
id integer NOT NULL, id integer DEFAULT nextval('public.poi_contributors_sequence'::regclass) NOT NULL,
poi integer, poi integer,
contributor integer contributor integer
); );
@@ -261,13 +337,28 @@ CREATE TABLE public.poi_contributors (
ALTER TABLE public.poi_contributors OWNER TO kabano; 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
--
CREATE SEQUENCE public.poi_localised_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.poi_localised_sequence OWNER TO kabano;
-- --
-- TOC entry 224 (class 1259 OID 18160) -- TOC entry 224 (class 1259 OID 18160)
-- Name: poi_localised; Type: TABLE; Schema: public; Owner: kabano -- Name: poi_localised; Type: TABLE; Schema: public; Owner: kabano
-- --
CREATE TABLE public.poi_localised ( CREATE TABLE public.poi_localised (
id integer NOT NULL, id integer DEFAULT nextval('public.poi_localised_sequence'::regclass) NOT NULL,
poi integer NOT NULL, poi integer NOT NULL,
locale character varying(32) NOT NULL, locale character varying(32) NOT NULL,
key public.poi_key_enum NOT NULL, key public.poi_key_enum NOT NULL,
@@ -294,13 +385,28 @@ CREATE TABLE public.poi_sources (
ALTER TABLE public.poi_sources OWNER TO kabano; ALTER TABLE public.poi_sources OWNER TO kabano;
--
-- TOC entry 231 (class 1259 OID 18320)
-- Name: pois_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
CREATE SEQUENCE public.pois_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.pois_sequence OWNER TO kabano;
-- --
-- TOC entry 223 (class 1259 OID 18119) -- TOC entry 223 (class 1259 OID 18119)
-- Name: pois; Type: TABLE; Schema: public; Owner: kabano -- Name: pois; Type: TABLE; Schema: public; Owner: kabano
-- --
CREATE TABLE public.pois ( CREATE TABLE public.pois (
id integer NOT NULL, id integer DEFAULT nextval('public.pois_sequence'::regclass) NOT NULL,
permalink character varying(255) NOT NULL, permalink character varying(255) NOT NULL,
version integer DEFAULT 0 NOT NULL, version integer DEFAULT 0 NOT NULL,
creation_date timestamp without time zone NOT NULL, creation_date timestamp without time zone NOT NULL,
@@ -321,13 +427,28 @@ CREATE TABLE public.pois (
ALTER TABLE public.pois OWNER TO kabano; ALTER TABLE public.pois OWNER TO kabano;
--
-- TOC entry 230 (class 1259 OID 18317)
-- Name: users_id_sequence; Type: SEQUENCE; Schema: public; Owner: kabano
--
CREATE SEQUENCE public.users_id_sequence
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.users_id_sequence OWNER TO kabano;
-- --
-- TOC entry 220 (class 1259 OID 18047) -- TOC entry 220 (class 1259 OID 18047)
-- Name: users; Type: TABLE; Schema: public; Owner: kabano -- Name: users; Type: TABLE; Schema: public; Owner: kabano
-- --
CREATE TABLE public.users ( CREATE TABLE public.users (
id integer NOT NULL, id integer DEFAULT nextval('public.users_id_sequence'::regclass) NOT NULL,
name character varying(255) NOT NULL, name character varying(255) NOT NULL,
version integer DEFAULT 0 NOT NULL, version integer DEFAULT 0 NOT NULL,
email character varying(255) NOT NULL, email character varying(255) NOT NULL,
@@ -346,7 +467,7 @@ CREATE TABLE public.users (
ALTER TABLE public.users OWNER TO kabano; ALTER TABLE public.users OWNER TO kabano;
-- --
-- TOC entry 3667 (class 2606 OID 18297) -- TOC entry 3717 (class 2606 OID 18297)
-- Name: content_comments content_comments_permalink_version_key; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: content_comments content_comments_permalink_version_key; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -355,7 +476,7 @@ ALTER TABLE ONLY public.content_comments
-- --
-- TOC entry 3669 (class 2606 OID 18295) -- TOC entry 3719 (class 2606 OID 18295)
-- Name: content_comments content_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: content_comments content_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -364,7 +485,7 @@ ALTER TABLE ONLY public.content_comments
-- --
-- TOC entry 3661 (class 2606 OID 18275) -- TOC entry 3711 (class 2606 OID 18275)
-- Name: content_contributors content_contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: content_contributors content_contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -373,7 +494,7 @@ ALTER TABLE ONLY public.content_contributors
-- --
-- TOC entry 3663 (class 2606 OID 18277) -- TOC entry 3713 (class 2606 OID 18277)
-- Name: content_contributors content_contributors_unique; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: content_contributors content_contributors_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -382,7 +503,7 @@ ALTER TABLE ONLY public.content_contributors
-- --
-- TOC entry 3657 (class 2606 OID 18262) -- TOC entry 3707 (class 2606 OID 18262)
-- Name: contents contents_permalink_unique; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: contents contents_permalink_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -391,7 +512,7 @@ ALTER TABLE ONLY public.contents
-- --
-- TOC entry 3659 (class 2606 OID 18238) -- TOC entry 3709 (class 2606 OID 18238)
-- Name: contents contents_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: contents contents_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -400,7 +521,7 @@ ALTER TABLE ONLY public.contents
-- --
-- TOC entry 3623 (class 2606 OID 18073) -- TOC entry 3673 (class 2606 OID 18073)
-- Name: locales locales_display_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: locales locales_display_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -409,7 +530,7 @@ ALTER TABLE ONLY public.locales
-- --
-- TOC entry 3625 (class 2606 OID 18075) -- TOC entry 3675 (class 2606 OID 18075)
-- Name: locales locales_flag_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: locales locales_flag_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -418,7 +539,7 @@ ALTER TABLE ONLY public.locales
-- --
-- TOC entry 3627 (class 2606 OID 18071) -- TOC entry 3677 (class 2606 OID 18071)
-- Name: locales locales_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: locales locales_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -427,7 +548,7 @@ ALTER TABLE ONLY public.locales
-- --
-- TOC entry 3651 (class 2606 OID 18212) -- TOC entry 3701 (class 2606 OID 18212)
-- Name: poi_comments poi_comments_permalink_version_key; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_comments poi_comments_permalink_version_key; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -436,7 +557,7 @@ ALTER TABLE ONLY public.poi_comments
-- --
-- TOC entry 3653 (class 2606 OID 18210) -- TOC entry 3703 (class 2606 OID 18210)
-- Name: poi_comments poi_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_comments poi_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -445,7 +566,7 @@ ALTER TABLE ONLY public.poi_comments
-- --
-- TOC entry 3645 (class 2606 OID 18190) -- TOC entry 3695 (class 2606 OID 18190)
-- Name: poi_contributors poi_contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_contributors poi_contributors_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -454,7 +575,7 @@ ALTER TABLE ONLY public.poi_contributors
-- --
-- TOC entry 3647 (class 2606 OID 18192) -- TOC entry 3697 (class 2606 OID 18192)
-- Name: poi_contributors poi_contributors_unique; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_contributors poi_contributors_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -463,7 +584,7 @@ ALTER TABLE ONLY public.poi_contributors
-- --
-- TOC entry 3641 (class 2606 OID 18164) -- TOC entry 3691 (class 2606 OID 18164)
-- Name: poi_localised poi_localised_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_localised poi_localised_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -472,7 +593,7 @@ ALTER TABLE ONLY public.poi_localised
-- --
-- TOC entry 3643 (class 2606 OID 18185) -- TOC entry 3693 (class 2606 OID 18185)
-- Name: poi_localised poi_localised_unique; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_localised poi_localised_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -481,7 +602,7 @@ ALTER TABLE ONLY public.poi_localised
-- --
-- TOC entry 3629 (class 2606 OID 18118) -- TOC entry 3679 (class 2606 OID 18118)
-- Name: poi_sources poi_sources_display_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_sources poi_sources_display_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -490,7 +611,7 @@ ALTER TABLE ONLY public.poi_sources
-- --
-- TOC entry 3631 (class 2606 OID 18116) -- TOC entry 3681 (class 2606 OID 18116)
-- Name: poi_sources poi_sources_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_sources poi_sources_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -499,7 +620,7 @@ ALTER TABLE ONLY public.poi_sources
-- --
-- TOC entry 3636 (class 2606 OID 18145) -- TOC entry 3686 (class 2606 OID 18145)
-- Name: pois pois_permalink_unique; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: pois pois_permalink_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -508,7 +629,7 @@ ALTER TABLE ONLY public.pois
-- --
-- TOC entry 3638 (class 2606 OID 18124) -- TOC entry 3688 (class 2606 OID 18124)
-- Name: pois pois_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: pois pois_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -517,7 +638,7 @@ ALTER TABLE ONLY public.pois
-- --
-- TOC entry 3615 (class 2606 OID 18079) -- TOC entry 3665 (class 2606 OID 18079)
-- Name: users users_email_unique; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: users users_email_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -526,7 +647,7 @@ ALTER TABLE ONLY public.users
-- --
-- TOC entry 3618 (class 2606 OID 18077) -- TOC entry 3668 (class 2606 OID 18077)
-- Name: users users_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: users users_name_unique; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -535,7 +656,7 @@ ALTER TABLE ONLY public.users
-- --
-- TOC entry 3620 (class 2606 OID 18055) -- TOC entry 3670 (class 2606 OID 18055)
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -544,7 +665,7 @@ ALTER TABLE ONLY public.users
-- --
-- TOC entry 3664 (class 1259 OID 18313) -- TOC entry 3714 (class 1259 OID 18313)
-- Name: content_comments_is_archive_index; Type: INDEX; Schema: public; Owner: kabano -- Name: content_comments_is_archive_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -552,7 +673,7 @@ CREATE INDEX content_comments_is_archive_index ON public.content_comments USING
-- --
-- TOC entry 3665 (class 1259 OID 18314) -- TOC entry 3715 (class 1259 OID 18314)
-- Name: content_comments_is_public_index; Type: INDEX; Schema: public; Owner: kabano -- Name: content_comments_is_public_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -560,7 +681,7 @@ CREATE INDEX content_comments_is_public_index ON public.content_comments USING b
-- --
-- TOC entry 3654 (class 1259 OID 18251) -- TOC entry 3704 (class 1259 OID 18251)
-- Name: contents_is_archive_index; Type: INDEX; Schema: public; Owner: kabano -- Name: contents_is_archive_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -568,7 +689,7 @@ CREATE INDEX contents_is_archive_index ON public.contents USING btree (is_archiv
-- --
-- TOC entry 3655 (class 1259 OID 18252) -- TOC entry 3705 (class 1259 OID 18252)
-- Name: contents_is_public_index; Type: INDEX; Schema: public; Owner: kabano -- Name: contents_is_public_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -576,7 +697,7 @@ CREATE INDEX contents_is_public_index ON public.contents USING btree (is_public)
-- --
-- TOC entry 3648 (class 1259 OID 18229) -- TOC entry 3698 (class 1259 OID 18229)
-- Name: poi_comments_is_archive_index; Type: INDEX; Schema: public; Owner: kabano -- Name: poi_comments_is_archive_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -584,7 +705,7 @@ CREATE INDEX poi_comments_is_archive_index ON public.poi_comments USING btree (i
-- --
-- TOC entry 3649 (class 1259 OID 18228) -- TOC entry 3699 (class 1259 OID 18228)
-- Name: poi_comments_is_public_index; Type: INDEX; Schema: public; Owner: kabano -- Name: poi_comments_is_public_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -592,7 +713,7 @@ CREATE INDEX poi_comments_is_public_index ON public.poi_comments USING btree (is
-- --
-- TOC entry 3632 (class 1259 OID 18157) -- TOC entry 3682 (class 1259 OID 18157)
-- Name: pois_is_archive_index; Type: INDEX; Schema: public; Owner: kabano -- Name: pois_is_archive_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -600,7 +721,7 @@ CREATE INDEX pois_is_archive_index ON public.pois USING btree (is_archive);
-- --
-- TOC entry 3633 (class 1259 OID 18159) -- TOC entry 3683 (class 1259 OID 18159)
-- Name: pois_is_destroyed_index; Type: INDEX; Schema: public; Owner: kabano -- Name: pois_is_destroyed_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -608,7 +729,7 @@ CREATE INDEX pois_is_destroyed_index ON public.pois USING btree (is_detroyed);
-- --
-- TOC entry 3634 (class 1259 OID 18156) -- TOC entry 3684 (class 1259 OID 18156)
-- Name: pois_is_public_index; Type: INDEX; Schema: public; Owner: kabano -- Name: pois_is_public_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -616,7 +737,7 @@ CREATE INDEX pois_is_public_index ON public.pois USING btree (is_public);
-- --
-- TOC entry 3639 (class 1259 OID 18158) -- TOC entry 3689 (class 1259 OID 18158)
-- Name: pois_type_index; Type: INDEX; Schema: public; Owner: kabano -- Name: pois_type_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -624,7 +745,7 @@ CREATE INDEX pois_type_index ON public.pois USING btree (type);
-- --
-- TOC entry 3616 (class 1259 OID 18080) -- TOC entry 3666 (class 1259 OID 18080)
-- Name: users_is_archive_index; Type: INDEX; Schema: public; Owner: kabano -- Name: users_is_archive_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -632,7 +753,7 @@ CREATE INDEX users_is_archive_index ON public.users USING btree (is_archive);
-- --
-- TOC entry 3621 (class 1259 OID 18081) -- TOC entry 3671 (class 1259 OID 18081)
-- Name: users_register_date_index; Type: INDEX; Schema: public; Owner: kabano -- Name: users_register_date_index; Type: INDEX; Schema: public; Owner: kabano
-- --
@@ -640,7 +761,7 @@ CREATE INDEX users_register_date_index ON public.users USING btree (register_dat
-- --
-- TOC entry 3684 (class 2606 OID 18298) -- TOC entry 3734 (class 2606 OID 18298)
-- Name: content_comments content_comments_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: content_comments content_comments_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -649,7 +770,7 @@ ALTER TABLE ONLY public.content_comments
-- --
-- TOC entry 3686 (class 2606 OID 18308) -- TOC entry 3736 (class 2606 OID 18308)
-- Name: content_comments content_comments_content_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: content_comments content_comments_content_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -658,7 +779,7 @@ ALTER TABLE ONLY public.content_comments
-- --
-- TOC entry 3685 (class 2606 OID 18303) -- TOC entry 3735 (class 2606 OID 18303)
-- Name: content_comments content_comments_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: content_comments content_comments_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -667,7 +788,7 @@ ALTER TABLE ONLY public.content_comments
-- --
-- TOC entry 3683 (class 2606 OID 18283) -- TOC entry 3733 (class 2606 OID 18283)
-- Name: content_contributors content_contributors_content_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: content_contributors content_contributors_content_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -676,7 +797,7 @@ ALTER TABLE ONLY public.content_contributors
-- --
-- TOC entry 3682 (class 2606 OID 18278) -- TOC entry 3732 (class 2606 OID 18278)
-- Name: content_contributors content_contributors_contributor_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: content_contributors content_contributors_contributor_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -685,7 +806,7 @@ ALTER TABLE ONLY public.content_contributors
-- --
-- TOC entry 3680 (class 2606 OID 18241) -- TOC entry 3730 (class 2606 OID 18241)
-- Name: contents contents_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: contents contents_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -694,7 +815,7 @@ ALTER TABLE ONLY public.contents
-- --
-- TOC entry 3681 (class 2606 OID 18263) -- TOC entry 3731 (class 2606 OID 18263)
-- Name: contents contents_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: contents contents_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -703,7 +824,7 @@ ALTER TABLE ONLY public.contents
-- --
-- TOC entry 3677 (class 2606 OID 18213) -- TOC entry 3727 (class 2606 OID 18213)
-- Name: poi_comments poi_comments_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_comments poi_comments_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -712,7 +833,7 @@ ALTER TABLE ONLY public.poi_comments
-- --
-- TOC entry 3678 (class 2606 OID 18218) -- TOC entry 3728 (class 2606 OID 18218)
-- Name: poi_comments poi_comments_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_comments poi_comments_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -721,7 +842,7 @@ ALTER TABLE ONLY public.poi_comments
-- --
-- TOC entry 3679 (class 2606 OID 18223) -- TOC entry 3729 (class 2606 OID 18223)
-- Name: poi_comments poi_comments_poi_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_comments poi_comments_poi_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -730,7 +851,7 @@ ALTER TABLE ONLY public.poi_comments
-- --
-- TOC entry 3675 (class 2606 OID 18193) -- TOC entry 3725 (class 2606 OID 18193)
-- Name: poi_contributors poi_contributors_contributor_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_contributors poi_contributors_contributor_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -739,7 +860,7 @@ ALTER TABLE ONLY public.poi_contributors
-- --
-- TOC entry 3676 (class 2606 OID 18198) -- TOC entry 3726 (class 2606 OID 18198)
-- Name: poi_contributors poi_contributors_poi_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_contributors poi_contributors_poi_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -748,7 +869,7 @@ ALTER TABLE ONLY public.poi_contributors
-- --
-- TOC entry 3674 (class 2606 OID 18179) -- TOC entry 3724 (class 2606 OID 18179)
-- Name: poi_localised poi_localised_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_localised poi_localised_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -757,7 +878,7 @@ ALTER TABLE ONLY public.poi_localised
-- --
-- TOC entry 3673 (class 2606 OID 18174) -- TOC entry 3723 (class 2606 OID 18174)
-- Name: poi_localised poi_localised_poi_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: poi_localised poi_localised_poi_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -766,7 +887,7 @@ ALTER TABLE ONLY public.poi_localised
-- --
-- TOC entry 3671 (class 2606 OID 18146) -- TOC entry 3721 (class 2606 OID 18146)
-- Name: pois pois_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: pois pois_author_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -775,7 +896,7 @@ ALTER TABLE ONLY public.pois
-- --
-- TOC entry 3672 (class 2606 OID 18151) -- TOC entry 3722 (class 2606 OID 18151)
-- Name: pois pois_source_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: pois pois_source_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -784,7 +905,7 @@ ALTER TABLE ONLY public.pois
-- --
-- TOC entry 3670 (class 2606 OID 18082) -- TOC entry 3720 (class 2606 OID 18082)
-- Name: users users_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano -- Name: users users_locale_fkey; Type: FK CONSTRAINT; Schema: public; Owner: kabano
-- --
@@ -792,7 +913,7 @@ ALTER TABLE ONLY public.users
ADD CONSTRAINT users_locale_fkey FOREIGN KEY (locale) REFERENCES public.locales(name); ADD CONSTRAINT users_locale_fkey FOREIGN KEY (locale) REFERENCES public.locales(name);
-- Completed on 2018-08-20 19:41:10 CEST -- Completed on 2018-10-17 20:33:23 CEST
-- --
-- PostgreSQL database dump complete -- PostgreSQL database dump complete

View File

@@ -38,18 +38,15 @@ if(isset($controller->splitted_url[1])) {
if (isset($_POST['submit'])) { if (isset($_POST['submit'])) {
// PROCESS DATA FROM FORM // PROCESS DATA FROM FORM
$user = new User(); $user = new User();
$user->password = sha1($_POST['password']);
$user->name = $_POST['login']; $user->name = $_POST['login'];
$user->mail = strtolower($_POST['mail']); $user->email = strtolower($_POST['mail']);
$user->rank = "registered"; $user->rank = "registered";
$user->avatar = 'f';
$user->locale = "fr";
if($_POST['captcha'] == -2) { if($_POST['captcha'] == -2) {
if($user->availableName()) { if($user->availableName()) {
if($user->availableMail()) { if($user->availableMail()) {
if($user->password != "" AND $user->name != "" AND $user->mail != "") { if($_POST['password'] AND $user->name != "" AND $user->email != "") {
$user->create(); $user->create(sha1($_POST['password']));
header('Location: '.$config['rel_root_folder'].'user/login?status=created'); header('Location: '.$config['rel_root_folder'].'user/login?status=created');
} }
else { else {

View File

@@ -103,6 +103,9 @@ class User
return $this->id; return $this->id;
} }
/*****
** Returns true if user permissions are higher than $rank
*****/
public function rank_is_higher($rank) { public function rank_is_higher($rank) {
if( $rank == 'blocked' ) { if( $rank == 'blocked' ) {
return true; return true;
@@ -168,6 +171,7 @@ class User
return 0; return 0;
} }
} }
/***** /*****
** Checks if the user's mail address exists in the database ** Checks if the user's mail address exists in the database
*****/ *****/
@@ -177,11 +181,11 @@ class User
$con = pg_connect("host=".$config['SQL_host']." dbname=".$config['SQL_db']." user=".$config['SQL_user']." password=".$config['SQL_pass']) $con = pg_connect("host=".$config['SQL_host']." dbname=".$config['SQL_db']." user=".$config['SQL_user']." password=".$config['SQL_pass'])
or die ("Could not connect to server\n"); or die ("Could not connect to server\n");
$query = "SELECT id FROM users WHERE lower(mail)=$1"; $query = "SELECT id FROM users WHERE lower(email)=$1";
pg_prepare($con, "prepare1", $query) pg_prepare($con, "prepare1", $query)
or die ("Cannot prepare statement\n"); or die ("Cannot prepare statement\n");
$result = pg_execute($con, "prepare1", array(strtolower($this->mail))) $result = pg_execute($con, "prepare1", array(strtolower($this->email)))
or die ("Cannot execute statement\n"); or die ("Cannot execute statement\n");
pg_close($con); pg_close($con);
@@ -197,31 +201,35 @@ class User
return 0; return 0;
} }
} }
/***** /*****
** Creates a new user. ** Creates a new user giving a sha1 password
*****/ *****/
public function create() { public function create($password) {
global $config; global $config;
$regex = '/^(https?:\/\/)/'; $regex = '/^(https?:\/\/)/';
if (!preg_match($regex, $this->website) && $this->website!="") if (!preg_match($regex, $this->website) && $this->website!="")
$this->website = "http://".$this->website; $this->website = "http://".$this->website;
$this->visit_date = date('r');
$this->register_date = date('r');
$this->locale = "fr_FR";
$this->timezone = "CEST";
$con = pg_connect("host=".$config['SQL_host']." dbname=".$config['SQL_db']." user=".$config['SQL_user']." password=".$config['SQL_pass']) $con = pg_connect("host=".$config['SQL_host']." dbname=".$config['SQL_db']." user=".$config['SQL_user']." password=".$config['SQL_pass'])
or die ("Could not connect to server\n"); or die ("Could not connect to server\n");
$query = "INSERT INTO users (name, password, avatar, locale, role, lastlogin, mail, website, registered) VALUES $query = "INSERT INTO users (name, version, email, password, website, is_avatar_present, is_archive, rank, locale, timezone, visit_date, register_date) VALUES
($1, $2, $3, $4, $5, $6, $7, $8, $9)"; ($1, '0', $2, $3, $4, 'f', 'f', 'registered', $5, $6, $7, $8)";
pg_prepare($con, "prepare1", $query) pg_prepare($con, "prepare1", $query)
or die ("Cannot prepare statement\n"); or die ("Cannot prepare statement\n");
pg_execute($con, "prepare1", array($this->name, $this->password, $this->avatar, $this->locale, $this->role, $this->lastlogin, $this->mail, $this->website, date('r'))) pg_execute($con, "prepare1", array($this->name, $this->email, $password, $this->website, $this->locale, $this->timezone, $this->visit_date, $this->register_date))
or die ("Cannot execute statement\n"); or die ("Cannot execute statement\n");
pg_close($con); pg_close($con);
$this->updateLoginDate();
} }
/***** /*****
** Update the user profile ** Update the user profile
*****/ *****/
@@ -258,6 +266,7 @@ class User
3, 3,
$config['logs_folder'].'users.log'); $config['logs_folder'].'users.log');
} }
/***** /*****
** Generates a random passwords, update the base and send the new password by mail. ** Generates a random passwords, update the base and send the new password by mail.
*****/ *****/
@@ -301,6 +310,7 @@ class User
mail($this->mail, 'Kabano - Nouveau mot de passe', $message, $headers); mail($this->mail, 'Kabano - Nouveau mot de passe', $message, $headers);
} }
/***** /*****
** Update the last login date ** Update the last login date
*****/ *****/
@@ -321,6 +331,7 @@ class User
pg_close($con); pg_close($con);
} }
/***** /*****
** Outputs the role of the user ** Outputs the role of the user
*****/ *****/
@@ -328,6 +339,7 @@ class User
global $config; global $config;
return '<span class="userrole" style="color: '.$config['roles'][$this->role][2].';">'.$config['roles'][$this->role][1].'</span>'; return '<span class="userrole" style="color: '.$config['roles'][$this->role][2].';">'.$config['roles'][$this->role][1].'</span>';
} }
/***** /*****
** Sends an email to the user from an other user ** Sends an email to the user from an other user
*****/ *****/