From a84a6d99aa654c7ce4a88ce36f6807a887e1572f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Tue, 4 Feb 2020 20:35:16 +0100 Subject: fix: json_decode v array in fetchocene sedaj podpira tudi popravne roke --- main.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/main.php b/main.php index 54ef9b4..5bd0a49 100644 --- a/main.php +++ b/main.php @@ -54,7 +54,7 @@ Errors: class gimsisextClient { private $username; private $password; - public $version = array(0, 9, 1); + public $version = array(0, 9, 2); private $programname = "gimsisextclient"; private $programdomain = 'gimsisextclient.gimb.tk'; private $cookiedir; // set at runtime, ker je get_curerent_user, v login() @@ -580,10 +580,6 @@ Errors: $postbody=$postvars.'&'.urlencode('ctl00$ModalMasterBody$edtZadeva').'='.urlencode($zadeva).'&'.urlencode('ctl00$ModalMasterBody$edtBesediloExt').'='.urlencode($telo).'&__EVENTTARGET=ctl00%24ModalMasterBody%24btnDogodekShrani&__EVENTARGUMENT=&'.urlencode('ctl00$ModalMasterBody$hfPrejemniki').'='.urlencode($prejemnikst); curl_setopt($ch, CURLOPT_POSTFIELDS, $postbody); $posljisporocilo_output = curl_exec($ch); - // file_put_contents("/tmp/psio.html", $posljisporocilo_init_output); // debug - // file_put_contents("/tmp/pso.html", $posljisporocilo_output); // debug - // file_put_contents("/tmp/pb.html", $postbody); // debug - // file_put_contents("/tmp/p.html", $prejemnikst); // debug return; } public function setgeslo($geslo, $spremenigeslovobjektu = true) { // geslo @@ -768,17 +764,27 @@ Errors: } else { $zacasna = 0; } - $ocene[] = array( + $ocenaarray = array( "datum" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $datum))), "profesor" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $ucitelj))), "predmet" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $predmet))), "naslov" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $ocenjevanje))), "vrsta" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $vrsta))), "rok" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $rok))), - "rok" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $rok))), "ocena" => intval(str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $ocena)))), "zacasna" => boolval(str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $zacasna)))) ); + if(sizeof($sn->getElementsByTagName("span")) > 1) { + $ocenaarray["novaocena"] = DOMinnerHTML($sn->getElementsByTagName("span")[1]); + if(explode(" ", $sn->getElementsByTagName("span")[1]->getAttribute("class"))[1] == "ocVmesna") { + $ocenaarray["novazacasna"] = 1; + } else { + $ocenaarray["novazacasna"] = 0; + } + $ocenaarray["novaocena"] = intval(str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $ocenaarray["novaocena"])))); + $ocenaarray["novazacasna"] = boolval(str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $ocenaarray["novazacasna"])))); + } + $ocene[] = $ocenaarray; } } return $ocene; -- cgit v1.2.3