Ejemplo n.º 1
1
function go($message)
{
    $S = anyC::getFirst("Websocket", "WebsocketUseFor", "fheME");
    $realm = $S->A("WebsocketRealm");
    spl_autoload_unregister("phynxAutoloader");
    require Util::getRootPath() . 'PWS/Thruway/vendor/autoload.php';
    if (!class_exists("ClientPhimAuthenticator", false)) {
        Thruway\Logging\Logger::set(new Psr\Log\NullLogger());
        class ClientPhimAuthenticator implements Thruway\Authentication\ClientAuthenticationInterface
        {
            private $authID;
            private $key;
            private $realm;
            function __construct($realm, $authID, $key)
            {
                $this->authID = $authID;
                $this->key = $key;
                $this->realm = $realm;
            }
            public function getAuthId()
            {
                return $this->authID;
            }
            public function setAuthId($authid)
            {
            }
            public function getAuthMethods()
            {
                return ["phimAuth_" . $this->realm];
            }
            public function getAuthenticateFromChallenge(Thruway\Message\ChallengeMessage $msg)
            {
                return new \Thruway\Message\AuthenticateMessage($this->key);
            }
        }
    }
    $connection = new \Thruway\Connection(["realm" => $realm, "url" => "ws" . ($S->A("WebsocketSecure") ? "s" : "") . "://" . $S->A("WebsocketServer") . ":" . $S->A("WebsocketServerPort") . "/"]);
    $client = $connection->getClient();
    $client->addClientAuthenticator(new ClientPhimAuthenticator($realm, "phimUser", $S->A("WebsocketToken")));
    $connection->on('open', function (\Thruway\ClientSession $session) use($connection, $message) {
        $session->publish('it.furtmeier.fheme', [json_encode($message, JSON_UNESCAPED_UNICODE)], [], ["acknowledge" => true])->then(function () use($connection) {
            $connection->close();
        }, function ($connection) {
            $connection->close();
        });
    });
    $connection->open();
    #spl_autoload_unregister(array("ThruwayLoader", "alienClassLoader"));
    #spl_autoload_register("phynxAutoloader");
}
Ejemplo n.º 2
0
 function newMe($checkUserData = true, $output = false)
 {
     $S = anyC::getFirst("poolSteuerung", "poolSteuerungTyp", $this->A("poolSteuerungTyp"));
     if ($S !== null) {
         Red::errorD("Jeder Steuerungstyp darf maximal einmal angelegt werden.");
     }
     return parent::newMe($checkUserData, $output);
 }
Ejemplo n.º 3
0
 public function getServer()
 {
     try {
         $S = anyC::getFirst("Websocket");
     } catch (Exception $e) {
         die("nil");
     }
     if ($S == null) {
         die("nil");
     }
     echo $S->A("WebsocketServer") . ":" . $S->A("WebsocketServerPort");
 }
Ejemplo n.º 4
0
 function backgroundDelete($DeviceID)
 {
     $O = anyC::getFirst("fheOverview", "fheOverviewDeviceID", $DeviceID);
     $d = json_decode($O->A("fheOverviewDesktop"));
     unset($d->background);
     $O->changeA("fheOverviewDesktop", json_encode($d));
     $O->saveMe();
     echo OnEvent::script("\$j('#wrapper').css('background-image', '');");
 }
