summaryrefslogtreecommitdiffstats
path: root/main.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-03-01 00:50:46 +0100
committerAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-03-01 00:50:46 +0100
commit81d7453d4c5b15f8ccc03b0f8ec668ca31b367f7 (patch)
treefc4d602c83057c87da245c103e39d75e41c350cb /main.php
parentadded spremenigeslo (diff)
downloadgimsisextclient-81d7453d4c5b15f8ccc03b0f8ec668ca31b367f7.tar
gimsisextclient-81d7453d4c5b15f8ccc03b0f8ec668ca31b367f7.tar.gz
gimsisextclient-81d7453d4c5b15f8ccc03b0f8ec668ca31b367f7.tar.bz2
gimsisextclient-81d7453d4c5b15f8ccc03b0f8ec668ca31b367f7.tar.lz
gimsisextclient-81d7453d4c5b15f8ccc03b0f8ec668ca31b367f7.tar.xz
gimsisextclient-81d7453d4c5b15f8ccc03b0f8ec668ca31b367f7.tar.zst
gimsisextclient-81d7453d4c5b15f8ccc03b0f8ec668ca31b367f7.zip
Diffstat (limited to 'main.php')
-rw-r--r--main.php68
1 files changed, 67 insertions, 1 deletions
diff --git a/main.php b/main.php
index e05f759..ef5e944 100644
--- a/main.php
+++ b/main.php
@@ -1,4 +1,24 @@
<?php
+function build_data_files($boundary, $fields, $files){
+ $data = '';
+ $eol = "\r\n";
+ $delimiter = '-------------' . $boundary;
+ foreach ($fields as $name => $content) {
+ $data .= "--" . $delimiter . $eol
+ . 'Content-Disposition: form-data; name="' . $name . "\"".$eol.$eol
+ . $content . $eol;
+ }
+ foreach ($files as $name => $content) {
+ $data .= "--" . $delimiter . $eol
+ . 'Content-Disposition: form-data; name="undefined"; filename="' . $name . '"' . $eol
+ . 'Content-Type: '.$content[1].$eol
+ ;
+ $data .= $eol;
+ $data .= $content[0] . $eol;
+ }
+ $data .= "--" . $delimiter . "--".$eol;
+ return $data;
+}
function strip_tags_content($text, $tags = '', $invert = FALSE) {
preg_match_all('/<(.+?)[\s]*\/?[\s]*>/si', trim($tags), $tags);
$tags = array_unique($tags[1]);
@@ -504,7 +524,7 @@ Errors:
curl_setopt($ch, CURLOPT_POST, 0);
$sporocilo_output = curl_exec($ch);
$zadeva = html_entity_decode(get_string_between($sporocilo_output, '<input name="ctl00$ModalMasterBody$edtZadeva" type="text" value="', '" id="ctl00_ModalMasterBody_edtZadeva" />'));
- $telo = html_entity_decode(html_entity_decode(get_string_between($sporocilo_output, "&lt;/span&gt;&lt;/p&gt;", "</textarea>")));
+ $telo = html_entity_decode(html_entity_decode(html_entity_decode(get_string_between($sporocilo_output, "&lt;/span&gt;&lt;/p&gt;", "</textarea>"))));
$posiljatelj = html_entity_decode(html_entity_decode(get_string_between($sporocilo_output, "&gt;&lt;b&gt;Od&lt;/b&gt;: ", "&lt;br /&gt;&lt;b&gt;Poslano&lt;/b&gt;: "))); // ne trudi se za prejemnika, gimsisglitch(C)12
$datumincas = get_string_between($sporocilo_output, "&lt;br /&gt;&lt;b&gt;Poslano&lt;/b&gt;: ", "&lt;br /&gt;&lt;b&gt;Za&lt;/b&gt;: "); // pazi, tale je za ljudi
$cas = explode(":", end(explode(" ", $datumincas)));
@@ -580,6 +600,52 @@ Errors:
$posljisporocilo_output = curl_exec($ch);
return;
}
+ public function posljisporocilonov($prejemnikst, $zadeva, $telo, $file = null, $filemime = null, $filename = null) { // prejemnikst je zajeban dobit (za zdej)
+ $ch = $this->login();
+ if(!curl_getinfo($ch)) {
+ if(!empty($ch)){return $ch;}else{return -2;}
+ }
+ curl_setopt($ch, CURLOPT_POST, 0);
+ curl_setopt($ch, CURLOPT_URL, $this->gimsisextposljisporocilo);
+ $posljisporocilo_init_output = curl_exec($ch);
+ $xmlDoc = new DOMDocument($posljisporocilo_init_output);
+ $xmlDoc->loadHTML( $posljisporocilo_init_output );
+ $searchNode = $xmlDoc->getElementsByTagName( "input" );
+ $postfields = array();
+ foreach( $searchNode as $sn ) {
+ if($sn->getAttribute("name") == 'ctl00$ModalMasterBody$edtPrejemniki') {
+ } else if($sn->getAttribute("name") == 'ctl00$ModalMasterBody$edtZadeva') {
+ } else if($sn->getAttribute("name") == 'ctl00$ModalMasterBody$edtBesediloExt'){
+ } else if ($sn->getAttribute("name") == 'ctl00$ModalMasterBody$hfPrejemniki') {
+ } else {
+ $postfields[urlencode($sn->getAttribute("name"))] = urlencode($sn->getAttribute('value'));
+ }
+ }
+ $postfields['ctl00$ModalMasterBody$edtBesediloExt'] = $telo;
+ $postfields['ctl00$ModalMasterBody$hfPrejemniki'] = $prejemnikst;
+ $postfields['ctl00$ModalMasterBody$edtZadeva'] = $zadeva;
+ $postfields['ctl00$ModalMasterBody$edtPrejemniki'] = "";
+ if(!empty($file) && !empty($filemime) && !empty($filename)) {
+ $files = array($filename => array($file, $filemime));
+ } else {
+ $files = array();
+ }
+ $postfields["__EVENTTARGET"] = "ctl00%24ModalMasterBody%24btnDogodekShrani";
+ $postfields["__EVENTARGUMENT"] = "";
+ $boundary = time();
+ $delimiter = '-------------' . $boundary;
+ $post_data = build_data_files($boundary, $postfields, $files);
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_HEADER, array(
+ "Content-Type: multipart/form-data; boundary=".$delimiter
+ ));
+ curl_setopt($ch, CURLOPT_URL, $this->gimsisextposljisporocilo);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
+ $posljisporocilo_output = curl_exec($ch);
+ file_put_contents("/tmp/12.html", $posljisporocilo_output);
+ file_put_contents("/tmp/12.txt", $post_data);
+ return;
+ }
public function setgeslo($geslo, $spremenigeslovobjektu = true) { // geslo
$ch = $this->login();
if(!curl_getinfo($ch)) {