diff --git a/application/config/fhcomplete.php b/application/config/fhcomplete.php index 4af6424ec..00ed49d65 100755 --- a/application/config/fhcomplete.php +++ b/application/config/fhcomplete.php @@ -167,8 +167,6 @@ $config['fhc_acl'] = array 'public.tbl_ortraumtyp' => 'basis/ortraumtyp', 'public.tbl_person' => 'basis/person', 'public.tbl_personfunktionstandort' => 'basis/personfunktionstandort', - 'public.tbl_phrase' => 'system/phrase', - 'public.tbl_phrase_inhalt' => 'system/phrase', 'public.tbl_preincoming' => 'basis/preincoming', 'public.tbl_preinteressent' => 'basis/preinteressent', 'public.tbl_preinteressentstudiengang' => 'basis/preinteressentstudiengang', @@ -194,10 +192,13 @@ $config['fhc_acl'] = array 'public.tbl_vorlage' => 'system/vorlage', 'public.tbl_vorlagestudiengang' => 'system/vorlagestudiengang', 'public.vw_studiensemester' => 'basis/vw_studiensemester', - 'system.tbl_appdaten' => 'basis/appdaten', + 'system.tbl_app' => 'system/app', + 'system.tbl_appdaten' => 'system/appdaten', 'system.tbl_benutzerrolle' => 'basis/benutzerrolle', 'system.tbl_berechtigung' => 'basis/berechtigung', 'system.tbl_cronjob' => 'basis/cronjob', + 'system.tbl_phrase' => 'system/phrase', + 'system.tbl_phrase_inhalt' => 'system/phrase', 'system.tbl_rolle' => 'basis/rolle', 'system.tbl_rolleberechtigung' => 'basis/rolleberechtigung', 'system.tbl_server' => 'basis/server', diff --git a/application/helpers/fhc_helper.php b/application/helpers/fhc_helper.php new file mode 100644 index 000000000..b76e2041d --- /dev/null +++ b/application/helpers/fhc_helper.php @@ -0,0 +1,64 @@ +=5.3 and <7 + if(function_exists('openssl_random_pseudo_bytes')) + { + $token = base64_encode(openssl_random_pseudo_bytes($length, $strong)); + // is the token strong enough? + if($strong == true) + return strtr(substr($token, 0, $length), '+/=', '-_,'); + } + + //fallback to mt_rand if php < 5.3 or no openssl available + $characters = '0123456789'; + $characters .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/+'; + $charactersLength = strlen($characters)-1; + $token = ''; + //select some random characters + for ($i = 0; $i < $length; $i++) + $token .= $characters[mt_rand(0, $charactersLength)]; + return $token; +} diff --git a/application/language/bulgarian/index.html b/application/language/bg-BG/index.html similarity index 100% rename from application/language/bulgarian/index.html rename to application/language/bg-BG/index.html diff --git a/application/language/bulgarian/rest_controller_lang.php b/application/language/bg-BG/rest_controller_lang.php similarity index 100% rename from application/language/bulgarian/rest_controller_lang.php rename to application/language/bg-BG/rest_controller_lang.php diff --git a/application/language/portuguese-brazilian/index.html b/application/language/pt-BR/index.html similarity index 100% rename from application/language/portuguese-brazilian/index.html rename to application/language/pt-BR/index.html diff --git a/application/language/portuguese-brazilian/rest_controller_lang.php b/application/language/pt-BR/rest_controller_lang.php similarity index 100% rename from application/language/portuguese-brazilian/rest_controller_lang.php rename to application/language/pt-BR/rest_controller_lang.php diff --git a/application/language/system/calendar_lang.php b/application/language/system/calendar_lang.php new file mode 100644 index 000000000..222f4f65b --- /dev/null +++ b/application/language/system/calendar_lang.php @@ -0,0 +1,84 @@ + + +
+Directory access is forbidden.
+ + + diff --git a/application/language/system/message_lang.php b/application/language/system/message_lang.php new file mode 100644 index 000000000..0f13225b9 --- /dev/null +++ b/application/language/system/message_lang.php @@ -0,0 +1,19 @@ +=5.3 and <7 - if(function_exists('openssl_random_pseudo_bytes')) - { - $token = base64_encode(openssl_random_pseudo_bytes($length, $strong)); - // is the token strong enough? - if($strong == true) - return strtr(substr($token, 0, $length), '+/=', '-_,'); - } - - //fallback to mt_rand if php < 5.3 or no openssl available - $characters = '0123456789'; - $characters .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz/+'; - $charactersLength = strlen($characters)-1; - $token = ''; - //select some random characters - for ($i = 0; $i < $length; $i++) - $token .= $characters[mt_rand(0, $charactersLength)]; - return $token; - } // ------------------------------------------------------------------------ diff --git a/application/migrations/009_phrase.php b/application/migrations/009_phrase.php index 19a294e6c..1a671d952 100755 --- a/application/migrations/009_phrase.php +++ b/application/migrations/009_phrase.php @@ -6,18 +6,27 @@ class Migration_Phrase extends CI_Migration { public function up() { - if (! $this->db->table_exists('public.tbl_phrase')) + if (! $this->db->table_exists('system.tbl_app')) { $query= " - CREATE TABLE public.tbl_app ( + CREATE TABLE system.tbl_app ( app varchar(32), PRIMARY KEY (app) ); - GRANT SELECT ON TABLE public.tbl_app TO web; - GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.tbl_app TO admin; - GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.tbl_app TO vilesci; + GRANT SELECT ON TABLE system.tbl_app TO web; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE system.tbl_app TO admin; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE system.tbl_app TO vilesci; + "; + if (!$this->db->simple_query($query)) + { + echo "Error creating Basis DB-Schema!"; + } + } - CREATE TABLE public.tbl_phrase ( + if (! $this->db->table_exists('system.tbl_phrase')) + { + $query= " + CREATE TABLE system.tbl_phrase ( phrase_id serial, app varchar(32) NOT NULL, phrase varchar(64) NOT NULL, @@ -25,14 +34,14 @@ class Migration_Phrase extends CI_Migration { insertvon varchar(32), PRIMARY KEY (phrase_id) ); - GRANT SELECT ON TABLE public.tbl_phrase TO web; - GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.tbl_phrase TO admin; - GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.tbl_phrase TO vilesci; - GRANT SELECT, UPDATE ON SEQUENCE public.tbl_phrase_phrase_id_seq TO web; - GRANT SELECT, UPDATE ON SEQUENCE public.tbl_phrase_phrase_id_seq TO admin; - GRANT SELECT, UPDATE ON SEQUENCE public.tbl_phrase_phrase_id_seq TO vilesci; + GRANT SELECT ON TABLE system.tbl_phrase TO web; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE system.tbl_phrase TO admin; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE system.tbl_phrase TO vilesci; + GRANT SELECT, UPDATE ON SEQUENCE system.tbl_phrase_phrase_id_seq TO web; + GRANT SELECT, UPDATE ON SEQUENCE system.tbl_phrase_phrase_id_seq TO admin; + GRANT SELECT, UPDATE ON SEQUENCE system.tbl_phrase_phrase_id_seq TO vilesci; - CREATE TABLE public.tbl_phrase_inhalt ( + CREATE TABLE system.tbl_phrase_inhalt ( phrase_inhalt_id serial, phrase_id bigint NOT NULL, sprache varchar(32) NOT NULL, @@ -44,12 +53,12 @@ class Migration_Phrase extends CI_Migration { insertvon varchar(32), PRIMARY KEY (phrase_inhalt_id) ); - GRANT SELECT ON TABLE public.tbl_phrase_inhalt TO web; - GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.tbl_phrase_inhalt TO admin; - GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE public.tbl_phrase_inhalt TO vilesci; - GRANT SELECT, UPDATE ON SEQUENCE public.tbl_phrase_inhalt_phrase_inhalt_id_seq TO web; - GRANT SELECT, UPDATE ON SEQUENCE public.tbl_phrase_inhalt_phrase_inhalt_id_seq TO admin; - GRANT SELECT, UPDATE ON SEQUENCE public.tbl_phrase_inhalt_phrase_inhalt_id_seq TO vilesci; + GRANT SELECT ON TABLE system.tbl_phrase_inhalt TO web; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE system.tbl_phrase_inhalt TO admin; + GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE system.tbl_phrase_inhalt TO vilesci; + GRANT SELECT, UPDATE ON SEQUENCE system.tbl_phrase_inhalt_phrase_inhalt_id_seq TO web; + GRANT SELECT, UPDATE ON SEQUENCE system.tbl_phrase_inhalt_phrase_inhalt_id_seq TO admin; + GRANT SELECT, UPDATE ON SEQUENCE system.tbl_phrase_inhalt_phrase_inhalt_id_seq TO vilesci; "; if (!$this->db->simple_query($query)) { @@ -62,10 +71,10 @@ class Migration_Phrase extends CI_Migration { { try { - $this->dbforge->drop_table('public.tbl_phrase_inhalt'); - $this->dbforge->drop_table('public.tbl_phrase'); - $this->dbforge->drop_table('public.tbl_app'); - echo "Table public.tbl_phrase_inhalt, public.tbl_phrase and public.tbl_app dropped!"; + $this->dbforge->drop_table('system.tbl_phrase_inhalt'); + $this->dbforge->drop_table('system.tbl_phrase'); + $this->dbforge->drop_table('system.tbl_app'); + echo "Table system.tbl_phrase_inhalt, system.tbl_phrase and system.tbl_app dropped!"; } catch(Exception $e) { diff --git a/application/models/system/App_model.php b/application/models/system/App_model.php new file mode 100644 index 000000000..e0fd19c75 --- /dev/null +++ b/application/models/system/App_model.php @@ -0,0 +1,15 @@ +dbTable = 'system.tbl_app'; + $this->pk = 'app'; + } + +} diff --git a/application/models/system/Phrase_inhalt_model.php b/application/models/system/Phrase_inhalt_model.php index 806915bca..5a54476d2 100644 --- a/application/models/system/Phrase_inhalt_model.php +++ b/application/models/system/Phrase_inhalt_model.php @@ -8,7 +8,7 @@ class Phrase_inhalt_model extends DB_Model public function __construct() { parent::__construct(); - $this->dbTable = 'public.tbl_phrase_inhalt'; + $this->dbTable = 'system.tbl_phrase_inhalt'; $this->pk = 'phrase_inhalt_id'; } diff --git a/application/models/system/Phrase_model.php b/application/models/system/Phrase_model.php index 7b845780b..20655f582 100644 --- a/application/models/system/Phrase_model.php +++ b/application/models/system/Phrase_model.php @@ -8,7 +8,7 @@ class Phrase_model extends DB_Model public function __construct() { parent::__construct(); - $this->dbTable = 'public.tbl_phrase'; + $this->dbTable = 'system.tbl_phrase'; $this->pk = 'phrase_id'; } @@ -18,10 +18,10 @@ class Phrase_model extends DB_Model public function getPhrases($app, $sprache, $phrase = null, $orgeinheit_kurzbz = null, $orgform_kurzbz = null) { // Checks if the operation is permitted by the API caller - if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_phrase'], 's')) - return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_phrase'], FHC_MODEL_ERROR); - if (! $this->fhc_db_acl->isBerechtigt($this->acl['public.tbl_phrase_inhalt'], 's')) - return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['public.tbl_phrase_inhalt'], FHC_MODEL_ERROR); + if (! $this->fhc_db_acl->isBerechtigt($this->acl['system.tbl_phrase'], 's')) + return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['system.tbl_phrase'], FHC_MODEL_ERROR); + if (! $this->fhc_db_acl->isBerechtigt($this->acl['system.tbl_phrase_inhalt'], 's')) + return $this->_error(lang('fhc_'.FHC_NORIGHT).' -> '.$this->acl['system.tbl_phrase_inhalt'], FHC_MODEL_ERROR); $parametersArray = array('app' => $app, 'sprache' => $sprache); @@ -30,7 +30,7 @@ class Phrase_model extends DB_Model orgeinheit_kurzbz, orgform_kurzbz, text - FROM public.tbl_phrase JOIN public.tbl_phrase_inhalt USING (phrase_id) + FROM system.tbl_phrase JOIN system.tbl_phrase_inhalt USING (phrase_id) WHERE app = ? AND sprache = ?'; if (isset($phrase)) @@ -65,4 +65,4 @@ class Phrase_model extends DB_Model else return $this->_error($this->db->error(), FHC_DB_ERROR); } -} \ No newline at end of file +} diff --git a/application/seeds/005_message.php b/application/seeds/005_message.php index e7d729400..9497bc074 100644 --- a/application/seeds/005_message.php +++ b/application/seeds/005_message.php @@ -8,7 +8,7 @@ class Seed_Message public function __construct() { $this->fhc =& get_instance(); - $this->fhc->load->library('MessageLib'); + $this->fhc->load->helper('fhc'); } public function seed($limit = 50) @@ -36,7 +36,7 @@ class Seed_Message ( 'message_id' => $message_id, 'person_id' => $person[$i%($num_persons-1)+1]->person_id, - 'token' => $this->fhc->messagelib->generateToken(), + 'token' => generateToken(), 'insertvon' => 'seed' ); $recipient = $this->fhc->db->insert('public.tbl_msg_recipient', $data);