Exemplo n.º 1
0
 /**
  * @return iCorporateDesign
  */
 public static function getCorporateDesign()
 {
     try {
         $FB = new FileBrowser();
         $FB->addDir(FileStorage::getFilesDir());
         $FB->addDir(Util::getRootPath() . "specifics");
         $T = $FB->getAsLabeledArray("iCorporateDesign", ".class.php");
         foreach ($T as $c) {
             $CD = new $c();
             break;
         }
         #throw new ClassNotFoundException();
     } catch (ClassNotFoundException $e) {
         $CD = new CorporateDesign();
     }
     return $CD;
 }
Exemplo n.º 2
0
 public function setPath()
 {
     $bps = $this->getMyBPSData();
     #Aspect::registerOnetimePointCut("aboveList", "GUIFactory::getContainer", "FileManagerGUI::adviceAboveList");
     $rootDir = null;
     if ($bps != -1 and isset($bps["root"])) {
         $rootDir = preg_replace("/^([A-Z])%/", "\\1:", $bps["root"]);
     }
     #echo $rootDir;
     if ($rootDir != null) {
         $T = new HTMLTable(1);
         #$rel = "specifics/$rootDir";
         #$root = Util::getRootPath().$rel;
         $root = FileStorage::getFilesDir() . $rootDir;
         $_SESSION["BPS"]->setProperty("FileManagerGUI", "path", preg_replace("/^([A-Z]):/", "\\1%", $root));
         $_SESSION["BPS"]->setProperty("FileManagerGUI", "root", preg_replace("/^([A-Z]):/", "\\1%", $root));
         $F = new File($root);
         $F->loadMe();
         if ($F->getA() == null) {
             if (is_writable(FileStorage::getFilesDir())) {
                 mkdir($root);
             } else {
                 $B = new Button("", "stop");
                 $B->type("icon");
                 $B->style("float:left;margin-right:10px;");
                 $T->addRow($B . "Das Verzeichnis <code>{$rel}</code> existiert nicht und kann nicht automatisch angelegt werden, da keine Schreibberechtigung für <code>specifics</code> vorliegt.");
                 return $T;
             }
         }
     }
     $bps = $this->getMyBPSData();
     //go again
     #print_r($bps);
     if (isset($bps["path"]) and strpos($bps["path"], $bps["root"]) === false) {
         $bps["path"] = preg_replace("/^([A-Z])%/", "\\1:", $bps["root"]);
     }
     #$bps["root"];
     if ($bps != -1 and isset($bps["path"])) {
         $this->setDir(preg_replace("/^([A-Z])%/", "\\1:", $bps["path"]));
     }
     return true;
 }
Exemplo n.º 3
0
 public function download()
 {
     $this->loadMe();
     if (strpos($this->getID(), realpath(FileStorage::getFilesDir())) === false) {
         return;
     }
     #if(strpos($this->ID, "specifics") === false) return;
     #if(strpos(strtolower($this->ID), ".pdf") !== false)
     #	header("Content-Type: application/pdf");
     #if(strpos(strtolower($this->ID), ".jpg") !== false)
     #	header("Content-Type: image/jpg");
     #if(strpos(strtolower($this->ID), ".png") !== false)
     #	header("Content-Type: image/png");
     #if(strpos(strtolower($this->ID), ".gif") !== false)
     #	header("Content-Type: image/gif");
     $ex = explode(DIRECTORY_SEPARATOR, $this->ID);
     header("Content-Type: " . $this->A("FileMimetype"));
     header("Content-Disposition: attachment; filename=\"" . $ex[count($ex) - 1] . "\"");
     header('Content-Length: ' . filesize($this->ID));
     readfile($this->ID);
 }
Exemplo n.º 4
0
 function backgroudUpload($DeviceID, $filename)
 {
     $O = anyC::getFirst("fheOverview", "fheOverviewDeviceID", $DeviceID);
     $d = json_decode($O->A("fheOverviewDesktop"));
     $d->background = "OverviewBG." . Util::ext($filename);
     $C = $_SESSION["TempFiles"]->getCollector();
     $v = $C[0];
     file_put_contents(realpath(FileStorage::getFilesDir()) . "/OverviewBG." . Util::ext($filename), file_get_contents($v->A("filename")));
     unlink($v->A("filename"));
     unset($_SESSION["TempFiles"]);
     $O->changeA("fheOverviewDesktop", json_encode($d));
     $O->saveMe();
     echo OnEvent::script("\$j('#wrapper').css('background-image', 'url(./specifics/{$d->background})');");
 }
Exemplo n.º 5
0
 function deleteSingle($table, $keyName, $id)
 {
     if (strpos($id, FileStorage::getFilesDir()) === false) {
         Red::errorD("Die Datei kann wegen fehlender Berechtigung nicht gelöscht werden!");
     }
     if (is_dir($id)) {
         $fp = opendir($id);
         $i = 0;
         while (($file = readdir($fp)) !== false) {
             if ($file == ".") {
                 continue;
             }
             if ($file == "..") {
                 continue;
             }
             $i++;
         }
         closedir($fp);
         if ($i > 0) {
             Red::errorD("Das Verzeichnis kann nicht gelöscht werden, es ist nicht leer!");
         }
         rmdir($id);
     } else {
         if (!is_writable($id)) {
             Red::errorD("Die Datei kann wegen fehlender Berechtigung nicht gelöscht werden!");
         }
         unlink($id);
     }
 }
