function initializeAction($nsname, $oUser)
 {
     list($sClassName, $sPath, $sName, $sPlugin) = $this->getActionByNsname($nsname);
     if (!empty($sPath)) {
         require_once $sPath;
     }
     $oPluginRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oPluginRegistry->getPlugin($sPlugin);
     $oAction = new $sClassName($oUser, $oPlugin);
     return $oAction;
 }
Esempio n. 2
0
 /**
  * Render function for template
  *
  * @return unknown
  */
 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('TagCloud/dashlet');
     $aTags = $this->get_tag_weightings($aTags);
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktcore.tagcloud.plugin');
     $url = $oPlugin->getPagePath('TagCloudRedirection');
     $aTemplateData = array('tags' => $aTags, 'url' => $url);
     return $oTemplate->render($aTemplateData);
 }
 function takeover()
 {
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('password.reset.plugin');
     $dispatcherURL = $oPlugin->getURLPath('loginResetDispatcher.php');
     $redirect = KTUtil::arrayGet($_REQUEST, 'redirect');
     $url = KTUtil::kt_url() . $dispatcherURL;
     $url .= !empty($redirect) ? '?redirect=' . $redirect : '';
     redirect($url);
     exit(0);
 }
 function takeover()
 {
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('password.reset.plugin');
     $dispatcherURL = $oPlugin->getURLPath('loginResetDispatcher.php');
     $queryString = $_SERVER['QUERY_STRING'];
     $redirect = KTUtil::arrayGet($_REQUEST, 'redirect');
     $redirect = urlencode($redirect);
     $url = KTUtil::kt_url() . $dispatcherURL;
     $url .= !empty($queryString) ? '?' . $queryString : '';
     redirect($url);
     exit(0);
 }
 function do_main()
 {
     $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Edit Disclaimers'));
     $this->oPage->setBreadcrumbDetails(_kt('select a section'));
     $this->oPage->setTitle(_kt('Edit Disclaimers'));
     $oTemplating =& KTTemplating::getSingleton();
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktstandard.disclaimers.plugin');
     $aDisclaimers = $oPlugin->getDisclaimerList();
     $oTemplate = $oTemplating->loadTemplate("ktstandard/disclaimers/manage_disclaimers");
     $aTemplateData = array("context" => &$this, "disclaimers" => $aDisclaimers);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 6
0
 function render()
 {
     // this is unfortunate, but such is life.
     $current_action = KTUtil::arrayGet($_REQUEST, 'fBrowseMode', null);
     $modes = array('folder' => array('name' => _kt('Folder'), 'target' => "main"), 'document_type' => array('name' => _kt('Document Type'), 'target' => 'selectType'), 'lookup_value' => array('name' => _kt('Lookup Value'), 'target' => 'selectField'));
     // Browse by tag
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktcore.tagcloud.plugin');
     if (!PEAR::isError($oPlugin) && !empty($oPlugin)) {
         $tagUrl = $oPlugin->getPagePath('TagCloudRedirection');
         $modes['tag'] = array('name' => '<a href="' . $tagUrl . '">' . _kt('Tag') . '</a>');
     }
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("kt3/portlets/browsemodes_portlet");
     $aTemplateData = array("context" => $this, "current_action" => $current_action, "modes" => $modes);
     return $oTemplate->render($aTemplateData);
 }
 function do_cleanup()
 {
     $folder = KTUtil::arrayGet($_REQUEST, 'folder');
     if (is_null($folder)) {
         exit(redirect(generateControllerLink('dashboard')));
     }
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
     // we must avoid doing anything to the documents folder at all costs!
     $folder = HouseKeeper::getDirectory($folder);
     if (is_null($folder) || !$folder['canClean']) {
         exit(redirect(generateControllerLink('dashboard')));
     }
     HouseKeeper::cleanDirectory($folder['folder'], $folder['pattern']);
     HouseKeeper::getKTUsageStats();
     exit(redirect(generateControllerLink('dashboard')));
 }
 function render()
 {
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('FolderUsage');
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
     $config = KTConfig::getSingleton();
     $rootUrl = $config->get('KnowledgeTree/rootUrl');
     $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php');
     if (!empty($rootUrl)) {
         $dispatcherURL = $rootUrl . $dispatcherURL;
     }
     $dispatcherURL = str_replace('\\', '/', $dispatcherURL);
     if (substr($dispatcherURL, 0, 1) != '/') {
         $dispatcherURL = '/' . $dispatcherURL;
     }
     $aTemplateData = array('context' => $this, 'usages' => $this->usage, 'dispatcherURL' => $dispatcherURL);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 9
0
 function getDisclaimer()
 {
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktstandard.disclaimers.plugin');
     if (!PEAR::isError($oPlugin) && !is_null($oPlugin)) {
         return $oPlugin->getPageDisclaimer();
     } else {
         return;
     }
 }
Esempio n. 10
0
 public static function getKTUsageStats($update = true)
 {
     $usage = array();
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
     $folders = self::getDirectories();
     foreach ($folders as $folder) {
         $directory = $folder['folder'];
         $pattern = $folder['pattern'];
         $canClean = $folder['canClean'];
         $name = $folder['name'];
         $temp = self::scanPath($directory, $pattern);
         $usage[] = array('description' => $name, 'folder' => $directory, 'files' => number_format($temp['files'], 0, '.', ','), 'filesize' => KTUtil::filesizeToString($temp['filesize']), 'action' => $i, 'canClean' => $canClean);
     }
     if ($update) {
         KTUtil::setSystemSetting('KTUsage', serialize($usage));
     }
     return $usage;
 }
 function getPortletsForPage($aBreadcrumbs)
 {
     $aPortlets = array();
     foreach ($aBreadcrumbs as $aBreadcrumb) {
         $action = KTUtil::arrayGet($aBreadcrumb, 'action');
         if (empty($action)) {
             continue;
         }
         $aThisPortlets = $this->getPortlet($action);
         if (empty($aThisPortlets)) {
             continue;
         }
         foreach ($aThisPortlets as $aPortlet) {
             $aPortlets[] = $aPortlet;
         }
     }
     $aReturn = array();
     $aDone = array();
     foreach ($aPortlets as $aPortlet) {
         if (in_array($aPortlet, $aDone)) {
             continue;
         }
         $aDone[] = $aPortlet;
         $sPortletClass = $aPortlet[0];
         $sPortletFile = $aPortlet[1];
         $sPluginName = $aPortlet[3];
         $oRegistry =& KTPluginRegistry::getSingleton();
         $oPlugin =& $oRegistry->getPlugin($sPluginName);
         if (file_exists($sPortletFile)) {
             require_once $sPortletFile;
         }
         $oPortlet = new $sPortletClass();
         $oPortlet->setPlugin($oPlugin);
         array_push($aReturn, $oPortlet);
     }
     return $aReturn;
 }
Esempio n. 12
0
 function do_main()
 {
     global $default;
     KTUtil::save_base_kt_url();
     $oUser =& KTInterceptorRegistry::checkInterceptorsForAuthenticated();
     if (is_a($oUser, 'User')) {
         $res = $this->performLogin($oUser);
         if ($res) {
             $oUser = array($res);
         }
     }
     if (is_array($oUser) && count($oUser)) {
         if (empty($_REQUEST['errorMessage'])) {
             $_REQUEST['errorMessage'] = array();
         } else {
             $_REQUEST['errorMessage'] = array($_REQUEST['errorMessage']);
         }
         foreach ($oUser as $oError) {
             $_REQUEST['errorMessage'][] = $oError->getMessage();
         }
         $_REQUEST['errorMessage'] = join('. <br /> ', $_REQUEST['errorMessage']);
     }
     KTInterceptorRegistry::checkInterceptorsForTakeOver();
     $this->check();
     // bounce here, potentially.
     header('Content-type: text/html; charset=UTF-8');
     $errorMessage = KTUtil::arrayGet($_REQUEST, 'errorMessage');
     session_start();
     $errorMessageConfirm = $_SESSION['errormessage']['login'];
     $redirect = strip_tags(KTUtil::arrayGet($_REQUEST, 'redirect'));
     $oReg =& KTi18nregistry::getSingleton();
     $aRegisteredLangs = $oReg->geti18nLanguages('knowledgeTree');
     $aLanguageNames = $oReg->getLanguages('knowledgeTree');
     $aRegisteredLanguageNames = array();
     if (!empty($aRegisteredLangs)) {
         foreach (array_keys($aRegisteredLangs) as $sLang) {
             $aRegisteredLanguageNames[$sLang] = $aLanguageNames[$sLang];
         }
     }
     $sLanguageSelect = $default->defaultLanguage;
     // extra disclaimer, if plugin is enabled
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktstandard.disclaimers.plugin');
     if (!PEAR::isError($oPlugin) && !is_null($oPlugin)) {
         $sDisclaimer = $oPlugin->getLoginDisclaimer();
     }
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate("ktcore/login");
     $aTemplateData = array("context" => $this, 'errorMessage' => $errorMessage, 'errorMessageConfirm' => $errorMessageConfirm, 'redirect' => $redirect, 'systemVersion' => $default->systemVersion, 'versionName' => $default->versionName, 'languages' => $aRegisteredLanguageNames, 'selected_language' => $sLanguageSelect, 'disclaimer' => $sDisclaimer, 'smallVersion' => substr($default->versionName, -17));
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 13
0
 function getDocumentActionsByNames($aNames, $slot = 'documentaction', $oDocument = null, $oUser = null)
 {
     $aObjects = array();
     foreach (KTDocumentActionUtil::getDocumentActionInfo($slot) as $aAction) {
         list($sClassName, $sPath, $sName, $sPlugin) = $aAction;
         $oRegistry =& KTPluginRegistry::getSingleton();
         $oPlugin =& $oRegistry->getPlugin($sPlugin);
         if (!in_array($sName, $aNames)) {
             continue;
         }
         if (!empty($sPath)) {
             require_once $sPath;
         }
         $aObjects[] = new $sClassName($oDocument, $oUser, $oPlugin);
     }
     return $aObjects;
 }
Esempio n. 14
0
 function render()
 {
     $notifications = KTNotification::getList(array('user_id = ?', $this->oUser->getId()));
     $num_notifications = count($notifications);
     $_MAX_NOTIFICATIONS = 5;
     // FIXME in lieu of pagination, we slice.
     if ($num_notifications > $_MAX_NOTIFICATIONS) {
         $notifications = array_slice($notifications, 0, $_MAX_NOTIFICATIONS);
     }
     $oPluginRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oPluginRegistry->getPlugin('ktcore.plugin');
     $link = $oPlugin->getPagePath('notifications');
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('ktcore/dashlets/notifications');
     $aTemplateData = array('notifications' => $notifications, 'notification_count' => $num_notifications, 'visible_count' => count($notifications), 'link_all' => $link);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 15
0
 function &getFolderInfoActionsForFolder($oFolder, $oUser)
 {
     $aObjects = array();
     foreach (KTFolderActionUtil::getFolderInfoActions() as $aAction) {
         list($sClassName, $sPath, $sPlugin) = $aAction;
         $oRegistry =& KTPluginRegistry::getSingleton();
         $oPlugin =& $oRegistry->getPlugin($sPlugin);
         if (!empty($sPath)) {
             require_once $sPath;
         }
         $aObjects[] = new $sClassName($oFolder, $oUser, $oPlugin);
     }
     return $aObjects;
 }
        $this->registerDashlet('KTWebDAVDashlet', 'ktstandard.ktwebdavdashlet.dashlet', __FILE__);
        require_once KT_LIB_DIR . "/templating/templating.inc.php";
        $oTemplating =& KTTemplating::getSingleton();
    }
}
class KTWebDAVDashlet extends KTBaseDashlet
{
    var $sClass = "ktInfo";
    function KTWebDAVDashlet()
    {
        $this->sTitle = _kt('WebDAV Connection Information');
    }
    function render()
    {
        $oTemplating =& KTTemplating::getSingleton();
        $oTemplate = $oTemplating->loadTemplate('ktstandard/ktwebdavdashlet/dashlet');
        $sURL = KTUtil::kt_url();
        // Check if this is a commercial installation - before displaying the KT Tools webdav link
        // Shortcut: Check if the the wintools plugin exists and set to true.
        // Long way: Check that a license is installed - this is only text so having a license is not a requirement.
        $isComm = false;
        if (KTPluginUtil::pluginIsActive('ktdms.wintools')) {
            $isComm = true;
        }
        $webdavUrl = $sURL . '/ktwebdav/ktwebdav.php';
        $aTemplateData = array('url' => $sURL, 'webdav_url' => $webdavUrl, 'hasLicense' => $isComm);
        return $oTemplate->render($aTemplateData);
    }
}
$oPluginRegistry =& KTPluginRegistry::getSingleton();
$oPluginRegistry->registerPlugin('KTWebDAVDashletPlugin', 'ktstandard.ktwebdavdashlet.plugin', __FILE__);
 function do_main()
 {
     global $default;
     $oPage = $GLOBALS['main'];
     // Check if the user is trying to reset their password.
     $reset_password = $this->checkReset();
     KTUtil::save_base_kt_url();
     if (is_a($oUser, 'User')) {
         $res = $this->performLogin($oUser);
         if ($res) {
             $oUser = array($res);
         }
     }
     if (is_array($oUser) && count($oUser)) {
         if (empty($_REQUEST['errorMessage'])) {
             $_REQUEST['errorMessage'] = array();
         } else {
             $_REQUEST['errorMessage'] = array($_REQUEST['errorMessage']);
         }
         foreach ($oUser as $oError) {
             $_REQUEST['errorMessage'][] = $oError->getMessage();
         }
         $_REQUEST['errorMessage'] = join('. <br /> ', $_REQUEST['errorMessage']);
     }
     if (!loginUtil::check() && $_SESSION['userID'] != -2) {
         // bounce here, potentially.
         // User is already logged in - get the redirect
         $redirect = strip_tags(KTUtil::arrayGet($_REQUEST, 'redirect'));
         $cookietest = KTUtil::randomString();
         setcookie("CookieTestCookie", $cookietest, 0);
         $this->redirectTo('checkCookie', array('cookieVerify' => $cookietest, 'redirect' => $redirect));
         exit(0);
     }
     header('Content-type: text/html; charset=UTF-8');
     $errorMessage = KTUtil::arrayGet($_REQUEST, 'errorMessage');
     session_start();
     $errorMessageConfirm = $_SESSION['errormessage']['login'];
     $redirect = strip_tags(KTUtil::arrayGet($_REQUEST, 'redirect'));
     // Get the list of languages
     $oReg =& KTi18nregistry::getSingleton();
     $aRegisteredLangs = $oReg->geti18nLanguages('knowledgeTree');
     $aLanguageNames = $oReg->getLanguages('knowledgeTree');
     $aRegisteredLanguageNames = array();
     if (!empty($aRegisteredLangs)) {
         foreach (array_keys($aRegisteredLangs) as $sLang) {
             $aRegisteredLanguageNames[$sLang] = $aLanguageNames[$sLang];
         }
         asort($aRegisteredLanguageNames);
     }
     $sLanguageSelect = $default->defaultLanguage;
     // extra disclaimer, if plugin is enabled
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktstandard.disclaimers.plugin');
     if (!PEAR::isError($oPlugin) && !is_null($oPlugin)) {
         $sDisclaimer = $oPlugin->getLoginDisclaimer();
     }
     $js = array();
     $css = array();
     $js[] = '/thirdpartyjs/extjs/adapter/ext/ext-base.js';
     $js[] = '/thirdpartyjs/extjs/ext-all.js';
     $css[] = '/thirdpartyjs/extjs/resources/css/ext-all.css';
     // Include additional js and css files
     $oPlugin =& $oRegistry->getPlugin('password.reset.plugin');
     $js[] = $oPlugin->getURLPath('resources/passwordReset.js');
     $css[] = $oPlugin->getURLPath('resources/passwordReset.css');
     $sUrl = KTUtil::addQueryStringSelf('action=');
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplate = $oTemplating->loadTemplate('login_reset');
     $aTemplateData = array('errorMessage' => $errorMessage, 'errorMessageConfirm' => $errorMessageConfirm, 'redirect' => $redirect, 'systemVersion' => $default->systemVersion, 'versionName' => $default->versionName, 'languages' => $aRegisteredLanguageNames, 'selected_language' => $sLanguageSelect, 'disclaimer' => $sDisclaimer, 'js' => $js, 'css' => $css, 'sUrl' => $sUrl, 'smallVersion' => substr($default->versionName, -17), 'reset_password' => $reset_password);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 18
0
 function getDashlets($oUser)
 {
     $aDashlets = array();
     $oRegistry =& KTPluginRegistry::getSingleton();
     // probably not the _best_ way to do things.
     foreach ($this->nsnames as $aPortlet) {
         $name = $aPortlet[0];
         $filename = $aPortlet[1];
         $sPluginName = $aPortlet[3];
         require_once $aPortlet[1];
         $oPlugin =& $oRegistry->getPlugin($sPluginName);
         $oDashlet = new $name();
         $oDashlet->setPlugin($oPlugin);
         if ($oDashlet->is_active($oUser)) {
             $aDashlets[] = $oDashlet;
         }
     }
     return $aDashlets;
 }
Esempio n. 19
0
 static function pluginIsActive($sNamespace)
 {
     $oReg =& KTPluginRegistry::getSingleton();
     $plugin = $oReg->getPlugin($sNamespace);
     if (is_null($plugin) || PEAR::isError($plugin)) {
         return false;
     } else {
         // check if its active
         $ent = KTPluginEntity::getByNamespace($sNamespace);
         if (PEAR::isError($ent)) {
             return false;
         }
         // we now can ask
         return !$ent->getDisabled();
     }
 }
Esempio n. 20
0
 /**
  * Display a list of versions for comparing
  *
  * @return unknown
  */
 function do_main()
 {
     $show_version = KTUtil::arrayGet($_REQUEST, 'show');
     $showall = isset($show_version) && $show_version == 'all' ? true : false;
     $this->oPage->setSecondaryTitle($this->oDocument->getName());
     $this->oPage->setBreadcrumbDetails(_kt('Version History'));
     $aMetadataVersions = KTDocumentMetadataVersion::getByDocument($this->oDocument);
     $aVersions = array();
     foreach ($aMetadataVersions as $oVersion) {
         $version = Document::get($this->oDocument->getId(), $oVersion->getId());
         if ($showall) {
             $aVersions[] = $version;
         } else {
             if ($version->getMetadataStatusID() != VERSION_DELETED) {
                 $aVersions[] = $version;
             }
         }
     }
     // render pass.
     $this->oPage->title = _kt('Document History');
     $oTemplate = $this->oValidator->validateTemplate('ktcore/document/metadata_history');
     $aActions = KTDocumentActionUtil::getDocumentActionsByNames(array('ktcore.actions.document.view'));
     $oAction = $aActions[0];
     $oAction->setDocument($this->oDocument);
     // create delete action if user is sys admin or folder admin
     $bShowDelete = false;
     require_once KT_LIB_DIR . '/security/Permission.inc';
     $oUser =& User::get($_SESSION['userID']);
     $iFolderId = $this->oDocument->getFolderId();
     if (Permission::userIsSystemAdministrator($oUser) || Permission::isUnitAdministratorForFolder($oUser, $iFolderId)) {
         // Check if admin mode is enabled
         $bShowDelete = KTUtil::arrayGet($_SESSION, 'adminmode', false);
     }
     // Check if the document comparison plugin is installed
     $isActive = KTPluginUtil::pluginIsActive('document.comparison.plugin');
     $bShowCompare = false;
     $bShowVersionCompare = false;
     $sUrl = false;
     if ($isActive) {
         $oRegistry =& KTPluginRegistry::getSingleton();
         $oPlugin =& $oRegistry->getPlugin('document.comparison.plugin');
         if ($oPlugin->loadHelpers()) {
             $sUrl = $oPlugin->getPagePath('DocumentComparison');
             $file = $oPlugin->_aPages['document.comparison.plugin/DocumentComparison'][2];
             include_once $file;
             // Check mime type of document for content comparison
             list($bShowCompare, $bShowVersionCompare) = DocumentComparison::checkMimeType($this->oDocument);
         }
     }
     $aTemplateData = array('context' => $this, 'document_id' => $this->oDocument->getId(), 'document' => $this->oDocument, 'versions' => $aVersions, 'downloadaction' => $oAction, 'showdelete' => $bShowDelete, 'showall' => $showall, 'bShowCompare' => $bShowCompare, 'bShowVersionCompare' => $bShowVersionCompare, 'sUrl' => $sUrl);
     return $oTemplate->render($aTemplateData);
 }
Esempio n. 21
0
 function getTargetURL()
 {
     $oPluginRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oPluginRegistry->getPlugin('ktcore.plugin');
     $sPath = $oPlugin->getPagePath('collection');
     $oKTConfig =& KTConfig::getSingleton();
     $sName = $this->sName;
     if (KTUtil::arrayGet($this->aOptions, 'broken_name', false)) {
         $this->sName = 'fFolderId';
     }
     $sPath = KTUtil::addQueryString($sPath, array('code' => $this->sCode, 'fFolderId' => $this->iFolderId, 'varname' => $sName));
     return $sPath;
 }