/** * Checks if a given user-id is granted the passed permission for the passed systemid. * * @param string $strUserid * @param string $strPermission * @param string $strSystemid * * @return bool */ public function checkPermissionForUserId($strUserid, $strPermission, $strSystemid) { if ($strSystemid == "") { return false; } if ($this->bitTestMode) { return true; } $arrGroupIds = array(); if (validateSystemid($strUserid)) { if ($strUserid == $this->objSession->getUserID()) { $arrGroupIds = $this->objSession->getGroupIdsAsArray(); } else { $objUser = new class_module_user_user($strUserid); $arrGroupIds = $objUser->getArrGroupIds(); } } else { if (validateSystemid($this->objSession->getUserID())) { $arrGroupIds = $this->objSession->getGroupIdsAsArray(); } else { $arrGroupIds[] = class_module_system_setting::getConfigValue("_guests_group_id_"); } } foreach ($arrGroupIds as $strOneGroupId) { if ($this->checkPermissionForGroup($strOneGroupId, $strPermission, $strSystemid)) { return true; } } return false; }
/** * Returns one instance of the Session-Object, using a singleton pattern * * @return class_session The Session-Object */ public static function getInstance() { if (self::$objSession == null) { self::$objSession = new class_session(); } return self::$objSession; }
/** * Sends conditional get headers and tries to match sent ones. * * @param string $strContent * @return void */ private function sendConditionalGetHeaders($strContent) { //check headers, maybe execution could be terminated right here //yes, this doesn't save us from generating the page, but the traffic towards the client can be reduced if (checkConditionalGetHeaders(md5($_SERVER["REQUEST_URI"] . $this->objSession->getSessionId() . $strContent))) { class_response_object::getInstance()->sendHeaders(); flush(); die; } //send headers if not an ie if (strpos(getServer("HTTP_USER_AGENT"), "IE") === false) { setConditionalGetHeaders(md5($_SERVER["REQUEST_URI"] . $this->objSession->getSessionId() . $strContent)); } }
/** * The last page of the installer, showing a few infos and links how to go on */ public function finish() { $strReturn = ""; if (isset($_GET["autoInstall"]) && $_GET["autoInstall"] == "true") { $this->strLogfile = $this->processAutoInstall(); } $this->objSession->sessionUnset("install_username"); $this->objSession->sessionUnset("install_password"); $strReturn .= $this->getLang("installer_finish_intro"); $strReturn .= $this->getLang("installer_finish_hints"); $strReturn .= $this->getLang("installer_finish_hints_update"); $strReturn .= $this->getLang("installer_finish_closer"); $this->strOutput = $strReturn; $this->strBackwardLink = $this->getBackwardLink(_webpath_ . "/installer.php?step=samplecontent"); }
/** * Renders the list of available packages or any other kind of gui-representation * of the packageprovider. * * Whenever the provider is capable of uploading new packages, the copy & and upload process * should be triggered by the admin-class again. * So make sure links or forms point to * module = packagemanager * action = uploadPackage * provider = class_name * The provider will be called using the processPackageUpload method. * * @throws class_exception * @return string */ public function renderPackageList() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $intStart = ($this->getPageNumber() - 1) * $objUser->getIntItemsPerPage(); $intEnd = $intStart + $objUser->getIntItemsPerPage() - 1; $objToolkit = class_carrier::getInstance()->getObjToolkit("admin"); $objLang = class_carrier::getInstance()->getObjLang(); $objManager = new class_module_packagemanager_manager(); $objRemoteloader = $this->getRemoteloader(); $objRemoteloader->setStrQueryParams($this->buildQueryParams($intStart, $intEnd)); $strResponse = ""; try { $strResponse = $objRemoteloader->getRemoteContent(); } catch (class_exception $objEx) { return $objLang->getLang("package_remote_errorloading", self::$STR_MODULE_NAME); } $arrResponse = json_decode($strResponse, true); if ($arrResponse === null) { throw new class_exception("Error loading the remote package list. Got: <br />" . htmlToString($strResponse, true), class_exception::$level_ERROR); } $objRemoteParser = class_module_packagemanager_remoteparser_factory::getRemoteParser($arrResponse, $this->getPageNumber(), $intStart, $intEnd, get_class($this), "&name=" . urlencode($this->getParam("name")) . "&type=" . $this->getParam("type")); $arrPackages = $objRemoteParser->getArrPackages(); $strReturn = $this->createFilterCriteria(); $strReturn .= $objToolkit->listHeader(); if (!$this->containsItems($arrPackages)) { $strReturn .= $objToolkit->getTextRow($objLang->getLang("commons_list_empty", null)); } else { $intI = 0; foreach ($arrPackages as $arrOnePackage) { //check if already installed locally if ($objManager->getPackage($arrOnePackage["title"]) !== null) { $strAction = $objToolkit->listButton(getImageAdmin("icon_installDisabled", $objLang->getLang("package_noinstall_installed", self::$STR_MODULE_NAME))); } else { $strAction = $objToolkit->listButton(getLinkAdmin(self::$STR_MODULE_NAME, "uploadPackage", "provider=" . get_class($this) . "&systemid=" . $arrOnePackage["systemid"], $objLang->getLang("package_install", self::$STR_MODULE_NAME), $objLang->getLang("package_install", self::$STR_MODULE_NAME), "icon_install")); } $strIcon = "icon_module"; if ($arrOnePackage["type"] == "TEMPLATE") { $strIcon = "icon_dot"; } $arrOnePackage["version"] = $objLang->getLang("type_" . $arrOnePackage["type"], self::$STR_MODULE_NAME) . ", V " . $arrOnePackage["version"]; $strReturn .= $objToolkit->genericAdminList($arrOnePackage["systemid"], $arrOnePackage["title"], getImageAdmin($strIcon), $strAction, $intI++, $arrOnePackage["version"], $arrOnePackage["description"]); } } $strReturn .= $objToolkit->listFooter(); $strReturn .= $objRemoteParser->paginationFooter(); return $strReturn; }
public function sendContent() { ignore_user_abort(true); if (trim($this->strContent) != "") { echo $this->strContent; @ob_flush(); @flush(); } else { header("Content-Length: 0"); header("Content-Encoding: none"); header("Connection: close"); @ob_end_flush(); @ob_flush(); @flush(); } if (!class_session::getInstance()->getBitClosed()) { class_session::getInstance()->sessionClose(); } }
/** * Generates a new SystemRecord and, if needed, the corresponding record in the rights-table (here inheritance is default) * Returns the systemID used for this record * * @param string $strPrevId Previous ID in the tree-structure * @param string $strComment Comment to identify the record * @return string The ID used/generated * * * @todo find ussages and make private */ private function createSystemRecord($strPrevId, $strComment) { $strSystemId = generateSystemid(); $this->setStrSystemid($strSystemId); //Correct prevID if ($strPrevId == "") { $strPrevId = 0; } $this->setStrPrevId($strPrevId); //determine the correct new sort-id - append by default if (class_module_system_module::getModuleByName("system") != null && version_compare(class_module_system_module::getModuleByName("system")->getStrVersion(), "4.7.5", "lt")) { $strQuery = "SELECT COUNT(*) FROM " . _dbprefix_ . "system WHERE system_prev_id = ? AND system_id != '0'"; } else { $strQuery = "SELECT COUNT(*) FROM " . _dbprefix_ . "system WHERE system_prev_id = ? AND system_id != '0' AND system_deleted = 0"; } $arrRow = $this->objDB->getPRow($strQuery, array($strPrevId), 0, false); $intSiblings = $arrRow["COUNT(*)"]; $strComment = uniStrTrim(strip_tags($strComment), 240); if (class_module_system_module::getModuleByName("system") != null && version_compare(class_module_system_module::getModuleByName("system")->getStrVersion(), "4.7.5", "lt")) { //So, lets generate the record $strQuery = "INSERT INTO " . _dbprefix_ . "system\n ( system_id, system_prev_id, system_module_nr, system_owner, system_create_date, system_lm_user,\n system_lm_time, system_status, system_comment, system_sort, system_class) VALUES\n (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; //Send the query to the db $this->objDB->_pQuery($strQuery, array($strSystemId, $strPrevId, $this->getIntModuleNr(), $this->objSession->getUserID(), class_date::getCurrentTimestamp(), $this->objSession->getUserID(), time(), (int) $this->getIntRecordStatus(), $strComment, $this->getNextSortValue($strPrevId), $this->getStrRecordClass())); } else { //So, lets generate the record $strQuery = "INSERT INTO " . _dbprefix_ . "system\n ( system_id, system_prev_id, system_module_nr, system_owner, system_create_date, system_lm_user,\n system_lm_time, system_status, system_comment, system_sort, system_class, system_deleted) VALUES\n (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; //Send the query to the db $this->objDB->_pQuery($strQuery, array($strSystemId, $strPrevId, $this->getIntModuleNr(), $this->objSession->getUserID(), class_date::getCurrentTimestamp(), $this->objSession->getUserID(), time(), (int) $this->getIntRecordStatus(), $strComment, (int) ($intSiblings + 1), $this->getStrRecordClass(), $this->getIntRecordDeleted())); } //we need a Rights-Record $this->objDB->_pQuery("INSERT INTO " . _dbprefix_ . "system_right (right_id, right_inherit) VALUES (?, 1)", array($strSystemId)); //update rights to inherit class_carrier::getInstance()->getObjRights()->setInherited(true, $strSystemId); class_logger::getInstance()->addLogRow("new system-record created: " . $strSystemId . " (" . $strComment . ")", class_logger::$levelInfo); $this->objDB->flushQueryCache(); $this->internalInit(); //reset the old values since we're having a new record $this->strOldPrevId = -1; $this->intOldRecordStatus = -1; return $strSystemId; }
/** * Looks up the real filename of a template passed. * The filename is the relative path, so adding /templates/[packname] is not required and not allowed. * * @param string $strTemplateName * @param bool $bitScanAdminSkin * * @throws class_exception * @return string The path on the filesystem, relative to the root-folder. Null if the file could not be mapped. */ public function getTemplate($strTemplateName, $bitScanAdminSkin = false) { $strTemplateName = removeDirectoryTraversals($strTemplateName); if (isset($this->arrTemplates[$strTemplateName])) { return $this->arrTemplates[$strTemplateName]; } $this->bitCacheSaveRequired = true; $strFilename = null; //first try: load the file in the current template-pack $strDefaultTemplate = class_module_system_setting::getConfigValue("_packagemanager_defaulttemplate_"); if (is_file(_realpath_ . _templatepath_ . "/" . $strDefaultTemplate . "/tpl" . $strTemplateName)) { $this->arrTemplates[$strTemplateName] = _templatepath_ . "/" . $strDefaultTemplate . "/tpl" . $strTemplateName; return _templatepath_ . "/" . $strDefaultTemplate . "/tpl" . $strTemplateName; } //second try: load the file from the default-pack if (is_file(_realpath_ . _templatepath_ . "/default/tpl" . $strTemplateName)) { $this->arrTemplates[$strTemplateName] = _templatepath_ . "/default/tpl" . $strTemplateName; return _templatepath_ . "/default/tpl" . $strTemplateName; } //third try: try to load the file from a given module foreach ($this->arrModules as $strCorePath => $strOneModule) { if (is_file(_realpath_ . "/" . $strCorePath . "/templates/default/tpl" . $strTemplateName)) { $strFilename = "/" . $strCorePath . "/templates/default/tpl" . $strTemplateName; break; } } if ($bitScanAdminSkin) { if (is_file(_realpath_ . class_adminskin_helper::getPathForSkin(class_session::getInstance()->getAdminSkin()) . $strTemplateName)) { $strFilename = class_adminskin_helper::getPathForSkin(class_session::getInstance()->getAdminSkin()) . $strTemplateName; } } if ($strFilename === null) { throw new class_exception("Required file " . $strTemplateName . " could not be mapped on the filesystem.", class_exception::$level_ERROR); } $this->arrTemplates[$strTemplateName] = $strFilename; return $strFilename; }
/** * @return string */ public function getReport() { $strReturn = ""; $arrData = $this->getTotalUniqueHostsInInterval(); $arrLogs = array(); $intI = 0; $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); foreach ($arrData as $arrOneLog) { if ($intI++ >= $objUser->getIntItemsPerPage()) { break; } $arrLogs[$intI][0] = $intI; $arrLogs[$intI][1] = $arrOneLog["log_hostname"]; $arrLogs[$intI][2] = $arrOneLog["anzahl"]; } //Create a data-table $arrHeader = array(); $arrHeader[0] = "#"; $arrHeader[1] = $this->objLang->getLang("packageservertopqueries_header_host", "packageserver"); $arrHeader[2] = $this->objLang->getLang("packageservertopqueries_header_requests", "packageserver"); $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrLogs); return $strReturn; }
private function loadPostLoginSite() { //any url to redirect? if ($this->objSession->getSession(self::SESSION_REFERER) != "" && $this->objSession->getSession(self::SESSION_REFERER) != "admin=1") { class_response_object::getInstance()->setStrRedirectUrl(_indexpath_ . "?" . $this->objSession->getSession(self::SESSION_REFERER)); $this->objSession->sessionUnset(self::SESSION_REFERER); $this->objSession->setSession(self::SESSION_LOAD_FROM_PARAMS, "true"); } else { //route to the default module $strModule = "dashboard"; if (class_session::getInstance()->isLoggedin()) { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); if ($objUser->getStrAdminModule() != "") { $strModule = $objUser->getStrAdminModule(); } } class_response_object::getInstance()->setStrRedirectUrl(class_link::getLinkAdminHref($strModule)); } }
/** * A internal helper to verify if the passed user is allowed to view the listed systemids * * @param $strValidateId * @param class_module_user_user $objUser * * @return bool */ private function hasUserViewPermissions($strValidateId, class_module_user_user $objUser) { $objInstance = class_objectfactory::getInstance()->getObject($strValidateId); if ($objInstance != null) { $objCurUser = new class_module_user_user($this->objSession->getUserID()); try { class_session::getInstance()->switchSessionToUser($objUser, true); if ($objInstance->rightView()) { class_session::getInstance()->switchSessionToUser($objCurUser, true); return true; } } catch (Exception $objEx) { } class_session::getInstance()->switchSessionToUser($objCurUser, true); } return false; }
/** * Constructor * * @param $arrElements * * @return \class_array_iterator */ public function __construct($arrElements) { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $this->intElementsPerPage = $objUser->getIntItemsPerPage(); $this->setArrElements($arrElements); }
/** * Loads the records of the dl-logbook * * @return mixed */ private function getLogbookData() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT *\n\t\t\t\t\t FROM " . _dbprefix_ . "mediamanager_dllog\n\t\t\t\t\t WHERE downloads_log_date > ?\n\t\t\t\t\t\t\tAND downloads_log_date <= ?\n\t\t\t\t\t ORDER BY downloads_log_date DESC"; $arrReturn = $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); foreach ($arrReturn as &$arrOneRow) { //Load hostname, if available. faster, then mergin per LEFT JOIN $arrOneRow["stats_hostname"] = null; $strQuery = "SELECT stats_hostname\n \t\t FROM " . _dbprefix_ . "stats_data\n \t\t WHERE stats_ip = ?\n \t\t GROUP BY stats_hostname"; $arrRow = $this->objDB->getPRow($strQuery, array($arrOneRow["downloads_log_ip"])); if (isset($arrRow["stats_hostname"])) { $arrOneRow["stats_hostname"] = $arrRow["stats_hostname"]; } } return $arrReturn; }
/** * Adds the portal-editor code to the current page-output - if all requirements are given * * @param class_module_pages_page $objPageData * @param bool $bitEditPermissionOnMasterPage * @param string $strPageContent * * @return string */ private function renderPortalEditorCode(class_module_pages_page $objPageData, $bitEditPermissionOnMasterPage, $strPageContent) { //add the portaleditor toolbar if (class_module_system_setting::getConfigValue("_pages_portaleditor_") == "false") { return $strPageContent; } if (!$this->objSession->isAdmin()) { return $strPageContent; } if (!$objPageData->rightEdit() && !$bitEditPermissionOnMasterPage) { return $strPageContent; } class_adminskin_helper::defineSkinWebpath(); //save back the current portal text language and set the admin-one $strPortalLanguage = class_carrier::getInstance()->getObjLang()->getStrTextLanguage(); class_carrier::getInstance()->getObjLang()->setStrTextLanguage($this->objSession->getAdminLanguage()); if ($this->objSession->getSession("pe_disable") != "true") { $strPeToolbar = ""; $arrPeContents = array(); $arrPeContents["pe_status_page_val"] = $objPageData->getStrName(); $arrPeContents["pe_status_status_val"] = $objPageData->getIntRecordStatus() == 1 ? "active" : "inactive"; $arrPeContents["pe_status_autor_val"] = $objPageData->getLastEditUser(); $arrPeContents["pe_status_time_val"] = timeToString($objPageData->getIntLmTime(), false); $arrPeContents["pe_dialog_close_warning"] = $this->getLang("pe_dialog_close_warning", "pages"); //Add an iconbar $arrPeContents["pe_iconbar"] = ""; $arrPeContents["pe_iconbar"] .= class_link::getLinkAdmin("pages_content", "list", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage, $this->getLang("pe_icon_edit"), $this->getLang("pe_icon_edit", "pages"), "icon_page"); $arrPeContents["pe_iconbar"] .= " "; $strEditUrl = class_link::getLinkAdminHref("pages", "editPage", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage . "&pe=1"); $arrPeContents["pe_iconbar"] .= "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strEditUrl . "'); return false;\">" . class_adminskin_helper::getAdminImage("icon_edit", $this->getLang("pe_icon_page", "pages")) . "</a>"; $arrPeContents["pe_iconbar"] .= " "; $strEditUrl = class_link::getLinkAdminHref("pages", "newPage", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage . "&pe=1"); $arrPeContents["pe_iconbar"] .= "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strEditUrl . "'); return false;\">" . class_adminskin_helper::getAdminImage("icon_new", $this->getLang("pe_icon_new", "pages")) . "</a>"; $arrPeContents["pe_disable"] = "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.switchEnabled(false); return false;\" title=\"\">" . class_adminskin_helper::getAdminImage("icon_enabled", $this->getLang("pe_disable", "pages")) . "</a>"; //Load portaleditor javascript (even if it's maybe already loaded in portal and init the ckeditor) $strTemplateInitID = $this->objTemplate->readTemplate("/elements.tpl", "wysiwyg_ckeditor_inits"); $strSkinInit = $this->objTemplate->fillTemplate(array(), $strTemplateInitID); $strConfigFile = "'config_kajona_standard.js'"; if (is_file(_realpath_ . "/project/admin/scripts/ckeditor/config_kajona_standard.js")) { $strConfigFile = "KAJONA_WEBPATH+'/project/admin/scripts/ckeditor/config_kajona_standard.js'"; } $strPeToolbar .= "<script type='text/javascript'>\n KAJONA.admin.lang.pe_rte_unsavedChanges = '" . $this->getLang("pe_rte_unsavedChanges", "pages") . "';\n\n if(\$) {\n KAJONA.portal.loader.loadFile([\n '/core/module_pages/admin/scripts/kajona_portaleditor.js',\n '/core/module_system/admin/scripts/jqueryui/jquery-ui.custom.min.js',\n '/core/module_system/admin/scripts/jqueryui/css/smoothness/jquery-ui.custom.css'\n ], function() {\n KAJONA.admin.portaleditor.RTE.config = {\n language : '" . (class_session::getInstance()->getAdminLanguage() != "" ? class_session::getInstance()->getAdminLanguage() : "en") . "',\n filebrowserBrowseUrl : '" . uniStrReplace("&", "&", class_link::getLinkAdminHref("folderview", "browserChooser", "&form_element=ckeditor")) . "',\n filebrowserImageBrowseUrl : '" . uniStrReplace("&", "&", class_link::getLinkAdminHref("mediamanager", "folderContentFolderviewMode", "systemid=" . class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_") . "&form_element=ckeditor&bit_link=1")) . "',\n customConfig : {$strConfigFile},\n " . $strSkinInit . "\n }\n \$(KAJONA.admin.portaleditor.initPortaleditor);\n });\n }\n else {\n KAJONA.portal.loader.loadFile([\n '/core/module_system/admin/scripts/jquery/jquery.min.js',\n '/core/module_system/admin/scripts/jqueryui/jquery-ui.custom.min.js',\n '/core/module_pages/admin/scripts/kajona_portaleditor.js',\n '/core/module_system/admin/scripts/jqueryui/css/smoothness/jquery-ui.custom.css'\n ], function() {\n KAJONA.admin.portaleditor.RTE.config = {\n language : '" . (class_session::getInstance()->getAdminLanguage() != "" ? class_session::getInstance()->getAdminLanguage() : "en") . "',\n filebrowserBrowseUrl : '" . uniStrReplace("&", "&", class_link::getLinkAdminHref("folderview", "browserChooser", "&form_element=ckeditor")) . "',\n filebrowserImageBrowseUrl : '" . uniStrReplace("&", "&", class_link::getLinkAdminHref("mediamanager", "folderContentFolderviewMode", "systemid=" . class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_") . "&form_element=ckeditor&bit_link=1")) . "',\n " . $strSkinInit . "\n }\n \$(KAJONA.admin.portaleditor.initPortaleditor);\n });\n }\n </script>"; //Load portaleditor styles $strPeToolbar .= $this->objToolkit->getPeBasicData(); $strPeToolbar .= $this->objToolkit->getPeToolbar($arrPeContents); $objScriptlets = new class_scriptlet_helper(); $strPeToolbar = $objScriptlets->processString($strPeToolbar, interface_scriptlet::BIT_CONTEXT_ADMIN); //The toolbar has to be added right after the body-tag - to generate correct html-code $strTemp = uniSubstr($strPageContent, uniStrpos($strPageContent, "<body")); //find closing bracket $intTemp = uniStrpos($strTemp, ">") + 1; //and insert the code $strPageContent = uniSubstr($strPageContent, 0, uniStrpos($strPageContent, "<body") + $intTemp) . $strPeToolbar . uniSubstr($strPageContent, uniStrpos($strPageContent, "<body") + $intTemp); } else { //Button to enable the toolbar & pe $strEnableButton = "<div id=\"peEnableButton\" style=\"z-index: 1000; position: fixed; top: 0px; right: 0px;\"><a href=\"#\" onclick=\"KAJONA.admin.portaleditor.switchEnabled(true); return false;\" title=\"\">" . getImageAdmin("icon_disabled", $this->getLang("pe_enable", "pages")) . "</a></div>"; //Load portaleditor javascript $strEnableButton .= "\n<script type=\"text/javascript\" src=\"" . _webpath_ . "/core/module_pages/admin/scripts/kajona_portaleditor.js?" . class_module_system_setting::getConfigValue("_system_browser_cachebuster_") . "\"></script>"; $strEnableButton .= $this->objToolkit->getPeBasicData(); //Load portaleditor styles //The toobar has to be added right after the body-tag - to generate correct html-code $strTemp = uniSubstr($strPageContent, uniStripos($strPageContent, "<body")); //find closing bracket $intTemp = uniStripos($strTemp, ">") + 1; //and insert the code $strPageContent = uniSubstr($strPageContent, 0, uniStrpos($strPageContent, "<body") + $intTemp) . $strEnableButton . uniSubstr($strPageContent, uniStrpos($strPageContent, "<body") + $intTemp); } //reset the portal texts language class_carrier::getInstance()->getObjLang()->setStrTextLanguage($strPortalLanguage); return $strPageContent; }
/** * Loads the records of the dl-logbook * * @return mixed */ private function getLogbookData() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT COUNT(*) as amount, downloads_log_file\n\t\t\t\t\t FROM " . _dbprefix_ . "mediamanager_dllog\n\t\t\t\t\t WHERE downloads_log_date > ?\n\t\t\t\t AND downloads_log_date <= ?\n\t\t\t\t\t GROUP BY downloads_log_file\n\t\t\t\t\t ORDER BY amount DESC"; return $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); }
/** * Returns a text-field using the cool WYSIWYG editor * You can use the different toolbar sets defined in /admin/scripts/ckeditor/config.js * * @param string $strName * @param string $strTitle * @param string $strContent * @param string $strToolbarset * * @return string */ public function formWysiwygEditor($strName = "inhalt", $strTitle = "", $strContent = "", $strToolbarset = "standard") { $strReturn = ""; //create the html-input element $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "wysiwyg_ckeditor"); $arrTemplate = array(); $arrTemplate["name"] = $strName; $arrTemplate["title"] = $strTitle; $arrTemplate["editorid"] = generateSystemid(); $arrTemplate["content"] = htmlentities($strContent, ENT_COMPAT, "UTF-8"); $strReturn .= $this->objTemplate->fillTemplate($arrTemplate, $strTemplateID); //for the popups, we need the skinwebpath $strReturn .= $this->formInputHidden("skinwebpath", _skinwebpath_); //set the language the user defined for the admin $strLanguage = class_session::getInstance()->getAdminLanguage(); if ($strLanguage == "") { $strLanguage = "en"; } //include the settings made by admin skin $strTemplateInitID = $this->objTemplate->readTemplate("/elements.tpl", "wysiwyg_ckeditor_inits"); $strTemplateInit = $this->objTemplate->fillTemplate(array(), $strTemplateInitID); //check if a customized editor-config is available $strConfigFile = "'config_kajona_standard.js'"; if (is_file(_realpath_ . "/project/admin/scripts/ckeditor/config_kajona_standard.js")) { $strConfigFile = "KAJONA_WEBPATH+'/project/admin/scripts/ckeditor/config_kajona_standard.js'"; } //to add role-based editors, you could load a different toolbar or also a different CKEditor config file //the editor code $strReturn .= " <script type=\"text/javascript\" src=\"" . _webpath_ . class_resourceloader::getInstance()->getCorePathForModule("module_system") . "/module_system/admin/scripts/ckeditor/ckeditor.js\"></script>\n"; $strReturn .= " <script type=\"text/javascript\">\n"; $strReturn .= "\r\n var ckeditorConfig = {\r\n customConfig : " . $strConfigFile . ",\r\n toolbar : '" . $strToolbarset . "',\r\n " . $strTemplateInit . "\r\n language : '" . $strLanguage . "',\r\n filebrowserBrowseUrl : '" . uniStrReplace("&", "&", getLinkAdminHref("folderview", "browserChooser", "&form_element=ckeditor")) . "',\r\n filebrowserImageBrowseUrl : '" . uniStrReplace("&", "&", getLinkAdminHref("mediamanager", "folderContentFolderviewMode", "systemid=" . class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_") . "&form_element=ckeditor&bit_link=1")) . "'\r\n\t };\r\n CKEDITOR.replace(\$(\"textarea[name='" . $strName . "'][data-kajona-editorid='" . $arrTemplate["editorid"] . "']\")[0], ckeditorConfig);\r\n "; $strReturn .= "</script>\n"; return $strReturn; }
/** * Managing access to the session object. Use ONLY this method to * get an instance! * * @return class_session */ public function getObjSession() { //Do we have to generate the object? if ($this->objSession == null) { $this->objSession = class_session::getInstance(); } return $this->objSession; }
/** * @return string */ public function getReport() { $strReturn = ""; //Create Data-table $arrHeader = array(); $arrValues = array(); //Fetch data $arrStats = $this->getTopVisitors(); //calc a few values $intSum = 0; foreach ($arrStats as $arrOneStat) { $intSum += $arrOneStat["anzahl"]; } $intI = 0; $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); foreach ($arrStats as $arrOneStat) { //Escape? if ($intI >= $objUser->getIntItemsPerPage()) { break; } $arrValues[$intI] = array(); $arrValues[$intI][] = $intI + 1; if ($arrOneStat["stats_hostname"] != "" and $arrOneStat["stats_hostname"] != "na") { $arrValues[$intI][] = $arrOneStat["stats_hostname"]; } else { $arrValues[$intI][] = $arrOneStat["stats_ip"]; } $arrValues[$intI][] = $arrOneStat["anzahl"]; $arrValues[$intI][] = $this->objToolkit->percentBeam($arrOneStat["anzahl"] / $intSum * 100); $strUtraceLinkMap = "href=\"http://www.utrace.de/ip-adresse/" . $arrOneStat["stats_ip"] . "\" target=\"_blank\""; $strUtraceLinkText = "href=\"http://www.utrace.de/whois/" . $arrOneStat["stats_ip"] . "\" target=\"_blank\""; if ($arrOneStat["stats_ip"] != "127.0.0.1" && $arrOneStat["stats_ip"] != "::1") { $arrValues[$intI][] = class_link::getLinkAdminManual($strUtraceLinkMap, "", $this->objLang->getLang("login_utrace_showmap", "user"), "icon_earth") . " " . class_link::getLinkAdminManual($strUtraceLinkText, "", $this->objLang->getLang("login_utrace_showtext", "user"), "icon_text"); } else { $arrValues[$intI][] = getImageAdmin("icon_earthDisabled", $this->objLang->getLang("login_utrace_noinfo", "user")) . " " . getImageAdmin("icon_textDisabled", $this->objLang->getLang("login_utrace_noinfo", "user")); } $intI++; } //HeaderRow $arrHeader[] = "#"; $arrHeader[] = $this->objLang->getLang("top_visitor_titel", "stats"); $arrHeader[] = $this->objLang->getLang("commons_hits_header", "stats"); $arrHeader[] = $this->objLang->getLang("anteil", "stats"); $arrHeader[] = $this->objLang->getLang("login_utrace", "user"); $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrValues); $strReturn .= $this->objToolkit->getTextRow($this->objLang->getLang("stats_hint_task", "stats")); return $strReturn; }
/** * Returns the pages and their hits * * @return mixed */ public function getTopSessions() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT stats_session,\n stats_ip,\n stats_hostname,\n MIN(stats_date) AS startdate,\n MAX(stats_date) AS enddate,\n COUNT(*) AS anzahl,\n MAX(stats_date)-MIN(stats_date) AS dauer\n\n\n FROM " . _dbprefix_ . "stats_data\n WHERE stats_date > ?\n\t\t\t\t\t AND stats_date <= ?\n GROUP BY stats_session, stats_ip, stats_hostname\n ORDER BY enddate DESC"; $arrSessions = $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); $intI = 0; foreach ($arrSessions as $intKey => $arrOneSession) { if ($intI++ >= $objUser->getIntItemsPerPage()) { break; } //Load the details for all sessions $strDetails = ""; $strSessionID = $arrOneSession["stats_session"]; $strDetails .= $this->objTexts->getLang("top_session_detail_start", "stats") . timeToString($arrOneSession["startdate"]) . "<br />"; $strDetails .= $this->objTexts->getLang("top_session_detail_end", "stats") . timeToString($arrOneSession["enddate"]) . "<br />"; $strDetails .= $this->objTexts->getLang("top_session_detail_time", "stats") . $arrOneSession["dauer"] . "<br />"; $strDetails .= $this->objTexts->getLang("top_session_detail_ip", "stats") . $arrOneSession["stats_ip"] . "<br />"; $strDetails .= $this->objTexts->getLang("top_session_detail_hostname", "stats") . $arrOneSession["stats_hostname"] . "<br />"; //and fetch all pages $strQuery = "SELECT stats_page\n FROM " . _dbprefix_ . "stats_data\n WHERE stats_session= ?\n ORDER BY stats_date ASC"; $arrPages = $this->objDB->getPArray($strQuery, array($strSessionID)); $strDetails .= $this->objTexts->getLang("top_session_detail_verlauf", "stats"); foreach ($arrPages as $arrOnePage) { $strDetails .= $arrOnePage["stats_page"] . " - "; } $strDetails = uniSubstr($strDetails, 0, -2); $arrFolder = $this->objToolkit->getLayoutFolder($strDetails, $this->objTexts->getLang("top_session_detail", "stats")); $arrSessions[$intKey]["detail"] = $arrFolder[1] . $arrFolder[0]; } return $arrSessions; }
/** * Wrapper to load a single element and generate the image * @return void */ private function generateMediamanagerImage() { if (class_module_system_module::getModuleByName("mediamanager") !== null) { $objElement = new class_module_pages_pageelement($this->strElementId); $objPortalElement = $objElement->getConcretePortalInstance(); $objFile = new class_module_mediamanager_file($this->strSystemid); if (!$objFile->rightView()) { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_FORBIDDEN); class_response_object::getInstance()->sendHeaders(); return; } $arrElementData = $objPortalElement->getElementContent($objElement->getSystemid()); class_session::getInstance()->sessionClose(); if (is_file(_realpath_ . $objFile->getStrFilename())) { $objImage = new class_image2(); $objImage->load($objFile->getStrFilename()); $objImage->addOperation(new class_image_scale($arrElementData["gallery_maxw_d"], $arrElementData["gallery_maxh_d"])); $objImage->addOperation(new class_image_text($arrElementData["gallery_text"], $arrElementData["gallery_text_x"], $arrElementData["gallery_text_y"], 10, "#ffffff")); if (is_file(_realpath_ . $arrElementData["gallery_overlay"])) { $objImageOverlay = new class_image2(); $objImageOverlay->load($arrElementData["gallery_overlay"]); $objImage->addOperation(new class_image_overlay($arrElementData["gallery_overlay"], $arrElementData["gallery_text_x"], $arrElementData["gallery_text_y"])); } $objImage->setJpegQuality((int) $this->intQuality); $objImage->sendToBrowser(); return; } } class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND); class_response_object::getInstance()->sendHeaders(); }
/** * returns a list of top-referer * * @return mixed */ public function getTopReferer() { //Build excluded domains $arrBlocked = explode(",", class_module_system_setting::getConfigValue("_stats_exclusionlist_")); $arrParams = array("%" . str_replace("%", "\\%", _webpath_) . "%", $this->intDateStart, $this->intDateEnd); $strExclude = ""; foreach ($arrBlocked as $strBlocked) { if ($strBlocked != "") { $strExclude .= " AND stats_referer NOT LIKE ? \n"; $arrParams[] = "%" . str_replace("%", "\\%", $strBlocked) . "%"; } } $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT stats_referer as refurl, COUNT(*) as anzahl\n\t\t\t\t\t\tFROM " . _dbprefix_ . "stats_data\n\t\t\t\t\t\tWHERE stats_referer NOT LIKE ?\n\t\t\t\t\t\t\tAND stats_date > ?\n\t\t\t\t\t\t\tAND stats_date <= ?\n\t\t\t\t\t\t\t" . $strExclude . "\n\t\t\t\t\t\tGROUP BY stats_referer\n\t\t\t\t\t\tORDER BY anzahl desc"; return $this->objDB->getPArray($strQuery, $arrParams, 0, $objUser->getIntItemsPerPage() - 1); }
/** * @return string */ public function getReport() { $strReturn = ""; //Create Data-table $arrHeader = array(); $arrValues = array(); //Fetch data $arrStats = $this->getTopQueries(); //calc a few values $intSum = 0; foreach ($arrStats as $intHits) { $intSum += $intHits; } $intI = 0; $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); foreach ($arrStats as $strKey => $intHits) { //Escape? if ($intI >= $objUser->getIntItemsPerPage()) { break; } $arrValues[$intI] = array(); $arrValues[$intI][] = $intI + 1; $arrValues[$intI][] = $strKey; $arrValues[$intI][] = $intHits; $arrValues[$intI][] = $this->objToolkit->percentBeam($intHits / $intSum * 100); $intI++; } //HeaderRow $arrHeader[] = "#"; $arrHeader[] = $this->objTexts->getLang("top_query_titel", "stats"); $arrHeader[] = $this->objTexts->getLang("top_query_gewicht", "stats"); $arrHeader[] = $this->objTexts->getLang("anteil", "stats"); $strReturn .= $this->objToolkit->dataTable($arrHeader, $arrValues); return $strReturn; }
/** * Creates a list of the recent messages for the current user. * The structure is returned in an json-format. * * @permissions view * @xml * @autoTestable * * @return string */ protected function actionGetRecentMessages() { class_carrier::getInstance()->getObjSession()->setBitBlockDbUpdate(true); class_session::getInstance()->sessionClose(); class_module_system_changelog::$bitChangelogEnabled = false; class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON); $intMaxAmount = $this->getParam("limit") != "" ? $this->getParam("limit") : 5; $arrMessages = class_module_messaging_message::getObjectList($this->objSession->getUserID(), 0, $intMaxAmount - 1); $arrReturn = array(); foreach ($arrMessages as $objOneMessage) { $arrReturn[] = array("systemid" => $objOneMessage->getSystemid(), "title" => $objOneMessage->getStrDisplayName(), "unread" => $objOneMessage->getBitRead(), "details" => class_link::getLinkAdminHref($objOneMessage->getArrModule("modul"), "edit", "&systemid=" . $objOneMessage->getSystemid(), false)); } $arrReturn = array("messages" => $arrReturn, "messageCount" => class_module_messaging_message::getNumberOfMessagesForUser($this->objSession->getUserID(), true)); return json_encode($arrReturn); }
/** * @param bool $intStart * @param bool $intEnd * * @return array */ private function getTopQueries($intStart = false, $intEnd = false) { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT search_log_query, COUNT(*) as hits\n\t\t\t\t\t FROM " . _dbprefix_ . "search_log\n\t\t\t\t\t WHERE search_log_date > ?\n\t\t\t\t\t AND search_log_date <= ?\n\t\t\t\t GROUP BY search_log_query\n\t\t\t\t ORDER BY hits DESC"; if ($intStart !== false && $intEnd !== false) { $arrReturn = $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), $intStart, $intEnd); } else { $arrReturn = $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); } return $arrReturn; }
/** * returns the full portal history array * * @return string[] */ public function getArrPortalHistory() { return $this->objSession->getSession(self::STR_PORTAL_SESSION_KEY); }
/** * Returns the pages and their hits * * @return mixed */ public function getTopPages() { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); $strQuery = "SELECT stats_page as name, count(*) as anzahl, stats_language as language\n\t\t\t\t\t\tFROM " . _dbprefix_ . "stats_data\n\t\t\t\t\t\tWHERE stats_date > ?\n\t\t\t\t\t\t\t\tAND stats_date <= ?\n\t\t\t\t\t\tGROUP BY stats_page, stats_language\n\t\t\t\t\t\t\tORDER BY anzahl desc"; return $this->objDB->getPArray($strQuery, array($this->intDateStart, $this->intDateEnd), 0, $objUser->getIntItemsPerPage() - 1); }
/** * Generates the list of favorite tags for the current user. * Returned structure is json based. * * @return string * @permissions view */ protected function actionGetFavoriteTags() { class_session::getInstance()->sessionClose(); class_carrier::getInstance()->getObjSession()->setBitBlockDbUpdate(true); class_module_system_changelog::$bitChangelogEnabled = false; $arrReturn = array(); $arrFavorites = class_module_tags_favorite::getAllFavoritesForUser(class_carrier::getInstance()->getObjSession()->getUserID(), 0, 10); foreach ($arrFavorites as $objOneFavorite) { $arrReturn[] = array("name" => $objOneFavorite->getStrDisplayName(), "onclick" => "location.href='" . getLinkAdminHref("tags", "showAssignedRecords", "&systemid=" . $objOneFavorite->getMappedTagSystemid(), false) . "'", "url" => getLinkAdminHref("tags", "showAssignedRecords", "&systemid=" . $objOneFavorite->getMappedTagSystemid(), false)); } class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON); return json_encode($arrReturn); }