$val) { $g .= '&' . $key . '=' . $val; } if ($encode) $g = str_replace('&', '&', $g); return $g; } /************************************************ * Funcktja pridobi vse url parametre in jih ustrezno doda v globalne spremenljivke razreda SurveyClass * * @param $_GET * @param $var - vse spremenljivke * @return (obje ct) $get ************************************************/ public function getAllUrlParameters() { // Vse GET parametre damo v objekt if (!empty($_GET)) $get = (object)$_GET; //V kolikor gre za enkripcijo potem najprej dekriptiramo - URLDECODE SE ZE AVTOMATSKO IZVEDE NA $_GET array-u if (isset($get->enc)) { //$request_decoded = base64_decode(urldecode($get->enc)); $request_decoded = base64_decode($get->enc); $request_array = array(); parse_str($request_decoded, $request_array); foreach ($request_array as $var => $value) { $get->$var = $value; } } //postavimo še ID ankete, ker ga bomo največkrat potrebovali if (empty($get->anketa) && !is_int($get->anketa) && empty($_POST['anketa'])) { return header('Location: ' . self::$site_url); die("Missing anketa id!"); } $anketa = (($get->anketa) ? $get->anketa : $_POST['anketa']); // Shranimo vse spremenljivke iz get parametrov v classu VariableClass save('anketa', $anketa); save('get', $get); return $get; } /************************************************ * Pridobimo vse parametre iz piškotka * * @param $_COOKIE * @return (object) $cookie ************************************************/ public function getAllCookieParameters() { $cookie = null; // Vse GET parametre damo v objekt if (!empty($_COOKIE)) $cookie = (object)$_COOKIE; // Piškot shranimo v spremenljivke VariableClass save('cookie', $cookie); return $cookie; } /** * @desc zgenereira header */ public function header(){ global $app_settings; // preprecimo caching - tudi s klikom na gumb nazaj! header("Last-Modified: " . gmdate("D, j M Y H:i:s") . " GMT"); header("Expires: " . gmdate("D, j M Y H:i:s", time()) . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 header("Cache-Control: post-check=0, pre-check=0", FALSE); header("Pragma: no-cache"); // HTTP/1.0 echo '' . "\n"; $row = SurveyInfo::getInstance()->getSurveyRow(); $sqlv = sisplet_query("SELECT value FROM misc WHERE what='version'"); $rowv = mysqli_fetch_array($sqlv); // Custom header title if(isset($app_settings['head_title_custom']) && $app_settings['head_title_custom'] == 1){ echo ''.strip_tags(Helper::getInstance()->displayAkronim(0)).' - '.$app_settings['head_title_text'].'' . "\n"; } // Default header title else{ echo ''.strip_tags(Helper::getInstance()->displayAkronim(0)).' - '.self::$lang['1ka_surveys'].'' . "\n"; } echo ' ' . "\n"; // Preprecimo vklop compatibility moda v IE echo ' ' . "\n"; // nova verzija UI 1.8.10 - includamo minificirano skupaj z script.js (uporabimo iste jQuery fajle kot v adminu) echo ' ' . "\n"; echo '' . "\n"; // tukaj nalozimo CSS za jquery in template temo echo ' ' . "\n"; //nalozimo stringe iz langa za JS echo '' . "\n"; // nalozimo open sans fonte za nov design echo ''; /*echo '';*/ echo ''; // CSS mobile skin za telefone in tablice if (get('mobile') == 1) { echo ' ' . "\n"; // za MJU anketo nalozimo posebej custom skin if(SurveyInfo::getInstance()->checkSurveyModule('mju_theme') == '1'){ $this->loadCustomMadeSkin($custom_skin='MJU'); } // CSS samo za mobilne telefone else{ $this->themeEditorMobileCustom(); } } // CSS za tablice je po defaultu enak kot za pc elseif(get('mobile') == 2){ echo ' ' . "\n"; // za MJU anketo nalozimo posebej custom skin if(SurveyInfo::getInstance()->checkSurveyModule('mju_theme') == '1'){ $this->loadCustomMadeSkin($custom_skin='MJU'); } // profili tem - skinov else{ $this->themeEditor(); } } // CSS za pc else{ // Custom skin za Bled if($row['skin'] == 'Bled'){ $this->loadCustomMadeSkin($custom_skin='Bled'); } // za MJU anketo nalozimo posebej custom skin elseif(SurveyInfo::getInstance()->checkSurveyModule('mju_theme') == '1'){ $this->loadCustomMadeSkin($custom_skin='MJU'); } // profili tem - skinov else{ $this->themeEditor(); } } // še css za printer // tole je ze out-of-date, po moje je zaenkrat boljs brez posebnega print skina //echo ' '."\n"; // Skin za glasovanje $sqlG = sisplet_query("SELECT skin FROM srv_glasovanje WHERE ank_id='" . get('anketa') . "'"); $rowG = mysqli_fetch_array($sqlG); if (mysqli_num_rows($sqlG) > 0) echo ' ' . "\n"; // CSS za modul kviz if (SurveyInfo::getInstance()->checkSurveyModule('quiz')) { echo ' ' . "\n"; } // CSS za modul SAZU anketo if (SurveyInfo::getInstance()->checkSurveyModule('sazu')) { echo ' ' . "\n"; } // CSS za rtl text - glede na lang datoteko (zaenkrat samo arabscina) if (in_array(self::$lang['id'], array('39', '43'))) { echo ' ' . "\n"; } // JavaScript za napredne parapodatke if (SurveyAdvancedParadataLog::getInstance()->paradataEnabled()){ // Ce ne postamo oz. ce smo na zadnji strani vkljucimo js kodo if(count($_POST) == 0 || Find::getInstance()->findNextGrupa($_GET['grupa']) == 0){ SurveyAdvancedParadataLog::getInstance()->prepareLogging(); SurveyAdvancedParadataLog::getInstance()->linkJavaScript(); } } echo '' . "\n"; // Ce imamo vklopljen evoli na instalaciji, potem onemogocimo kopiranje $evoli_copy_disable = ''; if (Common::checkModule('evoli') == '1' || Common::checkModule('evoli_employmeter') == '1') $evoli_copy_disable = 'oncopy="return false;" oncut="return false;" oncontextmenu="return false;"'; $preview = ''; if (isset($_GET['preview']) && $_GET['preview'] == 'on') $preview = ' class="preview"'; elseif (isset($_GET['testdata']) && $_GET['testdata'] == 'on') $preview = ' class="preview"'; echo '' . "\n"; // Zamenjamo class no_js z js -> test javacsripta za userje (javascript_warning) echo ""; if ($row['user_from_cms'] == 2 && $row['user_from_cms_email'] == 1) { // vnos $sql1 = sisplet_query("SELECT user_id FROM srv_user WHERE id = '" . get('usr_id') . "'"); $row1 = mysqli_fetch_array($sql1); $sqlu = Model::db_select_user($row1['user_id']); $rowu = mysqli_fetch_array($sqlu); if (mysqli_num_rows($sqlu) > 0) { echo '
'; echo self::$lang['srv_recognized'] . ' ' . $rowu['name'] . ' ' . $rowu['surname'] . '
(' . $rowu['email'] . ')'; echo '
' . "\n"; } } } /** * @desc prikaze sistemske spremenljivke */ public function displaySistemske() { $sql = sisplet_query("SELECT id, recnum FROM srv_user WHERE id='" . get('usr_id') . "'"); if (!$sql) echo mysqli_error($GLOBALS['connect_db']); $row = mysqli_fetch_array($sql); echo ' '; echo ' '; // Ce imamo vklopljen modul panel sproti belezimo tudi panel_status if(SurveyInfo::checkSurveyModule('panel') == 1){ // Ce gre za prvo nastavimo na default vrednost, drugace beremo iz post-a $sp = new SurveyPanel(get('anketa')); $panel_status = (isset($_COOKIE['panel_status']) && $_COOKIE['panel_status'] != '') ? $_COOKIE['panel_status'] : $sp->getPanelSettings('status_default'); echo ' '; } // Spremenljivke, ki se rabijo v JS echo ' ' . "\n"; // Spremenljivke, ki se rabijo v JS za drag/drop echo ' '; } public function themeEditor($themePreview = false){ if (isset($_GET['theme'])) $themePreview = true; // to ne bo vec if (isset($_GET['theme-preview']) && $_GET['theme-preview'] == '1') $themePreview = true; // to je pri urejanju CSSa da se refresha mimo cachea $row = SurveyInfo::getSurveyRow(); if (isset($_GET['theme_profile'])) { $row['skin_profile'] = (int)$_GET['theme_profile']; } if (isset($_GET['theme'])) {//to ne bo vec $row['skin'] = str_replace('.css', '', $_GET['theme']); $row['skin_profile'] = 0; } // ni nastavljenih profilov, nastavimo navadno temo if ($row['skin_profile'] == 0) { // Ce ne gre za obstojeco anketo nastavimo default skin if($row['skin'] == '') $row['skin'] = '1kaBlue'; // moznost zip skinov if (!is_file(self::$site_path . 'main/survey/skins/' . $row['skin'] . '.css')) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } } // nastavljen je profil, nastavimo temo in potem še lastne nastavitve else { $sqla = sisplet_query("SELECT skin, logo FROM srv_theme_profiles WHERE id = '$row[skin_profile]'"); $rowa = mysqli_fetch_array($sqla); // moznost zip skinov if (!is_file(self::$site_path . 'main/survey/skins/' . $rowa['skin'] . '.css')) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } $sqlt = sisplet_query("SELECT * FROM srv_theme_editor WHERE profile_id = '" . $row['skin_profile'] . "'"); if (mysqli_num_rows($sqlt) > 0) { echo ''; } // Izrisemo css za custom logo if ($rowa['logo'] != '') { $this->customLogoCSS($rowa['logo']); } } // Za office in nature skina imamo random background if($row['skin'] == '1kaOffice' || $row['skin'] == '1kaNature'){ $bg_number = rand(1,15); echo ''; } } public function themeEditorMobileCustom(){ $row = SurveyInfo::getSurveyRow(); // Najprej nalozimo mobile template skin echo ' ' . "\n"; if (isset($_GET['theme_profile'])) { $row['skin_profile_mobile'] = (int)$_GET['theme_profile']; } if (isset($_GET['theme'])) { $themePreview = true; $row['mobile_skin'] = str_replace('.css', '', $_GET['theme']); } // Fonti za mobilne skine (vse razen prvega default) if($row['mobile_skin'] != 'Mobile') echo ''; // ni nastavljenih profilov, nastavimo navadno temo if ($row['skin_profile_mobile'] == 0) { if (!is_file(self::$site_path . 'main/survey/skins/' . $row['mobile_skin'] . '.css')) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } } // nastavljen je profil, nastavimo temo in potem še lastne nastavitve else { $sqla = sisplet_query("SELECT skin FROM srv_theme_profiles_mobile WHERE id = '$row[skin_profile_mobile]'"); $rowa = mysqli_fetch_array($sqla); if (!is_file(self::$site_path . 'main/survey/skins/' . $rowa['skin'] . '.css')) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } $sqlt = sisplet_query("SELECT * FROM srv_theme_editor_mobile WHERE profile_id = '" . $row['skin_profile_mobile'] . "'"); if (mysqli_num_rows($sqlt) > 0) { echo ''; } } // Izrisemo css za custom logo $sqla = sisplet_query("SELECT logo FROM srv_theme_profiles WHERE id = '$row[skin_profile]'"); $rowa = mysqli_fetch_array($sqla); if ($rowa['logo'] != '') { $this->customLogoCSS($rowa['logo']); } } // Funkcija ki nalozi custom temo narejeno po narocilu private function loadCustomMadeSkin($custom_skin){ if (isset($_GET['theme'])) $themePreview = true; // to ne bo vec if (isset($_GET['theme-preview']) && $_GET['theme-preview'] == '1') $themePreview = true; // to je pri urejanju CSSa da se refresha mimo cachea // Custom narejen skin za Bled if($custom_skin == 'Bled'){ // Font PT sans echo ''; // Imamo različne backgrounde $bg_number = rand(1,9); echo ''; echo ' ' . "\n"; // Premaknemo footer na dno echo ''; } // Custom skin za MJU anketo elseif($custom_skin == 'MJU'){ // Font PT sans echo ''; // mobitel if (get('mobile') == 1) { echo ' ' . "\n"; } // tablica elseif(get('mobile') == 2){ echo ' ' . "\n"; } // navaden racunalnik else{ echo ' ' . "\n"; } } } // Insertamo css za custom logo private function customLogoCSS($logo){ // Najprej dobimo velikost originalne slike $image_orig = self::$site_url . 'main/survey/uploads/' . $logo; if (file_exists(survey_path('uploads/' . $logo))) { $size_orig = @getimagesize($image_orig); $css_bg_image = $image_orig; $css_width = ''; $css_height = ''; $css_bg_size = 'contain !important'; // Ce gre za Gorenje prikazemo drug logo if(Common::checkModule('gorenje')){ $css_bg_size = 'auto 50px !important'; } // Ce slucajno ne moremo dobiti siza elseif(!$size_orig){ $css_height = '100px'; $css_width = '250px'; } // Ce je original visji kot 160 ga avtomatsko pomanjsamo elseif($size_orig[1] > 160) { $image = self::$site_url . 'function/thumb.php?src=' . self::$site_url . 'main/survey/uploads/' . $logo . '&h=100'; $size = @getimagesize($image); if($size){ $css_bg_image = $image; $css_width = $size[0].'px'; $css_height = '100px'; } } // Drugace pustimo default size logotipa else{ $css_width = $size_orig[0].'px'; $css_height = $size_orig[1].'px'; } // CSS za custom logo echo ''; } } }