diff options
Diffstat (limited to 'main/survey/app/Controllers/InitClass.php')
-rw-r--r-- | main/survey/app/Controllers/InitClass.php | 388 |
1 files changed, 331 insertions, 57 deletions
diff --git a/main/survey/app/Controllers/InitClass.php b/main/survey/app/Controllers/InitClass.php index f0c7dc9..f735419 100644 --- a/main/survey/app/Controllers/InitClass.php +++ b/main/survey/app/Controllers/InitClass.php @@ -17,13 +17,16 @@ use App\Controllers\LanguageController as Language; use App\Models\Model;
use App\Models\SaveSurvey;
use Common;
-use Mobile_Detect;
use SurveyInfo;
use SurveySetting;
use SurveySlideshow;
use GDPR;
use MAZA;
use UserAccess;
+use SurveyCheck;
+use KolektorResponse;
+use SurveyPanel;
+use SurveyEmailAccess;
class InitClass extends Controller
@@ -50,9 +53,12 @@ class InitClass extends Controller private function loadIfPrintPreviewFalse()
{
// cist na zacetku preverimo referer. Ce je prisel od kje drugje (napacno skopiran link itd...) ga preusmerimo na prvo stran ankete
- if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], self::$site_url) === false && !isset($_GET['code']) && !isset($_GET['return']) && !isset($_GET['params'])) {
+ if (!SurveyInfo::getInstance()->checkSurveyModule('panel') && isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], self::$site_url) === false && !isset($_GET['code']) && !isset($_GET['return']) && !isset($_GET['params'])) {
- $anketa = (isset($_GET['anketa'])) ? $_GET['anketa'] : ((isset($_POST['anketa'])) ? $_POST['anketa'] : die("Missing anketa id!"));
+ $anketa_hash = (isset($_GET['anketa'])) ? $_GET['anketa'] : ((isset($_POST['anketa'])) ? $_POST['anketa'] : die("Missing anketa id!"));
+ save('anketa_hash', $anketa_hash);
+
+ $anketa = getSurveyIdFromHash($anketa_hash);
save('anketa', $anketa);
// Pri ul evalvaciji tega ne pustimo, ker drugace narobe preusmeri
@@ -69,7 +75,6 @@ class InitClass extends Controller $g .= Header::getSurveyParams();
- //$redirect_url = self::$site_url."a/".get('anketa').$g;
$redirect_url = SurveyInfo::getSurveyLink(false, false) . $g;
$request_url = 'http' . ($_SERVER['HTTPS'] ? 's' : null) . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
@@ -89,9 +94,18 @@ class InitClass extends Controller }
if (isset($_GET['anketa']) || isset($_POST['anketa'])) {
-
- $anketa = (isset($_GET['anketa'])) ? $_GET['anketa'] : ((isset($_POST['anketa'])) ? $_POST['anketa'] : die("Missing anketa id!"));
- save('anketa', $anketa);
+ $anketa_hash = (isset($_GET['anketa'])) ? $_GET['anketa'] : ((isset($_POST['anketa'])) ? $_POST['anketa'] : die("Missing anketa id!"));
+ save('anketa_hash', $anketa_hash);
+
+ $anketa = getSurveyIdFromHash($anketa_hash);
+ save('anketa', $anketa);
+
+ // Preverimo, ce gre za deaktivirano phishing anketo - vrnemo 404
+ global $mysql_database_name;
+ if($mysql_database_name == 'real1kasi' && in_array(get('anketa'), array('321069','328454','328864','329691')) ){
+ http_response_code(404);
+ die();
+ }
// Preverimo ce gre za POSEBNO webSM anketo (ki ne shranjuje nicesar - samo direktno preusmeri na ustrezno stran)
if (get('anketa') == get('webSMSurvey') && Common::checkModule('websmsurvey') == '1')
@@ -99,8 +113,8 @@ class InitClass extends Controller // polovimo podatke o anketi
SurveyInfo::getInstance()->SurveyInit(get('anketa'));
- if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1)
- save('db_table', '_active');
+ $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString();
+ save('db_table', $db_table);
$rowa = SurveyInfo::getInstance()->getSurveyRow();
@@ -136,11 +150,65 @@ class InitClass extends Controller Header::getInstance()->header();
Body::getInstance()->displayStaticIntroduction();
+
die();
- } // Ce imamo staticen uvod s captcho in smo kliknili na naslednjo stran, najprej preverimo captcho
+ }
+ // Ce imamo staticen uvod s captcho in smo kliknili na naslednjo stran, najprej preverimo captcho
elseif ($rowa['intro_static'] == 2 && $rowa['show_intro'] == 1 && count($_POST) != 0 && isset($_GET['grupa']) && $_GET['grupa'] == '0') {
Check::getInstance()->check_captcha_intro();
}
+
+
+ // Modul email dostop - prikazemo prvo stran za vnos emaila
+ if(SurveyInfo::getInstance()->checkSurveyModule('email_access') && (!isset($_GET['grupa']) || $_GET['grupa'] == '0')){
+
+ $sea = new SurveyEmailAccess(get('anketa'));
+
+ $response = array();
+ $code_check = false;
+
+ // Poslana je bila koda - preverimo, ce je ok in spustimo naprej
+ if(isset($_POST['code']) && $_POST['code'] != ''){
+
+ $code = $_POST['code'];
+ $code = str_replace(' ', '', $code);
+
+ // Preverimo kodo - ce je ok, spustimo naprej, drugace prikazemo error
+ $response = $sea->checkAccessCode($code);
+
+ // Koda je ok, pustimo na anketo
+ if($response === true)
+ $code_check = true;
+ }
+ // Poslan je bil email - posljemo kodo
+ elseif(isset($_POST['email'])){
+
+ // Preverimo captcho
+ if($sea->getEmailAccessSettings('captcha') == '1'){
+ Check::getInstance()->check_captcha_intro();
+ }
+
+ $email = $_POST['email'];
+
+ // Posljemo email s kodo
+ $response = $sea->sendAccessCode($email);
+ }
+
+ // Koda ni ok - izpisemo vsebino
+ if($code_check !== true){
+
+ // inicializiramo jezik za multilang anketo
+ Language::getInstance()->multilang_init();
+
+ // konec ukvarjanja s cookieji, prikazemo header
+ Header::getInstance()->header();
+
+ // Izpisemo uvod s kodo
+ Body::getInstance()->displayEmailAccessIntroduction($response);
+
+ die();
+ }
+ }
// ali je respondent avtor ankete (zaradi posebnih opcij prepoznave)
@@ -159,15 +227,18 @@ class InitClass extends Controller if ($row['cookie'] == 0) {
$this->expire = 0;
- } elseif ($row['cookie'] == -1) {
+ }
+ elseif ($row['cookie'] == -1) {
if ($rowa['user_from_cms'] == 1) {
$this->expire = time() - 3600;
} else {
$this->expire = 0;
}
- } elseif ($row['cookie'] == 1) {
+ }
+ elseif ($row['cookie'] == 1) {
$this->expire = time() + 3600;
- } else {
+ }
+ else {
$this->expire = time() + 2500000;
}
@@ -177,9 +248,23 @@ class InitClass extends Controller // da delata oba načina nastavljanja piškotkov, neglede na nastavitve
if (isset($_GET['survey-' . get('anketa')]))
$this->cookie = $_GET['survey-' . get('anketa')]; // Pri nastavitvi brez cookie-ja se cookie string prenaša preko URL-ja
- if (isset($_COOKIE['survey-' . get('anketa')]))
- $this->cookie = $_COOKIE['survey-' . get('anketa')]; // Obicajen cookie
+ // PANEL - preverimo, ce je respondent z istim panel id-jem in ga prepoznamo
+ if(SurveyInfo::getInstance()->checkSurveyModule('panel')){
+ if($this->cookie == null){
+ // Postavimo status panelista na default
+ $sp = new SurveyPanel(get('anketa'));
+ setcookie('panel_status', $sp->getPanelSettings('status_default'), 0, '/');
+
+ // Ustvarimo cookie panelista
+ $this->cookie = $this->panelNovRespondent();
+ }
+ }
+ // Obicajen cookie - pri panelu ga nikoli ne upostevamo
+ else{
+ if (isset($_COOKIE['survey-' . get('anketa')]))
+ $this->cookie = $_COOKIE['survey-' . get('anketa')];
+ }
// EVALVACIJA - Ce je nov respondent preverimo ce se je vrnil (zapis v tabeli eval_data_userCookie) in mu nastavimo ustrezen cookie da ga preusmerimo na ustrezno stran
if (Common::checkModule('evalvacija') == '1' && $this->cookie == null)
@@ -187,10 +272,9 @@ class InitClass extends Controller // HIERARHIJA - UČITELJ, preverimo, če je učitelj ponovno prišel nazaj
if (Common::checkModule('hierarhija') == '1' && SurveyInfo::checkSurveyModule('hierarhija') == 2 && is_null($this->cookie))
- $this->cookie = $this->hierarhijaPreveriCeSeJeUciteljVrnilPonovnoResevatiAnketo();
+ $this->cookie = $this->hierarhijaPreveriCeSeJeUciteljVrnilPonovnoResevatiAnketo();
// poskrbimo za user ID
- //
// tuki je kookie ze nastavljen in ga samo preberemo
if ($this->cookie != null)
$this->cookieExist($this->cookie);
@@ -199,7 +283,7 @@ class InitClass extends Controller if ($this->cookie == null)
$this->cookieIsNull();
-
+
// tukaj bomo dodatno preverjali, ce slucajno kje&kdaj pride do napake da usr_id ni postavljen
if (get('usr_id') == 0) {
$get = '';
@@ -290,13 +374,10 @@ class InitClass extends Controller $this->set_userstatus(6);
Body::getInstance()->displayKonec();
-
}
elseif (get('displayAllPages')) {
- Body::getInstance()->displayAllPages();
-
-
+ Body::getInstance()->displayAllPages();
}
// prikazemo ustrezno stran / grupo
elseif (get('grupa') > 0) {
@@ -304,7 +385,7 @@ class InitClass extends Controller $preskok = false;
// pogledamo ce preskocimo kaksno stran zaradi branchinga
- while (!Check::getInstance()->checkGrupa() && get('grupa') > 0 && $_GET['disableif'] != 1) {
+ while (get('grupa') > 0 && (!isset($_GET['disableif']) || $_GET['disableif'] != 1) && !Check::getInstance()->checkGrupa()) {
SaveSurvey::getInstance()->posted(1);
save('grupa', Find::getInstance()->findNextGrupa());
@@ -368,6 +449,16 @@ class InitClass extends Controller $s = sisplet_query("REPLACE INTO srv_user_grupa" . get('db_table') . " (gru_id, usr_id, time_edit) VALUES ('0', '" . get('usr_id') . "', NOW())");
if (!$s) echo mysqli_error($GLOBALS['connect_db']);
+
+ // Ce imamo napredni modul za belezenje casovc po straneh
+ if(SurveyInfo::getInstance()->checkSurveyModule('advanced_timestamps')){
+ sisplet_query("INSERT INTO srv_advanced_timestamps
+ (gru_id, usr_id, time_edit)
+ VALUES
+ ('0', '".get('usr_id')."', NOW())
+ ");
+ }
+
$this->set_userstatus(4);
}
@@ -405,7 +496,6 @@ class InitClass extends Controller header('Location: ' . SurveyInfo::getSurveyLink(false, false) . '&grupa=' . get('grupa') . '&ime=' . get('ime_AW') . Header::getSurveyParams() . get('cookie_url') . '');
elseif (get('loop_id') != null)
header('Location: ' . SurveyInfo::getSurveyLink(false, false) . '&grupa=' . get('grupa') . '&loop_id=' . get('loop_id') . Header::getSurveyParams() . get('cookie_url') . '');
-
}
else {
@@ -453,11 +543,12 @@ class InitClass extends Controller // polovimo podatke o anketi
\SurveyInfo::getInstance()->SurveyInit(get('anketa'));
- if (\SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1)
- save('db_table', '_active');
+ $db_table = \SurveyInfo::getInstance()->getSurveyArchiveDBString();
+ save('db_table', $db_table);
\SurveySetting::getInstance()->Init(get('anketa'));
- save('usr_id', $_REQUEST['usr_id']);
+ if(isset($_REQUEST['usr_id']))
+ save('usr_id', $_REQUEST['usr_id']);
Language::getInstance()->multilang_init();
}
@@ -510,7 +601,7 @@ class InitClass extends Controller save('grupa', $_GET['grupa']);
// pogledamo ce preskocimo kaksno stran zaradi branchinga
- while (!Check::getInstance()->checkGrupa() && get('grupa') > 0 && $_GET['disableif'] != 1) {
+ while (get('grupa') > 0 && $_GET['disableif'] != 1 && !Check::getInstance()->checkGrupa()) {
save('grupa', Find::getInstance()->findNextGrupa());
}
@@ -598,9 +689,59 @@ class InitClass extends Controller }
+ // PANEL - Ce je nov respondent preverimo ce se je vrnil (ima isti SID) in mu nastavimo ustrezen cookie da ga preusmerimo na ustrezno stran
+ private function panelNovRespondent(){
+
+ $sp = new SurveyPanel(get('anketa'));
+ $panel_id_name = $sp->getPanelSettings('user_id_name');
+
+ $panel_id = ($panel_id_name != '' && isset($_GET[$panel_id_name])) ? $_GET[$panel_id_name] : 0;
+
+ if ($panel_id != '' && $panel_id != '0') {
+
+ $sqlPanel = sisplet_query("SELECT u.cookie
+ FROM srv_spremenljivka s, srv_grupa g, srv_data_text".get('db_table')." d, srv_user u
+ WHERE s.variable='".$panel_id_name."' AND s.gru_id=g.id AND g.ank_id='".get('anketa')."'
+ AND s.id=d.spr_id AND d.text='".$panel_id."'
+ AND u.id=d.usr_id AND u.deleted!='1'
+ ");
+
+ if (mysqli_num_rows($sqlPanel) > 0) {
+ $rowPanel = mysqli_fetch_array($sqlPanel);
+ $cookie = $rowPanel['cookie'];
+ return $cookie;
+ }
+ }
+ }
+
+ // MODUL EMAIL DOSTOP - preverimo kodo mu nastavimo ustrezen cookie
+ private function emailDostopNovRespondent(){
+
+ $sp = new SurveyPanel(get('anketa'));
+ $panel_id_name = $sp->getPanelSettings('user_id_name');
+
+ $panel_id = ($panel_id_name != '' && isset($_GET[$panel_id_name])) ? $_GET[$panel_id_name] : 0;
+
+ if ($panel_id != '' && $panel_id != '0') {
+
+ $sqlPanel = sisplet_query("SELECT u.cookie
+ FROM srv_spremenljivka s, srv_grupa g, srv_data_text".get('db_table')." d, srv_user u
+ WHERE s.variable='".$panel_id_name."' AND s.gru_id=g.id AND g.ank_id='".get('anketa')."'
+ AND s.id=d.spr_id AND d.text='".$panel_id."'
+ AND u.id=d.usr_id AND u.deleted!='1'
+ ");
+
+ if (mysqli_num_rows($sqlPanel) > 0) {
+ $rowPanel = mysqli_fetch_array($sqlPanel);
+ $cookie = $rowPanel['cookie'];
+ return $cookie;
+ }
+ }
+ }
+
// EVALVACIJA - Ce je nov respondent preverimo ce se je vrnil (zapis v tabeli eval_data_userCookie) in mu nastavimo ustrezen cookie da ga preusmerimo na ustrezno stran
- private function evlavacijaNovRespondent()
- {
+ private function evlavacijaNovRespondent(){
+
$student = (isset($_GET['sifstud'])) ? $_GET['sifstud'] : 0;
$predmet = (isset($_GET['sifpredm'])) ? $_GET['sifpredm'] : -1; // Ce resuje splosno anketo ni predmeta -> predmet = -1
@@ -644,7 +785,8 @@ class InitClass extends Controller // Preverimo, ce je ze koncal anketo (in se kasneje vrnil), ce lahko se ureja svoje odgovore
// Dodano v pogoj da se to izvede samo ce nima nastavljene grupe (drugace dela narobe klik nazaj na zakljucku, preklop med bloki...)
- if ($rowa['return_finished'] == 0 && !isset($_GET['grupa']) && !isset($_GET['urejanje']) && !isset($_GET['return'])) {
+ if ($rowa['return_finished'] == 0 && !isset($_GET['grupa']) && !isset($_GET['urejanje']) && !isset($_GET['return']) && !SurveyInfo::getInstance()->checkSurveyModule('panel')) {
+
$sqls = sisplet_query("SELECT MAX(status) AS status FROM srv_userstatus WHERE usr_id='" . get('usr_id') . "'");
$rows = mysqli_fetch_array($sqls);
if ($rows['status'] == 6) { // Koncal anketo
@@ -768,8 +910,10 @@ class InitClass extends Controller Check::getInstance()->check_cookie_return();
}
- // userji iz baze
- } elseif (
+
+ }
+ // userji iz baze
+ elseif (
($rowa['user_base'] == 1) &&
#če imamo neindividualizirana vabila - poslana preko vabil, vendar bez kode in zato brez sledenja (uporabnik se pri pošiljanju NE prenese iz srv_invitations_recipients v srv_user)
$rowa['individual_invitation'] != 0 &&
@@ -844,10 +988,10 @@ class InitClass extends Controller $referal = SurveySetting::getInstance()->getSurveyMiscSetting('survey_referal');
$date = SurveySetting::getInstance()->getSurveyMiscSetting('survey_date');
- if ($ip == 0) $_ip = Helper::remote_address(); else $ip = "";
- if ($date == 0) $_time_insert = "NOW()"; else $_time_insert = "''";
- if ($referal == 0) $_referer = $referer; else $_referer = '';
- if ($browser == 0) $_useragent = $_SERVER['HTTP_USER_AGENT']; else $_useragent = '';
+ if ($ip == 0 || $ip == '') $_ip = Helper::remote_address(); else $ip = "";
+ if ($date == 0 || $date == '') $_time_insert = "NOW()"; else $_time_insert = "''";
+ if ($referal == 0 || $referal == '') $_referer = $referer; else $_referer = '';
+ if ($browser == 0 || $browser == '') $_useragent = $_SERVER['HTTP_USER_AGENT']; else $_useragent = '';
// Ce dovolimo useragent in ce je instaliran browscap
$_browser = '';
@@ -856,7 +1000,7 @@ class InitClass extends Controller if ($_useragent != '' && get_cfg_var('browscap')) {
$browser_detect = get_browser($_useragent, true);
- $detect = New Mobile_Detect();
+ $detect = New \Detection\MobileDetect;
$detect->setUserAgent($_useragent);
// Detect browserja
@@ -871,7 +1015,8 @@ class InitClass extends Controller $_device = 2;
else
$_device = 1;
- } elseif ($browser_detect['crawler'] == 1)
+ }
+ elseif (isset($browser_detect['crawler']) && $browser_detect['crawler'] == 1)
$_device = 3;
else
$_device = 0;
@@ -949,12 +1094,136 @@ class InitClass extends Controller die();
}
}
+ }
+ // Kolektor modul - respondent s kodo - poenostavljeno vabilo
+ elseif(Common::checkModule('kolektor') == '1' && isset($_GET['code'])) {
+
+ $usercode = strtolower($_GET['code']);
+
+ $sql2 = sisplet_query("SELECT id, recnum, cookie FROM srv_user WHERE TRIM(pass) = '$usercode' AND ank_id='".get('anketa')."' AND deleted='0'");
+ if (!$sql2) echo mysqli_error($GLOBALS['connect_db']);
+ $row2 = mysqli_fetch_array($sql2);
+
+ // Pravilna koda
+ if (mysqli_num_rows($sql2) > 0) {
+
+ $rand = $row2['cookie'];
+
+ $this->set_cookie('survey-' . get('anketa'), $rand, $this->expire);
+
+ save('usr_id', $row2['id']);
+
+
+ // Preverimo ce imamo vklopljeno da uporabnik nadaljuje kjer je ostal - potem ga preusmerimo na pravo stran
+ Check::getInstance()->check_cookie_return();
+
+ if ($row2['recnum'] == 0) {
+
+ if (isset($_POST['referer']))
+ $referer = $_POST['referer'];
+ elseif (isset($_SERVER['HTTP_REFERER']))
+ $referer = $_SERVER['HTTP_REFERER'];
+ else
+ $referer = 0;
+
+ SurveySetting::getInstance()->Init(get('anketa'));
+ $ip = SurveySetting::getInstance()->getSurveyMiscSetting('survey_ip');
+ $browser = SurveySetting::getInstance()->getSurveyMiscSetting('survey_browser');
+ $referal = SurveySetting::getInstance()->getSurveyMiscSetting('survey_referal');
+ $date = SurveySetting::getInstance()->getSurveyMiscSetting('survey_date');
+
+ if ($ip == 0 || $ip == '') $_ip = Helper::remote_address(); else $ip = "";
+ if ($date == 0 || $date == '') $_time_insert = "NOW()"; else $_time_insert = "''";
+ if ($referal == 0 || $referal == '') $_referer = $referer; else $_referer = '';
+ if ($browser == 0 || $browser == '') $_useragent = $_SERVER['HTTP_USER_AGENT']; else $_useragent = '';
+
+ // Ce dovolimo useragent in ce je instaliran browscap
+ $_browser = '';
+ $_device = 0;
+ $_os = '';
+ if ($_useragent != '' && get_cfg_var('browscap')) {
+
+ $browser_detect = get_browser($_useragent, true);
+ $detect = New \Detection\MobileDetect;
+ $detect->setUserAgent($_useragent);
+
+ // Detect browserja
+ if ($browser_detect['browser'] == 'Default Browser')
+ $_browser = self::$lang['srv_para_graph_other'];
+ else
+ $_browser = $browser_detect['browser'] . ' ' . $browser_detect['version'];
+
+ // Detect naprave (pc, mobi, tablet, robot)
+ if ($detect->isMobile()) {
+ if ($detect->isTablet())
+ $_device = 2;
+ else
+ $_device = 1;
+ }
+ elseif (isset($browser_detect['crawler']) && $browser_detect['crawler'] == 1)
+ $_device = 3;
+ else
+ $_device = 0;
+
+ // Detect operacijskega sistema
+ if ($browser_detect['platform'] == 'unknown')
+ $_os = self::$lang['srv_para_graph_other'];
+ else
+ $_os = $browser_detect['platform'];
+ }
+
+ $recnum = 0;
+ if (isset($_GET['language'])) save('language', (int)$_GET['language']); else save('language', self::$lang['id']);
+
+ $s = sisplet_query("UPDATE srv_user SET recnum = MAX_RECNUM('" . get('anketa') . "'), time_insert=" . $_time_insert . ", language='" . get('language') . "', ip='" . $_ip . "', useragent='" . $_useragent . "', device='" . $_device . "', browser='" . $_browser . "', os='" . $_os . "' WHERE id = '" . get('usr_id') . "'");
+ if (!$s) {
+ echo 'err3432' . mysqli_error($GLOBALS['connect_db']);
+ die();
+ }
+ }
+
+ // Preverimo, ce je ze koncal anketo (in se kasneje vrnil), ce lahko se ureja svoje odgovore
+ if ($rowa['return_finished'] == 0) {
+ $sqls = sisplet_query("SELECT MAX(status) AS status FROM srv_userstatus WHERE usr_id='" . get('usr_id') . "'");
+ $rows = mysqli_fetch_array($sqls);
+
+ if ($rows['status'] == 6) { // Koncal anketo
+ Header::getInstance()->header();
+ Body::getInstance()->displayKonec();
+
+ die();
+ }
+ }
+
+
+ // ce ze ima kuki in ni poslana grupa pomeni, da se je vrnil se enkrat resevat anketo
+ if (!isset($_GET['grupa'])) {
+ Check::getInstance()->check_cookie_return();
+ }
+ }
+ // koda ne obstaja
+ else {
+ // Pri Ne in Samo avtor prikazemo obvestilo, pri Da spustimo naprej in kreiramo nov cookie
+ SurveySetting::getInstance()->init(get('anketa'));
+ $srv_wrongcode = SurveySetting::getInstance()->getSurveyMiscSetting('srvlang_srv_wrongcode' . $_lang);
+ if ($srv_wrongcode == '') $srv_wrongcode = self::$lang['srv_wrongcode'];
+
+ Display::getInstance()->displayNapaka($srv_wrongcode);
+ die();
+ }
}
// drugace gremo kreirat nov cookie
if (get('usr_id') == null) {
+ // Najprej preverimo limit responsov na anketi - zaenkrat ne naredimo nic, samo posljemo mail ko je limit dosezen
+ $check = new SurveyCheck(get('anketa'));
+ if($check->checkLimitResponses()){
+ /*Display::getInstance()->displayNapaka(self::$lang['srv_survey_repsonse_limit']);
+ die();*/
+ }
+
// izberemo random hash, ki se ni v bazi
do {
$rand = md5(mt_rand(1, mt_getrandmax()) . '@' . Helper::remote_address());
@@ -1005,19 +1274,20 @@ class InitClass extends Controller $referal = SurveySetting::getInstance()->getSurveyMiscSetting('survey_referal');
$date = SurveySetting::getInstance()->getSurveyMiscSetting('survey_date');
- if ($ip == 0) $_ip = Helper::remote_address(); else $ip = "";
- if ($date == 0) $_time_insert = "NOW()"; else $_time_insert = "''";
- if ($referal == 0) $_referer = $referer; else $_referer = '';
- if ($browser == 0) $_useragent = $_SERVER['HTTP_USER_AGENT']; else $_useragent = '';
+ if ($ip == 0 || $ip == '') $_ip = Helper::remote_address(); else $_ip = "";
+ if ($date == 0 || $date == '') $_time_insert = "NOW()"; else $_time_insert = "''";
+ if ($referal == 0 || $referal == '') $_referer = $referer; else $_referer = '';
+ if ($browser == 0 || $browser == '') $_useragent = $_SERVER['HTTP_USER_AGENT']; else $_useragent = '';
// Ce dovolimo useragent in ce je instaliran browscap
$_browser = '';
$_device = 0;
$_os = '';
+
if ($_useragent != '' && get_cfg_var('browscap')) {
$browser_detect = get_browser($_useragent, true);
- $detect = New Mobile_Detect();
+ $detect = New \Detection\MobileDetect;
$detect->setUserAgent($_useragent);
// Detect browserja
@@ -1032,7 +1302,8 @@ class InitClass extends Controller $_device = 2;
else
$_device = 1;
- } elseif ($browser_detect['crawler'] == 1)
+ }
+ elseif (isset($browser_detect['crawler']) && $browser_detect['crawler'] == 1)
$_device = 3;
else
$_device = 0;
@@ -1121,16 +1392,14 @@ class InitClass extends Controller */
protected $anketa, $rand, $expire;
- private function set_cookie($anketa, $rand, $expire)
- {
-
- $cookie_ok = isset($_COOKIE['cookie_ok']) ? $_COOKIE['cookie_ok'] : '';
+ private function set_cookie($anketa, $rand, $expire){
- // ce je nastavljeno na brez piskotka ali se ni potrdil shranjevanja piskotkov
- if (get('cookie_expire') == -1 or $cookie_ok != 1) { // cookie prenasamo preko URLja
+ // ce je nastavljeno na brez piskotka
+ if (get('cookie_expire') == -1) { // cookie prenasamo preko URLja
save('cookie_url', '&' . $anketa . '=' . $rand); // ta string se bo dodal vsem URLjem na konec
// & dodamo naknadno samo tam, kjer se pise v html (v header() more bit samo &)
- } else {
+ }
+ else {
setcookie($anketa, $rand, $expire); // ce je cookie, ga obicajno nastavimo
}
}
@@ -1171,7 +1440,7 @@ class InitClass extends Controller SurveySetting::getInstance()->Init(get('anketa'));
$date = SurveySetting::getInstance()->getSurveyMiscSetting('survey_date');
- if ($date == 0) $_time_insert = "NOW()"; else $_time_insert = "''";
+ if ($date == 0 || $date == '') $_time_insert = "NOW()"; else $_time_insert = "''";
if (isset($_GET['language'])) save('language', (int)$_GET['language']); else save('language', self::$lang['id']);
@@ -1188,19 +1457,24 @@ class InitClass extends Controller $u = sisplet_query($sqlString);
}
- // updatamo samo datum - tip se ni spremenil
- } else {
+ // Modul kolektor - shranimo poseben status "koncano - 5" in posljemo opomnik
+ if(Common::checkModule('kolektor') == '1' && $status == '6'){
+ $kr = new KolektorResponse(get('usr_id'));
+ $kr->setStatus($kolektor_status='5');
+ }
+ }
+ // updatamo samo datum - tip se ni spremenil
+ else {
SurveySetting::getInstance()->Init(get('anketa'));
$date = SurveySetting::getInstance()->getSurveyMiscSetting('survey_date');
- if ($date == 0) $_time_insert = "NOW()"; else $_time_insert = "''";
+ if ($date == 0 || $date == '') $_time_insert = "NOW()"; else $_time_insert = "''";
if (isset($_GET['language'])) save('language', (int)$_GET['language']); else save('language', self::$lang['id']);
# osvežimo datum spremembe
sisplet_query("UPDATE srv_user SET time_edit = " . $_time_insert . ", language='" . get('language') . "' WHERE id='" . get('usr_id') . "'");
-
}
// Ce ne belezimo parapodatka za cas responsa, anonimno zabelezimo cas zadnjega responsa
|