Ejemplo n.º 1
0
 /**
  * @param AJXP_Plugin $a
  * @param AJXP_Plugin $b
  * @return int
  */
 public function frontendsSort($a, $b)
 {
     $aConf = $a->getConfigs();
     $bConf = $b->getConfigs();
     $orderA = intval($aConf["ORDER"]);
     $orderB = intval($bConf["ORDER"]);
     if ($orderA == $orderB) {
         return 0;
     }
     return $orderA > $orderB ? 1 : -1;
 }
 protected function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     if ($this->detectStreamWrapper() !== false) {
         $this->actions["cross_copy"] = array();
     }
 }
Ejemplo n.º 3
0
 /**
  * Parse
  * @param DOMNode $contribNode
  */
 protected function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     if ($this->pluginConf["ENABLE_324_IMPORT"] == true) {
         return;
     }
     if ($contribNode->nodeName != "actions") {
         return;
     }
     $actionXpath = new DOMXPath($contribNode->ownerDocument);
     $compressNodeList = $actionXpath->query('action[@name="import_from_324"]', $contribNode);
     if (!$compressNodeList->length) {
         return;
     }
     unset($this->actions["import_from_324"]);
     $compressNode = $compressNodeList->item(0);
     $contribNode->removeChild($compressNode);
     $compressNodeList = $actionXpath->query('action[@name="migrate_metaserial"]', $contribNode);
     if (!$compressNodeList->length) {
         return;
     }
     unset($this->actions["import_from_324"]);
     $compressNode = $compressNodeList->item(0);
     $contribNode->removeChild($compressNode);
 }
 function init($options)
 {
     parent::init($options);
     $pServ = AJXP_PluginsService::getInstance();
     $aPlugs = $pServ->getActivePlugins();
     $accessPlugs = $pServ->getPluginsByType("access");
     $this->repository = ConfService::getRepository();
     foreach ($accessPlugs as $pId => $plug) {
         if (array_key_exists("access." . $pId, $aPlugs) && $aPlugs["access." . $pId] === true) {
             $this->accessDriver = $plug;
             if (!isset($this->accessDriver->repository)) {
                 $this->accessDriver->init($this->repository);
                 $this->accessDriver->initRepository();
                 $wrapperData = $this->accessDriver->detectStreamWrapper(true);
             } else {
                 $wrapperData = $this->accessDriver->detectStreamWrapper(false);
             }
             $this->urlBase = $wrapperData["protocol"] . "://" . $this->repository->getId();
         }
     }
     $this->metaStore = AJXP_PluginsService::getInstance()->getUniqueActivePluginForType("metastore");
     if ($this->metaStore !== false) {
         $this->metaStore->initMeta($this->accessDriver);
     }
 }
Ejemplo n.º 5
0
 public function logDebug($message = "")
 {
     parent::logDebug("core.indexer", $message);
     if ($this->verboseIndexation && ConfService::currentContextIsCommandLine()) {
         print $message . "\n";
     }
 }
 public function loadRegistryContributions()
 {
     $currentUser = AuthService::getLoggedUser();
     if ($currentUser != null) {
         $cData = $currentUser->getPref("CUSTOM_PARAMS");
         if ($cData != null && isset($cData["email"])) {
             $this->exposeConfigInManifest("current_user_email", $cData["email"]);
         }
     }
     $actionsBranch = $this->xPath->query("registry_contributions/actions");
     $actionsNode = $actionsBranch->item(0);
     foreach (array_map("trim", explode(",", $this->pluginConf["ACTIONS"])) as $action) {
         // Action node
         $prop = $this->manifestDoc->createElement("action");
         $attName = $this->manifestDoc->createAttribute("name");
         $attValue = $this->manifestDoc->createTextNode($action);
         $attName->appendChild($attValue);
         $prop->appendChild($attName);
         $actionsNode->appendChild($prop);
         // Pre_proc
         $preproc = $this->manifestDoc->createElement("pre_processing");
         $prop->appendChild($preproc);
         // Server callback
         $sC = $this->manifestDoc->createElement("serverCallback");
         $sAttName = $this->manifestDoc->createAttribute("methodName");
         $sAttValue = $this->manifestDoc->createTextNode("preProcess");
         $sAttName->appendChild($sAttValue);
         $sC->appendChild($sAttName);
         $preproc->appendChild($sC);
     }
     $this->reloadXPath();
     parent::loadRegistryContributions();
 }