Ejemplo n.º 5
0
 function handleForm($valuesAssocArray)
 {
     $this->classes();
     switch ($valuesAssocArray["action"]) {
         case "register":
             $F = new Factory("Adresse");
             $F->sA("firma", $valuesAssocArray["firma"]);
             $F->sA("strasse", $valuesAssocArray["strasse"]);
             $F->sA("nr", $valuesAssocArray["nr"]);
             $F->sA("plz", $valuesAssocArray["plz"]);
             $F->sA("ort", $valuesAssocArray["ort"]);
             $F->sA("email", $valuesAssocArray["userEmail"]);
             //from email
             $F->sA("tel", $valuesAssocArray["tel"]);
             $AdresseID = $F->store(false, false);
             $K = new Kunden();
             $Kappendix = $K->createKundeToAdresse($AdresseID, false, true);
             $Kappendix->changeA("KappendixKontonummer", $valuesAssocArray["kontonummer"]);
             $Kappendix->changeA("KappendixBLZ", $valuesAssocArray["blz"]);
             $Kappendix->changeA("KappendixSameKontoinhaber", "1");
             $KappendixID = $Kappendix->newMe(false);
             $token = sha1($AdresseID . $KappendixID . microtime());
             $F = new Factory("PDFixUser");
             $F->sA("PDFixUserAdresseID", $AdresseID);
             $F->sA("PDFixUserKappendixID", $KappendixID);
             $F->sA("PDFixUserPDFixUserDBID", "0");
             $F->sA("PDFixUserIsActive", "0");
             $F->sA("PDFixUserVorNachname", $valuesAssocArray["userVorNachname"]);
             $F->sA("PDFixUserUsername", $valuesAssocArray["userUsername"]);
             $F->sA("PDFixUserPassword", $valuesAssocArray["userPassword"]);
             $F->sA("PDFixUserEmail", $valuesAssocArray["userEmail"]);
             $F->sA("PDFixUserRate", $valuesAssocArray["zahlungsweise"]);
             $F->sA("PDFixUserRegisteredDate", time());
             $F->sA("PDFixUserToken", $token);
             $F->store(false, false);
             $mail = new htmlMimeMail5();
             $mail->setFrom("*****@*****.**");
             $mail->setSubject(utf8_decode("PDFix Registrierung ihres Mitarbeiters " . $valuesAssocArray["userVorNachname"]));
             $mail->setText(utf8_decode("Sehr geehrte Damen und Herren,\n \nSie selbst oder Ihr Mitarbeiter/Ihre Mitarbeiterin \n" . $valuesAssocArray["userVorNachname"] . " hat sich soeben bei www.pdfix.de angemeldet. \n \nDer Account wurde angelegt.\n \nIm Anhang finden Sie unsere AGB und den Softwarelizenzvertrag.\nMit der Aktivierung des Accounts werden die AGB und Nutzungsbedingungen\nannerkannt.\n\nSobald die Abbuchungserklärung bei uns eingegangen ist,\nwird der Account innerhalb 24 Std. freigeschalten und\n\"pdfix\" kann dann genutzt werden.\n \nWenn Sie die Kosten übernehmen, dann klicken Sie auf\n\n\nnachstehenden Aktivierungslink.\n\nhttp://" . $_SERVER["HTTP_HOST"] . "" . str_replace("/ubiquitous/CustomerPage/index.php", "/ubiquitous/CustomerPage/?CC=RegistrationPDFix&activate={$token}", $_SERVER["SCRIPT_NAME"]) . "\n \n\nAnsonsten klären Sie bitte die Kostenübernahme mit Ihrem Mitarbeiter ab.\n\n \nMit freundlichen Grüßen\n \nM. Tischler\nGeschäftsführer\nETS-SÜD UG (haftungsbeschränkt)\nDR. Michael Samer Ring 2a\n86609 Donauwörth\nAG Augsburg\nHRB 26204\ninfo@pdfix.de"));
             /*
             Zum Download von pdfix besuchen Sie bitte
             http://www.meine-smn.de und klicken auf \"Login\"
             
             melden Sie sich an mit:
             
             Benutzername: ".$valuesAssocArray["userUsername"]."
             Passwort: ".$valuesAssocArray["userPassword"]."
             
             Bestätigen Sie jeweils am Ende der Seiten die AGB´s und Lizenzbedingungen und
             laden \"pdfix\" down.
             
             Sobald die Abbuchungserklärung bei uns eingegangen ist,
             wird der Account innerhalb 24 Std. freigeschalten,und
             \"pdfix\" kann dann genutzt werden.
             */
             #$mail->setTextCharset("UTF-8");
             #$mail->addAttachment(new fileAttachment(Util::getRootPath()."open3A/PDFix/abbuchungserkl.pdf", "application/pdf"));
             $mail->addAttachment(new fileAttachment(Util::getRootPath() . "../download/Agbs.pdf", "application/pdf"));
             $mail->addAttachment(new fileAttachment(Util::getRootPath() . "../download/Softwarelizenzvertrag.pdf", "application/pdf"));
             if (!$mail->send(array($valuesAssocArray["userEmail"]))) {
                 //from email
                 Red::errorD("Die E-Mail konnte nicht verschickt werden, bitte versuchen Sie es erneut!");
             }
             break;
         case "activate":
             $PU = anyC::getFirst("PDFixUser", "PDFixUserToken", $valuesAssocArray["token"]);
             $PU->changeA("PDFixUserActivatedDate", time());
             $PU->changeA("PDFixUserIsActive", "1");
             $PU->changeA("PDFixUserRate", $valuesAssocArray["zahlungsweise"]);
             $PU->saveMe();
             $mail = new htmlMimeMail5();
             $mail->setFrom("*****@*****.**");
             $mail->setSubject(utf8_decode("PDFix Registrierung ihres Mitarbeiters " . $valuesAssocArray["userVorNachname"]));
             $mail->setText(utf8_decode("Sehr geehrte Damen und Herren,\n \nIhr Account wurde soeben angelegt.\n \nBenutzername: " . $PU->A("PDFixUserUsername") . "\nPasswort: " . $PU->A("PDFixUserPassword") . "\n \nSobald die Abbuchungserklärung bei uns eingegangen ist,\nwird der Account innerhalb 24 Std. freigeschalten und\n\"pdfix\" kann dann genutzt werden.\n\t\n\nMit freundlichen Grüßen\n \nM. Tischler\nGeschäftsführer\nETS-SÜD UG (haftungsbeschränkt)\nDR. Michael Samer Ring 2a\n86609 Donauwörth\nAG Augsburg\nHRB 26204\ninfo@pdfix.de"));
             /*
             Zum Download von pdfix besuchen Sie bitte
             http://www.meine-smn.de und klicken auf \"Login\"
             
             melden Sie sich an mit:
             
             Bestätigen Sie jeweils am Ende der Seiten die AGB´s und Lizenzbedingungen und
             laden \"pdfix\" down.
             */
             #$mail->setTextCharset("UTF-8");
             if (!$mail->send(array($PU->A("PDFixUserEmail")))) {
                 Red::errorD("Die E-Mail konnte nicht verschickt werden, bitte versuchen Sie es erneut!");
             }
             $Adresse = new Adresse($PU->A("PDFixUserAdresseID"));
             $mail = new htmlMimeMail5();
             $mail->setFrom("*****@*****.**");
             $mail->setSubject("PDFix Aktivierung");
             $mail->setText(utf8_decode("\nFirma: " . $Adresse->A("firma") . "\nBenutzername: " . $PU->A("PDFixUserUsername") . ""));
             #$mail->setTextCharset("UTF-8");
             if (!$mail->send(array("*****@*****.**"))) {
                 Red::errorD("Die E-Mail konnte nicht verschickt werden, bitte versuchen Sie es erneut!");
             }
             break;
     }
 }
