function manageEditors() { if ($_SESSION["OBJ_user"]->allow_access("xwysiwyg", "settings")) { $this->content .= "<a href=\"" . $this->linkRef . "&action=admin" . "\">" . $_SESSION['translate']->it("Back to administration") . "</a>"; if (isset($_GET['updList'])) { //to update, simply delete the existing file @unlink(PHPWS_HOME_DIR . "files/xwysiwyg/editors/list.txt"); } $editors = array(); $formTags = array(); $table = array(); $this->content .= "<br /><br /><b>" . $_SESSION['translate']->it("Available editors") . "</b>"; $table[] = array("<b>" . $_SESSION['translate']->it("Location") . "</b>", "<b>" . $_SESSION['translate']->it("Editor") . "</b>", "<b>" . $_SESSION['translate']->it("Status") . "</b>", "<b>" . $_SESSION['translate']->it("Action") . "</b>"); $dir = PHPWS_File::readDirectory(PHPWS_HOME_DIR . "files/xwysiwyg/editors/", FALSE, TRUE, FALSE, array('conf')); if (is_array($dir)) { $location = $_SESSION['translate']->it("local"); foreach ($dir as $file) { include PHPWS_HOME_DIR . "files/xwysiwyg/editors/" . $file; $editors[] = $cfg_editor; $result = $GLOBALS['core']->quickFetch("SELECT editor FROM mod_xw_config WHERE editor = '{$cfg_editor}'", TRUE, TRUE); if ($result) { $status = $_SESSION['translate']->it("installed"); $action_link = $this->linkRef . "&action=delEditor&delEditor={$cfg_editor}"; $action_label = $_SESSION['translate']->it("Uninstall"); $action = "<a href=\"{$action_link}\">{$action_label}</a>"; $select = $GLOBALS['core']->quickFetch("SELECT editor FROM mod_xw_editor", TRUE, TRUE); if ($select['editor'] == $cfg_editor) { $editor = "<strong>{$cfg_editor}</strong>"; } else { $action_link = $this->linkRef . "&action=toggle&editor={$cfg_editor}"; $action_label = $_SESSION['translate']->it("Select"); $action .= " || <a href=\"{$action_link}\">{$action_label}</a>"; $editor = $cfg_editor; } } else { $status = $_SESSION['translate']->it("not installed"); $action_link = $this->linkRef . "&action=addEditor&addEditor={$cfg_editor}&fn={$file}"; $action_label = $_SESSION['translate']->it("Install"); $action = "<a href=\"{$action_link}\">{$action_label}</a>"; $action_link = $this->linkRef . "&action=delFile&delFile={$cfg_editor}&filetyp=ext"; $action_label = $_SESSION['translate']->it("Remove"); $action .= " || <a href=\"{$action_link}\">{$action_label}</a>"; $editor = $cfg_editor; } $table[] = array($location, $editor, $status, $action); } } else { $this->content .= "<br />" . $_SESSION['translate']->it("No local editors found"); } if (!$GLOBALS["core"]->isHub) { $table[] = array("<b>" . $_SESSION['translate']->it("Location") . "</b>", "<b>" . $_SESSION['translate']->it("Editor") . "</b>", "<b>" . $_SESSION['translate']->it("Status") . "</b>", "<b>" . $_SESSION['translate']->it("Action") . "</b>"); if (!is_dir("{$GLOBALS['core']->home_dir}files/xwysiwyg/")) { PHPWS_File::makeDir($GLOBALS['core']->home_dir . "files/xwysiwyg/"); } if (!is_dir("{$GLOBALS['core']->home_dir}files/xwysiwyg/editors/")) { PHPWS_File::makeDir($GLOBALS['core']->home_dir . "files/xwysiwyg/editors/"); } $dir = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . "files/xwysiwyg/editors/", FALSE, TRUE, FALSE, array('conf')); if (is_array($dir)) { $location = $_SESSION['translate']->it("hub"); foreach ($dir as $file) { include_once PHPWS_SOURCE_DIR . "files/xwysiwyg/editors/" . $file; if (!in_array($cfg_editor, $editors)) { $status = $_SESSION['translate']->it("not copied"); $action_link = $this->linkRef . "&action=cpyEditor&cpyEditor={$cfg_editor}"; $action_label = $_SESSION['translate']->it("Copy"); $action = "<a href=\"{$action_link}\">{$action_label}</a>"; $editor = $cfg_editor; } else { $status = $_SESSION['translate']->it("copied"); $action_link = $this->linkRef . "&action=remEditor&remEditor={$cfg_editor}"; $action_label = ""; $action = "na"; $editor = $cfg_editor; } $table[] = array($location, $editor, $status, $action); } } else { $this->content .= "<br />" . $_SESSION['translate']->it("No editors found on hub"); } } $this->content .= PHPWS_Text::ezTable($table, 2, 2, 1, "", NULL, 1, "top"); $this->content .= "<br /><br /><b>" . $_SESSION['translate']->it("Available editor-packages") . "</b>"; $this->content .= " <a href=\"" . $this->linkRef . "&action=manageEditor&updList=1" . "\">" . $_SESSION['translate']->it("Update List") . "</a>"; $table = array(); $table[] = array("<b>" . $_SESSION['translate']->it("Location") . "</b>", "<b>" . $_SESSION['translate']->it("Editor") . "</b>", "<b>" . $_SESSION['translate']->it("Description") . "</b>", "<b>" . $_SESSION['translate']->it("Action") . "</b>"); $dir = PHPWS_File::readDirectory(PHPWS_HOME_DIR . "files/xwysiwyg/editors/", FALSE, TRUE, FALSE, array('tgz')); if (is_array($dir)) { $location = $_SESSION['translate']->it("local"); foreach ($dir as $file) { $status = $_SESSION['translate']->it("Archive package"); $action_link = $this->linkRef . "&action=tarEditor&tarEditor={$file}&local=1"; $action_label = $_SESSION['translate']->it("Extract"); $action = "<a href=\"{$action_link}\">{$action_label}</a>"; $action_link = $this->linkRef . "&action=delFile&delFile={$file}&filetyp=tgz"; $action_label = $_SESSION['translate']->it("Delete"); $action .= " || <a href=\"{$action_link}\">{$action_label}</a>"; $editor = $file; $table[] = array($location, $editor, $status, $action); } } // fixme: remeber to update this entry ! $file_loc = PHPWS_HOME_DIR . "files/xwysiwyg/editors/list.txt"; $file_onl = "http://www.firebird.ch/xwysiwyg/editors/list41.txt"; $location = $_SESSION['translate']->it("remote"); if (!is_file($file_loc)) { PHPWS_File::fileCopy($file_onl, PHPWS_HOME_DIR . "files/xwysiwyg/editors/", "list.txt", TRUE, TRUE); } if ($rows = file($file_loc)) { PHPWS_Array::dropNulls($rows); foreach ($rows as $items) { $item = explode("::", $items); $editor = $item[0]; if (in_array($editor, $editors)) { continue; } $status = $item[1]; $action_label = $_SESSION['translate']->it("Direct install ([var1]kb)", $item[3]); $action_link = $this->linkRef . "&action=tarEditor&tarEditor=" . $item[2]; $action = "<a href=\"{$action_link}\">{$action_label}</a>"; $action_label = $_SESSION['translate']->it("Download"); $action_link = "http://www.firebird.ch/xwysiwyg/editors/" . $item[2]; $action .= " || <a href=\"{$action_link}\" target=\"_blank\">{$action_label}</a>"; $table[] = array($location, $editor, $status, $action); } } $this->content .= PHPWS_Text::ezTable($table, 2, 2, 1, "", NULL, 1, "top"); $this->content .= $_SESSION['translate']->it("Depending on your server's security settings, direct install may not work.") . "<br />"; $this->content .= $_SESSION['translate']->it("If everything fails, or if you want to modify the editor,") . "<br />"; $this->content .= $_SESSION['translate']->it("download the file and copy it to /_phpws_/files/xwysiwyg/editors/ manually") . "<br />"; } else { $this->content .= $_SESSION['translate']->it("Access was denied due to lack of proper permissions."); } // End of ADMINISTRATOR condition }