Example #1
0
 function write()
 {
     $F = new File($this->fileName);
     $F->loadMe();
     if (!$F->getA()->FileIsWritable) {
         return false;
     }
     $fp = fopen($this->fileName, 'w');
     fwrite($fp, $this->getContent());
     fclose($fp);
     return true;
 }
 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;
 }
Example #3
0
 public function getPopupManager($rootDir = null, $class = null, $classID = null, $usePool = false, $fieldDefaultFile = "", $uploadTargetFilename = null)
 {
     if ($rootDir != null) {
         $T = new HTMLTable(1);
         #$rel = "$rootDir";
         $root = FileStorage::getFilesDir() . $rootDir;
         $_SESSION["BPS"]->setProperty("mFileGUI", "path", $root);
         $_SESSION["BPS"]->setProperty("mFileGUI", "root", $root);
         $F = new File($root);
         $F->loadMe();
         if ($F->getA() == null) {
             if (is_writable(FileStorage::getFilesDir())) {
                 mkdir($root, 0777, true);
             } else {
                 $B = new Button("", "stop");
                 $B->type("icon");
                 $B->style("float:left;margin-right:10px;");
                 $T->addRow($B . "Das Verzeichnis <code>{$rootDir}</code> existiert nicht und kann nicht automatisch angelegt werden, da keine Schreibberechtigung für <code>specifics</code> vorliegt.");
                 die($T);
             }
         }
     }
     $bps = $this->getMyBPSData();
     if (strpos($bps["path"], $bps["root"]) === false) {
         $bps["path"] = $bps["root"];
     }
     if ($bps != -1 and isset($bps["path"])) {
         $this->setDir($bps["path"]);
     }
     $this->hideDirs(true);
     $gui = new HTMLGUIX();
     $gui->object($this);
     $cols = array();
     if ($fieldDefaultFile != "") {
         $C = new $class($classID);
         self::$fieldDefaultFile = array($C, $C->A($fieldDefaultFile), $fieldDefaultFile);
         $cols[] = "isDefault";
         $gui->colWidth("isDefault", 20);
         $gui->parser("isDefault", "mFileGUI::parserDefault");
     }
     $cols[] = "FileName";
     $gui->attributes($cols);
     $gui->parser("FileName", "mFileGUI::nameParser2");
     $gui->options(true, false, false);
     $gui->name("Datei");
     $gui->addToEvent("onDelete", OnEvent::reloadPopup("mFile"));
     $oldFiles = "";
     if ($class != null and $classID != null) {
         $AC = anyC::get("Datei", "DateiClassID", $classID);
         $AC->addAssocV3("DateiClass", "=", $class);
         $oldFiles = new HTMLTable(2, "Verknüpfte Dateien");
         while ($F = $AC->getNextEntry()) {
             $BDL = new Button("Datei herunterladen", "./plugins/Files/download.png", "icon");
             $BDL->onclick("windowWithRme('File','" . $F->A("DateiPath") . "','download','');");
             $BDL->style("float:right;");
             $oldFiles->addRow(array($BDL . $F->A("DateiName")));
         }
     }
     $BPool = new Button("Pool\nanzeigen", "./lightCRM/Mail/images/attach.png");
     $BPool->style("float:right;margin:10px;");
     $BPool->onclick(OnEvent::popupSidePanel("mFile", -1, "sidePanelPool", array("'{$class}Pool'", "'{$rootDir}'")));
     if ($usePool and $rootDir) {
         echo $BPool . "<div style=\"clear:both;\"></div>";
         if (file_exists(FileStorage::getFilesDir() . "{$class}Pool")) {
             echo OnEvent::script("window.setTimeout(function(){ if(\$j('#editDetailsmFileSidePanel').length > 0) return; " . OnEvent::popupSidePanel("mFile", -1, "sidePanelPool", array("'{$class}Pool'", "'{$rootDir}'")) . "}, 100);");
         }
     }
     $F = new HTMLForm("fileUpload", array("datei"));
     $s = array("path" => $bps["path"], "class" => "File");
     if ($uploadTargetFilename != null) {
         $s["targetFilename"] = $uploadTargetFilename;
     }
     $F->setType("datei", "file", null, $s);
     $F->addJSEvent("datei", "onChange", OnEvent::reloadPopup("mFile"));
     $F->getTable()->setColWidth(1, 120);
     echo "<p class=\"prettyTitle\">/" . basename($bps["path"]) . "</p><p style=\"color:grey;margin-top:-15px;margin-bottom:10px;\"><small>" . dirname(realpath($bps["path"])) . "</small></p>" . $F . $gui->getBrowserHTML(-1) . $oldFiles;
 }
 function getHTML($id)
 {
     $showHelp = true;
     if ($this->collector == null) {
         $this->lCV3($id);
     }
     $singularLanguageClass = $this->loadLanguageClass("Installation");
     $text = $singularLanguageClass != null ? $singularLanguageClass->getText() : "";
     $t = new HTMLTable(1);
     $g = "";
     $DBFilePath = Util::getRootPath() . "system/DBData/Installation.pfdb.php";
     $writable = new HTMLTable(1);
     $File = new File($DBFilePath);
     $File->loadMe();
     if (!$File->getA()->FileIsWritable) {
         $writable->addRow("<img src=\"./images/navi/restrictions.png\" style=\"float:left;margin-right:10px;\"/>Die Datei " . $DBFilePath . " ist nicht beschreibbar, Änderungen können nicht gespeichert werden.<br /><br />Machen Sie die Datei mit einem FTP-Programm beschreibbar. Klicken Sie dazu mit der rechten Maustaste auf die Datei auf dem Server, wählen Sie \"Eigenschaften\", und geben Sie den Modus 666 an, damit sie durch den Besitzer, die Gruppe und alle Anderen les- und schreibbar ist.");
         $g .= $writable->getHTML();
     }
     $gui = new HTMLGUI();
     $gui->setName("Datenbank-Zugangsdaten");
     if ($this->collector != null) {
         $gui->setAttributes($this->collector);
     }
     $gui->setCollectionOf($this->collectionOf, "Datenbank-Zugangsdaten");
     $gui->hideAttribute("password");
     $gui->hideAttribute("httpHost");
     $gui->hideAttribute("InstallationID");
     if (strstr($_SERVER["SCRIPT_FILENAME"], "demo")) {
         $UA = $_SESSION["S"]->getCurrentUser()->getA();
         if ($UA->name != "Installations-Benutzer") {
             $g = "In der Demo können keine Datenbank-Zugangsdaten geändert werden!";
             $gui->setIsDisplayMode(true);
         }
     }
     if (!Session::isPluginLoaded("multiInstall")) {
         $gui->setIsDisplayMode(true);
         $gui->setEditInDisplayMode(true, "contentLeft");
     }
     #try {
     $g .= $gui->getBrowserHTML($id);
     #} catch (Exception $e){
     #	$t->addRow(array("Etwas stimmt nicht, eine ".get_class($e)." wurde abgefangen!"));
     #	$t->addRow(array("<span style=\"font-size:8px;\">".nl2br(str_replace("#","\n#", $e->getTraceAsString()))."</span>"));
     #}
     $help = "\n\t<script type=\"text/javascript\">\n\t\tcontentManager.rmePCR('mInstallation','','getHelp','true','if(checkResponse(transport)) { Popup.create(\\'123\\', \\'Installation\\', \\'Hilfe\\'); Popup.update(transport, \\'123\\', \\'Installation\\'); }');\n\t</script>";
     try {
         $user = new User(1);
         $user->loadMe();
     } catch (DatabaseNotSelectedException $e) {
         $t->addRow(isset($text["noDatabase"]) ? $text["noDatabase"] : "Es wurde kein korrekter Datenbankname angegeben.<br /><br />Bitte geben Sie eine existierende Datenbank an, sie wird nicht automatisch erzeugt.");
         return $g . $t->getHTML() . $help;
     } catch (NoDBUserDataException $e) {
         $t->addRow(isset($text["wrongData"]) ? $text["wrongData"] : "Mit den angegebenen Datenbank-Zugangsdaten kann keine Verbindung aufgebaut werden.<br /><br />Wenn sie korrekt sind, wird hier eine Liste der Plugins angezeigt.");
         if (PHYNX_MAIN_STORAGE == "MySQL") {
             try {
                 $DB1 = new DBStorageU();
                 $B = new Button("Hinweis", "notice", "icon");
                 $B->style("float:left;margin-right:10px;");
                 $File = new File(Util::getRootPath() . "system/connect.php");
                 $BR = new Button("DB-Verbindung\numstellen", "lieferschein");
                 $BR->style("float:right;margin-left:10px;");
                 $BR->rmePCR("mInstallation", "-1", "switchDBToMySQLo", "", "Installation.reloadApp();");
                 $BR = "Verwenden Sie den nebenstehenden Knopf, um die Verbindungsart auf die ältere Version umzustellen.<br />{$BR} Sie müssen sich anschließend erneut anmelden.";
                 $BReload = new Button("Ansicht\naktualisieren", "refresh");
                 $BReload->onclick("contentManager.emptyFrame('contentLeft'); contentManager.loadFrame('contentRight', 'mInstallation', -1, 0, 'mInstallationGUI;-');Popup.closeNonPersistent();");
                 $BReload->style("float:right;margin:10px;");
                 if (!$File->A("FileIsWritable")) {
                     $BR = "Bitte machen Sie die Datei /system/connect.php für den Webserver beschreibbar, damit phynx auf die ältere Verbindungsart umstellen kann.<br /><br />Verwenden Sie dazu Ihr FTP-Programm. Klicken Sie mit der rechten Maustaste auf die Datei auf dem Server, wählen Sie \"Eigenschaften\", und geben Sie den Modus 666 an, damit sie durch den Besitzer, die Gruppe und alle Anderen les- und schreibbar ist.{$BReload}";
                 }
                 $t->addRow(array("{$B} <b>Möglicherweise ist die MySQLi-Erweiterung auf Ihrem Server nicht korrekt konfiguriert.</b><br /><br />{$BR}"));
                 $t->addRowClass("backgroundColor0");
             } catch (Exception $e) {
                 #echo "MySQL geht auch nicht!";
             }
         }
         return $g . $t->getHTML() . $help;
     } catch (DatabaseNotFoundException $e) {
         $t->addRow(isset($text["noDatabase"]) ? $text["noDatabase"] : "Es wurde kein korrekter Datenbankname angegeben.<br /><br />Bitte geben Sie eine existierende Datenbank an, sie wird nicht automatisch erzeugt.");
         return $g . $t->getHTML() . $help;
     } catch (TableDoesNotExistException $e) {
     } catch (StorageException $e) {
     }
     $help = "\n\t<script type=\"text/javascript\">\n\t\trme('mInstallation','','getHelp','false','if(checkResponse(transport)) { Popup.create(\\'123\\', \\'Installation\\', \\'Hilfe\\'); Popup.update(transport, \\'123\\', \\'Installation\\'); }');\n\t</script>";
     if ($id == -1) {
         $BackupTab = new HTMLTable(1);
         $BackupButton = new Button("Backup-\nManager", "disk");
         $BackupButton->style("float:right;");
         $BackupButton->onclick("contentManager.loadFrame('contentLeft','BackupManager');");
         $BackupTab->addRow($BackupButton);
         $BUT = new Button(isset($text["alle Tabellen aktualisieren"]) ? $text["alle Tabellen aktualisieren"] : "alle Tabellen\naktualisieren", "update");
         $BUT->rmePCR("mInstallation", "", "updateAllTables", "", "\$('contentLeft').update(transport.responseText);");
         $g .= "\n\t<div style=\"height:30px;\"></div>\n\t{$BackupTab}\n\t<div class=\"Tab backgroundColor1\"><p>Plugins</p></div>\n\t<table>\n\t\t<colgroup>\n\t\t\t<col style=\"width:100px;\" class=\"backgroundColor2\" />\n\t\t\t<col class=\"backgroundColor3\" />\n\t\t</colgroup>\n\t\t<tr>\n\t\t\t<td colspan=\"3\">\n\t\t\t\t<span style=\"float:right;\">" . Installation::getReloadButton() . "</span>\n\t\t\t\t{$BUT}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td style=\"background-color:white;\"></td>\n\t\t</tr>";
         $p = array_flip($_SESSION["CurrentAppPlugins"]->getAllPlugins());
         foreach ($p as $key => $value) {
             try {
                 if (method_exists($_SESSION["CurrentAppPlugins"], "isPluginGeneric") and $_SESSION["CurrentAppPlugins"]->isPluginGeneric($key)) {
                     $c = new mGenericGUI('', $key);
                 } else {
                     $c = new $key();
                 }
             } catch (ClassNotFoundException $e) {
                 $key2 = $key . "GUI";
                 try {
                     $c = new $key2();
                 } catch (ClassNotFoundException $e2) {
                     continue;
                 }
             }
             if ($key == "CIs") {
                 continue;
             }
             /*$e = explode(", ",$_SESSION["CurrentAppPlugins"]->getDepsOfPlugin($key));
             		for($i=0;$i<count($e);$i++) 
             			if($e[$i] != "none") 
             				$e[$i] = (($p[$e[$i]] != -1) ? $p[$e[$i]] : $e[$i]);*/
             if ($c->checkIfMyTableExists() and $c->checkIfMyDBFileExists()) {
                 $showHelp = false;
             }
             if (!$c->checkIfMyDBFileExists()) {
                 continue;
             }
             $g .= "\n\t\t<tr>\n\t\t\t<td style=\"font-weight:bold;text-align:right;\">" . ($value != -1 ? $value : $key) . "</td>\n\t\t\t<td>" . (!$c->checkIfMyTableExists() ? $c->checkIfMyDBFileExists() ? "<input type=\"button\" value=\"" . (isset($text["Tabelle anlegen"]) ? $text["Tabelle anlegen"] : "Tabelle anlegen") . "\" onclick=\"installTable('{$key}');\" />" : "keine DB-Info-Datei" : ($c->checkIfMyDBFileExists() ? "<input type=\"button\" onclick=\"checkFields('{$key}');\" value=\"Tabellenupdate\" style=\"float:right;width:140px;\" />" . (isset($text["Tabelle existiert"]) ? $text["Tabelle existiert"] : "Tabelle existiert") : (isset($text["keine DB-Info-Datei"]) ? $text["keine DB-Info-Datei"] : "keine DB-Info-Datei")) . "") . "</td>\n\t\t</tr>";
         }
         $g .= "\n\t</table>";
     }
     $showHelp = false;
     if (!$showHelp) {
         $help = "";
     }
     $ST = new HTMLSideTable("left");
     try {
         $BTestMail = $ST->addButton("Mailversand\ntesten", "mail");
         $BTestMail->popup("mailTest", "Mailversand testen", "mInstallation", "-1", "testMailGUI");
         $MailServer = LoginData::get("MailServerUserPass");
         $MailServerID = $MailServer == null ? -1 : $MailServer->getID();
         $BMail = $ST->addButton("Mail-Server\neintragen", "./plugins/Installation/serverMail.png");
         $BMail->popup("edit", "Mail-Server", "LoginData", $MailServerID, "getPopup", "", "LoginDataGUI;preset:mailServer");
     } catch (Exception $e) {
     }
     return (!$showHelp ? $ST : "") . $g . $help;
 }
 public static function checkForTodaysBackup()
 {
     $BF = BackupManagerGUI::getNewBackupName();
     $F = new File($BF);
     $F->loadMe();
     return $F->getA() != null;
 }