Ejemplo n.º 6
0
 private function go($message, $to)
 {
     $S = anyC::getFirst("Websocket", "WebsocketUseFor", "phim");
     $realm = $S->A("WebsocketRealm");
     spl_autoload_unregister("phynxAutoloader");
     require Util::getRootPath() . 'PWS/Thruway/vendor/autoload.php';
     require_once __DIR__ . '/ClientPhimAuthenticator.php';
     Thruway\Logging\Logger::set(new Psr\Log\NullLogger());
     $connection = new \Thruway\Connection(["realm" => $realm, "url" => "ws" . ($S->A("WebsocketSecure") ? "s" : "") . "://" . $S->A("WebsocketServer") . ":" . $S->A("WebsocketServerPort") . "/"]);
     $client = $connection->getClient();
     $client->addClientAuthenticator(new ClientPhimAuthenticator($realm, "phimUser", $S->A("WebsocketToken")));
     $connection->on('open', function (\Thruway\ClientSession $session) use($connection, $message, $to) {
         $session->publish('it.furtmeier.phim_' . $to, [json_encode($message, JSON_UNESCAPED_UNICODE)], [], ["acknowledge" => true])->then(function () use($connection) {
             $connection->close();
         }, function ($connection) {
             $connection->close();
         });
     });
     $connection->open();
     /*$client = new Thruway\Peer\Client($realm);
     		$client->addClientAuthenticator(new ClientPhimAuthenticator($realm, "phimUser", $S->A("WebsocketToken")));
     		
     		$client->addTransportProvider(new Thruway\Transport\PawlTransportProvider("ws".($S->A("WebsocketSecure") ? "s" : "")."://".$S->A("WebsocketServer").":".$S->A("WebsocketServerPort")."/"));
     
     		$client->on('open', function (Thruway\ClientSession $session) use ($message, $to) {
     
     			$session->publish('it.furtmeier.phim_'.$to, [json_encode($message, JSON_UNESCAPED_UNICODE)], [], ["acknowledge" => true])->then(
     				function () {
     					echo "Publish Acknowledged!\n";
     					die();
     				},
     				function ($error) {
     					// publish failed
     					echo "Publish Error {$error}\n";
     				}
     			);
     
     			//$session->close();
     		});
     
     
     		$client->start();*/
 }
Ejemplo n.º 7
0
 public function download($link, $logLink = null, $logFilename = "", Serie $Serie = null)
 {
     if (strpos($link, "linksafe.")) {
         $newLocation = get_headers($link, 1);
         $links = $newLocation["Location"];
         $link = null;
         if (is_array($links)) {
             foreach ($links as $k => $l) {
                 if (stripos($l, "https") === 0) {
                     $link = $links[$k];
                 }
             }
             if ($link == null) {
                 $link = $links[0];
             }
         } else {
             $link = $links;
         }
     }
     if (strpos($link, "safeurl.")) {
         $newLocation = get_headers($link, 1);
         if (isset($newLocation["Location"])) {
             $link = $newLocation["Location"][0];
         } else {
             $contentWithLink = file_get_contents($link);
             preg_match_all("/(https:\\/\\/rapidshare[a-zA-Z0-9\\.\\-\\/_#+\\|!]*)/", $contentWithLink, $links);
             $links = array_unique($links[1]);
             $link = $links[0];
             $ex = explode("|", $link);
             $ex[0] = str_replace("/#!download", "/files/", $ex[0]);
             $link = $ex[0] . $ex[2] . "/" . $ex[3];
         }
     }
     if (strpos($link, "canhaz.")) {
         $newLocation = get_headers($link, 1);
         $link = $newLocation["Location"];
         $contentWithLink = file_get_contents($link);
         preg_match_all("/(http:\\/\\/rapidshare[a-zA-Z0-9\\.\\-\\/_#+]*)/", $contentWithLink, $links);
         $links = array_unique($links[1]);
         $link = $links[0];
     }
     $linkOld = $link;
     if ($this->A("JDLinkParser") != "") {
         $C = $this->A("JDLinkParser");
         $C = new $C();
         $link = $C->parse($link, $this->A("JDLinkParserUser"), $this->A("JDLinkParserPassword"));
     }
     if ($this->A("JDDLType") == "4") {
         if ($logFilename == "") {
             $info = get_headers($link, 1);
             if ($info !== false) {
                 preg_match("/filename=\"(.*)\"/ismU", $info["Content-Disposition"], $matches);
                 if (isset($matches[1])) {
                     $logFilename = $matches[1];
                 }
             }
         }
         if ($logFilename == "") {
             $logFilename = basename($link);
         }
         $DL = anyC::getFirst("Incoming", "IncomingUseForDownloads", "1");
         $size = $this->filesize($link);
         if ($size < 10 * 1024 * 1024) {
             throw new Exception("File size too small");
         }
         $id = $this->logDownload($logLink, $linkOld, $logFilename, $size, $Serie, true);
         file_put_contents($this->A("JDWgetFilesDir") . "/{$id}.temp", "-o wgetDL_" . str_pad($id, 5, "0", STR_PAD_LEFT) . ".log -O " . rtrim($DL->A("IncomingDir"), "/") . "/" . str_replace(" ", ".", basename($logFilename)) . "." . Util::ext($link) . " {$link}");
         rename($this->A("JDWgetFilesDir") . "/{$id}.temp", $this->A("JDWgetFilesDir") . "/{$id}.dl");
         chmod($this->A("JDWgetFilesDir") . "/{$id}.dl", 0666);
         return true;
     }
     if ($this->A("JDDLType") == "0") {
         Util::PostToHost($this->A("JDHost"), $this->A("JDPort"), "/link_adder.tmpl", "none", "do=Add&addlinks=" . urlencode($link), $this->A("JDUser"), $this->A("JDPassword"));
     }
     if ($this->A("JDDLType") == "1") {
         $xml = Util::PostToHost($this->A("JDHost"), $this->A("JDPort"), "/cgi-bin/Qdownload/DS_Login.cgi", "none", "user="******"JDUser") . "&pwd=" . urlencode(base64_encode($this->A("JDPassword"))) . "&admin=1");
         $xml = new SimpleXMLElement(substr($xml, strpos($xml, "<?xml ")));
         $data = Util::PostToHost($this->A("JDHost"), $this->A("JDPort"), "/cgi-bin/Qdownload/DS_Task_Option.cgi", "none", "url=" . urlencode($link) . "&todo=add_rs&type=http_ftp&acc_id=1&user=&pwd=&sid=" . $xml->authSid . "&ver=2.0");
         $xml = new SimpleXMLElement(substr($data, strpos($data, "<?xml ")));
         if ($xml->Result . "" == "success") {
             $this->logDownload($logLink, $link, $logFilename, 0, $Serie);
         }
     }
     if ($this->A("JDDLType") == "2") {
         $content = file_get_contents("http://" . $this->A("JDHost") . ":" . $this->A("JDPort") . "/action/add/links/grabber0/start1/{$link}");
         if (strpos($content, "Link(s) added. (\"{$link}\"") !== false and $logLink != null) {
             $this->logDownload($logLink, $link, $logFilename, 0, $Serie);
         }
     }
     if ($this->A("JDDLType") == "3") {
         $GLOBALS['THRIFT_ROOT'] = Util::getRootPath() . "ubiquitous/Thrift";
         require_once $GLOBALS['THRIFT_ROOT'] . '/Thrift.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TTransport.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TFramedTransport.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TBufferedTransport.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/packages/pyload/Pyload.php';
         require_once $GLOBALS['THRIFT_ROOT'] . '/packages/pyload/pyload_types.php';
         $transport = new TSocket($this->A("JDHost"), $this->A("JDPort") * 1);
         $transport->open();
         $protocol = new TBinaryProtocol($transport);
         $client = new PyloadClient($protocol);
         $client->login($this->A("JDUser"), $this->A("JDPassword"));
         #echo $client->getServerVersion();
         #echo "<br />";
         $client->addPackage("trinityDB", array($link), 1);
         #Print 'result = ' . $result;
         $transport->close();
     }
 }
