public function downloadTrashData() { $json = file_get_contents("http://www.awv-nordschwaben.de/WebService/AWVService.svc/getData/00000000-0000-0000-0000-000000001190"); echo "<pre style=\"font-size:10px;max-height:400px;overflow:auto;\">"; $data = json_decode($json); foreach ($data->calendar as $day) { if ($day->fr == "") { continue; } if ($day->dt < date("Ymd")) { continue; } print_r($day); $tag = Util::parseDate("de_DE", substr($day->dt, 6) . "." . substr($day->dt, 4, 2) . "." . substr($day->dt, 0, 4)); $name = ""; foreach ($day->fr as $T) { if ($T == "PT") { $name .= ($name != "" ? ", " : "") . "Papiertonne"; } if ($T == "RM") { $name .= ($name != "" ? ", " : "") . "Restmüll"; } if ($T == "GS") { $name .= ($name != "" ? ", " : "") . "Gelber Sack"; } if ($T == "BT") { $name .= ($name != "" ? ", " : "") . "Biotonne"; } } if ($name == "") { continue; } $F = new Factory("Todo"); $F->sA("TodoName", $name); $F->sA("TodoFromDay", $tag); $F->sA("TodoFromTime", "32400"); $F->sA("TodoTillDay", $tag); $F->sA("TodoTillTime", "36000"); $F->sA("TodoUserID", "-1"); $F->sA("TodoClass", "Kalender"); $F->sA("TodoClassID", "-1"); $F->sA("TodoType", "2"); $F->sA("TodoRemind", "-1"); if ($F->exists()) { continue; } $F->store(); } echo "</pre>"; }
private function logDownload($logLink, $link, $fileName = "", $fileSize = 0, Serie $Serie = null, $renamed = false) { $F = new Factory("JDownload"); $F->sA("JDownloadURL", $logLink); $F->sA("JDownloadFilename", $link); $F->sA("JDownloadRenameto", $fileName); $F->sA("JDownloadJDID", $this->getID()); $F->sA("JDownloadSerieID", $Serie != null ? $Serie->getID() : 0); if ($renamed) { $F->sA("JDownloadRenamed", time()); } $E = $F->exists(true); if ($E === false) { $F->sA("JDownloadDate", time()); $F->sA("JDownloadFilesize", $fileSize); $id = $F->store(); } else { $E->changeA("JDownloadDate", time()); $E->changeA("JDownloadFilesize", $fileSize); $E->saveMe(); $id = $E->getID(); } return $id; }
function handleOrder() { $values = $_SESSION["ticketDataAddress"]; $F = new Factory("Adresse"); $values["land"] = ISO3166::getCountryToCode($values["land"]); $F->fill($values); $exists = $F->exists(true); if (!$exists) { $AdresseID = $F->store(false, false); $K = new Kunden(); $Kappendix = $K->createKundeToAdresse($AdresseID, false, true); } else { $AdresseID = $exists->getID(); $Kappendix = Kappendix::getKappendixToAdresse($AdresseID); } if ($_SESSION["ticketDataPayment"]["via"] == "debit") { $Kappendix->changeA("KappendixKontonummer", $_SESSION["ticketDataPayment"]["debitKontonummer"]); $Kappendix->changeA("KappendixBLZ", $_SESSION["ticketDataPayment"]["debitBlz"]); $Kappendix->changeA("KappendixKontoinhaber", $_SESSION["ticketDataPayment"]["debitInhaber"]); $Kappendix->changeA("KappendixEinzugsermaechtigung", "1"); $Kappendix->changeA("KappendixEinzugsermaechtigungAltZBTB", "5"); $Kappendix->changeA("KappendixSameKontoinhaber", "0"); } if (!$exists) { $Kappendix->newMe(false); } else { $Kappendix->saveMe(); } $zahlungsart = 6; if ($_SESSION["ticketDataPayment"]["via"] == "debit") { $zahlungsart = 1; } if ($_SESSION["ticketDataPayment"]["via"] == "transfer") { $zahlungsart = 5; } if ($_SESSION["ticketDataPayment"]["via"] == "paypal") { $zahlungsart = 7; } $orderIDs = array(); foreach ($_SESSION["ticketDataSelection"] as $SeminarID => $anzahl) { if ($anzahl == 0) { continue; } $F = new Factory("STeilnehmer"); $F->sA("STeilnehmerSeminarID", $SeminarID); $F->sA("STeilnehmerAdresseID", $AdresseID); $F->sA("STeilnehmerAngemeldetAm", time()); $F->sA("STeilnehmerErwachsene", $anzahl); $F->sA("STeilnehmerZahlungsart", $zahlungsart); $STeilnehmerID = $F->store(); $Tickets = array(); foreach ($_SESSION["ticketDataTickets"] as $k => $v) { $ex = explode("_", $k); if (count($ex) != 3) { continue; } if ($ex[1] != $SeminarID) { continue; } if (!isset($Tickets[$ex[2]])) { $Tickets[$ex[2]] = array(); } $Tickets[$ex[2]][$ex[0]] = $v; } foreach ($Tickets as $ticket) { $F = new Factory("STeilnehmerTicket"); $F->sA("STeilnehmerTicketSeminarID", $SeminarID); $F->sA("STeilnehmerTicketSTeilnehmerID", $STeilnehmerID); $F->sA("STeilnehmerTicketVorname", $ticket["Vorname"]); $F->sA("STeilnehmerTicketNachname", $ticket["Nachname"]); $F->sA("STeilnehmerTicketPosition", $ticket["Position"]); $F->sA("STeilnehmerTicketUnternehmen", $ticket["Unternehmen"]); $F->sA("STeilnehmerTicketEMail", $ticket["Email"]); if ($this->fromPOS) { $F->sA("STeilnehmerTicketFirstSeen", time()); } $F->store(); } $S = new Seminar($SeminarID); $S->createRechnungen($STeilnehmerID); foreach ($S->createdGRLBMs as $GRLBM) { $Auftrag = new Auftrag($GRLBM->A("AuftragID")); $Auftrag->sendViaEmail($GRLBM->getID(), "", "", "", false); $B = new Bestellung(-1); $orderIDs[] = $B->createFromInvoice($GRLBM->A("AuftragID"), $GRLBM, "MMDB/Seminare/STeilnehmer", $STeilnehmerID); } } $_SESSION["ticketStep"] = 6; $_SESSION["ticketDataOrderIDs"] = $orderIDs; }
public function downloadTrashData() { $andreas = false; if (!$andreas) { $json = file_get_contents("http://awido.cubefour.de/WebServices/Awido.Service.svc/getData/00000000-0000-0000-0000-000000001190?fractions=1,5,2,6,3,4,10&client=awv-nordschwaben"); } else { $json = file_get_contents("http://awido.cubefour.de/WebServices/Awido.Service.svc/getData/00000000-0000-0000-0000-000000000629?fractions=1,5,2,6,3,4,10&client=awv-nordschwaben"); } echo "<pre style=\"font-size:10px;max-height:400px;overflow:auto;\">"; $data = json_decode($json); foreach ($data->calendar as $day) { if ($day->fr == "") { continue; } if ($day->dt < date("Ymd")) { continue; } print_r($day); $tag = new Datum(Util::parseDate("de_DE", substr($day->dt, 6) . "." . substr($day->dt, 4, 2) . "." . substr($day->dt, 0, 4))); if ($andreas) { $tag->subDay(); } $name = ""; foreach ($day->fr as $T) { if ($T == "PT") { $name .= ($name != "" ? ", " : "") . "Papiertonne"; } if ($T == "RT") { $name .= ($name != "" ? ", " : "") . "Restmüll"; } if ($T == "GS") { $name .= ($name != "" ? ", " : "") . "Gelber Sack"; } if ($T == "BT") { $name .= ($name != "" ? ", " : "") . "Biotonne"; } } if ($name == "") { continue; } $F = new Factory("Todo"); $F->sA("TodoName", $name); $F->sA("TodoFromDay", $tag->time()); $F->sA("TodoTillDay", $tag->time()); $F->sA("TodoFromTime", "32400"); $F->sA("TodoTillTime", "36000"); $F->sA("TodoUserID", "-1"); $F->sA("TodoRemind", "-1"); if ($andreas) { $F->sA("TodoFromTime", Util::parseTime("de_DE", "18:00")); $F->sA("TodoTillTime", Util::parseTime("de_DE", "18:05")); $F->sA("TodoUserID", Session::currentUser()->getID()); $F->sA("TodoRemind", 60); } $F->sA("TodoClass", "Kalender"); $F->sA("TodoClassID", "-1"); $F->sA("TodoType", "2"); if ($F->exists()) { continue; } $F->store(); } echo "</pre>"; }
public function discoverNow($reloadWhat = null, $force = false, $quiet = false) { $last = mUserdata::getGlobalSettingValue("UPnPLastDiscover", 0); if (time() - $last < 3600 * 3.5 and !$force) { return; } $C = new phpUPnP(); $result = $C->mSearch(); #print_r($result); if (!$quiet) { echo "<p>Gefundene Geräte:</p>"; } #$locations = array(); $L = new HTMLList(); $L->addListStyle("list-style-type:none;"); $foundLocations = array(); #echo "<pre style=\"padding:5px;font-size:9px;overflow:auto;height:400px;\">"; #print_r($result); #echo "</pre>"; foreach ($result as $r) { if (isset($foundLocations[$r["location"]])) { continue; } $info = file_get_contents($r["location"]); if ($info === false) { continue; } $xml = new SimpleXMLElement($info); $services = array(); foreach ($xml->device->serviceList->service as $service) { foreach (self::$desiredServices as $k => $S) { if ($service->serviceId[0] == $S) { $services[$k] = $service; } } } #echo "<pre>"; #print_r($xml->device->UDN); #echo "</pre>"; $F = new Factory("UPnP"); $F->sA("UPnPUDN", $xml->device->UDN); $L->addItem($xml->device->friendlyName); $U = $F->exists(true); if ($U !== false) { $U->changeA("UPnPLocation", $r["location"]); #$U->changeA("UPnPName", $xml->device->friendlyName); $U->changeA("UPnPModelName", $xml->device->modelName); $U->changeA("UPnPUDN", $xml->device->UDN); foreach (self::$desiredServices as $S => $nil) { $U->changeA("UPnP{$S}", 0); } foreach ($services as $S => $service) { $U->changeA("UPnP{$S}", 1); $U->changeA("UPnP" . $S . "SCPDURL", $service->SCPDURL[0] . ""); $U->changeA("UPnP" . $S . "controlURL", $service->controlURL[0] . ""); } #echo "save"; $U->saveMe(); } else { $F->sA("UPnPLocation", $r["location"]); $F->sA("UPnPName", $xml->device->friendlyName); $F->sA("UPnPModelName", $xml->device->modelName); foreach (self::$desiredServices as $S => $nil) { $F->sA("UPnP{$S}", 0); } foreach ($services as $S => $service) { $F->sA("UPnP{$S}", 1); $F->sA("UPnP" . $S . "SCPDURL", $service->SCPDURL[0] . ""); $F->sA("UPnP" . $S . "controlURL", $service->controlURL[0] . ""); } #echo "store"; $F->store(); } $foundLocations[$r["location"]] = true; } $AC = anyC::get("UPnP"); while ($U = $AC->getNextEntry()) { if (!isset($foundLocations[$U->A("UPnPLocation")])) { $U->deleteMe(); } } if (!$quiet) { echo $L; } $B = new Button("OK", "bestaetigung"); $B->style("float:right;margin:10px;"); if ($reloadWhat == "targets") { $B->onclick(OnEvent::closePopup("mUPnP") . " UPnP.targetSelection();"); } if ($reloadWhat == "sources") { $B->onclick(OnEvent::closePopup("mUPnP") . " UPnP.sourceSelection();"); } if ($reloadWhat) { echo $B . "<div style=\"clear:both;\"></div>"; } mUserdata::setUserdataS("UPnPLastDiscover", time(), "", -1); #echo "</pre>"; }
public function saveMe($checkUserData = true, $output = false, $update = true) { $old = new Todo($this->getID()); $old->loadMe(); #$fromDay = date("Y-m-d", Util::CLDateParser($this->A("TodoFromDay"), "store")); #$fromTime = Util::formatTime("de_DE", Util::CLTimeParser($this->A("TodoFromTime"), "store")); #die($this->getID()); if ($update) { $this->changeA("TodoLastChange", time()); $this->changeA("TodoReminded", "0"); } #$name = $this->getOwnerObject()->getCalendarTitle(); if ($this->A("TodoAllDay")) { $this->changeA("TodoFromTime", Util::CLTimeParser(0)); $this->changeA("TodoTillTime", Util::CLTimeParser(0)); } if ($this->A("TodoRepeatWeekOfMonth") > 0 and $this->A("TodoRepeatWeekOfMonth") != 127) { $D = new Datum($this->hasParsers ? Util::CLDateParser($this->A("TodoFromDay"), "store") : $this->A("TodoFromDay")); $nthDay = $D->getNthDayOfMonth(); if ($nthDay > 4) { $nthDay = 4; } $this->changeA("TodoRepeatWeekOfMonth", $nthDay); } if ($this->A("TodoClass") != "" and $this->A("TodoClass") != "Kalender" and $this->A("TodoName") == "") { $this->changeA("TodoName", $this->getOwnerObject()->getCalendarTitle()); } if (Session::isPluginLoaded("mAufgabe") and ($this->A("TodoType") == 3 or $this->A("TodoType") == 4 or $this->A("TodoType") == 5) and $this->A("TodoUserID") > 0) { $F = new Factory("Aufgabe"); $F->sA("AufgabeByClass", "Todo"); $F->sA("AufgabeByClassID", $this->getID()); $E = $F->exists(true); if (!$E) { $F->sA("AufgabeUserID", $this->A("TodoUserID")); $F->sA("AufgabeText", "Bericht für Termin '" . $this->A("TodoName") . "' eintragen"); $F->sA("AufgabeCreated", time()); if ($this->A("TodoDoneTime") > 0) { $F->sA("AufgabeStatus", "5"); $F->sA("AufgabeDone", time()); } if ($this->hasParsers) { $F->sA("AufgabeUntil", Util::CLDateParser($this->A("TodoFromDay"), "store")); $F->sA("AufgabeUhrzeitVon", Util::CLTimeParser($this->A("TodoTillTime"), "store")); } else { $F->sA("AufgabeUntil", $this->A("TodoFromDay")); $F->sA("AufgabeUhrzeitVon", $this->A("TodoTillTime")); } $F->store(); } else { $E->changeA("AufgabeText", "Bericht für Termin '" . $this->A("TodoName") . "' eintragen"); if ($this->hasParsers) { $E->changeA("AufgabeUntil", Util::CLDateParser($this->A("TodoFromDay"), "store")); $E->changeA("AufgabeUhrzeitVon", Util::CLTimeParser($this->A("TodoTillTime"), "store")); } else { $E->changeA("AufgabeUntil", $this->A("TodoFromDay")); $E->changeA("AufgabeUhrzeitVon", $this->A("TodoTillTime")); } if ($this->A("TodoDoneTime") > 0) { $E->changeA("AufgabeStatus", "5"); $E->changeA("AufgabeDone", time()); } $E->saveMe(); } } parent::saveMe($checkUserData, false); if (Session::isPluginLoaded("mGoogle") and $this->updateGoogle) { $KE = mTodoGUI::getCalendarDetails("Todo", $this->getID()); if ($this->A("TodoUserID") == Session::currentUser()->getID()) { if ($old->A("TodoUserID") == $this->A("TodoUserID")) { Google::calendarUpdateEvent(mTodoGUI::getCalendarDetails("Todo", $this->getID())); } else { Google::calendarDeleteEvent($KE); #"Todo", $this->getID()); Google::calendarCreateEvent($KE); } } else { Google::calendarDeleteEvent($KE); #"Todo", $this->getID()); Google::calendarCreateEvent($KE, $this->A("TodoUserID")); } } }
public function download(Serie $S, $echo = false) { $tab = new HTMLTable(1); $mirrorPath = $this->getMirror(); $tab->addRow("Retrieving mirror list... using {$mirrorPath}"); $serverTime = $this->getServerTime(); $tab->addRow("Retrieving server time... {$serverTime}"); $S->changeA("lastupdate", $serverTime); if ($S->A("siteID") == 0) { $tab->addRow("Retrieving series information..."); $data = file_get_contents("{$mirrorPath}/api/GetSeries.php?seriesname=" . urlencode($S->A("name")) . "&language=" . $S->A("sprache")); if ($data === false) { throw new Exception("No data from {$mirrorPath}/api/GetSeries.php?seriesname=" . urlencode($S->A("name")) . "&language=" . $S->A("sprache")); } #die("DATA: $data"); $seriesInfo = new SimpleXMLElement($data, null, false); $seriesID = $seriesInfo->Series->seriesid; $S->changeA("siteID", $seriesID); #$S->changeA("description", $seriesInfo->Series->Overview); } else { $seriesID = $S->A("siteID"); } $tempFile = Util::getTempFilename("SerieID" . $S->getID(), "zip"); $tab->addRow("Downloading episodes information..."); $SZip = "{$mirrorPath}/api/{$this->apiKey}/series/{$seriesID}/all/" . $S->A("sprache") . ".zip"; if (!copy($SZip, $tempFile)) { Red::errorD("The download of {$SZip} failed!"); } try { $zip = new ZipArchive(); if ($zip->open($tempFile) === TRUE) { $zip->extractTo(dirname($tempFile) . "/SerieID" . $S->getID()); $zip->close(); $tab->addRow("Extracting data..."); } else { throw new ClassNotFoundException(""); } } catch (ClassNotFoundException $e) { if (!Util::isWindowsHost()) { $commandUnzip = "unzip -o {$tempFile} -d SerieID" . $S->getID(); } else { $commandUnzip = Util::getRootPath() . "trinityDB/Serien/unzip.exe -o {$tempFile} -d SerieID" . $S->getID(); } $tab->addRow("Extracting data...<br />{$commandUnzip}"); $sc = new SystemCommand(); $sc->setCommand("cd " . dirname($tempFile) . " && {$commandUnzip}"); $sc->execute(); } $e = 0; $u = 0; $file = dirname($tempFile) . "/SerieID" . $S->getID() . "/" . $S->A("sprache") . ".xml"; if (!file_exists($file)) { Red::errorD("Could not find the expected file {$file}. Please check if it was properly extracted from {$tempFile}."); } $episodesList = new SimpleXMLElement(file_get_contents($file)); $status = $episodesList->Series->Status; $S->changeA("description", $episodesList->Series->Overview); $S->changeA("status", $status); $S->changeA("genre", $episodesList->Series->Genre); foreach ($episodesList->Episode as $k => $v) { $AC = anyC::get("Folge", "SerieID", $S->getID()); $AC->addAssocV3("season", "=", $v->SeasonNumber); $AC->addAssocV3("episode", "=", $v->EpisodeNumber); $AC->lCV3(); if ($AC->numLoaded() > 1) { while ($F = $AC->getNextEntry()) { $F->deleteMe(); } } $F = new Factory("Folge"); $F->sA("SerieID", $S->getID()); $F->sA("season", $v->SeasonNumber); $F->sA("episode", $v->EpisodeNumber); if ($E = $F->exists(true)) { if ($v->lastupdated == $E->A("lastupdate")) { continue; } $E->changeA("name", $v->EpisodeName); $E->changeA("airDate", $v->FirstAired); $E->changeA("lastupdate", $v->lastupdated); $E->changeA("description", $v->Overview); $E->saveMe(true, false); $u++; continue; } $F->sA("episodeID", $v->id); $F->sA("name", $v->EpisodeName); $F->sA("airDate", $v->FirstAired); $F->sA("lastupdate", $v->lastupdated); $F->sA("description", $v->Overview); $F->sA("wanted", "1"); $F->store(true, false); $e++; } $tab->addRow("Loaded {$e} episodes"); $tab->addRow("Updated {$u} episodes"); if (mUserdata::getGlobalSettingValue("trinityDBdlCover", "0") == "1") { $bannerList = new SimpleXMLElement(dirname($tempFile) . "/SerieID" . $S->getID() . "/banners.xml", null, true); foreach ($bannerList as $banner) { if ($banner->BannerType . "" == "poster") { #echo $banner->BannerPath.""; $cover = file_get_contents("http://www.thetvdb.com/banners/" . $banner->BannerPath); $temp = Util::getTempFilename("cover", "jpg"); file_put_contents($temp, $cover); if ($S->A("dir") != "" and file_exists($S->A("dir"))) { file_put_contents($S->A("dir") . "/Folder.jpg", $cover); } $S->changeA("cover", DBImageGUI::stringifyS("image/jpg", $temp)); $S->changeA("coverThumb", DBImageGUI::stringifyS("image/png", $temp, 150, 220)); #$S->saveMe(); unlink($temp); $tab->addRow("Downloaded cover"); break; } } } $S->saveMe(true, false); if ($echo) { echo $tab; } }
public function saveContextMenu($identifier, $key) { $F = new Factory("Userdata"); $F->sA("UserID", "-1"); $F->sA("name", "trinityDBdlCover"); $U = $F->exists(true); if ($U !== false) { $U->changeA("wert", $identifier); $U->saveMe(); } else { $F->sA("wert", $identifier); $F->store(); } mUserdata::setUserdataS("trinityDBdlCover", $identifier); }
public function addInvitee($TodoID, $name, $email) { $F = new Factory("TodoInvitation"); $F->sA("TodoInvitationTodoID", $TodoID); $F->sA("TodoInvitationName", $name); $F->sA("TodoInvitationUserEmail", $email); #$F->sA("TodoInvitationStatus", 0); if ($F->exists()) { $this->getInvitees($TodoID); return; } $F->store(); $this->getInvitees($TodoID); }
public function reAddItem($EinkaufszettelID, $overviewList = false) { $E = new Einkaufszettel($EinkaufszettelID); $E->changeA("EinkaufszettelAdded", $E->A("EinkaufszettelAdded") + 1); $E->saveMe(); $F = new Factory("Einkaufszettel"); $F->sA("EinkaufszettelBought", "0"); $F->sA("EinkaufszettelName", $E->A("EinkaufszettelName")); $exists = $F->exists(true); if ($exists !== false) { $exists->changeA("EinkaufszettelMenge", $exists->A("EinkaufszettelMenge") + 1); $exists->saveMe(); } else { #$E->changeA("EinkaufszettelBought", "0"); #$E->changeA("EinkaufszettelTime", time()); $F->sA("EinkaufszettelMenge", "1"); #$E->newMe(); $F->sA("EinkaufszettelEinkaufszettelKategorieID", $E->A("EinkaufszettelEinkaufszettelKategorieID")); $F->sA("EinkaufszettelTime", time()); $F->store(); } #$F->sA("EinkaufszettelName", $E->A("EinkaufszettelName")); #$exists = $F->exists(true); #if($exists !== false){ #$exists->changeA("EinkaufszettelMenge", $exists->A("EinkaufszettelMenge") + 1); # $exists->saveMe(); #} else { # $E->changeA("EinkaufszettelBought", "0"); # #$E->changeA("EinkaufszettelMenge", "1"); # $E->newMe(); #} #if(!$overviewList) echo $this->getListTable(); #else # echo $this->getOverviewList(); }