summaryrefslogtreecommitdiffstats
path: root/admin/survey/SurveyAdminAjax.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/survey/SurveyAdminAjax.php')
-rw-r--r--admin/survey/SurveyAdminAjax.php2464
1 files changed, 1819 insertions, 645 deletions
diff --git a/admin/survey/SurveyAdminAjax.php b/admin/survey/SurveyAdminAjax.php
index c52315a..7aa8fc9 100644
--- a/admin/survey/SurveyAdminAjax.php
+++ b/admin/survey/SurveyAdminAjax.php
@@ -6,15 +6,15 @@
*/
// STARO
-define("A_REPORTI", "reporti");
+if (!defined('A_REPORTI')) define("A_REPORTI", "reporti");
// tipi uporabnikov, (za kontrolo prikaza posameznih elementov) za preverjanje kličemo funkcijo user_role_cehck
-define("U_ROLE_ADMIN", 0);
-define("U_ROLE_MANAGER", 1);
-define("U_ROLE_CLAN", 2);
-define("U_ROLE_NAROCNIK", 3);
+if (!defined('U_ROLE_ADMIN')) define("U_ROLE_ADMIN", 0);
+if (!defined('U_ROLE_MANAGER')) define("U_ROLE_MANAGER", 1);
+if (!defined('U_ROLE_CLAN')) define("U_ROLE_CLAN", 2);
+if (!defined('U_ROLE_NAROCNIK')) define("U_ROLE_NAROCNIK", 3);
-define("EXPORT_FOLDER", "admin/survey/SurveyData");
+if (!defined('EXPORT_FOLDER')) define("EXPORT_FOLDER", "admin/survey/SurveyData");
global $site_path;
@@ -68,8 +68,7 @@ class SurveyAdminAjax {
SurveyInfo::getInstance()->SurveyInit($this->anketa);
- if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1)
- $this->db_table = '_active';
+ $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString();
$this->survey_type = $this->SurveyAdmin->getSurvey_type($this->anketa);
@@ -112,17 +111,6 @@ class SurveyAdminAjax {
header('Location: index.php?anketa=' . $this->anketa . '&grupa=' . $this->grupa . '');
}
- /*
- // meta podatki, ki jih beremo z JS
- echo '<form name="meta" action="" style="display:none">';
- echo '<input type="hidden" name="anketa" id="srv_meta_anketa_id" value="' . $this->anketa . '" />';
- echo '<input type="hidden" name="grupa" id="srv_meta_grupa" value="' . $this->grupa . '" />';
- echo '<input type="hidden" name="branching" id="srv_meta_branching" value="' . $this->branching . '" />';
- echo '<input type="hidden" name="podstran" id="srv_meta_podstran" value="' . $_GET['m'] . '" />';
- echo '<input type="hidden" name="akcija" id="srv_meta_akcija" value="' . $_GET['a'] . '" />';
- echo '<input type="hidden" name="full_screen_edit" id="srv_meta_full_screen_edit" value="' . ($this->full_screen_edit == 1 ? 1 : 0) . '" />';
- echo '</form>';
- */
}
// tole je, ce se inicializira v branhingu z $action=-1 (pa mogoce/najbrz se kje), da se ne prikazujejo 2x te meta podatki in redirecta...
@@ -202,7 +190,7 @@ class SurveyAdminAjax {
if (isset ($_POST['branching']))
$this->branching = $_POST['branching'];
if (isset ($_POST['label']))
- $label = $_POST['label'];
+ $label = strip_tags($_POST['label']);
if (isset ($_POST['cela']))
$cela = $_POST['cela'];
if (isset ($_POST['decimalna']))
@@ -288,7 +276,7 @@ class SurveyAdminAjax {
if (isset ($_POST['timer']))
$timer = $_POST['timer'];
if (isset ($_POST['intro_opomba']))
- $intro_opomba = $_POST['intro_opomba'];
+ $intro_opomba = strip_tags($_POST['intro_opomba']);
if (isset ($_POST['akronim']))
$akronim = $_POST['akronim'];
if (isset ($_POST['paramName']))
@@ -346,7 +334,7 @@ class SurveyAdminAjax {
$_GET['parent_if'] = substr( $_SERVER['HTTP_REFERER'], strpos($_SERVER['HTTP_REFERER'], 'parent_if')+10 );
}
- SurveyInfo :: getInstance()->SurveyInit($anketa);
+ SurveyInfo :: getInstance()->SurveyInit($this->anketa);
// vsilimo refresh podatkov
SurveyInfo :: getInstance()->resetSurveyData();
@@ -404,7 +392,7 @@ class SurveyAdminAjax {
elseif ($_GET['a'] == 'edit_anketa_note') {
if ($anketa && isset ($_POST['note']) && $_POST['note'] != '' && $_POST['note'] != 'undefined') {
Common::updateEditStamp();
- $sql = sisplet_query("UPDATE srv_anketa SET intro_opomba='" . $_POST['note'] . "' WHERE id='$anketa'");
+ $sql = sisplet_query("UPDATE srv_anketa SET intro_opomba='" . strip_tags($_POST['note']) . "' WHERE id='$anketa'");
// vsilimo refresh podatkov
SurveyInfo :: getInstance()->resetSurveyData();
@@ -429,29 +417,45 @@ class SurveyAdminAjax {
echo '<h2>'.$lang['srv_ime'].'</h2>';
- echo '<div class="quick_title_edit_label taLeft floatLeft">'.$lang['srv_novaanketa_polnoime'].':</div>';
- echo '<div class="floatLeft" >';
- echo '<input type="text" id="novaanketa_naslov_1" name="novaanketa_naslov_1" value="'.$naslov.'" class="full" maxlength="'.ANKETA_NASLOV_MAXLENGTH.'" onfocus="if(this.value==\''.$lang['srv_naslov'].'\') {this.value=\'\';}" />';
- echo '<span id="novaanketa_naslov_1_chars" class="spaceLeft">'.mb_strlen($naslov, 'UTF-8').'/'.ANKETA_NASLOV_MAXLENGTH.'</span>';
- echo '<br class="clr"/><i class="gray small">'.$lang['srv_interno_ime'].'</i>';
- echo '</div>';
-
- echo '<br class="clr"/><br class="clr"/>';
+
+ echo '<div class="quick_title_setting">';
+
+ echo ' <div class="title_line">'.$lang['srv_novaanketa_polnoime'].':</div>';
+ echo ' <div class="setting_line">';
+ echo ' <input type="text" id="novaanketa_naslov_1" name="novaanketa_naslov_1" value="'.$naslov.'" class="medium" maxlength="'.ANKETA_NASLOV_MAXLENGTH.'" onfocus="if(this.value==\''.$lang['srv_naslov'].'\') {this.value=\'\';}" />';
+ echo ' <span id="novaanketa_naslov_1_chars" class="counter">'.mb_strlen($naslov, 'UTF-8').'/'.ANKETA_NASLOV_MAXLENGTH.'</span>';
+ echo ' </div>';
+ echo ' <div class="opomba_line">';
+ echo $lang['srv_interno_ime'];
+ echo ' </div>';
+
+ echo '</div>';
- echo '<div class="quick_title_edit_label taLeft floatLeft">'.$lang['srv_novaanketa_kratkoime'].':</div>';
- echo '<div class="floatLeft">';
+
+ echo '<div class="quick_title_setting">';
+
+ echo ' <div class="title_line">'.$lang['srv_novaanketa_kratkoime'].':</div>';
+ echo ' <div class="setting_line">';
$name_changed = ($naslov != $akronim) ? '1' : '0';
- echo '<input type="text" id="novaanketa_akronim_1" name="novaanketa_akronim_1" value="'.$akronim.'" class="full" maxlength="'.ANKETA_AKRONIM_MAXLENGTH.'" onfocus="$(this).attr(\'changed\',\'1\'); if(this.value==\''.$lang['srv_naslov'].'\') {this.value=\'\';}" changed="'.$name_changed.'" />';
- echo '<span id="novaanketa_akronim_1_chars" class="spaceLeft">'.mb_strlen($akronim, 'UTF-8').'/'.ANKETA_AKRONIM_MAXLENGTH.'</span>';
- echo '<br class="clr"/><i class="gray small">'.$lang['srv_objavljeno_ime'].'</i>';
- echo '</div>';
-
- echo '<br class="clr"/><br class="clr"/>';
-
- echo '<div class="quick_title_edit_label taLeft floatLeft">'.$lang['srv_list_no_data_create_note'].':</div>';
- echo '<div class="floatLeft">';
- echo '<textarea id="novaanketa_opis_1" name="novaanketa_opis_1" class="full" rows="3">'.$row['intro_opomba'].'</textarea>';
- echo '</div>';
+ echo ' <input type="text" id="novaanketa_akronim_1" name="novaanketa_akronim_1" value="'.$akronim.'" class="medium" maxlength="'.ANKETA_AKRONIM_MAXLENGTH.'" onfocus="$(this).attr(\'changed\',\'1\'); if(this.value==\''.$lang['srv_naslov'].'\') {this.value=\'\';}" changed="'.$name_changed.'" />';
+ echo ' <span id="novaanketa_akronim_1_chars" class="counter">'.mb_strlen($akronim, 'UTF-8').'/'.ANKETA_AKRONIM_MAXLENGTH.'</span>';
+ echo ' </div>';
+ echo ' <div class="opomba_line">';
+ echo $lang['srv_objavljeno_ime'];
+ echo ' </div>';
+
+ echo '</div>';
+
+
+ echo '<div class="quick_title_setting">';
+
+ echo ' <div class="title_line">'.$lang['srv_list_no_data_create_note'].':</div>';
+ echo ' <div class="setting_line">';
+ echo ' <textarea id="novaanketa_opis_1" name="novaanketa_opis_1" class="full" rows="3">'.$row['intro_opomba'].'</textarea>';
+ echo ' </div>';
+
+ echo '</div>';
+
echo '<script>';
echo "$('#novaanketa_naslov_1').keyup(function(){
@@ -485,12 +489,10 @@ class SurveyAdminAjax {
";
echo '</script>';
-
- //echo '<span class="floatleft spaceLeft" title="'.$lang['srv_settings_quick'].'"><a class="" href="#" onclick="quick_title_edit_save(\'true\'); return false;"><span>'.$lang['srv_settings_quick'].'</span></a></span>';
-
- echo '<div class="buttons_holder">';
- echo '<span class="buttonwrapper floatRight" title="'.$lang['srv_save_profile_yes'].'"><a class="ovalbutton ovalbutton_orange" href="#" onclick="quick_title_edit_save(); return false;"><span>'.$lang['srv_save_profile_yes'].'</span></a></span>';
- echo '<span class="buttonwrapper floatRight spaceRight" title="'.$lang['srv_cancel'].'"><a class="ovalbutton ovalbutton_gray" href="#" onclick="quick_title_edit_cancel(); return false;"><span>'.$lang['srv_cancel'].'</span></a></span>';
+
+ echo '<div class="button_holder">';
+ echo ' <button class="medium white-blue" title="'.$lang['srv_cancel'].'" onclick="quick_title_edit_cancel(); return false;">'.$lang['srv_cancel'].'</button>';
+ echo ' <button class="medium blue" title="'.$lang['srv_save_profile_yes'].'" onclick="quick_title_edit_save(); return false;">'.$lang['srv_save_profile_yes'].'</button>';
echo '</div>';
echo '</div>';
@@ -500,13 +502,13 @@ class SurveyAdminAjax {
$update=array();
if (isset($_POST['naslov']) && trim($_POST['naslov']) != '') {
- $update[] = " naslov='".trim($_POST['naslov'])."'";
+ $update[] = " naslov='".strip_tags(trim($_POST['naslov']))."'";
}
if (isset($_POST['akronim']) && trim($_POST['akronim']) != '') {
- $update[] = " akronim='".trim($_POST['akronim'])."'";
+ $update[] = " akronim='".strip_tags(trim($_POST['akronim']))."'";
}
if (isset($_POST['intro_opomba']) /*&& trim($_POST['intro_opomba']) != ''*/) {
- $update[] = " intro_opomba='".trim($_POST['intro_opomba'])."'";
+ $update[] = " intro_opomba='".strip_tags(trim($_POST['intro_opomba']))."'";
}
if (count($update) > 0 ) {
sisplet_query("UPDATE srv_anketa SET ".implode(',',$update)." WHERE id='".$this->anketa."'");
@@ -540,8 +542,8 @@ class SurveyAdminAjax {
$show_intro = $_POST['show_intro'];
$show_concl = $_POST['show_concl'];
$concl_link = $_POST['concl_link'];
- $intro_opomba = $_POST['intro_opomba'];
- $concl_opomba = $_POST['concl_opomba'];
+ $intro_opomba = strip_tags($_POST['intro_opomba']);
+ $concl_opomba = strip_tags($_POST['concl_opomba']);
if ($_POST['concl_link'] == 1)
$concl_link = 0;
else
@@ -585,18 +587,19 @@ class SurveyAdminAjax {
if (!$sql)
echo mysqli_error($GLOBALS['connect_db']);
}
- if (isset ($_POST['SurveyExport'])) {
- $val = $_POST['SurveyExport'];
- $sql = sisplet_query("UPDATE misc SET value='$val' WHERE what = 'SurveyExport'");
- if (!$sql)
- echo mysqli_error($GLOBALS['connect_db']);
- }
if (isset ($_POST['SurveyForum'])) {
$val = $_POST['SurveyForum'];
$sql = sisplet_query("UPDATE misc SET value='$val' WHERE what = 'SurveyForum'");
if (!$sql)
echo mysqli_error($GLOBALS['connect_db']);
}
+
+ // Save app settings
+ foreach($_POST as $what => $value){
+ if(substr($what, 0, 3) == 'as_'){
+ AppSettings::getInstance()->saveSetting(substr($what, 3), $value);
+ }
+ }
}
elseif ($_GET['m'] == 'global_user_settings') {
if (isset ($_POST['language'])) {
@@ -690,7 +693,8 @@ class SurveyAdminAjax {
}
if(empty($_POST['google-2fa']) && !empty($_POST['google_2fa_akcija']) && $_POST['google_2fa_akcija'] == 'deactivate' && !empty($_POST['google_2fa_deaktiviraj'])){
- $user_2fa = User::option($global_user_id, 'google-2fa-secret');
+
+ $user_2fa = User::option($global_user_id, 'google-2fa-secret');
$user_2fa_validate = User::option($global_user_id, 'google_2fa_koda_validate');
$google2fa = new \Sonata\GoogleAuthenticator\GoogleAuthenticator();
@@ -700,7 +704,8 @@ class SurveyAdminAjax {
echo 'success';
return true;
- }else{
+ }
+ else{
echo 'error';
return true;
}
@@ -731,7 +736,7 @@ class SurveyAdminAjax {
&& $_POST['geslo'] == $_POST['geslo2']){
- $result = sisplet_query ("UPDATE users SET pass='".base64_encode((hash(SHA256, $geslo.$pass_salt)))."' WHERE id='".$global_user_id."'");
+ $result = sisplet_query ("UPDATE users SET pass='".base64_encode((hash('SHA256', $geslo.$pass_salt)))."' WHERE id='".$global_user_id."'");
setcookie('uid', '', time() - 3600, '/', $cookie_domain);
setcookie('secret', '', time() - 3600, '/', $cookie_domain);
setcookie('unam', '', time() - 3600, '/', $cookie_domain);
@@ -753,6 +758,14 @@ class SurveyAdminAjax {
// naredi link za aktivacijo
$code = base64_encode((hash('SHA256', time() .$pass_salt . $email. $rowU['name'])));
+ //Preverimo, koliko alternativnih emailov ima (dovolimo samo 10)
+ $sql_user_to_be = sisplet_query ("SELECT count(id) AS skupaj FROM users_to_be WHERE user_id='" . $global_user_id . "'");
+ $row_user_to_be = mysqli_fetch_array($sql_user_to_be);
+ if($row_user_to_be['skupaj'] > 10){
+ echo 'error';
+ return true;
+ }
+
// Vstavimo novega userja v users_to_be kjer caka na aktivacijo
$insert_id = sisplet_query ("INSERT INTO users_to_be
(type, email, name, user_id, timecode, code, lang)
@@ -761,8 +774,7 @@ class SurveyAdminAjax {
$poslji_email = [];
- global $app_settings;
- $PageName = $app_settings['app_name'];
+ $PageName = AppSettings::getInstance()->getSetting('app_settings-app_name');
// Pošljemo email na alternativni email in nato še na primarni email samo obvestilo o dodanem emailu
$poslji_email['novi'] = [
@@ -923,6 +935,10 @@ class SurveyAdminAjax {
if (isset($_POST['mobile_tables'])) {
SurveySetting::getInstance()->setSurveyMiscSetting('mobile_tables', $_POST['mobile_tables']);
}
+
+ if (isset($_POST['pc_tables'])) {
+ SurveySetting::getInstance()->setSurveyMiscSetting('pc_tables', $_POST['pc_tables']);
+ }
if (isset($_POST['export_font_size'])) {
SurveySetting::getInstance()->setSurveyMiscSetting('export_font_size', $_POST['export_font_size']);
@@ -1048,7 +1064,7 @@ class SurveyAdminAjax {
if(isset($_POST['lang_resp'])){
// Popravljamo samo ce imamo vec jezikov
- $sqlL = sisplet_query("SELECT id FROM srv_language WHERE ank_id='$this->anketa'");
+ $sqlL = sisplet_query("SELECT lang_id FROM srv_language WHERE ank_id='$this->anketa'");
if (mysqli_num_rows($sqlL) > 0){
$new_resp_lang_id = $_POST['lang_resp'];
$old_resp_lang_id = SurveyInfo::getInstance()->getSurveyColumn('lang_resp');
@@ -1093,6 +1109,9 @@ class SurveyAdminAjax {
// Zaradi zavihkov sproti preverjamo katere variable lahko shranimo če so bile podane preko $_POST
$allVariableToSave = array (
+ 'naslov',
+ 'akronim',
+ 'intro_opomba',
'cookie',
'cookie_return',
'return_finished',
@@ -1132,8 +1151,6 @@ class SurveyAdminAjax {
'continue_later',
'js_tracking',
'defValidProfile',
- 'showItime',
- 'showLineNumber',
'parapodatki'
);
@@ -1173,7 +1190,7 @@ class SurveyAdminAjax {
$sql = sisplet_query("UPDATE srv_anketa SET progressbar='$_POST[progressbar]' WHERE id='$anketa'");
}
- if ($_POST['quiz'] == 1) { // za kviz je anketa vedno v pogoji in bloki načinu
+ if (isset($_POST['quiz']) && $_POST['quiz'] == 1) { // za kviz je anketa vedno v pogoji in bloki načinu
sisplet_query("UPDATE srv_anketa SET survey_type='3' WHERE id = '$anketa'");
ob_start();
$ba = new BranchingAjax($this->anketa);
@@ -1207,7 +1224,7 @@ class SurveyAdminAjax {
}
}
- if ($_POST['multilang'] == 1) {
+ if (isset($_POST['multilang']) && $_POST['multilang'] == 1) {
$this->SurveyAdmin->createUserbaseSystemVariable(0, 0, 1);
}
@@ -1271,7 +1288,7 @@ class SurveyAdminAjax {
}
}
- if ($dostop_edit == 1 && isset ($global_user_id) && $global_user_id > 0) {
+ if (isset($dostop_edit) && $dostop_edit == 1 && isset($global_user_id) && $global_user_id > 0) {
global $admin_type;
$uid = $_POST['uid'];
@@ -1317,7 +1334,7 @@ class SurveyAdminAjax {
}
}
- if ($_POST['comment_send'] != '') {
+ if (isset($_POST['comment_send']) && $_POST['comment_send'] != '') {
// nastavitev, da se okno s komentarji prvic prikaze odprto
if ($_POST['srv_c_alert'] == '1')
@@ -1357,100 +1374,6 @@ class SurveyAdminAjax {
}
}
}
-
- // Dodajanje novih uproabnikov (emailov)
- if (isset($_POST['addusers']) && $_POST['addusers'] != '') {
- global $pass_salt, $global_user_id, $site_path, $admin_type;
-
- $_POST['addusers'] = mysql_real_unescape_string($_POST['addusers']);
- $users = explode(NEW_LINE, $_POST['addusers']);
- $sqlu = sisplet_query("SELECT email, name FROM users WHERE id = '".$global_user_id."'");
- $rowu = mysqli_fetch_array($sqlu);
-
- $MailReply = $rowu['email'];
- $nameAuthor = $rowu['name'];
-
- $aktiven = $_POST['aktiven'];
-
- // Loop cez vse vnesesne userje, ki jim dajemo dostop
- foreach ($users AS $user) {
-
- $user = explode(',', $user);
- $email = trim($user[0]);
- $name = trim($user[1])!='' ? trim($user[1]) : $email;
- $surnname = trim($user[2])!='' ? trim($user[2]) : $email;
-
- // Ce gre za veljaven email dodamo userja
- if ($email != '' && validEmail($email)) {
-
- $id = 0;
- $sqlu = sisplet_query("SELECT id FROM users WHERE email='$email'");
-
- // Ce user, ki ga dodajamo, se ne obstaja, ga ustvarimo - PO NOVEM SAMO CE SMO ADMIN ALI MANAGER
- if (mysqli_num_rows($sqlu) == 0 && ($admin_type == 0 || $admin_type == 1)) {
- $s = sisplet_query("INSERT INTO users (name, surname, email, pass, type, when_reg, came_from) VALUES ('$name', '$surnname', '$email', '" .base64_encode((hash(SHA256, '' .$pass_salt))) ."', '3', DATE_FORMAT(NOW(), '%Y-%m-%d'), '1')");
- $id = mysqli_insert_id($GLOBALS['connect_db']);
- }
- // Drugace pridobimo podatke o userju iz baze
- else {
- $rowu = mysqli_fetch_array($sqlu);
- $id = $rowu['id'];
- }
-
- // Ce je bil ustvarjen oz ga imamo ze v bazi, mu damo dostop in posljemo mail
- if($id > 0){
- $s = sisplet_query("INSERT INTO srv_dostop (ank_id, uid, aktiven) VALUES ('$anketa', '$id', '$aktiven')");
- if ( !$s ) echo mysqli_error($GLOBALS['connect_db']);
-
- // V kolikor gre za hierarhijo, potem še enkrat preverimo v bazi in dodelimo dostop tudi do hierarhije status 2 - naknadno dodan administrator
- if(SurveyInfo::checkSurveyModule('hierarhija', $anketa))
- sisplet_query("INSERT INTO srv_hierarhija_users (user_id, anketa_id, type) VALUES ('".$id."', '".$anketa."', 2)");
-
- $naslov = SurveyInfo::getInstance()->getSurveyColumn('naslov');
-
- $subject = $lang['srv_dostopmail_1'].' '.$naslov.'.';
-
- $content = $lang['srv_dostopmail_2'].' <span style="color:red;">'.$nameAuthor.'</span> (<a style="color:#1e88e5 !important; text-decoration:none !important;" href="mailto:'.$MailReply.'">'.$MailReply.'</a>) '.$lang['srv_dostopmail_3'].' <a style="color:#1e88e5 !important; text-decoration:none !important;" href="'.$site_url.'admin/survey/index.php?anketa='.$anketa.'"><span style="font-weight:bold;">'.$naslov.'.</span></a><br /><br />
- '.$lang['srv_dostopmail_4'].' <a style="color:#1e88e5 !important; text-decoration:none !important;" href="'.$site_url.'">'.$site_url.'</a> '.$lang['srv_dostopmail_5'].' (<a style="color:#1e88e5 !important; text-decoration:none !important;" href="mailto:'.$email.'">'.$email.'</a>).';
-
- // Ce email se ni registriran, dodamo dodatno obvestilo
- if(mysqli_num_rows($sqlu) == 0 && ($admin_type == 0 || $admin_type == 1)){
- $content .= '<br /><br />'.$lang['srv_dostopmail_7'];
- $content .= ' <a style="color:#1e88e5 !important; text-decoration:none !important;" href="'.$site_url.'/admin/survey/index.php?a=nastavitve&m=global_user_myProfile">'.$lang['edit_data'].'</a> ';
- $content .= $lang['srv_dostopmail_72'];
- }
-
- // Sporočilo urednika (opcijsko)
- if(isset($_POST['addusers_note']) && $_POST['addusers_note'] != ''){
-
- $_POST['addusers_note'] = mysql_real_unescape_string($_POST['addusers_note']);
-
- $content .= '<br /><br /><span style="font-weight:bold;">'.$lang['srv_dostopmail_note'].'</span><br /><br />';
- $content .= '<span style="color:red;">'.$_POST['addusers_note'].'</span>';
- }
-
- // Podpis
- $signature = Common::getEmailSignature();
- $content .= $signature;
-
- try{
- $MA = new MailAdapter($this->anketa, $type='account');
- $MA->addRecipients($email);
- $resultX = $MA->sendMail(stripslashes($content), $subject);
- }
- catch (Exception $e)
- {
- }
-
- if ($resultX) {
- $status = 1; // poslalo ok
- } else {
- $status = 2; // ni poslalo
- }
- }
- }
- }
- }
}
# nastavimo še stvari za slideshow
@@ -1463,58 +1386,71 @@ class SurveyAdminAjax {
}
$urlprefix = "?";
+ $anketaurl = '';
if (isset ($anketa) && $anketa != null && $anketa != "") {
$anketaurl = $urlprefix . 'anketa=' . $anketa;
$urlprefix = "&";
}
- if ($_REQUEST['location'] == 'jezik' && $_REQUEST['multilang'] == '1') {
+
+ $location = isset($_REQUEST['location']) ? $_REQUEST['location'] : '';
+ $multilang = isset($_REQUEST['multilang']) ? $_REQUEST['multilang'] : '';
+ $uporabnost = isset($_REQUEST['uporabnost']) ? $_REQUEST['uporabnost'] : '';
+ $user_from_cms = isset($_REQUEST['user_from_cms']) ? $_REQUEST['user_from_cms'] : '';
+ $quiz = isset($_REQUEST['quiz']) ? $_REQUEST['quiz'] : '';
+ $phone = isset($_REQUEST['phone']) ? $_REQUEST['phone'] : '';
+ $email = isset($_REQUEST['email']) ? $_REQUEST['email'] : '';
+ $social_network = isset($_REQUEST['social_network']) ? $_REQUEST['social_network'] : '';
+ $slideshow = isset($_REQUEST['slideshow']) ? $_REQUEST['slideshow'] : '';
+ $m = isset($_REQUEST['m']) ? $_REQUEST['m'] : '';
+
+ if ($location == 'jezik' && $multilang == '1') {
$locationurl = $urlprefix . 'a=prevajanje';
$urlprefix = "&";
- } else if ($_REQUEST['uporabnost'] == 1) {
+ } else if ($uporabnost == 1) {
$locationurl = $urlprefix . 'a=uporabnost';
$urlprefix = "&";
- } else if ($_REQUEST['user_from_cms'] == 2 && $_REQUEST['location'] != 'piskot') {
+ } else if ($user_from_cms == 2 && $location != 'piskot') {
$locationurl = $urlprefix . 'a=vnos';
$urlprefix = "&";
- } else if ($_REQUEST['quiz'] == 1) {
+ } else if ($quiz == 1) {
$locationurl = $urlprefix . 'a=kviz';
$urlprefix = "&";
- } else if ($_REQUEST['phone'] == 1) {
+ } else if ($phone == 1) {
$locationurl = $urlprefix . 'a='.A_TELEPHONE;
$urlprefix = "&";
- } else if ($_REQUEST['email'] == 1) {
+ } else if ($email == 1) {
#$locationurl = $urlprefix . 'a=invitations';
$locationurl = $urlprefix . 'a='.A_VABILA;
$urlprefix = "&";
- } else if ($_REQUEST['social_network'] == 1) {
+ } else if ($social_network == 1) {
$locationurl = $urlprefix . 'a=social_network';
$urlprefix = "&";
- } else if ($_REQUEST['m'] == 'vabila ') {
+ } else if ($m == 'vabila ') {
// izpisemo vsebino nastavitev za vabila
$locationurl = $urlprefix . 'a='.A_VABILA;
$urlprefix = "&";
- } else if ($_REQUEST['slideshow'] == 1) {
+ } else if ($slideshow == 1) {
$locationurl = $urlprefix.'a=slideshow';
$urlprefix = "&";
- } else if ($_REQUEST['m'] == 'system') {
+ } else if ($m == 'system') {
$locationurl = $urlprefix.'a=nastavitve&m=system';
$urlprefix = "&";
- } else if ($_REQUEST['m'] == 'global_user_settings') {
+ } else if ($m == 'global_user_settings') {
$locationurl = $urlprefix.'a=nastavitve&m=global_user_settings';
$urlprefix = "&";
- } else if ($_REQUEST['m'] == 'global_user_myProfile') {
+ } else if ($m == 'global_user_myProfile') {
$locationurl = $urlprefix.'a=nastavitve&m=global_user_myProfile';
$urlprefix = "&";
- } else if ($_REQUEST['m'] == 'predvidenicasi') {
+ } else if ($m == 'predvidenicasi') {
$locationurl = $urlprefix.'a=nastavitve&m=predvidenicasi';
$urlprefix = "&";
- } else if ($_REQUEST['m'] == 'vabila_settings') {
+ } else if ($m == 'vabila_settings') {
$locationurl = $urlprefix.'a='.A_VABILA;
$urlprefix = "&";
- } else if ($_REQUEST['m'] == 'inv_server') {
+ } else if ($m == 'inv_server') {
$locationurl = $urlprefix.'a=invitations&m=inv_settings';
$urlprefix = "&";
- } else if ($_REQUEST['m'] == 'email_server') {
+ } else if ($m == 'email_server') {
$locationurl = $urlprefix.'a=alert&m=email_server';
$urlprefix = "&";
} else if ($_POST['location'] == 'handleUserCodeSetting') {
@@ -1526,7 +1462,7 @@ class SurveyAdminAjax {
$urlprefix = "&";
}
if (isset($_REQUEST['submited']) && $_REQUEST['submited'] == 1) {
- $locationurl .= $urlprefix.'s=1'.($_GET['show_back'] ? '&show_back=true' : '');
+ $locationurl .= $urlprefix.'s=1'.(isset($_GET['show_back']) ? '&show_back=true' : '');
}
if ( isset($_REQUEST['lang_id']) ) {
$locationurl .= $urlprefix.'lang_id='.$_REQUEST['lang_id'];
@@ -1632,8 +1568,9 @@ class SurveyAdminAjax {
}
}
- SurveyAlert::getInstance()->Init($anketa, $global_user_id);
- SurveyAlert::getInstance()->prepareSendExpireAlerts();
+ // Ostanek, kjer se uporablja baza surveycrontab za posiljanje obvestil o poteku
+ /*SurveyAlert::getInstance()->Init($anketa, $global_user_id);
+ SurveyAlert::getInstance()->prepareSendExpireAlerts();*/
} elseif ($_POST['m'] == 'active') {
@@ -1762,7 +1699,7 @@ class SurveyAdminAjax {
} elseif ($_GET['a'] == 'anketa' || $_GET['a'] == 'nova-anketa-in-hierarhija' || $_GET['a'] == 'anketa_from_text') {
Common::updateEditStamp();
- if (trim($_POST['survey_type']) == '') {
+ if (!isset($_POST['survey_type']) || trim($_POST['survey_type']) == '') {
$_POST['survey_type'] = 2;
}
$anketa = $this->SurveyAdmin->nova_anketa($naslov, $intro_opomba, $akronim, $_POST['survey_type'], $skin);
@@ -1838,6 +1775,10 @@ class SurveyAdminAjax {
$row = SurveyInfo::getInstance()->getSurveyRow();
+ $starts = '';
+ $expire = '';
+
+ // Anketa ni aktivna - jo aktiviramo
if ($row['active'] == 0) {
$active = 1;
$backup = 0;
@@ -1855,10 +1796,12 @@ class SurveyAdminAjax {
if ($_POST['starts']) {
$starts = ", starts='" . $_POST['starts'] . "' ";
$activity_starts = "'".$_POST['starts']."'";
- } else {
+ }
+ else {
$starts = ", starts=NOW() ";
$activity_starts = 'NOW()';
}
+
if ($_POST['expire']) {
# če je datum expire od trajne ankete '2099-01-01' in anketo deaktiviramo moramo spremeniti datum expire da ni več videti kot trajna
if ($_POST['expire'] == PERMANENT_DATE) {
@@ -1867,28 +1810,45 @@ class SurveyAdminAjax {
}
$expire = ", expire='" . $_POST['expire'] . "' ";
$activity_expire = "'".$_POST['expire']."'";
- } else {
+ }
+ else {
$expire = ", expire=NOW() + INTERVAL 30 DAY ";
$activity_expire = 'NOW() + INTERVAL 30 DAY';
}
- } else {
+ }
+ // Anketa je aktivna - jo deaktiviramo
+ else {
$active = 0;
$backup = $row['backup'];
$locked = "locked";
-
- if(Common::checkModule('maza') && SurveyInfo::getSurveyModules('maza')){
+
+ $activity_expire = 'NOW()';
+
+ if(Common::checkModule('maza') && SurveyInfo::checkSurveyModule('maza')){
$maza = new MAZA($this->anketa);
$maza ->maza_off();
}
}
- $sql = sisplet_query("UPDATE srv_anketa SET active='$active', backup='$backup', locked=$locked $starts $expire WHERE id = '$anketa'");
+ $sql = sisplet_query("UPDATE srv_anketa SET active='$active', backup='$backup', locked=$locked $starts $expire WHERE id='$anketa'");
- # dodamo zapis v srv_activity
+ # Pri aktivaciji dodamo zapis v srv_activity samo ce
if ($active == 1) {
- $activity_insert_string = "INSERT INTO srv_activity (sid, starts, expire, uid) VALUES('".$anketa."', $activity_starts, $activity_expire, '".$global_user_id."' );";
- $sql_insert = sisplet_query($activity_insert_string);
+ $sql_insert = sisplet_query("INSERT INTO srv_activity
+ (sid, starts, expire)
+ VALUES
+ ('".$anketa."', ".$activity_starts.", ".$activity_expire.")
+ ON DUPLICATE KEY UPDATE
+ expire=".$activity_expire."
+ ");
}
+ else{
+ $sql_insert = sisplet_query("UPDATE srv_activity
+ SET expire=".$activity_expire."
+ WHERE sid='".$anketa."'
+ ");
+ }
+
# vsilimo refresh podatkov
SurveyInfo :: getInstance()->resetSurveyData();
@@ -1902,7 +1862,7 @@ class SurveyAdminAjax {
$this->anketa = $anketa;
- if ($_POST['folders'] && $_POST['folders'] == 'true') { // če smo na folderjih zlistamo folderje
+ if (isset($_POST['folders']) && $_POST['folders'] == 'true') { // če smo na folderjih zlistamo folderje
# osvezimo samo ikonico in ne celotnih map
$row = SurveyInfo::getInstance()->getSurveyRow();
echo '<a href="#" onclick="anketa_active(\''.$this->anketa.'\',\''.(int)$row['active'].'\',\'true\'); return false;">' .
@@ -1924,31 +1884,34 @@ class SurveyAdminAjax {
$rowa = SurveyInfo::getInstance()->getSurveyRow();
- //notify all maza app users who participate in this survey that this survey has ended
- if(SurveyInfo::getSurveyModules('maza') && $rowa['active'] = 1){
- $maza = new MAZA($this->anketa);
- $maza ->maza_off();
- }
+ //notify all maza app users who participate in this survey that this survey has ended
+ if(SurveyInfo::checkSurveyModule('maza') && $rowa['active'] = 1){
+ $maza = new MAZA($this->anketa);
+ $maza ->maza_off();
+ }
$this->SurveyAdmin->anketa_delete($anketa);
# če postamo iz survey_lista (prva stran) preverimo koliko anket je ostalo, če je bila zadnja osvežimo celotno stran
if (isset($_POST['inList'] ) && $_POST['inList'] == 'true' ) {
+ global $admin_type, $global_user_id;
+
# preštejemo število anket.
- global $admin_type, $global_user_id;
//SELECT count(sa.id) AS cnt FROM srv_anketa sa WHERE sa.backup='0' AND sa.id > 0 AND (sa.dostop >= '2' OR sa.id IN (SELECT ank_id FROM srv_dostop WHERE uid='90'))
$stringSurveyList = "SELECT count(sa.id) AS cnt FROM srv_anketa sa WHERE sa.backup='0' AND sa.id > 0 AND (sa.dostop >= '".$admin_type."' OR sa.id IN (SELECT ank_id FROM srv_dostop WHERE uid='".$global_user_id."'))";
$sqlSurveyList = sisplet_query($stringSurveyList);
$rowSurveyList = mysqli_fetch_assoc($sqlSurveyList);
+
# v ajax post vrnemo število anket
echo $rowSurveyList['cnt'];
+
return;
}
+
if ($rowa['backup'] > 0)
echo 'index.php?anketa=' . $rowa['backup'] . '&a=arhivi';
else
echo 'index.php';
-
}
elseif ($_GET['a'] == 'nova_grupa') {
Common::updateEditStamp();
@@ -3236,9 +3199,6 @@ class SurveyAdminAjax {
if ($value != '') {
sisplet_query("INSERT INTO srv_data_text".$this->db_table." (spr_id, vre_id, usr_id, text) VALUES ('$spr_id', '$vre_id', '$usr_id', '$value')");
-
- /*if ($textfield == 1)
- sisplet_query("DELETE FROM srv_data_vrednost WHERE spr_id='$spr_id' AND usr_id='$usr_id'");*/
}
}
@@ -3246,40 +3206,11 @@ class SurveyAdminAjax {
Common::updateEditStamp();
sisplet_query("DELETE FROM srv_user WHERE id = '$usr_id'");
- /* Ker imamo FK bi moralo avtomatsko pobrisati vse ostale vnose ( upam da res :) )
- sisplet_query("DELETE FROM srv_data_grid".$this->db_table." WHERE usr_id = '$usr_id'");
- sisplet_query("DELETE FROM srv_data_text".$this->db_table." WHERE usr_id = '$usr_id'");
- sisplet_query("DELETE FROM srv_data_vrednost".$this->db_table." WHERE usr_id = '$usr_id'");
- sisplet_query("DELETE FROM srv_data_checkgrid".$this->db_table." WHERE usr_id = '$usr_id'");
- sisplet_query("DELETE FROM srv_data_imena WHERE usr_id = '$usr_id'");
- sisplet_query("DELETE FROM srv_data_number WHERE usr_id = '$usr_id'");
- sisplet_query("DELETE FROM srv_data_rating WHERE usr_id = '$usr_id'");
- sisplet_query("DELETE FROM srv_data_textgrid".$this->db_table." WHERE usr_id = '$usr_id'");
- sisplet_query("DELETE FROM srv_user_grupa_active WHERE usr_id = '$usr_id'");
- sisplet_query("DELETE FROM srv_user_grupa WHERE usr_id = '$usr_id'");
- */
}
elseif ($_GET['a'] == 'delete_all') {
Common::updateEditStamp();
$sql = sisplet_query("DELETE FROM srv_user WHERE ank_id = '$this->anketa'");
- //$sql = sisplet_query("SELECT * FROM srv_user WHERE ank_id = '$this->anketa'");
- //while ($row = mysqli_fetch_array($sql)) {
-
- //sisplet_query("DELETE FROM srv_user WHERE id = '$row[id]'");
- /* Ker imamo FK bi moralo avtomatsko pobrisati vse ostale vnose ( upam da res :) )
- sisplet_query("DELETE FROM srv_data_grid".$this->db_table." WHERE usr_id = '$row[id]'");
- sisplet_query("DELETE FROM srv_data_text".$this->db_table." WHERE usr_id = '$row[id]'");
- sisplet_query("DELETE FROM srv_data_vrednost".$this->db_table." WHERE usr_id = '$row[id]'");
- sisplet_query("DELETE FROM srv_data_checkgrid".$this->db_table." WHERE usr_id = '$row[id]'");
- sisplet_query("DELETE FROM srv_data_imena WHERE usr_id = '$row[id]'");
- sisplet_query("DELETE FROM srv_data_number WHERE usr_id = '$row[id]'");
- sisplet_query("DELETE FROM srv_data_rating WHERE usr_id = '$row[id]'");
- sisplet_query("DELETE FROM srv_data_textgrid".$this->db_table." WHERE usr_id = '$row[id]'");
- sisplet_query("DELETE FROM srv_user_grupa_active WHERE usr_id = '$row[id]'");
- sisplet_query("DELETE FROM srv_user_grupa WHERE usr_id = '$row[id]'");
- */
- //}
# pobrišemo še DATA datoteke in HTML -dashboard če obstajajo
global $site_path;
@@ -3325,8 +3256,9 @@ class SurveyAdminAjax {
$row = SurveyInfo::getInstance()->getSurveyRow();
# updejtjmo pošiljanje alertov
- SurveyAlert::getInstance()->Init($anketa, $global_user_id);
- SurveyAlert::getInstance()->prepareSendExpireAlerts();
+ // Ostanek, kjer se uporablja baza surveycrontab za posiljanje obvestil o poteku
+ /*SurveyAlert::getInstance()->Init($anketa, $global_user_id);
+ SurveyAlert::getInstance()->prepareSendExpireAlerts();*/
if ($_POST['folders'] && $_POST['folders'] == 'true') { // če smo na folderjih zlistamo folderje
// osvezimo samo ikonico in ne celotnih map
@@ -3342,111 +3274,111 @@ class SurveyAdminAjax {
global $global_user_id;
$folders = $_POST['folders'];
-
+
# za koliko časa aktiviramo
$mth = 3;
$starts = date("d.m.Y"); // danes
- $startsDB = date("Y-m-d"); // danes
$cd = strtotime($starts);
$expire = date('d.m.Y', mktime(0, 0, 0, date('m', $cd) + $mth, date('d', $cd), date('Y', $cd)));
- $expireDB = date('Y-m-d', mktime(0, 0, 0, date('m', $cd) + $mth, date('d', $cd), date('Y', $cd)));
- # preverimo ali ima uporabnik izklopljeno zaklepanje
- # polovimo nastavitve uporabnika
-
- UserSetting::getInstance()->Init($global_user_id);
- # ali zaklepamo anketo ob aktivaciji
- $lockSurvey = UserSetting::getInstance()->getUserSetting('lockSurvey');
-
- # aktiviramo anketo
- #avtomatsko aktiviramo anketo za 1 mesec in o tem obvestimo uporabnika.
- $updateString = "UPDATE srv_anketa SET active='1', locked='".(int)$lockSurvey."', backup='0', starts='".$startsDB."', expire='".$expireDB."' WHERE id='$anketa'";
- $sql = sisplet_query($updateString) or die(mysqli_error($GLOBALS['connect_db']));
-
- // Zapišemo vsako aktivacijo ankete po dnevih
- $activity_insert_string = "INSERT INTO srv_activity (sid, starts, expire, uid) VALUES('" . $anketa . "', '" . $startsDB . "', '" . $expireDB . "', '" . $global_user_id . "' )";
- $sql_insert = sisplet_query($activity_insert_string);
-
- # popravimo timestamp za regeneracijo dashboarda
- Common::getInstance()->Init($anketa);
- Common::getInstance()->updateEditStamp();
-
- # vsilimo refresh podatkov
- SurveyInfo :: getInstance()->resetSurveyData();
$row = SurveyInfo::getInstance()->getSurveyRow();
-
- # posljemo mail ob spremembi aktivnosti ankete
- SurveyAlert::getInstance()->Init($anketa, $global_user_id);
- SurveyAlert::getInstance()->sendMailActive();
-
- $gdpr = new GDPR();
+
+ $b = new Branching($this->anketa);
+ $napake = $b->check_pogoji_output();
# Aktivacijski pop up za hierarhijo
if(SurveyInfo::getInstance()->checkSurveyModule('hierarhija')){
// Anketo zaklenemo
- sisplet_query("UPDATE srv_anketa SET locked='1' WHERE id = '$anketa'");
+ //sisplet_query("UPDATE srv_anketa SET locked='1' WHERE id = '$anketa'");
// Popup
- echo '<div id="anketa_activate_note" class="divPopUp">';
+ echo '<div id="anketa_activate_note" class="divPopUp PopUpNarrow">';
- echo '<div class="popup_close"><a href="#" onClick="anketa_activate_save(\''.$this->anketa.'\',\''.$folders.'\'); return false;">✕</a></div>';
+ //echo '<div class="popup_close"><a href="#" onClick="anketa_activate_save(\''.$this->anketa.'\',\''.$folders.'\'); return false;">✕</a></div>';
- echo '<h2>' . $lang['srv_hierarchy_activation_header'] . '.</h2>';
-
- echo '<div>' . $lang['srv_activation_expire'] . $expire . '</div>';
- echo '<div id="div_anketa_activate_more"><br/>';
- printf($lang['srv_activation_setting'], $anketa);
- echo '</div>';
-
- // Seznam uporabnikov na katere je bil poslan email
- // Dobimo samo uporabnike na zadnjem nivoju in to obvestilo prikažemo samo prvič ko se aktivira anketa
- if(SurveyInfo::getSurveyModules('hierarhija') == 1) {
- $users_upravicen_do_evalvacije = (new \Hierarhija\Model\HierarhijaOnlyQuery())->queryStrukturaUsers($anketa, ' AND hs.level=(SELECT MAX(level) FROM srv_hierarhija_struktura WHERE anketa_id=' . $anketa . ') GROUP BY users.id');
- echo '<div class="hierarhija-aktivacija-seznam-uporabnikov">';
- echo '<div class="oranzna">';
-
- echo '<h3>' . Hierarhija\HierarhijaHelper::textGledeNaOpcije($anketa, 'srv_hierarchy_email_code') . '</h3>';
-
- if(\Hierarhija\Model\HierarhijaQuery::getOptions($anketa, 'onemogoci_dostop_uciteljem') == 1)
- echo '<h3>' . $lang['srv_hierarchy_teacher_can_not_access']. '</h3>';
-
- echo '</div>';
- echo '<ul>';
- while ($uporabnik = $users_upravicen_do_evalvacije->fetch_object()) {
- echo '<li>' . $uporabnik->email . '</li>';
- }
- echo '</ul>';
- echo '</div>';
- }
+ echo '<h2>' . $lang['srv_hierarchy_activation_header'] . '</h2>';
+
+ //ce hocemo izpisati samo warninge, izpustimo prvo vrstico
+ if((!isset($_POST['izpis']) || $_POST['izpis'] !== 'only_warnings')){
+ echo '<div class="popup_row">';
+ echo '<div><span class="faicon info blue"></span></div>';
+
+ echo '<div>';
+ echo '<div class="'.(($napake == '1') ? '':' gray-text').' bottom8">' . $lang['srv_activation_expire'] . $expire . '</div>';
+ echo '<div class="'.(($napake == '1') ? '':' gray-text').'" id="div_anketa_activate_more">';
+ printf($lang['srv_activation_setting'], $anketa);
+ echo '</div>';
+
+ // Seznam uporabnikov na katere je bil poslan email
+ // Dobimo samo uporabnike na zadnjem nivoju in to obvestilo prikažemo samo prvič ko se aktivira anketa
+ if(SurveyInfo::getSurveyModules('hierarhija') == 1) {
+ $users_upravicen_do_evalvacije = (new \Hierarhija\Model\HierarhijaOnlyQuery())->queryStrukturaUsers($anketa, ' AND hs.level=(SELECT MAX(level) FROM srv_hierarhija_struktura WHERE anketa_id=' . $anketa . ') GROUP BY users.id');
+ echo '<div class="hierarhija-aktivacija-seznam-uporabnikov top16">';
+ echo '<div class="oranzna">';
+
+ echo Hierarhija\HierarhijaHelper::textGledeNaOpcije($anketa, 'srv_hierarchy_email_code');
+
+ if(\Hierarhija\Model\HierarhijaQuery::getOptions($anketa, 'onemogoci_dostop_uciteljem') == 1)
+ echo '<br>'.$lang['srv_hierarchy_teacher_can_not_access'];
+
+ echo '</div>';
+ echo '<ul>';
+ while ($uporabnik = $users_upravicen_do_evalvacije->fetch_object()) {
+ echo '<li>' . $uporabnik->email . '</li>';
+ }
+ echo '</ul>';
+ echo '</div>';
+ }
+
+ echo '</div>';
+ echo '</div>';
+ }
}
else {
// Brez timerja
//echo '<script>stopActivationTimer();</script>';
# Aktivacijski pop up za vse ostale ankete
- echo '<div id="anketa_activate_note" class="divPopUp">';
+ echo '<div id="anketa_activate_note" class="divPopUp PopUpNarrow">';
- echo '<div class="popup_close"><a href="#" onClick="anketa_activate_save(\''.$this->anketa.'\',\''.$folders.'\'); return false;">✕</a></div>';
+ //echo '<div class="popup_close"><a href="#" onClick="anketa_activate_save(\''.$this->anketa.'\',\''.$folders.'\'); return false;">✕</a></div>';
- echo '<h2>' . $lang['srv_activation_header'] . '.</h2>';
+ echo '<h2>' . $lang['srv_activation_header'] . '</h2>';
// GDPR opozorilo ce ni potencialno GDPR
- echo '<p class="bold">';
+ /* echo '<p class="semi-bold bottom16">';
printf($lang['srv_activation_text_nongdpr'], $anketa);
echo '</p>';
- echo '<p class="bold">';
+ echo '<p class="semi-bold">';
echo $lang['srv_activation_text_nongdpr2'];
- echo '</p>';
-
- echo '<div>' . $lang['srv_activation_expire'] .'<b>'.$expire.'</b></div>';
- echo '<div id="div_anketa_activate_more"><br/>';
- printf($lang['srv_activation_setting'], $anketa);
- echo '</div>';
+ echo '</p>'; */
+
+ //ce hocemo izpisati samo warninge, izpustimo prvo vrstico
+ if((!isset($_POST['izpis']) || $_POST['izpis'] !== 'only_warnings')){
+ echo '<div class="popup_row">';
+ echo '<div><span class="faicon info blue"></span></div>';
+ echo '<div>';
+ echo '<div class="bottom8 '.(($napake == '1') ? '':' gray-text').'">' . $lang['srv_activation_expire'] .'<b> '.$expire.'</b></div>';
+ echo '<div class="'.(($napake == '1') ? '':' gray-text').'" id="div_anketa_activate_more">';
+ printf($lang['srv_activation_setting'], $anketa);
+ echo '</div>';
+ echo '</div>';
+ echo '</div>';
+ }
- echo '<div id="div_lock_survey">';
+ /* echo '<div id="div_lock_survey">';
$sas = new SurveyAdminSettings();
$sas->showLockSurvey();
+ echo '</div>'; */
+ }
+
+ if($napake !== '1'){
+ echo '<div class="popup_row top16">';
+ echo '<div><span class="faicon warning yellow"></span></div>';
+ echo '<div>';
+ echo $napake;
+ echo '</div>';
echo '</div>';
}
@@ -3462,9 +3394,7 @@ class SurveyAdminAjax {
echo $lang['srv_activate_duration_manual_to'];
echo '<input id="expireManual" type="text" name="expireManual" value="' . $expire . '" /> <span id="expire_img_manual" class="sprites calendar_ico"></span><br/>';
echo '</label></p>';
- echo '</fieldset>';
- echo '<fieldset><legend>'.$lang['srv_vote_limit'].'</legend>';
echo '<p><label>' . $lang['srv_vote_limit'] . ':</label>';
echo '<input type="radio" name="vote_count_limit" value="0" id="vote_count_limit_0"' . ($row['vote_limit'] == 0 ? ' checked="checked"' : '') . ' onClick="voteCountToggle(0)" /><label for="vote_count_limit_0">' . $lang['no1'] . '</label>';
echo '<input type="radio" name="vote_count_limit" value="1" id="vote_count_limit_1"' . ($row['vote_limit'] == 1 ? ' checked="checked"' : '') . ' onClick="voteCountToggle(1)" /><label for="vote_count_limit_1">' . $lang['yes'] . '</label>';
@@ -3473,7 +3403,6 @@ class SurveyAdminAjax {
echo '<label for="anketa' . $row['id'] . '" >'.$lang['srv_vote_count'].':</label>';
echo '<input type="text" id="vote_count_val" name="vote_count_val" value="' . $row['vote_count'] . '" style="width:50px; margin-left: 5px;" maxlength="7" />';
echo '</p>';
- echo '</fieldset>';
echo '
<script type="text/javascript">
@@ -3496,14 +3425,71 @@ class SurveyAdminAjax {
echo '</div>';
// Timer counter
- echo '<div id="divAvtoClose" active="1" >'.$lang['srv_activate_duration_autostart'].': <span>10</span> s.</div>';
+ //echo '<div class="top16 bottom16" id="divAvtoClose" active="1" >'.$lang['srv_activate_duration_autostart'].': <span>10</span> s.</div>';
// Gumb zapri
- echo '<div class="buttonwrapper buttons_holder"><a class="ovalbutton ovalbutton_orange" href="#" onclick="anketa_activate_save(\''.$this->anketa.'\',\''.$folders.'\'); return false;"><span>' . $lang['srv_zapri'] . '</span></a></div>';
-
+ echo '<div class="button_holder">';
+ echo '<button class="medium white-blue" onClick="$(\'#fullscreen\').fadeOut(\'slow\'); popupClose(); return false;">'.$lang['srv_activation_button_cancel'].'</button>';
+ if($napake == '1')
+ echo '<button class="medium blue" onClick="anketa_activate_save(\''.$this->anketa.'\',\''.$folders.'\'); return false;">'.$lang['srv_activation_button_activate'].'</button>';
+ echo '</div>';
+
echo '</div>';
- } elseif ($_GET['a'] == 'anketa_save_activation') {
+ }
+ elseif ($_GET['a'] == 'anketa_activate') {
+ global $global_user_id;
+
+ $folders = $_POST['folders'];
+
+ # za koliko časa aktiviramo
+ $mth = 3;
+
+ $starts = date("d.m.Y"); // danes
+ $startsDB = date("Y-m-d"); // danes
+ $cd = strtotime($starts);
+ $expire = date('d.m.Y', mktime(0, 0, 0, date('m', $cd) + $mth, date('d', $cd), date('Y', $cd)));
+ $expireDB = date('Y-m-d', mktime(0, 0, 0, date('m', $cd) + $mth, date('d', $cd), date('Y', $cd)));
+
+ # preverimo ali ima uporabnik izklopljeno zaklepanje
+ # polovimo nastavitve uporabnika
+
+ UserSetting::getInstance()->Init($global_user_id);
+ # ali zaklepamo anketo ob aktivaciji
+ $lockSurvey = UserSetting::getInstance()->getUserSetting('lockSurvey');
+
+ # aktiviramo anketo
+ #avtomatsko aktiviramo anketo za 1 mesec in o tem obvestimo uporabnika.
+ $updateString = "UPDATE srv_anketa SET active='1', locked='".(int)$lockSurvey."', backup='0', starts='".$startsDB."', expire='".$expireDB."' WHERE id='$anketa'";
+
+ $sql = sisplet_query($updateString) or die(mysqli_error($GLOBALS['connect_db']));
+
+ // Zapišemo vsako aktivacijo ankete po dnevih
+ $sql_insert = sisplet_query("INSERT INTO srv_activity
+ (sid, starts, expire)
+ VALUES
+ ('".$anketa."', '".$startsDB."', '".$expireDB."')
+ ON DUPLICATE KEY UPDATE
+ expire='".$expireDB."'
+ ");
+
+ # popravimo timestamp za regeneracijo dashboarda
+ Common::getInstance()->Init($anketa);
+ Common::getInstance()->updateEditStamp();
+
+ # vsilimo refresh podatkov
+ SurveyInfo :: getInstance()->resetSurveyData();
+ $row = SurveyInfo::getInstance()->getSurveyRow();
+
+ # posljemo mail ob spremembi aktivnosti ankete
+ SurveyAlert::getInstance()->Init($anketa, $global_user_id);
+ SurveyAlert::getInstance()->sendMailActive();
+
+ # Preverimo, ce gre za phishing
+ $check = new SurveyCheck($anketa);
+ $check->checkPhishing();
+ }
+ elseif ($_GET['a'] == 'anketa_save_activation') {
Common::updateEditStamp();
# po potrebi shranimo dodatne nastavitve
@@ -3522,24 +3508,29 @@ class SurveyAdminAjax {
if ((int)$_POST['voteCountLimitType'] == 1) {
$updateString .= $prefix." vote_limit = '1', vote_count='".(int)$_POST['voteCountValue']."'";
$prefix = ',';
- } elseif ((int)$_POST['voteCountLimitType'] == 2) {
+ }
+ elseif ((int)$_POST['voteCountLimitType'] == 2) {
$updateString .= $prefix." vote_limit = '2', vote_count='".(int)$_POST['voteCountValue']."'";
$prefix = ',';
- } else {
+ }
+ else {
$updateString .= $prefix." vote_limit = '0'";
$prefix = ',';
}
$updateString .= " WHERE id='$anketa'";
$sql = sisplet_query($updateString);
+
#updejtamo srv_alert
- global $global_user_id;
+ // Ostanek, kjer se uporablja baza surveycrontab za posiljanje obvestil o poteku
+ /*global $global_user_id;
SurveyAlert::getInstance()->Init($this->anketa, $global_user_id);
- SurveyAlert::getInstance()->prepareSendExpireAlerts();
+ SurveyAlert::getInstance()->prepareSendExpireAlerts();*/
+
# vsilimo refresh podatkov
- SurveyInfo :: getInstance()->resetSurveyData();
-
- } elseif ($_GET['a'] == 'anketa_getDates') {
+ SurveyInfo :: getInstance()->resetSurveyData();
+ }
+ elseif ($_GET['a'] == 'anketa_getDates') {
// prikažemo vmesnik za izbiro datuma
// preberemo datume aktivnosti
//$sqlDates = sisplet_query("SELECT starts, expire FROM srv_anketa WHERE id='" . $this->anketa . "'");
@@ -4193,13 +4184,17 @@ class SurveyAdminAjax {
// shranimo nastavitve
UserSetting::getInstance()->saveUserSetting();
- $SL = new SurveyList();
+ $SL = (SurveyList::hasFolders()) ? new SurveyListFolders() : new SurveyList();
+
$SL->getSurveys();
}
elseif ($_GET['a'] == 'surveyListFilter') {
- // setiramo nastavitve v UserSetting
- $SL = new SurveyList();
- $SL -> setFilter();
+
+ // setiramo nastavitve v UserSetting
+ $SL = (SurveyList::hasFolders()) ? new SurveyListFolders() : new SurveyList();
+
+ $SL->setFilter();
+
$SL->getSurveys();
}
elseif ($_GET['a'] == 'default_surveyListSettings') {
@@ -4226,8 +4221,10 @@ class SurveyAdminAjax {
if ($_POST['sortby'] != "" )
UserSetting::getInstance()->setUserSetting('survey_list_order_by', $_POST['sortby']. ",".$_POST['sorttype']);
- $SL = new SurveyList();
+ $SL = (SurveyList::hasFolders()) ? new SurveyListFolders() : new SurveyList();
+
$SL->saveCssSettings($_POST['data']);
+
$SL->getSurveys();
}
elseif ($_GET['a'] == 'surveyList_goTo') {
@@ -4236,7 +4233,7 @@ class SurveyAdminAjax {
UserSetting::getInstance()->setUserSetting('survey_list_order_by', $_POST['sortby']. ",".$_POST['sorttype']);
UserSetting::getInstance()->saveUserSetting();
- $SL = new SurveyList();
+ $SL = (SurveyList::hasFolders()) ? new SurveyListFolders() : new SurveyList();
$SL->getSurveys();
}
@@ -4247,37 +4244,37 @@ class SurveyAdminAjax {
UserSetting::getInstance()->setUserSetting('survey_list_folders', $val);
UserSetting::getInstance()->saveUserSetting();
- $SL = new SurveyList();
+ $SL = (SurveyList::hasFolders()) ? new SurveyListFolders() : new SurveyList();
$SL->getSurveys();
}
elseif ($_GET['a'] == 'surveyList_user') {
- $SL = new SurveyList();
+ $SL = (SurveyList::hasFolders()) ? new SurveyListFolders() : new SurveyList();
+
$SL -> setUserId();
$SL->getSurveys();
-
}
elseif ($_GET['a'] == 'surveyList_language') {
- $SL = new SurveyList();
+ $SL = (SurveyList::hasFolders()) ? new SurveyListFolders() : new SurveyList();
+
$SL -> setUserLanguage();
$SL->getSurveys();
-
}
elseif ($_GET['a'] == 'surveyList_gdpr') {
- $SL = new SurveyList();
+ $SL = (SurveyList::hasFolders()) ? new SurveyListFolders() : new SurveyList();
+
$SL -> setUserGDPR();
$SL->getSurveys();
-
}
elseif ($_GET['a'] == 'surveyList_library') {
- $SL = new SurveyList();
+ $SL = (SurveyList::hasFolders()) ? new SurveyListFolders() : new SurveyList();
+
$SL -> setUserLibrary();
$SL->getSurveys();
-
}
elseif ($_GET['a'] == 'survey_chaneg_type') {
global $site_url;
@@ -4403,7 +4400,7 @@ class SurveyAdminAjax {
echo '<div id="preview_spremenljivka">';
- echo '<div class="popup_close"><a href="#" onClick="preview_spremenljivka_cancle(); return false;">✕</a></div>';
+ echo '<div class="popup_close"><a href="#" onClick="preview_spremenljivka_cancel(); return false;">✕</a></div>';
include_once('../../main/survey/app/global_function.php');
new \App\Controllers\SurveyController(true);
@@ -4413,10 +4410,10 @@ class SurveyAdminAjax {
}
echo ' <div id="spremenljivka_preview">';
if ( $_POST['spremenljivka'] == -1 ) {
- \App\Controllers\BodyController::getInstance()->displayIntroduction();
+ \App\Controllers\BodyController::getInstance()->displayIntroductionContent();
}
elseif ( $_POST['spremenljivka'] == -2 ) {
- \App\Controllers\BodyController::getInstance()->displayKonec();
+ \App\Controllers\BodyController::getInstance()->displayKonecContent();
}
elseif ( $_POST['spremenljivka'] == -3 ) {
\App\Controllers\StatisticController::displayStatistika();
@@ -4427,14 +4424,84 @@ class SurveyAdminAjax {
\App\Controllers\Vprasanja\VprasanjaController::getInstance()->displaySpremenljivka($_POST['spremenljivka'], $offset, $zaporedna);
}
echo ' </div>';
-
- echo '<div class="buttons_holder">';
- echo '<span class="floatRight">';
- echo ' <div class="buttonwrapper floatRight"><a class="ovalbutton ovalbutton_orange" href="#" onclick="preview_spremenljivka_cancle(); return false;"><span>' . $lang['srv_zapri'] . '</span></a></div> ';
- echo ' <div class="buttonwrapper spaceRight floatRight"><a class="ovalbutton ovalbutton_gray" href="#" onclick="window.open(\''.$site_url.'admin/survey/ajax.php?t=branching&a=spremenljivka_preview_print&anketa='.$this->anketa.'&spremenljivka='.$_POST['spremenljivka'].'\', \'print\', \'scrollbars=1\'); return false;"><span><img src="img_0/printer.png" /> ' . $lang['hour_print2'] . '</span></a></div> ';
- echo '</span>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium white-blue" onclick="window.open(\''.$site_url.'admin/survey/ajax.php?t=branching&a=spremenljivka_preview_print&anketa='.$this->anketa.'&spremenljivka='.$_POST['spremenljivka'].'\', \'print\', \'scrollbars=1\'); return false;">'.$lang['hour_print2'].'</button>';
+ echo '<button class="medium blue" onClick="preview_spremenljivka_cancel(); return false;">'.$lang['srv_zapri'].'</button>';
echo '</div>';
+
+ echo '</div>';
+ }
+ elseif ($_GET['a'] == 'preview_spremenljivka_lib') {
+ global $site_path;
+
+ SurveyInfo :: getInstance()->SurveyInit($anketa);
+
+ $offset = 0;
+ $zaporedna = 0;
+ $count_type = SurveyInfo :: getInstance()->getSurveyCountType();
+
+ if ($count_type) {
+
+ // Preštejemo koliko vprašanj je bilo do sedaj
+ $sqlg = sisplet_query("SELECT vrstni_red FROM srv_grupa WHERE id = (SELECT gru_id FROM srv_spremenljivka WHERE id = '" . $_POST['spremenljivka'] . "')");
+ $rowg = mysqli_fetch_assoc($sqlg);
+ $vrstni_red = $rowg['vrstni_red'];
+
+ $sqlCountPast = sisplet_query("SELECT count(*) as cnt FROM srv_spremenljivka s, srv_grupa g WHERE g.ank_id='" . $_POST['anketa'] . "' AND s.gru_id=g.id AND g.vrstni_red < '$vrstni_red' ORDER BY g.vrstni_red ASC, s.vrstni_red ASC");
+ $rowCount = mysqli_fetch_assoc($sqlCountPast);
+ $offset = $rowCount['cnt'];
+
+ // poiscemo vprasanja / spremenljivke
+ $sql = sisplet_query("SELECT id FROM srv_spremenljivka WHERE gru_id=(SELECT gru_id FROM srv_spremenljivka WHERE id = '" . $_POST['spremenljivka'] . "') AND visible='1' ORDER BY vrstni_red ASC");
+ while ($row = mysqli_fetch_array($sql)) {
+ if ($row['id'] == $_POST['spremenljivka']) {
+ $zaporedna++;
+ break;
+ }
+ }
+ }
+
+
+ echo '<h2><span class="as_link" onClick="closePreviewVprasanje();"><span class="faicon arrow_back"></span>'.$lang['srv_deleted_vprasanja_back'].'</span></h2>';
+
+ echo '<div class="popup_close"><a href="#" onClick="popupClose(); return false;">✕</a></div>';
+
+ echo '<div id="preview_spremenljivka">';
+
+ $lang_old = $lang;
+
+ include_once('../../main/survey/app/global_function.php');
+ new \App\Controllers\SurveyController(true);
+
+ if (isset($_POST['lang_id'])) {
+ save('lang_id', (int)$_POST['lang_id']);
+ }
+ echo ' <div id="spremenljivka_preview">';
+ if ( $_POST['spremenljivka'] == -1 ) {
+ \App\Controllers\BodyController::getInstance()->displayIntroductionContent();
+ }
+ elseif ( $_POST['spremenljivka'] == -2 ) {
+ \App\Controllers\BodyController::getInstance()->displayKonecContent();
+ }
+ elseif ( $_POST['spremenljivka'] == -3 ) {
+ \App\Controllers\StatisticController::displayStatistika();
+ }
+ else {
+ save('forceShowSpremenljivka', true);
+ save('question_preview', true);
+ \App\Controllers\Vprasanja\VprasanjaController::getInstance()->displaySpremenljivka($_POST['spremenljivka'], $offset, $zaporedna);
+ }
+ echo ' </div>';
+
+ echo '</div>';
+
+ $lang = $lang_old;
+
+
+ echo '<div class="button_holder">';
+ echo ' <button class="medium blue" onClick="closePreviewVprasanje(); return false;">'.$lang['srv_deleted_vprasanja_back'].'</button>';
echo '</div>';
}
else if ($_GET['a'] == 'preview_page') {
@@ -4448,23 +4515,7 @@ class SurveyAdminAjax {
echo ' <div class="clr"></div>';
echo ' </div>';
echo '</div>';
- }
- /*else if ($_GET['a'] == 'rename_variable') {
- if ($_POST['show'] == 'true') {
- echo '<input type="text" name="variable" id="variable_' . $spremenljivka . '" value="' . $_POST['value'] . '" class="variableinput variableinput_noborder" onkeyup="edit_spremenljivka_variable(\'' . $spremenljivka . '\');" ' . ' />';
- echo '<script type="text/javascript">';
- echo '$(document).ready(function() {';
- echo ' $("#variable_' . $spremenljivka . '").keypress(function(e){if(e.which==13) rename_variable(\'' . $spremenljivka . '\', $(this).val()' . ', \'' . $_POST['variable_custom'] . '\', \'false\'); });';
- echo '});';
- echo '</script>';
-
- } else {
- echo $_POST['value'];
- echo '<a href="#" onclick="rename_variable(\'' . $spremenljivka . '\', \'' . $_POST['value'] . '\', \'' . $_POST['variable_custom'] . '\', \'true\'); return false;" title="' . $lang['edit3'] . '"><img id="edit_variable_' . $spremenljivka . '" src="img_' . $this->skin . '/pencil.png" /></a>';
-
- }
- }*/
-
+ }
else if ($_GET['a'] == 'form_settings') {
Common::updateEditStamp();
@@ -4679,8 +4730,6 @@ class SurveyAdminAjax {
UserSetting::getInstance()->setUserSetting('full_screen_edit', $_POST['full_screen_edit']);
}
UserSetting::getInstance()->saveUserSetting();
- } elseif ($_GET['a'] == 'display_success_save') {
- $this->SurveyAdmin->displaySuccessSave();
} elseif ($_GET['a'] == 'vnosi_show_status_casi') {
SurveyStatusCasi :: Init($anketa);
if (isset($pid) && $pid > 0) {
@@ -4807,7 +4856,19 @@ class SurveyAdminAjax {
Timer::GetTimer($lang['srv_collectData']);
- } elseif ($_GET['a'] == 'dataDeleteRow') {
+ }
+ // Pobrisemo neustrezne odgovore
+ elseif ($_GET['a'] == 'dataCountNeustrezne') {
+ $sql = sisplet_query("SELECT count(id) FROM srv_user WHERE ank_id='".$this->anketa."' AND (last_status='-1' OR last_status='3' OR last_status='4' OR (last_status='5' AND lurker='1') OR (last_status='6' AND lurker='1')) AND deleted='0' AND preview='0'");
+ $row = mysqli_fetch_array($sql);
+
+ echo $row['count(id)'];
+ }
+ // Pobrisemo neustrezne odgovore
+ elseif ($_GET['a'] == 'dataDeleteNeustrezne') {
+ sisplet_query("DELETE FROM srv_user WHERE ank_id='".$this->anketa."' AND (last_status='-1' OR last_status='3' OR last_status='4' OR (last_status='5' AND lurker='1') OR (last_status='6' AND lurker='1')) AND deleted='0' AND preview='0'");
+ }
+ elseif ($_GET['a'] == 'dataDeleteRow') {
if ((int)$usr_id > 0) {
@@ -4818,13 +4879,18 @@ class SurveyAdminAjax {
sisplet_query("UPDATE srv_user SET deleted = '1', time_edit = NOW() WHERE id = '$usr_id'");
sisplet_query('COMMIT');
+ // Pobrišemo vse datoteke
+ $SDF = SurveyDataFile::get_instance();
+ $SDF->init($this->anketa);
+ $SDF->clearFiles();
+
echo '0';
}
else {
echo 'Error: Invalid user ID!';
}
- } elseif ($_GET['a'] == 'dataDeleteMultipleRow') { // V DELU...
+ } elseif ($_GET['a'] == 'dataDeleteMultipleRow') {
// ulovimo json objekt z userji za brisanje
if ( is_array($_POST['users']) && count($_POST['users']) > 0 ) {
@@ -4837,6 +4903,11 @@ class SurveyAdminAjax {
sisplet_query("UPDATE srv_user SET deleted = '1', time_edit = NOW() WHERE id IN (".$users.")");
sisplet_query('COMMIT');
+
+ // Pobrišemo vse datoteke
+ $SDF = SurveyDataFile::get_instance();
+ $SDF->init($this->anketa);
+ $SDF->clearFiles();
}
} elseif ($_GET['a'] == 'dataCopyRow') {
@@ -4931,6 +5002,9 @@ class SurveyAdminAjax {
} elseif ($_GET['a'] == 'nice_url') {
$this->ajax_nice_url();
+ } elseif ($_GET['a'] == 'nice_url_check') {
+ $this->ajax_nice_url_check();
+
} elseif ($_GET['a'] == 'nice_url_remove') {
$this->ajax_nice_url_remove();
@@ -4970,10 +5044,70 @@ class SurveyAdminAjax {
$row = mysqli_fetch_array($sql);
$f = new Forum();
- $vsebina = $row['vsebina'].'<blockquote style="margin-left:20px"><b>'.$f->user($global_user_id).'</b> ('.$f->datetime1(date('Y-m-d h:i:s')).'):<br />'.$vsebina.'</blockquote>';
+ $vsebina = $row['vsebina'].'<blockquote><span class="semi-bold">'.$f->user($global_user_id).'</span> <span class="gray">('.$f->datetime1(date('Y-m-d h:i:s')).')</span><div class="answer">'.$vsebina.'</div></blockquote>';
sisplet_query("UPDATE post SET vsebina='$vsebina' WHERE id='$id'");
+ }
+ elseif ($_GET['a'] == 'comment_on_comment_resp') {
+ $id = $_POST['id'];
+ $vsebina = $_POST['vsebina'];
+
+ if ($vsebina == '') return;
+
+ $sql = sisplet_query("SELECT text FROM srv_data_text".$this->db_table." WHERE id='$id'");
+ $row = mysqli_fetch_array($sql);
+
+ $f = new Forum();
+ $vsebina = $row['text'].'<blockquote><span class="semi-bold">'.$f->user($global_user_id).'</span> <span class="gray">('.$f->datetime1(date('Y-m-d h:i:s')).')</span><div class="answer">'.$vsebina.'</div></blockquote>';
+
+ sisplet_query("UPDATE srv_data_text".$this->db_table." SET text='$vsebina' WHERE id='$id'");
+
+ }
+ elseif ($_GET['a'] == 'comment_on_comment_splosni_resp') {
+ $id = $_POST['id'];
+ $vsebina = $_POST['vsebina'];
+
+ if ($vsebina == '') return;
+
+ $sql = sisplet_query("SELECT comment FROM srv_comment_resp WHERE id='$id'");
+ $row = mysqli_fetch_array($sql);
+
+ $f = new Forum();
+ $vsebina = $row['comment'].'<blockquote><span class="semi-bold">'.$f->user($global_user_id).'</span> <span class="gray">('.$f->datetime1(date('Y-m-d h:i:s')).')</span><div class="answer">'.$vsebina.'</div></blockquote>';
+
+ sisplet_query("UPDATE srv_comment_resp SET comment='$vsebina' WHERE id='$id'");
+
+ }
+ elseif ($_GET['a'] == 'comment_delete') {
+ $id = $_POST['id'];
+
+ if (isset($_POST['id']) && $_POST['id'] != "" && $_POST['id'] > 0) {
+ $id = $_POST['id'];
+ $sql = sisplet_query("DELETE FROM post WHERE id='$id'");
+ }
+ } elseif ($_GET['a'] == 'respondent_comment_delete') {
+ $id = $_POST['id'];
+
+ if (isset($_POST['id']) && $_POST['id'] != "" && $_POST['id'] > 0) {
+ $id = $_POST['id'];
+ $sql = sisplet_query("DELETE FROM srv_data_text_active WHERE id='$id'");
+ }
+ } elseif ($_GET['a'] == 'survey_respondent_comment_delete') {
+ $id = $_POST['id'];
+
+ if (isset($_POST['id']) && $_POST['id'] != "" && $_POST['id'] > 0) {
+ $id = $_POST['id'];
+ $sql = sisplet_query("DELETE FROM srv_comment_resp WHERE id='$id'");
+ }
+ } elseif ($_GET['a'] == 'survey_comment_delete') {
+ $id = $_POST['id'];
+
+ if (isset($_POST['id']) && $_POST['id'] != "" && $_POST['id'] > 0) {
+ $id = $_POST['id'];
+ $sql = sisplet_query("DELETE FROM post WHERE id='$id'");
+ }
+
} elseif ($_GET['a'] == 'archivePopup') {
echo '<div class="survey_archive_popup">';
$sas = new SurveyAdminSettings();
@@ -5122,9 +5256,9 @@ class SurveyAdminAjax {
} elseif ($_GET['a'] == 'new_anketa') {
global $global_user_id, $site_url;
- $naslov = trim($_POST['naslov']);
+ $naslov = strip_tags(trim($_POST['naslov']));
- echo '<div id="new_anketa_div">';
+ echo '<div id="new_anketa_div" class="fullwidth menu_left">';
$newSurvey = new NewSurvey();
$newSurvey->displayNewSurveyPage();
echo '</div>';
@@ -5184,17 +5318,12 @@ class SurveyAdminAjax {
} elseif ($_GET['a'] == 'exportChangeCheckbox') {
- if(isset($_POST['name']) && $_POST['name'] != '') {
-
- session_start();
-
- // Resetiramo vse nastavitve
- $_SESSION['exportHiddenSystem'] = false;
- $_SESSION['exportFullMeta'] = false;
- $_SESSION['exportOnlyData'] = false;
-
- // Nastavimo ustrezno nastavitev
- $_SESSION[$_POST['name']] = true;
+ if(isset($_POST['value']) && is_numeric($_POST['value'])) {
+ //nastavi nastavitve za export ankete
+ //kateri podatki so v export se sedaj veze na naketo (0-onlydata, 1-data in paradata, 2-identifikatorji)
+ sisplet_query("INSERT INTO srv_user_setting_for_survey (sid, what, uid, value)
+ VALUES ('" . $this->anketa . "', 'default_export_data_mode', '$global_user_id', '".$_POST['value']."')
+ ON DUPLICATE KEY UPDATE value = '".$_POST['value']."';");
}
} elseif ($_GET['a'] == 'exportChangeRadio') {
if(isset($_POST['name']) && $_POST['name'] != '') {
@@ -5234,7 +5363,7 @@ class SurveyAdminAjax {
}
# dodamo zapis v srv_activity
- $activity_insert_string = "INSERT IGNORE INTO srv_activity (sid, starts, expire, uid) VALUES('".$anketa."', '".$rowDates['starts']."', '".$rowDates['expire']."', '".$global_user_id."')";
+ $activity_insert_string = "INSERT INTO srv_activity (sid, starts, expire) VALUES('".$anketa."', '".$rowDates['starts']."', '".$rowDates['expire']."') ON DUPLICATE KEY UPDATE expire='".$rowDates['expire']."'";
$msg.=$activity_insert_string;
$sql_insert = sisplet_query($activity_insert_string);
if (!$sql_insert) {
@@ -5290,113 +5419,8 @@ class SurveyAdminAjax {
} elseif ($_GET['a'] == 'comments_onoff') {
$this->ajax_comments_onoff();
- } elseif ($_GET['a'] == 'runLanguageTechnology') {
- header('Content-Type: application/json; charset=UTF-8');
- $parsedData= array();
- try {
- $settings = array();
- foreach(array('lt_language', 'lt_min_FWD', 'lt_min_nNoM', 'lt_min_vNoM', 'lt_special_setting') AS $_key) {
- if (isset ($_POST['settings'][$_key]))
- $settings[$_key] = $_POST['settings'][$_key];
- }
-
- $slt = new SurveyLanguageTechnology($this->anketa);
- $settings = $slt->setup($settings);
- $parsedData = $slt->parseSpremenljivka($spremenljivka);
- $settings['lt_spremenljivka'] = $spremenljivka;
-
- $parsedData['setting'] = $settings;
- $parsedData['error'] = array('hasError'=> false, 'msg' => '');
-
- } catch (Exception $e) {
- $parsedData['error'] = array('hasError'=> true, 'msg' => 'Prišlo je do napake');
- }
- if (isset($parsedData['language'])) {
- //unset($parsedData['language']);
- }
- echo json_encode($parsedData);
- exit();
- } elseif ($_GET['a'] == 'runLanguageTechnologyWord') {
- header('Content-Type: application/json; charset=UTF-8');
- $parsedData= array();
- try {
- $settings = array();
- if (isset ($_POST['lt_language']))
- $settings['lt_language'] = $_POST['lt_language'];
- if (isset ($_POST['lt_min_FWD']))
- $settings['lt_min_FWD'] = $_POST['lt_min_FWD'];
- if (isset ($_POST['lt_min_nNoM']))
- $settings['lt_min_nNoM'] = $_POST['lt_min_nNoM'];
- if (isset ($_POST['lt_min_vNoM']))
- $settings['lt_min_vNoM'] = $_POST['lt_min_vNoM'];
-
- $word = $_REQUEST['lt_word'];
- $wordType = $_REQUEST['lt_tag'];
- $slt = new SurveyLanguageTechnology($this->anketa);
- $settings = $slt->setup($settings);
- $parsedData = $slt->parseWord($word, $wordType);
- $settings['lt_spremenljivka'] = $spremenljivka;
-
- $parsedData['setting'] = $settings;
- $parsedData['error'] = array('hasError'=> false, 'msg' => '');
-
- } catch (Exception $e) {
- $parsedData['error'] = array('hasError'=> true, 'msg' => 'Prišlo je do napake');
-
- }
- if (isset($parsedData['language'])) {
- //unset($parsedData['language']);
- }
- echo json_encode($parsedData);
- exit();
- } elseif ($_GET['a'] == 'runLanguageTechnologyHypoHypernym') {
- header('Content-Type: application/json; charset=UTF-8');
- $parsedData= array();
- try {
- $synsets = $_REQUEST['synsets'];
-
- $slt = new SurveyLanguageTechnology($this->anketa);
- $settings = array();
-
- if (isset ($_POST['settings']['lt_language']))
- $settings['lt_language'] = $_POST['settings']['lt_language'];
- $settings = $slt->setup($settings);
-
- $parsedData = $slt->getHypoHypernym($synsets);
-
- $parsedData['setting']['lt_spremenljivka'] = $spremenljivka;
- $parsedData['setting']['synsets'] = $synsets;
-
- $parsedData['error'] = array('hasError'=> false, 'msg' => '');
-
- } catch (Exception $e) {
- $parsedData['error'] = array('hasError'=> true, 'msg' => 'Prišlo je do napake');
-
- }
- if (isset($parsedData['language'])) {
- //unset($parsedData['language']);
- }
- echo json_encode($parsedData);
- exit();
- } elseif ($_GET['a'] == 'exportLanguageTechnology') {
- header('Content-Type: application/json; charset=UTF-8');
-
- $result = array();
- try {
- $slt = new SurveyLanguageTechnology($this->anketa);
- $url = $slt->exportLanguageTechnology($_REQUEST['lt_data'], $_REQUEST['language']);
- $result['error'] = false;
- $result['filename'] = $url;
- $result['url'] = makeEncodedIzvozUrlString('izvoz.php?a=lt_excel&file=' . $url);;
- } catch (Exception $e) {
- $result['error'] = true;
- $result['filename'] = '';
- $result['url'] = '';
- $result['msg'] = $e->getMessage();
- }
- echo json_encode($result);
- exit();
- } else { // genericna resitev za vse nadaljne
+ }
+ else { // genericna resitev za vse nadaljne
$ajax = 'ajax_' . $_GET['a'];
@@ -5433,7 +5457,7 @@ class SurveyAdminAjax {
$return['output'] .= '<p>'.$lang['spremenljivka_delete_in_if'].'</p>';
- $return['output'] .= '<span class="buttonwrapper floatRight"><a class="ovalbutton ovalbutton_gray" href="#" onclick="$(\'#dropped_alert\').hide(); $(\'#fade\').fadeOut(); return false;"><span>'.$lang['srv_analiza_arhiviraj_cancle'].'</span></a></span>';
+ $return['output'] .= '<div class="button_holder"><button class="medium blue" onclick="$(\'#dropped_alert\').hide(); $(\'#fade\').fadeOut(); return false;">'.$lang['srv_analiza_arhiviraj_cancle'].'</button></div>';
echo json_encode($return);
@@ -5454,11 +5478,10 @@ class SurveyAdminAjax {
$return['output'] .= '<h2>'.$lang['srv_warning'].'</h2>';
$return['output'] .= '<p>'.$lang['spremenljivka_delete_data'].'</p>';
- $return['output'] .= '<p>'.$lang['srv_brisispremenljivkoconfirm_data'].'</p><br />';
+ $return['output'] .= '<p class="top16">'.$lang['srv_brisispremenljivkoconfirm_data'].'</p>';
- $return['output'] .= '<span class="buttonwrapper floatRight"><a class="ovalbutton ovalbutton_orange" href="#" onclick="brisi_spremenljivko(\''.$spremenljivka.'\', \'\', \'1\'); return false;"><span>'.$lang['srv_brisispremenljivko'].'</span></a></span>';
- $return['output'] .= '<span class="buttonwrapper floatRight spaceRight"><a class="ovalbutton ovalbutton_gray" href="#" onclick="$(\'#dropped_alert\').hide(); $(\'#fade\').fadeOut(); return false;"><span>'.$lang['srv_analiza_arhiviraj_cancle'].'</span></a></span>';
- //$return['output'] .= '<p><a href="#" onclick="brisi_spremenljivko(\''.$spremenljivka.'\', \'\', \'1\'); return false;">'.$lang['srv_brisispremenljivko'].'</a> <a href="#" onclick="$(\'#dropped_alert\').hide(); $(\'#fade\').fadeOut(); return false;">'.$lang['srv_analiza_arhiviraj_cancle'].'</a></p>';
+ $return['output'] .= '<div class="button_holder"><button class="medium white-blue" onclick="$(\'#dropped_alert\').hide(); $(\'#fade\').fadeOut(); return false;">'.$lang['srv_analiza_arhiviraj_cancle'].'</button>';
+ $return['output'] .= '<button class="medium blue" onclick="brisi_spremenljivko(\''.$spremenljivka.'\', \'\', \'1\'); return false;">'.$lang['srv_brisispremenljivko'].'</button></div>';
echo json_encode($return);
@@ -5480,13 +5503,13 @@ class SurveyAdminAjax {
// ce je za spremenljivko PB, ga prestavimo na prejsnjo spremenljivko
$rowg = Cache::srv_branching($spremenljivka, 0);
- if ($rowg['pagebreak'] == 1) {
+ if (isset($rowg['pagebreak']) && $rowg['pagebreak'] == 1) {
$s = sisplet_query("UPDATE srv_branching SET pagebreak='1' WHERE element_spr='{$b->find_prev_spr($spremenljivka)}' AND ank_id='$this->anketa'");
if (!$s) echo mysqli_error($GLOBALS['connect_db']);
}
$this->SurveyAdmin->brisi_spremenljivko($spremenljivka);
- if ($_COOKIE['srv_clipboard_' . $this->anketa] == $spremenljivka)
+ if (isset($_COOKIE['srv_clipboard_' . $this->anketa]) && $_COOKIE['srv_clipboard_' . $this->anketa] == $spremenljivka)
$this->SurveyAdmin->clipboard_display(-1);
$this->SurveyAdmin->prestevilci(0);
@@ -5496,13 +5519,50 @@ class SurveyAdminAjax {
$b->branching_struktura();
$return['error'] = 0;
- $return['output'] = ob_get_clean().$echo;
+ $return['output'] = ob_get_clean();
echo json_encode($return);
}
+
+ function ajax_nice_url_check () {
+ global $site_path, $lang;
+
+ $nice_url = $_POST['nice_url'];
+ //$nice_url = preg_replace("#[^A-Za-z0-9-]#", "", $nice_url);
+
+ if (preg_match("/[^A-Za-z0-9\-]/", $nice_url)) {
+ echo '<br><p class="red"><span class="faicon warning red"></span>&nbsp;&nbsp;'.$lang['srv_nice_url_invalid'].'</p>';return;
+ }
+
+
+ $f = @fopen($site_path.'.htaccess', 'rb');
+ if ($f !== false) {
+ while (!feof($f)) {
+ $r = fgets($f);
+ if (strpos($r, "^".$nice_url.'\b') !== false) { // preverimo, da ni tak redirect ze dodan
+ echo '<br><p class="red"><span class="faicon warning red"></span>&nbsp;&nbsp;'.$lang['srv_nice_url_taken'].'</p>';return;
+ }
+ }
+ fclose($f);
+ }
+
+ // Ne pustimo manj kot 3 znake
+ if (strlen($nice_url) < 3) echo '<br><p class="red"><span class="faicon warning red"></span>&nbsp;&nbsp;'.$lang['srv_nice_url_short'].'</p>';return;
+
+ // Ne pustimo vec kot 20 znakov
+ if (strlen($nice_url) > 20) echo '<br><p class="red"><span class="faicon warning red"></span>&nbsp;&nbsp;'.$lang['srv_nice_url_long'].'</p>';return;
+
+ sisplet_query("BEGIN"); // damo v transakcijo, da se ne more kdo med tedva querija ustulit
+
+ $sql = sisplet_query("SELECT id FROM srv_nice_links WHERE link = '$nice_url'");
+ if (mysqli_num_rows($sql) > 0) echo '<br><p class="red"><span class="faicon warning red"></span>&nbsp;&nbsp;'.$lang['srv_nice_url_taken'].'</p>';return;
+
+ echo "";return;
+ }
function ajax_nice_url () {
global $site_path;
+ global $lang;
Common::updateEditStamp();
@@ -5537,9 +5597,9 @@ class SurveyAdminAjax {
if (mysqli_num_rows($sql) > 0) $add = false;
if (SurveyInfo::getInstance()->checkSurveyModule('uporabnost'))
- $link = 'main/survey/uporabnost.php?anketa=' . $anketa ;
+ $link = 'main/survey/uporabnost.php?anketa=' . SurveyInfo::getInstance()->getSurveyHash() ;
else
- $link = 'main/survey/index.php?anketa=' . $anketa ;
+ $link = 'main/survey/index.php?anketa=' . SurveyInfo::getInstance()->getSurveyHash();
// Dodamo nice url
@@ -5548,7 +5608,7 @@ class SurveyAdminAjax {
// Dodamo nice url za anketo
$f = @fopen($site_path.'.htaccess', 'a');
if ($f !== false) {
- fwrite($f, "\nRewriteRule ^".$nice_url.'\b(.*) '.$link."&foo=\$1&%{QUERY_STRING}");
+ fwrite($f, "\nRewriteRule ^".$nice_url.'\b(?!-)(.*) '.$link."&foo=\$1&%{QUERY_STRING}");
// Dodamo nice url v bazo
$s = sisplet_query("INSERT INTO srv_nice_links (id,ank_id,link) VALUES ('','$this->anketa','$nice_url')");
@@ -5570,10 +5630,11 @@ class SurveyAdminAjax {
while($rowS = mysqli_fetch_array($sqlS)){
$nice_url_skupina = $nice_url.'_'.$rowS['vrstni_red'];
- $link_skupina = $link.'&skupina='.$rowS['id'];
+ $skupina_string = strtolower($lang['srv_skupina']);
+ $link_skupina = $link.'&'.$skupina_string.'='.$rowS['id'];
// Skupini dodamo nice url zapis v htaccess
- fwrite($f, "\nRewriteRule ^".$nice_url_skupina.'\b(.*) '.$link_skupina."&foo=\$1&%{QUERY_STRING}");
+ fwrite($f, "\nRewriteRule ^".$nice_url_skupina.'\b(?!-)(.*) '.$link_skupina."&foo=\$1&%{QUERY_STRING}");
// Skupini zapisemo nice url se v bazo
$sqlSI = sisplet_query("INSERT INTO srv_nice_links_skupine
@@ -5596,25 +5657,33 @@ class SurveyAdminAjax {
function ajax_nice_url_remove () {
global $site_path;
+ global $lang;
Common::updateEditStamp();
$anketa = $_GET['anketa'];
+
+ SurveyInfo::getInstance()->SurveyInit($this->anketa);
+ $anketa_hash = SurveyInfo::getInstance()->getSurveyHash();
+
$nice_url_id = $_GET['nice_url'];
-
- $sql = sisplet_query("SELECT id, link FROM srv_nice_links WHERE id = '$nice_url_id'");
+
+ $sql = sisplet_query("SELECT id, link FROM srv_nice_links WHERE id = '$nice_url_id'");
$row = mysqli_fetch_array($sql);
$nice_url = $row['link'];
+ // Preberemo celoten .htaccess in ga zakesiramo
$f = fopen($site_path.'.htaccess', 'rb');
if ($f !== false) {
$output = array();
while (!feof($f)) {
$r = fgets($f);
- if (strpos($r, "^".$nice_url.'\b(.*) ') !== false && strpos($r, "?anketa=".$anketa."") !== false) {
- // kao pobrisemo vrstico
- } else {
+
+ // Vrstice, ki jih pobrisemo - ne zakesiramo
+ if (strpos($r, "^".$nice_url.'\b') !== false && strpos($r, "?anketa=".$anketa_hash."") !== false) {
+ }
+ else {
$output[] = $r;
}
}
@@ -5625,17 +5694,23 @@ class SurveyAdminAjax {
$f = fopen($site_path.'.htaccess', 'w');
if ($f !== false) {
+
+ // Na novo zapisemo htaccess
foreach ($output AS $line) {
fwrite($f, $line);
}
fclose($f);
+ // Pobrisemo lep url se iz baze
$sql = sisplet_query("DELETE FROM srv_nice_links WHERE id = '$nice_url_id'");
- // Preverimo ce imamo skupine s tem urljem in jih pobrisemo
+
+ // Preverimo ce imamo SKUPINE s tem urljem in jih pobrisemo
$sqlS = sisplet_query("SELECT * FROM srv_nice_links_skupine WHERE ank_id='$anketa' AND nice_link_id='$nice_url_id'");
if(mysqli_num_rows($sqlS) > 0){
+ $skupina_string = strtolower($lang['srv_skupina']);
+
$f = fopen($site_path.'.htaccess', 'rb');
if ($f !== false) {
$outputS = array();
@@ -5648,7 +5723,7 @@ class SurveyAdminAjax {
$sqlS = sisplet_query("SELECT * FROM srv_nice_links_skupine WHERE ank_id='$anketa' AND nice_link_id='$nice_url_id'");
while($rowS = mysqli_fetch_array($sqlS)){
- if (strpos($r, "^".$rowS['link'].'\b(.*) ') !== false && strpos($r, "?anketa=".$anketa."&skupina=".$rowS['vre_id']."") !== false) {
+ if (strpos($r, "^".$rowS['link'].'\b') !== false && strpos($r, "?anketa=".$anketa_hash."&".$skupina_string."=".$rowS['vre_id']."") !== false) {
// pobrisemo vrstico in vnos v bazi
$sqlD = sisplet_query("DELETE FROM srv_nice_links_skupine WHERE ank_id='$anketa' AND nice_link_id='$row[id]' AND vre_id='$rowS[vre_id]'");
$delete = true;
@@ -5675,14 +5750,12 @@ class SurveyAdminAjax {
}
}
-
header('Location: index.php?anketa='.$anketa.'&a=vabila&m=settings');
}
function ajax_alert_custom() {
global $lang;
global $global_user_id;
- global $app_settings;
$anketa = $this->anketa;
$type = $_POST['type'];
@@ -5717,22 +5790,31 @@ class SurveyAdminAjax {
$text = $row['text'];
}
+ echo '<h2><span class="faicon blue text_file empty"></span>'.$lang['srv_alert_custom'].'</h2>';
+ echo '<div class="popup_close"><a href="#" onClick="remove_editor(\'text\'); $(\'#fade\').fadeOut(\'slow\'); $(\'#vrednost_edit\').hide().html(\'\'); return false;">✕</a></div>';
+
echo '<form action="ajax.php?a=alert_custom_save" name="alert_custom" method="post">';
echo '<input type="hidden" name="anketa" value="'.$this->anketa.'">';
echo '<input type="hidden" name="type" value="'.$type.'">';
echo '<input type="hidden" name="uid" value="'.$uid.'">';
-
- echo '<p><label for="subject">' . $lang['subject'] . ': </label><input type="text" id="subject" name="subject" value="' . $subject . '" size="90"/></p>';
+ echo '<div class="setting_holder">';
+ echo '<label for="subject">' . $lang['subject'] . ': </label>';
+ echo '<input type="text" class="large wauto" id="subject" name="subject" value="' . $subject . '"/>';
+ echo '</div>';
// prikaze editor za ne-spremenljivko (za karkoli druzga pac)
- echo ' <p><label for="text">' . $lang['text'] . ':</label>';
- echo ' <textarea name="text" id="text" rows="3" >' . $text . '</textarea>';
- echo ' </p>';
+ echo '<div class="setting_holder">';
+
+ echo '<label class="bottom4" for="text">' . $lang['message'] . ':</label>';
+ echo '<textarea name="text" id="text">' . $text . '</textarea>';
+
+ echo '</div>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium white-blue" onclick="remove_editor(\'text\'); $(\'#fade\').fadeOut(\'slow\'); $(\'#vrednost_edit\').hide().html(\'\'); return false;">'.$lang['edit1338'].'</button>';
+ echo '<button class="medium blue" onclick="$(\'form[name=alert_custom]\').submit(); return false;">'.$lang['edit1337'].'</button>';
echo '</div>';
-
- echo '<div class="buttonwrapper floatRight spaceRight"><a class="ovalbutton ovalbutton_orange" onclick="$(\'form[name=alert_custom]\').submit(); return false;" href="#"><span>'.$lang['save'].'</span></a></div>';
- echo '<div class="buttonwrapper floatRight spaceRight"><a class="ovalbutton ovalbutton_gray" onclick="remove_editor(\'text\'); $(\'#fade\').fadeOut(\'slow\'); $(\'#vrednost_edit\').hide().html(\'\'); return false;" href="#"><span>'.$lang['srv_analiza_arhiviraj_cancle'].'</span></a></div>';
echo '</form>';
@@ -5838,10 +5920,13 @@ class SurveyAdminAjax {
}
function ajax_get_variable_labels () {
+ $spr = isset($_POST['spr']) ? array_unique( $_POST['spr'] ) : array();
+ echo json_encode(self::get_variable_labels($spr));
+ }
+
+ private function get_variable_labels($spr = array()){
global $lang;
-
- $spr = array_unique( $_POST['spr'] );
-
+
$response = array();
foreach ($spr AS $spr_id) {
@@ -5849,55 +5934,98 @@ class SurveyAdminAjax {
$s = sisplet_query("SELECT tip FROM srv_spremenljivka WHERE id = '$spr_id'");
$r = mysqli_fetch_array($s);
- if ( in_array($r['tip'], array(1, 3)) ) {
-
- $output = array();
+ //radio and select, ranking
+ if ( in_array($r['tip'], array(1, 3/* , 17 */)) ) {
+ $output = $this->add_missing_values(array());
$output['spr'] = $spr_id;
$output['tip'] = $r['tip'];
- $output['values'] = array();
-
- $sql = sisplet_query("SELECT naslov, variable FROM srv_vrednost WHERE spr_id='$spr_id' ORDER BY vrstni_red ASC");
- while ($row = mysqli_fetch_array($sql)) {
- $output['values'][$row['variable']] = strip_tags( $row['naslov'] );
+ $sql = sisplet_query("SELECT naslov, variable, vrstni_red FROM srv_vrednost WHERE spr_id='$spr_id' ORDER BY vrstni_red ASC");
+ while ($row = mysqli_fetch_array($sql)) {
+ /* if ( $r['tip'] == 17 )
+ $output['values'][$row['vrstni_red']] = strip_tags( $row['naslov'] );
+ else */
+ $output['values'][$row['variable']] = strip_tags( $row['naslov'] );
}
- $output['values']['-1'] = $lang['srv_bottom_data_legend_note_li1a'];
- $output['values']['-2'] = $lang['srv_bottom_data_legend_note_li2a'];
- $output['values']['-3'] = $lang['srv_bottom_data_legend_note_li3a'];
- $output['values']['-4'] = $lang['srv_bottom_data_legend_note_li4a'];
- $output['values']['-5'] = $lang['srv_bottom_data_legend_note_li5a'];
-
$response[] = $output;
-
- } elseif ( in_array($r['tip'], array(6, 16)) ) {
-
- $output = array();
+ }
+ //radio grid
+ elseif ( in_array($r['tip'], array(6)) ) {
+ $output = $this->add_missing_values(array());
$output['spr'] = $spr_id;
$output['tip'] = $r['tip'];
- $output['values'] = array();
-
- $sql = sisplet_query("SELECT naslov, variable FROM srv_grid WHERE spr_id='$spr_id' ORDER BY vrstni_red ASC");
+ $sql = sisplet_query("SELECT naslov, variable, other FROM srv_grid WHERE spr_id='$spr_id' ORDER BY vrstni_red ASC");
while ($row = mysqli_fetch_array($sql)) {
- $output['values'][$row['variable']] = strip_tags( $row['naslov'] );
+ if($row['other'] === 1 || $row['other'] === 0)
+ $output['values'][$row['variable']] = strip_tags( $row['naslov'] );
+ else
+ $output['values'][$row['other']] = strip_tags( $row['naslov'] );
}
- $output['values']['-1'] = $lang['srv_bottom_data_legend_note_li1a'];
- $output['values']['-2'] = $lang['srv_bottom_data_legend_note_li2a'];
- $output['values']['-3'] = $lang['srv_bottom_data_legend_note_li3a'];
- $output['values']['-4'] = $lang['srv_bottom_data_legend_note_li4a'];
- $output['values']['-5'] = $lang['srv_bottom_data_legend_note_li5a'];
-
$response[] = $output;
+ }
+ //check and checkk grid
+ elseif ( in_array($r['tip'], array(2, 16)) ) {
+ $output = $this->add_missing_values(array());
+
+ $output['spr'] = $spr_id;
+ $output['tip'] = $r['tip'];
+
+ $output['values']['0'] = $lang['srv_checked_value_0'];
+ $output['values']['1'] = $lang['srv_checked_value_1'];
+
+ //misingi za labele
+ if($r['tip'] == 2){
+ $sql = sisplet_query("SELECT naslov, variable, vrstni_red, other FROM srv_vrednost WHERE spr_id='$spr_id' ORDER BY vrstni_red ASC");
+ while ($row = mysqli_fetch_array($sql)) {
+ if($row['other'] != 1 && $row['other'] != 0)
+ $output['values'][$row['variable']] = strip_tags( $row['naslov'] );
+ }
+ }
+ if($r['tip'] == 16){
+ $sql = sisplet_query("SELECT naslov, variable, other FROM srv_grid WHERE spr_id='$spr_id' ORDER BY vrstni_red ASC");
+ while ($row = mysqli_fetch_array($sql)) {
+ if($row['other'] != 1 && $row['other'] != 0){
+ $output['values'][$row['other']] = strip_tags( $row['naslov'] );
+ }
+ }
+ }
+
+ $response[] = $output;
}
+ /* else{
+ $output = array();
+
+ $output['spr'] = $spr_id;
+ $output['tip'] = $r['tip'];
+
+ $output['values'] = array();
+
+ $response[] = $this->add_missing_values($output);
+ } */
}
-
- echo json_encode($response);
-
+
+ return $response;
+ }
+
+ private function add_missing_values($output){
+ global $lang;
+
+ $output['values']['-1'] = $lang['srv_bottom_data_legend_note_li1a'];
+ $output['values']['-2'] = $lang['srv_bottom_data_legend_note_li2a'];
+ $output['values']['-3'] = $lang['srv_bottom_data_legend_note_li3a'];
+ $output['values']['-4'] = $lang['srv_bottom_data_legend_note_li4a'];
+ $output['values']['-5'] = $lang['srv_bottom_data_legend_note_li5a'];
+ $output['values']['-97'] = $lang['srv_other_97'];
+ $output['values']['-98'] = $lang['srv_other_98'];
+ $output['values']['-99'] = $lang['srv_other_99'];
+
+ return $output;
}
function ajax_remove_logo () {
@@ -5942,7 +6070,7 @@ class SurveyAdminAjax {
SurveyInfo::getInstance()->resetSurveyData();
- $this->SurveyAdmin->request_help_content();
+ $this->SurveyAdmin->tooltip_request_help();
}
@@ -5973,71 +6101,107 @@ class SurveyAdminAjax {
echo '<form name="testiranje_preview_settings" action="#" method="get">';
echo '<input type="hidden" name="anketa" value="'.$this->anketa.'">';
-
- // Nastavitve komentarjev - preverimo ce so na voljo v paketu
+
+ echo '<div id="testiranje_preview_settings">';
+ echo '<div class="testiranje_preview_settings_left">';
+
+ echo '<div class="setting_holder">';
+ echo '<span class="setting_title semi-bold">'.$lang['srv_preview_defaults'].':</span>';
+
+ echo '<div class="setting_item">';
+ echo ' <input type="checkbox" value="1" '.($preview_disableif==1?' checked':'').' name="disableif" id="disableif"/>';
+ echo ' <label for="disableif">'.$lang['srv_disableif'].'</label>';
+ echo '</div>';
+
+ echo '<div class="setting_item">';
+ echo ' <input type="checkbox" value="1" '.($preview_displayifs==1?' checked':'').' name="displayifs" id="displayifs"/>';
+ echo ' <label for="displayifs">'.$lang['srv_displayifs'].'</label>';
+ echo '</div>';
+
+ echo '<div class="setting_item">';
+ echo ' <input type="checkbox" value="1" '.($preview_displayvariables==1?' checked':'').' name="displayvariables" id="displayvariables"/>';
+ echo ' <label for="displayvariables">'.$lang['srv_displayvariables'].'</label>';
+ echo '</div>';
+
+ // Nastavitve komentarjev - preverimo ce so na voljo v paketu
if($userAccess->checkUserAccess($what='question_type_location')){
- echo '<div style="float: right; width: 260px">';
-
- echo '<p style="margin-top:0">'.$lang['srv_testiranje_komentarji'].': ';
- echo '<input type="radio" name="question_resp_comment" value="0" id="question_resp_comment_0" ' . ($question_resp_comment == 0 ? ' checked' : '') . ' onclick="testiranje_settings();"><label for="question_resp_comment_0">' . $lang['no'] . '</label> ';
+ echo '<div class="setting_item">';
+ echo ' <input type="checkbox" value="1" '.($preview_hidecomment==1?' checked':'').' name="hidecomment" id="hidecomment"/>';
+ echo ' <label for="hidecomment">'.$lang['srv_preview_comments2'].'</label>';
+ echo '</div>';
+ }
+
+ echo '</div>';
+
+
+
+ echo '</div>'; #testiranje_preview_settings_left
+ echo '<div class="testiranje_preview_settings_right">';
+
+ // Nastavitve komentarjev - preverimo ce so na voljo v paketu
+ if($userAccess->checkUserAccess($what='question_type_location')){
+
+ echo '<div class="setting_holder">';
+ echo '<span class="setting_title semi-bold">'.$lang['srv_testiranje_komentarji'].':</span>';
+
+ echo '<div class="setting_item">';
+ echo '<input type="radio" name="question_resp_comment" value="0" id="question_resp_comment_0" ' . ($question_resp_comment == 0 ? ' checked' : '') . ' onclick="testiranje_settings();"><label for="question_resp_comment_0">' . $lang['no'] . '</label> ';
echo '<input type="radio" name="question_resp_comment" value="1" id="question_resp_comment_1" ' . ($question_resp_comment == 1 ? ' checked' : '') . ' onclick="testiranje_settings();"><label for="question_resp_comment_1">' . $lang['yes'] . '</label> ';
- echo '</p>';
- echo '<p class="question_resp_comment">'.$lang['srv_comments_show_open'].': <br />';
- echo '<input type="radio" name="question_resp_comment_show_open" value="" id="question_resp_comment_show_open_0" ' . ($question_resp_comment_show_open == 0 ? ' checked' : '') . '/><label for="question_resp_comment_show_open_0">' . $lang['forma_settings_open'] . '</label> ';
+ echo '</div>';
+
+ echo '</div>';
+
+
+ echo '<div class="setting_holder question_resp_comment">';
+ echo '<span class="setting_title">'.$lang['srv_comments_show_open'].':</span>';
+
+ echo '<div class="setting_item">';
+ echo '<input type="radio" name="question_resp_comment_show_open" value="" id="question_resp_comment_show_open_0" ' . ($question_resp_comment_show_open == 0 ? ' checked' : '') . '/><label for="question_resp_comment_show_open_0">' . $lang['forma_settings_open'] . '</label> ';
echo '<input type="radio" name="question_resp_comment_show_open" value="1" id="question_resp_comment_show_open_1" ' . ($question_resp_comment_show_open == 1 ? ' checked' : '') . '/><label for="question_resp_comment_show_open_1">' . $lang['forma_settings_closed'] . '</label> ';
- echo '</p><p class="question_resp_comment">';
- echo '' . $lang['srv_q_inicialke'] . ': <br />';
- echo '<input type="radio" name="question_resp_comment_inicialke" value="0" id="question_resp_comment_inicialke_0" ' . ($question_resp_comment_inicialke == 0 ? ' checked' : '') . ' onclick="testiranje_settings();"><label for="question_resp_comment_inicialke_0">' . $lang['no'] . '</label> ';
+ echo '</div>';
+
+ echo '</div>';
+
+ echo '<div class="setting_holder question_resp_comment">';
+ echo '<span class="setting_title">'.$lang['srv_q_inicialke'].':</span>';
+
+ echo '<div class="setting_item">';
+ echo '<input type="radio" name="question_resp_comment_inicialke" value="0" id="question_resp_comment_inicialke_0" ' . ($question_resp_comment_inicialke == 0 ? ' checked' : '') . ' onclick="testiranje_settings();"><label for="question_resp_comment_inicialke_0">' . $lang['no'] . '</label> ';
echo '<input type="radio" name="question_resp_comment_inicialke" value="1" id="question_resp_comment_inicialke_1" ' . ($question_resp_comment_inicialke == 1 ? ' checked' : '') . ' onclick="testiranje_settings();"><label for="question_resp_comment_inicialke_1">' . $lang['yes'] . '</label> ';
- echo '</p>';
- echo '<p class="question_resp_comment question_resp_comment_inicialke">' . $lang['srv_q_inicialke_alert'] . ': <br />';
- echo '<input type="radio" name="question_resp_comment_inicialke_alert" value="0" id="question_resp_comment_inicialke_alert_0" ' . ($question_resp_comment_inicialke_alert == 0 ? ' checked' : '') . '/><label for="question_resp_comment_inicialke_alert_0">' . $lang['srv_reminder_off2'] . '</label><br> ';
- echo '<input type="radio" name="question_resp_comment_inicialke_alert" value="1" id="question_resp_comment_inicialke_alert_1" ' . ($question_resp_comment_inicialke_alert == 1 ? ' checked' : '') . '/><label for="question_resp_comment_inicialke_alert_1">' . $lang['srv_reminder_soft2'] . '</label><br> ';
- echo '<input type="radio" name="question_resp_comment_inicialke_alert" value="2" id="question_resp_comment_inicialke_alert_2" ' . ($question_resp_comment_inicialke_alert == 2 ? ' checked' : '') . '/><label for="question_resp_comment_inicialke_alert_2">' . $lang['srv_reminder_hard2'] . '</label> ';
- echo '</p>';
- echo '<p><a href="index.php?anketa='.$this->anketa.'&a=urejanje&advanced_expanded=1">('.$lang['srv_details_settings'].')</a></p>';
-
- echo '</div>';
+ echo '</div>';
+
+ echo '</div>';
+
+ echo '<div class="setting_holder question_resp_comment question_resp_comment_inicialke">';
+ echo '<span class="setting_title">'.$lang['srv_q_inicialke_alert'].':</span>';
+
+ echo '<div class="setting_item">';
+ echo '<input type="radio" name="question_resp_comment_inicialke_alert" value="0" id="question_resp_comment_inicialke_alert_0" ' . ($question_resp_comment_inicialke_alert == 0 ? ' checked' : '') . '/><label for="question_resp_comment_inicialke_alert_0">' . $lang['srv_reminder_off2'] . '</label>';
+ echo '</div>';
+ echo '<div class="setting_item">';
+ echo '<input type="radio" name="question_resp_comment_inicialke_alert" value="1" id="question_resp_comment_inicialke_alert_1" ' . ($question_resp_comment_inicialke_alert == 1 ? ' checked' : '') . '/><label for="question_resp_comment_inicialke_alert_1">' . $lang['srv_reminder_soft2'] . '</label>';
+ echo '</div>';
+ echo '<div class="setting_item">';
+ echo '<input type="radio" name="question_resp_comment_inicialke_alert" value="2" id="question_resp_comment_inicialke_alert_2" ' . ($question_resp_comment_inicialke_alert == 2 ? ' checked' : '') . '/><label for="question_resp_comment_inicialke_alert_2">' . $lang['srv_reminder_hard2'] . '</label>';
+ echo '</div>';
+
+ echo '</div>';
+
+ echo '<p class="top16"><a href="index.php?anketa='.$this->anketa.'&a=urejanje&advanced_expanded=1">'.$lang['srv_details_settings'].'</a></p>';
?><script>
testiranje_settings();
</script><?
}
-
- echo '<h3>'.$lang['srv_preview_defaults'].'</h3>';
-
- echo '<p><label for="disableif"><input type="checkbox" value="1" '.($preview_disableif==1?' checked':'').' name="disableif" id="disableif">';
- echo ' '.$lang['srv_disableif'].'</label></p>';
-
- echo '<p><label for="disablealert"><input type="checkbox" value="1" '.($preview_disablealert==1?' checked':'').' name="disablealert" id="disablealert">';
- echo ' '.$lang['srv_disablealert'].'</label></p>';
-
- echo '<p><label for="displayifs"><input type="checkbox" value="1" '.($preview_displayifs==1?' checked':'').' name="displayifs" id="displayifs">';
- echo ' '.$lang['srv_displayifs'].'</label></p>';
-
- echo '<p><label for="displayvariables"><input type="checkbox" value="1" '.($preview_displayvariables==1?' checked':'').' name="displayvariables" id="displayvariables">';
- echo ' '.$lang['srv_displayvariables'].'</label></p>';
-
- // Nastavitve komentarjev - preverimo ce so na voljo v paketu
- if($userAccess->checkUserAccess($what='question_type_location')){
- echo '<p><label for="hidecomment"><input type="checkbox" value="1" '.($preview_hidecomment==1?' checked':'').' name="hidecomment" id="hidecomment">';
- echo ' '.$lang['srv_preview_comments2'].'</label></p>';
- }
-
- echo '<div style="clear:both;"></div>';
- echo '<div class="buttonwrapper floatRight">
- <a class="ovalbutton ovalbutton_orange btn_savesettings" onclick="testiranje_preview_settings_save(); return false;" href="#">
- <span>'.$lang['edit1337'].'</span>
- </a>
- </div>
-
- <div class="buttonwrapper spaceRight floatRight">
- <a class="ovalbutton ovalbutton_gray btn_savesettings" onclick="$(\'#vrednost_edit\').html(\'\').hide(); $(\'#fade\').fadeOut(); return false;" href="#" style="margin-left:10px">
- <span>'.$lang['srv_cancel'].'</span>
- </a>
- </div>';
-
+ echo '</div>'; #testiranje_preview_settings_right
+ echo '</div>'; #testiranje_preview_settings
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium white-blue" onClick="$(\'#vrednost_edit\').html(\'\').hide(); $(\'#fade\').fadeOut(); return false;">'.$lang['srv_cancel'].'</button>';
+ echo '<button class="medium blue" onclick="testiranje_preview_settings_save(); return false;">'.$lang['edit1337'].'</button>';
+ echo '</div>';
+
echo '</form>';
}
@@ -6152,10 +6316,15 @@ class SurveyAdminAjax {
$sv->displaySettings();
}
elseif ($what == 'advanced_paradata' && $value == '1'){
- // kviz
+ // napredni parapodatki
$sap = new SurveyAdvancedParadata($this->anketa);
$sap->displaySettings();
}
+ elseif ($what == 'advanced_timestamps' && $value == '1'){
+ // napredni casi po straneh
+ $sat = new SurveyAdvancedTimestamps($this->anketa);
+ $sat->displaySettings();
+ }
elseif ($what == 'slideshow' && $value == '1'){
$ss = new SurveySlideshow($this->anketa);
$ss->ShowSlideshowSetings();
@@ -6214,6 +6383,12 @@ class SurveyAdminAjax {
$sp->activatePanel();
$sp->displaySettings();
}
+ elseif ($what == 'email_access' && $value == '1'){
+ // dostop z emailom
+ $sea = new SurveyEmailAccess($this->anketa);
+ $sea->activateEmailAccess();
+ $sea->displaySettings();
+ }
}
// Zgenerira key za api
@@ -6236,28 +6411,19 @@ class SurveyAdminAjax {
if (!$sql)
echo mysqli_error($GLOBALS['connect_db']);
- echo '<div class="title">'.$lang['srv_api_auth_title'].'</div>';
-
- echo '<br />';
-
- echo 'ID: ';
- echo '<br /><span class="bold">'.$identifier.'</span>';
-
- echo '<br /><br />';
+ echo '<h2><span class="faicon fa-key"></span>'.$lang['srv_api_auth_title'].'</h2>';
+ echo '<div class="popup_close"><a href="#" onClick="close_API_window(); return false;">✕</a></div>';
- echo 'PRIVATNI KLJUČ: ';
- echo '<br /><span class="bold">'.$private_key.'</span>';
+ echo '<p class="semi-bold bottom8">ID:</p>';
+ echo '<p class="bottom16">'.$identifier.'<span class="faicon copy empty pointer blue link-left" onClick="CopyToClipboard(\''.$identifier.'\'); actionNotePopup(\'text_copied\', \'success\');"></span></p>';
- echo '<br /><br />';
+ echo '<p class="semi-bold bottom8 caps">'.$lang['srv_api_auth_private'].':</p>';
+ echo '<p class="bottom32">'.$private_key.'<span class="faicon copy empty pointer blue link-left" onClick="CopyToClipboard(\''.$private_key.'\'); actionNotePopup(\'text_copied\', \'success\');"></p>';
// Gumb za zapiranje
- echo '<div class="floatRight spaceRight">';
- echo '<div class="buttonwrapper" title="'.$lang['srv_zapri'].'">';
- echo '<a class="ovalbutton ovalbutton" onclick="close_API_window(); return false;" href="#">';
- echo '<span>'.$lang['srv_zapri'].'</span>';
- echo '</a>';
- echo '</div>';
- echo '</div>';
+ echo '<div class="button_holder">';
+ echo '<button class="medium blue" onClick="close_API_window(); return false;">'.$lang['srv_zapri'].'</button>';
+ echo '</div>';
}
// Prikaze uvoz iz besedila znotraj ankete (popup)
@@ -6265,39 +6431,50 @@ class SurveyAdminAjax {
global $lang, $site_url, $global_user_id;
// uvoz iz besedila
- echo '<div class="fieldset anketa_from_text">';
+ echo '<div class="fieldset anketa_from_text from_text_popup">';
+
echo '<div class="popup_close"><a href="#" onClick="popupImportAnketaFromText_close();">✕</a></div>';
// Naslov
echo '<h2>' . $lang['srv_newSurvey_survey_from_text_title'] . ' '.Help::display('srv_create_survey_from_text').'</h2>';
- echo '<span>' . $lang['srv_newSurvey_survey_from_text_text'] . '</span>';
+ echo '<div class="instructions">';
+ echo ' <p>'.$lang['srv_newSurvey_survey_from_text_text1'].'</p>';
+ echo ' <p>'.$lang['srv_newSurvey_survey_from_text_text2'].'</p>';
+ echo ' <p>'.$lang['srv_newSurvey_survey_from_text_text3'].'</p>';
+ echo '</div>';
+
+
+ echo '<div class="import_holder">';
+
// Input okno za text
echo '<div id="input_field_holder"><div id="input_field">';
- //echo '<textarea placeholder="'.$lang['srv_newSurvey_survey_from_text_example'].'" onKeyUp="$(\'#preview_field\').html($(\'textarea\').val());"></textarea>';
- echo '<textarea id="anketa_from_text_textarea" placeholder="'.$lang['srv_newSurvey_survey_from_text_example'].'" onKeyUp="anketaFromText_preview();"></textarea>';
+ echo ' <textarea id="anketa_from_text_textarea" placeholder="'.$lang['srv_newSurvey_survey_from_text_example'].'" onKeyUp="anketaFromText_preview();"></textarea>';
echo '</div></div>';
// Preview okno
echo '<div id="preview_field_holder"><div id="preview_field">';
- echo '<span class="italic">'.$lang['srv_poglejanketo2'].'</span>';
+ echo ' <span class="caps bold">'.$lang['srv_poglejanketo2'].'</span>';
echo '</div></div>';
+
+ echo '</div>';
+
echo '</div>';
// Gumba naprej in preklici
- echo '<div class="noSurvey_buttons">';
+ echo '<div class="button_holder">';
- echo ' <span class="floatRight spaceRight buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick="importAnketaFromText();" title="'.$lang['srv_newSurvey_survey_from_text'].'">';
- echo ' <span>'.$lang['next1'].'</span>';
- echo ' </a></span>';
-
- echo ' <span class="floatRight spaceRight buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onclick="popupImportAnketaFromText_close();" title="'.$lang['srv_cancel'].'">';
- echo ' <span>'.$lang['srv_cancel'].'</span>';
- echo ' </a></span>';
-
+ echo ' <button class="medium white-blue" onclick="popupImportAnketaFromText_close();" title="'.$lang['srv_cancel'].'">';
+ echo $lang['srv_cancel'];
+ echo ' </button>';
+
+ echo ' <button class="medium blue" href="#" onclick="importAnketaFromText();" title="'.$lang['srv_newSurvey_survey_from_text'].'">';
+ echo $lang['next1'];
+ echo ' </button>';
+
echo '</div>';
}
@@ -6356,6 +6533,150 @@ class SurveyAdminAjax {
}
+ // Dodeljevanje uredniskega dostopa do ankete
+ private function ajax_add_survey_dostop_popup(){
+ global $lang, $pass_salt, $global_user_id, $site_path, $site_url, $admin_type;
+
+ $_POST['addusers'] = mysql_real_unescape_string($_POST['addusers']);
+ $users = explode(NEW_LINE, $_POST['addusers']);
+ $sqlu = sisplet_query("SELECT email, name FROM users WHERE id = '".$global_user_id."'");
+ $rowu = mysqli_fetch_array($sqlu);
+
+ $MailReply = $rowu['email'];
+ $nameAuthor = $rowu['name'];
+
+
+ // Vsebina popupa
+ echo '<div class="popup_close"><a href="#" onClick="popupClose(); return false;">✕</a></div>';
+
+ echo '<h2>'.$lang['srv_dostop_addusers'].'</h2>';
+
+
+ echo '<div class="popup_content">';
+
+ // Loop cez vse vnesesne userje, ki jim dajemo dostop
+ foreach ($users AS $user) {
+
+ $user = explode(',', $user);
+ $email = trim($user[0]);
+ $name = (isset($user[1]) && trim($user[1])!='') ? trim($user[1]) : $email;
+ $surnname = (isset($user[2]) && trim($user[2])!='') ? trim($user[2]) : $email;
+
+ if($email != ''){
+
+ echo '<div class="row">';
+
+ // Ce gre za veljaven email dodamo userja
+ if (validEmail($email)) {
+
+ $id = 0;
+ $sqlu = sisplet_query("SELECT id FROM users WHERE email='$email'");
+
+ $create_new_account = false;
+
+ // Ce user, ki ga dodajamo, se ne obstaja, ga ustvarimo - PO NOVEM SAMO CE SMO ADMIN
+ if (mysqli_num_rows($sqlu) == 0 && $admin_type == 0) {
+ $s = sisplet_query("INSERT INTO users (name, surname, email, pass, type, when_reg, came_from) VALUES ('$name', '$surnname', '$email', '" .base64_encode((hash('SHA256', '' .$pass_salt))) ."', '3', DATE_FORMAT(NOW(), '%Y-%m-%d'), '1')");
+ $id = mysqli_insert_id($GLOBALS['connect_db']);
+
+ $create_new_account = true;
+ }
+ // Drugace pridobimo podatke o userju iz baze
+ else {
+ $rowu = mysqli_fetch_array($sqlu);
+ $id = $rowu['id'];
+ }
+
+ // Ce je bil ustvarjen oz ga imamo ze v bazi, mu damo dostop in posljemo mail
+ if($id > 0){
+
+ $sqlDostopExist = sisplet_query("SELECT * FROM srv_dostop WHERE ank_id='".$this->anketa."' AND uid='".$id."' AND aktiven='1'");
+ if(mysqli_num_rows($sqlDostopExist) == 0){
+
+ $s = sisplet_query("INSERT INTO srv_dostop (ank_id, uid, aktiven) VALUES ('$this->anketa', '$id', '1')");
+
+ // V kolikor gre za hierarhijo, potem še enkrat preverimo v bazi in dodelimo dostop tudi do hierarhije status 2 - naknadno dodan administrator
+ if(SurveyInfo::checkSurveyModule('hierarhija', $this->anketa))
+ sisplet_query("INSERT INTO srv_hierarhija_users (user_id, anketa_id, type) VALUES ('".$id."', '".$this->anketa."', 2)");
+
+ $naslov = SurveyInfo::getInstance()->getSurveyColumn('naslov');
+
+ $subject = $lang['srv_dostopmail_1'].' '.$naslov.'.';
+
+ $content = $lang['srv_dostopmail_2'].' <span style="color:red;">'.$nameAuthor.'</span> (<a style="color:#1e88e5 !important; text-decoration:none !important;" href="mailto:'.$MailReply.'">'.$MailReply.'</a>) '.$lang['srv_dostopmail_3'].' <a style="color:#1e88e5 !important; text-decoration:none !important;" href="'.$site_url.'admin/survey/index.php?anketa='.$this->anketa.'"><span style="font-weight:bold;">'.$naslov.'.</span></a><br /><br />
+ '.$lang['srv_dostopmail_4'].' <a style="color:#1e88e5 !important; text-decoration:none !important;" href="'.$site_url.'">'.$site_url.'</a> '.$lang['srv_dostopmail_5'].' (<a style="color:#1e88e5 !important; text-decoration:none !important;" href="mailto:'.$email.'">'.$email.'</a>).';
+
+ // Ce email se ni registriran, dodamo dodatno obvestilo
+ if(mysqli_num_rows($sqlu) == 0 && $admin_type == 0){
+ $content .= '<br /><br />'.$lang['srv_dostopmail_7'];
+ $content .= ' <a style="color:#1e88e5 !important; text-decoration:none !important;" href="'.$site_url.'/admin/survey/index.php?a=nastavitve&m=global_user_myProfile">'.$lang['edit_data'].'</a> ';
+ $content .= $lang['srv_dostopmail_72'];
+ }
+
+ // Sporočilo urednika (opcijsko)
+ if(isset($_POST['addusers_note']) && $_POST['addusers_note'] != ''){
+
+ $_POST['addusers_note'] = mysql_real_unescape_string($_POST['addusers_note']);
+
+ $content .= '<br /><br /><span style="font-weight:bold;">'.$lang['srv_dostopmail_note'].'</span><br /><br />';
+ $content .= '<span style="color:red;">'.$_POST['addusers_note'].'</span>';
+ }
+
+ // Podpis
+ $signature = Common::getEmailSignature();
+ $content .= $signature;
+
+ try{
+ $MA = new MailAdapter($this->anketa, $type='account');
+ $MA->addRecipients($email);
+ $resultX = $MA->sendMail(stripslashes($content), $subject);
+
+ if($resultX){
+ echo '<span><span class="email bold">'.$email.' - </span>'.($create_new_account ? $lang['srv_dostop_addusers_success_create'] : $lang['srv_dostop_addusers_success']).'</span>';
+ }
+ else{
+ echo '<span class="red"><span class="email bold">'.$email.' - </span>'.$lang['srv_dostop_addusers_error3'].'</span>';
+ }
+ }
+ catch (Exception $e){
+ echo '<span class="red"><span class="email bold">'.$email.' - </span>'.$lang['srv_dostop_addusers_error3'].'</span>';
+ }
+ }
+ // Uporabnik ze ima dostop
+ else{
+ echo '<span><span class="email bold">'.$email.' - </span>'.$lang['srv_dostop_addusers_error4'].'</span>';
+ }
+ }
+ // Uporabnika ni v bazi
+ else{
+ echo '<span class="red"><span class="email bold">'.$email.' - </span>'.$lang['srv_dostop_addusers_error2'].'</span>';
+ }
+ }
+ // Mail ni veljaven
+ else{
+ echo '<span class="red"><span class="email bold">'.$email.' - </span>'.$lang['srv_dostop_addusers_error1'].'</span>';
+ }
+
+ echo '</div>';
+ }
+ }
+
+ echo '</div>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium blue" title="'.$lang['srv_zapri'].'" onClick="popupClose(); return false;">'.$lang['srv_zapri'].'</button>';
+ echo '</div>';
+ }
+
+ private function ajax_refresh_dostop_settings(){
+
+ $_GET['a'] = 'dostop';
+
+ $sas = new SurveyAdminSettings();
+ $sas->anketa_nastavitve_global();
+ }
+
+
// Display consulting popup
function ajax_consulting_popup_open () {
global $lang;
@@ -6392,6 +6713,859 @@ class SurveyAdminAjax {
echo '<span class="buttonwrapper floatRight" title="'.$lang['srv_zapri'].'"><a class="ovalbutton ovalbutton_gray" href="#" onclick="smtpAAIPopupClose(); return false;"><span>'.$lang['srv_zapri'].'</span></a></span>';
echo '</div>';
}
+
+ // Alert na vsa vprašanja - popup
+ private function ajax_alert_all_popup(){
+ global $lang;
+
+ $alert_type = $_POST['alert_type'];
+
+
+ // Vsebina popupa
+ echo '<div class="popup_close"><a href="#" onClick="popupClose(); return false;">✕</a></div>';
+
+ echo '<h2>'.$lang['srv_'.$alert_type.'_reminder_all'].'</h2>';
+
+ echo '<div class="popup_content">';
+ echo $lang['srv_reminder_popup_warning'];
+ echo '</div>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium white-blue" onClick="popupClose();">'.$lang['edit1338'].'</button>';
+ echo '<button class="medium blue" onClick="window.location.href=\'ajax.php?a=reminder_all&what='.$alert_type.'&anketa='.$this->anketa.'\';return false;">'.$lang['edit1339'].'</button>';
+ echo '</div>';
+ }
+
+ // Generičen alert popup
+ private function ajax_genericAlertPopup(){
+ global $lang;
+
+ $name = $_POST['name'];
+ $optional_parameter = $_POST['optional_parameter'];
+
+
+ // Generičen alert popup - vsebina
+ echo '<h2>'.$lang['srv_warning'].'</h2>';
+ echo '<div class="popup_close"><a href="#" onClick="popupClose(); return false;">✕</a></div>';
+ echo '<div class="popup_content">';
+
+
+ switch ($name) {
+
+ //branching.js
+ case 'srv_unlock_popup2':
+ echo $lang['srv_unlock_popup2'];
+ break;
+ case 'srv_unlock_popup3':
+ echo $lang['srv_unlock_popup3'];
+ echo $optional_parameter;
+ break;
+
+ //_index.js
+ case 'alert_extensions_match':
+ echo $lang['alert_extensions_match'];
+ break;
+
+ //bm.js
+ case 'alert_no_jscss_found':
+ echo $lang['alert_no_jscss_found_1'];
+ echo $optional_parameter;
+ echo $lang['alert_no_jscss_found_2'];
+ break;
+
+ //hierarhija_analize.js, break.js, cReport.js, crosstab.js, means.js, script_analiza.js, ttest.js
+ case 'alert_no_archive_tables':
+ echo $lang['alert_no_archive'];
+ echo ' ';
+ echo $lang['alert_create_tables'];
+ break;
+
+ case 'alert_no_archive_response':
+ echo $lang['alert_no_archive'];
+ echo $optional_parameter;
+ break;
+
+ case 'alert_archive_error_response':
+ echo $lang['alert_archive_error'];
+ echo $optional_parameter;
+ break;
+
+ //MAZA.js, VnaprejMarkers.js
+ case 'srv_resevanje_alert_location_not_found_map':
+ echo $lang['srv_resevanje_alert_location_not_found_map'];
+ break;
+
+ //appendMerge.js, invitations.js, telephone.js
+ case 'srv_invitation_note1':
+ echo $lang['srv_invitation_note1'];
+ break;
+
+ case 'srv_invitation_note2':
+ echo $lang['srv_invitation_note2'];
+ break;
+
+ //charts.js
+ case 'srv_chart_num_limit_warning':
+ echo $lang['srv_chart_num_limit_warning'];
+ break;
+
+ //collectData.js
+ case 'srv_collectdata_failed':
+ echo $lang['srv_collectdata_failed'];
+ break;
+
+ //conditionProfiles.js, script_analiza.js, statistika.js, zankaProfiles.js
+ case 'error':
+ echo $lang['error'];
+ echo "!";
+ break;
+
+ case 'alert_missing_action':
+ echo $lang['alert_missing_action'];
+ echo $optional_parameter;
+ break;
+
+ //dataSettingsProfiles.js, missingProfiles.js, timeProfiles.js, zoom.js
+ case 'alert_parameter_action':
+ echo $optional_parameter;
+ break;
+
+ //invitations.js
+ case 'alert_deprecated':
+ echo $lang['alert_deprecated'];
+ break;
+
+ case 'alert_parameter_dataerror':
+ echo $optional_parameter;
+ break;
+
+ case 'alert_parameter_profilename':
+ echo $optional_parameter;
+ break;
+
+ case 'alert_incorrect_filetype':
+ echo $lang['alert_incorrect_filetype'];
+ break;
+
+ case 'alert_choose_file':
+ echo $lang['alert_choose_file'];
+ break;
+
+ case 'alert_parameter_response':
+ echo $optional_parameter;
+ break;
+
+ case 'alert_timeout':
+ echo $lang['alert_timeout'];
+ break;
+
+ case 'alert_unknown_error':
+ echo $lang['alert_unknown_error'];
+ break;
+
+ //missingvalues.js
+ case 'srv_missing_value_not_empty':
+ echo $lang['srv_missing_value_not_empty'];
+ break;
+
+ //script_analiza.js
+ case 'alert_delete_error':
+ echo $lang['alert_delete_error'];
+ break;
+
+ case 'srv_data_delete_not_selected':
+ echo $lang['srv_data_delete_not_selected'];
+ break;
+
+ case 'alert_copy_error':
+ echo $lang['alert_copy_error'];
+ break;
+
+ case 'alert_too_many_arguments':
+ echo $lang['alert_too_many_arguments'];
+ break;
+
+ case 'alert_missing_arguments':
+ echo $lang['alert_missing_arguments'];
+ break;
+
+
+ //script.js, telephone.js, invitations.js
+ case 'srv_newSurvey_survey_template_error':
+ echo $lang['srv_newSurvey_survey_template_error'];
+ break;
+
+ case 'alert_parameter_datamsg':
+ echo $optional_parameter;
+ break;
+
+ case 'alert_save_error':
+ echo $lang['alert_save_error'];
+ break;
+
+ case 'alert_userGlobalSettingChange':
+ echo $lang['alert_userGlobalSettingChange'];
+ echo ' (';
+ echo $optional_parameter;
+ echo ')';
+ break;
+
+ case 'cms_error_password_incorrect':
+ echo $lang['cms_error_password_incorrect'];
+ break;
+
+ case 'password_err_complex':
+ echo $lang['password_err_complex'];
+ break;
+
+ //slideshow.js
+ case 'alert_checkbox_error':
+ echo $lang['alert_checkbox_error'];
+ break;
+
+ //surveyCondition.js, ds_extras.js
+ case 'alert_error_code':
+ echo $lang['alert_error_code'];
+ echo $optional_parameter;
+ break;
+
+ case 'alert_parameter_dataerrormsg':
+ echo $optional_parameter;
+ break;
+
+ //surveyList.js
+ case 'alert_parameter_msg':
+ echo $optional_parameter;
+ break;
+
+ //telephone.js
+ case 'alert_invalidPID':
+ echo $lang['alert_invalidPID'];
+ break;
+
+ //timeProfiles.js
+ case 'srv_time_profile_error_interval':
+ echo $lang['srv_time_profile_error_interval'];
+ break;
+
+ //vprasanje.js
+ case 'srv_checkbox_min_limit_error_msg':
+ echo $lang['srv_checkbox_min_limit_error_msg'];
+ break;
+
+ //zankaProfiles
+ case 'srv_loop_multiplication_error':
+ echo $lang['srv_loop_multiplication_error'];
+ break;
+
+ //zoom.js
+ case 'alert_choose_variables':
+ echo $lang['alert_choose_variables'];
+ break;
+
+ //calendar.js
+ case 'alert_parameter_text':
+ echo $optional_parameter;
+ break;
+
+ //SurveyAdmin.php
+ case 'srv_filealert':
+ echo $lang['srv_filealert'];
+ break;
+
+ //SurveyAdminSettings.php
+ case 'srv_anketa_noactive2':
+ echo $lang['srv_anketa_noactive2'];
+ break;
+
+ //class.SurveyCondition.php
+ case 'alert_no_action_set':
+ echo $lang['alert_no_action_set'];
+ break;
+
+
+ }
+
+ echo '</div>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium blue" onClick="popupClose(); return false;">OK</button>';
+ echo '</div>';
+ }
+
+ // Generičen popup spodaj levo
+ private function ajax_actionNotePopup(){
+ global $lang;
+
+ $name = $_POST['name'];
+ $type = $_POST['type'];
+
+ if($type == 'error'){
+ $icon = 'close';
+ }
+ elseif($type == 'success'){
+ $icon = 'success';
+ }
+
+ echo '<div class="action_note_box '.$type.'">';
+
+ echo ' <span class="faicon '.$type.'"></span>';
+ echo ' <span class="text">'.$lang['action_note_'.$name].'</span>';
+ echo ' <span class="close" onClick="actionNotePopupClose();">✕</span>';
+
+ echo '</div>';
+ }
+
+ function ajax_publish_popup_open() {
+ global $lang, $site_url;
+
+ $name = $_POST['name'];
+
+ echo '<div class="popup_close"><a href="#" onClick="popupClose(); return false;">✕</a></div>';
+
+ switch ($name) {
+
+ case 'html':
+
+ $code = '<a href="'.SurveyInfo::getSurveyLink().'">'.$lang['srv_complete_survey'].'</a>';
+
+ echo '<h2><span class="fa-brands html5"></span>'.$lang['srv_anketa_href'].'</h2>';
+
+ echo '<div class="popup_content publish">';
+ echo '<textarea onclick="this.select();" readonly>';
+ echo $code;
+ echo '</textarea>';
+
+ echo '</div>';
+ break;
+
+ case 'htmlcount':
+
+ $code = '<a href="'.SurveyInfo::getSurveyLink().'">'.$lang['srv_complete_survey'].'</a><img src="'.$site_url.'main/survey/view_count.php?a='.$this->anketa.'" style="display:none"/>';
+
+ echo '<h2><span class="fa-brands html5"></span>'.$lang['srv_anketa_href_count'].'</h2>';
+
+ echo '<div class="popup_content publish">';
+ echo '<textarea onclick="this.select();" readonly>';
+ echo $code;
+ echo '</textarea>';
+
+ echo '</div>';
+ break;
+
+ case 'QR':
+ $img = 'classes/phpqrcode/imgs/code'.$this->anketa.'.png';
+ QRcode::png(SurveyInfo::getSurveyLink(), $img, 'L', 4, 2);
+
+ echo '<h2><span class="faicon fa-qrcode"></span>'.$lang['srv_anketa_href_friends'].'</h2>';
+
+ echo '<div class="popup_content publish qr">';
+ echo '<img src="'.$site_url.'admin/survey/'.$img.'">';
+ echo '</div>';
+
+ break;
+
+ case 'jazvem':
+ $img = 'img_new/jazvem.png';
+
+ echo '<h2 class="jazvem_popup_title"><span><img src="'.$site_url.'admin/survey/'.$img.'"></span>'.$lang['srv_anketa_href_jazvem'].'</h2>';
+
+ echo '<div class="popup_content publish">';
+ echo '<h4>'.$lang['srv_anketa_href_jazvem_text1'].'</h4>';
+ echo '<p>'.$lang['srv_anketa_href_jazvem_text2'].'</p>';
+ echo '</div>';
+
+ break;
+
+ case 'iframejs':
+
+ $code = SurveyAdmin::getEmbed();
+
+ echo '<h2><span class="faicon fa-window-maximize empty"></span>'.$lang['srv_anketa_href_ijs'].'</h2>';
+
+ echo '<div class="popup_content publish">';
+ //echo '<p class="bottom16">'.$lang['srv_anketa_href_ijs_text2'].'</p>';
+ echo '<textarea class="iframe" onclick="this.select();" readonly>';
+ echo $code;
+ echo '</textarea>';
+
+ echo '</div>';
+ break;
+
+ case 'iframenojs':
+
+ $code = SurveyAdmin::getEmbed(false);
+
+ echo '<h2><span class="faicon fa-window-maximize empty"></span>'.$lang['srv_anketa_href_inojs'].'</h2>';
+
+ echo '<div class="popup_content publish">';
+ //echo '<p class="bottom16">'.$lang['srv_anketa_href_inojs_text2'].'</p>';
+ echo '<textarea onclick="this.select();" readonly>';
+ echo $code;
+ echo '</textarea>';
+
+ echo '</div>';
+ break;
+
+ case 'add_url':
+
+ $code = SurveyAdmin::getEmbed(false);
+
+ echo '<h2>'.$lang['srv_nice_url_add'].'</h2>';
+
+ echo '<div class="popup_content publish">';
+ echo ' <div id="nice_url_holder">';
+ echo ' <div class="url">';
+ echo ' <span class="faicon link-chain link-right"></span>'.$site_url;
+ echo ' <input type="text" class="text large" name="nice_url" id="nice_url" value=""/>';
+ echo ' </div>';
+ echo ' </div>';
+ echo '<span id="add_url_error"></span>';
+ echo '</div>';
+ break;
+
+ case 'settings': // še v delu
+ $d = new Dostop();
+
+ echo '<h2><span class="faicon wheel_32 blue"></span>'.$lang['srv_publication_survey_settings'].'</h2>';
+
+ echo '<div class="popup_content publish settings">';
+
+ //privzete nastavitve
+ echo '<input type="hidden" value="' . $this->anketa . '" name="anketa" >';
+
+ $base_url = $site_url.'admin/survey/index.php?anketa='.$this->anketa;
+ # preberomo osnovne nastavitve
+ $row = SurveyInfo::getInstance()->getSurveyRow();
+
+ // Ce imamo dostop do zavihka urejanje
+ if($d->checkDostopSub('edit')){
+
+ # Trajanje
+ $starts = explode('-',$row['starts']);
+ $starts = $starts[2].'.'.$starts[1].'.'.$starts[0];
+ $expire = explode('-',$row['expire']);
+ $expire = $expire[2].'.'.$expire[1].'.'.$expire[0];
+ echo '<p><span>'.$lang['srv_starts'].':</span> <a href="'.$base_url.'&a='.A_TRAJANJE.'&f=vabila_settings" title="'.$lang['srv_info_duration'].'"><span class="qs_data as_link">'.$starts.'</span></a></p>';
+ if ( $row['expire'] == PERMANENT_DATE ) {
+ #trajna
+ echo '<p><span>'.$lang['srv_trajna_anketa'].':</span> <a href="'.$base_url.'&a='.A_TRAJANJE.'&f=vabila_settings" title="'.$lang['srv_trajna_anketa'].'"><span class="qs_data as_link">'.($row['expire'] == PERMANENT_DATE ? $lang['yes'] : $lang['no']).'</span></a></p>';
+ } else {
+ echo '<p><span>'.$lang['srv_expire'].':</span> <a href="'.$base_url.'&a='.A_TRAJANJE.'&f=vabila_settings" title="'.$lang['srv_info_duration'].'"><span class="qs_data as_link">'.$expire.'</span></a></p>';
+ }
+
+ // Skin ankete
+ if ($row['skin_profile'] == 0) {
+ $skin_name = $row['skin'];
+ }
+ else {
+ $sqla = sisplet_query("SELECT name FROM srv_theme_profiles WHERE id = '".$row['skin_profile']."'");
+ $rowa = mysqli_fetch_array($sqla);
+ $skin_name = $rowa['name'];
+ }
+ //echo '<p>'.$lang['srv_themes'].':<a href="'.$base_url.'&a='.A_TEMA.'&f=vabila_settings" title="'.$lang['srv_themes'].'"><span class="qs_data as_link">'.$row['skin'].'</span></a></p>';
+ echo '<p><span>'.$lang['srv_themes'].':</span> <a href="'.$base_url.'&a='.A_TEMA.'" title="'.$lang['srv_themes'].'"><span class="qs_data as_link">'.$skin_name.'</span></a></p>';
+
+ # Jezik
+ $lang_old = $lang;
+ $lang_admin = (int)$row['lang_admin'];
+ $lang_resp = (int)$row['lang_resp'];
+ $lang_array = array();
+ $lang_array[0] = $lang['srv_language_not_set'];
+ // Preberemo razpoložljive jezikovne datoteke
+ if ($dir = opendir('../../lang')) {
+ while (($file = readdir($dir)) !== false) {
+ if ($file != '.' AND $file != '..') {
+ if (is_numeric(substr($file, 0, strpos($file, '.')))) {
+ $i = substr($file, 0, strpos($file, '.'));
+ $file = '../../lang/'.$i.'.php';
+ if (file_exists($file)) {
+ include($file);
+ $lang_array[$i] = $lang['language'];
+ }
+ }
+ }
+ }
+ }
+
+ $lang = $lang_old;
+ $resp_change_lang = SurveySetting::getInstance()->getSurveyMiscSetting('resp_change_lang');
+ //echo '<p>'.$lang['srv_language_admin_1'].':</p>';
+ echo '<p><span>'.$lang['srv_language_admin_0'].':</span> <a href="'.$base_url.'&a='.A_JEZIK.'&f=vabila_settings" title="'.$lang['srv_language_admin_1'].'"><span class="qs_data as_link">'.$lang_array[$lang_admin].'</span></a> / <a href="'.$base_url.'&a='.A_JEZIK.'&f=vabila_settings" title="'.$lang['srv_language_respons_1'].'"><span class="qs_data as_link">'.$lang_array[$lang_resp].'</span></a></p>';
+
+ #obveščanje
+
+ // jezikovni linki
+ $p = new Prevajanje($this->anketa);
+ $p->dostop();
+ $jeziki = $p->get_all_translation_langs();
+ if (count($jeziki) > 0) {
+ echo '<p>' . $lang['srv_trans_lang'] . ': ';
+ $i = 0;
+ foreach ($jeziki AS $key => $val) {
+ if ($i++ != 0) echo ', ';
+ echo '<a href="'.$link.'?anketa='.$this->anketa.'&a=prevajanje&lang_id='.$key.'" target="_blank">'.$val.'</a>';
+ }
+ echo '</p>';
+ }
+
+ #piškotki
+ echo '<p><span>'.$lang['srv_cookie'].':</span> <a href="'.$base_url.'&a='.A_COOKIE.'&f=vabila_settings" title="'.$lang['srv_cookie'].'"><span class="qs_data as_link">'.$lang['srv_cookie_'.$row['cookie']].'</span></a></p>';
+ echo '<p><span>'.$lang['srv_cookie_return'].':</span> <a href="'.$base_url.'&a='.A_COOKIE.'&f=vabila_settings" title="'.$lang['srv_cookie_return'].'"><span class="qs_data as_link">'.($row['cookie_return'] == 0 ? $lang['srv_cookie_return_start'] : $lang['srv_cookie_return_middle']).'</span></a></p>';
+
+ #more - več
+ echo '<div id="srv_objava_info_more1" class="as_link" onclick="togglePublishSettings();"><span class="faicon fa-angle-down"></span>'.$lang['srv_publication_survey_settings_more'].'</div>';
+ echo '<div id="srv_objava_info_more2" class="as_link displayNone" onclick="togglePublishSettings();"><span class="faicon fa-angle-up"></span>'.$lang['srv_publication_survey_settings_less'].'</div>';
+
+ echo '<div id="publish_settings_more">';
+
+ if ($row['cookie'] > -1) {
+ # če je piškotek dlje kot do konca nakete lahko izbere tudi druge možnosti
+ echo '<p><span>'.$lang['srv_return_finished'].':</span> <a href="'.$base_url.'&a='.A_COOKIE.'&f=vabila_settings" title="'.$lang['srv_return_finished'].'"><span class="qs_data as_link">'.($row['return_finished'] == 1 ? $lang['srv_return_finished_yes'] : $lang['srv_return_finished_no']).'</span></a></p>';
+ } else {
+ # ker je piškotek samo do konca ankete se ne more vrnit ali urejat
+ echo '<p><span>'.$lang['srv_return_finished'].':</span> <a href="'.$base_url.'&a='.A_COOKIE.'&f=vabila_settings" title="'.$lang['srv_return_finished'].'"><span class="qs_data as_link">'. $lang['srv_return_finished_no'] .'</span></a></p>';
+ }
+
+ echo '<p><span>'.$lang['srv_multilang'].':</span> <a href="'.$base_url.'&a='.A_PREVAJANJE.'&f=vabila_settings" title="'.$lang['srv_multilang'].'"><span class="qs_data as_link">'.($row['multilang'] == 1 ? $lang['yes'] : $lang['no'] ).'</span></a></p>';
+
+ echo '<p><span>'.$lang['srv_user'].':</span> <a href="'.$base_url.'&a='.A_COOKIE.'&f=vabila_settings" title="'.$lang['srv_user'].'"><span class="qs_data as_link">';
+ if ($row['user_from_cms'] == 1) {
+ echo $lang['srv_respondent'];
+ } elseif ($row['user_from_cms'] == 2) {
+ echo $lang['srv_vnasalec'];
+ } elseif ($row['user_from_cms'] == 0) {
+ echo $lang['no1'];
+ }
+ echo '</span></a></p>';
+
+ echo '<p><span>'.$lang['srv_block_ip'].':</span> <a href="'.$base_url.'&a='.A_COOKIE.'&f=vabila_settings" title="'.$lang['srv_block_ip'].'"><span class="qs_data as_link">';
+ if ($row['block_ip'] == 0) {
+ echo $lang['no1'];
+ } elseif ($row['block_ip'] == 10) {
+ echo '10 min';
+ } elseif ($row['block_ip'] == 20) {
+ echo '20 min';
+ } elseif ($row['block_ip'] == 60) {
+ echo '60 min';
+ } elseif ($row['block_ip'] == 720) {
+ echo '12 '.$lang['hour_hours2'];
+ } elseif ($row['block_ip'] == 1440) {
+ echo '24 '.$lang['hour_hours2'];
+ }
+ echo '</a>';
+ echo '</p>';
+
+
+ # user from cms
+ if ($row['user_from_cms']>0) {
+ echo '<p><span>'.$lang['srv_user_cms_show'].':</span> <a href="'.$base_url.'&a='.A_COOKIE.'&f=vabila_settings" title="'.$lang['srv_user_cms_show'].'"><span class="qs_data as_link">'.($lang['srv_user_cms_email']).'</span></a></p>';
+ }
+ echo '<p><span>'.$lang['srv_vote_limit'].':</span> <a href="'.$base_url.'&a='.A_TRAJANJE.'&f=vabila_settings" title="'.$lang['srv_vote_limit'].'"><span class="qs_data as_link">'.($row['vote_limit'] == 0 ? $lang['no'] : $lang['yes']).'</span></a></p>';
+
+ echo '<p><span>'.$lang['srv_vote_count'].':</span> <a href="'.$base_url.'&a='.A_TRAJANJE.'&f=vabila_settings" title="'.$lang['srv_vote_count'].'"><span class="qs_data as_link">'.($row['vote_limit'] == 0 ? '/' : $row['vote_count']).'</span></a></p>';
+ # Obveščanje
+ // preberemo nastavitve alertov
+ $sqlAlert = sisplet_query("SELECT * FROM srv_alert WHERE ank_id = '".$this->anketa."'");
+ if (mysqli_num_rows($sqlAlert) > 0) {
+ $rowAlert = mysqli_fetch_assoc($sqlAlert);
+ } else {
+ SurveyAlert::getInstance()->Init($anketa, $global_user_id);
+ $rowAlert = SurveyAlert::setDefaultAlertBeforeExpire();
+ }
+
+ $alert_finish = array();
+ $alert_expire = array();
+ $alert_delete = array();
+ $alert_active = array();
+ if ($rowAlert['finish_respondent'] == 1) {
+ $alert_finish[] = $lang['srv_alert_respondent'];
+ }
+ if ($rowAlert['finish_respondent_cms'] == 1) {
+ $alert_finish[] = $lang['srv_alert_respondent_cms'];
+ }
+ if ($rowAlert['finish_author'] == 1) {
+ $alert_finish[] = $lang['srv_info_author'];
+ }
+ if ($rowAlert['finish_other'] == 1) {
+ $alert_finish[] = $lang['email_prejemniki'];
+ }
+ if ($rowAlert['expire_author'] == 1) {
+ $alert_expire[] = $lang['srv_info_author'];
+ }
+ if ($rowAlert['expire_other'] == 1) {
+ $alert_expire[] = $lang['email_prejemniki'];
+ }
+ if ($rowAlert['delete_author'] == 1) {
+ $alert_delete[] = $lang['srv_info_author'];
+ }
+ if ($rowAlert['delete_other'] == 1) {
+ $alert_delete[] = $lang['email_prejemniki'];
+ }
+ if ($rowAlert['active_author'] == 1) {
+ $alert_active[] = $lang['srv_info_author'];
+ }
+ if ($rowAlert['active_other'] == 1) {
+ $alert_active[] = $lang['email_prejemniki'];
+ }
+ echo '<p><span>'.$lang['srv_alert_completed_2'].':</span> <a href="'.$base_url.'&a='.A_ALERT.'&f=vabila_settings" title="'.$lang['srv_alert_completed_2'].'"><span class="qs_data as_link">'.(count($alert_finish) ? implode(',',$alert_finish) : $lang['no']).'</span></a></p>';
+ echo '<p><span>'.$lang['srv_alert_expired_2'].':</span> <a href="'.$base_url.'&a='.A_ALERT.'&f=vabila_settings" title="'.$lang['srv_alert_expired_2'].'"><span class="qs_data as_link">'.(count($alert_expire) ? implode(',',$alert_expire) : $lang['no']).'</span></a></p>';
+ echo '<p><span>'.$lang['srv_alert_active_2'].':</span> <a href="'.$base_url.'&a='.A_ALERT.'&f=vabila_settings" title="'.$lang['srv_alert_active_2'].'"><span class="qs_data as_link">'.(count($alert_active) ? implode(',',$alert_active) : $lang['no']).'</span></a></p>';
+ echo '<p><span>'.$lang['srv_alert_delete_2'].':</span> <a href="'.$base_url.'&a='.A_ALERT.'&f=vabila_settings" title="'.$lang['srv_alert_delete_2'].'"><span class="qs_data as_link">'.(count($alert_delete) ? implode(',',$alert_delete) : $lang['no']).'</span></a></p>';
+
+ echo '<p>';
+ echo '<a href="index.php?anketa=' . $this->anketa . '&a='.A_SETTINGS . '&f=vabila_settings" title="' . $lang['srv_nastavitve_ankete'] . '">';
+ echo $lang['srv_nastavitve_ankete_all'].'</a>';
+ echo '</p>';
+
+ echo '</div>'; // div#publish_settings_more
+ }
+ // Nimamo dostopa do zavihka urejanje - ni nobenih linkov
+ else{
+ # Trajanje
+ $starts = explode('-',$row['starts']);
+ $starts = $starts[2].'.'.$starts[1].'.'.$starts[0];
+ $expire = explode('-',$row['expire']);
+ $expire = $expire[2].'.'.$expire[1].'.'.$expire[0];
+ echo '<p><span>'.$lang['srv_starts'].':</span> '.$starts.'</p>';
+ if ( $row['expire'] == PERMANENT_DATE ) {
+ #trajna
+ echo '<p><span>'.$lang['srv_trajna_anketa'].':</span> '.($row['expire'] == PERMANENT_DATE ? $lang['yes'] : $lang['no']).'</p>';
+ } else {
+ echo '<p><span>'.$lang['srv_expire'].':</span> '.$expire.'</p>';
+ }
+
+ echo '<p><span>'.$lang['srv_themes'].':</span> '.$row['skin'].'</p>';
+
+ # Jezik
+ $lang_old = $lang;
+ $lang_admin = (int)$row['lang_admin'];
+ $lang_resp = (int)$row['lang_resp'];
+ $lang_array = array();
+ $lang_array[0] = $lang['srv_language_not_set'];
+ // Preberemo razpoložljive jezikovne datoteke
+ if ($dir = opendir('../../lang')) {
+ while (($file = readdir($dir)) !== false) {
+ if ($file != '.' AND $file != '..') {
+ if (is_numeric(substr($file, 0, strpos($file, '.')))) {
+ $i = substr($file, 0, strpos($file, '.'));
+ $file = '../../lang/'.$i.'.php';
+ if (file_exists($file)) {
+ include($file);
+ $lang_array[$i] = $lang['language'];
+ }
+ }
+ }
+ }
+ }
+
+ $lang = $lang_old;
+ $resp_change_lang = SurveySetting::getInstance()->getSurveyMiscSetting('resp_change_lang');
+ echo '<p><span>'.$lang['srv_language_admin_0'].':</span> '.$lang_array[$lang_admin].' / '.$lang_array[$lang_resp].'</p>';
+
+ #obveščanje
+
+ // jezikovni linki
+ $p = new Prevajanje($this->anketa);
+ $jeziki = $p->get_all_translation_langs();
+ if (count($jeziki) > 0) {
+ echo '<p>' . $lang['srv_trans_lang'] . ': ';
+ $i = 0;
+ foreach ($jeziki AS $key => $val) {
+ if ($i++ != 0) echo ', ';
+ echo '<a href="'.$link.'?language='.$key.'&f=vabila_settings" target="_blank">'.$val.'</a>';
+ }
+ echo '</p>';
+ }
+ #piškotki
+ echo '<p><span>'.$lang['srv_cookie'].':</span> '.$lang['srv_cookie_'.$row['cookie']].'</p>';
+ echo '<p><span>'.$lang['srv_cookie_return'].':</span> '.($row['cookie_return'] == 0 ? $lang['srv_cookie_return_start'] : $lang['srv_cookie_return_middle']).'</p>';
+
+ #more - več
+ echo '<div id="srv_objava_info_more1" class="as_link" onclick="togglePublishSettings();"><span class="faicon fa-angle-down"></span>'.$lang['srv_publication_survey_settings_more'].'</div>';
+ echo '<div id="srv_objava_info_more2" class="as_link displayNone" onclick="togglePublishSettings();"><span class="faicon fa-angle-up"></span>'.$lang['srv_publication_survey_settings_less'].'</div>';
+
+ echo '<div id="publish_settings_more">';
+
+ if ($row['cookie'] > -1) {
+ # če je piškotek dlje kot do konca nakete lahko izbere tudi druge možnosti
+ echo '<p><span>'.$lang['srv_return_finished'].':</span> '.($row['return_finished'] == 1 ? $lang['srv_return_finished_yes'] : $lang['srv_return_finished_no']).'</p>';
+ } else {
+ # ker je piškotek samo do konca ankete se ne more vrnit ali urejat
+ echo '<p><span>'.$lang['srv_return_finished'].':</span> '. $lang['srv_return_finished_no'] .'</p>';
+ }
+
+ echo '<p><span>'.$lang['srv_multilang'].':</span> '.($row['multilang'] == 1 ? $lang['yes'] : $lang['no'] ).'</p>';
+
+ echo '<p><span>'.$lang['srv_user'].':</span> ';
+ if ($row['user_from_cms'] == 1) {
+ echo $lang['srv_respondent'];
+ } elseif ($row['user_from_cms'] == 2) {
+ echo $lang['srv_vnasalec'];
+ } elseif ($row['user_from_cms'] == 0) {
+ echo $lang['no1'];
+ }
+ echo '</p>';
+
+ echo '<p><span>'.$lang['srv_block_ip'].':</span> ';
+ if ($row['block_ip'] == 0) {
+ echo $lang['no1'];
+ } elseif ($row['block_ip'] == 10) {
+ echo '10 min';
+ } elseif ($row['block_ip'] == 20) {
+ echo '20 min';
+ } elseif ($row['block_ip'] == 60) {
+ echo '60 min';
+ } elseif ($row['block_ip'] == 720) {
+ echo '12 '.$lang['hour_hours2'];
+ } elseif ($row['block_ip'] == 1440) {
+ echo '24 '.$lang['hour_hours2'];
+ }
+ echo '</p>';
+
+
+ # user from cms
+ if ($row['user_from_cms']>0) {
+ echo '<p><span>'.$lang['srv_user_cms_show'].':</span> '.($lang['srv_user_cms_email']).'</p>';
+ }
+ echo '<p><span>'.$lang['srv_vote_limit'].':</span> '.($row['vote_limit'] == 0 ? $lang['no'] : $lang['yes']).'</p>';
+
+ echo '<p><span>'.$lang['srv_vote_count'].':</span> '.($row['vote_limit'] == 0 ? '/' : $row['vote_count']).'</p>';
+ # Obveščanje
+ // preberemo nastavitve alertov
+ $sqlAlert = sisplet_query("SELECT * FROM srv_alert WHERE ank_id = '".$this->anketa."'");
+ if (mysqli_num_rows($sqlAlert) > 0) {
+ $rowAlert = mysqli_fetch_assoc($sqlAlert);
+ } else {
+ SurveyAlert::getInstance()->Init($anketa, $global_user_id);
+ $rowAlert = SurveyAlert::setDefaultAlertBeforeExpire();
+ }
+
+ $alert_finish = array();
+ $alert_expire = array();
+ $alert_delete = array();
+ $alert_active = array();
+ if ($rowAlert['finish_respondent'] == 1) {
+ $alert_finish[] = $lang['srv_alert_respondent'];
+ }
+ if ($rowAlert['finish_respondent_cms'] == 1) {
+ $alert_finish[] = $lang['srv_alert_respondent_cms'];
+ }
+ if ($rowAlert['finish_author'] == 1) {
+ $alert_finish[] = $lang['srv_info_author'];
+ }
+ if ($rowAlert['finish_other'] == 1) {
+ $alert_finish[] = $lang['email_prejemniki'];
+ }
+ if ($rowAlert['expire_author'] == 1) {
+ $alert_expire[] = $lang['srv_info_author'];
+ }
+ if ($rowAlert['expire_other'] == 1) {
+ $alert_expire[] = $lang['email_prejemniki'];
+ }
+ if ($rowAlert['delete_author'] == 1) {
+ $alert_delete[] = $lang['srv_info_author'];
+ }
+ if ($rowAlert['delete_other'] == 1) {
+ $alert_delete[] = $lang['email_prejemniki'];
+ }
+ if ($rowAlert['active_author'] == 1) {
+ $alert_active[] = $lang['srv_info_author'];
+ }
+ if ($rowAlert['active_other'] == 1) {
+ $alert_active[] = $lang['email_prejemniki'];
+ }
+ echo '<p><span>'.$lang['srv_alert_completed_2'].':</span> '.(count($alert_finish) ? implode(',',$alert_finish) : $lang['no']).'</p>';
+ echo '<p><span>'.$lang['srv_alert_expired_2'].':</span> '.(count($alert_expire) ? implode(',',$alert_expire) : $lang['no']).'</p>';
+ echo '<p><span>'.$lang['srv_alert_active_2'].':</span> '.(count($alert_active) ? implode(',',$alert_active) : $lang['no']).'</p>';
+ echo '<p><span>'.$lang['srv_alert_delete_2'].':</span> '.(count($alert_delete) ? implode(',',$alert_delete) : $lang['no']).'</p>';
+
+ echo '</div>';
+ }
+
+ echo '</div>';
+ break;
+ }
+
+ // Gumbi spodaj
+
+ echo '<div class="button_holder">';
+ // privzete nastavitve in QR koda imajo samo gumb zapri
+ if ($name == 'settings' || $name == 'QR') {
+ $img = $site_url.'admin/survey/classes/phpqrcode/imgs/code'.$this->anketa.'.png';
+ echo '<button class="medium blue" id="'.$name.'" onclick="download_file(\''.$img.'\'); popupClose(); return false;">'.$lang['srv_anketa_href_friends_button'].'</button>';
+ }
+ // html in iframe kode imajo gumba zapri in kopiraj ($code)
+ elseif ($name == 'html' || $name == 'htmlcount') {
+ //echo '<button class="medium white-blue" onclick="popupClose(); return false;">'.$lang['srv_zapri'].'</button>';
+ echo '<button class="medium blue" onclick="CopyToClipboard(\''.htmlspecialchars($code).'\'); actionNotePopup(\'link_copied\', \'success\'); popupClose(); return false;">'.$lang['srv_diagnostika_testiranje_copy'].'</button>';
+ }
+ elseif ($name == 'jazvem') {
+ echo '<button class="medium blue" onclick="window.location.href=\'index.php?anketa='.$this->anketa.'&a=panel\'; popupClose(); return false;">'.$lang['srv_anketa_href_jazvem_button'].'</button>';
+ }
+ elseif ($name == 'add_url') {
+ echo '<button type="button" class="medium white-blue" onclick="popupClose(); return false;">'.$lang['edit1338'].'</button>';
+ echo '<button type="button" class="medium blue" onclick="addPrettyURL();">'.$lang['srv_nice_url_add_button'].'</button>';
+ }
+ else {
+ //echo '<button class="medium white-blue" onclick="popupClose(); return false;">'.$lang['srv_zapri'].'</button>';
+ echo '<button class="medium blue" onclick="CopyToClipboard(\''.$code.'\'); actionNotePopup(\'link_copied\', \'success\'); popupClose(); return false;">'.$lang['srv_diagnostika_testiranje_copy'].'</button>';
+ }
+ echo '</div>';
+ }
+
+ // Enklikarhiv popup
+ private function ajax_oneClickArchive(){
+ global $lang;
+
+ $anketa = $_POST['anketa'];
+
+ echo '<h2>'.$lang['srv_analiza_arhiviraj'].'</h2>';
+ echo '<div class="popup_close"><a href="#" onClick="popupClose(); return false;">✕</a></div>';
+
+
+ echo '<div class="popup_content">';
+ echo '<p class="bottom16">'.$lang['srv_questionnaire_archives_text_popup'].'</p>';
+
+ echo '<div class="setting_holder">';
+ echo $lang['srv_questionnaire_archives_note'].':';
+ echo '<input class="large w400" name="intro_opomba" id="intro_opomba" type="text"/>';
+ echo '</div>';
+
+ echo '</div>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium white-blue" onClick="popupClose(); return false;">'.$lang['edit1338'].'</button>';
+ echo '<button class="medium blue" onclick="create_archive_survey(\'' . $this->anketa .'\'); return false;">'.$lang['srv_backup_button'].'</button>';
+ echo '</div>';
+ }
+
+
+ private function ajax_show_gdpr_messeage(){
+ global $lang;
+
+ $id_sporocila = $_POST['id_sporocila'];
+
+ $sql = sisplet_query("SELECT text FROM srv_gdpr_requests WHERE id = '".$id_sporocila."'");
+ $row = mysqli_fetch_array($sql);
+
+ echo '<h2><span class="faicon envelope"></span>'.$lang['srv_gdpr_requests_text'].'</h2>';
+
+ echo '<div class="popup_close"><a href="#" onClick="popupClose(); return false;">✕</a></div>';
+
+
+ echo '<div class="popup_content">';
+ echo '<p class="bottom16"> '.$row['text'].'</p>';
+
+ echo '<div class="button_holder">';
+ echo '<button class="medium blue" onClick="popupClose(); return false;">'.$lang['srv_zapri'].'</button>';
+ echo '</div>';
+
+
+ echo '</div>';
+
+
+ }
}
?> \ No newline at end of file