diff --git a/admin/survey/SurveyAdmin.php b/admin/survey/SurveyAdmin.php
index 49ab4b59f..1362f7a71 100644
--- a/admin/survey/SurveyAdmin.php
+++ b/admin/survey/SurveyAdmin.php
@@ -220,8 +220,7 @@ class SurveyAdmin
echo '';
// Ce imamo vklopljene komercialne pakete
- global $app_settings;
- if($app_settings['commercial_packages']){
+ if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') === true){
$userAccess = UserAccess::getInstance($global_user_id);
// Ce gre za staro anketo nimamo omejitev
@@ -264,7 +263,6 @@ class SurveyAdmin
global $lang;
global $admin_type;
global $site_domain;
- global $aai_instalacija;
echo '
';
@@ -510,8 +508,7 @@ class SurveyAdmin
// Gumb za nadgraditev paketa v mojih anketah (ce imamo vklopljene pakete in nimamo 3ka paketa)
if($this->anketa == 0){
- global $app_settings;
- if($app_settings['commercial_packages'] == true){
+ if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') === true){
// Preverimo trenuten paket uporabnika
$userAccess = UserAccess::getInstance($global_user_id);
@@ -683,8 +680,12 @@ class SurveyAdmin
}
// GDPR popup za prejemanje obvestil - force ce ga se ni izpolnil - SAMO NA www.1ka.si, test.1ka.si in virtualkah
- if (($site_url == 'https://www.1ka.si/' || $site_url == 'http://test.1ka.si/' || $site_url == 'https://1ka.arnes.si/' || ($cookie_domain == '.1ka.si' && $virtual_domain == true))
- && User::getInstance()->getSetting($setting='gdpr_agree') == '-1') {
+ if ( ($site_url == 'http://test.1ka.si/'
+ || isWWW()
+ || isAAI()
+ || ($cookie_domain == '.1ka.si' && isVirtual()))
+ && User::getInstance()->getSetting($setting='gdpr_agree') == '-1'
+ ) {
// Avtomatsko prikazemo po loadu
echo '';
@@ -710,9 +711,7 @@ class SurveyAdmin
// Priakz footerja
private function displayFooter(){
global $lang;
- global $app_settings;
global $site_frontend;
- global $aai_instalacija;
global $mysql_database_name;
@@ -723,14 +722,14 @@ class SurveyAdmin
echo '';
// Segment paket
- global $app_settings;
- if($app_settings['commercial_packages'] == true){
+ if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') === true){
echo '
';
$userAccess = UserAccess::getInstance($uid);
@@ -1510,7 +1508,6 @@ class Dostop {
public function ajax_confirm_user_email(){
global $pass_salt;
global $lang;
- global $app_settings;
$uid = (!empty($_POST['uid']) ? $_POST['uid'] : NULL);
@@ -1540,7 +1537,7 @@ class Dostop {
// Ce gre slucajno za virutalko
$Subject = $lang['confirmed_user_mail_subject'];
- $PageName = $app_settings['app_name'];
+ $PageName = AppSettings::getInstance()->getSetting('app_settings-app_name');
$ZaMail = ''.' '.$Subject.'';
// Besedilo v lang dilu je potrebno popravit, ker nimamo vec cel kup parametrov
diff --git a/admin/survey/classes/class.GDPR.php b/admin/survey/classes/class.GDPR.php
index 2776740a4..549f5eb96 100644
--- a/admin/survey/classes/class.GDPR.php
+++ b/admin/survey/classes/class.GDPR.php
@@ -1471,8 +1471,6 @@ class GDPR{
// Poskrbi za vse potrebno ko respondent zahteva izbris oz. vpogled v podatke
public function sendGDPRRequest($request_data){
global $lang;
- global $gdpr_admin_email;
- global $app_settings;
$errors = array();
@@ -1635,7 +1633,7 @@ class GDPR{
//$MA->addRecipients('dusan.rutnik@gorenje.com');
$MA->addRecipients('gdpr@gorenje.com');
}
- elseif(isset($gdpr_admin_email) && $gdpr_admin_email != ''){
+ elseif(AppSettings::getInstance()->getSetting('gdpr_admin_email') !== false){
$MA->addRecipients($gdpr_admin_email);
}
else{
diff --git a/admin/survey/classes/class.Library.php b/admin/survey/classes/class.Library.php
index 1f28fcd7b..4b5b67e26 100644
--- a/admin/survey/classes/class.Library.php
+++ b/admin/survey/classes/class.Library.php
@@ -954,9 +954,8 @@ class Library {
$hierarhija = (empty($_POST['hierarhija']) ? false : true);
if($hierarhija && $ank_id == 'privzeta'){
- global $hierarhija_default_id;
- $ank_id = $hierarhija_default_id;
+ $ank_id = AppSettings::getInstance()->getSetting('hierarhija-default_id');
}
if ($anketa > 0) {
@@ -1030,10 +1029,10 @@ class Library {
// Če imamo hierarhijo in je privzeta anketa potem preverimo v settings_optional.php
if(!empty($_POST['hierarhija']) && $ank_id == 'privzeta'){
- global $hierarhija_default_id;
- $ank_id=$hierarhija_default_id;
+ $ank_id = AppSettings::getInstance()->getSetting('hierarhija-default_id');
}
- }else {
+ }
+ else {
$API_call = true;
}
diff --git a/admin/survey/classes/class.NewSurvey.php b/admin/survey/classes/class.NewSurvey.php
index b54f44c4f..e468ed9f4 100644
--- a/admin/survey/classes/class.NewSurvey.php
+++ b/admin/survey/classes/class.NewSurvey.php
@@ -46,8 +46,6 @@ class NewSurvey{
global $lang;
global $site_url;
global $site_path;
- global $virtual_domain;
- global $debug;
global $admin_type;
echo '
'.$lang['srv_newSurvey_title'].':
';
@@ -56,10 +54,10 @@ class NewSurvey{
echo ''.$lang['srv_newSurvey_survey_new'].'';
// Anketa iz predloga (knjiznice) - samo na www.1ka.si, testu in arnesu
- if((strpos($site_url, 'www.1ka.si') !== false && !$virtual_domain)
+ if((strpos($site_url, 'www.1ka.si') !== false && !isVirtual())
|| strpos($site_url, 'test.1ka.si')
|| strpos($site_url, '1ka.arnes.si')
- || $debug == '1'){
+ || isDebug()){
echo ''.$lang['srv_newSurvey_survey_template'].'';
@@ -540,7 +538,6 @@ class NewSurvey{
echo '
';
// Javascript s katerim povozimo urlje za izvoze, ki niso na voljo v paketu
- global $app_settings;
- if($app_settings['commercial_packages'] == true){
+ if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') === true){
echo '';
}
}
diff --git a/admin/survey/classes/surveyAnalysis/class.SurveyBreak.php b/admin/survey/classes/surveyAnalysis/class.SurveyBreak.php
index aea8c684d..308f55614 100644
--- a/admin/survey/classes/surveyAnalysis/class.SurveyBreak.php
+++ b/admin/survey/classes/surveyAnalysis/class.SurveyBreak.php
@@ -1526,8 +1526,7 @@ class SurveyBreak
echo '
';
// Javascript s katerim povozimo urlje za izvoze, ki niso na voljo v paketu
- global $app_settings;
- if($app_settings['commercial_packages'] == true){
+ if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') === true){
echo '';
}
}
diff --git a/admin/survey/classes/surveyEmails/class.SurveyAlert.php b/admin/survey/classes/surveyEmails/class.SurveyAlert.php
index 35a8cc2d4..b0e0f33fd 100644
--- a/admin/survey/classes/surveyEmails/class.SurveyAlert.php
+++ b/admin/survey/classes/surveyEmails/class.SurveyAlert.php
@@ -93,7 +93,7 @@ class SurveyAlert
* se s pomočjo crontaba zaganja vsak dan samodejno.
*/
static function prepareSendExpireAlerts() {
- global $site_url, $lang, $mysql_database_name, $app_settings;
+ global $site_url, $lang, $mysql_database_name;
// napolnimo tabelo srv_alert v bazi surveycrontab
$sqlSurvey = sisplet_query("SELECT active FROM srv_anketa WHERE id='".self::getSurveyId()."'");
@@ -245,7 +245,7 @@ class SurveyAlert
* Funkcija pošlje emaile ob spremembi aktivnosti ankete
*/
static function sendMailActive() {
- global $lang, $site_url, $site_path, $app_settings;
+ global $lang, $site_url, $site_path;
// poiščemo vse email naslove
// poiscemo e-maile od avtorja in userjev v dostopu
@@ -368,7 +368,7 @@ class SurveyAlert
* Funkcija pošlje emaile ob izbrisu ankete
*/
static function sendMailDelete() {
- global $lang, $site_url, $site_path, $app_settings;
+ global $lang, $site_url, $site_path;
// poiščemo vse email naslove
// poiscemo e-maile od avtorja in userjev v dostopu
@@ -484,7 +484,7 @@ class SurveyAlert
}
static function setDefaultAlertBeforeExpire() {
- global $lang, $site_url, $site_path, $app_settings;
+ global $lang, $site_url, $site_path;
$turn_on_alert = false;
@@ -535,7 +535,6 @@ class SurveyAlert
static function setDefaultAlertActivation() {
global $lang;
global $global_user_id;
- global $app_settings;
$anketa = self::getSurveyId();
diff --git a/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php b/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php
index 403a07dc1..6ea21f359 100644
--- a/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php
+++ b/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php
@@ -89,7 +89,6 @@ class SurveyInvitationsNew {
function action($action) {
global $lang;
global $site_url;
- global $app_settings;
global $global_user_id;
$NoNavi = $_POST['noNavi'];
@@ -2764,7 +2763,7 @@ class SurveyInvitationsNew {
}
function displayNavigation() {
- global $lang, $admin_type, $global_user_id, $app_settings;
+ global $lang, $admin_type, $global_user_id;
$isEmail = (int)SurveyInfo::getInstance()->checkSurveyModule('email');
@@ -3713,7 +3712,7 @@ class SurveyInvitationsNew {
// Glavno posiljanje mail vabil
function sendMail() {
- global $lang, $site_path, $site_url, $global_user_id, $lastna_instalacija;
+ global $lang, $site_path, $site_url, $global_user_id;
Common::getInstance()->Init($this->sid);
@@ -3799,7 +3798,7 @@ class SurveyInvitationsNew {
$numRows = mysqli_num_rows($sql_query);
# če pošiljamo na večje število reposndentov obvestimo info@1ka.si
- if ($numRows > NOTIFY_INFO1KA && (!isset($lastna_instalacija) || $lastna_instalacija == false)) {
+ if ($numRows > NOTIFY_INFO1KA && !isLastnaInstalacija()) {
// Gorenje tega nima
if (!Common::checkModule('gorenje')){
@@ -6968,7 +6967,7 @@ class SurveyInvitationsNew {
}
function showInvitationStatus() {
- global $admin_type, $app_settings, $global_user_id;
+ global $admin_type, $global_user_id;
$isEmail = (int)SurveyInfo::getInstance()->checkSurveyModule('email');
$d = new Dostop();
@@ -7004,7 +7003,7 @@ class SurveyInvitationsNew {
// Prikaz statusov posiljanj
private function displayInvitationStatusNew() {
- global $lang, $admin_type, $global_user_id, $site_url, $site_path, $app_settings;
+ global $lang, $admin_type, $global_user_id, $site_url, $site_path;
$isEmail = (int)SurveyInfo::getInstance()->checkSurveyModule('email');
@@ -7470,7 +7469,7 @@ class SurveyInvitationsNew {
// Prikaz statusov posiljanj pri volitvah
private function displayInvitationStatusVoting() {
- global $lang, $admin_type, $global_user_id, $site_url, $site_path, $app_settings;
+ global $lang, $admin_type, $global_user_id, $site_url, $site_path;
$isEmail = (int)SurveyInfo::getInstance()->checkSurveyModule('email');
@@ -7610,7 +7609,7 @@ class SurveyInvitationsNew {
function showInvitationSettings() {
- global $lang, $admin_type, $global_user_id, $site_url, $site_path, $app_settings;
+ global $lang, $admin_type, $global_user_id, $site_url, $site_path;
$row = $this->surveySettings;
$_email = (int)SurveyInfo::getInstance()->checkSurveyModule('email');
@@ -9831,7 +9830,6 @@ class SurveyInvitationsNew {
global $admin_type;
global $global_user_id;
global $mysql_database_name;
- global $aai_instalacija;
$row = SurveyInfo::getInstance()->getSurveyRow();
@@ -9886,7 +9884,7 @@ class SurveyInvitationsNew {
echo ''.$lang['srv_email_setting_select_server'].' ';
// AAI ima Arnesov smtp
- if($aai_instalacija){
+ if(isAAI()){
echo '';
}
diff --git a/admin/survey/classes/surveyEmails/squalo/class.SqualoApi.php b/admin/survey/classes/surveyEmails/squalo/class.SqualoApi.php
index 6c1c8cf73..1ea7bcb30 100644
--- a/admin/survey/classes/surveyEmails/squalo/class.SqualoApi.php
+++ b/admin/survey/classes/surveyEmails/squalo/class.SqualoApi.php
@@ -18,12 +18,10 @@ class SqualoApi {
private function executeCall($action, $method, $data){
- global $squalo_user;
- global $squalo_key;
// Add credentials
- $data['apiUser'] = $squalo_user;
- $data['apiKey'] = $squalo_key;
+ $data['apiUser'] = AppSettings::getInstance()->getSetting('squalo-user');
+ $data['apiKey'] = AppSettings::getInstance()->getSetting('squalo-key');
// GET call - set url params
if($method == 'GET'){
diff --git a/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php b/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php
index f37c0da24..4cfa18a42 100644
--- a/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php
+++ b/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php
@@ -38,8 +38,6 @@ class SurveyInvitationsSqualo {
private function checkSqualoEnabled(){
global $mysql_database_name;
global $admin_type;
- global $squalo_user;
- global $squalo_key;
// Zaenkrat imajo squalo samo admini
if($admin_type != 0)
@@ -50,7 +48,7 @@ class SurveyInvitationsSqualo {
return false;
// Zaenkrat imajo squalo samo admini
- if(!isset($squalo_user) || $squalo_user == '' || !isset($squalo_key) || $squalo_key == '')
+ if(AppSettings::getInstance()->getSetting('squalo-user') === false || AppSettings::getInstance()->getSetting('squalo-key') === false)
return false;
return true;
diff --git a/admin/survey/index.php b/admin/survey/index.php
index cf08a572d..90d360150 100644
--- a/admin/survey/index.php
+++ b/admin/survey/index.php
@@ -21,7 +21,7 @@
}
- global $site_url, $global_user_id, $app_settings;
+ global $site_url, $global_user_id;
$surveySkin = 0;
@@ -85,8 +85,8 @@
$rowv = mysqli_fetch_array($sqlv);
// Custom head title
- if(isset($app_settings['head_title_custom']) && $app_settings['head_title_custom'] == 1){
- echo ''.$app_settings['head_title_text'].'' . "\n";
+ if(AppSettings::getInstance()->getSetting('app_settings-head_title_custom')){
+ echo ''.AppSettings::getInstance()->getSetting('app_settings-head_title_text').'' . "\n";
}
// Default head title
else{
diff --git a/admin/survey/izvoz.php b/admin/survey/izvoz.php
index 78b95c71f..8f1f6782d 100644
--- a/admin/survey/izvoz.php
+++ b/admin/survey/izvoz.php
@@ -6,7 +6,7 @@ include_once('definition.php');
include_once('../../function.php');
include_once('../../vendor/autoload.php');
-global $site_path, $global_user_id, $admin_type, $lang, $app_settings;
+global $site_path, $global_user_id, $admin_type, $lang;
# error reporting
@@ -143,11 +143,11 @@ elseif(in_array($_GET['m'], array('pdf_teammeter','pdf_employmeter', 'pdf_evoli'
$export_type = 'old';
}
// Ce imamo vklopljeno nastavitev za nove izvoze
-elseif(isset($app_settings['export_type']) && $app_settings['export_type'] == 'new'){
+elseif(AppSettings::getInstance()->getSetting('app_settings-export_type') == 'new'){
$export_type = 'new';
}
// Ce imamo vklopljeno nastavitev za nove izvoze samo za admine
-elseif(isset($app_settings['export_type']) && $app_settings['export_type'] == 'new_admin' && $admin_type == 0){
+elseif(AppSettings::getInstance()->getSetting('app_settings-export_type') == 'new_admin' && $admin_type == 0){
$export_type = 'new';
}
else{
diff --git a/admin/survey/modules/mod_MAZA/class.MAZA.php b/admin/survey/modules/mod_MAZA/class.MAZA.php
index 90bc3dbf4..aefae5279 100644
--- a/admin/survey/modules/mod_MAZA/class.MAZA.php
+++ b/admin/survey/modules/mod_MAZA/class.MAZA.php
@@ -1115,12 +1115,11 @@ class MAZA {
* @return type - json result of curl output
*/
private function send_FCM_mesage_curl($fields){
- #API access key from Google API's Console
- global $FCM_server_key;
+ #API access key from Google API's Console
$headers = array
(
- 'Authorization: key=' . $FCM_server_key,
+ 'Authorization: key=' . AppSettings::getInstance()->getSetting('maza-FCM_server_key'),
'Content-Type: application/json'
);
#Send Reponse To FireBase Server
@@ -1790,16 +1789,14 @@ class MAZA {
* @param type $password - passwor to set in nextpin for this user
*/
public function nextpin_create_user($identifier, $password){
- #credentials to use nextpin API
- global $NextPinMainToken;
-
+ #credentials to use nextpin API
$fields = array
(
'username' => $this->nextpin_token_prefix . $identifier,
'password' => $password
);
- $this -> nextpin_API_call($NextPinMainToken, $fields, 'auth/createUser');
+ $this -> nextpin_API_call(AppSettings::getInstance()->getSetting('maza-NextPinMainToken'), $fields, 'auth/createUser');
}
/**
diff --git a/admin/survey/modules/mod_WPN/class.WPN.php b/admin/survey/modules/mod_WPN/class.WPN.php
index 864a15af4..16ee8896b 100644
--- a/admin/survey/modules/mod_WPN/class.WPN.php
+++ b/admin/survey/modules/mod_WPN/class.WPN.php
@@ -99,7 +99,6 @@ class WPN {
}
public function sendWebPushNotificationsToAll(){
- //global $FCM_server_key;
$title = $_POST['wpn_title'];
$message = $_POST['wpn_message'];
diff --git a/admin/survey/modules/mod_hierarhija/class/HierarhijaAjaxClass.php b/admin/survey/modules/mod_hierarhija/class/HierarhijaAjaxClass.php
index df7ee5bdd..3c3adf8c5 100644
--- a/admin/survey/modules/mod_hierarhija/class/HierarhijaAjaxClass.php
+++ b/admin/survey/modules/mod_hierarhija/class/HierarhijaAjaxClass.php
@@ -922,10 +922,9 @@ class HierarhijaAjax
public function pridobiVseAnketeKiSoVknjizniciZaHierarhijo()
{
global $site_url;
- global $hierarhija_folder_id;
- $ime_mape = sisplet_query("SELECT * FROM srv_library_folder where id='" . $hierarhija_folder_id . "'", "obj")->naslov;
- $ankete_v_knjiznici = sisplet_query("SELECT * FROM srv_library_anketa WHERE folder='" . $hierarhija_folder_id . "'", "obj");
+ $ime_mape = sisplet_query("SELECT * FROM srv_library_folder where id='" . AppSettings::getInstance()->getSetting('hierarhija-folder_id') . "'", "obj")->naslov;
+ $ankete_v_knjiznici = sisplet_query("SELECT * FROM srv_library_anketa WHERE folder='" . AppSettings::getInstance()->getSetting('hierarhija-folder_id') . "'", "obj");
if (empty($ime_mape) && sizeof($ankete_v_knjiznici) == 0) {
echo 'Knjižnica je prazna.';
diff --git a/frontend/api/class.ApiLogin.php b/frontend/api/class.ApiLogin.php
index 3dfe301ce..798918d10 100644
--- a/frontend/api/class.ApiLogin.php
+++ b/frontend/api/class.ApiLogin.php
@@ -32,11 +32,10 @@ class ApiLogin
global $site_path;
global $site_domain;
global $cookie_domain;
- global $virtual_domain;
// Overridi za virtualne domene na TUS strezniku
- if(isset($virtual_domain) && $virtual_domain == true){
+ if(isVirtual()){
if (getenv('apache_site_path') != '') $site_url = getenv('apache_site_url');
if (getenv('apache_site_path') != '') $site_path = getenv('apache_site_path');
if (getenv('apache_site_domain') != '') $site_domain = getenv('apache_site_domain');
@@ -416,16 +415,16 @@ class ApiLogin
global $cookie_domain;
global $originating_domain;
global $keep_domain;
- global $app_settings;
// Ce imamo vklopljeno blokiranje dostopa do admina glede na ip
- if(isset($app_settings['admin_allow_only_ip']) && $app_settings['admin_allow_only_ip'] != '' && !empty($app_settings['admin_allow_only_ip'])){
+ $admin_allow_only_ip = AppSettings::getInstance()->getSetting('app_limits-admin_allow_only_ip');
+ if($admin_allow_only_ip !== false && !empty($admin_allow_only_ip)){
$ip = $_SERVER['REMOTE_ADDR'];
// Preverimo ip - ce se ne ujema ne pustimo logina
- if(!in_array($ip, $app_settings['admin_allow_only_ip'])){
+ if(!in_array($ip, $admin_allow_only_ip)){
header('location: '.$this->page_urls['page_login'.$this->prijava]);
die();
}
@@ -602,8 +601,6 @@ class ApiLogin
{
require_once('../../function/JWT.php');
- global $google_login_client_id;
- global $google_login_client_secret;
global $site_url;
global $lang;
global $proxy;
@@ -617,8 +614,8 @@ class ApiLogin
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query([
- 'client_id' => $google_login_client_id,
- 'client_secret' => $google_login_client_secret,
+ 'client_id' => AppSettings::getInstance()->getSetting('google-login_client_id'),
+ 'client_secret' => AppSettings::getInstance()->getSetting('google-login_client_secret'),
'code' => $oauth2_code,
'grant_type' => 'authorization_code',
'redirect_uri' => $site_url.'frontend/api/google-oauth2.php',
@@ -634,8 +631,8 @@ class ApiLogin
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query([
- 'client_id' => $google_login_client_id,
- 'client_secret' => $google_login_client_secret,
+ 'client_id' => AppSettings::getInstance()->getSetting('google-login_client_id'),
+ 'client_secret' => AppSettings::getInstance()->getSetting('google-login_client_secret'),
'code' => $oauth2_code,
'grant_type' => 'authorization_code',
'redirect_uri' => $site_url.'frontend/api/google-oauth2.php',
@@ -713,11 +710,9 @@ class ApiLogin
// Prijavi userja v 1ko z FB racunom (kopirano iz ProfileClass.php) - PRETESTIRATI
private function userLoginFacebook()
{
- global $facebook_appid;
- global $facebook_appsecret;
global $cookie_path;
- if ($r = file_get_contents("https://graph.facebook.com/v2.9/oauth/access_token?client_id=".$facebook_appid."&redirect_uri=https://www.1ka.si/frontend/api/fb_login.php&client_secret=".$facebook_appsecret."&code=".$_GET['code'])) {
+ if ($r = file_get_contents("https://graph.facebook.com/v2.9/oauth/access_token?client_id=".AppSettings::getInstance()->getSetting('facebook-appid')."&redirect_uri=https://www.1ka.si/frontend/api/fb_login.php&client_secret=".AppSettings::getInstance()->getSetting('facebook-appsecret')."&code=".$_GET['code'])) {
$at = json_decode($r);
$user = json_decode(file_get_contents('https://graph.facebook.com/me?fields=email,first_name,last_name&access_token='.$at->{'access_token'}));
@@ -981,7 +976,6 @@ class ApiLogin
global $site_url;
global $cookie_domain;
global $global_user_id;
- global $aai_instalacija;
setcookie('uid', '', time() - 3600, '/', $cookie_domain);
setcookie('unam', '', time() - 3600, '/', $cookie_domain);
@@ -1022,7 +1016,7 @@ class ApiLogin
}
// Ce gre za arnes aai odjavo odjavimo posebej
- if ($aai_instalacija){
+ if (isAAI()){
setcookie("aai", '', time() - 3600, '/', $cookie_domain);
header('location: '.$site_url.'/logout_AAI.php?return='.$site_url);
die();
@@ -1035,8 +1029,6 @@ class ApiLogin
// Registrira userja v 1ko - vnos podatkov
private function userRegister()
{
- global $secret_captcha;
-
$error = [];
$email = (isset($_POST['email'])) ? $_POST['email'] : '';
@@ -1055,9 +1047,9 @@ class ApiLogin
// Preverimo ReCaptcha
- if (!empty($secret_captcha)) {
+ if (AppSettings::getInstance()->getSetting('google-secret_captcha') !== false) {
$recaptchaResponse = $_POST['g-recaptcha-response'];
- $requestReCaptcha = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret_captcha."&response=".$recaptchaResponse);
+ $requestReCaptcha = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".AppSettings::getInstance()->getSetting('google-secret_captcha')."&response=".$recaptchaResponse);
if (!strstr($requestReCaptcha, "true")) {
$error['invalid_recaptcha'] = '1';
@@ -1265,11 +1257,8 @@ class ApiLogin
global $site_url;
global $site_path;
global $site_domain;
- global $virtual_domain;
global $pass_salt;
global $lang;
- global $confirm_registration;
- global $app_settings;
$email = (isset($_POST['email']) ? $_POST['email'] : '');
@@ -1306,7 +1295,7 @@ class ApiLogin
$priimek = '';
// Ce imamo vklopljeno potrjevanje urednika aplikacije ga potrdi admin
- if (isset($confirm_registration) && $confirm_registration == 1)
+ if (AppSettings::getInstance()->getSetting('confirm_registration') === true)
$status = 2;
else
$status = 1;
@@ -1337,16 +1326,16 @@ class ApiLogin
$Content .= $lang['confirm_user_mail_ignore'];
// Ce gre slucajno za virutalko
- $Subject = ($virtual_domain) ? $lang['confirm_user_mail_subject_virtual'] : $lang['confirm_user_mail_subject'];
+ $Subject = (isVirtual()) ? $lang['confirm_user_mail_subject_virtual'] : $lang['confirm_user_mail_subject'];
// Ce mora admin potrditi dobi email admin in ne uporabnik!
- if(isset($confirm_registration) && $confirm_registration == 1){
+ if(AppSettings::getInstance()->getSetting('confirm_registration') === true){
// Popravimo besedilo emaila
$Content = $lang['confirm_user_mail_admin'];
}
- $PageName = $app_settings['app_name'];
+ $PageName = AppSettings::getInstance()->getSetting('app_settings-app_name');
$ZaMail = ''.' '.$Subject.'';
@@ -1363,7 +1352,7 @@ class ApiLogin
$Subject = str_replace("SFPAGENAME", $PageName, $Subject);
// Ce gre slucajno za virutalko
- if($virtual_domain)
+ if(isVirtual())
$Subject = str_replace("SFVIRTUALNAME", $site_domain, $Subject);
@@ -1382,8 +1371,8 @@ class ApiLogin
$MA = new MailAdapter(null, 'account');
// Ce mora admin potrditi, posljemo njemu mail
- if(isset($confirm_registration) && $confirm_registration == 1){
- global $confirm_registration_admin;
+ if(AppSettings::getInstance()->getSetting('confirm_registration') === true){
+ $confirm_registration_admin = AppSettings::getInstance()->getSetting('confirm_registration_admin');
if(is_array($confirm_registration_admin)){
// Mail posljemo vsem nastavljenim adminom
@@ -1428,11 +1417,8 @@ class ApiLogin
global $site_url;
global $site_path;
global $site_domain;
- global $virtual_domain;
global $pass_salt;
global $cookie_domain;
- global $confirm_registration;
- global $app_settings;
if (!isset ($_GET['code'])) {
@@ -1462,14 +1448,14 @@ class ApiLogin
$pass = $r['pass'];
$ime = $r['name'];
- $PageName = $app_settings['app_name'];
+ $PageName = AppSettings::getInstance()->getSetting('app_settings-app_name');
include_once('../../lang/'.$r['lang'].'.php');
$Content = $lang['confirm_user_content'];
$Subject = $lang['confirm_user_subject'];
// Ce je ga moramo po registraciji odobriti dobi drugacno sporocilo
- if (isset($confirm_registration) && $confirm_registration == 1){
+ if (AppSettings::getInstance()->getSetting('confirm_registration') === true){
$UserContent = $lang['register_user_banned_content'];
}
else{
@@ -1486,7 +1472,7 @@ class ApiLogin
$out = '';
// Ce gre slucajno za virtualko
- $Subject = ($virtual_domain) ? $lang['register_user_subject_virtual'] : $lang['register_user_subject'];
+ $Subject = (isVirtual()) ? $lang['register_user_subject_virtual'] : $lang['register_user_subject'];
$UserContent = str_replace("SFNAME", $ime, $UserContent);
$UserContent = str_replace("SFMAIL", $email, $UserContent);
@@ -1498,7 +1484,7 @@ class ApiLogin
$Subject = str_replace("SFPAGENAME", $PageName, $Subject);
// Ce gre slucajno za virtualko
- if($virtual_domain)
+ if(isVirtual())
$Subject = str_replace("SFVIRTUALNAME", $site_domain, $Subject);
if ($geslo2 == "") {
@@ -1537,7 +1523,7 @@ class ApiLogin
}
// Ce imamo vklopljeno potrjevanje urednika aplikacije je to izvedel admin in ne prijavljamo
- if (!isset($confirm_registration) || $confirm_registration != 1){
+ if (AppSettings::getInstance()->getSetting('confirm_registration') !== true){
// določi še, od kje se je prijavil
$hostname = "";
@@ -1620,7 +1606,6 @@ class ApiLogin
global $lang;
global $global_user_id;
global $cookie_domain;
- global $app_settings;
$email = $global_user_id;
@@ -1642,7 +1627,7 @@ class ApiLogin
$result = sisplet_query("SELECT name FROM users WHERE email='$email'");
list ($ime) = mysqli_fetch_row($result);
- $PageName = $app_settings['app_name'];
+ $PageName = AppSettings::getInstance()->getSetting('app_settings-app_name');
$ByeEmail = str_replace("SFPAGENAME", $PageName, $ByeEmail);
if (strlen($ime) > 2) {
@@ -1715,9 +1700,7 @@ class ApiLogin
global $pass_salt;
global $site_path;
global $site_domain;
- global $virtual_domain;
global $cookie_domain;
- global $app_settings;
if (isset ($_GET['email']) || isset ($_POST['email'])) {
@@ -1778,11 +1761,11 @@ class ApiLogin
$result = sisplet_query("UPDATE users SET LastLP=UNIX_TIMESTAMP(NOW()), lost_password='".base64_encode((hash(SHA256, $geslo.$pass_salt)))."', lost_password_code='$passhint' WHERE email='$email'");
// Ce gre slucajno za virtualko
- $Subject = ($virtual_domain) ? $lang['lost_pass_subject_virtual'] : $lang['lost_pass_subject'];
+ $Subject = (isVirtual()) ? $lang['lost_pass_subject_virtual'] : $lang['lost_pass_subject'];
$Content = $lang['lost_pass_mail'];
- $PageName = $app_settings['app_name'];
+ $PageName = AppSettings::getInstance()->getSetting('app_settings-app_name');
$ZaMail = ''.' '.$Subject.'';
@@ -1804,7 +1787,7 @@ class ApiLogin
$Subject = str_replace("SFPAGENAME", $PageName, $Subject);
// Ce gre slucajno za virtualko
- if($virtual_domain)
+ if(isVirtual())
$Subject = str_replace("SFVIRTUALNAME", $site_domain, $Subject);
if ($LoginWith == 1) {
diff --git a/frontend/api/fb_login.php b/frontend/api/fb_login.php
index 65ba7be34..0b12f14ad 100644
--- a/frontend/api/fb_login.php
+++ b/frontend/api/fb_login.php
@@ -1,7 +1,6 @@
executeAction($params=array('action'=>'login_facebook'), $data=array());
}
else {
- header ('location: https://www.facebook.com/v2.10/dialog/oauth?client_id=' .$facebook_appid .'&redirect_uri=https://www.1ka.si/frontend/api/fb_login.php&auth_type=rerequest&scope=email,public_profile');
+ header ('location: https://www.facebook.com/v2.10/dialog/oauth?client_id=' .AppSettings::getInstance()->getSetting('facebook-appid') .'&redirect_uri=https://www.1ka.si/frontend/api/fb_login.php&auth_type=rerequest&scope=email,public_profile');
}
?>
diff --git a/frontend/install/classes/class.DisplayDatabase.php b/frontend/install/classes/class.DisplayDatabase.php
index 44c6e50a2..2fdd6237c 100644
--- a/frontend/install/classes/class.DisplayDatabase.php
+++ b/frontend/install/classes/class.DisplayDatabase.php
@@ -76,7 +76,6 @@ class DisplayDatabase{
public function displayUpdate($update){
global $site_url;
global $lang;
- global $debug;
global $admin_type;
echo '
';
}
// Default footer
else{
diff --git a/main/survey/app/Controllers/CheckController.php b/main/survey/app/Controllers/CheckController.php
index 7fd772a75..fb9a6a3e7 100644
--- a/main/survey/app/Controllers/CheckController.php
+++ b/main/survey/app/Controllers/CheckController.php
@@ -15,6 +15,7 @@ use SurveyInfo;
use SurveyMissingValues;
use Common;
use Mobile_Detect;
+use AppSettings;
class CheckController extends Controller
@@ -681,8 +682,7 @@ class CheckController extends Controller
*/
public function check_captcha()
{
- global $secret_captcha;
-
+
// Ce urejamo podatke v admin vmesniku ne preverjamo nicesar
if(isset($_GET['t']) && $_GET['t'] == 'postprocess' || get('grupa') == '0' || get('grupa') == ''){
return;
@@ -696,7 +696,7 @@ class CheckController extends Controller
if ($captcha == 1) {
$recaptchaResponse = $_POST['g-recaptcha-response'];
- $request = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret_captcha."&response=".$recaptchaResponse);
+ $request = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".AppSettings::getInstance()->getSetting('google-secret_captcha')."&response=".$recaptchaResponse);
// zdaj pa zabeleži mail (pred pošiljanjem)
// zdaj pa še v bazi tistih ki so se ročno dodali
@@ -716,10 +716,9 @@ class CheckController extends Controller
*
*/
public function check_captcha_intro(){
- global $secret_captcha;
$recaptchaResponse = $_POST['g-recaptcha-response'];
- $request = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret_captcha."&response=".$recaptchaResponse);
+ $request = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".AppSettings::getInstance()->getSetting('google-secret_captcha')."&response=".$recaptchaResponse);
if(strstr($request,"true")){
//
diff --git a/main/survey/app/Controllers/HeaderController.php b/main/survey/app/Controllers/HeaderController.php
index b53c87e8d..1b82582c9 100644
--- a/main/survey/app/Controllers/HeaderController.php
+++ b/main/survey/app/Controllers/HeaderController.php
@@ -15,6 +15,7 @@ use SurveyAdvancedParadataLog;
use SurveyInfo;
use SurveyThemeEditor;
use SurveyPanel;
+use AppSettings;
class HeaderController extends Controller
{
@@ -149,8 +150,6 @@ class HeaderController extends Controller
* @desc zgenereira header
*/
public function header(){
- global $app_settings;
-
// preprecimo caching - tudi s klikom na gumb nazaj!
header("Last-Modified: " . gmdate("D, j M Y H:i:s") . " GMT");
@@ -168,8 +167,8 @@ class HeaderController extends Controller
$rowv = mysqli_fetch_array($sqlv);
// Custom header title
- if(isset($app_settings['head_title_custom']) && $app_settings['head_title_custom'] == 1){
- echo ''.strip_tags(Helper::getInstance()->displayAkronim(0)).' - '.$app_settings['head_title_text'].'' . "\n";
+ if(AppSettings::getInstance()->getSetting('app_settings-head_title_custom')){
+ echo ''.strip_tags(Helper::getInstance()->displayAkronim(0)).' - '.AppSettings::getInstance()->getSetting('app_settings-head_title_text').'' . "\n";
}
// Default header title
else{
diff --git a/main/survey/app/Controllers/JsController.php b/main/survey/app/Controllers/JsController.php
index f6346a66e..e1bfe47d8 100644
--- a/main/survey/app/Controllers/JsController.php
+++ b/main/survey/app/Controllers/JsController.php
@@ -21,6 +21,7 @@ use SurveySetting;
use SurveySlideshow;
use Common;
use SurveyPanel;
+use AppSettings;
class JsController extends Controller
{
@@ -64,7 +65,6 @@ class JsController extends Controller
{
global $lang;
global $site_url;
- global $secret_captcha;
global $admin_type;
// Dodaten text pri alertu ce smo v testnem vnosu
diff --git a/main/survey/app/Controllers/Vprasanja/TextController.php b/main/survey/app/Controllers/Vprasanja/TextController.php
index 0251ed5fe..b4be44005 100644
--- a/main/survey/app/Controllers/Vprasanja/TextController.php
+++ b/main/survey/app/Controllers/Vprasanja/TextController.php
@@ -21,6 +21,7 @@ use App\Controllers\LanguageController as Language;
use App\Controllers\Vprasanja\SystemVariableController as SystemVariable;
use App\Models\Model;
use enkaParameters;
+use AppSettings;
class TextController extends Controller
{
@@ -480,7 +481,6 @@ class TextController extends Controller
************************************************/
public function textbox($spremenljivka, $oblika)
{
- global $recaptcha_sitekey;
global $lang;
$row = Model::select_from_srv_spremenljivka($spremenljivka);
@@ -575,7 +575,7 @@ class TextController extends Controller
$captcha = ($spremenljivkaParams->get('captcha') ? $spremenljivkaParams->get('captcha') : 0);
if ($captcha == 1) {
- echo '';
+ echo '';
}
else {
$char_counter_events = $limit ? 'charCounter(this);' : '';
diff --git a/settings_optional.php.example b/settings_optional.php.example
deleted file mode 100644
index 016c59814..000000000
--- a/settings_optional.php.example
+++ /dev/null
@@ -1,165 +0,0 @@
- '', // Ime aplikacije
- 'admin_email' => '', // Email administratorja aplikacije (gdpr zahtevki, kontakt, potrditev registracije...)
- 'owner' => '', // Ime lastnika aplikacije (podjetje...)
- 'owner_website' => '', // Spletna stran lastnika aplikacije (podjetje...)
-
- 'footer_custom' => 0, // Custom ali default footer
- 'footer_text' => '', // Text v footerju
- 'footer_survey_custom' => 0, // Custom ali default footer ankete
- 'footer_survey_text' => '', // Text v footerju ankete
-
- 'email_signature_custom' => 0, // Custom ali default podpis v emailih
- 'email_signature_text' => '', // Podpis v emailih
-
- 'survey_finish_url' => '', // Skok na url po koncani anketi (ce je prazno se uporabi default www.1ka.si)
-
- 'admin_allow_only_ip' => '', // Dovolimo dostop do admina samo dolocenim ip-jem (array ip-jev)
-
- 'export_type' => 'old', // Uporaba novih ("new") / novih samo za admine ("new_admin") / starih ("old") izvozov
-
- 'commercial_packages' => false // Ce so vklopljeni komercialni paketi
-);
-
-
-/* OMEJITVE APLIKACIJE */
-$app_limits = array(
-
- // Max stevilo klikov na doloceno anketo (izpolnjevanje) v eni minuti (zascita, da se streznik ne sesuje) (ce je 0 ni limita)
- 'clicks_per_minute_limit' => 200,
-
- // Max stevilo vprasanj v anketi
- 'question_count_limit' => 0,
-
- // Max stevilo vprasanj v anketi
- 'response_count_limit' => 0,
-
- // Max stevilo poslanih vabil v anketi
- 'invitation_count_limit' => 0
-);
-
-
-// Nastavitev email streznika za posiljanje mailov
-$email_server_settings = array(
- 'SMTPFrom' => '', // polje "from" pri posiljanju
- 'SMTPFromNice' => '', // izpisano ime posiljatelja
- 'SMTPReplyTo' => '', // polje "reply to" pri posiljanju
-
- 'SMTPHost' => '', // smtp streznik za posiljanje
- 'SMTPPort' => '', // št. porta
- 'SMTPSecure' => '', // tls ali ssl
- 'SMTPAuth' => 1, // 1 oz. 0
- 'SMTPUsername' => '', // username za smtp streznik
- 'SMTPPassword' => '' // geslo za smtp streznik
-);
-
-/**
- * Email streznik, ki se uporablja pri posiljanju emailov iz posamezne ankete
- * - TRUE - emaili iz ankete se posiljajo preko istega streznika kot splosni emaili
- * - FALSE (default) - pri vsaki anketi je potrebno posebej vnesti smtp streznik
- */
-$email_server_fromSurvey = false;
-
-
-
-
-/* DODATNE NASTAVITVE APLIKACIJE ZA ADMINISTRATORJE */
-// Po registraciji je lahko uporabnik neaktiven (banan) in ga mora administrator inštalacije še ročno potrditi (dobi na mail obvestilo o registraciji)
-$confirm_registration = 0;
-$confirm_registration_admin = $app_settings['admin_email'];
-
-// Dodatna opcijska nastavitev, kam se pošlje email GDPR zahtevka za izbris (administratir instalacije)
-$gdpr_admin_email = $app_settings['admin_email'];
-
-
-
-
-/* DODATNE FUNKCIONALNOSTI APLIKACIJE */
-// Google reCaptcha - potrebno za delovanje recaptche pri registraciji in tipa vprašanja "captcha" v anketi
-$recaptcha_sitekey = '';
-$secret_captcha = '';
-
-/**
- * Google login podatki za prijavo v 1KO
- * Pridobi API: https://developers.google.com/identity/sign-in/web
- * Pregled vseh API-jev: https://console.developers.google.com/apis
- */
-$google_login_client_id = '';
-$google_login_client_secret = '';
-
-
-/**
- * Google maps - potrebno za delovanje tipa vprašanja "lokacija"
- * Google's API key (CREATE YOUR OWN!) needed when working with Google Maps
- * Instructions to get API key: https://developers.google.com/maps/documentation/javascript/get-api-key
- * APIs need to be enabled: Google Maps JavaScript API, Google Maps Geocoding API, Google Places API Web Service
- */
-$google_maps_API_key = '';
-
-/**
- * Facebook developer api - potrebno za delovanje prijave in registracije s FB računom
- * Uporabi jscript include iz 1ka-grey header.php v svojem skinu
-*/
-$facebook_appid = '';
-$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
- */
-$FCM_server_key = '';
-$APP_special_login_key = '';
-$NextPinMainToken = '';
-$NextPinMainPassword = '';
-
-/**
- * Nastavitve hierarhije
- */
- $hierarhija_folder_id = ''; // Skupna mapa iz knjižnice za SA ankete
- $hierarhija_default_id = ''; // privzeta SA anketa
-
-/**
- * Squalo API za vabila
-*/
-$squalo_user = '';
-$squalo_key = '';
-
-
-
-/* PLACEVANJE */
-/**
- * Izdajanje racunov preko cebelice
- */
-$cebelica_api = '';
-
-/**
- * Stripe za placevanje s kreditno kartico
- */
-$stripe_key = '';
-$stripe_secret = '';
-
-/**
- * Placevanje s paypalom
- */
-$paypal_account = '';
-$paypal_client_id = '';
-$paypal_secret = '';
diff --git a/sql/update2.sql b/sql/update2.sql
index 1300b9370..053fb87fe 100644
--- a/sql/update2.sql
+++ b/sql/update2.sql
@@ -9544,3 +9544,27 @@ UPDATE misc SET value='21.08.30' WHERE what="version";
UPDATE srv_survey_list SET updated='1';
UPDATE misc SET value='21.09.20' WHERE what="version";
+
+## Ciscenje tabele "misc"
+DELETE FROM misc WHERE NOT (
+ what LIKE '%version%'
+ OR what LIKE '%drupal version%'
+ OR what LIKE '%mobileApp_version%'
+ OR what LIKE '%SurveyLang_admin%'
+ OR what LIKE '%SurveyLang_resp%'
+ OR what LIKE '%SurveyDostop%'
+ OR what LIKE '%SurveyForum%'
+ OR what LIKE '%SurveyCookie%'
+ OR what LIKE '%CookieLife%'
+);
+
+## Nova tabela z nastavitvami aplikacije - SEM SE PRENESE VSE IZ settings_optional.php
+CREATE TABLE app_settings(
+ what VARCHAR(100) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ domain VARCHAR(100) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ value TEXT CHARACTER SET utf8 NOT NULL DEFAULT '',
+ UNIQUE KEY (what, domain)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+UPDATE misc SET value='21.09.21' WHERE what="version";
+
diff --git a/utils/1kaUtils/app_settings_copy.php b/utils/1kaUtils/app_settings_copy.php
new file mode 100644
index 000000000..4829c46ca
--- /dev/null
+++ b/utils/1kaUtils/app_settings_copy.php
@@ -0,0 +1,266 @@
+
\ No newline at end of file
diff --git a/utils/crontab9am.php b/utils/crontab9am.php
index b7c52d263..804607159 100644
--- a/utils/crontab9am.php
+++ b/utils/crontab9am.php
@@ -16,8 +16,7 @@
/*** TRGOVINA ***/
- global $app_settings;
- if(isset($app_settings['commercial_packages']) && $app_settings['commercial_packages'] == true){
+ if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') === false){
$unc = new UserNarocilaCron();