Ejemplo n.º 7
0
 public function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     if ($contribNode->nodeName != "actions") {
         return;
     }
     $actionXpath = new DOMXPath($contribNode->ownerDocument);
     $paramList = $actionXpath->query('action[@name="scheduler_addTask"]/processing/standardFormDefinition/param[@name="repository_id"]', $contribNode);
     if (!$paramList->length) {
         return;
     }
     $paramNode = $paramList->item(0);
     $sVals = array();
     $repos = ConfService::getRepositoriesList("all");
     foreach ($repos as $repoId => $repoObject) {
         $sVals[] = $repoId . "|" . AJXP_Utils::xmlEntities($repoObject->getDisplay());
     }
     $sVals[] = "*|All Repositories";
     $paramNode->attributes->getNamedItem("choices")->nodeValue = implode(",", $sVals);
     if (!AuthService::usersEnabled() || AuthService::getLoggedUser() == null) {
         return;
     }
     $paramList = $actionXpath->query('action[@name="scheduler_addTask"]/processing/standardFormDefinition/param[@name="user_id"]', $contribNode);
     if (!$paramList->length) {
         return;
     }
     $paramNode = $paramList->item(0);
     $paramNode->attributes->getNamedItem("default")->nodeValue = AuthService::getLoggedUser()->getId();
 }
Ejemplo n.º 8
0
    public function initMeta($accessDriver)
    {
        $this->accessDriver = $accessDriver;
        if (!function_exists("exif_read_data")) {
            return;
        }
        $messages = ConfService::getMessages();
        $def = $this->getMetaDefinition();
        if (!count($def)) {
            return;
        }
        $cdataHead = '<div>
						<div class="panelHeader infoPanelGroup" colspan="2">' . $messages["meta.exif.1"] . '</div>
						<table class="infoPanelTable" cellspacing="0" border="0" cellpadding="0">';
        $cdataFoot = '</table></div>';
        $cdataParts = "";
        foreach ($def as $key => $label) {
            $trClass = $even ? " class=\"even\"" : "";
            $even = !$even;
            $cdataParts .= '<tr' . $trClass . '><td class="infoPanelLabel">' . $label . '</td><td class="infoPanelValue" id="ip_' . $key . '">#{' . $key . '}</td></tr>';
        }
        $selection = $this->xPath->query('registry_contributions/client_configs/component_config[@className="InfoPanel"]/infoPanelExtension');
        $contrib = $selection->item(0);
        $contrib->setAttribute("attributes", implode(",", array_keys($def)));
        $contrib->setAttribute("modifier", "ExifCellRenderer.prototype.infoPanelModifier");
        $htmlSel = $this->xPath->query('html', $contrib);
        $html = $htmlSel->item(0);
        $cdata = $this->manifestDoc->createCDATASection($cdataHead . $cdataParts . $cdataFoot);
        $html->appendChild($cdata);
        parent::init($this->options);
    }
Ejemplo n.º 9
0
 public function init($options)
 {
     parent::init($options);
     $this->useQueue = $this->pluginConf["USE_QUEUE"];
     try {
         $this->msgExchanger = ConfService::instanciatePluginFromGlobalParams($this->pluginConf["UNIQUE_MS_INSTANCE"], "AJXP_MessageExchanger");
     } catch (Exception $e) {
     }
 }
