summaryrefslogtreecommitdiffstats
path: root/frontend/payments/classes/class.UserAccess.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-05-27 13:08:29 +0200
commit75160b12821f7f4299cce7f0b69c83c1502ae071 (patch)
tree27e25e4ccaef45f0c58b22831164050d1af1d4db /frontend/payments/classes/class.UserAccess.php
parentprvi-commit (diff)
download1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.gz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.bz2
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.lz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.xz
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.tar.zst
1ka-75160b12821f7f4299cce7f0b69c83c1502ae071.zip
Diffstat (limited to 'frontend/payments/classes/class.UserAccess.php')
-rw-r--r--frontend/payments/classes/class.UserAccess.php85
1 files changed, 67 insertions, 18 deletions
diff --git a/frontend/payments/classes/class.UserAccess.php b/frontend/payments/classes/class.UserAccess.php
index 105d4c9..070c723 100644
--- a/frontend/payments/classes/class.UserAccess.php
+++ b/frontend/payments/classes/class.UserAccess.php
@@ -80,6 +80,7 @@ class UserAccess{
'telephone' => 3, // Telefonska anketa
'chat' => 3, // Chat
'panel' => 3, // Panel
+ 'email_access' => 3, // Dostop z emailom
/* Ostale funkcionalnosti */
'prevajanje' => 2, // Vecjezikovna anketa
@@ -120,10 +121,9 @@ class UserAccess{
}
private function __construct($usr_id){
- global $app_settings;
// Ce so paketi onemogoceni nič ne preverjamo
- if(!isset($app_settings['commercial_packages']) || $app_settings['commercial_packages'] == false){
+ if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') !== true){
return;
}
@@ -133,7 +133,11 @@ class UserAccess{
if(isset($_POST['anketa']) || isset($_GET['anketa'])){
$ank_id = (isset($_GET['anketa'])) ? $_GET['anketa'] : $_POST['anketa'];
-
+
+ // Pogledamo, ce smo v izpolnjevanju ankete - imamo hash in pridobimo id iz njega
+ if($_SERVER["SCRIPT_NAME"] == '/main/survey/index.php')
+ $ank_id = getSurveyIdFromHash($ank_id);
+
$sqlU = sisplet_query("SELECT insert_uid FROM srv_anketa WHERE id='".$ank_id."'");
$rowU = mysqli_fetch_array($sqlU);
@@ -163,6 +167,8 @@ class UserAccess{
echo 'Napaka! Manjka ID uporabnika.';
die();
}
+
+
}
@@ -202,12 +208,12 @@ class UserAccess{
private function checkAnketaOld(){
// Ce nismo znotraj ankete ti ignoriramo
- if(!isset($_GET['anketa'])){
+ if(!isset($_GET['anketa']) && !isset($_POST['anketa'])){
return;
}
// Nastavimo id ankete
- $ank_id = $_GET['anketa'];
+ $ank_id = isset($_GET['anketa']) ? $_GET['anketa'] : $_POST['anketa'];
$sqlA = sisplet_query("SELECT insert_time FROM srv_anketa WHERE id='".$ank_id."'");
$rowA = mysqli_fetch_array($sqlA);
@@ -229,13 +235,12 @@ class UserAccess{
// Preverimo ce ima uporabnik dostop do neke funkcionalnosti
public function checkUserAccess($what=''){
- global $app_settings;
global $admin_type;
global $global_user_id;
global $mysql_database_name;
// Ce so paketi onemogoceni vrnemo vedno true
- if(!isset($app_settings['commercial_packages']) || $app_settings['commercial_packages'] == false){
+ if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') !== true){
return true;
}
@@ -277,11 +282,10 @@ class UserAccess{
// Vrnemo paket uporabnika
public function getPackage(){
- global $app_settings;
global $admin_type;
// Ce so paketi onemogoceni vrnemo -1
- if(!isset($app_settings['commercial_packages']) || $app_settings['commercial_packages'] == false){
+ if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') !== true){
return -1;
}
@@ -345,25 +349,44 @@ class UserAccess{
// Kateri paket je potreben za to funkcionalnost
$package_required = (isset($this->functionality_package[$what])) ? $this->functionality_package[$what] : 3;
- $package_required_name = $this->packages[$package_required]['name'];
+ $package_temp = $this->packages[$package_required]['name'];
+ $package_required_name = $lang['paket_opis_'.$package_temp];
if($lang['id'] == '2')
$drupal_url = $site_url.'d/en/purchase/'.$package_required.'/package';
else
$drupal_url = $site_url.'d/izvedi-nakup/'.$package_required.'/podatki';
-
+ echo '<div class="layout_right_item">';
echo '<div class="user_access_warning">';
-
+
+ echo '<div class="no_access_title"> <span class="faicon lock_close yellow"></span>'.$lang['srv_access_no_access_title'].'</div>';
+
// Ce user ni avtor ankete
if($this->user_not_author){
echo '<p>'.$lang['srv_access_no_access_not_author'].'</p>';
}
-
+ echo '<div class="no_access_stavki">';
echo '<p>'.$lang['srv_access_no_access'].' "'.$package_required_name.'".</p>';
+
+ echo '<p>'.$lang['srv_access_no_access_funkcionalnosti_intro'].'</p>';
+
+ echo '<ul class="no_access_list">';
+ echo '<li>'.$lang['srv_access_no_access_funkcionalnost_1'].'</li>';
+ echo '<li>'.$lang['srv_access_no_access_funkcionalnost_2'].'</li>';
+ echo '<li>'.$lang['srv_access_no_access_funkcionalnost_3'].'</li>';
+ echo '<li>'.$lang['srv_access_no_access_funkcionalnost_4'].'</li>';
+ echo '</ul>';
+
+
+ echo '</div>';
+
if(!$this->user_not_author)
- echo '<span class="floatLeft"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_blue" href="'.$drupal_url.'" target="_blank">'.$lang['srv_narocila_buy'].'</a></div></span>';
+ echo '<div class="button_holder top16 upgrade_packet">';
+ echo '<button class="medium yellow upgrade_packet" onClick="window.location.href=\''.$drupal_url.'\'" target="_blank">'.$lang['srv_narocila_buy'].'</button>';
+ echo '</div>';
echo '</div>';
+ echo '</div>';
}
// Izpisemo popup obvestilo, da je funkcionalnost onemogocena in naj kupi paket
@@ -373,22 +396,31 @@ class UserAccess{
// Kateri paket je potreben za to funkcionalnost
$package_required = (isset($this->functionality_package[$what])) ? $this->functionality_package[$what] : 3;
- $package_required_name = $this->packages[$package_required]['name'];
+ $package_temp = $this->packages[$package_required]['name'];
+ $package_required_name = $lang['paket_opis_'.$package_temp];
if($lang['id'] == '2')
$drupal_url = $site_url.'d/en/purchase/'.$package_required.'/package';
else
$drupal_url = $site_url.'d/izvedi-nakup/'.$package_required.'/podatki';
+
+ echo '<h2>'.$lang['srv_access_upgrade'].'</h2>';
+
+ echo '<div class="popup_close"><a href="#" onclick="popupUserAccess_close();">✕</a></div>';
+
// Ce user ni avtor ankete
if($this->user_not_author){
echo '<p>'.$lang['srv_access_no_access_not_author'].'</p>';
}
echo '<p>'.$lang['srv_access_no_access'].' "'.$package_required_name.'".</p>';
+
+ echo '<div class="button_holder">';
+ echo ' <button class="medium white-blue" href="#" onClick="popupUserAccess_close();">'.$lang['srv_zapri'].'</button>';
if(!$this->user_not_author)
- echo '<span class="floatRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_blue" href="'.$drupal_url.'" target="_blank">'.$lang['srv_narocila_buy'].'</a></div></span>';
- echo '<span class="floatRight spaceRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onClick="popupUserAccess_close();">'.$lang['srv_zapri'].'</a></div></span>';
+ echo ' <a href="'.$drupal_url.'" target="_blank"><button class="medium blue">'.$lang['srv_narocila_buy'].'</button></a>';
+ echo '</div>';
}
// Izpisemo obvestilo, da je funkcionalnost onemogocena in naj kupi paket
@@ -402,7 +434,8 @@ class UserAccess{
// Kateri paket je potreben za to funkcionalnost
$package_required = (isset($this->functionality_package[$what])) ? $this->functionality_package[$what] : 3;
- $package_required_name = $this->packages[$package_required]['name'];
+ $package_temp = $this->packages[$package_required]['name'];
+ $package_required_name = $lang['paket_opis_'.$package_temp];
echo '<p class="user_access_warning_text">';
@@ -459,6 +492,22 @@ class UserAccess{
return $what;
}
+ public function getPackageName($package_id) {
+ global $lang;
+
+ $string = '';
+
+ if ($package_id == 1) {
+ $string = $lang['paket_opis_1ka'];
+ } else if($package_id == 2) {
+ $string = $lang['paket_opis_2ka'];
+ } else if($package_id == 3) {
+ $string = $lang['paket_opis_3ka'];
+ }
+
+ return $string;
+ }
+
// Ajax klici
public function ajax(){