aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/mayor-portal/www/include
diff options
context:
space:
mode:
Diffstat (limited to 'mayor-orig/mayor-portal/www/include')
-rw-r--r--mayor-orig/mayor-portal/www/include/menu/parent/hu_HU/module-portal.php11
-rw-r--r--mayor-orig/mayor-portal/www/include/menu/private/hu_HU/module-portal.php43
-rw-r--r--mayor-orig/mayor-portal/www/include/menu/public/hu_HU/module-portal.php8
-rw-r--r--mayor-orig/mayor-portal/www/include/modules/portal/base/rights.php10
-rw-r--r--mayor-orig/mayor-portal/www/include/modules/portal/hirek/egyhir.php47
-rw-r--r--mayor-orig/mayor-portal/www/include/modules/portal/kerdoiv/kerdoivAdmin.php32
-rw-r--r--mayor-orig/mayor-portal/www/include/modules/portal/share/hirek.php51
-rw-r--r--mayor-orig/mayor-portal/www/include/modules/portal/share/kerdoiv.php45
-rw-r--r--mayor-orig/mayor-portal/www/include/modules/portal/share/nevnap.php8
9 files changed, 255 insertions, 0 deletions
diff --git a/mayor-orig/mayor-portal/www/include/menu/parent/hu_HU/module-portal.php b/mayor-orig/mayor-portal/www/include/menu/parent/hu_HU/module-portal.php
new file mode 100644
index 00000000..802a2d6e
--- /dev/null
+++ b/mayor-orig/mayor-portal/www/include/menu/parent/hu_HU/module-portal.php
@@ -0,0 +1,11 @@
+<?php
+
+ if ($page != 'naplo') array_unshift($NAV[1], array('page' => 'naplo'));
+
+ if (is_array($MENU['modules']['portal']['sub'][$sub])) foreach ($MENU['modules']['portal']['sub'][$sub] as $_f => $M) {
+ $NAV[2][] = array('page' => 'portal', 'sub' => $sub, 'f' => $_f);
+ } elseif (is_array($MENU['modules']['portal'])) foreach ($MENU['modules']['portal'] as $_sub => $M) {
+ if ($_sub != 'sub') $NAV[2][] = array('page' => 'portal', 'sub' => $_sub);
+ }
+
+?> \ No newline at end of file
diff --git a/mayor-orig/mayor-portal/www/include/menu/private/hu_HU/module-portal.php b/mayor-orig/mayor-portal/www/include/menu/private/hu_HU/module-portal.php
new file mode 100644
index 00000000..eeb70da8
--- /dev/null
+++ b/mayor-orig/mayor-portal/www/include/menu/private/hu_HU/module-portal.php
@@ -0,0 +1,43 @@
+<?php
+
+ if (defined('__HIREKADMIN') && __HIREKADMIN === true) {
+// $MENU['portal'] = array(array('txt' => 'Portál', 'url' => 'index.php?page=portal&sub=hirek&f=egyhir'));
+ $MENU['portal'] = array(array('txt' => 'Kezdőlap', 'url' => 'index.php'));
+ $MENU['modules']['portal']['hirek'] = array(array('txt'=>'Hírek szerkesztése','url'=>'index.php?page=portal&sub=hirek&f=hirekAdmin'));
+ $MENU['modules']['portal']['sub']['hirek'] = array(
+ 'hirekAdmin'=>array(array('txt' => 'Hírek')),
+ 'egyhir'=>array(array('txt' => 'Új hír')),
+// array('txt' => 'Új kérdés', 'url' => 'index.php?page=portal&sub=kerdoiv&f=kerdoivAdmin')
+ );
+ $MENU['modules']['portal']['kerdoiv'] = array(
+ array('txt' => 'Új kérdés', 'url' => 'index.php?page=portal&sub=kerdoiv&f=kerdoivAdmin')
+ );
+
+ //if ($page != 'portal')
+ // $NAV[1][] = array('page'=>'portal', 'sub' => 'hirek');
+ } else {
+ /* Mégse rakjuk ki a többieknek */
+ // $MENU['portal'] = array(array('txt' => 'Hír beküldése', 'url' => 'index.php?page=portal&sub=hirek&f=egyhir'));
+ }
+
+// if (memberOf(_USERACCOUNT, $AUTH[_POLICY]['adminGroup'])) {
+// $NAV[1][] = array('page'=>'session');
+// } else {
+// $NAV[1][] = array('page'=>'session','f'=>'changeMyPassword');
+// }
+
+ //if ($page != 'naplo') $NAV[1][] = array('page' => 'naplo');
+
+
+
+if ($page=='portal') {
+ if (is_array($MENU['modules']['portal']['sub'][$sub])) foreach ($MENU['modules']['portal']['sub'][$sub] as $_f => $M) {
+ $NAV[2][] = array('page' => 'portal', 'sub' => $sub, 'f' => $_f);
+ } elseif (is_array($MENU['modules']['portal'])) foreach ($MENU['modules']['portal'] as $_sub => $M) {
+ if ($_sub != 'sub') $NAV[2][] = array('page' => 'portal', 'sub' => $_sub);
+ }
+}
+
+
+
+?>
diff --git a/mayor-orig/mayor-portal/www/include/menu/public/hu_HU/module-portal.php b/mayor-orig/mayor-portal/www/include/menu/public/hu_HU/module-portal.php
new file mode 100644
index 00000000..53b4315c
--- /dev/null
+++ b/mayor-orig/mayor-portal/www/include/menu/public/hu_HU/module-portal.php
@@ -0,0 +1,8 @@
+<?php
+/*
+ module: naplo
+*/
+
+// $MENU['portal'] = array(array('txt' => 'Portál', 'url' => 'index.php?page=portal'));
+
+?>
diff --git a/mayor-orig/mayor-portal/www/include/modules/portal/base/rights.php b/mayor-orig/mayor-portal/www/include/modules/portal/base/rights.php
new file mode 100644
index 00000000..c1a5c039
--- /dev/null
+++ b/mayor-orig/mayor-portal/www/include/modules/portal/base/rights.php
@@ -0,0 +1,10 @@
+<?php
+
+ if (_POLICY=='private' && @memberOf(_USERACCOUNT, 'hirekadmin')) {
+ $AUTH['my']['categories'][] = 'hirekadmin';
+ define('__HIREKADMIN',true);
+ } else {
+ define('__HIREKADMIN',false);
+ }
+
+?>
diff --git a/mayor-orig/mayor-portal/www/include/modules/portal/hirek/egyhir.php b/mayor-orig/mayor-portal/www/include/modules/portal/hirek/egyhir.php
new file mode 100644
index 00000000..c93a81bd
--- /dev/null
+++ b/mayor-orig/mayor-portal/www/include/modules/portal/hirek/egyhir.php
@@ -0,0 +1,47 @@
+<?php
+
+ function saveHir($DATA) {
+ global $LANGUAGES;
+
+ $cim = $DATA['cim'];
+ $txt = $DATA['txt'];
+ $pic = $DATA['pic'];
+ $owner = $DATA['owner'];
+ $hirId = $DATA['hirId'];
+ $kdt = $DATA['kdt'];
+ $vdt = $DATA['vdt'];
+ $flag = intval($DATA['flag']);
+ $class = intval($DATA['class']);
+ $lang = (in_array($DATA['lang'],$LANGUAGES)) ? $DATA['lang'] : _DEFAULT_LANG;
+ if ($DATA['cid']>0) $cid = $DATA['cid'];
+ $csoport = $DATA['csoport'];
+ if ($hirId!='' && __HIREKADMIN == false ) {
+ $q = "SELECT owner FROM hirek WHERE owner='%s'";
+ $v = array($owner);
+ $_owner = db_query($q,array('modul'=>'portal','result'=>'value','values'=>$v));
+ $isOwner = ($_owner===$owner);
+ } else $isOwner = false;
+ if ($hirId=='') {
+ $keys = array('`pic`','`owner`','`cim`','`txt`','`kdt`','`vdt`','`flag`','`class`','`lang`','`csoport`');
+ $pattern = array("'%s'","'%s'","'%s'","'%s'","'%s'","'%s'","%u","%u","'%s'","'%s'");
+ $v = array($pic,$owner,$cim,$txt,$kdt,$vdt,$flag,$class,$lang,$csoport);
+ if (isset($cid)) {
+ $keys[] = 'cid';
+ $pattern[] = '%u';
+ $v[] = $cid;
+ }
+ $q = "insert INTO `hirek` (".implode(',',$keys).") VALUES (".implode(',',$pattern).")";
+ } elseif (isset($hirId) && (__HIREKADMIN || $isOwner)) {
+ if (isset($cid)) {
+ $q = "update `hirek` SET pic='%s', cim='%s', txt='%s',kdt='%s',vdt='%s',flag=%u,class=%u,lang='%s',csoport='%s',cid=%u WHERE id=%u";
+ $v = array($pic,$cim,$txt,$kdt,$vdt,$flag,$class,$lang,$csoport, $cid, $hirId);
+ } else {
+ $q = "update `hirek` SET pic='%s', cim='%s', txt='%s',kdt='%s',vdt='%s',flag=%u,class=%u,lang='%s',csoport='%s' WHERE id=%u";
+ $v = array($pic,$cim,$txt,$kdt,$vdt,$flag,$class,$lang,$csoport, $hirId);
+ }
+ } else $q = '';
+ if ($q!='') $r = db_query($q,array('modul'=>'portal','result'=>'insert','values'=>$v));
+ return $r;
+ }
+
+?>
diff --git a/mayor-orig/mayor-portal/www/include/modules/portal/kerdoiv/kerdoivAdmin.php b/mayor-orig/mayor-portal/www/include/modules/portal/kerdoiv/kerdoivAdmin.php
new file mode 100644
index 00000000..237b6dc6
--- /dev/null
+++ b/mayor-orig/mayor-portal/www/include/modules/portal/kerdoiv/kerdoivAdmin.php
@@ -0,0 +1,32 @@
+<?php
+
+ function addKerdoiv($kerdes, $valaszok) {
+
+ $v = $Pattern = array();
+ // ellenőrizük, hogy van-e válasz...
+ for ($i = 0; $i < count($valaszok); $i++) if ($valaszok[$i] != '') {
+ $Pattern[] = "(%u, '%s')";
+ }
+
+ if (count($Pattern) > 0) {
+ // A kérdés felvétele
+ $q = "INSERT INTO kerdesek (vszam,kerdes) VALUES (%u,'%s')";
+ $kszam = db_query($q, array('fv' => 'addKerdoiv', 'modul' => 'portal', 'result' => 'insert', 'values' => array(count($valaszok), $kerdes)));
+ // A válaszok rögzítése
+ for ($i = 0; $i < count($valaszok); $i++) if ($valaszok[$i] != '') { $v[] = $kszam; $v[] = $valaszok[$i]; }
+ $q = "INSERT INTO valaszok (kszam,valasz) VALUES ".implode(',', $Pattern);
+ return db_query($q, array('fv' => 'addKerdoiv', 'modul' => 'portal', 'values' => $v));
+ } else {
+ return false;
+ }
+ }
+
+ function delKerdoivKerdes($kerdesek) {
+ $q = "DELETE FROM kerdesek WHERE sorszam IN (".implode(',',array_fill(0, count($kerdesek), '%u')).")";
+ $v = $kerdesek;
+ db_query($q, array('fv' => 'delKeroivKerdes', 'modul' => 'portal', 'values'=>$v));
+ $q = "DELETE FROM valaszok WHERE kszam IN (".implode(',',array_fill(0, count($kerdesek), '%u')).")";
+ db_query($q, array('fv' => 'delKeroivKerdes', 'modul' => 'portal', 'values'=>$v));
+ }
+
+?>
diff --git a/mayor-orig/mayor-portal/www/include/modules/portal/share/hirek.php b/mayor-orig/mayor-portal/www/include/modules/portal/share/hirek.php
new file mode 100644
index 00000000..5aa3bdc9
--- /dev/null
+++ b/mayor-orig/mayor-portal/www/include/modules/portal/share/hirek.php
@@ -0,0 +1,51 @@
+<?php
+
+ function isOwner($hirId) {
+ if ($hirId=='') return false;
+ $q = "SELECT owner FROM hirek WHERE id=%u";
+ $r = db_query($q,array('modul'=>'portal','result'=>'value','values'=>array($hirId)));
+ return ($r === _USERACCOUNT);
+ }
+
+ function getKategoriak() {
+ $q = "SELECT * FROM kategoriak ORDER BY leiras";
+ $r = db_query($q,array('modul'=>'portal','result'=>'indexed'));
+ return $r;
+ }
+
+ function getHirek($SET = array('all'=>true,'tolDt'=>'', 'igDt'=>'', 'id' => '', 'flag'=>array(), 'class'=>array(), 'cid'=>array(), 'limit'=>'', 'lang'=>'hu_HU') ) {
+
+ $tolDt = $SET['tolDt']; $igDt = $SET['igDt'];
+ if ($tolDt!='') $W[] = "kdt<='$tolDt'";
+ if ($igDt!='') $W[] = "vdt>='$igDt'";
+ if (count($SET['flag'])>0) $W[] = "flag IN (".implode(',',$SET['flag']).")";
+ if (count($SET['class'])>0) $W[] = "class IN (".implode(',',$SET['class']).")";
+ if (count($SET['cid'])>0) $W[] = "cid IN (".implode(',',$SET['cid']).")";
+ if ($SET['lang']!='') $W[] = "lang='".$SET['lang']."'";
+
+ if ($SET['limit']!='') $L = ' LIMIT '.$SET['limit'];
+ if ($SET['id']!='') $W[] = 'id='.$SET['id'];
+
+ if ($SET['id']=='') {
+ if (is_array($SET['csoport'])) {
+ for ($i=0; $i<count($SET['csoport']); $i++) {
+ $GW[] = "csoport like '%".$SET['csoport'][$i]."%'";
+ }
+ if (count($GW)>0) $WOR = ' OR '.implode(' OR ',$GW);
+ } else {
+ $WOR = '';
+ }
+ $W[] = '(csoport="" '.$WOR.')';
+ }
+ if (is_array($W) && count($W)>0) {
+ $WHERE = "WHERE ".implode(' AND ',$W);
+ } else $WHERE = '';
+
+ //hack
+ if ($SET['all']===true) $WHERE='';
+ $q = "SELECT * FROM hirek $WHERE ORDER BY kdt DESC,vdt DESC".$L;
+ $HIREK['szovegek'] = db_query($q, array('modul'=>'portal','result'=>'indexed'));
+ return $HIREK;
+ }
+
+?>
diff --git a/mayor-orig/mayor-portal/www/include/modules/portal/share/kerdoiv.php b/mayor-orig/mayor-portal/www/include/modules/portal/share/kerdoiv.php
new file mode 100644
index 00000000..36a7e8b1
--- /dev/null
+++ b/mayor-orig/mayor-portal/www/include/modules/portal/share/kerdoiv.php
@@ -0,0 +1,45 @@
+<?php
+
+ function getKerdoiv($policy='public') {
+
+ $v = array($policy);
+ $q = "select * from kerdesek where sorszam=(select max(sorszam) from kerdesek WHERE policy='%s')";
+ $R['kerdes'] = db_query($q, array('fv' => 'getKerdoiv', 'modul' => 'portal', 'values'=>$v,'result' => 'record'));
+
+ $q = "select * from valaszok where kszam=(select max(sorszam) from kerdesek WHERE policy='%s')";
+ $R['valaszok'] = db_query($q, array('fv' => 'getKerdoiv', 'modul' => 'portal', 'result' => 'indexed', 'values'=>$v, 'keyfiled' => 'kszam'));
+ return $R;
+
+ }
+
+ function szavazotte($kerdoivId) {
+ if (defined('_USERACCOUNT') && defined('_POLICY') && _USERACCOUNT!='' && _POLICY != '') {
+ $q = "SELECT count(*) AS db FROM kerdoivSzavazott WHERE kerdoivId=%u AND policy='%s' AND userAccount='%s'";
+ $v = array($kerdoivId, _POLICY, _USERACCOUNT);
+ return (db_query($q, array('fv' => 'szavaz', 'modul' => 'portal', 'result'=>'value','values' => $v))>0);
+ } else {
+ if (isset($_SESSION['kerdoivSzavazott']))
+ return true;
+ else
+ return false;
+ }
+ }
+
+ function szavaz($id, $db = 1, $kerdoivId) {
+ if (defined('_USERACCOUNT') && defined('_POLICY')) {
+ $q = "INSERT INTO kerdoivSzavazott (kerdoivId,policy,userAccount) VALUES (%u,'%s','%s')";
+ $v = array($kerdoivId, _POLICY, _USERACCOUNT);
+ db_query($q, array('fv' => 'szavaz', 'modul' => 'portal', 'values' => $v));
+ }
+ $q = "UPDATE valaszok SET pontszam=pontszam + (%u) WHERE sorszam=%u";
+ $v = array($db, $id);
+ return db_query($q, array('fv' => 'szavaz', 'modul' => 'portal', 'values' => $v));
+ }
+
+ function getRegiKerdesek() {
+ $q = "SELECT * FROM kerdesek ORDER BY sorszam DESC LIMIT 10";
+ return db_query($q, array('modul'=>'portal','result'=>'indexed'));
+ }
+
+
+?> \ No newline at end of file
diff --git a/mayor-orig/mayor-portal/www/include/modules/portal/share/nevnap.php b/mayor-orig/mayor-portal/www/include/modules/portal/share/nevnap.php
new file mode 100644
index 00000000..7a9ae971
--- /dev/null
+++ b/mayor-orig/mayor-portal/www/include/modules/portal/share/nevnap.php
@@ -0,0 +1,8 @@
+<?php
+
+ function getNevnap($ho,$nap) {
+ $v = array($ho,$nap);
+ return db_query("SELECT `nevnap` FROM `nevnap` WHERE `honap`=%u AND `nap`=%u", array('modul'=>'portal','values'=>$v,'result'=>'value'));
+ }
+
+?>