diff options
author | M.Gergo | 2018-12-16 16:35:17 +0100 |
---|---|---|
committer | M.Gergo | 2018-12-16 16:35:17 +0100 |
commit | e6988247360fa98b85915a38803d018dd353df00 (patch) | |
tree | 24f42628f6cdaedacc06ce033378173a0e561be9 /mayor-orig/www/include | |
parent | 2a219b9ea312fb88703a33ea2450e32af40be64a (diff) | |
download | mayor-e6988247360fa98b85915a38803d018dd353df00.tar.gz mayor-e6988247360fa98b85915a38803d018dd353df00.zip |
Rev: 4412
Diffstat (limited to 'mayor-orig/www/include')
16 files changed, 95 insertions, 26 deletions
diff --git a/mayor-orig/www/include/base/base.php b/mayor-orig/www/include/base/base.php index dd620a41..378b31fd 100644 --- a/mayor-orig/www/include/base/base.php +++ b/mayor-orig/www/include/base/base.php @@ -126,13 +126,20 @@ function page($page, $sub, $f, $lang, $skin, $policy = _DEFAULT_POLICY) { global $_JSON; if (html_alert($_SESSION['alert'])) { // A figyelmeztető üzenet letilthatja az oldal további megjelenítését. - if ($sub != '') { $load = "$sub/$f"; } else { $load = $f; } + // --TEST $API_DICTIONARY['api']['naplo']['orarend']['orarend'] = true; + if ($skin=='api') { + $_JSON['api']['version'] = '1.0'; + if (isset($API_DICTIONARY[$skin][$page][$sub][$f])===false) { // --TODO API_DICTIONARY + return false; + } + } + if (file_exists("policy/$policy/$page/$load.php")) { if (file_exists("lang/$lang/module-$page/base.php")) { require_once("lang/$lang/module-$page/base.php"); @@ -146,20 +153,19 @@ function page($page, $sub, $f, $lang, $skin, $policy = _DEFAULT_POLICY) { } if (file_exists("skin/$skin/module-$page/html/base.phtml")) { require_once("skin/$skin/module-$page/html/base.phtml"); - } elseif (file_exists("skin/"._DEFAULT_SKIN."/module-$page/html/base.phtml")) { + } elseif ($skin!=='api' && file_exists("skin/"._DEFAULT_SKIN."/module-$page/html/base.phtml")) { // api esetén nem töltjük be a default skin phtml-t require_once("skin/"._DEFAULT_SKIN."/module-$page/html/base.phtml"); } if (file_exists("skin/$skin/module-$page/html/$load.phtml")) { require_once("skin/$skin/module-$page/html/$load.phtml"); - } elseif (file_exists("skin/"._DEFAULT_SKIN."/module-$page/html/$load.phtml")) { + } elseif ($skin!=='api' && file_exists("skin/"._DEFAULT_SKIN."/module-$page/html/$load.phtml")) { // api esetén nem töltjük be a default skin phtml-t require_once("skin/"._DEFAULT_SKIN."/module-$page/html/$load.phtml"); } + $_JSON['api']['debug'] = serialize($page.$load); include("policy/$policy/$page/$load.php"); - //szamlal($policy,$page); } elseif (file_exists("static/$lang/$page/$load.html")) { include("static/$lang/$page/$load.html"); - //szamlal($policy,$page); } else { //??? ha már kiírtuk a hibaüzeneteket, újabbat nem írhatunk ki sajnos :( html_alert(array('page:page_missing:'."[$page]:[$sub]:[$f]")); --> rights.php } diff --git a/mayor-orig/www/include/base/config.php b/mayor-orig/www/include/base/config.php index 4a234fcf..28f711cb 100644 --- a/mayor-orig/www/include/base/config.php +++ b/mayor-orig/www/include/base/config.php @@ -31,7 +31,7 @@ if (!defined('_SECURECOOKIE')) define('_SECURECOOKIE', true); define('_BASE_URL',( ($_SERVER['HTTPS']=='on')?"https://".$_SERVER['SERVER_NAME']:"http://".$_SERVER['SERVER_NAME'] )); /* classic, blue, ajax + rpc, + cron kiegészítés */ -$SKINS = @array_unique(array_merge($SKINS,array('classic','blue','ajax','rpc','gray','cron'))); +$SKINS = @array_unique(array_merge($SKINS,array('classic','blue','ajax','rpc','gray','cron','api'))); $SKINSSHOW = @array_unique(array_merge($SKINSSHOW,array('classic','vakbarat','gray'))); if (is_array($POLICIES) && defined('_CONFIGDIR')) { diff --git a/mayor-orig/www/include/menu/private/hu_HU/module-naplo.php b/mayor-orig/www/include/menu/private/hu_HU/module-naplo.php index d6a09aa2..73e66f5b 100644 --- a/mayor-orig/www/include/menu/private/hu_HU/module-naplo.php +++ b/mayor-orig/www/include/menu/private/hu_HU/module-naplo.php @@ -152,6 +152,9 @@ 'stat' => array(array('txt' => 'Haladási statisztika')), 'elszamolas' => array(array('txt' => 'Munkaidő')), ); + if (MAYOR_SOCIAL === true) { + $MENU['modules']['naplo']['sub']['haladasi']['helyettesites'] = array(array('txt' => 'Helyettesítés kezelés')); + } $MENU['modules']['naplo']['sub']['hianyzas'] = array( 'osztaly' => array(array('txt' => 'Osztály hiányzásösszesítő')), 'osztalyNap' => array(array('txt' => 'Osztály napi hiányzásösszesítő')), @@ -420,7 +423,7 @@ ); $MENU['modules']['naplo']['sub']['haladasi'] = array( - 'helyettesites' => array(array('txt' => 'Helyettesítés')), + 'helyettesites' => array(array('txt' => 'Helyettesítés kiírás')), 'pluszora' => array(array('txt' => 'Plusz óra')), 'minuszora' => array(array('txt' => 'Óra elmaradás')), 'osszevonas' => array(array('txt' => 'Összevonás', 'rejtett' => true)), diff --git a/mayor-orig/www/include/modules/naplo/orarend/convert-eKréta import.php b/mayor-orig/www/include/modules/naplo/orarend/convert-eKréta import.php index 6639192a..cac44633 100644 --- a/mayor-orig/www/include/modules/naplo/orarend/convert-eKréta import.php +++ b/mayor-orig/www/include/modules/naplo/orarend/convert-eKréta import.php @@ -12,10 +12,11 @@ Ebben egy sor egy óra adatait tartalmazza - akár az orarendiOra adatbázis egy rekordja. Feltételezzük, hogy a tanárnevek _pontosan_ megegyeznek a naplóbeli nevekkel, továbbá a termek rövid neve az azonosító számuk. - A szkript kezeli a blokkokat, ezeket szétbontja különrekordokra + A szkript kezeli a blokkokat, ezeket szétbontja külön rekordokra (???) + + 0. Óra érvényességének kezdete - yyyy.mm.dd formátumú dátum - eldobjuk - de előfordul, hogy eleve nincs is... + 1. Őra érvényességének vége - yyyy.mm.dd formátumú dátum - eldobjuk - de előfordul, hogy eleve nincs is... - 0. Óra érvényességének kezdete - yyyy.mm.dd formátumú dátum - eldobjuk - 1. Őra érvényességének vége - yyyy.mm.dd formátumú dátum - eldobjuk 2. Hetirend - Minden héten/A hét/B hét - 1. hét esetén az első kettő, 2. esetén az 1. és a harmadik érvényes - többit eldobjuk 3. Nap - a nap magyar neve - konvertáljuk hétfő --> 1, ..., vasárnap --> 7 alakra 4. Óra (az adott napon belül) - pozitív egész szám - --> ora @@ -30,7 +31,9 @@ require_once('include/modules/naplo/share/tanar.php'); - function terem2teremId($terem) { + $vanErvenyesseg = false; + + function terem2teremId($terem) { // -- TODO kretaNev if ($terem == 'könyvtár') return 12; else if ($terem == 'fonotéka') return 13; else if ($terem == 'studió') return 14; @@ -50,8 +53,13 @@ $OrarendiOra = array(); $Napok = array('hétfő'=>1, 'kedd'=>2, 'szerda'=>3, 'csütörtök'=>4, 'péntek'=>5, 'szombat'=>6, 'vasárnap'=>7); - $Tanarok = getTanarok(array('tanev' => __TANEV, 'result' => 'assoc')); - foreach ($Tanarok as $tanarId => $tanarAdat) $Tanar[ $tanarAdat['tanarNev'] ] = $tanarId; + $Tanarok = getTanarok(array('tanev' => __TANEV, 'result' => 'assoc', 'extraAttrs' => 'kretaNev')); + + foreach ($Tanarok as $tanarId => $tanarAdat) { + if ($tanarAdat['tanarNev']!='') $Tanar[ $tanarAdat['tanarNev'] ] = $tanarId; + if ($tanarAdat['kretaNev']!='') $Tanar[ $tanarAdat['kretaNev'] ] = $tanarId; + } + /* VMG további HACK!!! --TODO */ $Tanar['Pintér László (1961. 03. 14.)'] = $Tanar['Pintér László']; $Tanar['Pintér László (1975. 02. 25.)'] = $Tanar['Pintér László Sp']; $Tanar['Balkayné Kalló Ágnes Zsófia'] = $Tanar['Balkayné Kalló Ágnes']; @@ -66,7 +74,7 @@ $Tanar['Csapody Barbara Mária'] = $Tanar['Csapody Barbara']; $Tanar['dr Szabóné Karácsonyi Virág'] = $Tanar['dr. Szabóné Karácsonyi Virág']; $Tanar['dr Kas Géza Imre'] = $Tanar['Dr. Kas Géza Imre']; - + $fp = fopen($ADAT['fileName'], 'r'); if (!$fp) return false; @@ -79,6 +87,7 @@ while ($sor = fgets($fp, 1024)) { $rec = explode(' ', chop($sor)); + if (!$vanErvenyesseg) array_unshift($rec, "", ""); $nap = $Napok[$rec[3]]; $ora = $rec[4]; diff --git a/mayor-orig/www/include/modules/naplo/share/ora.php b/mayor-orig/www/include/modules/naplo/share/ora.php index 40b2650d..b41bc7b8 100644 --- a/mayor-orig/www/include/modules/naplo/share/ora.php +++ b/mayor-orig/www/include/modules/naplo/share/ora.php @@ -15,6 +15,7 @@ kit, ora.tankorId AS tankorId, teremId, + ".__INTEZMENYDBNEV.".terem.leiras AS teremLeiras, ora.leiras AS leiras, ora.tipus AS tipus, eredet, @@ -28,6 +29,7 @@ LEFT JOIN ".__INTEZMENYDBNEV.".tanar AS t1 ON ki=t1.tanarId LEFT JOIN ".__INTEZMENYDBNEV.".tanar AS t2 ON kit=t2.tanarId LEFT JOIN ".__INTEZMENYDBNEV.".feladatTipus USING (feladatTipusId) + LEFT JOIN ".__INTEZMENYDBNEV.".terem USING (teremId) WHERE oraId=%u AND (tanev=%u OR feladatTipusId IS NOT NULL)"; $v = array(tanevDbNev(__INTEZMENY, $tanev), $oraId, $tanev); return db_query($q, array('fv' => 'getOraAdatById', 'modul' => 'naplo_intezmeny', 'result' => 'record', 'values' => $v), $olr); diff --git a/mayor-orig/www/include/modules/naplo/share/terem.php b/mayor-orig/www/include/modules/naplo/share/terem.php index 954f5fbe..0c00c89a 100644 --- a/mayor-orig/www/include/modules/naplo/share/terem.php +++ b/mayor-orig/www/include/modules/naplo/share/terem.php @@ -124,19 +124,25 @@ if (is_array($ADAT['foglaltTermek'][ $ADAT['teremId'] ])) { $return = $ADAT['foglaltTermek'][ $ADAT['teremId'] ]['tanarId']; // A foglalt terem felszabadítása - $q = "UPDATE `%s`.orarendiOra SET teremId=NULL WHERE tolDt<='%s' AND '%s'<=igDt AND het=%u AND nap=%u AND ora=%u AND teremId=%u"; + $q = "UPDATE `%s`.orarendiOra SET teremId=NULL WHERE tolDt<='%s' AND ('%s'<=igDt OR igDt IS NULL) AND het=%u AND nap=%u AND ora=%u AND teremId=%u"; $v = array($tanevDb, $dt, $dt, $ADAT['het'], $ADAT['nap'], $ADAT['ora'], $ADAT['teremId']); db_query($q, array('fv' => 'teremModositas/foglalt terem felszabadítása', 'modul' => 'naplo', 'values' => $v)); } // teremhozzárendelés módosítása if ($ADAT['teremId']>0) { - $q = "UPDATE `%s`.orarendiOra SET teremId=%u WHERE tolDt <= '%s' AND '%s' <= igDt AND het=%u AND nap=%u AND ora=%u AND tanarId=%u"; + $q = "UPDATE `%s`.orarendiOra SET teremId=%u WHERE tolDt <= '%s' AND ('%s' <= igDt OR igDt IS NULL) AND het=%u AND nap=%u AND ora=%u AND tanarId=%u"; $v = array($tanevDb, $ADAT['teremId'], $dt, $dt, $ADAT['het'], $ADAT['nap'], $ADAT['ora'], $ADAT['tanarId']); } else { - $q = "UPDATE `%s`.orarendiOra SET teremId=NULL WHERE tolDt <= '%s' AND '%s' <= igDt AND het=%u AND nap=%u AND ora=%u AND tanarId=%u AND teremId IS NOT NULL"; + $q = "UPDATE `%s`.orarendiOra SET teremId=NULL WHERE tolDt <= '%s' AND ('%s' <= igDt OR igDt IS NULL) AND het=%u AND nap=%u AND ora=%u AND tanarId=%u AND teremId IS NOT NULL"; $v = array($tanevDb, $dt, $dt, $ADAT['het'], $ADAT['nap'], $ADAT['ora'], $ADAT['tanarId']); } - db_query($q, array('debug'=>true,'fv' => 'teremModositas/foglalt terem felszabadítása', 'modul' => 'naplo', 'values' => $v)); + db_query($q, array('debug'=>false,'fv' => 'teremModositas/foglalt terem felszabadítása', 'modul' => 'naplo', 'values' => $v)); + + if (MAYOR_SOCIAL === true && $ADAT['oraId']>0) { + $q = "UPDATE ora SET teremId = NULL WHERE ora=%u AND oraId=%u"; + $v = array($ADAT['ora'], $ADAT['oraId']); + db_query($q, array('fv' => 'teremModositas/foglalt terem felszabadítása', 'modul' => 'naplo', 'values' => $v)); + } return $return; diff --git a/mayor-orig/www/include/modules/session/accountInfo.php b/mayor-orig/www/include/modules/session/accountInfo.php index 4b1521d0..b670312f 100644 --- a/mayor-orig/www/include/modules/session/accountInfo.php +++ b/mayor-orig/www/include/modules/session/accountInfo.php @@ -45,4 +45,34 @@ } + function setEduroamRecord($ADAT) { + + // ALTER TABLE eduroam ADD UNIQUE INDEX (userAccount,policy); + // ALTER TABLE eduroam ADD UNIQUE INDEX (eduroamUID); + // https://wiki.niif.hu/index.php?title=Sulinet_felhaszn%C3%A1l%C3%B3k_t%C3%B6meges_felvitele + + $q = "UPDATE eduroam SET eduroamPASSWORD='%s', modositasDt = NOW() WHERE userAccount='%s' AND policy='%s'"; + $res = db_query($q, array('modul'=>'login','values'=>array($ADAT['eduroamPASSWORD'],$userAccount,$toPolicy))); + + } + + function getEduroamSettings($userAccount,$toPolicy,$ADAT) { + + $res = false; + if (_ACCESS_AS == _ADMIN_ACCESS) { + $userAccoungt = ($userAccount); + $toPolicy = ($toPolicy); + } else { + $userAccount = (_USERACCOUNT); + $toPolicy = (_POLICY); + } + + if ($toPolicy == 'private') { + $q = "SELECT * FROM eduroam WHERE userAccount='%s' AND policy='%s'"; + $res = db_query($q, array('modul'=>'login','values'=>array($userAccount,$toPolicy), 'result'=>'record')); + } + return $res; + + } + ?> diff --git a/mayor-orig/www/include/share/facebook/Exceptions/FacebookResponseException.php b/mayor-orig/www/include/share/facebook/Exceptions/FacebookResponseException.php index 60fd5cfc..4a135db1 100644 --- a/mayor-orig/www/include/share/facebook/Exceptions/FacebookResponseException.php +++ b/mayor-orig/www/include/share/facebook/Exceptions/FacebookResponseException.php @@ -113,7 +113,9 @@ class FacebookResponseException extends FacebookSDKException // API Throttling case 4: case 17: + case 32: case 341: + case 613: return new static($response, new FacebookThrottleException($message, $code)); // Duplicate Post diff --git a/mayor-orig/www/include/share/facebook/Facebook.php b/mayor-orig/www/include/share/facebook/Facebook.php index 4b444530..2e789ca2 100644 --- a/mayor-orig/www/include/share/facebook/Facebook.php +++ b/mayor-orig/www/include/share/facebook/Facebook.php @@ -53,7 +53,7 @@ class Facebook /** * @const string Version number of the Facebook PHP SDK. */ - const VERSION = '5.6.1'; + const VERSION = '5.6.3'; /** * @const string Default Graph API version for requests. diff --git a/mayor-orig/www/include/share/facebook/FacebookBatchRequest.php b/mayor-orig/www/include/share/facebook/FacebookBatchRequest.php index 3d5d5d56..9297e77d 100644 --- a/mayor-orig/www/include/share/facebook/FacebookBatchRequest.php +++ b/mayor-orig/www/include/share/facebook/FacebookBatchRequest.php @@ -39,7 +39,7 @@ class FacebookBatchRequest extends FacebookRequest implements IteratorAggregate, /** * @var array An array of FacebookRequest entities to send. */ - protected $requests; + protected $requests = []; /** * @var array An array of files to upload. diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphNode.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphNode.php index 061e7449..a81c47b7 100644 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphNode.php +++ b/mayor-orig/www/include/share/facebook/GraphNodes/GraphNode.php @@ -150,7 +150,8 @@ class GraphNode extends Collection 'backdated_time', 'issued_at', 'expires_at', - 'publish_time' + 'publish_time', + 'joined' ], true); } diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphPage.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphPage.php index 3dfb0e03..503b96b5 100644 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphPage.php +++ b/mayor-orig/www/include/share/facebook/GraphNodes/GraphPage.php @@ -144,4 +144,14 @@ class GraphPage extends GraphNode { return $this->getField('perms'); } + + /** + * Returns the `fan_count` (Number of people who likes to page) as int if present. + * + * @return int|null + */ + public function getFanCount() + { + return $this->getField('fan_count'); + } } diff --git a/mayor-orig/www/include/share/facebook/GraphNodes/GraphUser.php b/mayor-orig/www/include/share/facebook/GraphNodes/GraphUser.php index c50d7efd..6e1ed8f5 100644 --- a/mayor-orig/www/include/share/facebook/GraphNodes/GraphUser.php +++ b/mayor-orig/www/include/share/facebook/GraphNodes/GraphUser.php @@ -123,7 +123,7 @@ class GraphUser extends GraphNode /** * Returns the users birthday, if available. * - * @return \DateTime|null + * @return Birthday|null */ public function getBirthday() { diff --git a/mayor-orig/www/include/share/facebook/Helpers/FacebookRedirectLoginHelper.php b/mayor-orig/www/include/share/facebook/Helpers/FacebookRedirectLoginHelper.php index 4a0755a4..3240ba81 100644 --- a/mayor-orig/www/include/share/facebook/Helpers/FacebookRedirectLoginHelper.php +++ b/mayor-orig/www/include/share/facebook/Helpers/FacebookRedirectLoginHelper.php @@ -222,8 +222,8 @@ class FacebookRedirectLoginHelper $this->resetCsrf(); $redirectUrl = $redirectUrl ?: $this->urlDetectionHandler->getCurrentUrl(); - // At minimum we need to remove the state param - $redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['state']); + // At minimum we need to remove the 'state' and 'code' params + $redirectUrl = FacebookUrlManipulator::removeParamsFromUrl($redirectUrl, ['code', 'state']); return $this->oAuth2Client->getAccessTokenFromCode($code, $redirectUrl); } diff --git a/mayor-orig/www/include/share/facebook/HttpClients/FacebookCurlHttpClient.php b/mayor-orig/www/include/share/facebook/HttpClients/FacebookCurlHttpClient.php index 059e75a5..9516cc83 100644 --- a/mayor-orig/www/include/share/facebook/HttpClients/FacebookCurlHttpClient.php +++ b/mayor-orig/www/include/share/facebook/HttpClients/FacebookCurlHttpClient.php @@ -98,7 +98,7 @@ class FacebookCurlHttpClient implements FacebookHttpClientInterface CURLOPT_URL => $url, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => $timeOut, - CURLOPT_RETURNTRANSFER => true, // Follow 301 redirects + CURLOPT_RETURNTRANSFER => true, // Return response as string CURLOPT_HEADER => true, // Enable header processing CURLOPT_SSL_VERIFYHOST => 2, CURLOPT_SSL_VERIFYPEER => true, diff --git a/mayor-orig/www/include/share/ssl/ssl.php b/mayor-orig/www/include/share/ssl/ssl.php index 0b6e2e04..61b6ca1b 100644 --- a/mayor-orig/www/include/share/ssl/ssl.php +++ b/mayor-orig/www/include/share/ssl/ssl.php @@ -431,7 +431,7 @@ function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzAB $this->sessionKey = $this->_sessionKeyDecode($PACKED['sessionKeyEncoded']); if ($this->_verifyHash($PACKED)) { $this->incomingRequest = $this->_unpackData($PACKED); -openlog("MaYoR Interconnect", LOG_PID | LOG_PERROR, LOG_LOCAL0); +openlog("MaYoR", LOG_PID | LOG_PERROR, LOG_LOCAL0); syslog(LOG_WARNING, "Data unpacked: ".(json_encode($this->incomingRequest))." {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})"); closelog(); $this->status = 'ok:success request'; |