Ejemplo n.º 8
0
 public static function getCalendarDetails($className, $classId)
 {
     $calendar = new Kalender();
     $ids = preg_split("/:/", $classId);
     $server = anyC::getFirst("xCal", "xCalID", $ids[0]);
     $xmlBuffer = xCalUtil::getSimpleXmlByXCal($server->A("xCalCache"));
     foreach ($xmlBuffer->vcalendar->vevent as $event) {
         if ((string) $event->uid != $ids[1]) {
             continue;
         }
         // Konvertierung der Zeitstempel
         $match = array();
         preg_match("/^(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2})Z\$/", (string) $event->dtstart, $match);
         $startTimestamp = gmmktime($match[4], $match[5], $match[6], $match[2], $match[3], $match[1]);
         $match = array();
         preg_match("/^(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2})Z\$/", (string) $event->dtend, $match);
         $endTimestamp = gmmktime($match[4], $match[5], $match[6], $match[2], $match[3], $match[1]);
         $calendarEvent = new KalenderEvent("mxCalGUI", $server->A("xCalID") . ":" . (string) $event->uid, $calendar->formatDay($startTimestamp), $calendar->formatTime($startTimestamp), (string) $event->summary);
         $description = preg_replace("/\n|\r/", "<br>", (string) $event->description);
         $calendarEvent->summary($description);
         return $calendarEvent;
     }
 }
Ejemplo n.º 9
0
<?php

#session_name("phim_".sha1(__FILE__));
define("PHYNX_NO_SESSION_RELOCATION", true);
require "../../system/connect.php";
addClassPath(Util::getRootPath() . "ubiquitous/phim");
$username = filter_input(INPUT_GET, "username");
$password = sha1(filter_input(INPUT_GET, "password"));
if (filter_input(INPUT_GET, "token")) {
    $AC = anyC::get("phimUser", "phimUserToken", filter_input(INPUT_GET, "token"));
    $AC->addAssocV3("phimUserActive", "=", "1");
    $U = $AC->n();
    if ($U != null) {
        $AnyUser = anyC::getFirst("User");
        $Us = new Users();
        $login = $Us->doLogin(array("loginUsername" => $AnyUser->A("username"), "loginSHAPassword" => $AnyUser->A("SHApassword"), "loginPWEncrypted" => 1));
        $user = new User($U->A("phimUserUserID"));
        $user->loadMe(false);
        $username = $user->A("username");
        $password = $user->A("SHApassword");
    }
}
$U = new Users();
$login = $U->doLogin(array("loginUsername" => $username, "loginSHAPassword" => $password, "loginPWEncrypted" => 1, "anwendung" => "lightCRM"));
if (!$login) {
    emoFatalError("Sorry, ich kenne dich nicht!", "Login fehlgeschlagen! Vermutlich sind die Zugangsdaten falsch.", "Login fehlgeschlagen", false);
}
$p = new mphimGUI();
$p->chatPopup("../");
Ejemplo n.º 10
0
<?php