Ejemplo n.º 10
0
 public function init($options)
 {
     parent::init($options);
     self::$globalOptions = $this->pluginConf;
     $this->pluginInstance = ConfService::instanciatePluginFromGlobalParams($this->pluginConf["UNIQUE_PLUGIN_INSTANCE"], "AbstractLogDriver");
     if ($this->pluginInstance != false) {
         AJXP_PluginsService::getInstance()->setPluginUniqueActiveForType("log", $this->pluginInstance->getName(), $this->pluginInstance);
     }
     self::$loggerInstance = $this->pluginInstance;
 }
Ejemplo n.º 11
0
 public function loadConfigs($configsData)
 {
     parent::loadConfigs($configsData);
     if (isset($configsData["UNOCONV"]) && !empty($configsData["UNOCONV"])) {
         // APPEND THE UNOCONV SUPPORTED EXTENSIONS
         $this->manifestDoc->documentElement->setAttribute("mimes", implode(",", array_merge($this->imagickExtensions, $this->unoconvExtensios)));
     } else {
         $this->manifestDoc->documentElement->setAttribute("mimes", implode(",", $this->imagickExtensions));
     }
 }
Ejemplo n.º 12
0
 public function loadConfigs($configData)
 {
     parent::loadConfigs($configData);
     if (!defined("AJXP_THEME_FOLDER")) {
         define("CLIENT_RESOURCES_FOLDER", AJXP_PLUGINS_FOLDER . "/gui.ajax/res");
         define("AJXP_THEME_FOLDER", CLIENT_RESOURCES_FOLDER . "/themes/" . $this->pluginConf["GUI_THEME"]);
     }
     if (!isset($configData["CLIENT_TIMEOUT_TIME"])) {
         $this->pluginConf["CLIENT_TIMEOUT_TIME"] = intval(ini_get("session.gc_maxlifetime"));
     }
 }
Ejemplo n.º 13
0
 public function loadConfigs($configData)
 {
     parent::loadConfigs($configData);
     $keyFile = $this->getPluginWorkDir(true) . "/agent.pem";
     if (file_exists($keyFile)) {
         $res = openssl_pkey_get_private(file_get_contents($keyFile));
         $details = openssl_pkey_get_details($res);
         $public = $details["key"];
         $this->pluginConf["ZOHO_AGENT_PUBLIC_KEY"] = $public;
     }
 }
Ejemplo n.º 14
0
 public function init($options)
 {
     parent::init($options);
     if (AJXP_SERVER_DEBUG) {
         $this->mailCache = $this->getPluginWorkDir(true) . "/mailbox";
     }
     $pConf = $this->pluginConf["UNIQUE_MAILER_INSTANCE"];
     if (!empty($pConf)) {
         $p = ConfService::instanciatePluginFromGlobalParams($pConf, "AjxpMailer");
         AJXP_PluginsService::getInstance()->setPluginUniqueActiveForType($p->getType(), $p->getName(), $p);
     }
 }
Ejemplo n.º 15
0
 public function getConfigs()
 {
     $configs = parent::getConfigs();
     $configs["ALLOW_GUEST_BROWSING"] = !isset($_SERVER["HTTP_AJXP_FORCE_LOGIN"]) && ($configs["ALLOW_GUEST_BROWSING"] === "true" || $configs["ALLOW_GUEST_BROWSING"] === true || intval($configs["ALLOW_GUEST_BROWSING"]) == 1);
     // FORCE CASE INSENSITIVY FOR SQL BASED DRIVERS
     if (isset($configs["MASTER_INSTANCE_CONFIG"]) && is_array($configs["MASTER_INSTANCE_CONFIG"]) && isset($configs["MASTER_INSTANCE_CONFIG"]["instance_name"]) && $configs["MASTER_INSTANCE_CONFIG"]["instance_name"] == "auth.sql") {
         $configs["CASE_SENSITIVE"] = false;
     }
     if (isset($configs["SLAVE_INSTANCE_CONFIG"]) && !empty($configs["SLAVE_INSTANCE_CONFIG"]) && isset($configs["SLAVE_INSTANCE_CONFIG"]["instance_name"]) && $configs["SLAVE_INSTANCE_CONFIG"]["instance_name"] == "auth.sql") {
         $configs["CASE_SENSITIVE"] = false;
     }
     return $configs;
 }
