summaryrefslogtreecommitdiffstats
path: root/utils/1kaUtils
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
commit75160b12821f7f4299cce7f0b69c83c1502ae071 (patch)
tree27e25e4ccaef45f0c58b22831164050d1af1d4db /utils/1kaUtils
parentprvi-commit (diff)
download1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip
Diffstat (limited to 'utils/1kaUtils')
-rw-r--r--utils/1kaUtils/1ka_ankete_deactive_v3.php404
-rw-r--r--utils/1kaUtils/app_settings_copy.php288
2 files changed, 692 insertions, 0 deletions
diff --git a/utils/1kaUtils/1ka_ankete_deactive_v3.php b/utils/1kaUtils/1ka_ankete_deactive_v3.php
new file mode 100644
index 0000000..1e1eb9d
--- /dev/null
+++ b/utils/1kaUtils/1ka_ankete_deactive_v3.php
@@ -0,0 +1,404 @@
+<?php
+/**
+ *
+ * Podatke neaktivnih anket, ki se ze nekaj casa niso spreminjale prenese iz _active tabel v arhivske tabele
+ *
+ * NOVA SKRIPTA ZA TABELE
+ *
+ * srv_data_vrednost
+ * srv_data_text
+ * srv_data_grid
+ * srv_data_textgrid
+ * srv_data_checkgrid
+ * srv_user_grupa
+ * srv_tracking
+ *
+*/
+
+include_once('../../function.php');
+
+// Time limit skripte
+set_time_limit(1800); // 30 minut
+
+
+// ID ankete za arhiviranje (opcijsko)
+$survey_id = (isset($_GET['ank_id'])) ? ' AND id = '.$_GET['ank_id'] : '';
+
+// Zacetni ID ankete kjer zacnemo arhiviranje (opcijsko)
+$start = (isset($_GET['start'])) ? ' AND id > '.$_GET['start'] : '';
+
+// Limit stevila anket, ki jih naenkrat arhiviramo
+$limit = (isset($_GET['limit'])) ? $_GET['limit'] : 200;
+
+
+// Stevilka arhivskih anket kamor kopiramo (zaenkrat _archive2)
+/*$archive_table = '0';
+$archive_table_string = '_archive1';*/
+/*$archive_table = '2';
+$archive_table_string = '_archive2';*/
+$archive_table = '3';
+$archive_table_string = '_archive3';
+
+
+// Arhiviramo specificno anketo
+if($survey_id != ''){
+ $sql = sisplet_query("SELECT * FROM srv_anketa WHERE active='0' AND id > '0' AND db_table = '1' ".$survey_id."");
+}
+// Loop čez aktivne ankete, ali mlajše od 3 mesecev (od zadnje spremembe, ali da so takrat pretekle)
+else{
+ $sql = sisplet_query("SELECT * FROM srv_anketa
+ WHERE active='0'
+ AND id > '0'
+ AND db_table = '1'
+ AND edit_time < NOW() - INTERVAL 3 MONTH
+ AND expire < NOW() - INTERVAL 3 MONTH
+ ".$survey_id."
+ ".$start."
+ LIMIT ".$limit."
+ ");
+}
+if (!$sql) { echo mysqli_error($GLOBALS['connect_db']).' 50'; die(); }
+
+
+echo 'Arhiviranje '.mysqli_num_rows($sql).' anket.<hr>';
+
+
+// Loop po anketah
+while ($row = mysqli_fetch_array($sql)) {
+
+ $s = sisplet_query("START TRANSACTION");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 60'; die(); }
+
+ echo 'Anketa '.$row['id'].'<br />';
+
+
+ // Arhiviranje tabele srv_user_grupa
+ archive_srv_user_grupa($row['id']);
+
+ // Arhiviranje tabele srv_data_vrednost
+ archive_srv_data_vrednost($row['id']);
+
+ // Arhiviranje tabele srv_data_grid
+ archive_srv_data_grid($row['id']);
+
+ // Arhiviranje tabele srv_data_text
+ archive_srv_data_text($row['id']);
+
+ // Arhiviranje tabele srv_data_textgrid
+ archive_srv_data_textgrid($row['id']);
+
+ // Arhiviranje tabele srv_data_checkgrid
+ archive_srv_data_checkgrid($row['id']);
+
+ // Arhiviranje tabele srv_tracking
+ archive_srv_tracking($row['id']);
+
+
+ // Popravimo anketo med arhivske (ni vec _active)
+ $s = sisplet_query("UPDATE srv_anketa SET db_table = '".$archive_table."' WHERE id = '$row[id]'");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 70'; die(); }
+
+
+ //$s = sisplet_query("ROLLBACK");
+ $s = sisplet_query("COMMIT");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 80'; die(); }
+
+
+ flush(); @ob_flush();
+}
+
+
+
+// ARHIVIRANJE srv_user_grupa
+function archive_srv_user_grupa($ank_id){
+ global $archive_table_string;
+
+ // Vstavimo v arhivsko tabelo (srv_user_grupa_archive2)
+ $sql1 = sisplet_query("INSERT INTO srv_user_grupa".$archive_table_string." (gru_id, usr_id, time_edit, preskocena)
+ SELECT d2.gru_id, d2.usr_id, d2.time_edit, d2.preskocena
+ FROM srv_user_grupa_active d2, srv_grupa g
+ WHERE d2.gru_id = g.id
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 90'; die(); }
+
+ // Pobrisemo iz aktivne tabele
+ $s = sisplet_query("DELETE d
+ FROM srv_user_grupa_active d, srv_grupa g
+ WHERE d.gru_id = g.id
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 91'; die(); }
+}
+
+
+// ARHIVIRANJE srv_data_vrednost
+function archive_srv_data_vrednost($ank_id){
+ global $archive_table_string;
+
+ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja
+ sisplet_query("SET FOREIGN_KEY_CHECKS=0");
+
+ // Vstavimo v arhivsko tabelo (srv_data_vrednost_archive2)
+ $sql1 = sisplet_query("INSERT INTO srv_data_vrednost".$archive_table_string." (spr_id, vre_id, usr_id, loop_id)
+ SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.loop_id
+ FROM srv_data_vrednost_active d2, srv_spremenljivka s, srv_grupa g
+ WHERE d2.spr_id = s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 100'; die(); }
+
+ sisplet_query("SET FOREIGN_KEY_CHECKS=1");
+
+ // Pobrisemo iz aktivne tabele
+ $s = sisplet_query("DELETE d
+ FROM srv_data_vrednost_active d, srv_spremenljivka s, srv_grupa g
+ WHERE d.spr_id = s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 101'; die(); }
+}
+
+
+// ARHIVIRANJE srv_data_text
+function archive_srv_data_text($ank_id){
+ global $archive_table_string;
+
+ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja
+ sisplet_query("SET FOREIGN_KEY_CHECKS=0");
+
+ // Vstavimo v arhivsko tabelo (srv_data_text)
+ $sql1 = sisplet_query("INSERT INTO srv_data_text".$archive_table_string." (spr_id, vre_id, text, text2, usr_id, loop_id)
+ SELECT d2.spr_id, d2.vre_id, d2.text, d2.text2, d2.usr_id, d2.loop_id
+ FROM srv_data_text_active d2, srv_spremenljivka s, srv_grupa g
+ WHERE d2.spr_id = s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 110'; die(); }
+
+ sisplet_query("SET FOREIGN_KEY_CHECKS=1");
+
+ // Pobrisemo iz aktivne tabele
+ $s = sisplet_query("DELETE d
+ FROM srv_data_text_active d, srv_spremenljivka s, srv_grupa g
+ WHERE d.spr_id = s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 111'; die(); }
+
+
+ // Se dodatno kopiranje za komentarje (kjer je spr_id=0)
+ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja
+ sisplet_query("SET FOREIGN_KEY_CHECKS=0");
+
+ $sql1 = sisplet_query("INSERT INTO srv_data_text".$archive_table_string." (spr_id, vre_id, text, text2, usr_id, loop_id)
+ SELECT d2.spr_id, d2.vre_id, d2.text, d2.text2, d2.usr_id, d2.loop_id
+ FROM srv_data_text_active d2, srv_spremenljivka s, srv_grupa g
+ WHERE d2.spr_id = '0'
+ AND d2.vre_id = s.id AND d2.vre_id > '0'
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 112'; die(); }
+
+ sisplet_query("SET FOREIGN_KEY_CHECKS=1");
+
+ // Pobrisemo iz aktivne tabele
+ $s = sisplet_query("DELETE d
+ FROM srv_data_text_active d, srv_spremenljivka s, srv_grupa g
+ WHERE d.spr_id = '0'
+ AND d.vre_id = s.id AND d.vre_id > '0'
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 113'; die(); }
+}
+
+
+// ARHIVIRANJE srv_data_grid
+function archive_srv_data_grid($ank_id){
+ global $archive_table_string;
+
+ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja
+ sisplet_query("SET FOREIGN_KEY_CHECKS=0");
+
+ // Vstavimo v arhivsko tabelo (srv_data_grid)
+ $sql1 = sisplet_query("INSERT INTO srv_data_grid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, loop_id)
+ SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.loop_id
+ FROM srv_data_grid_active d2, srv_spremenljivka s, srv_grupa g
+ WHERE d2.spr_id = s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 210'; die(); }
+
+ sisplet_query("SET FOREIGN_KEY_CHECKS=1");
+
+ // Pobrisemo iz aktivne tabele
+ $s = sisplet_query("DELETE d
+ FROM srv_data_grid_active d, srv_spremenljivka s, srv_grupa g
+ WHERE d.spr_id = s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 211'; die(); }
+
+
+ // Se dodatno za kombinirane tabele
+ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja
+ sisplet_query("SET FOREIGN_KEY_CHECKS=0");
+
+ $sql1 = sisplet_query("INSERT INTO srv_data_grid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, loop_id)
+ SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.loop_id
+ FROM srv_data_grid_active d2, srv_spremenljivka s, srv_grupa g, srv_grid_multiple m
+ WHERE d2.spr_id = m.spr_id AND m.parent=s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 212'; die(); }
+
+ sisplet_query("SET FOREIGN_KEY_CHECKS=1");
+
+ // Pobrisemo iz aktivne tabele
+ $s = sisplet_query("DELETE d
+ FROM srv_data_grid_active d, srv_spremenljivka s, srv_grupa g, srv_grid_multiple m
+ WHERE d.spr_id = m.spr_id AND m.parent=s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 213'; die(); }
+}
+
+
+// ARHIVIRANJE srv_data_textgrid
+function archive_srv_data_textgrid($ank_id){
+ global $archive_table_string;
+
+ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja
+ sisplet_query("SET FOREIGN_KEY_CHECKS=0");
+
+ // Vstavimo v arhivsko tabelo (srv_data_textgrid)
+ $sql1 = sisplet_query("INSERT INTO srv_data_textgrid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, text, loop_id)
+ SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.text, d2.loop_id
+ FROM srv_data_textgrid_active d2, srv_spremenljivka s, srv_grupa g
+ WHERE d2.spr_id = s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 310'; die(); }
+
+ sisplet_query("SET FOREIGN_KEY_CHECKS=1");
+
+ // Pobrisemo iz aktivne tabele
+ $s = sisplet_query("DELETE d
+ FROM srv_data_textgrid_active d, srv_spremenljivka s, srv_grupa g
+ WHERE d.spr_id = s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 311'; die(); }
+
+
+ // Se dodatno za kombinirane tabele
+ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja
+ sisplet_query("SET FOREIGN_KEY_CHECKS=0");
+
+ $sql1 = sisplet_query("INSERT INTO srv_data_textgrid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, text, loop_id)
+ SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.text, d2.loop_id
+ FROM srv_data_textgrid_active d2, srv_spremenljivka s, srv_grupa g, srv_grid_multiple m
+ WHERE d2.spr_id = m.spr_id AND m.parent=s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 312'; die(); }
+
+ sisplet_query("SET FOREIGN_KEY_CHECKS=1");
+
+ // Pobrisemo iz aktivne tabele
+ $s = sisplet_query("DELETE d
+ FROM srv_data_textgrid_active d, srv_spremenljivka s, srv_grupa g, srv_grid_multiple m
+ WHERE d.spr_id = m.spr_id AND m.parent=s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 313'; die(); }
+}
+
+
+// ARHIVIRANJE srv_data_checkgrid
+function archive_srv_data_checkgrid($ank_id){
+ global $archive_table_string;
+
+ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja
+ sisplet_query("SET FOREIGN_KEY_CHECKS=0");
+
+ // Vstavimo v arhivsko tabelo (srv_data_checkgrid)
+ $sql1 = sisplet_query("INSERT INTO srv_data_checkgrid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, loop_id)
+ SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.loop_id
+ FROM srv_data_checkgrid_active d2, srv_spremenljivka s, srv_grupa g
+ WHERE d2.spr_id = s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 410'; die(); }
+
+ sisplet_query("SET FOREIGN_KEY_CHECKS=1");
+
+ // Pobrisemo iz aktivne tabele
+ $s = sisplet_query("DELETE d
+ FROM srv_data_checkgrid_active d, srv_spremenljivka s, srv_grupa g
+ WHERE d.spr_id = s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 411'; die(); }
+
+
+ // Se dodatno za kombinirane tabele
+ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja
+ sisplet_query("SET FOREIGN_KEY_CHECKS=0");
+ $sql1 = sisplet_query("INSERT INTO srv_data_checkgrid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, loop_id)
+ SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.loop_id
+ FROM srv_data_checkgrid_active d2, srv_spremenljivka s, srv_grupa g, srv_grid_multiple m
+ WHERE d2.spr_id = m.spr_id AND m.parent=s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 412'; die(); }
+
+ sisplet_query("SET FOREIGN_KEY_CHECKS=1");
+
+ // Pobrisemo iz aktivne tabele
+ $s = sisplet_query("DELETE d
+ FROM srv_data_checkgrid_active d, srv_spremenljivka s, srv_grupa g, srv_grid_multiple m
+ WHERE d.spr_id = m.spr_id AND m.parent=s.id
+ AND s.gru_id = g.id AND s.gru_id > '0'
+ AND g.ank_id = '$ank_id'
+ ");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 413'; die(); }
+}
+
+
+// ARHIVIRANJE srv_tracking
+function archive_srv_tracking($ank_id){
+ global $archive_table_string;
+
+ // Vstavimo v arhivsko tabelo (srv_tracking)
+ $sql1 = sisplet_query("INSERT INTO srv_tracking".$archive_table_string." (`ank_id`, `datetime`, `ip`, `user`, `get`, `post`, `status`, `time_seconds`)
+ SELECT d2.ank_id, d2.datetime, d2.ip, d2.user, d2.get, d2.post, d2.status, d2.time_seconds
+ FROM srv_tracking_active d2
+ WHERE d2.ank_id = '$ank_id'
+ ");
+ if (!$sql1) { echo mysqli_error($GLOBALS['connect_db']).' 510'; die(); }
+
+ // Pobrisemo iz aktivne tabele (srv_tracking_active)
+ $s = sisplet_query("DELETE FROM srv_tracking_active WHERE ank_id = '$ank_id'");
+ if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 511'; die(); }
+}
+
+
+?> \ No newline at end of file
diff --git a/utils/1kaUtils/app_settings_copy.php b/utils/1kaUtils/app_settings_copy.php
new file mode 100644
index 0000000..e437ed5
--- /dev/null
+++ b/utils/1kaUtils/app_settings_copy.php
@@ -0,0 +1,288 @@
+<?php
+
+/**
+*
+* prenese nastavitve aplikacije iz settings_optional.php v sql bazo
+*
+*/
+
+
+ini_set('display_errors', '1');
+ini_set('display_startup_errors', '1');
+error_reporting(E_ALL);
+
+
+include_once('../../function.php');
+include_once('../../vendor/autoload.php');
+include_once($site_path.'/settings_optional.php');
+
+
+echo '<br><br>';
+echo $site_url;
+echo '<br><br>';
+echo $site_path;
+echo '<br><br>';
+
+
+if($site_domain == '')
+ die();
+
+$sql = sisplet_query("DELETE FROM app_settings WHERE domain='".$site_domain."'");
+
+
+// Debuging - 0 ali 1, ali imamo debug vključen (privzeto je izključen)
+global $debug;
+$sql = sisplet_query("INSERT INTO app_settings SET value='".$debug."', domain='".$site_domain."', what='debug'");
+
+
+// tip instalacije (lastna - 0, www - 1, aai - 2, virtualka - 3)
+global $virtual_domain;
+global $lastna_instalacija;
+global $aai_instalacija;
+
+if($virtual_domain)
+ sisplet_query("INSERT INTO app_settings SET value='3', domain='".$site_domain."', what='installation_type'");
+elseif($lastna_instalacija)
+ sisplet_query("INSERT INTO app_settings SET value='0', domain='".$site_domain."', what='installation_type'");
+elseif($aai_instalacija)
+ sisplet_query("INSERT INTO app_settings SET value='2', domain='".$site_domain."', what='installation_type'");
+else
+ sisplet_query("INSERT INTO app_settings SET value='1', domain='".$site_domain."', what='installation_type'");
+
+
+
+/* DODATNE NASTAVITVE APLIKACIJE ZA LASTNE NAMESTITVE */
+global $app_settings;
+
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['app_name']."', domain='".$site_domain."', what='app_settings-app_name'");
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['admin_email']."', domain='".$site_domain."', what='app_settings-admin_email'");
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['owner']."', domain='".$site_domain."', what='app_settings-owner'");
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['owner_website']."', domain='".$site_domain."', what='app_settings-owner_website'");
+
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['footer_custom']."', domain='".$site_domain."', what='app_settings-footer_custom'");
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['footer_text']."', domain='".$site_domain."', what='app_settings-footer_text'");
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['footer_survey_custom']."', domain='".$site_domain."', what='app_settings-footer_survey_custom'");
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['footer_survey_text']."', domain='".$site_domain."', what='app_settings-footer_survey_text'");
+
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['email_signature_custom']."', domain='".$site_domain."', what='app_settings-email_signature_custom'");
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['email_signature_text']."', domain='".$site_domain."', what='app_settings-email_signature_text'");
+
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['survey_finish_url']."', domain='".$site_domain."', what='app_settings-survey_finish_url'");
+
+//sisplet_query("INSERT INTO app_settings SET value='".$app_settings['admin_allow_only_ip']."', domain='".$site_domain."', what='app_settings-admin_allow_only_ip'");
+
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['export_type']."', domain='".$site_domain."', what='app_settings-export_type'");
+
+sisplet_query("INSERT INTO app_settings SET value='".$app_settings['commercial_packages']."', domain='".$site_domain."', what='app_settings-commercial_packages'");
+
+
+/* OMEJITVE APLIKACIJE */
+global $app_limits;
+
+sisplet_query("INSERT INTO app_settings SET value='".$app_limits['clicks_per_minute_limit']."', domain='".$site_domain."', what='app_limits-clicks_per_minute_limit'");
+sisplet_query("INSERT INTO app_settings SET value='".$app_limits['question_count_limit']."', domain='".$site_domain."', what='app_limits-question_count_limit'");
+sisplet_query("INSERT INTO app_settings SET value='".$app_limits['response_count_limit']."', domain='".$site_domain."', what='app_limits-response_count_limit'");
+sisplet_query("INSERT INTO app_settings SET value='".$app_limits['invitation_count_limit']."', domain='".$site_domain."', what='app_limits-invitation_count_limit'");
+
+if(is_array($$app_settings['admin_allow_only_ip']))
+ $admin_allow_only_ip_string = implode(',', $app_settings['admin_allow_only_ip']);
+else
+ $admin_allow_only_ip_string = $app_settings['admin_allow_only_ip'];
+
+sisplet_query("INSERT INTO app_settings SET value='".$admin_allow_only_ip_string."', domain='".$site_domain."', what='app_limits-admin_allow_only_ip'"); // !!!!
+
+
+// Nastavitev email streznika za posiljanje mailov
+global $email_server_settings;
+global $email_server_fromSurvey;
+
+sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['SMTPFrom']."', domain='".$site_domain."', what='email_server_settings-SMTPFrom'");
+sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['SMTPFromNice']."', domain='".$site_domain."', what='email_server_settings-SMTPFromNice'");
+sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['SMTPReplyTo']."', domain='".$site_domain."', what='email_server_settings-SMTPReplyTo'");
+sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['SMTPHost']."', domain='".$site_domain."', what='email_server_settings-SMTPHost'");
+sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['SMTPPort']."', domain='".$site_domain."', what='email_server_settings-SMTPPort'");
+sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['SMTPSecure']."', domain='".$site_domain."', what='email_server_settings-SMTPSecure'");
+sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['SMTPAuth']."', domain='".$site_domain."', what='email_server_settings-SMTPAuth'");
+sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['SMTPUsername']."', domain='".$site_domain."', what='email_server_settings-SMTPUsername'");
+sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['SMTPPassword']."', domain='".$site_domain."', what='email_server_settings-SMTPPassword'");
+
+sisplet_query("INSERT INTO app_settings SET value='".$email_server_fromSurvey."', domain='".$site_domain."', what='email_server_fromSurvey'");
+
+if(isset($email_server_settings['secondary_mail'])){
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['secondary_mail']['SMTPFrom']."', domain='".$site_domain."', what='email_server_settings-secondary_mail-SMTPFrom'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['secondary_mail']['SMTPFromNice']."', domain='".$site_domain."', what='email_server_settings-secondary_mail-SMTPFromNice'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['secondary_mail']['SMTPReplyTo']."', domain='".$site_domain."', what='email_server_settings-secondary_mail-SMTPReplyTo'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['secondary_mail']['SMTPHost']."', domain='".$site_domain."', what='email_server_settings-secondary_mail-SMTPHost'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['secondary_mail']['SMTPPort']."', domain='".$site_domain."', what='email_server_settings-secondary_mail-SMTPPort'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['secondary_mail']['SMTPSecure']."', domain='".$site_domain."', what='email_server_settings-secondary_mail-SMTPSecure'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['secondary_mail']['SMTPAuth']."', domain='".$site_domain."', what='email_server_settings-secondary_mail-SMTPAuth'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['secondary_mail']['SMTPUsername']."', domain='".$site_domain."', what='email_server_settings-secondary_mail-SMTPUsername'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['secondary_mail']['SMTPPassword']."', domain='".$site_domain."', what='email_server_settings-secondary_mail-SMTPPassword'");
+}
+
+if(isset($email_server_settings['payments_mail'])){
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['payments_mail']['SMTPFrom']."', domain='".$site_domain."', what='email_server_settings-payments_mail-SMTPFrom'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['payments_mail']['SMTPFromNice']."', domain='".$site_domain."', what='email_server_settings-payments_mail-SMTPFromNice'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['payments_mail']['SMTPReplyTo']."', domain='".$site_domain."', what='email_server_settings-payments_mail-SMTPReplyTo'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['payments_mail']['SMTPHost']."', domain='".$site_domain."', what='email_server_settings-payments_mail-SMTPHost'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['payments_mail']['SMTPPort']."', domain='".$site_domain."', what='email_server_settings-payments_mail-SMTPPort'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['payments_mail']['SMTPSecure']."', domain='".$site_domain."', what='email_server_settings-payments_mail-SMTPSecure'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['payments_mail']['SMTPAuth']."', domain='".$site_domain."', what='email_server_settings-payments_mail-SMTPAuth'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['payments_mail']['SMTPUsername']."', domain='".$site_domain."', what='email_server_settings-payments_mail-SMTPUsername'");
+ sisplet_query("INSERT INTO app_settings SET value='".$email_server_settings['payments_mail']['SMTPPassword']."', domain='".$site_domain."', what='email_server_settings-payments_mail-SMTPPassword'");
+}
+
+
+/* DODATNE NASTAVITVE APLIKACIJE ZA ADMINISTRATORJE */
+global $confirm_registration;
+global $confirm_registration_admin;
+global $gdpr_admin_email;
+
+if(is_array($confirm_registration_admin))
+ $confirm_registration_admin_string = implode(',', $confirm_registration_admin);
+else
+ $confirm_registration_admin_string = $confirm_registration_admin;
+
+sisplet_query("INSERT INTO app_settings SET value='".$confirm_registration."', domain='".$site_domain."', what='confirm_registration'");
+sisplet_query("INSERT INTO app_settings SET value='".$confirm_registration_admin_string."', domain='".$site_domain."', what='confirm_registration_admin'");
+sisplet_query("INSERT INTO app_settings SET value='".$gdpr_admin_email."', domain='".$site_domain."', what='gdpr_admin_email'");
+
+
+/* METAADMINI - opcijsko */
+/*
+// WWW - vvasja@gmail.com - 100, peter.h1203@gmail.com - 12611, 1ka.techsupport - 72253
+$meta_admin_ids = array('100', '12611', '72253');
+
+// VIRTUALKE - vvasja@gmail.com - 100, peter.h1203@gmail.com - 12611, 1ka.techsupport - 49089
+$meta_admin_ids = array('100', '12611', '49089');
+
+// AAI - Manca Jeras - 13147, Klavdija Mezek - 1417
+$meta_admin_ids = array('1417', '13147');
+
+// LOCALHOST
+$meta_admin_ids = array('1046');
+*/
+global $meta_admin_ids;
+
+if(is_array($meta_admin_ids))
+ $meta_admin_ids_string = implode(',', $meta_admin_ids);
+else
+ $meta_admin_ids_string = $meta_admin_ids;
+
+sisplet_query("INSERT INTO app_settings SET value='".$meta_admin_ids_string."', domain='".$site_domain."', what='meta_admin_ids'");
+
+
+/* DODATNE FUNKCIONALNOSTI APLIKACIJE - GOOGLE */
+global $recaptcha_sitekey;
+global $secret_captcha;
+global $google_login_client_id;
+global $google_login_client_secret;
+global $google_maps_API_key;
+
+if($recaptcha_sitekey != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$recaptcha_sitekey."', domain='".$site_domain."', what='google-recaptcha_sitekey'");
+if($secret_captcha != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$secret_captcha."', domain='".$site_domain."', what='google-secret_captcha'");
+if($google_login_client_id != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$google_login_client_id."', domain='".$site_domain."', what='google-login_client_id'");
+if($google_login_client_secret != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$google_login_client_secret."', domain='".$site_domain."', what='google-login_client_secret'");
+if($google_maps_API_key != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$google_maps_API_key."', domain='".$site_domain."', what='google-maps_API_key'");
+
+
+/* DODATNE FUNKCIONALNOSTI APLIKACIJE - FB */
+global $facebook_appid;
+global $facebook_appsecret;
+
+if($facebook_appid != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$facebook_appid."', domain='".$site_domain."', what='facebook-appid'");
+if($facebook_appid != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$facebook_appsecret."', domain='".$site_domain."', what='facebook-appsecret'");
+
+
+/**
+ * Potrebno za delovanje modula "maza"
+ * Firebase Cloud Messaging server key is needed to work with module "Mobile aplication for respondents"
+ * NextPinMainToken and password is needed to work with NextPin API
+ */
+global $FCM_server_key;
+global $APP_special_login_key;
+global $NextPinMainToken;
+global $NextPinMainPassword;
+
+if($FCM_server_key != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$FCM_server_key."', domain='".$site_domain."', what='maza-FCM_server_key'");
+if($APP_special_login_key != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$APP_special_login_key."', domain='".$site_domain."', what='maza-APP_special_login_key'");
+if($NextPinMainToken != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$NextPinMainToken."', domain='".$site_domain."', what='maza-NextPinMainToken'");
+if($NextPinMainPassword != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$NextPinMainPassword."', domain='".$site_domain."', what='maza-NextPinMainPassword'");
+
+/**
+ * Nastavitve hierarhije
+ */
+global $hierarhija_folder_id;
+global $hierarhija_default_id;
+
+if($hierarhija_folder_id != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$hierarhija_folder_id."', domain='".$site_domain."', what='hierarhija-folder_id'");
+if($hierarhija_default_id != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$hierarhija_default_id."', domain='".$site_domain."', what='hierarhija-default_id'");
+
+
+/**
+ * Squalo API za vabila
+*/
+global $squalo_user;
+global $squalo_key;
+
+if($squalo_user != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$squalo_user."', domain='".$site_domain."', what='squalo-user'");
+if($squalo_key != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$squalo_key."', domain='".$site_domain."', what='squalo-key'");
+
+
+/* PLACEVANJE */
+/**
+ * Izdajanje racunov preko cebelice
+ */
+global $cebelica_api;
+
+if($cebelica_api != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$cebelica_api."', domain='".$site_domain."', what='cebelica_api'");
+
+
+/**
+ * Stripe za placevanje s kreditno kartico
+ */
+global $stripe_key;
+global $stripe_secret;
+
+if($stripe_key != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$stripe_key."', domain='".$site_domain."', what='stripe-key'");
+if($stripe_secret != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$stripe_secret."', domain='".$site_domain."', what='stripe-secret'");
+
+
+/**
+ * Placevanje s paypalom
+ */
+global $paypal_account;
+global $paypal_client_id;
+global $paypal_secret;
+
+if($paypal_account != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$paypal_account."', domain='".$site_domain."', what='paypal-account'");
+if($paypal_client_id != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$paypal_client_id."', domain='".$site_domain."', what='paypal-client_id'");
+if($paypal_secret != '')
+ sisplet_query("INSERT INTO app_settings SET value='".$paypal_secret."', domain='".$site_domain."', what='paypal-secret'");
+
+
+
+echo 'settings_optional.php spremenljivke uspešno prenešene v bazo';
+
+
+?> \ No newline at end of file