define("PHYNX_NO_SESSION_RELOCATION", true);
require "../../system/connect.php";
addClassPath(Util::getRootPath() . "ubiquitous/phim");
$T = mUserdata::getGlobalSettingValue("phimServerToken");
if (!$T) {
    die("<phynx><phim><token>unknown</token></phim></phynx>");
}
if ($T !== filter_input(INPUT_GET, "token")) {
    die("<phynx><phim><token>unknown</token></phim></phynx>");
}
$U = anyC::getFirst("phimUser", "phimUserSystemName", str_replace("\\", "/", filter_input(INPUT_GET, "user")));
if ($U == null) {
    $F = new Factory("phimUser");
    $F->sA("phimUserSystemName", str_replace("\\", "/", filter_input(INPUT_GET, "user")));
    $F->store();
    die("<phynx><phim><token>unknown</token></phim></phynx>");
}
echo "<phynx><phim><token>" . $U->A("phimUserToken") . "</token></phim></phynx>";
Ejemplo n.º 11
0
 public static function getLangCurrencyFactor($language)
 {
     if (!Session::isPluginLoaded("mSprache")) {
         return 1;
     }
     $Sprache = anyC::getFirst("Sprache", "SpracheIdentifier", $language);
     $faktor = 1;
     if ($Sprache != null) {
         $faktor = $Sprache->A("SpracheWaehrungFaktor") * 1;
     }
     if ($Sprache == null) {
         $Sprache = anyC::getFirst("Sprache", "CONCAT(SpracheIdentifier, '_', SpracheWaehrung) ", $language);
         if ($Sprache != null) {
             $faktor = $Sprache->A("SpracheWaehrungFaktor") * 1;
         }
     }
     return $faktor;
 }
Ejemplo n.º 12
0
 public static function stamp($args, $die = true)
 {
     #if(strtolower($args["P0"]) == "303005f7b4")
     #	die('{"status":"command", "action":"reload"}');
     if (!isset($_SESSION["BPS"])) {
         $_SESSION["BPS"] = new BackgroundPluginState();
     }
     addClassPath(Util::getRootPath() . "personalKartei/Zeiterfassung/");
     addClassPath(Util::getRootPath() . "personalKartei/Personal/");
     addClassPath(Util::getRootPath() . "personalKartei/ObjekteL/");
     #if(file_exists(Util::getRootPath()."personalKartei/Schichten/"))
     #	addClassPath(Util::getRootPath()."personalKartei/Schichten/");
     addClassPath(Util::getRootPath() . "open3A/Kategorien/");
     $CCP = new CCPage();
     $CCP->loadPlugin("personalKartei", "Schichten", true);
     $T = anyC::getFirst("ZETerminal", "ZETerminalID", $args["P1"]);
     if (!$T) {
         if ($die) {
             die('{"status":"error", "message":"Unbekanntes Terminal"}');
         } else {
             return;
         }
     }
     $CT = FileStorage::getFilesDir() . "ChipTrans.csv";
     if ($args["P3"] and $args["P4"] > 0) {
         $P = new Personal($args["P4"]);
         if (trim($P->A("PersonalChipNummer")) == "") {
             $P->changeA("PersonalChipNummer", trim(strtolower($args["P0"])));
             $P->saveMe();
         } else {
             file_put_contents($CT, "{$args['P4']}:" . trim(strtolower($args["P0"])) . "\n", FILE_APPEND);
         }
     }
     $A = new stdClass();
     $Date = new Datum();
     $Date->subDay();
     $Date->addDay();
     $A->ChipID = trim(strtolower($args["P0"]));
     $A->Date = $Date->time();
     $A->Time = Util::parseTime("de_DE", date("H:i", !isset($args["P5"]) ? time() : $args["P5"]));
     $A->Type = $args["P2"];
     $A->Mode = "";
     $A->TerminalID = $args["P1"];
     try {
         $ok = ZEData::addTime($A);
     } catch (Exception $e) {
         try {
             $hex = str_pad(trim(strtolower(dechex($args["P0"]))), 10, "0", STR_PAD_LEFT);
             $A->ChipID = $hex;
             $ok = ZEData::addTime($A);
         } catch (Exception $e) {
             try {
                 if (!$args["P3"]) {
                     throw new Exception("Chip unknown", 100);
                 }
                 if (!file_exists($CT)) {
                     file_put_contents($CT, "");
                 }
                 $trans = file_get_contents($CT);
                 $found = false;
                 foreach (explode("\n", $trans) as $line) {
                     $line = trim($line);
                     $ex = explode(":", $line);
                     if (trim(strtolower($ex[1])) != trim(strtolower($args["P0"]))) {
                         continue;
                     }
                     $P = new Personal($ex[0]);
                     $A->ChipID = $P->A("PersonalChipNummer");
                     $found = true;
                 }
                 if (!$found) {
                     throw new Exception("Learn", 200);
                 }
                 #if(!$found)
                 #	throw new Exception ("Chip unknown", 100);
                 $ok = ZEData::addTime($A);
             } catch (Exception $e) {
                 switch ($e->getCode()) {
                     case 100:
                         try {
                             $F = new Factory("ZETerminalFail");
                             $F->sA("ZETerminalFailTime", time());
                             $F->sA("ZETerminalFailData", json_encode($args));
                             $F->sA("ZETerminalFailZETerminalID", $args["P1"]);
                             $F->store();
                         } catch (Exception $e) {
                         }
                         if ($die) {
                             die('{"status":"error", "message":"Unbekannter Chip"}');
                         } else {
                             return;
                         }
                         break;
                     case 200:
                         $AC = anyC::get("Personal", "isDeleted", "0");
                         $AC->setFieldsV3(array("CONCAT(nachname, ' ', vorname) AS name"));
                         $AC->addAssocV3("TRIM(CONCAT(nachname, vorname))", "!=", "");
                         $AC->addOrderV3("nachname");
                         $AC->addOrderV3("vorname");
                         $knownPID = array();
                         $file = file($CT);
                         foreach ($file as $line) {
                             $line = trim($line);
                             $ex = explode(":", $line);
                             $knownPID[$ex[0]] = true;
                         }
                         $array = array();
                         while ($A = $AC->n()) {
                             if (isset($knownPID[$A->getID()])) {
                                 continue;
                             }
                             $subArray = array();
                             foreach ($A->getA() as $key => $value) {
                                 $subArray[$key] = $value;
                             }
                             $array[] = $subArray;
                         }
                         if ($die) {
                             die('{"status":"learn", "message":' . json_encode($array, defined("JSON_UNESCAPED_UNICODE") ? JSON_UNESCAPED_UNICODE : 0) . '}');
                         } else {
                             return;
                         }
                         break;
                     default:
                         try {
                             $F = new Factory("ZETerminalFail");
                             $F->sA("ZETerminalFailTime", time());
                             $F->sA("ZETerminalFailData", $e->getMessage());
                             $F->sA("ZETerminalFailZETerminalID", $args["P1"]);
                             $F->store();
                         } catch (Exception $e) {
                         }
                         if ($die) {
                             die('{"status":"error", "message":"' . $e->getMessage() . '"}');
                         } else {
                             return;
                         }
                 }
             }
         }
     }
     if ($args["P2"] == "G") {
         $AC = anyC::get("ZEData", "ZEDataPersonalID", $ok["Personal"]->getID());
         $AC->addAssocV3("ZEDataType", "=", "K");
         $AC->addAssocV3("ZEDataDate + ZEDataTime", ">", time() - 3600 * 13);
         $AC->addAssocV3("ZEDataDate + ZEDataTime", "<", time());
         $AC->addAssocV3("ZEDataIsDeleted", "=", "0");
         $AC->addOrderV3("ZEDataDate + ZEDataTime", "DESC");
         $AC->setLimitV3("1");
         $Kommen = $AC->getNextEntry();
         if ($Kommen != null) {
             $Gehen = $ok["ZEData"];
             $T = new ZETerminal($args["P1"]);
             $AC2 = anyC::get("PZuO", "ObjektLID", $T->A("ZETerminalObjektLID"));
             $AC2->addAssocV3("PersonalID", "=", $Kommen->A("ZEDataPersonalID"));
             $PZuO = $AC2->n();
             if ($PZuO !== null) {
                 $worked = $Gehen->A("ZEDataDate") + $Gehen->A("ZEDataTime") - ($Kommen->A("ZEDataDate") + $Kommen->A("ZEDataTime"));
                 $AZ = mZEArbeitsZeit::getArbeitszeiten($PZuO->getID(), time());
                 if (isset($AZ[0])) {
                     $hasTo = $AZ[0]->A("ZEArbeitsZeitEnde") - $AZ[0]->A("ZEArbeitsZeitStart");
                     if ($worked > 0 and $worked / $hasTo > 0.9) {
                         # AND $hasTo / $worked < 1.15){
                         $DE = $ok["ZEData"];
                         $DE->changeA("ZEDataPause", $AZ[0]->A("ZEArbeitsZeitMittag"));
                         $DE->saveMe(false, false);
                     }
                 }
             }
         }
     }
     #303046a1b7
     BPS::setProperty("ZEAuswertung", "objektLID", $T->A("ZETerminalObjektLID"));
     BPS::setProperty("ZEAuswertung", "personalID", $ok["Personal"]->getID());
     BPS::setProperty("ZEAuswertung", "month", date("Ym"));
     #$ZEA = new ZEAuswertung($A->ChipID);
     #$ZEA->debug = false;
     #$current = $ZEA->getContent();
     if ($die) {
         die('{"status":"OK", "message": "' . addslashes($ok["Personal"]->A("vorname") . " " . $ok["Personal"]->A("nachname")) . '", "details": ""}');
     } else {
         return;
     }
 }