Ejemplo n.º 16
0
 public function init($options)
 {
     parent::init($options);
     $this->useQueue = $this->pluginConf["USE_QUEUE"];
     try {
         $this->msgExchanger = ConfService::instanciatePluginFromGlobalParams($this->pluginConf["UNIQUE_MS_INSTANCE"], "AJXP_MessageExchanger");
         if (AuthService::$bufferedMessage != null && AuthService::getLoggedUser() != null) {
             $this->sendInstantMessage(AuthService::$bufferedMessage, ConfService::getCurrentRepositoryId(), AuthService::getLoggedUser()->getId());
             AuthService::$bufferedMessage = null;
         }
     } catch (Exception $e) {
     }
 }
 public function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     if (!self::rsyncEnabled() && $contribNode->nodeName == "actions") {
         // REMOVE rsync actions, this will advertise the fact that
         // rsync is not enabled.
         $xp = new DOMXPath($contribNode->ownerDocument);
         $children = $xp->query("action", $contribNode);
         foreach ($children as $child) {
             $contribNode->removeChild($child);
         }
     }
 }
Ejemplo n.º 18
0
 public function init($options)
 {
     parent::init($options);
     $this->repository = ConfService::getRepository();
     if (!is_a($this->repository->driverInstance, "AjxpWrapperProvider")) {
         return;
     }
     $this->accessDriver = $this->repository->driverInstance;
     $this->urlBase = $this->repository->driverInstance->getResourceUrl("/");
     $this->baseProtocol = array_shift(explode("://", $this->urlBase));
     if (array_key_exists("meta.watch", AJXP_PluginsService::getInstance()->getActivePlugins())) {
         $this->watcher = AJXP_PluginsService::getInstance()->getPluginById("meta.watch");
     }
 }
 public function loadConfigs($configData)
 {
     parent::loadConfigs($configData);
     if (preg_match('/MSIE 7/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/MSIE 8/', $_SERVER['HTTP_USER_AGENT'])) {
         // Force legacy theme for the moment
         $this->pluginConf["GUI_THEME"] = "oxygen";
     }
     if (!defined("AJXP_THEME_FOLDER")) {
         define("CLIENT_RESOURCES_FOLDER", AJXP_PLUGINS_FOLDER . "/gui.ajax/res");
         define("AJXP_THEME_FOLDER", CLIENT_RESOURCES_FOLDER . "/themes/" . $this->pluginConf["GUI_THEME"]);
     }
     if (!isset($configData["CLIENT_TIMEOUT_TIME"])) {
         $this->pluginConf["CLIENT_TIMEOUT_TIME"] = intval(ini_get("session.gc_maxlifetime"));
     }
 }
Ejemplo n.º 20
0
 protected function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     if ($contribNode->nodeName != "actions") {
         return;
     }
     // WEBDAV ACTION
     if (empty($this->pluginConf["USER_EVENTS"])) {
         unset($this->actions["get_my_feed"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="get_my_feed"]', $contribNode);
         $publicUrlNode = $publicUrlNodeList->item(0);
         $contribNode->removeChild($publicUrlNode);
     }
 }
