From 87607d3b6429bd187827993f5b34da7834686a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 3 Oct 2022 21:37:37 +0200 Subject: ics webcal ocenjevanja, popravek pathov v main.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dejstvo, da je bil po skoraj treh letih objavljen commit v repozitorij, ne pomeni, da je to zdaj kar naenkrat boljša koda in preverjena za morebitne varnostne luknje. kode še vedno ni smiselno uporabljati, javni endpoint je dostopen na http://razred.4a.si/gimsisextclient/endpoint.php, ical je dostopen na http://razred.4a.si/gimsisextclient/ical.php --- ical.php | 16 ++++++++++++++++ main.php | 34 +++++++++++++++++----------------- 2 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 ical.php diff --git a/ical.php b/ical.php new file mode 100644 index 0000000..b21137f --- /dev/null +++ b/ical.php @@ -0,0 +1,16 @@ +setusername($_REQUEST['u']); + $g->setpassword($_REQUEST['p']); + echo "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//Anton Luka Šijanec//NONSGML gimsisextClient iCal fetchocenjevanja//SL\r\n"; + foreach ($g->fetchocenjevanja() as $o) { + $d = explode(".", $o["datum"]); + echo "UID:" . $o["datum"] . $o["kratica"] . $o["predmet"] . "@ical.gimsisextclient.sijanec.eu\r\nDTSTAMP:" . $d[2] . $d[1] . $d[0] . "T080000Z\r\nORGANIZER;CN=" . $o["predmet"] . ":MAILTO:info+" . $o["kratica"] . "@gimb.org\r\nDTSTART:" . $d[2] . $d[1] . $d[0] . "T080000Z\r\nDTEND:" . $d[2] . $d[1] . $d[0] . "T140000Z\r\nSUMMARY:" . $o["kratica"] . ": " . $o["opis"] . "\r\nGEO:46.064167;14.511667\r\nEND:VEVENT\r\n"; + } + echo "END:VCALENDAR\r\n"; +?> diff --git a/main.php b/main.php index 53cdc43..594753d 100644 --- a/main.php +++ b/main.php @@ -80,22 +80,22 @@ Errors: private $programdomain = 'gimsisextclient.gimb.tk'; private $cookiedir; // set at runtime, ker je get_curerent_user, v login() private $mailbox = "/home/gimb/Mailbox"; - private $gimsisextlogin = "https://zgimsis.gimb.org/gse/Logon.aspx"; - private $gimsisexturnik = "https://zgimsis.gimb.org/gse/Page_Gim/Ucenec/DnevnikUcenec.aspx"; - private $gimsisextocenjevanja = "https://zgimsis.gimb.org/gse/Page_Gim/Ucenec/IzpitiUcenec.aspx"; - private $gimsisextocene = "https://zgimsis.gimb.org/gse/Page_Gim/Ucenec/OceneUcenec.aspx"; - private $gimsisextprofesorji = "https://zgimsis.gimb.org/gse/Page_Gim/Ucenec/UciteljskiZbor.aspx"; - private $gimsisextprofil = "https://zgimsis.gimb.org/gse/Page_Gim/Uporabnik/Profil.aspx"; - private $gimsisextshraniprofil = "https://zgimsis.gimb.org/gse/WS_Gim/wsGimSisUtils.asmx/ShraniUporabnikPodatki"; - private $gimsisextabout = "https://zgimsis.gimb.org/gse/About.aspx"; - private $gimsisextdefault = "https://zgimsis.gimb.org/gse/Default.aspx"; - private $gimsisextsporocila = "https://zgimsis.gimb.org/gse/Page_Gim/Uporabnik/Sporocila.aspx"; - private $gimsisextposljisporocilo = "https://zgimsis.gimb.org/gse/Page_Gim/Uporabnik/modSporocilo.aspx?params="; - private $gimsisextsetgeslo = "https://zgimsis.gimb.org/gse/WS_Gim/wsGimSisUtils.asmx/ShraniUporabnikGeslo"; - private $gimsisextizbrisisporocilo = "https://zgimsis.gimb.org/gse/Page_Gim/Uporabnik/Sporocila.aspx/DeleteMessage"; - private $gimsisextizostanki = "https://zgimsis.gimb.org/gse/Page_Gim/Ucenec/IzostankiUcenec.aspx"; - private $gimsisextresetgeslo = "https://zgimsis.gimb.org/gse/ResetPassword.aspx"; - private $gimsisextmodsporocilo = "https://zgimsis.gimb.org/gse/Page_Gim/Uporabnik/modSporocilo.aspx"; + private $gimsisextlogin = "https://zgimsis.gimb.org/Logon.aspx"; + private $gimsisexturnik = "https://zgimsis.gimb.org/Page_Gim/Ucenec/DnevnikUcenec.aspx"; + private $gimsisextocenjevanja = "https://zgimsis.gimb.org/Page_Gim/Ucenec/IzpitiUcenec.aspx"; + private $gimsisextocene = "https://zgimsis.gimb.org/Page_Gim/Ucenec/OceneUcenec.aspx"; + private $gimsisextprofesorji = "https://zgimsis.gimb.org/Page_Gim/Ucenec/UciteljskiZbor.aspx"; + private $gimsisextprofil = "https://zgimsis.gimb.org/Page_Gim/Uporabnik/Profil.aspx"; + private $gimsisextshraniprofil = "https://zgimsis.gimb.org/WS_Gim/wsGimSisUtils.asmx/ShraniUporabnikPodatki"; + private $gimsisextabout = "https://zgimsis.gimb.org/About.aspx"; + private $gimsisextdefault = "https://zgimsis.gimb.org/Default.aspx"; + private $gimsisextsporocila = "https://zgimsis.gimb.org/Page_Gim/Uporabnik/Sporocila.aspx"; + private $gimsisextposljisporocilo = "https://zgimsis.gimb.org/Page_Gim/Uporabnik/modSporocilo.aspx?params="; + private $gimsisextsetgeslo = "https://zgimsis.gimb.org/WS_Gim/wsGimSisUtils.asmx/ShraniUporabnikGeslo"; + private $gimsisextizbrisisporocilo = "https://zgimsis.gimb.org/Page_Gim/Uporabnik/Sporocila.aspx/DeleteMessage"; + private $gimsisextizostanki = "https://zgimsis.gimb.org/Page_Gim/Ucenec/IzostankiUcenec.aspx"; + private $gimsisextresetgeslo = "https://zgimsis.gimb.org/ResetPassword.aspx"; + private $gimsisextmodsporocilo = "https://zgimsis.gimb.org/Page_Gim/Uporabnik/modSporocilo.aspx"; public function setusername($value) { $this->username = $value; } @@ -355,7 +355,7 @@ Errors: curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'X-Requested-With: XMLHttpRequest', - 'Referer: https://zgimsis.gimb.org/gse/Page_Gim/Uporabnik/modVnosPodatki.aspx?params='.base64_encode("Id=".$this->username."|Type=") + 'Referer: https://zgimsis.gimb.org/Page_Gim/Uporabnik/modVnosPodatki.aspx?params='.base64_encode("Id=".$this->username."|Type=") )); $postbody = '{ "aPodatki": "'.base64_encode($podatki).'" }'; curl_setopt($ch, CURLOPT_POSTFIELDS, $postbody); -- cgit v1.2.3