Exemplo n.º 6
0
 protected function _getfontpath($file = null)
 {
     if (file_exists(Util::getRootPath() . "specifics/{$file}")) {
         return Util::getRootPath() . "specifics/{$file}";
     }
     if (file_exists(FileStorage::getFilesDir() . $file)) {
         return FileStorage::getFilesDir() . $file;
     }
     if (file_exists(Util::getRootPath() . "ubiquitous/Fonts/{$file}")) {
         return Util::getRootPath() . "ubiquitous/Fonts/{$file}";
     }
     if (file_exists(dirname(__FILE__) . '/font/' . $file)) {
         return dirname(__FILE__) . '/font/' . $file;
     }
     #if (!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__) . '/font'))
     #	define('FPDF_FONTPATH', dirname(__FILE__) . '/font/');
     #return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : '';
 }
Exemplo n.º 7
0
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *  lightAd is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  2007 - 2016, Rainer Furtmeier - Rainer@Furtmeier.IT
 */
if (isset($argv[1])) {
    $_GET["cloud"] = $argv[1];
}
if (isset($argv[2])) {
    $_SERVER["HTTP_HOST"] = $argv[2];
}
session_name("ExtConnOWM");
require_once realpath(dirname(__FILE__) . "/../../system/connect.php");
$absolutePathToPhynx = Util::getRootPath();
$e = new ExtConn($absolutePathToPhynx);
$e->addClassPath($absolutePathToPhynx . "ubiquitous/OWM");
$e->addClassPath($absolutePathToPhynx . "specifics");
$e->addClassPath(FileStorage::getFilesDir());
$e->useDefaultMySQLData();
$e->useUser();
#echo "<pre>";
mOpenWeatherMap::update();
$e->cleanUp();
#echo "</pre>";
Exemplo n.º 8
0
 public static function findImages($html)
 {
     $images = array();
     preg_match_all("/src\\=\"\\.\\.\\/interface\\/loadFrame\\.php\\?p=DBImage&amp;id=tinyMCEGUI:::([a-zA-Z0-9:\\.@_-]*)\"/ismU", $html, $matches);
     if (isset($matches[1])) {
         foreach ($matches[1] as $k => $imageUrl) {
             $images[] = FileStorage::getFilesDir() . str_replace(":::", "/", $imageUrl);
         }
     }
     $images = array_unique($images);
     return $images;
 }
Exemplo n.º 9
0
 public function deletePoolFile($dir, $fileName)
 {
     unlink(FileStorage::getFilesDir() . "{$dir}/" . $fileName);
 }
Exemplo n.º 10
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;
     }
 }
Exemplo n.º 11
0
 public function previewPDF()
 {
     if (strpos($this->getID(), realpath(FileStorage::getFilesDir())) === false) {
         return;
     }
     header('Content-Type: application/pdf');
     header('Content-Length: ' . filesize($this->getID()));
     header('Content-disposition: inline; filename="' . basename($this->getID()) . '"');
     readfile($this->getID());
 }
Exemplo n.º 12
0
        continue;
    }
    $ek = Util::eK();
    if ($lastUser == $ek) {
        syslog(LOG_ERR, "Changing cloud failed! Test 1");
        throw new Exception("Changing cloud failed 1 ({$lastZugang} > {$zugang})!");
    }
    if ($lastDir == FileStorage::getFilesDir()) {
        syslog(LOG_ERR, "Changing cloud failed! Test 2");
        throw new Exception("Changing cloud failed 2 ({$lastZugang} > {$zugang})!");
    }
    $e->addClassPath(FileStorage::getFilesDir());
    try {
        syslog(LOG_INFO, "{$zugang} updating...");
        mRSSParser::update();
    } catch (FieldDoesNotExistException $ex) {
        echo $zugang . " " . get_class($ex) . ": " . $ex->getField() . "\n";
    } catch (Exception $ex) {
        echo $zugang . " " . get_class($ex) . ": " . $ex->getMessage() . "\n";
    }
    syslog(LOG_INFO, "{$zugang} finished");
    $lastZugang = $zugang;
    $lastUser = $ek;
    $lastDir = FileStorage::getFilesDir();
    DBStorage::disconnect();
}
$e->cleanUp();
flock($fp, LOCK_UN);
fclose($fp);
syslog(LOG_INFO, "Done.");
closelog();
Exemplo n.º 13
0
 public function processUpload($fileName)
 {
     $ex = explode(".", strtolower($fileName));
     $mime = null;
     if ($ex[count($ex) - 1] == "ogg") {
         $mime = "ogg";
     }
     if ($ex[count($ex) - 1] == "mp3") {
         $mime = "mp3";
     }
     if ($mime == null) {
         Red::alertD("Datei unbekannt. Bitte verwenden Sie ogg oder mp3-Dateien.");
     }
     $tempDir = Util::getTempFilename();
     unlink($tempDir);
     $tempDir = dirname($tempDir);
     $filePath = $tempDir . "/" . $fileName . ".tmp";
     echo FileStorage::getFilesDir() . $fileName;
     if (!copy($filePath, FileStorage::getFilesDir() . $fileName)) {
         Red::errorD("Der Upload ist fehlgeschlagen!");
     }
     unlink($filePath);
 }