Ejemplo n.º 21
0
 /**
  * Extend parent
  * @param DOMNode $contribNode
  */
 protected function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     $disableSharing = false;
     $downloadFolder = ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER");
     if (empty($downloadFolder) || (!is_dir($downloadFolder) || !is_writable($downloadFolder))) {
         $this->logError("Warning on public links, {$downloadFolder} is not writeable!", array("folder" => $downloadFolder, "is_dir" => is_dir($downloadFolder), "is_writeable" => is_writable($downloadFolder)));
     }
     $xpathesToRemove = array();
     if (strpos(ConfService::getRepository()->getAccessType(), "ajxp_") === 0) {
         $xpathesToRemove[] = 'action[@name="share-file-minisite"]';
         $xpathesToRemove[] = 'action[@name="share-folder-minisite-public"]';
         $xpathesToRemove[] = 'action[@name="share-edit-shared"]';
     } else {
         if (AuthService::usersEnabled()) {
             $loggedUser = AuthService::getLoggedUser();
             if ($loggedUser != null && AuthService::isReservedUserId($loggedUser->getId())) {
                 $disableSharing = true;
             }
         } else {
             $disableSharing = true;
         }
     }
     if ($disableSharing) {
         // All share- actions
         $xpathesToRemove[] = 'action[contains(@name, "share-")]';
     } else {
         $folderSharingAllowed = $this->getAuthorization("folder", "any");
         $fileSharingAllowed = $this->getAuthorization("file", "any");
         if ($fileSharingAllowed === false) {
             // Share file button
             $xpathesToRemove[] = 'action[@name="share-file-minisite"]';
         }
         if (!$folderSharingAllowed) {
             // Share folder button
             $xpathesToRemove[] = 'action[@name="share-folder-minisite-public"]';
         }
     }
     foreach ($xpathesToRemove as $xpath) {
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $nodeList = $actionXpath->query($xpath, $contribNode);
         foreach ($nodeList as $shareActionNode) {
             $contribNode->removeChild($shareActionNode);
         }
     }
 }
 public function initMeta($accessDriver)
 {
     $this->accessDriver = $accessDriver;
     if (!empty($this->options["index_meta_fields"]) || $this->indexContent) {
         $metaFields = $this->metaFields;
         $el = $this->xPath->query("/indexer")->item(0);
         if ($this->indexContent) {
             if ($this->indexContent) {
                 $metaFields[] = "ajxp_document_content";
             }
             $data = array("indexed_meta_fields" => $metaFields, "additionnal_meta_columns" => array("ajxp_document_content" => "Content"));
             $el->setAttribute("indexed_meta_fields", json_encode($data));
         } else {
             $el->setAttribute("indexed_meta_fields", json_encode($metaFields));
         }
     }
     parent::init($this->options);
 }