Ejemplo n.º 13
0
    public function chatPopup($root = "")
    {
        $S = anyC::getFirst("Websocket", "WebsocketUseFor", "phim");
        $I = new HTMLInput("newMessage");
        $I->style("width:100%;background-color:white;");
        $I->onEnter("phimChat.send();");
        $IC = new HTMLInput("channel", "hidden", "0");
        $IC->id("channel");
        $B = new Button("Neue Nachricht", "star", "iconic");
        $B->style("color:orange;float:right;margin-top:-3px;");
        $B->className("newMessage");
        $BOn = new Button("Online", "{$root}../ubiquitous/phim/userOnline.png", "icon");
        $BOn->style("float:left;display:none;margin-right:3px;margin-top:-2px;");
        $BOn->className("online");
        $BOff = new Button("Offline", "{$root}../ubiquitous/phim/userOffline.png", "icon");
        $BOff->style("float:left;margin-right:3px;margin-top:-2px;");
        $BOff->className("offline");
        $AC = anyC::get("phimUserHidden");
        $hidden = array();
        while ($h = $AC->n()) {
            $hidden[$h->A("phimUserHiddenUserID")] = true;
        }
        $Users = Users::getUsersArray();
        $L = new HTMLList();
        $L->setListID("userList");
        $L->addListStyle("overflow:auto;box-sizing:border-box;");
        $L->noDots();
        $L->addItem($B . "Alle");
        $L->addItemEvent("onclick", "\$j(this).removeClass('highlight'); \$j('.chatWindow').hide(); \$j('#chatText0').show(); phimChat.scroll('chatText0'); \$j('#userList .backgroundColor0').removeClass('backgroundColor0'); \$j(this).addClass('backgroundColor0'); \$j('#channel').val('0');");
        $L->addItemStyle("cursor:pointer;margin-left:0;padding:5px;");
        $L->addItemClass("backgroundColor0");
        $L->setItemID("user0");
        $content = "";
        $AC = anyC::get("phim");
        $AC->addAssocV3("phimToUserID", "=", "0");
        $AC->addAssocV3("phimphimGruppeID", "=", "0");
        $AC->addOrderV3("phimID", "DESC");
        $AC->setLimitV3(50);
        while ($M = $AC->n()) {
            $content = "<div><span class=\"username\">" . (isset($Users[$M->A("phimFromUserID")]) ? $Users[$M->A("phimFromUserID")] : "Unbekannt") . ": </span>" . $M->A("phimMessage") . "</div>" . $content;
        }
        $chatAll = "<div class=\"chatWindow\" id=\"chatText0\">{$content}</div>";
        $AC = anyC::get("phimGruppe");
        $AC->addAssocV3("INSTR(phimGruppeMembers, ';" . Session::currentUser()->getID() . ";')", ">", "0");
        $groups = array();
        $chatGroups = "";
        while ($G = $AC->n()) {
            $L->addItem($B . $G->A("phimGruppeName"));
            $L->addItemEvent("onclick", "\$j(this).removeClass('highlight'); \$j('.chatWindow').hide(); \$j('#chatTextg" . $G->getID() . "').show(); phimChat.scroll('chatTextg" . $G->getID() . "'); \$j('#userList .backgroundColor0').removeClass('backgroundColor0'); \$j(this).addClass('backgroundColor0'); \$j('#channel').val('g" . $G->getID() . "');");
            $L->addItemStyle("cursor:pointer;margin-left:0;padding:5px;");
            #$L->addItemClass("backgroundColor0");
            $L->setItemID("groupg" . $G->getID());
            $content = "";
            $ACS = anyC::get("phim");
            $ACS->addAssocV3("phimToUserID", "=", "0");
            $ACS->addAssocV3("phimphimGruppeID", "=", $G->getID());
            $ACS->addOrderV3("phimID", "DESC");
            $ACS->setLimitV3(50);
            while ($M = $ACS->n()) {
                $content = "<div><span class=\"username\">" . $Users[$M->A("phimFromUserID")] . ": </span>" . $M->A("phimMessage") . "</div>" . $content;
            }
            $groups[] = $G->getID();
            $chatGroups .= "<div class=\"chatWindow\" style=\"display:none;\" id=\"chatTextg" . $G->getID() . "\">{$content}</div>";
        }
        asort($Users);
        $chatUsers = "";
        foreach ($Users as $ID => $U) {
            if ($ID == Session::currentUser()->getID()) {
                continue;
            }
            if (isset($hidden[$ID])) {
                continue;
            }
            $unread = false;
            $content = "";
            $AC = anyC::get("phim");
            $AC->addAssocV3("phimFromUserID", "=", Session::currentUser()->getID(), "AND", "1");
            $AC->addAssocV3("phimToUserID", "=", $ID, "AND", "1");
            $AC->addAssocV3("phimFromUserID", "=", $ID, "OR", "2");
            $AC->addAssocV3("phimToUserID", "=", Session::currentUser()->getID(), "AND", "2");
            $AC->addOrderV3("phimID", "DESC");
            $AC->setLimitV3(50);
            while ($M = $AC->n()) {
                $content = "<div><span class=\"username\">" . $Users[$M->A("phimFromUserID")] . ": </span>" . $M->A("phimMessage") . "</div>" . $content;
                if (!$M->A("phimRead") and $M->A("phimToUserID") == Session::currentUser()->getID()) {
                    $unread = true;
                }
            }
            $L->addItem($BOn . $BOff . $B . $U);
            $L->addItemEvent("onclick", OnEvent::rme("phim", "setRead", $ID) . "\$j(this).removeClass('highlight'); \$j('.chatWindow').hide(); \$j('#chatText{$ID}').show(); phimChat.scroll('chatText{$ID}'); \$j('#userList .backgroundColor0').removeClass('backgroundColor0'); \$j(this).addClass('backgroundColor0');\$j('#channel').val('{$ID}');");
            $L->addItemStyle("cursor:pointer;margin-left:0;padding:5px;");
            $L->setItemID("user{$ID}");
            if ($unread) {
                $L->addItemClass("highlight");
            }
            $chatUsers .= "<div style=\"display:none;\" class=\"chatWindow\" id=\"chatText{$ID}\">{$content}</div>";
        }
        $content = "<div style=\"width:68%;display:inline-block;vertical-align:top;\">\n\t\t\t\t{$chatAll}\n\t\t\t\t{$chatUsers}\n\t\t\t\t{$chatGroups}\n\t\t\t\t<div>{$I}</div>\n\t\t\t</div><div style=\"width:32%;display:inline-block;vertical-align:top;\">{$L}{$IC}</div>";
        $rp = str_replace("interface/rme.php", "", $_SERVER["SCRIPT_NAME"]);
        if (strpos($_SERVER["SCRIPT_NAME"], "phim.php") !== false) {
            $rp = "../../";
        }
        $physion = "default";
        if (isset($_GET["physion"])) {
            $physion = $_GET["physion"];
        }
        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>phim</title>
		<script type="text/javascript" src="' . $root . '../libraries/jquery/jquery-1.9.1.min.js"></script>
		<script type="text/javascript" src="' . $root . '../libraries/jquery/jquery-ui-1.10.1.custom.min.js"></script>
		<script type="text/javascript" src="' . $root . '../libraries/iconic/iconic.min.js"></script>
		<script type="text/javascript" src="' . $root . '../libraries/jquery/jquery.qtip.min.js"></script>
		<script type="text/javascript" src="' . $root . '../javascript/P2J.js"></script>
		<script type="text/javascript" src="' . $root . '../javascript/Aspect.js"></script>
		<script type="text/javascript" src="' . $root . '../javascript/handler.js"></script>
		<script type="text/javascript" src="' . $root . '../javascript/contentManager.js"></script>
		<script type="text/javascript" src="' . $root . '../javascript/Interface.js"></script>
		<script type="text/javascript" src="' . $root . '../javascript/Overlay.js"></script>
		<script type="text/javascript" src="' . $root . '../libraries/webtoolkit.base64.js"></script>
		
		<script type="text/javascript" src="' . $root . '../ubiquitous/phim/autobahn.min.js"></script>
		<script type="text/javascript" src="' . $root . '../ubiquitous/phim/phimChat.js"></script>
		<script type="text/javascript">
			contentManager.setRoot("' . $rp . '");
			$j(function(){
				Ajax.physion = "' . $physion . '";
					
				phimChat.init(
					"ws' . ($S->A("WebsocketSecure") ? "s" : "") . '://' . $S->A("WebsocketServer") . ":" . $S->A("WebsocketServerPort") . '/",
					"' . $S->A("WebsocketRealm") . '", 
					' . Session::currentUser()->getID() . ', 
					"' . Session::currentUser()->A("name") . '",
					"' . $S->A("WebsocketToken") . '",
					[' . implode(",", $groups) . '],
					"' . $root . '");
						
				phimChat.scroll("chatText0");
				$j("#userList").css("height", $j(window).height());
			});
		</script>
		<link rel="stylesheet" type="text/css" href="' . $root . '../libraries/jquery/jquery.qtip.min.css" />
		<link rel="stylesheet" type="text/css" href="' . $root . '../styles/' . (isset($_COOKIE["phynx_color"]) ? $_COOKIE["phynx_color"] : "standard") . '/colors.css"></link>
		<link rel="stylesheet" type="text/css" href="' . $root . '../styles/standard/general.css"></link>
		<style type="text/css">
			p {
				padding:5px;
			}
			
			body {
				background-color:#ddd;
			}
			
			html {
				overflow-y: auto;
			}

			.username {
				font-weight:bold;
			}
			
			.chatWindow {
				padding:5px;
				box-sizing:border-box;
				overflow-y: auto;
				height:270px;
				background-color:white;
				border-bottom:3px solid grey;
			}
			
			.newMessage {
				display:none;
			}
			
			.highlight .newMessage {
				display:block;
			}
			
			#darkOverlay {
				position:fixed;
				top:0;
				left:0;
			}
			
			#userList li {
				white-space: nowrap;
				overflow:hidden;
				margin-top:0;
			}
		</style>
	</head>
	<body>
		<div id="darkOverlay" style="background-color:rgba(0,0,0,.7);color:white;"></div>
		' . $content . '
	</body>