Ejemplo n.º 23
0
 public function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     if (!self::rsyncEnabled() && $contribNode->nodeName == "actions") {
         // REMOVE rsync actions, this will advertise the fact that
         // rsync is not enabled.
         $xp = new DOMXPath($contribNode->ownerDocument);
         $children = $xp->query("action[contains(@name, 'filehasher')]", $contribNode);
         foreach ($children as $child) {
             $contribNode->removeChild($child);
         }
     }
     if ($this->getFilteredOption("CACHE_XML_TREE") !== true && $contribNode->nodeName == "actions") {
         // REMOVE pre and post process on LS action
         $xp = new DOMXPath($contribNode->ownerDocument);
         $children = $xp->query("action[@name='ls']", $contribNode);
         foreach ($children as $child) {
             $contribNode->removeChild($child);
         }
     }
 }
 protected function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     // DISABLE STUFF
     if (empty($this->pluginConf["USER_EVENTS"])) {
         if ($contribNode->nodeName == "actions") {
             $actionXpath = new DOMXPath($contribNode->ownerDocument);
             $publicUrlNodeList = $actionXpath->query('action[@name="get_my_feed"]', $contribNode);
             $publicUrlNode = $publicUrlNodeList->item(0);
             $contribNode->removeChild($publicUrlNode);
         } else {
             if ($contribNode->nodeName == "client_configs") {
                 $actionXpath = new DOMXPath($contribNode->ownerDocument);
                 $children = $actionXpath->query('component_config', $contribNode);
                 foreach ($children as $child) {
                     $contribNode->removeChild($child);
                 }
             }
         }
     }
 }
 protected function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     if (!ConfService::getCoreConf("WEBDAV_ENABLE") && $contribNode->nodeName == "actions") {
         unset($this->actions["webdav_preferences"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="webdav_preferences"]', $contribNode);
         $publicUrlNode = $publicUrlNodeList->item(0);
         $contribNode->removeChild($publicUrlNode);
     }
     if (!ConfService::getCoreConf("USER_CREATE_REPOSITORY", "conf") && $contribNode->nodeName == "actions") {
         unset($this->actions["user_create_repository"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="user_create_repository"]', $contribNode);
         $publicUrlNode = $publicUrlNodeList->item(0);
         $contribNode->removeChild($publicUrlNode);
         unset($this->actions["user_delete_repository"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="user_delete_repository"]', $contribNode);
         $publicUrlNode = $publicUrlNodeList->item(0);
         $contribNode->removeChild($publicUrlNode);
     }
 }
Ejemplo n.º 26
0
 /**
  * Parse
  * @param DOMNode $contribNode
  */
 protected function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     if (substr($_SERVER["REQUEST_URI"], 0, strlen('/user')) != '/user') {
         if ($contribNode->nodeName == "client_configs") {
             $children = $contribNode->childNodes;
             foreach ($children as $child) {
                 if ($child->nodeType == XML_ELEMENT_NODE) {
                     $contribNode->removeChild($child);
                 }
             }
         } else {
             if ($contribNode->nodeName == "actions") {
                 $children = $contribNode->childNodes;
                 foreach ($children as $child) {
                     if ($child->nodeType == XML_ELEMENT_NODE && $child->nodeName == "action" && $child->getAttribute("name") == "login") {
                         $contribNode->removeChild($child);
                     }
                 }
             }
         }
     }
 }
 /**
  * Append some predefined XML to a plugin instance
  * @param AJXP_Plugin $plugin
  * @param DOMDocument $manifestDoc
  * @param String $mixinName
  */
 public function patchPluginWithMixin(&$plugin, &$manifestDoc, $mixinName)
 {
     // Load behaviours if not already
     if (!isset($this->mixinsDoc)) {
         $this->mixinsDoc = new DOMDocument();
         $this->mixinsDoc->load(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/core.ajaxplorer/ajxp_mixins.xml");
         $this->mixinsXPath = new DOMXPath($this->mixinsDoc);
     }
     // Merge into manifestDoc
     $nodeList = $this->mixinsXPath->query($mixinName);
     if (!$nodeList->length) {
         return;
     }
     $mixinNode = $nodeList->item(0);
     foreach ($mixinNode->childNodes as $child) {
         if ($child->nodeType != XML_ELEMENT_NODE) {
             continue;
         }
         $uuidAttr = $child->getAttribute("uuidAttr") or "name";
         $this->mergeNodes($manifestDoc, $child->nodeName, $uuidAttr, $child->childNodes, true);
     }
     // Reload plugin XPath
     $plugin->reloadXPath();
 }
 public function initMeta($accessDriver)
 {
     require_once "svn_lib.inc.php";
     $this->accessDriver = $accessDriver;
     parent::init($this->options);
 }
 protected function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     if ($contribNode->nodeName == 'client_configs' && !ConfService::getCoreConf("WEBDAV_ENABLE")) {
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $webdavCompNodeList = $actionXpath->query('component_config/additional_tab[@id="webdav_pane"]', $contribNode);
         if ($webdavCompNodeList->length) {
             $contribNode->removeChild($webdavCompNodeList->item(0)->parentNode);
         }
     }
     if ($contribNode->nodeName != "actions") {
         return;
     }
     // WEBDAV ACTION
     if (!ConfService::getCoreConf("WEBDAV_ENABLE")) {
         unset($this->actions["webdav_preferences"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="webdav_preferences"]', $contribNode);
         if ($publicUrlNodeList->length) {
             $publicUrlNode = $publicUrlNodeList->item(0);
             $contribNode->removeChild($publicUrlNode);
         }
     }
     // SWITCH TO DASHBOARD ACTION
     $u = AuthService::getLoggedUser();
     $access = true;
     if ($u == null) {
         $access = false;
     } else {
         $acl = $u->mergedRole->getAcl("ajxp_user");
         if (empty($acl)) {
             $access = false;
         }
     }
     if (!$access) {
         unset($this->actions["switch_to_user_dashboard"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="switch_to_user_dashboard"]', $contribNode);
         if ($publicUrlNodeList->length) {
             $publicUrlNode = $publicUrlNodeList->item(0);
             $contribNode->removeChild($publicUrlNode);
         }
     }
     // PERSONAL INFORMATIONS
     $hasExposed = false;
     $cacheHasExposed = AJXP_PluginsService::getInstance()->loadFromPluginQueriesCache("//server_settings/param[contains(@scope,'user') and @expose='true']");
     if ($cacheHasExposed !== null) {
         $hasExposed = $cacheHasExposed;
     } else {
         $paramNodes = AJXP_PluginsService::searchAllManifests("//server_settings/param[contains(@scope,'user') and @expose='true']", "node", false, false, true);
         if (is_array($paramNodes) && count($paramNodes)) {
             $hasExposed = true;
         }
         AJXP_PluginsService::getInstance()->storeToPluginQueriesCache("//server_settings/param[contains(@scope,'user') and @expose='true']", $hasExposed);
     }
     //$hasExposed = true;
     if (!$hasExposed) {
         unset($this->actions["custom_data_edit"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="custom_data_edit"]', $contribNode);
         $publicUrlNode = $publicUrlNodeList->item(0);
         $contribNode->removeChild($publicUrlNode);
     }
     // CREATE A NEW REPOSITORY
     if (!ConfService::getCoreConf("USER_CREATE_REPOSITORY", "conf")) {
         unset($this->actions["user_create_repository"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="user_create_repository"]', $contribNode);
         if ($publicUrlNodeList->length) {
             $publicUrlNode = $publicUrlNodeList->item(0);
             $contribNode->removeChild($publicUrlNode);
         }
         unset($this->actions["user_delete_repository"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="user_delete_repository"]', $contribNode);
         if ($publicUrlNodeList->length) {
             $publicUrlNode = $publicUrlNodeList->item(0);
             $contribNode->removeChild($publicUrlNode);
         }
     }
     // CREATE A NEW USER
     if (!ConfService::getCoreConf("USER_CREATE_USERS", "conf")) {
         unset($this->actions["user_create_user"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="user_create_user"]', $contribNode);
         if ($publicUrlNodeList->length) {
             $publicUrlNode = $publicUrlNodeList->item(0);
             $contribNode->removeChild($publicUrlNode);
         }
         unset($this->actions["user_update_user"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="user_update_user"]', $contribNode);
         if ($publicUrlNodeList->length) {
             $publicUrlNode = $publicUrlNodeList->item(0);
             $contribNode->removeChild($publicUrlNode);
         }
         unset($this->actions["user_delete_user"]);
         $actionXpath = new DOMXPath($contribNode->ownerDocument);
         $publicUrlNodeList = $actionXpath->query('action[@name="user_delete_user"]', $contribNode);
         if ($publicUrlNodeList->length) {
             $publicUrlNode = $publicUrlNodeList->item(0);
             $contribNode->removeChild($publicUrlNode);
         }
     }
 }
Ejemplo n.º 30
0
 /**
  * @param AJXP_Plugin $plugin
  * @param array $apis
  * @return string
  */
 public static function makeMarkdown($plugin, $apis)
 {
     $md = "\n\n";
     $md .= "## " . $plugin->getManifestLabel() . "  ";
     $md .= "\n" . $plugin->getManifestDescription() . "\n\n";
     $id = $plugin->getId();
     foreach ($apis as $index => $api) {
         $md .= "\n";
         $md .= "- **" . $api["path"] . "**  \n";
         $md .= "  " . $api["operations"][0]["notes"] . "  \n";
         $md .= "  [Details](" . API_DOC_PAGE . "" . $id . "/" . $api["operations"][0]["nickname"] . "_" . strtolower($api["operations"][0]["method"]) . "_" . $index . ")";
     }
     return $md;
 }