</html>';
    }
Ejemplo n.º 14
0
 public static function getLangCurrencyFactor($language)
 {
     if (!Session::isPluginLoaded("mSprache")) {
         return 1;
     }
     $Sprache = anyC::getFirst("Sprache", "SpracheIdentifier", $language);
     if ($Sprache == null) {
         return 1;
     }
     return $Sprache->A("SpracheWaehrungFaktor") * 1;
 }
Ejemplo n.º 15
0
 public static function stamp($args)
 {
     #if(strtolower($args["P0"]) == "303005f7b4")
     #	die('{"status":"command", "action":"reload"}');
     if (!isset($_SESSION["BPS"])) {
         $_SESSION["BPS"] = new BackgroundPluginState();
     }
     addClassPath(Util::getRootPath() . "personalKartei/Zeiterfassung/");
     addClassPath(Util::getRootPath() . "personalKartei/Personal/");
     addClassPath(Util::getRootPath() . "personalKartei/ObjekteL/");
     addClassPath(Util::getRootPath() . "open3A/Kategorien/");
     $T = anyC::getFirst("ZETerminal", "ZETerminalID", $args["P1"]);
     if (!$T) {
         die('{"status":"error", "message":"Unbekanntes Terminal"}');
     }
     $A = new stdClass();
     $Date = new Datum();
     $Date->subDay();
     $Date->addDay();
     $A->ChipID = trim(strtolower($args["P0"]));
     $A->Date = $Date->time();
     $A->Time = Util::parseTime("de_DE", date("H:i", time()));
     $A->Type = $args["P2"];
     $A->Mode = "";
     $A->TerminalID = $args["P1"];
     try {
         $ok = ZEData::addTime($A);
     } catch (Exception $e) {
         try {
             $A->ChipID = trim(strtolower(dechex($args["P0"])));
             $ok = ZEData::addTime($A);
         } catch (Exception $e) {
             switch ($e->getCode()) {
                 case 100:
                     die('{"status":"error", "message":"Unbekannter Chip"}');
                     break;
                 default:
                     die('{"status":"error", "message":"' . $e->getMessage() . '"}');
             }
         }
     }
     if ($args["P2"] == "G") {
         $AC = anyC::get("ZEData", "ZEDataChipID", $A->ChipID);
         $AC->addAssocV3("ZEDataType", "=", "K");
         $AC->addAssocV3("ZEDataDate + ZEDataTime", ">", time() - 3600 * 13);
         $AC->addOrderV3("ZEDataID", "DESC");
         $AC->addAssocV3("ZEDataIsDeleted", "=", "0");
         $AC->setLimitV3("1");
         $D = $AC->getNextEntry();
         if ($D != null) {
             $pause = ZEAuswertung::calcPause($D, $ok["ZEData"]);
             if ($pause !== null) {
                 $DE = $ok["ZEData"];
                 $DE->changeA("ZEDataPause", $pause);
                 $DE->saveMe(false, false);
             }
         }
     }
     #303046a1b7
     BPS::setProperty("ZEAuswertung", "objektLID", $T->A("ZETerminalObjektLID"));
     BPS::setProperty("ZEAuswertung", "personalID", $ok["Personal"]->getID());
     BPS::setProperty("ZEAuswertung", "month", date("Ym"));
     #$ZEA = new ZEAuswertung($A->ChipID);
     #$ZEA->debug = false;
     #$current = $ZEA->getContent();
     die('{"status":"OK", "message": "' . addslashes($ok["Personal"]->A("vorname") . " " . $ok["Personal"]->A("nachname")) . '", "details": ""}');
     #Stunden '.Util::CLMonthName(date("m")).': '.Util::formatSeconds($current["totalHours"][1], false).'
 }